From dcd95dbcfe42ff85e10c12fbfe24ce332fd417f3 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sun, 26 Jan 2025 16:32:53 +0800 Subject: [PATCH 1/5] Revert "fix: memory leak in LaunchActivity (#28)" This reverts commit f3568041ffc2a83ef1a6848a6755ac31e622cefe. --- TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java | 1 - 1 file changed, 1 deletion(-) diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java index e706eb163b..1871e6d847 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java @@ -6652,7 +6652,6 @@ protected void onDestroy() { } catch (Exception e) { FileLog.e(e); } - clearFragments(); super.onDestroy(); onFinish(); FloatingDebugController.onDestroy(); From 5f52253ea2300a031855a59543bdd2b8bdb3f312 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sun, 26 Jan 2025 16:49:06 +0800 Subject: [PATCH 2/5] chore: update dependencies --- TMessagesProj/build.gradle | 92 +++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 47 deletions(-) diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 3e50875bac..0b3020b023 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -257,32 +257,61 @@ def crashlyticsVersion = "18.6.2" def playCoreVersion = "1.10.3" dependencies { - - implementation "androidx.browser:browser:1.5.0" implementation 'androidx.fragment:fragment:1.2.0' - implementation "androidx.core:core-ktx:1.9.0" + implementation "androidx.core:core-ktx:1.10.1" implementation "androidx.palette:palette-ktx:1.0.0" - implementation "androidx.viewpager:viewpager:1.0.0" implementation "androidx.exifinterface:exifinterface:1.3.7" - implementation "androidx.interpolator:interpolator:1.0.0" - implementation 'androidx.biometric:biometric:1.1.0' implementation "androidx.dynamicanimation:dynamicanimation:1.0.0" implementation "androidx.multidex:multidex:2.0.1" implementation "androidx.sharetarget:sharetarget:1.2.0" + implementation "androidx.interpolator:interpolator:1.0.0" + implementation 'androidx.biometric:biometric:1.1.0' - // just follow official compileOnly 'org.checkerframework:checker-qual:2.5.2' compileOnly 'org.checkerframework:checker-compat-qual:2.5.0' - - // don"t change this :) - //noinspection GradleDependency + implementation "com.google.firebase:firebase-messaging:$fcmVersion" + implementation "com.google.firebase:firebase-crashlytics:$crashlyticsVersion" + implementation 'com.google.android.gms:play-services-vision:20.1.3' + implementation 'com.google.android.gms:play-services-maps:18.1.0' + implementation 'com.google.android.gms:play-services-auth:20.4.0' + implementation 'com.google.android.gms:play-services-vision:20.1.3' + implementation 'com.google.android.gms:play-services-wearable:18.0.0' + implementation 'com.google.android.gms:play-services-location:21.0.1' + implementation 'com.google.android.gms:play-services-wallet:19.1.0' implementation "com.googlecode.mp4parser:isoparser:1.0.6" - + implementation 'com.stripe:stripe-android:2.0.2' + // add for auto translate + implementation 'com.google.mlkit:language-id:17.0.6' + implementation 'com.android.billingclient:billing:6.0.1' implementation "com.google.code.gson:gson:2.11.0" - implementation "org.osmdroid:osmdroid-android:6.1.10" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.23" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0" + implementation 'com.google.guava:guava:31.1-android' + implementation 'com.google.android.play:integrity:1.3.0' + implementation 'com.google.android.gms:play-services-safetynet:18.0.1' + implementation 'com.google.android.gms:play-services-mlkit-subject-segmentation:16.0.0-beta1' + implementation 'com.google.android.gms:play-services-mlkit-image-labeling:16.0.8' +// constraints { +// implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0") { +// because("kotlin-stdlib-jdk7 is now a part of kotlin-stdlib") +// } + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0") { + because("kotlin-stdlib-jdk8 is now a part of kotlin-stdlib") + } +// } + + testImplementation "junit:junit:4.13.2" + testImplementation "androidx.test:core:1.5.0" + testImplementation "org.robolectric:robolectric:4.5.1" + + coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.2.0" +} +dependencies { + implementation "androidx.browser:browser:1.5.0" + implementation "androidx.viewpager:viewpager:1.0.0" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0" + // OSM + implementation "org.osmdroid:osmdroid-android:6.1.10" + // okhttp implementation "com.squareup.okhttp3:okhttp:5.0.0-alpha.10" implementation 'com.neovisionaries:nv-websocket-client:2.14' implementation 'dnsjava:dnsjava:3.4.1' @@ -292,47 +321,16 @@ dependencies { implementation "cn.hutool:hutool-crypto:5.7.13" implementation 'cn.hutool:hutool-http:5.7.5' implementation "com.jakewharton:process-phoenix:2.1.2" - implementation 'com.google.guava:guava:31.1-android' - - implementation 'com.google.android.play:integrity:1.3.0' - - implementation 'com.google.android.gms:play-services-mlkit-subject-segmentation:16.0.0-beta1' - implementation 'com.google.android.gms:play-services-mlkit-image-labeling:16.0.8' - + // openpgp implementation project(":openpgp-api") compileOnly fileTree("libs") - compileOnly "com.google.firebase:firebase-messaging:$fcmVersion" - compileOnly "com.google.firebase:firebase-crashlytics:$crashlyticsVersion" compileOnly "com.google.android.play:core:$playCoreVersion" - - implementation 'com.google.android.gms:play-services-vision:20.1.3' - implementation 'com.google.android.gms:play-services-maps:18.2.0' - implementation 'com.google.android.gms:play-services-location:21.2.0' - implementation 'com.google.android.gms:play-services-wallet:19.1.0' - - implementation "com.google.firebase:firebase-messaging:$fcmVersion" - implementation "com.google.firebase:firebase-crashlytics:$crashlyticsVersion" -// implementation "com.google.android.play:core:$playCoreVersion" - - implementation 'com.stripe:stripe-android:2.0.2' - implementation 'com.android.billingclient:billing:6.0.1' - - testImplementation "junit:junit:4.13.2" - testImplementation "androidx.test:core:1.5.0" - testImplementation "org.robolectric:robolectric:4.5.1" - - coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.2.0" - -} -dependencies { // add for undo and redo - implementation 'org.lsposed.hiddenapibypass:hiddenapibypass:4.3' + implementation 'org.lsposed.hiddenapibypass:hiddenapibypass:5.1' // add splash screen implementation("androidx.core:core-splashscreen:1.0.1") - // add for auto translate - implementation 'com.google.mlkit:language-id:17.0.5' // add for emoji implementation 'com.jaredrummler:truetypeparser-light:1.0.0' // add for up From eee720ef5e48e1c434f4c5a83698dc4ada34aaa9 Mon Sep 17 00:00:00 2001 From: dkaraush Date: Sun, 26 Jan 2025 19:30:37 +0400 Subject: [PATCH 3/5] update to 11.7.0 (5663) --- TMessagesProj/jni/tgnet/ApiScheme.cpp | 185 +- TMessagesProj/jni/tgnet/ApiScheme.h | 92 +- .../jni/voip/webrtc/p2p/base/turn_port.cc | 5 +- .../src/main/assets/darkblue.attheme | 3 + .../src/main/assets/models/coin_border.png | Bin 2137 -> 4331 bytes .../src/main/assets/models/coin_logo.binobj | Bin 46424 -> 46948 bytes .../src/main/assets/models/deal_border.png | Bin 0 -> 4951 bytes .../src/main/assets/models/deal_logo.binobj | Bin 247148 -> 89268 bytes TMessagesProj/src/main/assets/night.attheme | 3 + .../src/main/assets/shaders/fragment3.glsl | 17 +- .../widget/ChatListItemAnimator.java | 55 +- .../recyclerview/widget/ItemTouchHelper.java | 4 +- .../recyclerview/widget/RecyclerView.java | 8 +- .../telegram/messenger/AndroidUtilities.java | 92 +- .../messenger/BirthdayController.java | 29 +- .../messenger/CacheByChatsController.java | 18 +- .../ChatMessagesMetadataController.java | 8 +- .../org/telegram/messenger/ChatObject.java | 39 +- .../messenger/ChatThemeController.java | 9 +- .../messenger/ContactsController.java | 16 +- .../messenger/DatabaseMigrationHelper.java | 19 + .../org/telegram/messenger/DialogObject.java | 160 +- .../telegram/messenger/DispatchQueuePool.java | 14 +- .../messenger/DownloadController.java | 108 +- .../java/org/telegram/messenger/Emoji.java | 12 +- .../messenger/FactCheckController.java | 13 +- .../telegram/messenger/FileLoadOperation.java | 27 +- .../org/telegram/messenger/FileLoader.java | 17 +- .../java/org/telegram/messenger/FileLog.java | 2 +- .../telegram/messenger/FileRefController.java | 18 +- .../messenger/FileStreamLoadOperation.java | 3 + .../messenger/HashtagSearchController.java | 14 +- .../org/telegram/messenger/ImageLoader.java | 57 + .../org/telegram/messenger/ImageReceiver.java | 2 +- .../telegram/messenger/LocaleController.java | 95 +- .../telegram/messenger/MediaController.java | 119 +- .../messenger/MediaDataController.java | 58 +- .../messenger/MessageCustomParamsHelper.java | 6 +- .../org/telegram/messenger/MessageObject.java | 239 +- .../messenger/MessagesController.java | 400 +- .../telegram/messenger/MessagesStorage.java | 122 +- .../messenger/NotificationsController.java | 22 +- .../messenger/PushListenerController.java | 155 +- .../telegram/messenger/SecretChatHelper.java | 6 +- .../messenger/SendMessagesHelper.java | 22 +- .../org/telegram/messenger/SharedConfig.java | 8 - .../messenger/UnconfirmedAuthController.java | 11 +- .../org/telegram/messenger/UserConfig.java | 11 +- .../telegram/messenger/UserNameResolver.java | 14 +- .../org/telegram/messenger/UserObject.java | 28 +- .../telegram/messenger/VideoEditedInfo.java | 22 +- .../telegram/messenger/browser/Browser.java | 59 +- .../messenger/camera/CameraSession.java | 12 +- .../telegram/messenger/camera/CameraView.java | 81 +- .../messenger/ringtone/RingtoneDataStore.java | 9 +- .../messenger/ringtone/RingtoneUploader.java | 3 +- .../messenger/utils/BillingUtilities.java | 8 +- .../messenger/video/InputSurface.java | 4 - .../video/MediaCodecVideoConvertor.java | 17 +- .../messenger/video/OutputSurface.java | 60 +- .../messenger/video/TextureRenderer.java | 103 +- .../telegram/messenger/video/WebmEncoder.java | 15 +- .../voip/VoIPPreNotificationService.java | 19 +- .../telegram/messenger/voip/VoIPService.java | 93 +- .../messenger/voip/VoIPServiceState.java | 3 +- .../tgnet/AbstractSerializedData.java | 2 +- .../telegram/tgnet/ConnectionsManager.java | 6 +- .../telegram/tgnet/InputSerializedData.java | 22 + .../telegram/tgnet/OutputSerializedData.java | 22 + .../java/org/telegram/tgnet/TLObject.java | 10 +- .../main/java/org/telegram/tgnet/TLRPC.java | 51029 ++++++---------- .../main/java/org/telegram/tgnet/Vector.java | 221 + .../org/telegram/tgnet/tl/TL_account.java | 3714 +- .../java/org/telegram/tgnet/tl/TL_bots.java | 614 +- .../org/telegram/tgnet/tl/TL_chatlists.java | 490 +- .../org/telegram/tgnet/tl/TL_fragment.java | 22 +- .../org/telegram/tgnet/tl/TL_payments.java | 123 +- .../java/org/telegram/tgnet/tl/TL_phone.java | 1475 + .../java/org/telegram/tgnet/tl/TL_stars.java | 1635 +- .../java/org/telegram/tgnet/tl/TL_stats.java | 366 +- .../org/telegram/tgnet/tl/TL_stories.java | 1600 +- .../org/telegram/ui/ActionBar/ActionBar.java | 14 +- .../ui/ActionBar/ActionBarLayout.java | 4 +- .../ui/ActionBar/ActionBarMenuSubItem.java | 11 +- .../ui/ActionBar/ActionBarPopupWindow.java | 6 +- .../telegram/ui/ActionBar/AlertDialog.java | 62 +- .../telegram/ui/ActionBar/BottomSheet.java | 66 +- .../telegram/ui/ActionBar/MenuDrawable.java | 81 +- .../telegram/ui/ActionBar/SimpleTextView.java | 162 +- .../ui/ActionBar/TextViewWithLoading.java | 75 + .../java/org/telegram/ui/ActionBar/Theme.java | 33 +- .../telegram/ui/ActionBar/ThemeColors.java | 27 +- .../ui/Adapters/DialogsSearchAdapter.java | 239 +- .../telegram/ui/ArchiveSettingsActivity.java | 8 +- .../java/org/telegram/ui/ArticleViewer.java | 35 +- .../main/java/org/telegram/ui/AvatarSpan.java | 6 + .../java/org/telegram/ui/BubbleActivity.java | 9 +- .../ui/Business/AwayMessagesActivity.java | 26 +- .../ui/Business/BusinessBotButton.java | 5 +- .../Business/BusinessChatbotController.java | 12 +- .../ui/Business/BusinessIntroActivity.java | 7 +- .../ui/Business/BusinessLinksActivity.java | 18 +- .../ui/Business/BusinessLinksController.java | 51 +- .../ui/Business/BusinessLinksEmptyView.java | 4 +- .../ui/Business/BusinessRecipientsHelper.java | 27 +- .../ChatAttachAlertQuickRepliesLayout.java | 2 +- .../ui/Business/ChatbotsActivity.java | 23 +- .../ui/Business/GreetMessagesActivity.java | 10 +- .../ui/Business/LocationActivity.java | 17 +- .../ui/Business/OpeningHoursActivity.java | 52 +- .../ui/Business/ProfileHoursCell.java | 21 +- .../ui/Business/QuickRepliesController.java | 6 +- .../org/telegram/ui/CacheControlActivity.java | 8 +- .../org/telegram/ui/CachedMediaLayout.java | 2 +- .../org/telegram/ui/CalendarActivity.java | 4 +- .../org/telegram/ui/CameraScanActivity.java | 2 +- .../org/telegram/ui/Cells/AboutLinkCell.java | 42 +- .../java/org/telegram/ui/Cells/BaseCell.java | 4 +- .../org/telegram/ui/Cells/BotHelpCell.java | 2 +- .../ui/Cells/ChannelRecommendationsCell.java | 54 +- .../org/telegram/ui/Cells/ChatActionCell.java | 545 +- .../telegram/ui/Cells/ChatMessageCell.java | 374 +- .../telegram/ui/Cells/ContextLinkCell.java | 6 +- .../org/telegram/ui/Cells/DialogCell.java | 156 +- .../telegram/ui/Cells/DialogsHintCell.java | 22 +- .../telegram/ui/Cells/DrawerProfileCell.java | 16 +- .../org/telegram/ui/Cells/DrawerUserCell.java | 74 +- .../telegram/ui/Cells/EditEmojiTextCell.java | 35 +- .../telegram/ui/Cells/GraySectionCell.java | 19 +- .../telegram/ui/Cells/GroupCallUserCell.java | 21 +- .../ui/Cells/GroupCreateUserCell.java | 8 +- .../org/telegram/ui/Cells/HintDialogCell.java | 2 +- .../telegram/ui/Cells/ManageChatUserCell.java | 2 +- .../org/telegram/ui/Cells/MentionCell.java | 3 +- .../telegram/ui/Cells/ProfileSearchCell.java | 107 +- .../ui/Cells/ReactedUserHolderView.java | 2 +- .../org/telegram/ui/Cells/SessionCell.java | 6 +- .../telegram/ui/Cells/ShareDialogCell.java | 34 +- .../telegram/ui/Cells/SharedAudioCell.java | 2 +- .../org/telegram/ui/Cells/SharedLinkCell.java | 6 +- .../ui/Cells/SharedPhotoVideoCell2.java | 5 +- .../telegram/ui/Cells/StickerEmojiCell.java | 10 +- .../org/telegram/ui/Cells/StickerSetCell.java | 2 +- .../telegram/ui/Cells/StickerSetNameCell.java | 4 +- .../org/telegram/ui/Cells/TextDetailCell.java | 6 +- .../ui/Cells/TextDetailSettingsCell.java | 2 +- .../ui/Cells/TextInfoPrivacyCell.java | 18 +- .../ui/Cells/TextSelectionHelper.java | 4 +- .../ui/Cells/ThemesHorizontalListCell.java | 7 +- .../java/org/telegram/ui/Cells/UserCell.java | 32 +- .../java/org/telegram/ui/Cells/UserCell2.java | 2 +- .../org/telegram/ui/ChangeBioActivity.java | 3 +- .../org/telegram/ui/ChangeNameActivity.java | 3 +- .../telegram/ui/ChangeUsernameActivity.java | 9 +- .../telegram/ui/ChannelAdminLogActivity.java | 7 +- .../org/telegram/ui/ChannelColorActivity.java | 230 +- .../telegram/ui/ChannelCreateActivity.java | 2 +- .../ui/ChannelMonetizationLayout.java | 34 +- .../org/telegram/ui/Charts/BaseChartView.java | 4 +- .../java/org/telegram/ui/ChatActivity.java | 1417 +- .../org/telegram/ui/ChatEditActivity.java | 84 +- .../org/telegram/ui/ChatEditTypeActivity.java | 11 + .../org/telegram/ui/ChatLinkActivity.java | 11 + .../telegram/ui/ChatPullingDownDrawable.java | 4 +- .../ui/ChatReactionsEditActivity.java | 11 + .../telegram/ui/ChatRightsEditActivity.java | 34 +- .../org/telegram/ui/ChatUsersActivity.java | 23 +- .../telegram/ui/Components/AlertsCreator.java | 52 +- .../ui/Components/AnimatedEmojiDrawable.java | 130 +- .../ui/Components/AnimatedEmojiSpan.java | 40 +- .../ui/Components/AnimatedFileDrawable.java | 21 +- .../telegram/ui/Components/AnimatedFloat.java | 7 + .../ui/Components/AnimatedTextView.java | 2 +- .../Components/AvatarConstructorFragment.java | 17 +- .../ui/Components/AvatarDrawable.java | 24 +- .../ui/Components/BackupImageView.java | 9 + .../org/telegram/ui/Components/Bulletin.java | 104 +- .../ui/Components/BulletinFactory.java | 29 +- .../telegram/ui/Components/ButtonSpan.java | 36 +- .../ui/Components/CaptionPhotoViewer.java | 4 +- .../ui/Components/ChatActivityEnterView.java | 25 +- .../ui/Components/ChatAttachAlert.java | 16 +- .../ChatAttachAlertContactsLayout.java | 2 +- .../ChatAttachAlertPhotoLayout.java | 92 +- .../ChatAttachAlertPhotoLayoutPreview.java | 6 +- .../Components/ChatAttachAlertPollLayout.java | 8 +- .../ui/Components/ChatAvatarContainer.java | 108 +- .../ui/Components/ChatThemeBottomSheet.java | 3 +- .../telegram/ui/Components/CheckBoxBase.java | 67 +- .../Components/CircularProgressDrawable.java | 9 + .../ui/Components/CompatDrawable.java | 55 + .../CreateRtmpStreamBottomSheet.java | 7 +- .../ui/Components/Crop/CropAreaView.java | 45 +- .../ui/Components/Crop/CropRotationWheel.java | 6 +- .../telegram/ui/Components/Crop/CropView.java | 193 +- .../Components/CustomPhoneKeyboardView.java | 10 +- .../ui/Components/DialogCellTags.java | 50 +- .../ui/Components/DialogsBotsAdapter.java | 56 +- .../ui/Components/DialogsChannelsAdapter.java | 47 +- .../ui/Components/EditCoverButton.java | 124 + .../ui/Components/EditTextEffects.java | 11 +- .../telegram/ui/Components/EditTextEmoji.java | 58 +- .../ui/Components/EffectsTextView.java | 2 +- .../ui/Components/EmbedBottomSheet.java | 19 +- .../ui/Components/EmojiPacksAlert.java | 49 +- .../ui/Components/EmojiTabsStrip.java | 68 +- .../org/telegram/ui/Components/EmojiView.java | 43 +- .../ui/Components/FilterTabsView.java | 111 +- .../ui/Components/FiltersListBottomSheet.java | 8 +- .../ui/Components/FlickerLoadingView.java | 11 +- .../FloatingDebug/FloatingDebugView.java | 4 +- .../ui/Components/FolderBottomSheet.java | 283 +- .../ui/Components/FragmentContextView.java | 17 +- .../telegram/ui/Components/GroupCallPip.java | 12 +- .../ui/Components/GroupCreateSpan.java | 2 +- .../telegram/ui/Components/ImageUpdater.java | 69 +- .../ui/Components/InstantCameraView.java | 4 +- .../ui/Components/InviteLinkBottomSheet.java | 19 +- .../telegram/ui/Components/ItemOptions.java | 43 +- .../telegram/ui/Components/JoinCallAlert.java | 9 +- .../ui/Components/LinkSpanDrawable.java | 119 +- .../telegram/ui/Components/MediaActivity.java | 11 +- .../ui/Components/MentionsContainerView.java | 6 +- .../ui/Components/MessagePrivateSeenView.java | 5 +- .../telegram/ui/Components/MuteDrawable.java | 109 + .../Components/OutlineTextContainerView.java | 12 +- .../ui/Components/Paint/Views/EntityView.java | 11 +- .../Paint/Views/LPhotoPaintView.java | 6 +- .../Components/Paint/Views/LinkPreview.java | 8 +- .../Paint/Views/MessageEntityView.java | 114 +- .../Paint/Views/PaintTypefaceListView.java | 11 + .../ui/Components/Paint/Views/PhotoView.java | 227 +- .../ui/Components/PaintingOverlay.java | 5 +- .../telegram/ui/Components/PasscodeView.java | 6 +- .../ui/Components/PhotoFilterView.java | 10 +- .../Components/PhotoViewerBlurDrawable.java | 68 + .../PhotoViewerCaptionEnterView.java | 6 +- .../ui/Components/PhotoViewerCoverEditor.java | 104 + .../Components/PickerBottomLayoutViewer.java | 2 +- .../ui/Components/PollVotesAlert.java | 6 +- .../ui/Components/Premium/CarouselView.java | 8 +- .../Premium/DoubledLimitsBottomSheet.java | 20 +- .../ui/Components/Premium/GLIcon/Icon3D.java | 37 +- .../Components/Premium/LimitPreviewView.java | 4 +- .../Premium/LimitReachedBottomSheet.java | 35 +- .../Premium/PremiumLockIconView.java | 8 + .../PremiumStickersPreviewRecycler.java | 4 +- .../Premium/boosts/BoostDialogs.java | 7 +- .../Premium/boosts/BoostRepository.java | 68 +- .../boosts/BoostViaGiftsBottomSheet.java | 19 +- .../boosts/UserSelectorBottomSheet.java | 206 +- .../boosts/adapters/SelectorAdapter.java | 19 +- .../Premium/boosts/cells/BaseCell.java | 10 +- .../Premium/boosts/cells/TableCell.java | 7 +- .../cells/selector/SelectorCountryCell.java | 2 +- .../cells/selector/SelectorUserCell.java | 27 +- .../ui/Components/RLottieDrawable.java | 8 +- .../ui/Components/ReactedHeaderView.java | 5 +- .../Reactions/BackSpaceButtonView.java | 8 +- .../ChatCustomReactionsEditActivity.java | 22 +- .../Reactions/CustomEmojiReactionsWindow.java | 7 +- .../Reactions/ReactionsEffectOverlay.java | 84 +- .../Reactions/ReactionsLayoutInBubble.java | 122 +- .../Components/ReactionsContainerLayout.java | 16 +- .../ui/Components/RecyclerListView.java | 15 +- .../ui/Components/ScrollSlidingTabStrip.java | 4 +- .../ui/Components/SearchViewPager.java | 6 + .../org/telegram/ui/Components/SeekBar.java | 3 +- .../telegram/ui/Components/SeekBarView.java | 3 +- .../telegram/ui/Components/ShareAlert.java | 542 +- .../ui/Components/SharedMediaLayout.java | 242 +- .../Components/SizeNotifierFrameLayout.java | 2 +- .../telegram/ui/Components/StickersAlert.java | 31 +- .../ui/Components/StorageDiagramView.java | 2 +- .../ui/Components/SuggestEmojiView.java | 29 +- .../Components/SwipeGestureSettingsView.java | 4 +- .../org/telegram/ui/Components/TableView.java | 197 +- .../ui/Components/TermsOfServiceView.java | 3 +- .../java/org/telegram/ui/Components/Text.java | 48 +- .../telegram/ui/Components/ThanosEffect.java | 1 + .../org/telegram/ui/Components/UItem.java | 6 + .../org/telegram/ui/Components/UndoView.java | 35 +- .../ui/Components/UniversalAdapter.java | 2 + .../telegram/ui/Components/VideoPlayer.java | 16 + .../ui/Components/VideoPlayerSeekBar.java | 3 +- .../ui/Components/VideoSeekPreviewImage.java | 141 +- .../ui/Components/ViewPagerFixed.java | 3 +- .../telegram/ui/Components/WebPlayerView.java | 10 +- .../ui/Components/ZoomControlView.java | 8 +- .../ui/Components/spoilers/SpoilerEffect.java | 20 +- .../Components/spoilers/SpoilersTextView.java | 131 +- .../ui/Components/voip/VoIPHelper.java | 5 +- .../org/telegram/ui/ContactAddActivity.java | 6 +- .../org/telegram/ui/ContentPreviewViewer.java | 28 +- .../telegram/ui/CountrySelectActivity.java | 4 +- .../org/telegram/ui/DataSettingsActivity.java | 9 +- .../java/org/telegram/ui/DialogsActivity.java | 514 +- .../telegram/ui/EmojiAnimationsOverlay.java | 14 +- .../telegram/ui/ExternalActionActivity.java | 10 +- .../ui/FastSpannableStringBuilder.java | 4 + .../telegram/ui/FilterChatlistActivity.java | 27 +- .../org/telegram/ui/FilterCreateActivity.java | 409 +- .../org/telegram/ui/FilteredSearchView.java | 2 +- .../org/telegram/ui/FiltersSetupActivity.java | 19 +- .../java/org/telegram/ui/Gifts/GiftSheet.java | 555 +- .../ui/Gifts/ProfileGiftsContainer.java | 307 +- .../org/telegram/ui/Gifts/SendGiftSheet.java | 107 +- .../org/telegram/ui/GroupCallActivity.java | 59 +- .../telegram/ui/GroupCreateFinalActivity.java | 2 +- .../org/telegram/ui/IdenticonActivity.java | 2 +- .../java/org/telegram/ui/IntroActivity.java | 5 +- .../java/org/telegram/ui/LaunchActivity.java | 402 +- .../org/telegram/ui/LinkEditActivity.java | 4 +- .../java/org/telegram/ui/LoginActivity.java | 78 +- .../org/telegram/ui/ManageLinksActivity.java | 36 +- .../java/org/telegram/ui/MessageSeenView.java | 5 +- .../telegram/ui/MessageStatisticActivity.java | 2 +- .../ui/MultiContactsSelectorBottomSheet.java | 109 +- .../telegram/ui/NewContactBottomSheet.java | 2 +- .../ui/NotificationsSettingsActivity.java | 5 +- .../ui/NotificationsSoundActivity.java | 4 +- .../org/telegram/ui/PassportActivity.java | 74 +- .../org/telegram/ui/PaymentFormActivity.java | 74 +- .../org/telegram/ui/PeerColorActivity.java | 613 +- .../telegram/ui/PhotoAlbumPickerActivity.java | 4 +- .../org/telegram/ui/PhotoPickerActivity.java | 6 +- .../java/org/telegram/ui/PhotoViewer.java | 1161 +- .../org/telegram/ui/PollCreateActivity.java | 8 +- .../telegram/ui/PremiumPreviewFragment.java | 35 +- .../telegram/ui/PrivacyControlActivity.java | 19 +- .../telegram/ui/PrivacySettingsActivity.java | 16 +- .../java/org/telegram/ui/ProfileActivity.java | 675 +- .../main/java/org/telegram/ui/QrActivity.java | 2 +- .../ui/ReactionsDoubleTapManageActivity.java | 3 +- .../org/telegram/ui/SecretMediaViewer.java | 25 +- .../ui/SelectAnimatedEmojiDialog.java | 192 +- .../org/telegram/ui/SessionBottomSheet.java | 3 +- .../org/telegram/ui/SessionsActivity.java | 21 +- .../org/telegram/ui/Stars/BagRandomizer.java | 50 + .../telegram/ui/Stars/BotStarsActivity.java | 127 +- .../telegram/ui/Stars/BotStarsController.java | 11 +- .../telegram/ui/Stars/StarGiftPatterns.java | 212 + .../org/telegram/ui/Stars/StarGiftSheet.java | 3679 ++ .../ui/Stars/StarGiftUniqueActionLayout.java | 404 + .../ui/Stars/StarReactionsOverlay.java | 133 +- .../telegram/ui/Stars/StarsController.java | 304 +- .../telegram/ui/Stars/StarsIntroActivity.java | 833 +- .../ui/Stars/StarsReactionsSheet.java | 143 +- .../ui/Stories/DarkThemeResourceProvider.java | 20 +- .../ui/Stories/MessageMediaStoryFull.java | 6 +- .../ui/Stories/MessageMediaStoryFull_old.java | 6 +- .../telegram/ui/Stories/PeerStoriesView.java | 38 +- .../ui/Stories/SelfStoryViewsPage.java | 3 +- .../telegram/ui/Stories/StealthModeAlert.java | 4 +- .../ui/Stories/StoriesController.java | 10 +- .../telegram/ui/Stories/StoriesUtilities.java | 15 +- .../ui/Stories/StoryContainsEmojiButton.java | 11 +- .../ui/Stories/StoryCustomParamsHelper.java | 6 +- .../ui/Stories/StoryMediaAreasView.java | 9 + .../org/telegram/ui/Stories/StoryViewer.java | 11 +- .../telegram/ui/Stories/UserListPoller.java | 9 +- .../recorder/ButtonWithCounterView.java | 5 + .../recorder/CaptionContainerView.java | 6 +- .../ui/Stories/recorder/CollageLayout.java | 15 + .../Stories/recorder/CollageLayoutView2.java | 131 +- .../ui/Stories/recorder/CropEditor.java | 591 + .../ui/Stories/recorder/CropInlineEditor.java | 456 + .../ui/Stories/recorder/DraftsController.java | 16 + .../ui/Stories/recorder/DualCameraView.java | 6 +- .../ui/Stories/recorder/EmojiBottomSheet.java | 7 +- .../ui/Stories/recorder/FlashViews.java | 4 +- .../ui/Stories/recorder/GalleryListView.java | 294 +- .../ui/Stories/recorder/GallerySheet.java | 122 + .../ui/Stories/recorder/HintView2.java | 182 +- .../ui/Stories/recorder/PaintView.java | 141 +- .../ui/Stories/recorder/PreviewButtons.java | 18 +- .../ui/Stories/recorder/PreviewView.java | 222 +- .../ui/Stories/recorder/QRScanner.java | 353 + .../ui/Stories/recorder/RecordControl.java | 35 +- .../Stories/recorder/ScannedLinkPreview.java | 414 + .../ui/Stories/recorder/SliderView.java | 3 +- .../ui/Stories/recorder/StoryEntry.java | 97 +- .../ui/Stories/recorder/StoryLinkSheet.java | 16 +- .../ui/Stories/recorder/StoryRecorder.java | 388 +- .../ui/Stories/recorder/TimelineView.java | 29 +- .../telegram/ui/Stories/recorder/Weather.java | 3 +- .../ui/TextMessageEnterTransition.java | 2 +- .../org/telegram/ui/ThemePreviewActivity.java | 9 +- .../org/telegram/ui/ThemeSetUrlActivity.java | 5 +- .../org/telegram/ui/TopicCreateFragment.java | 3 +- .../java/org/telegram/ui/TopicsFragment.java | 60 +- .../ui/TopicsNotifySettingsFragments.java | 3 +- .../ui/TwoStepVerificationActivity.java | 186 +- .../ui/TwoStepVerificationSetupActivity.java | 35 +- .../org/telegram/ui/UserInfoActivity.java | 21 +- .../org/telegram/ui/UsersSelectActivity.java | 78 +- .../java/org/telegram/ui/VoIPFragment.java | 6 +- .../telegram/ui/WallpapersListActivity.java | 11 +- .../ui/bots/AffiliateProgramFragment.java | 16 +- .../telegram/ui/bots/BotCommandsMenuView.java | 3 +- .../org/telegram/ui/bots/BotVerifySheet.java | 432 + .../org/telegram/ui/bots/BotWebViewSheet.java | 15 + .../ChannelAffiliateProgramsFragment.java | 46 +- .../bots/ChatAttachAlertBotWebViewLayout.java | 10 +- .../ui/bots/SetupEmojiStatusSheet.java | 40 +- .../telegram/ui/web/BotWebViewContainer.java | 67 +- .../org/telegram/ui/web/BrowserHistory.java | 6 +- .../org/telegram/ui/web/WebActionBar.java | 4 +- .../org/telegram/ui/web/WebMetadataCache.java | 10 +- .../main/res/drawable/filled_crown_off.xml | 14 + .../src/main/res/drawable/filled_crown_on.xml | 12 + .../main/res/drawable/filled_gift_simple.xml | 17 + .../res/drawable/filled_gift_transfer.xml | 18 + .../src/main/res/drawable/filled_share.xml | 12 + .../src/main/res/drawable/filled_sound_on.xml | 11 + .../src/main/res/drawable/gift_unpack.xml | 29 + .../src/main/res/drawable/gift_upgrade.xml | 13 + .../src/main/res/drawable/input_gift_s.xml | 27 + .../res/drawable/menu_feature_tradable.xml | 32 + .../res/drawable/menu_feature_transfer.xml | 32 + .../main/res/drawable/menu_feature_unique.xml | 39 + .../src/main/res/drawable/menu_sort_date.xml | 32 + .../src/main/res/drawable/menu_sort_value.xml | 24 + .../main/res/drawable/menu_verification.xml | 16 + .../src/main/res/drawable/msg_emoji_gem.xml | 24 + .../src/main/res/drawable/video_settings.xml | 12 + .../src/main/res/drawable/video_starts_at.xml | 13 + .../src/main/res/raw/gift_upgrade.json | 1 + TMessagesProj/src/main/res/values/strings.xml | 293 +- .../telegram/messenger/SMSJobController.java | 6 +- .../java/org/telegram/tgnet/TL_smsjobs.java | 44 +- gradle.properties | 4 +- 432 files changed, 48731 insertions(+), 42558 deletions(-) create mode 100644 TMessagesProj/src/main/assets/models/deal_border.png create mode 100644 TMessagesProj/src/main/java/org/telegram/tgnet/InputSerializedData.java create mode 100644 TMessagesProj/src/main/java/org/telegram/tgnet/OutputSerializedData.java create mode 100644 TMessagesProj/src/main/java/org/telegram/tgnet/Vector.java create mode 100644 TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_phone.java create mode 100644 TMessagesProj/src/main/java/org/telegram/ui/ActionBar/TextViewWithLoading.java create mode 100644 TMessagesProj/src/main/java/org/telegram/ui/Components/CompatDrawable.java create mode 100644 TMessagesProj/src/main/java/org/telegram/ui/Components/EditCoverButton.java create mode 100644 TMessagesProj/src/main/java/org/telegram/ui/Components/MuteDrawable.java create mode 100644 TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerBlurDrawable.java create mode 100644 TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerCoverEditor.java create mode 100644 TMessagesProj/src/main/java/org/telegram/ui/FastSpannableStringBuilder.java create mode 100644 TMessagesProj/src/main/java/org/telegram/ui/Stars/BagRandomizer.java create mode 100644 TMessagesProj/src/main/java/org/telegram/ui/Stars/StarGiftPatterns.java create mode 100644 TMessagesProj/src/main/java/org/telegram/ui/Stars/StarGiftSheet.java create mode 100644 TMessagesProj/src/main/java/org/telegram/ui/Stars/StarGiftUniqueActionLayout.java create mode 100644 TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/CropEditor.java create mode 100644 TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/CropInlineEditor.java create mode 100644 TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/GallerySheet.java create mode 100644 TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/QRScanner.java create mode 100644 TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/ScannedLinkPreview.java create mode 100644 TMessagesProj/src/main/java/org/telegram/ui/bots/BotVerifySheet.java create mode 100644 TMessagesProj/src/main/res/drawable/filled_crown_off.xml create mode 100644 TMessagesProj/src/main/res/drawable/filled_crown_on.xml create mode 100644 TMessagesProj/src/main/res/drawable/filled_gift_simple.xml create mode 100644 TMessagesProj/src/main/res/drawable/filled_gift_transfer.xml create mode 100644 TMessagesProj/src/main/res/drawable/filled_share.xml create mode 100644 TMessagesProj/src/main/res/drawable/filled_sound_on.xml create mode 100644 TMessagesProj/src/main/res/drawable/gift_unpack.xml create mode 100644 TMessagesProj/src/main/res/drawable/gift_upgrade.xml create mode 100644 TMessagesProj/src/main/res/drawable/input_gift_s.xml create mode 100644 TMessagesProj/src/main/res/drawable/menu_feature_tradable.xml create mode 100644 TMessagesProj/src/main/res/drawable/menu_feature_transfer.xml create mode 100644 TMessagesProj/src/main/res/drawable/menu_feature_unique.xml create mode 100644 TMessagesProj/src/main/res/drawable/menu_sort_date.xml create mode 100644 TMessagesProj/src/main/res/drawable/menu_sort_value.xml create mode 100644 TMessagesProj/src/main/res/drawable/menu_verification.xml create mode 100644 TMessagesProj/src/main/res/drawable/msg_emoji_gem.xml create mode 100644 TMessagesProj/src/main/res/drawable/video_settings.xml create mode 100644 TMessagesProj/src/main/res/drawable/video_starts_at.xml create mode 100644 TMessagesProj/src/main/res/raw/gift_upgrade.json diff --git a/TMessagesProj/jni/tgnet/ApiScheme.cpp b/TMessagesProj/jni/tgnet/ApiScheme.cpp index fa2d2dd160..e723e620d2 100644 --- a/TMessagesProj/jni/tgnet/ApiScheme.cpp +++ b/TMessagesProj/jni/tgnet/ApiScheme.cpp @@ -377,6 +377,17 @@ TL_username *TL_username::TLdeserialize(NativeByteBuffer *stream, uint32_t const return result; } +TL_peerColor *TL_peerColor::TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) { + if (TL_peerColor::constructor != constructor) { + error = true; + if (LOGS_ENABLED) DEBUG_FATAL("can't parse magic %x in TL_peerColor", constructor); + return nullptr; + } + TL_peerColor *result = new TL_peerColor(); + result->readParams(stream, instanceNum, error); + return result; +} + void TL_restrictionReason::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) { platform = stream->readString(&error); reason = stream->readString(&error); @@ -405,6 +416,132 @@ void TL_username::serializeToStream(NativeByteBuffer *stream) { stream->writeString(username); } +void TL_peerColor::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) { + flags = stream->readInt32(&error); + if ((flags & 1) != 0) { + color = stream->readInt32(&error); + } + if ((flags & 2) != 0) { + background_emoji_id = stream->readInt64(&error); + } +} + +void TL_peerColor::serializeToStream(NativeByteBuffer *stream) { + stream->writeInt32(constructor); + stream->writeInt32(flags); + if ((flags & 1) != 0) { + stream->writeInt32(color); + } + if ((flags & 2) != 0) { + stream->writeInt64(background_emoji_id); + } +} + +EmojiStatus *EmojiStatus::TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) { + EmojiStatus *result = nullptr; + switch (constructor) { + case TL_emojiStatusEmpty::constructor: + result = new TL_emojiStatusEmpty(); + break; + case TL_emojiStatus::constructor: + result = new TL_emojiStatus(); + break; + case TL_emojiStatusCollectible::constructor: + result = new TL_emojiStatusCollectible(); + break; + case TL_emojiStatus_layer197::constructor: + result = new TL_emojiStatus_layer197(); + break; + case TL_emojiStatusUntil_layer197::constructor: + result = new TL_emojiStatusUntil_layer197(); + break; + default: + error = true; + if (LOGS_ENABLED) DEBUG_FATAL("can't parse magic %x in User", constructor); + return nullptr; + } + result->readParams(stream, instanceNum, error); + return result; +} + +void TL_emojiStatusEmpty::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) { + +} + +void TL_emojiStatusEmpty::serializeToStream(NativeByteBuffer *stream) { + stream->writeInt32(constructor); +} + +void TL_emojiStatus::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) { + flags = stream->readInt32(&error); + document_id = stream->readInt64(&error); + if ((flags & 1) != 0) { + until = stream->readInt64(&error); + } +} + +void TL_emojiStatus::serializeToStream(NativeByteBuffer *stream) { + stream->writeInt32(constructor); + stream->writeInt32(flags); + stream->writeInt64(document_id); + if ((flags & 1) != 0) { + stream->writeInt32(until); + } +} + +void TL_emojiStatus_layer197::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) { + document_id = stream->readInt64(&error); +} + +void TL_emojiStatus_layer197::serializeToStream(NativeByteBuffer *stream) { + stream->writeInt32(constructor); + stream->writeInt64(document_id); +} + +void TL_emojiStatusUntil_layer197::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) { + document_id = stream->readInt64(&error); + until = stream->readInt32(&error); +} + +void TL_emojiStatusUntil_layer197::serializeToStream(NativeByteBuffer *stream) { + stream->writeInt32(constructor); + stream->writeInt64(document_id); + stream->writeInt32(until); +} + +void TL_emojiStatusCollectible::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) { + flags = stream->readInt32(&error); + collectible_id = stream->readInt64(&error); + document_id = stream->readInt64(&error); + title = stream->readString(&error); + slug = stream->readString(&error); + pattern_document_id = stream->readInt64(&error); + center_color = stream->readInt32(&error); + edge_color = stream->readInt32(&error); + pattern_color = stream->readInt32(&error); + text_color = stream->readInt32(&error); + if ((flags & 1) != 0) { + until = stream->readInt64(&error); + } +} + +void TL_emojiStatusCollectible::serializeToStream(NativeByteBuffer *stream) { + stream->writeInt32(constructor); + stream->writeInt32(flags); + stream->writeInt64(collectible_id); + stream->writeInt64(document_id); + stream->writeString(title); + stream->writeString(slug); + stream->writeInt64(pattern_document_id); + stream->writeInt32(center_color); + stream->writeInt32(edge_color); + stream->writeInt32(pattern_color); + stream->writeInt32(text_color); + if ((flags & 1) != 0) { + stream->writeInt32(until); + } +} + User *User::TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) { User *result = nullptr; switch (constructor) { @@ -483,21 +620,7 @@ void TL_user::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &er lang_code = stream->readString(&error); } if ((flags & 1073741824) != 0) { - emojiStatusMagic = stream->readUint32(&error); - if (emojiStatusMagic == 0x2de11aae) { - // emojiStatusEmpty - } else if (emojiStatusMagic == 0x929b619d) { - // emojiStatus - emojiStatusDocumentId = stream->readInt64(&error); - } else if (emojiStatusMagic == 0xfa30a8c7) { - // emojiStatusUntil - emojiStatusDocumentId = stream->readInt64(&error); - emojiStatusUntil = stream->readInt32(&error); - } else { - error = true; - if (LOGS_ENABLED) DEBUG_FATAL("wrong EmojiStatus magic, got %x", emojiStatusMagic); - return; - } + emoji_status = std::unique_ptr(EmojiStatus::TLdeserialize(stream, stream->readInt32(&error), instanceNum, error)); } if ((flags2 & 1) != 0) { uint32_t magic = stream->readUint32(&error); @@ -519,18 +642,17 @@ void TL_user::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &er stories_max_id = stream->readInt32(&error); } if ((flags2 & 256) != 0) { - int magic = stream->readInt32(&error); - color_color = stream->readInt32(&error); - color_background_emoji_id = stream->readInt64(&error); + color = std::unique_ptr(TL_peerColor::TLdeserialize(stream, stream->readUint32(&error), instanceNum, error)); } if ((flags2 & 512) != 0) { - int magic = stream->readInt32(&error); - profile_color_color = stream->readInt32(&error); - profile_color_background_emoji_id = stream->readInt64(&error); + profile_color = std::unique_ptr(TL_peerColor::TLdeserialize(stream, stream->readUint32(&error), instanceNum, error)); } if ((flags2 & 4096) != 0) { bot_active_users = stream->readInt32(&error); } + if ((flags2 & 16384) != 0) { + bot_verification_icon = stream->readInt64(&error); + } } void TL_user::serializeToStream(NativeByteBuffer *stream) { @@ -577,15 +699,7 @@ void TL_user::serializeToStream(NativeByteBuffer *stream) { stream->writeString(lang_code); } if ((flags & 1073741824) != 0) { - stream->writeInt32(emojiStatusMagic); - if (emojiStatusMagic == 0x929b619d) { - // emojiStatus - stream->writeInt64(emojiStatusDocumentId); - } else if (emojiStatusMagic == 0xfa30a8c7) { - // emojiStatusUntil - stream->writeInt64(emojiStatusDocumentId); - stream->writeInt32(emojiStatusUntil); - } + emoji_status->serializeToStream(stream); } if ((flags2 & 1) != 0) { stream->writeInt32(0x1cb5c415); @@ -599,18 +713,17 @@ void TL_user::serializeToStream(NativeByteBuffer *stream) { stream->writeInt32(stories_max_id); } if ((flags2 & 256) != 0) { - stream->writeInt32(0xba278146); - stream->writeInt32(color_color); - stream->writeInt32(color_background_emoji_id); + color->serializeToStream(stream); } if ((flags2 & 512) != 0) { - stream->writeInt32(0xba278146); - stream->writeInt32(profile_color_color); - stream->writeInt32(profile_color_background_emoji_id); + profile_color->serializeToStream(stream); } if ((flags2 & 4096) != 0) { stream->writeInt32(bot_active_users); } + if ((flags2 & 16384) != 0) { + stream->writeInt64(bot_verification_icon); + } } InputPeer *InputPeer::TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) { diff --git a/TMessagesProj/jni/tgnet/ApiScheme.h b/TMessagesProj/jni/tgnet/ApiScheme.h index a883738dbe..9276e6660c 100644 --- a/TMessagesProj/jni/tgnet/ApiScheme.h +++ b/TMessagesProj/jni/tgnet/ApiScheme.h @@ -362,6 +362,85 @@ class TL_username : public TLObject { void serializeToStream(NativeByteBuffer *stream); }; +class TL_peerColor : public TLObject { +public: + static const uint32_t constructor = 0xb54b5acf; + + int32_t flags; + int32_t color; + int64_t background_emoji_id; + + static TL_peerColor *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error); + void readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error); + void serializeToStream(NativeByteBuffer *stream); +}; + +class EmojiStatus : public TLObject { +public: + static EmojiStatus *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error); +}; + +class TL_emojiStatusEmpty : public EmojiStatus { +public: + static const uint32_t constructor = 0xb54b5acf; + + void readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error); + void serializeToStream(NativeByteBuffer *stream); +}; + +class TL_emojiStatus : public EmojiStatus { +public: + static const uint32_t constructor = 0xe7ff068a; + + int32_t flags; + int64_t document_id; + int32_t until; + + void readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error); + void serializeToStream(NativeByteBuffer *stream); +}; + +class TL_emojiStatus_layer197 : public EmojiStatus { +public: + static const uint32_t constructor = 0x929b619d; + + int64_t document_id; + + void readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error); + void serializeToStream(NativeByteBuffer *stream); +}; + +class TL_emojiStatusUntil_layer197 : public EmojiStatus { +public: + static const uint32_t constructor = 0xfa30a8c7; + + int64_t document_id; + int32_t until; + + void readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error); + void serializeToStream(NativeByteBuffer *stream); +}; + +class TL_emojiStatusCollectible : public EmojiStatus { +public: + static const uint32_t constructor = 0x7141dbf; + + int32_t flags; + int64_t collectible_id; + int64_t document_id; + std::string title; + std::string slug; + int64_t pattern_document_id; + int32_t center_color; + int32_t edge_color; + int32_t pattern_color; + int32_t text_color; + int32_t until; + + void readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error); + void serializeToStream(NativeByteBuffer *stream); +}; + class User : public TLObject { public: @@ -381,14 +460,11 @@ class User : public TLObject { std::string lang_code; std::vector> usernames; int32_t stories_max_id; - int32_t emojiStatusMagic; - int64_t emojiStatusDocumentId; - int32_t emojiStatusUntil; - int32_t color_color; - int64_t color_background_emoji_id; - int32_t profile_color_color; - int64_t profile_color_background_emoji_id; + std::unique_ptr emoji_status; + std::unique_ptr color; + std::unique_ptr profile_color; int32_t bot_active_users; + int64_t bot_verification_icon; static User *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error); }; @@ -405,7 +481,7 @@ class TL_userEmpty : public User { class TL_user : public User { public: - static const uint32_t constructor = 0x83314fca; + static const uint32_t constructor = 0x4b46c37e; void readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error); void serializeToStream(NativeByteBuffer *stream); diff --git a/TMessagesProj/jni/voip/webrtc/p2p/base/turn_port.cc b/TMessagesProj/jni/voip/webrtc/p2p/base/turn_port.cc index 970d6adec6..a996a0f5a3 100644 --- a/TMessagesProj/jni/voip/webrtc/p2p/base/turn_port.cc +++ b/TMessagesProj/jni/voip/webrtc/p2p/base/turn_port.cc @@ -1759,9 +1759,9 @@ int TurnEntry::Send(const void* data, size_t size, bool payload, const rtc::PacketOptions& options) { + if (port_ == nullptr) return -1; rtc::ByteBufferWriter buf; - if (state_ != STATE_BOUND || - !port_->TurnCustomizerAllowChannelData(data, size, payload)) { + if (state_ != STATE_BOUND || !port_->TurnCustomizerAllowChannelData(data, size, payload)) { // If we haven't bound the channel yet, we have to use a Send Indication. // The turn_customizer_ can also make us use Send Indication. TurnMessage msg(TURN_SEND_INDICATION); @@ -1781,6 +1781,7 @@ int TurnEntry::Send(const void* data, state_ = STATE_BINDING; } } else { + if (data == nullptr && size > 0) return -1; // If the channel is bound, we can send the data as a Channel Message. buf.WriteUInt16(channel_id_); buf.WriteUInt16(static_cast(size)); diff --git a/TMessagesProj/src/main/assets/darkblue.attheme b/TMessagesProj/src/main/assets/darkblue.attheme index 56bee9df3a..5a3b6adee3 100644 --- a/TMessagesProj/src/main/assets/darkblue.attheme +++ b/TMessagesProj/src/main/assets/darkblue.attheme @@ -453,3 +453,6 @@ table_background=177390847 table_border=436207615 dialogCardShadow=1073741824 dialogTopBackground=-13473128 +share_icon=-1 +share_linkText=-1207959553 +share_linkBackground=352321535 diff --git a/TMessagesProj/src/main/assets/models/coin_border.png b/TMessagesProj/src/main/assets/models/coin_border.png index d68e1299f328301fc250a780b7495e1cb006daac..03a5254f5689472e31b89db6058830eeb1afc581 100644 GIT binary patch literal 4331 zcma)8cTm&WxBsTm11N;9uy$H-L3)XxtOzb5y@ntP3qguVClJ84s0+J5kRnB;g^&bk z0s#X40H2Zaq}K#BfV2c5gc9Jf|GmH7ygPI6xt}v<&bc#p&gXOfbg;h$7gG`g004g7 z=BgtAfR3&pKt$-sc;BxKI5MK)HXe}xATIOo1_Akn3jc;gI$pB^$o(omjsP^!@^?!B zsLc=;_`v``8h`z&rE@H3b!Mtz*oM%vPKjS?QxrGpNquepw6^4exPu4a-+Alku$*@X z?pdb7F3J@;$z5*iQ_gD534Ui)YG?bmqs{K&XgVzKyY-W(=>Pmxedegn|6^tLOMx>_ z#~^k3*8faWL85!2kUiWV2$tLuPgWUC#kx~mkt@kZeHPL`8JC9g` z3i2L&k_X@sT&0tnzDNoVhwNszx&C!Z9B_RTy87hp_Evrq5xncs8+bB}p99WBQ08jd z+Q<$ugT9)nd{rnWqN#o>Djs!dk<#`wQ4aqo7LHw|I0>ql*IxVdSZjGoU65ID3ivMG!rdH)8%%c%x&~Ie$w`j!d zc$<9R;Db?%J4{uyGG2K&E&j?EL7CTH<}2}V9IhCO$t(>zm`;mt;@Z{=0psEnznZp& za&`HY=`Ki+m#P!`Ka^MxW0=c8(90MSMvqBHXqdKe6WE=?|%!(t{tm8 z*`~Z%p<*AgaRrK>SNMW={kP%Sr7^@{#m9~uTTPl!BgkKm_S3t7IkGg>Fg_`8=XSWn z&+*OVskfWReZ?E{vsJAll)4OeE)$z(zioa4bUQ~Y^GQ*?Q}BWBX1goX=hK_7oyi%? z@EDLT?CHq*rv!1bQ*yO$M`%CG5Z!lpS}j3NTF$7}*_be&pzUu{t)nd?I9CX!^(sIz zKYJRmjo?_`@)+{izs^K$wJYckLxQr3+7?foS48ZIVS5IwL-g=w9{8%O7+gG2T#Ito zII3w^=M*Iac6e*!F4E7sTUJf3si%#9Wp7tsyuOiDEH0dKO4I&B`MOrgyl2f=Z&0jn z$Cmec@p@%koPO&G`ifSjHuuRUr|oA1wmK}4kzm`WLsMK#0O@U{S9JO1bF!r>ro3<) z@7U&LgwAtnS{flKQP}pPZ6TAgqdfHFjvJpe! zZp|0oUsl2e>@%3(=FVle9Qyt-k%FoSs%iI0(Ar)NWK?DN1fQ7E3CV_~!@8RYw=FO6 zD>sLaK3FZ|8e9KGP{@x>p1v*wKVcl@29B!6c90$sjGrXiRQo3Pc&0ML&#T?(tTH}1 z=t4S+%tlt0H|{znSQD_^0`4j}WoXwV;ZEG^>=2s62mXS&OUh|*-l~k4NNL!X+eSA9 z6||cLo4*9n=Z#ztsbzI?dCTQ;wB+*9G^Hz75E^&Bbe=#k<<WQEfDnn`c$W?>&fgUj{pE~F2W&3nj0-TZQj z0D1uZL~KK`VWyJ-OaH@h3?_pVb#M9j_kZ9Id#S2WHFZj2T?$t^)5{(OzUV-n0G{9h zy?5%3h3`_hN=8uVd%cRagp;3h;NcQR)DkO307L~Msr9+aT=_lE=BL*q|KtDSw+;yg z80|Wz`17?;g^!PiX#Nl_kdUtP;(e_Xb zhWe>=@SgYg$i+iQp5|~7T;-CPa_pOcvtSIYaFUa1c1D@XfAZ!K#{p&LIj#;pay{l= zJPYGQ1P4ghAJA=$8)8Js5JA@DfaV>plzX$|KEjej-IN~}saSJ)SgU@u@c^v+%^AM* zYS`R@`t*qT?d@Ic!n#AZYa6EskpDxbY!;aHzV^(Ue)}lUxEW>p2Ps;2Iql2z!imd| zwdi~O0Zr+2QF^(A=)tlrUilKB?AIA$c|v@%amp|UOcm7`mPkzIaa=8FaCGEx{O=cd z3oMJP=nbvdz9Tl}%C8P^{$A*s()(2i?=$WX16ZkI!1%8k0H!x-cq`WBSzMCiNG@M# z;RSI$b>OQ(|9GXgGjQNtRLmI2MLEG)ZIUOw&T{9xEzk#VtpK^N&NXXwKU%^J39s3D zVf&;Zc3mOxxl4}c&cZ2sw8(AKinz_fFF3)#vmMK2mP^BS5*@3ppG+Yh9>`|@LQ-a(iTr;CI*S>%R>!c4X)<`U{i=Fn!!~;7elUk@mTn6y zewV#jRin)HT)tJ=hUGc}N+eZP?9SNaeUt7wQ1$2gOYMM1Y(?y+j;(vmWnXjfGWg_p zheTG0rfqk!MZXIDD*-L?-MMUM?C7l=+m6xMAA4v}Ox)UXnVHYY80B5aN$Q!q_r0|c|4L(6;;Ge;2g?g<8t}#;MEaeBQti;6 zQsC&Nlbx)Q4wJAD>&)94KdrylDT>o?6OrawD_Ra52J=asK3Fkk$$f{ zeukROHv!5e$cSJecH0(QHn^j=WGH-Kgme`@Ba-$JOUs&Hy=mGI=B^=>)KkrB6%m>=LdCvA{Mjf@m8DXf!{BnRfK#L3F~?{3?W=EPu`c_EyR#2@10jq|6dIis zU#&+Kd-R1j3`VwVYKw6ltr|hU&z-yVp zp)hDs*3?ro_eROHA!?q`o`*Xg`rs+-Z`faBCPq=rs}DnfMGS7Ov3~c(s2+QMxJ~-M zdSqT&Ks{APihh&#l&V-O?iRi5T(x%app;ktdX%4W7eZLg6a};kcPnNkZR@hQvxQ$# z3`@WyXQ?>2t^vx+-}k;YHPvJEUI!Tb5HxPUTo#*qD`?#7kwn&FqriiVDo?$^G5x0q zEKZw^Hn9s2CMPAH2MpJjieps&IXi5+S2!=z`s$@T{uaraGPZJaV$Ca1G%|!|4rBId zcj2!tt+qFjCNgre)|$5H)p>tk)E1fU%zlMqKIoXi`87I<(6tKNIV<8r>*Vwj2a_^) zdEicI|MABUlpSjp_`$9h0bSOxIV1D7df3W*`Ev-M7(sO8jjvdxXPc8SMux!0OeZsC zZvHtMWlm|!0CQzDF@bAr{))jIU`KKVY2`boV{gak3VSFY9$m*{|WA&s=|5Gi*&LH zE*fF7%wt9bw-z##DyA+!XcVQ22t{;S4yAq4L{HpUjaIo-V+tkNmj+0eZGUbIVYQTz zZyv5LpL)+&Ug6#IfhQz=+D)$5Y!ypc@!&qPWas>*&O@q8YN}Q%*yo~D^+P;<4ilI( zr`>dEcbNG5W#5CWFA@3C6ny(_A3{~y^G9DK&w#7Hj!58hZ7GBGr#mS_`%Si4RYv-n z=hws@&KOrI-m&NVX-DIBIhkT}40cr1U`4*`^BMWUbQ!9i0bXva$!W7DY|a@L>r=S4 zw_p3ILYC?@m(4n!LsucOrG)oMDzKI5TkEzZg9b+3LkF_g(jf)m&NQ8alBkXJo0_4& zGC=1DWnf$2j_6!7%ADE{6EK)sZ;08?qEsk=;fvoy#s|t4Z{| zVtC@(X%yQFoAcLQ6K^ZNTFZcV%h7t;O6t*(8_g{6cY@DH@9@>uPVy zp!HNwP=pP_{!D;?KSB`z)jxp*yd*=ATMnRyF`RwlpZU3+-%wDD4DIX2cH=#M$##6I z6=3j?N6z*S3CHO<-!r6*LniMBBOz1Vz9($@bTx#;Qp ZD0O={QL)|c*}s$6b!+>pWGhVS{{Z(#O#A=< delta 2119 zcmV-N2)Os_A=wa+7%>C`00024T(wmI000DMK}|sb0I`n?{9y$E0004VQb$4nuFf3k z0000OP)t-sM{rD$u@!%40@TX@000PdQchC<{}SI~IJb@Cupi3+00+xSL_t(|+U;FS zbK5o$=2N-~qAXo0D`Q#11ckALLj|J;07X5fLQ*O`USEA zH|p|B$(Pu>|70Lyg=>7(<(E<{P~o>q&2O_gCj2aKi)M;9eEct#@7W9wepc$oQNRkn z>IsShcKB6~*e!qj_>moc^|KR-^}BODoWMJU$FB8LBxDB!`1g$AvlJZuOMQqS)fIq; zf5#xEXbMCf^5xr(X*(a(Bb!*PuZTue>ksLZ+ThP2`HQ9iARF7@AM!wGt=Ycp3JU(* z_f66+CgvVv7;GGL;V-{j@ky8?kfGiB@5P*C+PVOd;naU>{Wk)Wp{^JV8Qz>DPh(cN zQkhOZAY^#7IzJo$3(uSY5Hc+7&W{9uIROA%WMQ8M06Q_>!X!fg_F34sg+OJ;G!3nQ zg?$tN@Zn6mH*jdWb@=`@0D`V<9yT=HxSX#F0Q_}3hJVn|)aiWH0Ek%^@EX@%DFS|>c5bIneTf41^^r)w>H{5 z4TgZ!>jMBEDzUn)L&Zg|jBnUjhQd18!*P+rxs4hhe8QIYl^bpoTIVur9K+0B78s5S ze5(=KH(Nhsc9WYA78mhtn4Fvd@LZ*#{cuzu!mxiuYKDRH3!8MvxJY=Sx+{7HK;X;} z3>ucmGR*SO1%Qo)VZsvO4zv68JpSp@1PmS*#j+Im{!sllKkqfyL<58+vKm;)qTL{= z(}e^GOFkRp_e=m(j_yTNh1&h#o&fL^Sv|I1B!OmT!8^j z2T>OW%hovF5-6a+z{j;it@&#VaLzmuIl~}Z(I~(J1?d}1NHAD4bFvfO`i@8enbj3J zO^-}AQh`@G1-vM;mzXgn^+p+GluA>4>!op{v@tVJPXv*nL3o z$S}$bd$#yb&jxe@-ESE%_*zrmyUu?h_!I;euI9*~v&=r5UDzTsSOv;UI0wGG#OVI2 zI6#~9HS8MrDg-4ZnKU$oHAZS7A#OV~)zeE1v0RqSL3v(;5K;jJU|C|4^bUVv2HL|{ zfti+AH`V|Y1MMd0)>gCHPbm@<1-jjKb=h+QnXysKfMuok+%P?FL337`0#1&)gb5< zUjenh$!EANf0eae>S=;|Yz2Qbe@_}d1jk;njfv1PvDc#7mV%4*U0FMu>2JvCHQbhY6Dd#u~V2I4Dt)wLM29MTCfu zD$RRXaLN!UGVWu+5aWW~b>CfPImRLseQ3`Ryo9*#KDP;muQ=^9dj)?+L$1&u`R2kQ zhQBVl9$hSqQ@E+ib~b+~NAlOJv+NcY4$<1eYZgu(-M%~cLR9{cQ9{IR%dSeuUvv=Q zy6RD3T(#z-M~z#(nTa5EAnqGW6}OEdXw<@1g4{){-e^RUJXtIAPNIOCGa^wyE#}a) z*C{tPfM$z13%X?AV<5q#G(M+Va zmH_q{EBDjnx+9pYTm)wb_sYtbYJ9j+!qo`S4ymgvige2=BnW?=)Vr>IK$lQEiYkBc zCwX}LUg%vUC7@Ss%x-DxAqha!L`DLp&eF2q(L%${RfpG~zP~*igbf*%T+TjBfm1Y$ zU7RD>sAPS?%1ohu2P?jii7ddg6M1h6$cO(SFm3?nJ$3@2lsIuW)y52^qP=%%5M)Tr z-G%-3;|TA!=mdZJn5i+@-G0Iuzve+LRr|uMcjAMIyz`Siyj{yrpJc#>QL$10U-RJY zIbOR@JzS|$wKHj+op*8rL*d=uwE~YGmDCD&qXIv=0tul4f|~b~XHLb-lXR7xUBuOg x0x%Z5C{t;L4|EF1qu+NPrM&#{=>5;-A3qK9x>2gUhyV)!002ovPDHLkV1h=n;`9Ij diff --git a/TMessagesProj/src/main/assets/models/coin_logo.binobj b/TMessagesProj/src/main/assets/models/coin_logo.binobj index bf502ea820270127271f8eb99bf36110f24a382f..603ced6933dc7111f187d72e6c36e4dc448b2126 100644 GIT binary patch literal 46948 zcmZ^q2fP$D*T(NIy-V+K>0Em6o9xniZvrA!qzg#z9aKO-6i|xN5vkIIyR)kzAYDLE z0THPxSP;dA-}9WwEW!7F*WWS!oOzPTB$?#Q><|~1Ds^by_Tj`(>RVP&V z@=lj0CJPn#`XAwix*8qDM?MSW!T?{5dES1BxfFmGINUA=9h z*%+TKxckw1aZs*cNC2fRM`Ad)Ross3H?)=-K@HzJJ!`GqqzXcy`5=ttpP7u!X; zzcfm?_S_YbHq~~6cZHh%aXu3IXov8)bO$4;)xY4qp&8jqJ9paM0%II6KXP8qeNxyR z-|dk~*ILKMm;BPA7XnjvC5Yc+mi5M+nrUP6>&hRk6^+N#jLnxz<^wflzsoA~q0+U+ z!7uN04KB|dg1%miagD+5KQ0d*>9`Dj9b?QH-Ry5)@NT-S@YmMO{`v`=8Esx4n^(|B zHmw^KDwr%EG}U8_{=|H%E%U9?waU@>3I{^9@2!A_d{CJ4uyU3yp-|KB;4cT>D$F^l zTh9*FJ^N7ny7e4k`s?OdBlDJeZ{Cudym37gYW0oio4j#DnEDp;=7n^0llWWAn=ed% zn}j8yz}W8MZW82zjWIB zd8lICdDp-9f-wD^bG{NP*M(zL3Or9({DV)0O5F*#{=uh(#lPXlQ1L&%bp0EC5*Gii z+H&7XJrjL$-;vu~t`j`HstxqT!2xh9jM2hqqnW9LX~wWU#ldNW>91Y?RHWGQ-r}!a z|Fkgu<$m}la_t-Td2z#kNRlyC=kPis+e$V~q-DtDthKN7+ zpZA36&-%>ZXnU1I>dgAg5MiDxebsETKJZ-0&wecH130!mkiGQ**BJ5E2lA3lgQN8d zgi+^XM*qat4a|o~_Bp|5!j&4(JZ6krCn0^CGuK z7K6WbjJZB|>ks`ibG#eb^up(&@tB$srCLVj_sc7Om$`oR_XAN%8c2E2+{~-RovtJDE>RDX;E*BO5`>9F< zchBK{T|MG4>)&29RdCPPRN{9zh3L2BIuhJ7<8|@7{F?Z^^_lgoeQ`~2cdaI(ak-Ib z7W!ueH)p9OewS;AKX_?&@TJq2#qTl3)X5&+87%ihC;DTIw#C+ej_K9BFGq6bcm^6B zW3H3lzJT=;`@&7x7s#0!w3mH>?ClHW!g04EJ-&Vq^^k80b5AKd^+Kdu_15q=27fNh zy`%Qrm9me}-}H~qWgn?@t$C=+``IGpKQ0VCIjb=Dl>W_UHxO3aRa%lnc$=`xRMdJ2Nvhv+oSy zmT&b7%{V(tcv||Jq3M5$UN1YLLetKEFaFKRCx)hOdPR6|_Mbvi8f6lWgr|olcI+ek z$$=`Nv734dA2}Kq8aZQejE67$FvbJto{n+vVv}RsEx%ho%RXJ|0R6$H1d4fkCG!o9>KNtKs=K$f+X&Xx0<~iY1I}V02FL|A;r+xHkDEonF{5@hyYVrcH!jDH|8uQFx8;oEmF`@01=a zJoVMg!Pk217k;5>C^$R3NVwD4w!tyeQVQ3Zm^IjUrSyL!@1Ny^?N_n=3C<7QrUo0# zYcIUyk57U%hWttnf7W70uxxYoNy5Rgv_xQGP|>qL%z_Yz&r10 z;fy)wJ9$@j5zf`^n6vHUN#H`E_|{z`8CTp9F82G|k!E>$y@f&vol{0;ZRI>E6e>09 z*U07_jfG2oJ1=tX^Dn^(p`xl)jkev_Tlmz{zR{*RHVOav>%pk{ zwi7v;Y3b!?#ggv|=X(EUw8Ymx3dg7WJzAhlIpJbsUX5nUH(t2p`6|&gj>bB6**HUa{lGN#UDTaugJ+#G6$mh zx^{~ko>)};IhW*&eAuY4aF(|INciP=;q)6GL=HCFAe?f`r;!6MHzY?MRo)RfxZ|ww zkIzqzM8>BQzFO#DiH@Mo@#3BlLKrHS0Snn`%s z>**rr)5zQozS&|^Br^XU@h^}2GP3=7u3d$KulsgJ-hQ=;@Pg8rBa83%5T4oTVr2G2 zNBD(9CnIC3v;BpF?M`Qk^qv2iaD{8RBkc!`5>B;uUZnm9y~uid&R-+ddi^Gxa!{T~ zLTk>kLMr9?d66P#E0Ud-FAk36IB;9|w|Q}qRQck_k?O4GxLmqHKd8vwSd5A3FTL zaGqJigLx*l6pqhcKiFx*Pr^m|Hwn&57${tH#?j!8YKw&n-@hIFven1J1v*~{#kFOB z7K-Nh{I^i%KcsEZ^b1#o3O(XnDiry*bN5gM&3Xz&uBDUw7%P(8TAD2*1@bM`%jhw89IX?i`x>{wd)}V~>ZXT?q)c{HAeeM)LB) zxdS6ZGrpAZ4Tq=tLo@rgp+B5&RYQ2ObhJ zahx4~QCv4(6VH4L0o48Kc#C6~W5fj%5o48Kc#C5_Zt`jzKov?}PgiTyW_ToBW z6W5WwxQ^__b!0EDBYSb3u!-x0OiR*+-TqkVe zI$;yn37fc1*u-_<9bQ}~Y~ng$6W5W0Cax1Uahx4~QNA}{n7$dHWG2%M#0?{C@ zi!tK57$eRRHgTP>iR*+-TqkVeI$;yn37fc1*u-_hCaxoUaUI!<>&RYQCv4(6vKQA0 zo48Kc#C5_Zt`jzKov?}PgiTy0Y~s2YBd&`v;<^|ku8T3^I`9rJt|NPKov?}PgiTy0 zY~nhy7uN}!xK7x_b;2gD6E<<3u!-wjcH=r%x4~QCv4(6vKQA0o48Kc#C5_Zt`jzK9e78?#C5_Zt`jzK9odWP$X;AW_ToBW6W5Ww zxK7x_b;2gD6E<<3u!-x0Ox4~QCv4(6VH4L0o48Kc#C5_Z zt|NPKov?}P$X;AW_ToBW6W5WwxK7x_b;2gD6E<<3up8Iy6E<-j*^BFhO&RYQCv4(6a$KB$f_^^tue$g2 zCVF6rWV-i>6MDew>2&Y2>GZ&_hv?qBSL#7qO6lG+8tB1ef6=`wkJ5eWJG$4P5A~3$ z!*#EN7xj>xXLK)pPj|2ImF`g^w;r1QxbC@sh926qi0)b8lpZ>4qwcZgnjZR69^IqL zXS)5v*L1h}$@S0`3-z<_R?z40c(H(o%)Gf!~&~3*|)Gc1}>5glC zx@GaQy5rGOy2VHRb;pZ&b&H+>9P6N)c2DN!GnCXFPcPKX&mGt8b7s*^me$nqFUIMH z`X$|9Lv!7r#K*eD&+~M>xdn9Q3Sq6^YO8CVYNrFY+UbT%+UYv4wbK1RI;ksPEv_>j z-LBPw+B*I9%sMb*s4na8udBSZQ>UAPUt1?+(!uI$b+z@Yb=noZbnTIU>9ln!=~~0< z>9h++>Ke{_GXy6Q7ib+(R+b(NOAbg9$% zbmiJ_=$zfQ>B`-5>3(&`=wiWxy5>(Ub%nPc=sfej*Oi91*CltopevQGsq=3yrYmlG zLl@uDURNAAO2^MFtt;l)sEdAZQCIkTx-NX>2VLPxX7$Kdv5NjGgrExJHNYD zXZD}aJ*xH9PnEc%yDp8_neLy`-S_;WGle_E`pfHoZ@zf*+?!|KJn_!s)#uG4Z(f=H zP-D+`SNG~h)RZ*4)VBTi3Lcjw2c>1k%F zyK|mV!*cFcKU~eMX7qWaez@3C4SBDX`u^wMYUZ-J>igUOs=;YDtMC53uVxJ@t-ky1 zup0P5R(0p=uhi`9x7D4`e^vvcXVvXj)2rEwJE_}qUQ+`~R#mq$cr))X~6GYFCr1>d1Z1|c)t=w$sE_yD zQTxB$s3JRODqq1?>frsXYHW)O%JENA2UDC^2j5DkhJJfrg%gLW8AF<@@YuPkU+sD- z@xfO0^1}4$;HSgXv(KJW2lu86{FX73+I^(GTGXzx+JB*=>ikSabs+s+mDqli+BbQQ zYO9}D`~6qc(ueER?rB+7^W|05o<2KO;-QD?{r(wMmLg^4%}$ zz|h+2y*!@=en?$Wt=kl*KB&G$y}ReQTEA?)+I;FMRky@xweg1+)xP~z)aG&DsZBqh zR-4*=t@ft*Q*D}*Rqd`gT5bIJY4u+Jvufju^;F$$Z>n|cvZ!6v>#2=xeo#9Kf1x&( zx)iv3KAl?GX`ia!w3mA4&4H@nqv2}R$$hHnnWk!mY8AL&C%<}Q@j=z<$Y8bnPBGP? z{oiWoqyDPvy?}b7{%?W5>#kP|yH8ZTm)BHF65FUj-FKN8VH~@BdjXth-Rn-&0d9KG#&uFZZf?3v>LH^hea% z->#~;Pp?twS9DRcHk?#jat&9rvdmC9_N-LX@@-K&>-SdEs(h;Uj%%sLkN-s#Uh|5Y z&~C7*&~t_wxgx7Nux_;)_R^tT6S=Em=VKbrJX zmHKW~B|4>7<%<3r_+`{cResyiz}+%6RGIA&RqofEs$|*mDl%rI%AY2edh_1Ls#q{t z;P##ORYHv`fg2xxuZlJApaPK&DqoY)fp0%+tKxs`sFv5Lqzbgn9{9GzJ(aI`C-ug~ z5-L~1X_eT!pUT+zrfQL?pvv;k-+>#c3aP9wO;WF&nW?gzTNwCmLRXb8exK@gY@$lv z<}0;u+`B5{{u^rEl1?h!z#VFT$#0Y|Zmk-0wX#axyo8#Id71hzU*LYTHp>5CnVM1b zW0h)5HZ`%v%PQslGJ$`qZ3+CAa8d0#zbx=wnawIy+{wVL9IvYPGMo;atMQr2zUQOB z>0=3MUD+am=;hU_M4J?W@S79VTlIDYc40o&?y@1U{f)Y6QBNnZ@tx;Xo9+_>>rd5H zv)`B-cqi{9_5AHZfw$X#D)|-1zmxomJR2pyc-E_uU!3A~$7gAr=>gnNPBx6Y{k2R{gO&OB7jE}tdP>Gv9Hz=1h|78`z5 zvv#Zrw3yLC4a!<2P=EU>H7nK4K>e9-tHB5F1_DKMshL&l2kP9vq+Y0aDo}OlN;M;H zf1v8v1U3BECV>iR9W`xTFi`&C4{GGSPJuGbpH@@LUJ8_H;8$Z)-wc$h&_PXZdMQw< zTpcx`Y{@{v%mM#%UwikhxxZugiFebg^L^D5(vg4j|s(jZ>efsOq zdSL41;-5Dlhc14qu2bc5d3E&M5yPy#riuP#Tyu$Lhn*^?v#G=9`{{u@{}s)g z96#xjMbkM|Hb&LQr?crn9X}WU?mLKMTV)iE~`+Q|Vz1)jWF(J!wn=>bNmZg>c3|)pVKk%N}&m zFBaQIeYiWut3ucX2A3ztoGL`}JJ)~VS3Q>Sp3 zdurEryPOIw*Ey9^98{II7vi`(Ls93>?S({NB}>Y{!(@$|$}I*sW14kWV*_7^U-X}L z7X74hI|IL5Um*SoO+HX%4@sXpRo@H*dSQN6zP!|_^3%n@7PPbS(I1`37qFraH<`7|KQj(gPh8hD?8P6wmOHeO>-)5+ec2Ecz=&mIoIFL(aL_JcL z`q6zKi5}yZ82u%yQ>EdH&g7K8C+_&TvS=zdyp(t)?lY&#J5`*C`woOtFZYYT(&-zC z_b|RyK78m*`18GRzAdR;|D2PFe@$BG`e*D3V=j66aNg9*oyzIHaV8XgK3s9ZA@P@= za4-DAnhQ>a=Px^nlw=@^%ZHl>ZcV%B&lgxD@wp9cPDA`s&x=OIuPq{gQ2` zUgf#h+o{oaiBq;o+r*Q#PdJlyd@TMI6CJ1Ipu$f1KZdKeb51(rX3lZ_FMZ|tb(;0N zolfWbiT~n{Rh@pPMko7or#R;7ShaCZ_Me9GKGhi;-*MWX&L(>CAN0HRtk~(a z`)=3cdJ431s_Kb46Xtij3u)=sd0*b*H0z{=Grn8RX+QrZ(O>Nvak5~pR%}^Eci4K< zN&jm>(KLAa{Xn{UuRDcL-_RX)zZmluPTw?q{?xlp@oV4ff`?M5WEXh%Pie#^&dLTU$^93f1RkN{XcJZs`RU&YiuZ>aZd67zI>ogj=6?4 zN>>~jr)$i5`mz4|eAKJo`##diF!!t0_)&BHt#wQ8S@q|lHQINkrBn6oW4e5a1G?6( z=cNt)>kHH`DGoZ-4^+?%p^X+McaW!{z66?Z0wpbARayE1CrA_|`Zz zeypkoAU-?gt~nZGpV$FoQFC}BJ$dM7f!RlzNj>zp|L0fnkKURsJawq-C3clEXnK^l__|)*<3(v4@U`w4HV)b6Wn^jA7K9G?pwyGHf2S4Px9Q((8g0(Pxw%ex=zlv?VYMflcNv1M5c@Xh^p)4 zSbol_TKb%m?(9cS$3ee7)_1-}efa3&^iB@!UsVh2b298Z;B=@Y_eEIBzTJyu!$((_ zh-uQ{KJK{u9P4p1;{I>HB$w3r{wK#md{B&o4Y0qCv zk2u}$%i0)jeWQm{u}TW3Vy(sDMb{TNC9manDxPVXcqaErr}~K8PK7lW!q}Ick@E|) z{yNW;&+F8j+?#zAerm!@XW|QM#ozt2xt?F;s4>f#Sf`r!mp+?{>nT|kfTj}H>iPEr z7f?6mrc*u`7b%68`Km{ z9jt#|*{4sYa>`&G<6h5e8L20VrZ4)v4CYl8eN!#Ft(+I#eNZ7DbcR2yA)1R=1M~bf z*(o!6xtjOxDyLMnZ=H&7UDZ8~C4_(d=^`~c%jp|Vo4q-O8UIW=G}tLVZ@AA$7Zw9mHjcYqi8qiLc;3nA~fxXuewa ztEUmM)z@pCQp+lmo$;xchZ|2mPF6E9 z*GE@;mCV>D?DYxy$}xS#K6FeUCjNl2oz(aa^-i8;6`kg(-8x51y%=5@_Zj`+>$@-O zzUd^sat7nMINV?QE&KrMeviFVr0l?@N7RwdW66OxQ!nS*MArH5Cg>((+?c27mM?X_ z-apgtlzi}!6KuJT99}&2qBF8sL*Xv@wm9SRZ6PPNsJc;4-h5L0@2=|T46BlYthfi5 zbwh^`2bcJJKmB_0^zng-h5i-I{*$Tnke7y&odQ2ZoW}3V+}17s_)6z^yBGbkey+%N zT{yU+iBod5^qcDWY1A3J>ooo0Q~1tgK&FLcC*6r^PR9|l=Y|jT>7s|!K0$wAz^><= z$!`=TJB_APapIr9MAjKoJ?miICWi-NZyj5zg7}}CU0PjPnU}2Y;u?Eh@sY#d`_ntU zhm#HERy>!0@KfRp#`pH4G3hIhuTZys*lt0nb1Irhjd?*8IT zn%FV%a&L)A!Z*{dclzwUOpVhe;jm8e(@=8w-D>0Xuuwc%P5ffA9+RvQS;u#c=tlEe zlLH%zrsFdY+37T;icVXh137&7$CY~EmSN)WJ8q1+_I*BK%;hlVv~b$>&7Dr}+zt=T zv)UQ+V^#XYSNBeFo=cuvG(!uO4evSfzHk6-C>_Zon$ah}&|~^85&!s1B~@d?`G#fC zP2Fdo@VJD-&KOl!^rf+v!HmRicr*A6tjDG5vn&rla>JPkoe%7ol zy?)-Tez=vKn#3v3U(%B&+#~BT4?YSHnb?sWSaRo@GueHv2_HXx!WpnCOuwo+zpyj@ zSLtWXwYj$Y+`&CIFv=ZkJ?V!?;s=Y?P_J9msit%LuaKQ*8&3)UIc5-9C9cb&2OsYv zJmA)O?ae)|t#zMIOTQj>u8e9vsig3rj86EIqVAX$M{HQP#aZ#k;h6*Rt}w3MG1tyM zaZH~$p^@`-i4C)^nM9n3mE;`dYPP51uNgG&AuKJ@l6o>%*(ZFahymAxZzMU%D;o|otk zcgHi$*xQP%mT&pec`=>r3)<=jJ-Nhzz`D#UsL|ycPtmp9bzZ%8be4Y6-8U7V_lI8? zL5=gm>j%SIZ&nh0{bJj6(W!DjI!(~e1*TsYe`mx?Y0|iJBYORJXV6_))3|0Pnsvje zc3>Hw7e$YC)iLWT*IVyi2rqkOlJjEC&eS+v5%VNlGF5oY?G4I2r#n5{e;WSf=gs0r z+@ZSv5D_jI`b9S$BB{q(Cbv!2#t+`U7mLG0VfUC$MsBfa+n;oMEJ+vIiE zhhY36C!vDeFAkp916X%hPk7IuU!9>gWgE^}wb@Ts}N5#_~=hO)|dIaNkP= zzTkTa_npIc&E%bfyk|gMjrR;rCcG>70c!`|A-L}o4D-2rQny8X?q|Jo4PP?jxAnHBK8`0h8e4B`8sc~gqp|gM;7e)z zw#F`NYZ^n#cJR;E+nO{u#&+<}*7H0(#y?wQm$fx%p`-E7*4vtNI7Z{2t+zETa4fwj zT&<_KHLY+wgVEUfn($>bep_RgwKZ*^&6I@R*0jU%r;Ntd+nNqIp4n(@y{+LjWic9C zZ)S&hclb1q~vep_RgwKY#en>`7AHTZHEzpb&$R>AR{Noee{wq_BuxsuS^{#S84 zcM=-g-xbI6B%!GUUtZ&X4QW2Zb{lNJeO_B**OMQ0(D-MUwKZ?xSOHPET2DV8zJkVY zx7ofHyPjpx#v8p|=PU3PGJd-ryZ)DOyl@g4yX+hsFOr1DE^D{vO=yc6z1=qUYq2Ei zvFo3Sw0QWw*iBJOgdHB=q!^H-7tEb{n|2R7gT&m$fykp{ym!6Dz_nofTMhH-vFqOoe{C55R>M4v zUDnocZQvfsztu2LzXcqC@z2)SW$iXU3!S&G+wGqSzh)))vo&^E-rqqA@MoXPZiB6f zhb}}h{%k$hmAc|}*Dz0Gm$fy8pskmLej|MKjo;STWo=DiXd5J39g{zdqj8^5iw%jUpw#yb47 zHFjC<`7K59q{c4$0**5_;-6iQT{atzwHC#b8oR8m=>=_@B=m#fYisLqhyR5Bw4%!Y$=(E7r(fDnRUDnnxHtdvyJ~Mosjo;STWo^w<&_11n z-UnY57}Jt4u7Q3S|H#Q;-Wr=6%ssFRECtLi%Q6*UDPi0XE5TC1?6T#M=f0B~#{G?Y z#_4uh?|f_59~HRL&WIX;zP)N}55WjSZr7xYobKI;af&MwP+fbHTMSsg}wZkS!x)^JZ?-*9iQ z0b^OVkNrzO+liUldjs#xW=cv-KQr`isNr!8iuoOKp99Xn81rJHe>uSlMN}BG38DvE^DtJ;%x} z%el$E=h$|EJqzQw*=6ZtyEultx4f~k%Vvb1W5BWEbyLs0UA7nU>@SW(4;YVg9PF}v zkY_)(g!P0`&+)O#+M2#N#=hg2^oI3-d1JzUVc*-D=a8q~8!Pq&$DtpL=i@Psr&pF^ z!oK4;JP)Iu$2gu|S&k2nQ`g_5JZ6{mH0{pH<{p{C4Ft(k2Y3m0Y zKl^nEjMv=*X6s)-o_)sau{GI{r=ESuxxhYVpACgk&wjPb=0Kj~!~Povqn`a|mwgd= zjwkzXIE;GslU>%XBqnJvdfTB5PYM58{ZLp_#2TWZ>*cuqiv+P_td0<+8Vd<|jm!Pq|Px5DhQo@N{T zY)5_Ab{MaLWp}`e!0N(w!fXxOO8qWaQCJZ6K8)?|1KSPr%I*QPeF4~B7_T7++XwT? z?gz7dwP7E?cx}`lfZ1h>Azur25XNhxJ`rY@wKcq+8ZgdNUMI_jVZ5H|Fb8I9iX%^b z1ZHb^oz-Ab82g1~KZNnGD(oYetto*#^&ca|oQbqA>=2Co@|$5eS z2Sbz4Pl4|RW8s0z5b8g#u z*1_}9Z)xnZK3fxkj@S8LJ=@5Bq(1^P8oR8|*6{x1`2APUzL{eDmc}mYvo*Z8IWJj{ zt!LkJ-qUYs?6N*v!*zl8+kf>ObKdjxTN=Bp&(>fakvQYOdd{g?rXEXUm-X2imY}?HOJkSy*_y-9F=qL%p7-c0#&2otvOZgL1X{*8 ztjE@K4VZ8Imc}mYvo%MdWemi6Y`v}d6vtjQ8cXlv`n1sazd^dlR4>*wDtD6uHpD=Mq}516}~0LZ`WgKo@n#8(7tZ;cAa0t_eK)+T!qin|3p34;a_U> zR-Hbs>&uMa(mYZ23XU%~8oSL_8=k1=2DESfZ=G>=J;!nUt^cj_iF$70_zI)3>%0u# zO5?ZdvFd-Ko?FnaGJ3mCyPgv`zS?N4I-jWLHjck-G*+EH?xpV-zomJi>?IsuV>I@; z>^9h%lhCgHU;Pv3x`X5EjK(@|oL$c;9A9rVcAd87G>&gD8cYAgxxT~kjYeai_bd1| z8NXeRUB9h41MTMj)%zHyylec{xt?f)UC(FGZZUeh&M)D6&-iVPRrZN=NIs8H-1}Vm$fzLpxu##-qxJQ@tsCv>o3B$%lK`LRrZPN`T^Sajo!XS zyPnT+e0LIcUVv|p@!J}!tZxvG?=>3hTy`6t(A9?~j`3R>yX+I1`_M*` z(A)L=isMnEvGh;W^8m*g108}{`X@BM;TYo^YApQ|n%{AZu?sbp{t3-PbDSDW@9U5J zC+3)?vCBT8`2$+U2du}|+x7g3V@Hg}(mzqpUpRi$Xe|8`n!j=UQ=_r;zUSdPX8e}M zF8hS$A83y!q3;LZ3FEgkc3GdTc?2!jWnR0jw>AIb7}sTLEWPhJ*IelR#{u)gEWro=705l;NuzxzpZ(qtgWGl>(_tvz2W2fMZc}F%l5)?t~>wL*kya- zIM=EFYV5K-aQtEt8oR8m@k7h?^uKjJ3m?~X`fW`Q_`LeNgSp52S7Vob2FJNC{#Rp{ z?S|u*lhD{@yW;qjBs6weTayghuanSsf$ysE+Zwy<(>VT35*oW~XB@wlgvKswYm!6z zZ4&xU@Le~4TVt2)h~qbs(AZ@=;P}lXGf6D`{fzz;NWE*f zueT2T+|Q`7>#^&%HT9w8KKEaJZTPrX(Qj+)vbAuWd)0q6c3E4~0NMvh=hS$#{IQ@qd!2$F9FMjz3DG9=m>9lM32@lhE7eYJ`4-MEcWie^vN-fc@Ae`RRW8jW3#U4JuZ(j`%kUB6vVQ|QwtQK#*<+hf;n*JEq! zvXxMOh9uf!m$fzM17F4@^cCUHWc;?qE^BMhPrj#;&{u#zv+>&+yR5B2U;45np)U`A zR^zudc3E44KK5lxLSGL4?8a|v?6S57ed)`QguX2NIgQ`e*kx@E`q-B%34Iy(a~r>{ zvCG;TjEOH#68h5c=QVy?W0$ox7%N}CB=n`=&u{#;#x84XFt)w|N$3;cFKGO>#x84X zFy_AaB=jZWFJ%0-#x84XFh_ialhBudzlibM8oO+9Xo@DGvCG;T%r9TDB=qq4pp!Mn z*4Slj4d$Z{=lCBz+Tug|#BXctvbF~E)Q5igA3d(yhkh5ot+C768q8}S#`}Nt=vN=+ zllX0oUDnoMzWXqb|3{DU^x-}czpb&$+8W#+KHQ)GqmPFl_rLgUja}B(;J)!;-T5Cq z=BW?sn)q#vUDnp%KJ#Hc{U1H<10VJV@!J}^tgXTQ=fghwKYHAMKJL?pklGrnZ0tAF zPoS9vZ9f=T-Z^=^ANirM!_d5hbg;|v9?0WF_(sEyKrl=>! zUIwkdIgU?&fn&dav5qsa&9Ia3zk_sx%ksSL@p<@m!cIZ69_bF3<+<6guLFEHVW)Af z;z)11>}&s+<@t>Lf^+&<-x8POu3CHp{3h%(X!amo>asj>M;_b3?Ii8*XR2XR^4TJ<~V5h0a6^}bH48rq#R>#?41?)4;bbS zpYwej%R?@EvAI0|{{tV!iqGLb^tFsRSmI@tq2GrT?d7w*57#g6H^{&kbAAnneTjZ< zjr2vAW54;rAA64Y3e5I>3nM4DI1Ta{k-vnLWl|YVZSf%Z_QEdXTmhs9T#mgPgr6~# z?E6=c(y~FrG`+={!3E&weQ^zz&#<>|(w`kx0{*X&VjjtUK}LNs&JE`Jb`|M&u(F18 zS)3nS4gPPC-h)*&jB~~qdxh+knE$@NUg9gm?FUHg18vw)H_qRvNeh0_Cb0F7*?;#9*<4=q9 z50`y4Ean*Dn)wXr=h$+7gMD=@egV7?hWpbWLb}Z5*l$4a$DaLhpZT-k`1dfdFKBTC zFz*eFgFgq-UtEqoJ9B*6!1p%{<^6?`q94gV&RdT=gVC?NFa4#FV%&sFJ@)&a0bhdM zg{B-*%saBLo5elBxc_+l{z^zMy6o%mm}6`HkI;02zb_0N`%Z>z&kgjk#6p}Kn42-~ zgK}7VxK8-1BRyl7^UnC?cZvSUV+?$=kv`{gY(IiuejgZy6n*D=8R<}$<+lZo!|;uT z-G^oY($Ox`Hc+Y>e~ul z10%op*e~nWtH}Qb|C>nJCa|2(NYE|HGJ(<^8C~nCqM?Twi<+c%RGiPR?V@E&lGq_ZPm8U^QHpwIR_k z#}CJ3|2hm`O_yW8xm-Y=eR{-bcummB{f4pe*jx9wuKC%ftS~UwY>(x>$Nb=4hm_0?@Hi!ya}cSI?Ym_dx)`U0?+7VfEP0XI94E zd{^T89>%^S=e8K(jQ^fVC4K37Y3Js@jC9q${8+XadB`_82jLN81v*}7B>Q; zdEDpx=qJttvag}VIKSKz=xaawnq$v?uWGS(UiKO0WNfa)Tg-X)5P9^sAJ-#m6&cs> z`Mr14oKJqVgX_J_t$@XK!FS=$1`TxFqa=<9S?skR{{v_^Rt+p}iah%jW9!e0 zlyijR+{EHx(9cI6b@+MSg)V#FrO@wd3FG`l|M?3dP3f|)g~e@AmScc%_7?$j?ctcW zvA6^HCVZG9{*vGuhB4PXzpo4UD*R}#x1W-IPs9I>>-TjB^M1$&O?mJom%V*fo~8Q2 ze+GWcDSr*{X~WeY`(yKj^YJ$r+QfT9=9I_7p??KFT(`d-n0>`Q@cNBB3jP^LgC z((mg9|L3rK&{Rfx!DV01$L#Gdj0t?3;opUn<96{e%XL!1d%i`E}T+y9f?wu6`zQnr zB(mRv*ci{tjziSIOL!NV}5j6Rb;vDi@VpEG-fpO8k z#?ZtgP2qAZHh|xI4rP4d?}&3f4W;+#JP-9ZT)*#G@RzWA&|rO$ z?>)fYzArITZ}`s}O%)u&929>qq@NpZjr0+Y;rjfAkh1-}R_|KKEnq2O&7moPG>yy5 z$G8;On=^lb3!>f=NICZnd+%DMzPUI)5XVq=Z0{odF?;V?eVA*$-Kghvq?~u(T6`Ofw)#55 z_Jdcs%xA9{{{Vg;{-jC=$8jc4Uz8I%RJ{znj>@tjd z2|1m`Pl5BH46orESRTWfEM^_WV7R}1H(-SgXSKKzI0Fo8gFhKkmIuq8<8dzJIam6? z?!ZbL&S^2)BKv<|q<3MJVdT6P$Ac@to`d}iPs9 zu&kZ;U4QKTFy@!<9~iD#)(G~K;n+Pp2)?yAz6B}RdnZPgwVv~1FwTYXl=mWF?jJF( zk21d?KLncW;2&L%?OE{0^ynvlZsZ~3yI${G7vbi}d%ifoy)S;d+d$HFdW1E zDA!5mJSqbtw@2l-kq$>a#lSzg%ylisxW^ci@!#V3%Yqp*fO&7nxCfYP**$0~BK^{3 zdtc-HV?Xl!oWCkkj18IdResMQqh9`dB0fj@*;lW)?EU*4`n~sZdIK4+_tK|9SXO-roVtxeWIH4W_U;FYERA8E)|W%RJS;V=tYOU2C-k_#<$M{<@vdmvM6j)AJJ`PTFrE`EzoD^i=;JcL z*xtPGPe#glNS=b!=;NLO^SZJ2#bt(7c3Ivf7=2t8_^QEjz_P;FAG`-x#?x~iu)ngw zsH<)m_v;gS%+EMpQ!ZEy!)VhJdRxPOWdG%Z)iRt1sqxEPsAKYo-QsE+#u^Z3`xWy1 zi-+OJ9TseNlVRa1`Lu&jI zBiBbB<0rr8*K;|p1XAOdaczh^`;>F1fnm-y+us;@o}2TckzvkL_8HD6zuPo%S>{|) znmIV0))>dUsbS7j&Py8SOEbe9b6e8_dCo!3k>-XuM{Ip7*~Y%k|E$FQT}AW~by_F}&K<|6In zavaCX)<2DWb{NOGvtf>vt?!CF=Pbvz3+!1K$HCTfKC-_#w%rVK+-yC|@j5u>ybdz^ z*w*vjqL1U#!!XCk*7ri5{mZ`ZX_$TA1IDt{_kppmIaa-4Jzy+j>ut?*IL5wanZAa- zF=1bDtop%No;q8@@kBq$cPr1kEd6KeIfm>n_I-cD?0Z|!@#Jy#*#N`r8(VK{Ft#$@ z?E8U+IaaoRF!F3W`+ksN_NDFTn#XHpzYa0n1L+Ge_A9S>sA2Y*t>N79`goXO_NA@Q zfjq`UeqSAK_!XqK{zc?Dp6s&`hS>*3Fa2a|M&TIdh&+RibXoez_UDA3bC7KrZJ2#9 z7REWqJ{V(|ZSgd`zVR^5arVJD!)%wWpNKryS+;S4VYbEA=R&?FjO8X7=6P)W6yz(z z*!IaT%lA#TJ~#YjVQl+U!>q&T<(zqtF9l=Urx|7)wmvWNC17m(bi-4S+WMKu7f0VN zKsv)^Id1Fo!CwrTSCP(gS+ur(4*W%6tZ%kqrncVGu?t{&?6@W8^nswx0Q-u$8dohF2hEnRpnF zGoJu^%NThz%+{kV62rZNly#MXt%b3Sr#BiO+qfE55w;$-%J3Sb7zc@6)**e{@J6Kn zpC%s1La@y+o}0V@RtQ!P{ljZzy8kU7VBJ=I|jjQv9X5cdCRO5j*E z*vByT5jhIuUsa43=XFV!B_6dk?62owpFlU;;#uH+u3!3YDEKfmyx%?M`Y_n_$G*Ke z0uArY(J(Ua`H?Q$-`>bQKNW|`QxpuCrOzGFDX zduN`@d{&HG4Lc4$=eftck9hykKOX5g7_|0trN23R6I_4n+nbZna}IM(kl#VN!R6Su zH>cpIkK;#PkCfv_?tt_r>@?0*!s6oK+pa(M&CD6-IY#UkGV5F7a_oDU&*0w+AFrRh z2PyhY-k01#x(;?0{sR_s?!N8%z3*Y<+Y!#QeXw)TbH2XsviCiVygT>^$2dRFBgI^l zcR=9S_b{KscNkU^KJq6>IS0W{d<%+klJ~_Ip!pPh2nP1Pb>TY>?;99l^tJb0sQ0al z{O*NollQ-0K#%K}>n3wf4TpV+er{uNYw(M%pT9H6JK3+G=ecje$ZYGkhSMOQ5qt?L zk9mxGDLxBpUwC)gA0IpFW~$!z6Q=`{Mo^r zH>?BgjWOnwubA=Y2A2n4Mf$zP-+{{-e|~T^@Ha?*wD=yls_|p3@D&2%zOa9f@co5+ zLE}e#zMNpT@n4G{fzb}}R|IDQITwC${qkGL-(ZyS7eVTAVKDlUeqU## z=wtaE?rEgoxa=?enEC!a_AMyKA9IuUx4#@x%t85mt|wB?bzHx{vc;9axaXu_c;EMf zabC=N%>GW`zQ%9QjX$9)1V85q`q;;7Aaft){rMA^<<7Y5ul|_5?=BID;ce*(k& z_Sd$!7WkO!_r3{{-+T7Kw*tmBW-n6qBRK9VYzcfwy!}yl2OJnPvdroIU}Ss|@;llQq#hr}@tUsxiElxV!$;i(9OpGbCtLyf z%&=s*cC!Wwvwc}zf9!jYct$)OCx$1s5=WY7<~- zV7D!1TS^%JAZRhhKDKKx7;}{D*N>UMRV)T6`Z|&iIQXEec~FJhb?CFptsS2!`fypY!Lo7=0G|E)?gKdjfs!M?c1x z{m!xH7!-o>yqq6i8_1ZS@|z%;bB*m_fAfA}yTN{3kH@j^G%%n1s8{w4GTO)cLFQRq z@Lg~=_+c@IF7{n$L-3!_WQWGP7IIGbAGm&gZy|k&vGwP(I4_v`mv0w1mvJ6{JW`Jff>XMFUt8$e@95*$H+AG9@MG3y(V$40R$-a2lIPe76322&I+zdR) z^~-NLFG7pC=5Gz3$F0CPhs?og;6Y&AAO7|hw*wDx{akyvcW}S=_7UOD@b5Byw!0FH z_s`E3{{*gL{9~avZS!00^kZJdO@ZNBB)%R9J^PY-vd444*h?h#Jpdj7E)JV#@hf1= zKl<%&UF5yhc=(Ru*sDm{4zTyFi}{QvZ;O$V-vXme!a?x&;8Lg`_j!yngYUS0K3mGSF{P1z+v3&W zweZ2uy(jja=O&9cf_Fp1``~NX8{o3A9Tsl~FL(X1Z(X=fp`3gJLw+BOKH~Z%&r++v zxL0D|z>xRh7_L+N6TzHs6>weN+#|Pye~jzrwaT|K6_HQ0_#hbV<{rQ}RlbekJd0W! z0q=*8{{G-kkXD8b06Q-G>pbSzH#3}XPTYhA4|R#yA_8V*`KeTbD-Apg$z$BIg6Ahk<>qV18I*_zPJa59W2kFTYRs zMcM?KPN?7Gj^O8AzmNXw;HJ=EzQnjB_=fBEJq!L4b`Kif{~lKWf93jpy^)@G+4}}Y z^t_+hUnuKqjr0-HW~hhr+GDT%@cUZ8Qo@=;Q_$i9V2lm@^1YQePwY9vaYGr|zxE*= zj6Cam$>O=-fv*3FZ#d_}KN9|yuzBDSE^|%t-jUkxOYObviElVxhkho?a(tG6r@JiA zC8(Eu;Jq&u_Vy|I`$2yKX&YQS*O!3d8t|WXna?8f4JXR^R$9CQycj;#2QA-`a-a0x zmkPfP|9aOi@9=hj+r!}F`%>X`V61Coc|WlW+yS;3d5<@N_ZWXUq}gGZQ<#o1_TEj= z&pE|+q?~Ks`%>ZE@T0$E4&DZ%eSGiY`@rJ;;8m`l_fYH`&alOa;H}U+jr1qjL2wt? zhp_5~qwu3%i9>${BhT-=y!WNThv1L6e#ZOWJ5u|7sqZNKAHy!dF!%V5)YlDm(qfFE ztl9KquEoCL#CXQI4%or*XJA0ScVPVMy;BuF1OF-GN59Csy=T$Sr7TVW^ZtcjV*gY~ zd%$py%5x<73uyi|{`5$*!Fs~3SbQ1GJ&XRQVEIr6*ZRc2k^ctyJjTyDiotrpZd!Z; zT-f+4AO8|H{Vqs8bm*;BYqm4W3({shuT7XJgz>-y!LAMe>g zuyycxycWF0_?sY24I7Mep=IV{HgE&CMwvafI~(NBJ_EE#R| zK}Nr<(YQ{&)AbiX>T!N>I@cc?i($w=fN@;NxHsjR$?Z|$ZKT6dPjQQjfpMSH&wDTS z4QDxv%Yr$-N5Fc3FT(Dj9?XURtJ8dP2#BFLtc?pvkRX;sBqSu9#J`BeEG(VC30OD* z$3P;MF5>$=T5n^~^y{ykX=mPRC)3x=6_|Nq-zNOe;x;qd)E(Ej9y^RnY z+fhF!;Wri&TX3JI;|6tY61weSAK)eFLOJmn#(t)!zE+g!JD=g~{y0!qDoFT7>^sKR zc1{63Y+$uho1x)bRwCFQaSR>R0i-_#K0B z51s2R?)QX`Fyjg*$M~uCNTo;Sw5_k$OY4j6x5{=^$}P&$ujCJMt?$e~i_eH}j+4Ge QFQdQ6#i@<>{zuR4-|a%B#sB~S literal 46424 zcmZ{r1-uo-`^N7cy1To(FMZGKIdqqFN=pgS-K7GG2m(rplyphnv*!?khzJ4(N{FO| zA}HYAv6O$}?aPGFmPWquM!X3{Z2+j%b2u;4f zN_bWgTOAH|5+0K~n?0@hG~qHoXAIOCnH;>+dH-3#VB&0T!D}NvJ1$ru{Za6eNUfY7 z1#9h34PF?jyRKcZR_#Q>FD)n-teN2qcz&c!vsZ)F#vK!GJN{U(@`c*M?RUln3trse z@`OaeyqBK}7jF7bq;#d?!l^4~jdbW93tkvWeD-LhQ@YWSCPbRXu>U3D!9$-!svX({Uhd4XQb%$R>kR(Tzxz)9NV)|x$$?QlN{2t~oEf|} zkT~f-;SzIyAv@htCG*D*`G}rygHuxi>8z6A<>8h8tO`tvEi8O6S4?0{?XAM=^Jfn1 zezukzC?A|+$7F~DuMOM}XAW1a^BZ_eFiHLE;rjkO!s+V16mIkEj&SyGUkZ19W2A7+ z*O!G`R@n{S8Eo|Md^mV`yYSdl2gAwLzu-N=>6uG8w_mym#ynnp=DeBXl(0L$+rkyE zwusIz`Hgpm_^0eFA-czG>&-hoQ^(}7D;@qwJRZ|CCUAzIg_l1idP#1F5K=E zSehXSf9)va9s^zPEDaoQy9Bx&<&I}Rwi`dO0>7oo1ihx+`0*dY9A|G`K@V?OGcuSj zQEqrDMH%CX^;T2XTg9toBl*i82-f_489d~J!d!=yGHwb68~qHuBzTK3*Noj_R%ZdFqFDcfWc`!dj{j8FKe?SfHdv`eeY7Qy6Xx^MZqL`j3Nhzh zea|<-)Z1s96D-@2b5s;OS6K8xUj|Fw_PhF^)54;!yAv$>=z^=S`$Jgtoi*jTlYS;x z^4yVIUW^NzUeQwgEid|o>90Q{c_77T_j>BjNFhwUW}Pp?MV9syf6Y3lg{hbQ^=bI( zj~w%&QKnwF>EH5PQ_pu`e?$e=i6`HI1H$y=c=TJOai3R3&++JYVd|N>42rZ?S)rE% zzbedePF*>(><`ovpFJY`130=rkiGo@YbNaN59Ea#21RP;4WZBHZ0;LehgoI^A|)|Dir3>&EbgAzzEf zV>~;7VI`Y|=k?7cy2orA9M~t^`+7;yJ*MvMW4wkpUtZ{3{AwXRQRZ{!?Qgi|=>A6b z_BY<|fzxXPtFwQKwq>KtJFTzY_X62_FOUny+zh{bc{BPU-w@_I zrOcFX!kw$OfZhQ7wJ_fuHD6yY?-A;a9)2zFk&0KF1Uv4^94>dHApGP^!hEOnTXHv? zC(l*U`z`rXnEKdM@$%lG-+S-yUGVy}{7&dR_y6Z?zK@{$zxi=raK@QW?6*3XP}@E& z8=SG{d$OJR%#7fS-qVGfeb6^J{p?KPsi~_6r#%wCz2plOoO<>b(LYW+Avk5j9N|4# z{s>O4pH4U&niibUwwLgy2V#R`Hgp$0{#i_L#PkJG9ynJZ}GN z+o9wE>VZaO z)L@aELxeLYFB!~Lxs-5@h93qq6jH*ur+gDk=9?m%XUVR>!yo6nTqS+r&Y>S&PnOJq z8*K&)=d8OnaB<5#;cQ=T4xImKp>XDJ(gnUuaY{HtiJXDs_v;I%@tq4C$<|*u`N;1B z;pxMK6TNpn5NffU9C-4_;XwS`<%NG<(kKvmcvkqkslmYE`j>=1OCAcGc-Io%`}*m? zxqp5ZUe{x8;Og8)!ZWTu3;f$CmvEzot%50A_7P6D{a`S|!bN0z>fsZ?EC;5NL$TGG z1hb_{Pj>pe(>$29$1&mKOYR0UkNk-oPUSlq%+UL5;WBSN2&QQw{&3?hD}u@EB^JH! zL|@Q4E8`QMuw;DTehQh3@XU)t0@v=!+=bu#;%VUQ@EoH8+i?FCm0 z&#v}S;KNdbgr~fnA@J_Y`-F!y3I=9{-VtthwpC#C)TF|36EX#QFPHHT=Xz8w(0YY? z{l9je5~w@3H9gM4ho1(jy?T!v`l{*nK$#{oCI`oi-54mIX*P9x(A=?sTq~B51BnLb z45U7^S=j#kpFm7AS+{`>xy#yrmy-SiOY&v3PZpE45ePqQX)pS#wD_;(Ds7kEorxT@ zf)o88ZnlNfW}D~aTHaAOd*{!ctw$z;3k37G=oC)7?6z=`e^!MX=i>bq2$pD{G(2+) z*GYk3$&vTMA8&6UT>PiG;d5VK5H75mho9u;*cJ%pUb{Y$z6jS?fndhCG?DxZxgH7x zljQj=Qmz))Re`{*b7doOpZ+O)DDk*RgUkHBkh)-C)<$>Nh6(B zuZ?ooMpvWUYdN1g*E6ux$tVw<#C7HBBZ`KEokTSvV;a9Dyf5h+k?{{Wj|J?lUH*!{d?(Uny`fe5`Mr@RzR_44?U%&s~A=!Q;ciS2jEoUfgP{NPXSjRgYl zj!hB1c_p3jl0~V)=Tpeq4!qxVLpVI|L(!MUTnKM_g?m?lz#?l$c-7mn!f%zz5MJ=t z%fd6-eH)%N!4V#E^i+6sRk{AaOQ+L?d(Zny^zv78gj)|BDV%K2+;E-!J;?U9Z1=)d zdi*V%bYRYKi59ZPRMPWv!-dXPpzbsqJ}8{^z%Ajw=f;GS<&GhTtG0OH+)FW9xW&Y^ z&h4}Zgx~q6p%W^$Rd`?RbIz=FIl(2u-{<+wNtNU?;Rh3E`KSMxiyTS5wXt1$JN+dh z8TZe%j~?44oO9;TK+Xxxg!5;q6KJ>Y58*=n8V2T;7$97D`e%XdRTc;r{OeZWLh~cS zdE0*zjA_O3ED_22_20n^4|#1RBB|%E2o`w8wNxVfZ~Lyn^0xF7zO?LU(BGJQW{L3L zJ%fS`vNRN)`}AV4#rO`w{slFHZM$*IOE{ZPei!VptbUX`Pv^7a>OBYVi}HXSg`zxk znY<&Ut_%Nm^ADy8sS9oh${?D|r8;+T`csh9l1 z&3x6Y) zC#>^2VV&0r>%2}_=XJt5uM^gJov_a9qKv#Q%E;@YjJz(&$m^nvypHVUb;3HY6V`d1 zu+HnqUS21x^EzRj*9q&q4*XV7=XJt5uXEYW>s*hU*9q&qPFUx4!aA=L)_I+<&g+DA zUMH;cIx6Y)C#>^2VV&2Jy}S;*-OKC9US21x^E$GZ z*MZ*(>%2}_=XJt5uM^gJov_a9gmqpgtn)fyo!1HLyiQo>b;3HY6V`d1u+Hm*bzVny zbY3T{^E$GZ*O9%vj_l=iWG}B1)_I+<&g+DAUMH;cI$@pHk-fZ5Sm$-ZIx6Y)C#>^2VV&0r>%2}_=XJt5uM^gJ9oft4gmqpgtn)fyo!61Qye`Vf>!OUj4*aTk zkk>^Sd0mu|=LqY(PFUx4!aA=L)_I+<&g+DAUMH;cI$@pHk-fZ*?B#W2FRv5Uc^%oy z>x6Y)C#>^2VV&0r>%2}_=XJt5uM^gJU6hg6MHzWrl#$m(8F?M}EibPldwHF(&g+DA zUMH;cIs)s8I@jaob;3HY6V`d1u+Hm*bzUc|^EzRj z*9q&qPFUx4WG}B1)_I+<&g+DAUMH;cI$@pH3G2L0Sm$+QFRvqec^%oy>x6Y)NA~hM zVV&0r>%2}_=XJt5uM^gJov_a9gmqpgtn)fyo!1HLyiQo>b;3HY6V`d1u+Hm*bzVpI z@;YIi*O9%vj_l=i!aA=bdwHF(&g+DAUMH;cI$<}j+bgW|Ix6Y)C#>^2VV&0r>%0!U-OKBQbzUc|^EzRj*9q&qj_l=iQAS=DW#n~HMqU?X z&RYSC#>^2a!icxRr|Hq-?RtKPGOHo zIocj{aiu-Hm(L#b(|UWvr3Ut($T#-L&j#6pUN2^k+P&2tRJx-*sNi0EV1wfJ=(#!U zfghE!$K*+D56ryA?o;fp-Ot%J?6w2yZ^-w_Lv88cK^EP?6H{}+Wijt z>`wEW+r8iDZI3NE-|m;^l08;!wO?t`-yYi}VE66)gFUv{WxLOiF80`3)$QI>W9=sG zYS`Us-?m48^2ly~qO4u#tLt{>oK@`_U!1YqolRwTekrHjCjOz_`B)CS&8nyN$fm38 z2IGg@WgDckTfI8c?sQ?8-Nxx)cj|fHZnJfp-SKbK7oWDflzZE5(|xDien&04b>sVX zm+@un*8kSFyR5xwx1Rfx-DPhkyLFx%_Dji6+AY>~m-Tr`EWCvFny=bK504Rk8gilG{Zlt+ijx-oVb@=7L@8dOy2hj^1|tk>~Av)-QJB z%lGWu)@r-O)B$$(D^D;tU)ot-X=x8iHr&pf{~f!7KfRstSzdd87=(v09*jvBe z`th#I>rdae8vP)jdNiP=njAAzJ?dXajh|RtJ(}`NjhO6Lj|vV^Qw}6mkMiD7L(3IY z4_6#k(|Y7r50|u6gYz6!55C{5rr%zz9(;9O4eWJ5{c~!Onpt=8T znpN?#`g>P?)h`1+pNu)9X5ICx``8!yKKw@g^>0x%d(y}1ufGqezD?d%cbhgrnf>bG+5lKRa@=nwvDcZ*B? z+Tof~|7p2f|Eb^is`-M0>MHK<-KA~SkBic)>W?z2%R?@!6?0~(OM6bLqJze&?-#FC z8|I!;7rv^jvSj&EeZBsI+VOH3b^hkhDrv62)ah;W)V`y6)t65y`R^?ouTGRar{aGu zqCS5wvx-#Sr;erf`F}i&~#2zB^T3N`27+Un5y^{P{mGV0JfH~i-^Emr#vjaBb1>!_SIW7SJ)j0*3Vp^j!< ztm3~)rkZpZp+bFp>VsUB)c#>DRNW^N)q$Z$)zL-k)V?ZHRp7THYH!ZV{?FH}RNJ49 zRjZF?Q9G|>QAhiwRG(b`LiywVRl5d`R7b9Trgp_IR!7o*qIMj*tZFkrK(Z+YqhEN-^#h(OKnL~ zL~V^buQu&nrsDtYt~T9DuMYgYQ*Fu`Qag*BR~ruwRy9ujuGY_wsD0atsErGcs6Fj- zsEz&h`%j$Os8+VUsp6IwQfrFTQ})M+)hb+f?T00gukAsyi2{{%zh;pPrknx{XM$8r!{8??E|LOJ5b$tJEi| zYv_vVUiwcpxNv&aWywkPS^v$dK@5We+|5%;)JD_Tf*r*on>Z=;hFRPX$eofVH(p0_wxPz*d^;7lvm_@3><7sMn zjfjftIY6!Wyt%4U{G?jByRRzOXs@I zdfWeRpIfSA-TD5Xv#wFaZzNY~`uwSiC#vtiGW-`+to)}cbFa3l@VBvQM=;%F_YX1_o z^lP6=7S~)IE!NHdpxriAZ*oUvy;9yEzB*C)lFm@?4g5n{)o1#Tr5Nu2GixE$KJG97 zU!TUP1sj_9A69Is-l|*O|7YmF3iqt;zYx5x`gbYe|9RJN^+v5^{$JHz|LK2X{g*bz ztLdv6`fq*RRE__vm;dI+cl?+7%=Vwe9=N~9$9|{x5B@tD5BU%LvRv&574xrM_lHWJ zx4!?w6Yr}HKRoo$|0k`=b^l%eyhh{HiZi4AQ)bLj72hoBAO9qv-rao3KOpt%s&S`( z{C(~mRK;rmZXWnj_0fy+-S!QqT8QPpRjNO(XT> z>$gii`PjLv$34BCoOLPt6sQJy*@&`5J-1N9v&Moz7&Z%*) zw(6j!k6sry=y1Gxt!l}*HVucVsecxZYyI$$8b1H8xH|n>sws_9#?`4kUyaT%IIhOE zL26RIEO9ly`Bsg4|F^iR*Dgh$Yj1sf&x2mqF)@idPmYO+VL12?%W7x#Wb=5hX1mb5 zzto`|y`55BPTG?Sl<}{-vz%T#7{A6pscb{1=-hqkS@V&0@+U2vvcHDy&c*+>eXEnu zqmC`OWapZZ#mlwG!XVY}vvwxWNC_j%#1&7F!Pir6V@KeO8n%OU#PpO>(UJblxN z{ilz*3QzAXH(b5U6}xD*L!zJDvB>Vfwu$I(E!$xiwKI$U`PsvE|8u29pBI9E*i z=f>)DUut`RFSY1%`)9R_ep$w-^9HYYkbU!J)Kz{JKxtHu;X9R zXJ`GxE?zj56T3d5j-1YH4{ZCj=(}%UwFfs(D;!2HIjCVP;VCs1*d=`|r0I6aD3fDeSUkcQ_RvR8vi|G_}WG*e`mf4JGZ$V@EsXLuvh$Q>C*fg+@{LC(1b3 zuI~TNDL;Nj{Kvfx+mmvxq#i$f)>FG`qHRvaj=zU$9Lr#jbFVX$)Xr?j{uJ+2__u6m z$^DM@@FH934|T=7ln=h{RLI{sbaTu)yI03NqOWg1#x9y6)+x8=wv#V3%5IS2Jas4C z_0QC=C%|G2=H**&7v|Zojru4@xc(Pu(py?1CE>2$xBATur`o)~V3? zgj2BN?`r4IJDu{));JZD98?vz72y0jgVE=XZ3V<1n=z^XL8AIjrKbIz(T%&RG5+sF zpICN>|L(Q7gvU4BugV;iads-d@Avn>+N*SNu@n2pxBgAv-Et~@cE_3Y?G}IPEKS8f zsb(+#^1U+tPL<=k4vy;m%&AnVl2gUb9Cz&MRHxF`z2x`_e|_Rq%KpTebocr}^y6Mn zk*)EOyP2HWdc&PbN&ku8ex#D^ z&iF^0L%BC4clFt);vY|(@9NV(31Q86{!p&uOPxxoessncd?i%jt)rrs8~=M~$m(yL z@~`~hj4j_L)c&fhf2TnFn$W@ilbo_2ZE%K`NgG<5a;^9)RgXATzN{tOrSf_w=G(gD z(CTYNol@`Aa7y*RSopKL{s#dd4Ib&zcrf#QLyW44ZzOQ(`y;Irg zdv&Vt(G1I+oHJ%S731UV3>d#wt-FhUs%>H?^ZJNWIeRHP-5V*Km;U)u^v`De;bh%1 zf#ai2v|I0F>GLJ$R()P&tdr%B!F*2bv<+@Mtxsnbzvu^jZa>R*I4}LY^Lamcn>&^5 z33j^BDCebbQc|~by}8M0+|CwGyRnMXdfpr2ztSn}WZba8sn9IWZnNcvlloph@zm|G z%b%+DBB$W#>vqA^jY8+Y+~^d&`iq_KXcBeuwKPtt-yZQ<^ke?TpXhLR^)%UWr&7n6 zcDt1i?G%r1O8<|)sABv6{Md=@Tg|SvF0YOAi2l#g0d``nDeNJsh+?3}|J$h%gZJlZ6R9^MDU9Q*xyT;B}hUU4mwp2l(#FK zh}hLC6catu!Lw@WCtI9)OV8OgA7{1o^J14@*3chkt#+#2sciSpy-9uP?i)7dHNFkT zy!z1k_N2jI`DYz(Ed7kyk~uVGu?t7E`DoWsQl|I zotpmS>T0DALQm$OaqMrm*xj0^4L#~wS?+6E_e@TnD`^}x?V4TkixrM?*Oh-$+zO}k zjzvz*eRI^2-4~sKU3$?UKcd4fXVM!f$o{7V{&glM>n8diN#{A-uc}td6JMfad3ipn zS8Wm+hUYoow_6-Fp>3$tzB$f#x1Z2{tic?;OFLC2FAIH=IEOR1!DRLmI{I=gCtLfg zPGyvdpWbsihNp>sT-9>2E{Hi?2}G9vDp`dPL`YI^w;Nly!g1& z^)K0@LM^Vp>{N(N;#8=yAoR|)x18cvb2t^wG>bozTg1ChtfJD<`rcB zab3#ga;i`2$@>qbA3wvHFytfZDr>cw&V;xsKoui~(mlslTl!M>}y!ZYT3_kGs_eU{BU&WUYmsp<3Ha7NXwF8y>kmCPxPeS_~! zUgrpVg6O?5UZtmh;>6lF)RJ4u8D82i`YP=ELmyNV{uX;q&c~CS(xaBDxf@qFC9C}8 zRQTYE{qpA}LihgomL5Cf>FZ9*J=ugYkD&tv&p1Wgu@(*g@goa{vRG~rtaWBEE#r(LaUu*O9znE zfkuU#S8H`5JIH0?Ke8p?h@XQsJE_MW@qEALC#SF4NVa=jEEl>ysEhEZ$+2qcX&HYz z!|PS;Rv(NOe=qxnJ!Z~C;bz}uv++4e`1}u_+ON3p5xWa=gP3IvsXIgRA646@eoVF} zHJBW~_}EXv>hecU$t4xY&bZ`DLk%XKB&!)%qoXRkO=cbu^2P*X<>;~Uw@c}F^ccqf zius(_;5PkE&LtI`Cdu7ChfVo5v^?f3>Y;19FWS9RNv`4yT9Z+Q`pLM3?qi>QdCz2N zJ7Do~b-eu;vj6?$OSxZ=?L5Dgup5qc^M^*8F4(zy{z=^_e*dr&XtstNS}^5XXGD>D z!X0yOa>nM~M2>G-dA&X9<5Qwh`2*SAk{ar~c$vC;uxyknOa|x;d?% zx_ig~yvxRvEH8SWS*6sa<+;e}H{4^7OBOlwi!Zg)^VM=>JK62@cKiE>g$IBBj@sF@ zzwnqmSwaK$xof^a>YYx#r?Mxg99d^M`rhrq+dGAJUR+GSgE5I8mt{9u-5mI)qjS9Y z_H|BsYrx6%+asrO@}=S*yS7QFMUQ4=J2Bo*9o;?OnK+?s{KcN~-VfbKxz_2m`=a((R+^_t*-u(TNrCOgf%Uka%~f*ox8R}gLAHQM&GGSJ#=NyWT#K!9O4;V zpiJnKN|UM?}eg|OIKVq(470VGb2d zrk3I!hv$zPmqbkoU=#0DP=2zT~w1|IrM1sK(dNolhGb@vX^lGo9AtB?cwv7UF#J$FB*HU zv}!W3I6d~jv`*;L!tR_FMJ`sW=~>ZZkiR3R6vn+f`rbJvjvf;yIAWe%Y~3t+96a~_ z_t(fC<>0>Kb^Z|gaeQv4_t)|ahBo*vIj^mLRs2ng|Lx>_&Aoo?ss4Fw6N_$N|I98i zRMtSpBY}au2dG+pRGwtE-yHfEp^3ZRF(c=tRbTG8#Mn&=0 zDYDfrJVl;I*$*dnen&hFG3I%vT@z1xg}cfPRM5xEu11e`qnz7KmR)2Tb~Hs{Zrmw%r8{eU&G?b z7rbjX7$|#}T?n6lkaJU4qi1%oN4xJ4I|cI5cJAJ;@LA3K+#Sl%2ydQT?p_hdf7B^a zUY;EXpM(9_gV;~#lY#e~!Ljn3hQ_o{&(D+8oqX>Vwj1crs-^tN9p%3J?2#27hUU1R z-$PIF{_Q&QGx2vxcHFj#${GtT+A;yZekLiztmQ?Ge$82kQ8o7AGCdB|QrhpeB_4+5jfhb78 zKkr;*v+Zou3sJ;B(_^+ZujhUE3X3}?#=JI;YZ0xR{h0mF!11C9c+9rBaJ*Oo9A_YUQ+Up3A%juA%Y?c+9q@XC=H967ciBIi~!#65)Bwwv(Y(Lhzq?&E~!EIpMR! ze=8AQKW6_tR+<07zm*8jW47hG;6B2CD-oWDb+7FXa8(NUw-Vub%(h&E)e!u*65)Bw zw%n7dBlyp}ugR!;_ge&91HpeQ5nexL|68EfMDX8Agy%8anjY>Ad`I%%N`&X%1ok8N z&-9pW&1>!kpZ8ujuYUq`o1NgF=`q{#`3}&4f9AQ&YcM_e;S17?f2N=NN-a^{Jv49Jetz-XH;w*_Q9X zh6#Agwj*)8Q34*bt?5Y%Z{q~~!=W|Ny6G|7X2o&lI{asP%(i^zHxtK;9<%Kb9A|FC ze`Y^s+sruDLL4u8%(kYd2fQs4@DGC4O6#V_Y-@UY!OQ%K|4ct~qSm6u#F!qlt?B6l zZ<_@C8KJe+y6G|7njYqc?Go^3fYx5?rpIh+deXz&ApySyEf$doQ5?ZNFfoGv$Vm|1 z9-9=*cOd=A5N2B+>g5s15quw3L@)<8+m=P0@12wgzTfCig)rOlI@l&Pq6~umGzhaT zuaDQtwZr2b5gY@vEzh3|!TaWU=;wHtZFwJjPB>;25cG2%%(hif=i1GTsDz-O>(p$^ zG2(IhIA$#AGu!e#!0Y86SrtKl4usj(^zfa)@#DL_8iH+keVha8%y(+)dLERfpL;)j ze7E}%{Kq}j^n3eye&{x$6N3Aq=?|dJxhaSUA~@gNFHOI<4hloBh2R_%L70B73F<`= zwGo{We3zR3I;eYdQy0u};aW5O^|a3Q#r>7%=2|iR92=gG>&x^sK%IWBDbvHflk1V| zt097Ixu&=-8C*N2hh7HPOH%~bDc4J51pQniX4~edbNzC?G(phMHDb0kJuPsIYnf}O z8G>!OUS2|QEpsiHo|dT7&$VNETBFYO&UMiW!M2=#o}cTTYsB=lL7jfiKhK#7!8Otr zK|kl*Y})~KJ_i9rI|TilbF(ei6xT23nR`_i1n1LiOO0dC`R|CJpYv(9?S?w9h4as~ zLqF%%Y?~H!&H?ASD}sK`r`fg#>Krf5=gSEC*v4$z3w4eo=c+q`e$JKI*7WqoF`lCt zq9=lFIiH*pjtl3?^z=cUW6gd!CmajTPhSN6Y;U&ZoN(+oSFa%GXM3|P=ZEve=!c-6 zeVJ`d&j1`_fAsZ7upRs598%{z3`Fp{I1i?Okk&a5uOfJVoCniC1a*!9$Jg{^MxB0+ z7uOEQ>}AAY1pORuvu#$?y|I4{?2WP6b~tp-73X9qf_{#-+1B)oz%kB0=V2IvZ8`QM z5!5-xqYzv>981$b26e74j+yDnhC2Nmr*R0bO^(NC1pOQ{v+V@bZ3M?=EP{THf!Q`Y z>eUe(kMRilIR<9i$*5OC@V+M^=;u9|ZF8Vr2Ej3ygrJ}IG+8s-@|i1%;22Cn(9iob z+vY;O7=rgS6+!O~Q}r)dcKc~55B+^82p@Sdh4=;u9|ZD*ri2*G=riJ+g? zZniZ&uj5!j#AL)Q1l#gH<{%0nc)h0Q4b&<7G8aKV z&ttZI2X&4+uj?%Y{XD1H*7PjEG2RcaWj=y!dHy^)cz)CKF6#92{O=+1B6$9V2)5xl z&9+NW&yV2w7a{29dCa!&qh1)n>spM+kKj4Yw#!g2f#CU~jG=k^(06{;` zW41LtD{!m=g6CY0U|XJ(;~IzHc}&kr)amCrP0xp@zl`8HS0UJz=j0sLMzC+wlOOdU zf_-!T>mpVnRwL+VA7NOGc@)-S_b=_-Q1oavSdU=fgt-9{DH9gyK ztQz8V?PFVNI}lY7+jZUZ6h)oPQxXd*@kU*A^5K{A_>Cu6hoc<-AFxWpzMzL z#I4Kwn9TM)UEP|FvX{$j<9W=sFL>C#cLM%t(E4cI@R)5a)3XQOz6toJLVHE)hR1Ac znV!Ay_DjG&1zLZt8y>T*WqS6(J0Jo7WM~7mZg|YLmg(6K@1O+ylc2q-b;Dz}wM@?e zc=>+gSepKcs1MP);W67T*WqLyJ zj!3{i4%$eq8y>T*WqKTVM*uxb{;3-tv#n)%4#CH9|F56-%6X-3c+9qz={XD^*VBLfBcV;!y5TX~TBhd+ynIgB zkLl+e@;Rh#c+9qz={X7?pa1{*xpt;&-SC)gEz|QUyfYH;b8XJly5TX~TBhe1yt5MU z^O;~i!s|3VW?Rej9EXp4{D1v?=9s5YH#}xr%k+E(A9I=i`c2OX9G{~-hTr0Tz#NBd ze?&0H0l(0{p~o2g{J);h(FgM*_G$Xfb6v%;x3$OY{|dDES~vSKJTF}HPw>8@{brw+ zp)E+DpDWOG|1b1&4f?ywn=~w{d)x_88}lG5h%v$3N5_vrp4=8pl^_ zkKupeTtDOZN7`ea_j_n-v~Koe_HTO5z`OQ;{TB0rby_#h^};on{d@)QdhIv+yZ~*3 z)=iJm_Jwo(0`JG#Z=5&A?B^_wZ%m-i@1Skcy6G|7nx1p;Zce~&dd}nc7VRf1aKX>$T?!AWJ8i4v9ea!HfZC~*G0q@=f{ANFY;`l!8G5jy|a~H?=Ymec# z`a?UQb;Dz}eZlh=yayBToBiCw@p$bq{4ex#AIC%5WB6b2{Eg#|_89&bJpbT$SbGfr z3!Vo!9?>4dZ}o$ANb82jZ2N-eA-snZ@SFWS!to>8WB6a_=P`~S)gHtDg69d2f2uu( z-+Bcaa~iHI!(+C6!SfWp;|citLiUw=1fUu)g;ybR6jzblygCfk}Gvuzg~ z=N|fBkJ+{}j&o1{ug7fL3CH=4`LD-pYkCsF`+Wlbj?jM4y6G|7cEItA33$x5?Q#54 z0v@xi=}8RlQXu_`m*|(DeJ*GCgM78u0M_%C@G*Y-@Vz!pnERcj+NE9^4A=6Rbz=Yda9n&&dFp(&1W@BXjHY-@Uw!_R&5 zzkc(28p4xUd(3NV0-fuUZOwkn{wv`a=bIk0AG80)IL7<=Z$D=LW4DcunSj3n^i*0mJ!V_egFdX(3HZxHPos6yW41LtIH#31 z0e?B@>9lTo%(kWn*J7nlz+V=62CbVOv#sgDwObhz@Rxy}N$aM^Y-@UOPgdpx{H391 z(Yom|+nOGXft57@e<|qMv~GILwx$PTV`WdkUlMu_t(zXRt?9v7S~(N&mw=v2>!!zS zYkDxoR_+A+#i8fXy6G|7njXxFl{W!@G3fcUZhFkNMd8VxfX8fWdN7|>fdu?TpcmA- z=`q`y9?ZX0C;@+A=m^;>Opn>t^k7|BIQBn&^ljnXqMIJGt?9u!vT)D;sxfwW41LtSf>`AtN-z1U08T- zMK?WWThoJeZDGIoA3xTeh5bl$(_^+ZJy`D+_QC)0W4&A0XGJ$XM%(D$L-)Wt6W*Q( zaP;q|*pN(yT&2(vjh5k1UTl3!Pmj>Ar8ay3Ced}mi|1x4Q&_|Ir=wW z=+Vy+C&6Fi_+%qaRv_o&qaI(PY~rom!p3Jf*$?se*qrO?M(#O3K(1${3qgjc(S6zSd*il zi^(maJwW^bPeGIzU$WK0;Pzmw8-91=_Z+Of;Itx{;UNk z$GIH+tpd-({bmLN`>XXHO0GGud=Kq0=1l%Z#^-Mfcm;yI`MECN0nb4lYr=XTC9fMC zeP@wRAyy)8!NWd2a5?(Uf-c{iu19$rp4BMVx*UBUL6`3`x1;2elBd z*%$mTy!*r5iPnwe$oD#=UqmDhu;(mm>a0-Ldf-^(svwj(oQ8Vr%%FyI97sk=Td7|&K z30KS9YgT?)s@ISkGV##nRA zEUYJa-;wheTo7Cwo@XdI_a!wKFt{iwD+>&}-CCC7kku&KeV(3bO*5}ra}u35164i#<#{VFt! zhmUjnqvm4Ib*m%z2k00-?|n+PIzYeZ>Q+}Uo*6!?K0ceVE_?4;>fYbW_#Kn48vG}r zk*k8gaGC3!>x9p?#kEjaGfR($!ap1J^k`cf%&`J{zgZF<34Jm&JWsy*;HfTqdop$N zGmEb=JYx|d=wl3?2p$3r&#SLF80RK?zhe|e-^{O=+xcDs_jlR*Ehu%X2lTHH*bjV_ zQ0F=ZTisEfb=iBrNPhY;w5>SKedOEc%-n&Wmt_y&S}w0SuffLk`x>F`cm(fj^mCTH zyDzk?2#h833h%qEC?9}67&_LnH3vM%WiQ8&@4Ou7qY(RX>}`}IT$VlFa7?2a><=S+t+CL0l*IgrP9pnn3r5F!lT?Xu+Kn!TKa&!jI79;_ANnqbT; zne!&!H()-kBVeu(&h1@;{{e>)$8ikd2vmSJbCwQfxZHsk|=+8 z&fHJAxA9$TL6`lKoYLTQ;H+rFak+xXteNdR&IHEV5zjSnZp|4D=JSbrmG|E*lpOEU z2=pE0T;OtuGKgPwN#=9Hk}(B+_eWV4bJ_|#&}D0~!LNdsLq}g;z9Ib%g1*kxy~}#2^i0`Fvc;;ouFMny#mgK`;m7LIQl*!^PV`472$zJ_I0rA zkr`Z_-@(Xx7^N>UnD0qy^m$wrjjQ-X})*?TP`!MJ7&IenK3~r9L&rq)pPkxk^ z%T_akXTZ}PbzHlzEx4D<-v56=-D(H@3d)-B;MtHI0Bq6!qpMrpz+WRS!-IL1-+O?) z_rAQ#dO|;=Js3yteP_P=ywBL&tS6XS9}pXSp1GuTjS}@^dfOLNrGLd%t&*HF6T3#n7;h ztYzT0T$bNSd3+lBYUp(ktH2++9DT1r_r7aoerl~jeIrV+f_kI2<}b);rM1w-C4=$%XfU-*;KQ3-I_?=-Z(4 zIfw^;>~i$I23s;N^tbOMm;g= zmr=Gr@ZD8Kb0X;9YilFHIr@x4m%RjSm~&a*!GmiRPG)dwXz39zAub}) zYEES^k7q|4J{LbCvT9CeF!nd*9sJJTx{k=JnQO%3ir^H8Hn?V97taCaz8__rN1pAr zC~qT*A;{Sb&JAW8>}S?*h;o{98Jr(n8i8@L{zR13oX_AwV7{w5ApS-a)_fnOrw_)x zE=0W}t~mf+?y~orZR*kYPA7Ph!oz2SoCGE6WbeCHe(&hR7|1&a%y&SPl({%#5s45bG-D0L6i0Aw5+ktwW3a!(Bt?|eoC2lk_n}@MksMK4b1IakANxcM z_LG>Dh%%bfpfvrw4xTTyK8`&gCLO}`^O|^lX%RdpIRk=ydwyPTE(G@17_LJy_RAOi zyl+0^84;B<^I0_gRZ!20$c*54klDucCqbRZd912tKCh;q>yy{Zy}p`eUX$rJJsfL} zac)En%{ft;dYrE3MOjlb_J9~uSE%z}euSTZfB6um9zdP*hy5VNMsz|HKm-t;&Nacc zQWz1`TnMG9bM85RMG>_$7eQ(2bx`-_uQs?dq8P%|>!Hpu<=UyMnQP6|8=%f}b6wQe z%yq*tRhK>YfUtB&P{)F)VapF z)|zSNoSS~r(-OzhA-EP=XyzJx3Bk3@wbM#7=luWkw860q2+nzH&0I&kUaohpk+zyS z=cb3(n+d@+(oQqy-1K)qJqsd$Kpqg&1;P0={ai;}vs?=uHFG{qKihGWX_f8 z?}j?Bh4bH4Gw0Uyr$wFP&UNuJfQ0MyM z*o@N5u^fZo`r;Um*39uRJ>yX4`sJ97)y#V`{S#2{69l^1jsG0X? z`X{4a3Bh}vq?z|*`g5RO2Ej3yqM6rg`g5XQ62UQ;s+sp{`g5UP48i-DrkVF@`e&eC z6v6wLu9^30`g5aR1i|~5shQVe`e&nF2*LZ9rJ2`a`c2OpI93qB^SrKkGRirK0tjB? zo0@rzre_}N`4Bw+T+KYE>3Uj~o_C=a`PSd{x_5284`(n-P!}Pz8dSL{wYpG`TVfvS$UIM}E z{XjF%Z~A#Hr4j6Vxn`c<^qZcQI936{^RLj%b8;Ty5bS%EW}g55^W?{|pg#T~%9jy5 zC+EC2g4eQIGy5|=TrYJID-j=Qrq}eZMZF$^?bc{!Y5GmidK{~RSf_(bZy`i21ic$H zv!u`S6b1(n?Biq28&R76O{n|zaULUY*7X2NYFiLB5%lsHc`L&77eT!Sf?ggYZ$p@V z(^C}3sv&l0ANh4%uZnWJ4)QJp`%1`D40;vBZp2Q_Ecvf8A_=0n=ENvX58L!W>_HmJ z=hNev;GV7?{e8|}c;19I072$+)z9VV?{oG+=W{g-LFTjcn#<oE{msl_=$Nwve>-{`I-koU@EkCBKX{p|M}ISe@s9qMhK#Y0b;f!4 z6M;FD?+|gmDD#>sxw`z8g>8;OLvSpGKShc0mhX=rqGbEy@O*CY2{6V(eiQRlm!HA& zrNO7b?2EdE@-zbNtg{Ax1*VVsB$Tfra31e_0O1zUhPXPv*OBjbPs0C=!C!+fBdDi9 zqy&F~@_U0XfD>tbAWF^?&h1kM`@x(W=vEp;MlkNlLf=uo1WvE@4B(t#%+CwIx4DXX zcCBXt7Xst{t(ykl02k1D4sa>(8I->m{4=Uvc?`-;45`_Yjy{ALsDC%ieEh14j#4#TjtupHAdITLvTKLLMVHo#Cn&%&-F(6h0DIG&-sPl zi_V5lAJ_XVls#PL^B|v#eu6&7;5Weo5YT168G#aesP#5VkKY0hb9LD_CxFqP^)5<} z7l6mPy7xN``Mt$rXfqJk;eQY1G?%^a{bcSjXOchh`P=fGU--Q!-#NT)tcmD*itFPP zVkP1hbe0~k0J9Br?|X0g`|C%juSeX5e>KXrE_=V_kl%#y_;v)J^>rwDO5E~G` zK;LBWMlkEpWqtAe`YSx!PM&$3=d!a2s{DD6ApyYgjW3C|PBk+tx-;ZRD0p}I${U$_y zClN+{H{vcl4oY4hSOV)pe#dhJrN@WC`&`}py@z!i8r!3czVE0#La;sclLmhdW?$6H zBe?I~!@c_qw!rCJ-TO@l_blr)v=a#OmneB2GTKVc@i+LK!Dqp2Lp>=<-rql9?hPJ) z1O7?tDRC?{_yJ0+=O|;(l6N2Vw1~{`@cF)C@MUmDt)qfLRue)l56ELv_UA>x$Lu_GyCJ;ZsqSZT(2H;eV5XDUNFX5ewX=&!B}&A_laH* zTpauiCFUc_e}PMCy(l<8_+OM93y(RbXfJwwluuAc5&c^dIXnKtc|gIxg+_lbn%v-I z;HNmw`7eOLdF8hS`Wl2WZ}K-mu9xcY^I8)jYJhofU?1mDbM&_yiJ_;5&aozQef{jR zRSV3$BnfoRt;d_YH+==fjz*7@rZII9INc=FZ^C~BeYF8 zhP7sW4Bo1l^IH~?1%drK%71{%Ykds-`ucswz4#hIACJI&Nv_=&{;Y`CQTG_*%Dh7U z_J0687|i>`x{LB0@E}*0eSH+_`%#~d(&M+mBV674&5U>!LYw63FXR=ip#6nD@Z4A& zw_jcMVLf;(@48vgb0C&L_joaQhO6^)OZ4}m%MAVijO&)YFaW*@#xv*TpTbxx-fu@G z7yA$%KBKFkd%O~iki8r0J^Fjm4F<0VZ-*xjO3XLkt@7IlXi?qbdb`3$iXToQrjlKGzS7VrwqsZe5Xx*(}Fvk(PoR8yJ5grSr$FOkkm(T5$P$os7^d&JkF*t>*M}MCa3lB8O z0m;e1ya#YJf2a(u3H=UAurJMX=I;(=55d}s{uZ5_9y;fPYmV=!Ur<(sp2c9!Ip+_$ z)fj=bD8CoYV=(4i@`q|Do5TMMWp(sZz~KDQI2O>o|8J4k?tLZ|ZVP`e9EWbT17AUj zd-9bq7|(;`0MM;&;I9#v;la2^8FL){?PyQ%8STNiL>Xh}z3;3R;78~$4*e7~*t>q{ zR#Suz;fIIo$YVSQ^7|s_^1ONL)^hwF5i2;2FAR3 z-@6LWg=es<$ArOS5c^So$Kd(kQLZkZW2WGE0I>*~#|y!eTwOkk;N1K!#99j7<0ar( zTE}(C_ja{#@6`>)d`rFron`d*qRS0l27U|uaDAOdtOnOXd}#10FzVFhJB-cXx`?%? zd%Om`(beTUlC9u+h>xLryaBvJ>)0dYS*wq0hU~HRFPQrm^cQ|F`U&dqLT`ZB4aS&~ zp~l= z3F1@KJw6IP=<4#_65AX{{RB#nKLdwdou6Z(zZX4a@E2h8C2M&Acn`Q4#>a0k)_Q`! z7ySx4`r`8)eV383U-9|lGi2#!QTROSRkYq7o=f1CI9Ex7OMtJqy6hi`z^xD$5FURA z51$|EsS)WBFCo~U#}~nAwN5QN+VHu!YVeQXtXjvOCZE$gWKor(N{@dWexIaAG{A}b48XN#GcXe5JNx_{EvC#QEfPK(Be&P3`DWTtor!zbl z4|xZHxmWT#B>BB4#y-kvz;|3-?kNlEA=IBCJbnt!=IZiY=0?=JBD`mu{1J|?*Lp*g zoP%z-2JE9z&IyK%y6hbs-j~u6|t89 diff --git a/TMessagesProj/src/main/assets/models/deal_border.png b/TMessagesProj/src/main/assets/models/deal_border.png new file mode 100644 index 0000000000000000000000000000000000000000..02cb191b8223b8e0247f7aa9e3ce7c5c35250931 GIT binary patch literal 4951 zcmb6-c{tST_n#R?u1QpwQkI|Ff{?O|Elav?kx^NiMy8S5WlVOmls&mBq>vcNbu)>v zWEloCLs_zgi9yDYWg0`qGL|uBe(v}0@9&S_`#kS+&U@bTp7*@xJbSoyUbn-TB=%t{_usvPF-s^< zwGNeJ9s%JrG@T^p_l~7m8|@Euk~E0={qH;oNK*Rhff8~>NMM(%3Bn5%qD_T8*6~y)Md9q#P}HbDTr@Qg++o)z8%1A=j0>z z06p#8O6ilZ&Gn_>3ThZFi2=dtrke>UX#34=ID|B3w{dF%!Ox~@ z$8DOml$$9NEJ^kE0dp@cqV9L^Qc%s5pH5)jW7)whizL$8nC0B1q-_uokjfB9@r!TE z0{Z=O^NX1ki++%N204j&co>*;B(wh%D5n1q6wa{C51Qb5`(-AutPDUHB z$~oQ3W);v0X(S)-Rf5Xke=!lMp#M04`-ek zG0yxd*@x}s5Nh>K2(@U^`&CC_$?vH|K!0ZK7O~uFe$j>Uap^4-CU2iPN{#KEq^t$TA?!iYmeA0RkCwj&#&J`JD5UY8eYu=V9 z9&`*=Yf!=r>{_^Y@lOhWOt{g-5bOk1O;XovO{Wypoj|v%%D$indq`eQ{sBeH?!x}vNav{4nt*Ep;+bcyZJ)AN!?J`uJ~J$ zH#6u0!G^6@Ek*H9%iz9i2`q~rHLj4Gc!pWtmaSW$V+p@^kM7CM(jU}-m9?+j(l?lt&e0_JSR+X7<$Y+rtgJtboM2633aT-s~?*QA7+{`0q z-`u=?9RJ;^nphHRl{rsxmtpg5OD1o%-ZYm3dERU2)g7*RQBL1f7L7k{Ky=H-OoyS= zC5GC4cis|*yAPl046dc@xGz+XU~h0?5z^Atqdv@D;cI$iEd>&Lw+w@A3CID_bnxF> zKGYqV$D>###FLwj$o@!>Vr$2xmr)-HCi&O78<7h&uP5Q2o*jFE_ZA#}>Q~=$!HsK~ zl1a`Mn^d0$8%0aWPrFk|iI;FbAd{@cLFeaAI-3sAboXVmX7roK*PA$v181QL&zraG z|9L$dJGip!Xr1Hw-njNF_Hbj5Nv|{aNJRv%;*NHzA5FjUSZjs$M4}CLmPPuwC`S*!%LvAgBLWs`rL7b>>tf`yyM%VdB_|dq{yP9^?ZV ze?~7fu0>graQ$Ct0j^flf$1#)bx}L7v-N+23O{q@>!(tqh%~qr*D{f%FA?XuY-Tt` zOu~3P;z`x9h?P0GU$0hd%f`G0(U|q0Zfg)C;Gejb5&8R`BG%Qw{!4jtqycQpO1EY7 zaJ01h8Sxc}3^0C5O(-fIUJi89f(b=801#CQ0W+A z)=6%wOJ@S1>zzwF1^~^SuG#!#0ELnuqHk@W>Q3)bYSC(5+)_qKOu<3bzeryx958d2 znA!{E#Q|CPK_ckXQDt4|w>Sw{za~@pM-6^Bj={xw9SOvoKyaF&F9($|M*=5Xbvmz^ zE3?Q(G*~?N`edf)b)tKnRIAcsSlkn=;%Q0$A?2Jq2jziT{Gh}`#$DM;$wT#pZY00| zAZG~QYNb$Bl82BF-53F~4<+JsKvMploG4=ah>Z0~0M5{6DsR4vw3}~6f~0k_=@B>@ z$08rmcopK=2vI)eT>7LW#t1){m$vshzt-&Q&)#M4vPmBZCQJFPyTozM4Zy9!HHsSV@}WHL zU|i#5sLy^R-3lgzd8~>Pf$`^b&q^Ni%noCDX+4$d6t$z<@n3T9|BKWmRM#15jP_mU zbVLg}EYB^{p8(@VP+_m-j=^(duv_brGs)@8zX==vY}K=XqOB^7j#8)$bZ-klpOVMR zuh_@_>G=WtJwGn#!&uCM)IG`-etwL<99T(X z?@ztpr*u!tym%rVT>Xz7Yrdu*V=X^4hmx)t!0L)#3_`Et_c@MD^=?~juiaqGrZMz| zquaZ62B%V*ef(lb^Sa)q`%i<)kk&7Y*PDBl6qH&yp_u~bmPpShE!yX&Kq8A<4sWtJ1#K;{xUGV<2 zJW550hc~D{)F{I9R>xDYHaA=B2=KCQJpEnFvtAhqoJUjo%y!xA(8GKA=wxo?`FH1v z=W_7h6C<5j$xmhmWa`xk-vt50Q1hhrdS?K4(> zRxxz3>)#rP6stLI7`kwPbCwCd#T%n&q>rm>@Cf?)_JWKCjCKRa<3xJ$nC}U|)7P-n5mQfJmtvLA)1}3!yx5^N8*_p%bR7BNs-VGl)NN~{qelJDA#7A{ zw)^`=*9JF!3vA*Cd+%4%HtNSWHAa(Rl;>?W9yY4xLt-)Q$oGFf_p)~-25U3y+v1It z;t;DoE-c-gA|oD>XNKO|(B~g*vdKqCVCPMpaqq5tw%A0D&7XA~uUm;)FjzDDva1}v zTDEWN7>34OYxh0NHdLmb!ENU??D4u*5yrvl5d{7%cKio6BF7Wyl^CYXp&y1jQlnU5 z@m<$|(v?a3=%Sx*4c~K>7W(S@#@T0#)qjMM69;#bVe1hcQd@YDus3F3O-? z;^bQN!AzH_hW6%zL7wQ@UM^x9{@uN?1wW6HFrRft*;Zj&Dl#lOiuVf&S6~`$|DMM)T>RSx5mEnz-LjZ3?y6cazi+RPXxiAFP#WVJ6mzRTKPZ#-dW_C z>EbI%_ld&M($d3zxqV9aV^&&$hIr!foMm6XkMM-(pUu?p&)&0)PbEJcF2EBl%w`j* z46E-w?DQM8Q6BPZwNFwOsjxm=lUWaZD=tHd<8Tn&s^BkJe@)@zy{^32{9OH#^9d_S5B9*EakcNDt_)=_`$kES= z^vVlPrc}`uT~sr7zMn`?3omhH_WIS9Uf-$~G4@JTeBiR)jTaR!;xI(@lNbnUND*vg z^xdd^fANEkI1gt|t12P1yHzxy;`}S-4$6ZdKQeE2FZZ5@Qhm8Pt4h!2B&Mxc%F&P9 z{@3RA;|+ti?)@iLG|#Ca6&iy+=8X!$?_90cPs0Gg4;vdbQh}d4`JEy1MDMdJn1zRH6_BBlJQ}6~-UBqT+BQ|77ia z#bMKq68{Hp=-5KV7-M2wR$vzl$ZyBB=ae{|7+bDQ^!D1>CbqjDMu#~8WBf7p0r#Ub zl4Tdlpp}P(+jjIkk($Di0~^dOn$MKgiee_$P3fv##tN690bZ>r~wUr*f)nyA^t z;8KB&5rGUkcZ#P&BRYK5q>QE<mM zN5m?9L*}z;f}jiwc&<|DM_Gsb;tGL5!=6n0Yx6rmc&TfX+frtMk&nif=@5jq9w9=? zvt_^pL8OQ%9n)k}b(Q!0>+zK_*O?(gN9%Mjq~&90*vNh6yuK2qcgO9iU^+FAe5Es? z`?rDJ80`8U{aY9{zg%&1q?4?bDgN z-wu)l+c&6{4r&re!Q5LX@Z01jA;U|}g_T;lN^aqYXL!|t^)Ho6r9#H^HEnx4ml3Qz ztG>{LDqIj)KV>NQqxA=nA@{7w?DkHTN63 zv>@|f+0;I+vb@mxcxe{y9y2VXiJUQgWOnpSNy3|gVXo9?C~Y)2L|8R+ztCutI%~@7<|!I^7|znbRKbRB8a`dt+RviIc^ zIwKLu*$IkL$Ge~J-roxNXXjuCU|;h%_V8c)S@HW1OT!_FhHGap(wGg&V48`FFPnNa lR&1M`E6)4BYTY=+Em&8j!lS~%;?{q8F8zkMP<|eh@V_On*_!|W literal 0 HcmV?d00001 diff --git a/TMessagesProj/src/main/assets/models/deal_logo.binobj b/TMessagesProj/src/main/assets/models/deal_logo.binobj index 4136c9b4e639a16b3d68da13db5d69f135b16b27..db37f31d2814586b6773c8e24389210970e844b3 100644 GIT binary patch literal 89268 zcmZsj1y~hZ`}Wx=f*2@*D2Sk9qNv!yJZrXHs2JGYsHoV9-Q8j*_OT1uGu!S~>~2x) zj&D8B%;LZJUgo;ayMO1Nd)BO3vubYNqk}_MSG~mOc>QzZE^O7>i+Z4wu7Am0kJzh# zhyM5eZsN=20je2gf7mjOA9NA)|y;#^7;;|t;?ZxKWh-bcgW-rp90`V;WG4>+N zZt#o^_9DIs2LC)`FZ}BO@$BNA?S+%75Xbr^*b8KwNxZUMEqk8C83r#KZO`fJX?R9o zv%9VOL%gWg0(+JMgNSFBQSHtfpA%2&<2ZqMYmKt1X*k~l+Gn;L)U1F@wLsC$FY(Y0R>`>Ox-%|iS-Pd9aQ z^giPIzt^Z6J{}~#IdGBq#QP`zQ&+T( zCf+xrs=91)PJ<(ks{79sxz| zdFIbmgO}GP_OPT^E1alF?D}S?8tU4KI76Mns*>~!S^Hl0j#|aN5Al=h-P9TtJ`>-b zdt9yMO?^O%&wNj7A-;+%wqj4c|ce$%<9ARk`*Ozgap!cS@i(w>mFB ztA`$4jJnmOMJ1hi4I|F@WsY90Je6`Q``-G}l{XFUu|i)q zuDrnwJL$`I%r`jKV|}?tSK`c%+Uv`Q7@o|h3hK+(FC;x8!i;a3{_m9<96Frm>^u zcYCV4#M4+%^Tlk}U53yYSN)TR=q_cc@2URV-smo#Kj>Po^mX+NPE(1qtPR(lk6MVG z7O&7VKh2HI{ymwfd;Fz$$9|oks{20eLHb{{mtJTS>1w)&-g;1f8jq^0^_E_?JM}TO zg5zbqe$*8zbNXRVeO%&Y;)Jg@ebo>kzSd09w+*K`O1<+dTHjOEsOQ6)TlIv18svGH zTth!$w&%U|vHGRBGo;^5UZY>WK<`?;TWpkm$M zCO$HGhW_a8OyWazv+7S=jd!#w%Le`N+G?b4c2)I<+x8Hz8FoUy7fk(Goz-@kekF%d zpE_}S^@Gc)|FgFNz4X+DpMQsV#H&5}{F`-&+bpZ3FWg1* z9;-flp&sjap7csXuIno*CJ={|4%OF8rul)@-da=N(Eljuoj#1$H;w2^Z2RM&@2zwj zSuI<>gMKj!&DHAo!TI!;k7zwr7ab_2e_rWJp4dlo^lwwk5HDMPRR7hmsKFQ0>Hh{* zCtliYf!(6hdZaEb=3uux%VJ#nQ?)y~j4=3AbGu_;puzK-+8x7ajZ^1Od0=f`bcwvEyS;&{&Ia3>b9-U>GW6C zmk@twb6tP4VFj}0KEpvzUe=b_H+H}NxdQb`E%(`>`u7`#?$WKL{`>tiy7qdn?{)`= z3dGj}p4%OqXg;)EZd}3ckj+N=g)x)u4tczZ&sQ2~cgRQmM0LBo-|i8Th`O5d;7z;d zc;k7!f0VI%)ie54p32Gg+%1F1<6W$h-KQ`04K;W5(RQDEMtkN8&1TP2^*DLF+?Lz( ztgB4yX}@F7^XCO|djIow|GM-p*zI>8?fK79-Pqb`3HE@o^uAcNk}vHAds5$qA~(Bo zrg_!&pivonK)sb%jy8VZC3}9i%*2=ZwRv}KC%!suojvcOC&Y;#F4^<8eouV2*)MzE ze1C}VH+yW)>l{p+H0G~8&jorf+Ly6mb|1Iuq<>%D-<~`D7ve9uyzMz(-6Q_A;-o$2 z#COCWUOuGh_3*Kc@~Bt6W#p?<^dA#r$(a{Bct#=fFS>=6B0-JzsM9I2&W znLy)CZ`S>yeyQ^((wk>UryqIqi@0^yr~1C{I&tS|(fZbDG_UG?`yUW%kUrY2w!W;6 zaqX1#^Yw*029kgN?*x7Bwd}-eJdWtI_tM;}ujx5kpS}Gh>1&Hk)Mu|eZSbp+`s~^3 ziPx!h^x0ER5U;PjR-eu2o$4FBFX*$Do+Ew3$^!b#z108p4M&{x8SC6hk6Y4B@1tBN z-tMwWuj^cb_>kKMJ!p;LIlDbl_s&f7zkYwAhn~GF&1rh_f$F-~x!2_X=kZT30mSwU z5q^63;j^gQGaT)pH{RNs*tt=H-sI>igFoEUnIM4I+-vu&cSZMjeT+Qb zUeonV|E>`G#kJt;H9fDr;O7In>uMU;_Tv9G>F&d*58KP0Dz5vddrbavOC$As*=hc< zmmiQ$&zG?i=@qOSbiZ%3Uf3&q`lI_kr*Uns+(6Skyl6eLv(f3aKk1CRRohWhyL^lK zq`hY5jGC=-Zz`v@OS~3WlKQ#5_V26O^bgdw_Sz3lYn`g?CQq$R9$JvycwUxi3FzC6 zGK)TKqLwH{>yh0fA)C6oAkAs|tkXsG9p?eB)n{!iuJ3r-ka(h76FuHS`xbqS;-{aS z*Oc@zLyGFxGddAZa?Ywhx>AdH#@QJC%_M3cecATMc86#e(znd5YR}{!K)fqrkKOGj zjb;6C&ewL2?a8E{s?^BtawqgN! zp1#?lzkOxY`G!j^{pR#bq@N6UsUI!1m{@N=NIy6{Bk{ggFZKUkOeNm*D2u+uqdW1k z(VqI2+69Tv7ayvJPc+8G`Annq@IA&{aWr~^-sRmR^4M1O(_`Fg8+>P^KK(E4dGuqE z9rY!ravSCNy6GFL#1lVcHr>AO4e_Urz4d#6zQn&hz4ce?X+E(#zTT*RGWH2}mtS}F zZ|}%&cN@1~|DItX`t6=4Pw1cAX^ygcK3uAQd~fv0oL-^&$GH0B$r*NE|Jdf1!CiOj zA43Nc`;_t1U-}gw_FYz4zcZts!K3!-7rc%Td+)dE_WC1H#kIVkp7}t2fc895h`HHU1U2(D= z;%0J@yn0CGQKWm6?6229UXM8Y%x!wN8BGlC>#mOpSxTJa&kKEKnRCRR0ekd0M;{P- zZL{i2VtWvKm%FI1?)#b8r}Z*@y(I&&zxyG5yEcZnP}Y+Ao=nDEQGCG!eb2%=qz5Ng z(Ra8p;xaDT^#9&BG8oqA|81>n@W8VAf8DDaJkz58SGy%~#fjVW_2Z~b>>-8w>r4D- zjMzhJWYwo_{%d#+RMbayp?+(xFsGM3sQLiX%emawyDn};96Y+A9`T0O6np6w6Z8gW zsZZLAk3FV`d|pnTLaiR^rTZDr>$hc=UdqTi*yO?Q)CXm{a!(@rv}Ck;w>{3KiE63S zcJ=zcZp2ZIo~Y-OaQ;tJmmbTao;-l{PgHjVWmQjP!hL?CdZb%H_4wr$#8>(>R8MC7 zN&K+JJoWTmqs(U;JE>>N&m#Tx$xG^~AJ2)Cm5b_$Kr8XbwT)H#*WsKmS{)q^s%xJ4 z5qsvltt#d>Y!USr3!i(M^im&PZ9We@iA&$DYFkymqrs0l+P(}eYOre`tw6!+#3kED zYt=7JATI8FP#fGkKXJh3ciOJn3bAkf0@}+vFNt%1iPRmg`w)ALAFVrQqxQ6V9J{S& z9NW@wfv^j525nsJo+%_v_2J!X^Rhg@LfOzughisGk zAL6R(oYeH^DkHO3ISQ-6kFyhJl3kO}kE@l~lDt>ftJ>ckv04{HNE<jOFq% zkJNUB){tI##yYj-P@0SM&@K^b^A;mXZ&9U_TCwG0;^;O*)w~O6UDn6l2~#t<79oB5 zh6n6dUwXfK+>|5iNS9KiCtN7QHm^4JW*5@GWIOA$CH;mimR%itm-y;(N7d>6I^ts^ zTd1KmGZAlUH%py3lI9J4Y}GYt{O?%Ohb3Q9?d`CyUex;>Pf(BF9mhFQ?^LU}db%yH zL5X_PeMQu>msSvG`MgWLRu|hdQJd+tNxj|jEb`&ui{jOLf2cp(12;ahW}3ANb-QPe z$?Bh`i-_GzYwEXk*ba&IZ0(P$?@Q9X?Ag4ssxMxJk)C~E7WKigp2T_Xe^U<>8NvCY zz1*)LwMs@~{%PRV1y*FH^~K(DOhc{rEm!ii={QT9J$eCghXTd56~~OR-=)@bZPj5L z={;JE(iTL~9>CsfPYrFtoWrCK@LZx*Z~mHi_@E@)zdQ$tM_t}y(>5FBjQ+dWR(l}r zSM6h-EK;&&rT%6g>kWlf< z=M(Lfhb*)@uk;|Uu%e~aHSsoanMYf#nKv5kQ}XZxYv%XMP`3uu%xQJ&+?lx7kBe-4 z^Yff9TB90GWi{*HG1xIPbISN1aj&8p%>6l^xci$d%Hx1{#9b!mJRDHZm~+~CoUl#5 zNNsD4SUpH{gn%qz&{&ehw`fboJ;?GS+ssD7G zixSmupATEpEw4uWxAQe?h9QB-R>y6Btu7-s61z4V!rRB6*xliSHG9V;#GWH2SaWpG zNt}C5lGWoV_JKsJ@4lT@k3l#V60Q0AIa%FTT|-XE_Puu;NXhn*MYfMDvVCGR+ea4J zzW0teU1a;nBHKq6**>z!_K`)lk1Vo%WRdM7i)sCk?kXkY#&)<`^X~OM;6&WvdH#1r)2xcBHKq6**^M3wvQ~bePogC zBa3VwS!DajBHKq6**>z!_K`)lPi$uU#AdcnY-an&BHJf6vwdWd?IVk9A6aDk$RgWE z7TG?s$o7fNY#&)<`^X~OM;6&WvdH$4MYfMDvVCNc?IVk9A6aDk$RgY4oRaM$i)+ea4JKC;O6kwv!8IVIcYoRaNxPRaI>MYfMDvVCNc?IVk9pL0sKk1Vo%WRdM7 zi)+ea4JKCzkYBa3VwS!DafX10$kvVCGR+b1@&ePT1)M;6&Wv6<~7i)`vVCNc?IVk9pV-XykwvyoY-an&BHKq6**>z!_K`)lk1Vo%WRdL?o7q0H$o7#% zwohzk`^X~OM;6&WvdH#1r)2xcBHKq6**^M3wvQ~bePogCBa3VwS!DajBHKq6**>z! z_KD4GA6aDk$RgV(HnV+Xk?kXkY@gW7_K`)lPi$uU#AddSEV6xMk?kXkY#&)<`^X~O zM;6&WvdH$4MYfMDvVCNc?Q>4a_K`)lk1Vo%WRdM7i)+ea4JKC;O6kwvzT zEV6yhDcL@<$o7#%wvQ~bePogC6PwvSvdH#{&1@ez*39;a&1|38%=VE*wvQ~bePogC zBa3VwS!DajBHKq6**>z!_K`)l&p9RA=bV!5b56 z+ea4JK4+WA_K`)lk1Vo%WRdM7i)^2BO197U11Z@)vdH$4MYd16ne8KsY#&)<`^X~O zM;6&WvdH#1r)2xcBHKq6**@o#Y@c&Vw$C{w+ea4JKC;O6kwvzTEV6xMk?kXkY#&)< z`^X~OC*92UkwvzTEV6xMk?kXkY#&)<`^X~O=WVWuY#&)<`^X~O=d6otA6aDk$RgWE z7TG?s$o7#%wvQ~bePogCBa3VwS!DajBHKq6**>z!_K`)lk1Vo%WRdM7i) z+b1@&ePogC6PwvSvdH$4MYfMDvVCGR+b1@&ePogCBa3VwS!DajBHKq6**>z!_K`)l z&p9RACpNQvWRdL?o7q0H$o7fNY@gW7_K`)lPi$uU$RgWE7TG?s$o7#%wvQ~bePogC zBa3VwS!DajBHKq6**>z!_KD4GA6aDk$RgWE7TG?s$o7#%wohzk`^09pk1Vo%WRdM7 zi)`vVCGR+ea4JKC;O6iOp;uS!DajBHKq6**>z!_K`)l&&O{{wvQ~bePogC zBa3VwS!DafX0}gkX8Xt@+ea4JKHgVk`^09pk1Vo%WRdM7i)+ea4JKC;O6 zkwvzTEV6xKGuuZN**>z!_KD4GA6aDk$mh*$A6aDk$RgWE7TG@Mlx!baWc$b>+ea4J zKCzkYBa3XG*v$5c&1@f8Wc$b>+b1@&ePogCBa3VwS!DajBHQPjlIz!_K`)l&p9RA zM;6&W=ag(8S!DajBHKq6**>z!_K`)lk1Vo%WRdM7i)+vl8;?IVk9A6aDk z$RgWE7TG?rne7vs**>z!_K`)lk1Vo%WRdM7i)+ea4JKC;O6Ij3a%$RgWE z7TG?s$o7#%w$C{w+ea4JKIfEdA6aDk$RgWE7TG?s$o7#%wvQ~beaz!_K`)l&p9RA=bV!5b56z!_K`)lk1Vo%WRdM7i)+ea4JKC;O6kwvzTEV6xMk?kXkY#&)<`^X~O zM;6&W>1MW%EV6xMk?kXkY#&)<`^X~OM;6&WvdH#1r)2xcBHKq6**>wE?UTpM_K`)l zk1Vo%WRdM7i)+ea4JKC;O6kwv!8IVIai7TG?s$o7#% zwvQ~bearRuhd&!jkiwMciBdNSxr2t zAcLdUR>VW|`FI zCgSRG&8$_brXy}VFP}9e`z6jx>`m+UwpJW|oH$~{acjBTRfwDK4zcFHx0CZ6d-IVF z*1QjX5eI~QwHGf_gfsu|2Fm5Mx9CuY^9+0XtHnB=!a9*RP z&+ttzI^zxJ4O+WQ&Pqbxb*SsLE{sv#EX6pl&{ut1t&S_}Pkh+NL0w;U8}UZ}Z0g>> z=wG3hvW{U6*+V&RP`~INdT_P3oVQz@YChF#D!#;S)f?+g|0WaXy4gr?J9Q9o$du)J zc=^4YcU$ZHxT;%^V*Bj24$E{%cY%ML_glw%1ZuAuzu?T@enjrY4l4}RP* z<^3X0o!eI#v%4tig7I4M-qAC5XdYJP=sNNUMvv$Z=n?%P_;D@u_Nx|ZY<9-|Ra2Nh zquMq(Ry`H5fa@%UTVCDF>i)KzmdOu==I*Mo$VG{Vjz0 zTkzuwcK=d`tRe4~aSw7lF@Hz)GVWWf);ce_UWW5_V(g!+;Y4edtKUdx4JQ%H{TBVA z-y+vu^w?@`@QD1i7d<6Lf7px}R%YKwdf1Ga#HfcCoo7{swk18h=mKKYMgI?e9K`#7 zFY5ouqW>c|W5cXv8rJ03{vY$cYHzmxy0x^!bwf89_2ynvtwAmE9R+coK}>q@^VVXo zLJht51!B_U-dPL%yv_Au_U3WP#5C4+SE6x8x;gHU!|#QtmsW<6Km49TjQ*MvoYjo{ z|I-}&xDaO-V$?&bUC;~0b|PIc>Oo0=^v92Wb3Jbgvru;dhVZZiBZqdrkA}5h+b&TM0$Ja)&1dAYw# z3iJM;2JW4qzZh5$^%TZAN6bIGKdTdRZqYaOy}>;pDU6=}#p>%byZMqX7Ga^>y)~0{9Munqb}xWtk1dutJS@gtCL4CdgeGzR5!bqCtWb= z>fK4|)JylcULl3Ku6f#asX+u|MvQApi7|k19IUW@ZJVq7o8I)ZwgA2(e}%7}t~@OFrtpzK==ovE)55>ccV}rgaDXV%@>DV9Gc@&34_&{r|`E zdc<`HhxB*h!aN;pQ>ww0nf*Y^^bs!2=nY!wD7eV zbjhm_-@P_`f4T@pjo@o=u2~RYeYc1#5P2i@U_(hv4MI}i5OuVJrOUa(gVg591! zl)u#mz;6Fv;P5m%>}=c|>`(W=PT%HW32Y1hHTn%Fd*6Y$xu2AOJ0HWgmXDPtFMmO7 zKn>;9az|KuVk1l}QUkUooq`1p-(c(HmoRhU3D{P_4#V5tf~}e2VQE};*qqc0A}jue z&GQe#TCWSR$u$QwzrPbUPTB-pKDt8O)Ieyua00}=uMUUDb%l*i09uv}5SREA5-u%- zjRAe(V6pxX*X}DcniC9hUO7R}cNyY}dBN4C-C*v5IN0&%2E^rW1$%4%fH;q)pnom} z8w$ojgZm|6gT+(%(R>lCD4!8rr=EayYfpgFj~1|@+YdNiqzOq+?jbQ0s z4T9gSfu$`wLvYg_5c@A91ZSTNvDZgH{+f<3>&B1JS1T641lM#h^yM*FbfXlEy0Z@! zZLSG}2lRkNvll^$@nJC2k^rNZ4uD0KKEZ&0Rbf%FAnBO)NOuzpG+WyS~bGj~v=IPSIjLD%eFu4=V`c(@? z9*Boo7kD2m*HGg7MBZAg*>#7&B-ncsmBe=t*ZFWP%@z z{o4UzKWBi^*{q>+)d4W*S$Zh)vNMeNvK&fjPhrf=MW9S72}7fn!H(`_VNjwU%ywR0RKJkV_HKPHt8um3;zz?ecr&GJ4c|Ge`fg6xf2YU*b#zS6or93zJyMC zGzg-9_ke?AG>8m12j64fLUhu9%KT>ypwsKVux$uHx6{p)&IyO0eeTbpQ@wUVpY%)N z>$}p>x6~2%Qs*f|HSQ9+DESfe?6V3!?5GKmmBzx|Fbnipb0T!dARW5zaDjK8XP~R! zN;tAG6SThm6Ye&Mfo^VE=$T%tpzHCB@O;NF=wf*c`vw$)R(@OI&WoAQc|~=_a_l#B zoSpzl(W9Vql?m{2#3|^cW`;Yt$3e#lo8a~E`q1&q5@qhR&(J>Mtdh6!Mrhk)FWegL z2JI#!Dsvm(hBkdWC@q%6LL0}LaQ)2yXr8oC39P>uTKCwe%rCA$%W77ou18mBRcj8M zT^|bdU%ysDTs)u^@28sj9O@V7r7TY07@7^+4Od#-f<}#-D9h&eg{D69lnu*&K!Yd6 z;8Mb5XwaA`JL1Mcoh|8=n;A1fz0d2FrcuE_n@9qZ|XVrwT%WL4=qZbes zy8uq!j|TO+KP>9z3Sk>Mz>+;fAZ%_hTnI@IVah~U7?mIDbx(pNha(_t>K#~e{unPW z7M46H17VRZly`rsLA{kfV9ASM2Aay3PYX#L9qPuQ>c}=9C9sP0JV>IfMOZXLG8*xN<5z{YM#2H?5(g0YSmp04qf&^ zjn5h^h`9;1>P15K5`&@If=3WMYb8`;&tdh3l2C2jWLU8NAk-*fRrbwZ3N_DuQx4>v z3N@#!Qx4jrq2{D%kiK3;sN(qt78VJBYJBc;jXeq>M-IY<{x1M7zJ`T=8$y-aO`&4@ zd!Tgqsw7%3L)AIgmG@iiV1+Tt)8J}Qb(e>7wq+bxolC>AZZ-&=6%5YTmP5$hNag*x z@?b6Nr2LFL1EIqzEB3$nAv7d2oT|kCgYaq};k3h8U@qz4^eG2W&RmAwV~;|~LcJj8 z#@`SMzo0;|O8~?6L!MoY0p@pyq78pT$i?e$CjVSeD!+h`krSZoDjzu4b~jXb+8j1E zh=QPfn(}XS4k$mO2xPx>3MwqGuV{Qts66H_IDh2Nw{a{KZT}NOj?ID~r5Lc$ZkWng9qDVYQrH$+2-a~;T-c@9+meL*>NFDI1W-wn>U zYX+r*Ffp{m7!G25>V>wCuQ%~!4RDEQTZ1i4kdqlhmdEBpy-cj%I?FiP`b9W zhIA0R^duD7w*VBM?@(lJGAK2QLy=h%L0QuuicBsE%HM-fWb{pdBAcPe$i7f*lrt0_ zTvz$DsTc&5ih|ld-J#%;0GRRS78Dve1ZMqt0R>-gf$2Y1LBYkXVE(c%;6LRF)L-5R z@;@01)8Q5r_;Ul!HpmMBzO$4)KEEMv?-t6};85^#nxMQpG7bE@{D8CGSD--L9Vp7z z_q^HNVcMfNkneLJIPSm>OIJ5F0Lwvlb#tN_t&mU!Xa14y?X}udo_h@r*FfIVjCdOm}@ZS$_mJNO@Xp4eIa)@M^Nu< z1D~}PsNAU(_#Ey7H648+*LOc?rj7y6U*92q=tA(St15|!N5QMBRY`bV19Gohrr7wr znS0z##g;G|a(BE0CC6+4kK;`g+gpCV@dM>-`C;HypgYub_kmnVx1jF6Zs6gvknh7b zK@JB`21v#%@f^=h7L-T=iA>)pMP|&3WIN91l{KI9CaTcE|-^GJ-zlqAr zpvjQF&U)C;V36`_M|)_#`~$db{0#AX=0HYEU5Fq52V4ffgKd1xO*iT*v?$OXoX^*Q zcs|CQKTU^tp9?RhdbKq4;QiWi=PVo;dJNJ{DXApgj8J~}S`7RCya7jO4eqOwl%Jn` z;J+@1z;f{)>}})?7G)sxab(K(5A|XE-A&4`H@RSE(;MJ$ZyeP8K1uoEKN5B~=KsDW zNcrlYtbAPO4&%1vR(>^j2@|v4RDNy>g3aHel=n@8VeG22$`8k-kmZ%Ge7Lm>rtI6T ze41Af)Z_V;r-MGhn49C3FF~asdfQm#b+e7&J@cFLHtGV58JAUge=q_f@{dtI54{c@ z7pGI+uUG=D`}a^j|CakG`L@i~-_p{JE^0Rxl| zUxq8+n(RV(`^9{H?;Es497NAKRjxa=pDXSGYgxICwoXJrCmT;a{i zGybhKuK0T8S&mYC?>kMg1@(bSa}FyP&v%C<=N2m0y7qxB=l)Y3Z7Ks>?1hy_oyWtL zy}6V}`MSfFjboLE4<0~`3x|~(W8Q+-k!s2{{ynofc(!uuhZ78#SXj9pkM3N0OchA-dVG%t8#|#iSot|R&2R{ z18ccZIW(;vUo%E32@RG(pR?DM_|xg3>*|-v;Vipg@#scM{O$>m_i7_0;im=sTxuu@ zyLR(A>6?7xbB;D)9lGVM)5v z$^kVO^a-n|92&^~Bg!G=m2DG~pii!9%0b&zh)E)NRVP z*Xdw!$NI{)(0|Zx^KoTM$N{M0cw1RL^$aXj}N zcF_;Yie1i7<4SN_7VWn} z&Bp7LMFWGOX3rR9QL_dRHoLVl_iM+L?-}vEVSZ1EeWTb%rR)#Icgz2`uM^)TDf=~Z ze0M!dUb!XBKs|8XHjf6^mN^k`2rj#-e&WWCMRZU{P89SkH-p ztatJ0Y|w?ntoNj7Hn@!k>-A$5>%8(Mi`+7m4L(|u_3GfyhPd2fJ&z}|A>|TS&r*JD zNcbQY8TWv-EV6`k9lM?l={B52W?I9B4DZHzs8iUG$tPI%=3Cj2Xokuu_q%*6}8+?#H97QBWUNCyyt~QehUW9yf}G4l2s3?jOKvU!B6LlwZaA z9c{rXHf_ROM@BIIXGzQ@B8XM3X=TOFUS^d7+p-My&#a11ZdPT<1{N~>5_8fwG4;b5 z=EVPdZg%E0bJ|^$Dff0VXL!d#+t*+jwf8Kf&_~7`+p~&34lIj9LsmIMX_oCw16J`$ zU*=KClU2~7S=5^btZ@7f7Bb`?E4#WP^SWtc<@Y%=pKfhgxhs`e-ZfuXxsqR4fi8zw zxh&gRzS`qiS^nQrR$Mxsl^#5SRj5^*1-0~G727msflk3J^k7+5xLiioYse|)9qi4l z$H%e)H!rdpwfivtGyPbd_4AqU)f}ur<>t&gelu&r|GQ7Gu!^i_&p?(lV-42qPAKzu zU6i%*|Ha(bwqR{r#j$MmO{~MV&dhDbch;q1A?6ldi}yEg>TjZ-ivB42ndlcO@56i! z^Z6YdoDPh3aB#qX82=yJ`&wRFNB2bhcWvN}O17ELgOTB4gREL)&b-LB=U?Y*orgUl zeO{R|+Q8rr$gISAcNXe%8(C}1=cwOXT}ba&)(N%@Nrwy${O?d2`Li1F^5;vn{*${R zvr4-!u~KEDh^uzUp%v`ihPdJ8E}BP}1=)7|w6E4He|ORwIUUyAJB%Q<_Hob(Z}%XN ze=A)ZaqA`N>c2&-Na@1F84tD9nw_dko+;J3X@gdGMAphgmDI}5uR;2)4SQL)_)^5H z7dB?mZ}K3sA_18+Yv$d^TB&F4StYk0q?b4l&q7^F6PHd{ukkNCP>&{1!wTcs4Xr=p5ztni06J|!FC*9)TT5FS)+DD5#nH|m<{XrWxcP)gE z-HaX<@h89L`YQ(6)-v2%84Et#YhXUh+C*0^dh!L*^WV3y>SHn>CrrJ4h{g1% zhODum+N_w;4;hy5zA+&94C&6jrfDq{dUjUv%TcY=zeT9q62As&-F>P3ZMQP^(z@OG zf_j2m>!K{?=5}Pp>ueKsrgExvBYkAn2=IQ_iFkz1ZCmMC$C2SrXnC!z*&iHQ>8#C2 z4RzyPWO<96Fu*TgO8fI?XXdlRz!rP7A=6)=hc)2u!n1K9WGz=aXD#eNJn18OmXc+~ zc;YtaI@|uOQ<1eceb;FY1HU1|oHrA+f$gbpYeD%IvJj)cX-zJ9XjyB$LJxB;J)5=Y zQk=MJug~zn!yQ@c>sxj)3u#!P{2L%@UhIyv8*|&2ej6mK9KG( z&YiW1%!$lgnh#~ox6yk{sO{^i#q4ZFdIA3Tr&W8BK+MOhZS|B2#4$gj4^Q_r#z@vr zVXR4e>Kj_tTV7g|0ZqtL{p%ksf7n%IWhj4NF~(TH_J%*T8G%ecJQ z_{cVwSVxU#ugI)phY_~qEaQotYGh(9=dMKtK3*9gx5&0}PL0{%p>f2Y+i%v|f26rf zKH|ko;^DDLVW*d%Lw@JDDW&-M9 zSsSH|{In0*_9#O^t;^Rxr2ifFl(jYHkc7**FKDB-lqb)&Io(;`o7IuECc_@FtY?1_ z^ZA6C^NH=}$?U9MP;K)69duf2TO!0%`WM8y>>WTle@2`6j9S&k-?f6nhM>+eZmX&_yH4ZFwm$tBExJhu@;lhF zYHg|?>5H0Ckt4RGstND1W=J)X#o>z*_%dEv5cR~)WckX;jo42zKhVLh7-ez@1{nYZTps{Sb z`MaT*H(0wK)!?V&K)hD#I(oV7{sHQfa4zD87I~277FIaj4rcuqgdP^n`{BAH-^m{l z*pp?hS^^oS^gN^uioJ%c#7#WHV)Bu0d$6+=>soyc>KcE>!{#%xAcrej$cc@pGd@Q# zbFPC>%UW%?IrhC8HPPxD^O6>m)a>w~liAUqz@L|y&&#@ZSpYY-k3?My^2w-$?D~hy zl!)G1@!E%oWA?vNl=be&wp|NeYkiWMAw%W1<=F6p(~0>z*Z8|fR<=J6)?%`ZN7hPu zuhJ?T?ST6Yo7ivUp736)_izw;Sly!SG#}lYn6Hnv7sehy8~iGpEoQ_!)IrbUqxCk{ zAT8^aDJkG)?%*sC-C){{N58LvymQ8 zN#}bcP3)0I*&Zrq^l_-$iucRHMnv2|X5HrvgzK*!6MOwW$m%=L*kP@HJs&$lEirKxMqv)}Qa|h8XiL>yzOd>~BtGYK@-GV%hy$qem-V zz~&D-eP1H6|~D1Z?wOyWzTT2zH7rr&9SkL`_ZFC zf3FCuE7LxNxmNwln)T0(I_^6(zW+dG9V-`uo^c z2F_$164nz}KABw`Zj5)W4Il3gYZFm7=J{Uv$*8W*`TvD3!`di8~FE69dwAr$fIb@-+ z54=w@vrodH>}A=I7-|!Zk2{+=?%0rtEo=ji%%XB!h5~CI>xis8-nU&F)tCAMi@x;C zwx-N7)NKb=&1O-@dn2>%7y8<+y}wD!_f1OOUpbLAcitx9A9Il2f&Y2dr!nM#+rMHo zo-v>f{j5BzxX>5bcKono%J)}HpDT(vHkniQ<*eoI?-jplzQZp<``(TcJ zt;VT6EMNUl^5+;{hlN}HiOaig(8?I!N?Nnhvo+VPw@K$?Qxjt|Q`Lnm;$juj`TI{; z>Jp2rw0H?xjIjp>zMs{G6*b;_odT7$VV^&czxcyJTIkhQ$O-d@J;vjXCyn@%IvD_7lgoPFm|CU&)`p%rdP;cG~aZI8&zfqdt~! zwdF*{_hjg?6`0&r8*wlI8NRl=rM2&V7nwD<;;(rc-!HZsfjzbE=Dg(GKezZ!Q5NJ1 zWHAl0qTkl^)njc~Gn$JM7ETJ(OkErKwy4cwj9=R(zQ^vjHj2ux#JSYv{m3xxZyRl} zu@>OIN#pw`)U|G2E#Pj$TI7l6`~0XX)IPS4{M)cYD|)98n5QZmVeIW$iwn+LhSAIE zTK_&hSk2MKvsZvEEcoad(raG0rTH6UgoS@!jr|pMRx{9%`5XI8#>ysY#f-U*1$^tO zRXs|3JXUl`EMvyLOKZf(NOq$RTIa)&wrB7AP&sv7Vl^M*JM^&6`X^#9$NCq_1*@!6 z$OGk=7T65Cpo4Pb`Xx4M(F|nUu(sv2A?Ejf(q}(yl=&UR_hK5~lc5Jz?H{f6cc*(L zXddot)Pr@X+xXsIGxzp3+_(2F+z55evqmPZfw?EI_j8+;yLmR$#Xnd-*5|kr>^A2{ z>)I$**jU$Cu2@IL|6Cls@O4rkYu~Xx@%eImO_}aVe2)L!L6OFu0nQFd$0A=`C;bdx z3wj#!6`Xea!Fu+iy%U_6agg==JefR4`QK&TYu7^J1dpez_jBs=z_V!9*O=R3+SQ|M zkg=as{vPkmMj3mL1dsn3Fute3Yi&;H$1rovvh~d{lMQ)ntjqC=3yU(^P;0~=i|>- zAgZLn4QttofA%9D{`RM>d|*#v{*7xJ-nk`lae}mE3NPT(a4PEijqFW?tD&YWaK9-`;MtvBja0=(SF0s$J}`TZ(`&UEE{jH#+zup zW^N6f>^6t=GW%+<@{JORt0ua#fP2(FjDH`4xnAQ<4qo2x zMIOGNwRs!gHH`oNrfhqRZ*x}rOH0ky%z`qM{-L!rJkZzwxMr>$p%r+BW`4KYocMY) z@?2*u)5fzO%z%h_-_zO}*@)&kVY1fD{Fcm;@1NFm{(tDvvNjlm`Gvth?r2SnZ+y*# z??0QH>s>p(rVqVS06hs~c`jkDQ_6*q^V+DL$54mr{JU~^d1H;^YqU0``B2iQ-+HMH z%G-c=adJ70uLs1j*NSTcjQ0X@*Sl%`?njdTkgpM4{!Bw=rTKSv#qcCzUbd}z#bjh# ze95GgF+$_Q%yX!p7mg>-B);D>`xq-T;BZO?IPl^Y+e|Yvq>OQDG?h=;>7F&nM$Tq@ z*Rv7%yNe8pH3_qbT!LlXuvdIj<33m8Ybssq+~u#J|UxaHtr`N1F2JS@LBSd4$M{N%rmCd;1RTuW!_vj02R(wn;Mk*}3K z54qPV4gWW;Wia)J{8xD7Yh}+P?r~1Tf1hhErhb(FW;FQ$|8+I_EC0=8vRsZ_{yly^ zv+0q`k;|7o$GA638veUn%WCSfN51w8KksIGEoTe_nJjzcYh}+!?)6W@uX8P*smmVuTG=y-d-JE^*SJ=|)Mby(HBr9oiQ#%c8h#ts z3Yxm?k*^)c&lfU16ZmgolgIPlA|{XJzeP=!J@T~){CqLfBi~D|gIvx;?hQ<%%w(<= zH}yySSIjMPzmo4YntMu^e)+y*xE5sU^1b9b$eu~uTQUv5d@tEQntR244|6VMUMqX# zYh{moFWHapytGjc_03?Defe)0gDrA7let#b)a5ecxmM29WsiLAA%4Dm8Xoytxjuf} zTfy+lb+gE0@C-j+(JWIQk8(Nw{Cp+DLu1Y?(;|EF@$;2Uk3au4{i!@SZbD3tsxm=UEya`MGc`s)mQgt9f4w*3D|_l1Hv* zDi4m=DrxxTatibFRZWlNPgM?%?`oz;@~86PxUX({B!4Ooj{6#>NAjog;8?F|dL(}; z503j3XI|@~86Pcnvc>l0TIP z$8mkrBl#`2xYoeXE%Mlr$CTU;*Klt`(=YeERa^@8`1w|*NA}B}&HQ|8(p7vS%wl-`4cV ze%Z5)pKoV+WdA#^wKw%g{MXs!Wd4iehaVQXob6obK(d2HE^|58I-0utzU22Pm-8R@ zb~62PnX+dGKi}E(NPe2zx)?gmPhCx}%743=Y~{b*O~yG)c&czVuT3=uasBLJ`sMK` zms6dek2F1UnJU+Mn!4fD%8g78dgOOe znQNl_ikyd~;gPSEJvF&^`2YG-wa+eoeuUw%$ZaLJ;ck9@r0J3U`?)sC)Mbx+?NWX| z#`MT-D7UTLKDfsmZTM*)YK|j|e6KzH{20Syk?u?TLD4?AwvRQ-k=ns>lWXJ5YvulY zi)#%`eINfFZ?b$Zxel^tFZWLPUq9_(CmK5KHAH=+cVvm>=O>xh%Izb!o7_I-xOcKy zrrcH)xF+sZn=_6pJfwE8$n*1Keh%-)k5swATP{o^*})=vFv-B*f#!h+e6@IB5EQws7WtK0$Q~6yl;pbTyk41jQ8(dpp>as_^R(`H$ z+`G{9%g-o#p7ZmIOpolp&b7s+F5gS8gIvxF?!|WJhea+^eiztx@E!2OBEOewT);8F z4~u*+xeoHZUUDPODg3a=_r?0+e9aGwd@s2UvS$W2;y!~Psr*;Du#)7|^^xnD#LurX zJ#u~IdiwM8qHomYyxQ>7H-y;-EOLFYzppVo7P)R$xVF~R<@S;5Dc9!}_pUSja^2o= zZM~_>9{F0iJ~+-cn0~o#ayhU0`M5O7^yAt_L#OW{^Vu!_Tr=Cma+&ic{trJ=y?6O} z<@(^5-b{7}i(I$7T-##ksqQ7!A=SOkbMIEO9JxK^d*OVr&Gg9ky~MTcrY@HwKZ`Fv z|DWMWRUfII7P*`Y+`A)8d^SexsT#j76T%UT}yW8-ms#_ke?J;%9 zW09`4$o0W@xYzJoydT(b~oElewI{q#`!zJEJv zxF+h*oAdEBJo2@@`1uoQc%*AB+4%XBrbnueMXqO0e*RP%<;dkn^7E(D@JQEMz zd(RmDRQ<}0YiCW}!hg@1EY;H@>Ga)WwxRqisXYC88Rw01WIugt;yA}cZfEIPEOLDu zxew>k{AncNN*xgBzG?TV?(9{Jj={QOnZBiBc+C!QAd z8Nm6P;ZIdJxtw(TJnj$pVUfyo_{Rm@qu?Qxlj?c9^K*&hNZp1#xF*_GE@vRuZ<>C& zOfRn8GIWav{}t^cw@FT}-%i6LUn_e&x%W;Q{w!R(YwGf|OKp(*YhCy`!;;z~Un_euaKCv$sxqCq?r0Qbkv;OYe7?2d9LEof+|E+_r|M&k zxewbK52>G6T5uhonI9Ip4du3#J=M66*Xe)!e9pJB#;3dH#PtzC#PP z7anq7mHM!yKlfm}^TQ&SBbVQtpTqZu9=Xoav!rUDCftYp4-cuWEYV!YxsM;I?j_ej zzE^eb%WC@N`^x2X;vQVr`5~8y**WcX@Pu3+d5p{LGoSmjqnRIaTgmz`?r}FPvd7Yo z>p2YFBG*T%XR7)%<$e#d9I0*=`Ppl5kEdCt)DAdyEji6=<+@4FlBzzPx!>!5>xOfN zC082d$mRdwp4@48Hbq_VfLYrL?Kb_mb-%m(!B_gH69&rtE3OJ!MRf?3X>Q zxu>k@k^Qo#4fm8YJ+fc+wB?@irbqV6&$WbmDwrPm8Rfn@oO>#o9=ZR|;d&)gmp#(8 zsrpzq?yqe4EmA*8)i?N_*%D%wDc4`Fb1e6SnjX3Se6MOzOkMWK*W&yDrboV)+-|r= zurxgKwYV0mX?Wyo`QE@{O~WH!+n#%>q~VdSP1T0oxxcF6x5(|;hwIf$UH0_lx)|f~ z_^QSA>ZV^BYq;M}X~U(Q`Ix6eZco{>jC=U?bVz<|V++3r9@tKn+Jw}umO3WO9zI`M z>YBRb$8Qu%JwwNgKjmI>9prvEf_uVDztkr!a{Kh)p8Dp!Q8^bS`nW~&o+|%}d%fxo2Z+@(g z{Ood@$R0i>EbYyENq+pMr|%p*B|p2=COAjpei{#4|5NHLwMnWv$8Zmyo9K}0pQ@Z9 z+|${xq$-p5FAJX^@xXDMQfKK|Qq_6I|EuFH;Qgr4wmnG-h2ri|+$ru-w79z-+}*vn zQ{1H#cXwEdySwcccVBkV<-6`@o=no0^PL|d*W7a_lZnktX8y&){BD1B`M*Nn-u2p3 zpKsk>gYoa+{<{3N=LkHERr?!U`G>%a4g0G-b=oiSFiz~RE>B&~I-eu)GxqGS&a?I$ zg@AtB+Neq0Z-M{JXoq%5$XlnibC;tw;Azx$X2mygT<};5|K`I?vj3 zES|mGQ~N(h-`n+1;C-CybE)-@@$B1+r`GFpuk)$Pa~%2X=lRrSt3Ai#+21|2|1lh4(78UBTCdArdp;uVL7uiQb9FAdmkC^B^rvfV*A~^-)LLdZr1j|CayKsO{Oj{N z0T1(({Z;3v>p(cHl}8$b)z}=V-A}~Nn6bYq&yn(38PDL>Qs=4fECT)8{_1?{a@L-c z@YC1-=KlblzH5JX!1O=+tLvoJ>-woZr;zp-Pg@_WD#J)^F&lpRjsEI((RV0aJ}1NU z8~dyB)HT_@y;j<~eyaM{8g_SHcf!=K{nh7kJ34h|fAx9&|2&uCryPIt*T=dG59PMM z>bN77c@;dIr~c~l>z#0*zU;3)R#ncC>Tq`aw735B{Fm!avYM=lW`Y zwWm54-ACBFTTFUh?2c89sb)l#&pq&&ZI*gh+#Poc_$=3z*V)cf!sj?o4xihLr%rn- zp7Y#O*H2Y%x~B^~Z|G0=Ocvy1tv##a=US`3 zk;=9j+w?!vYfqJSq{|{tv*s8tNPwZ=YAjlt302&9{z=Xwd=KK1p4W&*X7}y z!ZohfWvlbKAJ4VDUx+I{d(7HPo1_d4|N%CaDQF4x;ziyxzRm!*=o;& zcy4k}?XNxmz;m;EYJcr{2+u9(0IE=Odjveb9biq)hAM{u7-xw!h(UuIIY`>+UXZ)xsL)r?)lX9z<3HzxLzNtE<^2M9ET@+@lS;QlM}6C!_)4m^QrRJnxcK*k4@{Z-Fa1YtKa_Gcc{v$K2}wRk@A@f|8wne>pb=SLU_K_ zo8fTohjkm(#~KyS3+}IvTjxXjhZp~zr`A*L8#{Js&A2O1eZKRdzucxB$y2AD7tbrb zc~>3Us1b-mRd#)o|? zuOzkq9rU+7pW0KWod6F$`>V@Sw#HC zod3;FodxDT`>Q>5+S@q6SCFisngcyK05yIJkPow z>U^HT^L;PJWo`>UxL$kewDqz2;s4S7^>OQbp2hQ1FL{oK{%_aoeCqs}o5RoUsq?Ax zuRYB1;Xl3j>tl_9=fAxicU<&eT(3QK+Hvsw+KZ=7J2sx*dhyh0$HMb_FP=K>n0Wr^ z#Z#s2zLgDl&&7Ky0ZwNX?!K3f?3x<=dIFrLD6D^{#M&{T<#UIl`j6@gwr9BY;Xd%C z#Ot=4E-I|w^w^pY*GB!0$JS)vczj{~j=|O$xIQ#P;me5OcyVES*F6t9^OpTP7W1_n zCnt8cJWgg?WmJ4Y%jtx|-EYt7o6U@bfdn{CSJz%p1vryg4 zL{L4zY5Kz5{VnaL-x=6_FC4EdY`;TYk^Qux{hJCawH#+7cGfqWHgC`u^c}0sGjP-x z{0dEdWOl+3Sbb^^!fh?5Sqs~9(w6Azn>Q10-Ez8t?LS>-pMAHiK2ET2(TS6eeLq3k z{Di>-#-;sR3$&#;&P(iU>mv8CJpuWs?>*RZI=!&IWwY-@vwWV~k9@oY|* z2oJ}w`5cZq&(G1MFHYE-Ffm~X!X7QhMe+Qvz4RM_rE)HYM0y-!U45~p_x+q%x-Y%|uo-;l!Te6;;szl->2!Zdj9 zCO)j?bVp%*3u*I3e>CP`n@8aIV`2R^$krLA#dA4K-)i7Ev~agpHXZxuBi2{ocxPd| z=BPb2p2*++Eg(33SJ>8L)@EDdRAY0!mJ{zku+6a#SD{Si@o3X9&rSsmr<#cUf&Bb9T+cOg)JgjAvx8u=Z zWc?d7_AQ>y1x}+9JKOV_`o6~Zlf?98aeAz}qURb|h)cZ@DJ2ek*PU3iW;qE)|1=x20 zL3IeneG7NrB`%1z9%&~ehU40W?HfJLLBIFyej5TO#uHtx)!!gKo3JpRH;IR|oL(#3 zeXG9+9%SqPaQw4y_kMX%JnIuSWFMT?DXiZy*xa-j``&`zBZlMah4n5s^haNucsqjn z9h|l~U{{H7&7pyf1mVSE1L82Wc` z?3s@-CQk1WJKNgW0&FjX=K*5+wK&~dSo5sv-u~^I>4;U|%Tk_c3fsNHZ)`6|7>B%m zZ8?rvSl0o2&$~SPj)C_ihU1ZiyWj7ufTnhMk^m>&$2i-+3GoEmg9y749&b7BRM^(N zreu3X@;R7T^#Ui=lXLeTc_lo|arRCVPBRtO`)&IMW@X~t2y2iYPCFOY@5XEmfw@G# z53_oQmfYZl??HV#V+nU23BOa^e^l)K) z-)CznlvUsK+4>Bem>V+dw;=ZJcumrM4(mP#j-M3n*7Vk5-z4btzXp!X4Vm?uFnhjZ zp3v{W?D-3hPZhR#kn_;@*P7#0c5xg~*uD#Xo9%T;H!1NeEvJbJcfV;`4{cw3+w&AeXCEM z*gJgnc{r&qopr6&`lMpc+{5DzYE(tbB)QZ@f=G$d&}vl!uk!3 zeM8ouD1-Hz-H7KVyv{y2%~{yq z{XT-eJK8zK|7ba#NnWw#Zk=-vwjam$5iuM|m%014b5HhNj86a7zY`QMDBNAI_dh2#8%?LGNcZ0|!p>LbjB;-vB6+`Vht7tg|kE7=F91q$om zRIvNh{n*ETdp`)rVTHSUmHqKNfPNz}9Pcfx`#AgkP7g8XoyT>eESc^28<6$@w5y0o zBTknW?!GlT5RE#v@0Z{>qOj&uwWa-ALd+Xs-j*YIXV$-kV9z<4wv(2B28xfM$^6t9L&D2V8(g_ z$IlCQ&(TM)?_TsviQ#xx;pPtbX!Iiqcfu#M9B(UZ>q+WYN1=U9JhbJcI&-#rqFvcm zUYbwTCU9J?u=TrR*e2NfXL;dtd+Rlwv|0zT`_L8PEX0pVXgJpy2J78 zn;bru7><(^ws+36p;NzI`Qdawn$88*JZrz>K9P7Q!qWseZcpgbvfY2t-uCYwX%19- zoW%ZB3+ox(zFRmMZ8&@@F&uS{&UUXiK00HgTN8lO4`}1LPX4w|M7iqgLRyXO3-GAC zzrm9dpGx>0p19@sOX2R{@g9Qq2m7f%JzJ(<3+w(}_wn{E@SgAlEholYX02P>w@(Au zr~av9!tv(9_M6cU&`&4)MR=p-sN*_ozE-{1z0qF8kG33lFWmhm>rAwt$bTAQIDTJP z>4Vzttae|RzU6oty0h-lg4(@@n7J^|pJ~0q_P%{WJZGalK|E2*N#%03=gt?|J_k=C ze!XR3=5B4D{%7@cG5g>|zPeV4RrmI-&Ur9>%AOlx-GgVgZ^J)l|IBDT#9y?WHY*(7 zhSwnMg6AD#`n_Gd-z;p;D4(!>KAr=KKWsVeS6FLic5kQt^gR4CF&v*MZ1>myL0^Dy z5W4y;9QQA5@8@qozYy&O;#*oy&lV2-;QtXW!ZQZ(Z!M?M3Tqw>i?Tfj@eYJ#TTa^+ z)|$TEgQ`x)gw?m;IC|kQ7;R3%C1{#|=W01|&B$!eVd{U(%iVkhr@PSBX?4xlns=I^ z1m&_O0mrY!4&d3B*gaoQ^GQ_f6^-m*aVZSp5c0 zuNJoX>rl3@ATT%CdmK12w`R8W*p@(!!5Y}cNoT&TEy1s_Z z(XS%te79~n9#Xh@52oMfy-N4Z3>@DI)*1vn9=W4A*bnhwP_#wL59`4r3Z-OJ*iv&3SRoLEH zsm*V|a~iSNRXU|`_bz5NJfEU#ZiCZDh3(nyZnhV~GX=566`Uq5+|83W<6)lC^{0W; zIfZqNwfn+b(7u5;CWhmeh3mDfZafacvoqeu2(aGY*n6*A;VEGq1CEmwwz-lr+IsW_ z=!>@;&n?`o|KE<*kNvcP*1S{S!gigQf$cj8N;`AQ@vOr3O~Fa%8=!ql+|zRUs<6#p z+p)bT;Zl6^!||fRns>q#=ywv-&lp?cD8IAad#;O48-$_6Yqgv%E^PO1I^VkqDm(Ln zI8IyG@>BiaLq3d8TQ7l=`pYJ+k4Jnz;a)uB6W`Zz8mF+H|LlF|{%8-uYFjuyP`F#G zQTiXyXKK?&>MC;>6YVns#|vW-zt?h7yEyCmZ|e~pzkVm1W?_2>KIuBg0|>OCJs&UK za+-$NxqF8~8M|*h;P?b-zCe>sJ=neVgYea`>JpB$Pv&NJv_S;wz}CiAY&p(K?5uyg z#olvMH_Zt6bYeKZU$}b@J{(Q$tagFZm4)@JX5XPbOgtaqW%j{o?!s30+n_&!b}O;w z3OF$@WVZLO*R#DALF47}mgB^QHILZ+)1&OW86HjyN6jP7c7H*A+q2hyh{tF-{ZzQ2 zoOW;f81ejs!2~$YQ@DPIQqMDK5ySBSnEEG#vW~`^%~W? zILhm+`;l-k+dagK5w>bMEnL{f)ye2j5;(rin{d3Nu&w=TetwFuIAQOW<0AM*b-h0^ z+xF}+EiuOy$EgcjKRS%_Ok@Wy^Rw%(ter4GVJ@EKpWV7 z)*mgWfyB;=ZN7UB?N7qL32^+au&t}9?w%(sM^K%@ap}T(pJU&PzCgSnfj+2btwdXA z*85aT|01!*!tw+-&Q!R2*FYbt$90;S?PKvtUzso%o`QH4!YM5$##ZJq98LB65}L{~ zP0LAR(zzMRzRTEtnLuoFEF3Q>Z0l|Eyh2!&aC^&frNSC-_P+B~G>x&hh~fB9VS9I^ z^g9vM&sS?X&Q-X3)_#q2!_lWDz)5qBvwhpk_|*E8t;bLY;`9WubN60D<*Md~G=OcL zhjjX&t>^a;SN%U}Tpf%@y872Y39rMW5UYQ{DHiVL$v4o{U%w}Yn z+7RtK*Xg60TW#%1eev3slj^`ZY{xNXXPY|do}u8h4cm*hy54u$S^#xZzjKTl|G%M0 z-vnk%>R!HkCkw}o(C2r3Ao0!w%|XBNWFGz z8hv5)Q|isWS5rDz&nUrJ=V0%BKV+ZEeKj#0-z#kI|J6<(p-n`rJ_4ul3+o!9ci48% zzBN2f%c-ZZ%@aqV?}GL=@fs~BmC;$(H?3FdeqYzOpf-TxmW4ImY)$-A_R+`fISP)N zN7T-+_5C66XE0+yYmMT>c+PD1CP%XUIYIN=2`$GJ3hVd8VO_SrAf}J#cckL9L*Z^M zRPB5p`c=emyt{B9|ImX@y>#YFu4LppNVs4#yn}+q2L&Y^y)5Mfj=Z zxO(9*0;Y{^9art#x8#XN9dp`M^cx}S*?1K~SkXhfD1l604N1w3Y^TJX6}s;a<2BClyMtL zm)ZKnZg|uNw70FF!%=zCS4`g!9svKFpgCvmmgD+`>-YP0`IE*#J{R@VSqVRrPHi$% z%V}_7TdP`uZPh*L!l0Jp`GxJB9(COO2W@F$&Pkj!&YZ&x>|2HH{}RtgSg++YU17WK zO^Ut&n%ZOHmXrE{v#mo9WcwF_%DYU4BBM=KU>Uof{lCFRU>WjzrfyOWwAY0ml;x+jBYR-JFNE6=AfN(-wu*zpdZ? z!9JB?31T>YUAX=}w)+lq9O`*CJdfdr18MDfNp+|;@%l`RvCOtsv=ZAp5#}PS+;W_~ zuzf$?hi#Qtb)-Ky(XRFlf5f&tz+H#z)uw7%{Bn^^18@UK$>!VY$-JhT`Xq>~5 zv6R{F>F#8kjKZ1hzo+GNTH)?J%f;-Y9&J8{)AogJ{dH8*sIGn?_WDeWx6E3v5Au%lv+`F@dsoFtmHN+C3j>MOf9MO{xQ5fTY-@~5ADj49Vy+o>-F~*^G$y)pcmJt6Tb`ga za9XCY^=b9Lz*?TTHsV--2_4*sFdaWZW4d-Wbf%50rRyXSt&(d;Sr?BEex2ovM`N6S&=cWws5I}p(FI~s933~fi(Ro|SG z-H&fhykN_5lfw3_ITzb%=Of9B{vb}2DRYx5J0F zoNg(s_jy_?vA#SDOrI1-?in(NKj4HuDPaVxIR;Me7uFhs?gQ-Fa|iL!Eyr66HKf1~lwTvo4j#5vh!ZZiFN((g~0itQ7KRfljqws8IKtiBgY$B|}F!Z5t|5v#4I zCfpCJ55Vc3!Zw$@i>@*B4)NP9$2SY-cLbq79{$4Fg#Ls-3pdlTV==b5KIHXtam1%* zN3r$0hl%m#?}fx^ezxyzb*+=?omQBhbdM2_XgMmKv&L=Ml>M|{{q8BAioS^J)VsaA zqHi_}6Aoe@9I1oMb`PR`^l5u1wtLG-W6rsL{%uCb_Z|BNDd}8WL9M36i?`C&l|6zoIgq>TCOBB}oG+kpgN7di5 zroGrst=_GH4`7>lAg@0})tTl9^m&~Z36I*Ja$4I{Px-k|YoF;{^yAP} zfBO>Nf>nR}5#Db(?p-*%0$)zpl6|idU)plgah&ZN2=!Cufcy?i9M43fAK88SA?#yZ z+I{+=aQ~JQeJ!)yAAN~VUF#WF&urrOa^avhpNReA5Dy|~E`ZZ=g>4?)fNj+w?GZL_ zIUZbCeZ-zW)z0)0druF?Y!h98PB61#DBVwjO^;%jraPXS+9 z{dH-y9(Wl795*YhdkVehw0&p8kF=c5D4f4FwRQTB*{?CREctv;IKO|i=cn69dkFiM zqdYek4qw95g*{h&1z*{6;+!(uGl%*)bBv9jEnALX5IgIc!`6oe5wC;ZhX6K@6PO*k~X({rqw7j`DM2EX6v!tkMy*a*1*JRSYfUG>0V58 zp4R^C-VKgF6t??|6WC@h%&5YMw7XnCmG}q(ZJ5WJIO;e%wYu8a-hcFEdwO^t0-X964!g0BGFsd2PE21GC(Ucl znlGEp3FD&ONX&Q>r|UT0=&t`p9NE7P;deN+oPH^+_y2b7dLL~Qcs^n{QXiSa(`d{$ zcJKEL@xm>qCkr=})A|;5)~zkTaaXnrKQ@v>dN5taU?s9->Y1dt^OF z#b41mFR@+gz9XKQpm|B{4JVBi=jJ7}ZwPaty-fUd%khQ6&5Q821of@#hvV~TN~^v= zTJ?Lo|9OR&_7*47X14X&Iq<3vson;(968U-dLI&YW&iSoqv73Kj_NPYjph&PO3%Rd z4EK1;QEljK^T$B+PY7G1FV%AFDIE4gqrU7ubARG5TTc5F)-~3ifvK}VzqWeyAOSjZTevM zoCU`>(B5tJZhe3@@2*pDQksv@V0$K1AKMJxnebH0QFEHJ&5MjfyDvN(eTJ6PA%*pB z!Nv_`&fnVE7~GNVwFo*F(%SiJ>-kk}WY?Gj zVA@uk_AT742d>0Eu1|Ik45wua+qLv2(kMU8?Kig^?=Rep3IBoq1z{}s_m*S7!nQv5 z9@|?HXd}BXhtn8^o4w#i*-!g7dlNKf;J8O&`?g|sboGnl&>g`zG|iVE6T?w;?`(ZRV?=#+V)nn&a+;v9J;!qnTGwa}X8*!1NBUdl z@Bvz1ws#?X2%p$;`d4AC{pg-ibD8doZJiNL&lC>iuXl%b9XkZ3j>PG}!gepIcHJF~ zzGz-Jep=Z2)X!|IPrX3=L(5U^*4)ldQ$BN@%JSroc-%;AV|Cji#Mx+0x&kCze znwij5CiTx*T24n4?nC?9IH3>rxd6#-LSDL5$j1G_E z%$T<|R_WP8KkmbIK8}Y++~aA*w4wD&+OSW6X>Yw}?XxI6p>yqt=o7hK`)kjVc<4ix zPwlTg1My7ap4z`4`lPPco;q#qSq49KXUD4jwI|`B-py0{8+7W_^x9LWtv!A4PuYvV z_Kbo@ef0q9u=dxUL3q@+<*EI(XC*w-xTp5dhu+`y+Eb^kJ*(iKwikcxSq;y0?y3E? zXAL~lyQlWoo>B44;GWuFd-~#;(LI$v{e`ZvqdKWQRoam}>)@Zc7eCiYt>0Nbm1m^1 zbK#lw@18z&+Se*Zp;#$D-4ImVcd3oj>zroWB=Oo%TpP z3-sct)7IrV8$V;%j$4;)V)TW2$*0c$a6HU4e=BpHb|O4n&;RDB(x(66VGcDrVvxIx9eCqs1@=S`KIoI;6{Cy@sU#gd5)n%wX8{i+< zi=Xiqmv+56R$Yel2Oj2PD?{b!Q>7ira{>Nkd+{@u#N}MCJR_w&2+#8FsmolQOZpwp z3V+Y1PnCcA4G(j%mAO7votC*)>vwr5{qd~ai>FS@y_nu@TR!!9 z)#p16o>hCvr_TQxJk05TD^H!a_T+n&1DLC;dgyZ%`K<2w)SfzRUFMDObDj8G`S(X( z)Aia@r{($?*Xre1bs1{Udfw)Suz zVb3SZr}hs;U(fTYJ$2fB@vQHjx_;_<+Zzvk!s@p6)M>}VvtciuI_(~KNdLEd>a?|I zH2fR);@=H@6W41`opxM2oA%#Ad#qR%=PwgKQeQVFB_S9)>&*=E67i-_z zKL+|XuGgMAZS7%fX`R>dsr=o%dLZST4v*$fxSLC*=Q;Kun0ri{hv6=*_z(1DNP94z z8DP!%;+$4I3;NRNhrlzrAMVnM|3qH`&!Ko`cE32Mg}dwKVd%5EAMVmhp96hP@;Mxy z4PLb6F0J&r&`BQ#!`vI1U!2p5=SJt)TJ!Bge&!eFv~YLtdL;S)_lt8{@qFn0$>%6| z9+>kNcWI?(&(SdVT=wiEp4Zcg8`qD47l5}TA941Jxwndwq8|${1k*>2vtRnc=*-tz zv+1)4%sqs0_DiSEOg|o844wdwIQzxH^%LO5;fe5wvtJxtKM|&FwN9sRG&;X{Np$Yv z!b$K_@FdRJFMXivC&Np_li?9(zc`^!j($qz5ijF@arT@FFNeM(e(|!NRy+zk75b3M zBc=iD8B;t6o*K_-@bc~#=d|LL(5Jz3I=q7W#W}4wd(MDY#xpH`@rs^Syc#?m`k9qS zyo&q9*>e`WI{NhZ#jAQ+@u=_&=x0|R@fz+I_l0M~a}K}QU!2p5$3)*6&rq1y{NkKeoIRJp9Mi64V)C}M z;;~#G25$#bCVh|D`NiA2emTrIwrjLF`^B`gUEi;$JYwp}{9@|H?h~$rcXYovrxjBl zcE52IytDhoIjwj%blNFg4e#Q9aZW4Fo@?OU@z5vqyVyRvdRp-wu3ro93DbvyIQzwW zqtoZ~?!EJf=`ZFN?+epM!}ai9?ic5@V)}>OKi>fF<9=~YD;^(xmBzj!=|jJfU*DAE zw8jUaFVC@VL_eVQ8+%&g3DB3qa}%Be-7n5*#S@}0j^}3hVE2o2TJc2ai{QBhKE(av zoK}1|`oef_g%5>ycFt*~PmI10`fc!G?ic5@;v>-)z;io1*!|+1R-8R|z(?VkAHVnr zPb)qao)7)b$|FA7{o>={dGOo?ALD*;PAfhUeRe!|!^gQ_oYRU=MxPDOJ@5(c7w5F% z?70^{1~HJylcV=@eM)#;_!0aUyI-8siie`Fhv!lF z68DR9T5`Z}&p4X*`1fquFB#W}6`D)iOyJPBXn zesNAKW-ha}f~Vjs-7n5*#nYg#N;t8i(SU70(j*#n}&c&l-oJ&xU7FJmTyZ z&w)NC`r+{G6=%P6=85h(1#idMKNt`5LHC@({LyjtA3=HkLgyU9k@%VOI?jIS%$Je& zv*#4%kB+ndsLFFR+~8r%=zUuE3{vaIpfktV^N4r>csu;Hek}UJ=;Nb{7lOBU&iZla z)L-|UvPi{QKORp&pMbRD#VXGF3Fr}hB0S>7E6)0f=u4tcj7Ln{cF!zXe*t|UI&*Fi zFI92YPexw`ojJ>%Q|MD2CwOx77x64xarQ{ho>O5e+MYYa%fUO6Ry+zk6+8r9zT)hW zJ_vnkJX{C5XAp7ri&w%k4IZu!-E)U{1y3u^o|oWN(5J;OUb*7c;OWr0hIG#z;_MM; z&sp#q_@~D&UcKT`;Th1m&UDWp;_MOk#WN!wt~uQ^hsOrp=abJy=$wx|r)*ep_FsT!H1v(}TnH0)oc+=_ zMeo6L5xhyo*)M%_^zraq3~yF(_Dk=FzAc`Y;jJp(5+2v}G2m_BOYv-7arR3e6P`E1AD&Mz2dB2 zi-&gWo-g*ScyE|~X3rOURh&K7k#=8n`jb6h>{D^}Uyo;h^fmF^0Pk0E_Dg53wRaP* zzz0;E{n8IYU!Ht!gb%DZ`=w8Sz7(FD;Dam9e(4jUGtb)d#UT}E|IK(NLSF>WE%2c* zZSc2ejl=WekA$=cy5P}s5twjXU`q*(Rk*^FFvZ` zW8wMG??gYQ;_Q)rJo-F%?t+i2IQylah(0@>yWtZm&VK19qtAxt9{8k+vtN4l+zX$I zXDF1&^hUXvfITdHW^hwc|#Pbk*Ud7ojJ$r`37vNbIzxe!$CxgdCe;ED3inB-hl<4c? zc?7LzW6eD7t)HSg4c#0hcB-P)|(UY zAI|nD(wIE69;QcQ-e@?!?i1~IYjEmcbn~9fHswtx z5Yz9CId0>6GXuN?VRZ7L4x53_)Opqe{ioTGKpiCdOtXuBG zb7#tyb$uJ!>`j;$&!Xu6b6$jP`jqtWE3y8V@00p+bmqABhi>1Ns;tbN=|kdkoIfCT zJ2?m6YIFHtKS8cX>ty89=w9{xkV3i!jGXd{*v16IcNGn)|*e@ebA>Q zpO4@Johe(^!+U6Ir>V&29pW*a-!8iDts9L&=FW6J@qW&fE$g}-H%Akg&(a;lhdJL~ z^!$61ra$HRkuq>h;~!x17B|D-YY4C58A_~vCe|2ty}27!KbQ{vPFQ_K%yF|G$W!gs zFt*Zn#PlQMZ;P(`;6`<>ae5hP|8gE$bp2ku*^V#+`7cAflk?I=Z>}TlLu@mqqssWG zv&OIM0ZG4?XlBBr{-yR3|5%*2#e_xr}=+3BOf z$jvO|Gb*vpOFT-^b^X(rXc+71F=G0!vC8hcjgRrzrcWi>OY?!T>elsURak9IAJnz0 z(fNv3D!S&%pf;ETy)Uf1#FQ=Tni~TBwV_|f$Kg+%DO=W?pW)nReuC-OO@I7VUkap%d~PK^!dZE{u7B@FV?)=Z_&f0j&c7AC(b%WWHFw6dVb0I^tfJd* z7)GEkfM;J~)uDJF;t?(D8XLxh7erqhp3r%%qU+y5XgDAHw*?qO5j38t=;00cY|;>? z*We+}uNK|1bmq(WI=bd8F~<$A z+iwB;qc2WATcgtljkkjPx7=(4F9|O}TIu6DZ&`HRH(1+~PwWG$oZ?jUW>a{6^n=hh zh8J+&sOX_DtcqKT^5k(RR-Udm_rX`;8Av|&z#8*n&2O%U{%B_q$S+Mze1P**Mc2P) zp!*d4MlQWa+|T*lqU+hie#fv3o_k^XwSKRhIBwRPX<^!-S(Y+PLrfhT>$tA#S`mI@ zdpSJxBfBn&$0)k417UYO%cCC&@9BI*(e3w78cQoshJ0@zR^N2J*#&-rFo=A1B4%DN z-m&ON?IVWR|n{}Jp7|#uJRr;7%*HrOG#ID;lWOTMyM}L@D zbtE26?0TRLb**S9YhpgI`)=`^MQ=WXRWF=d`~=?Hnd4^N?r;8q&KwY#5A;lIJOS)_ z^9=kwI^!}v1^?vyWYO*Zn)7HF$9g7Kd5tNX&QEN=Z+jbFmvT--ta(PvaU0j0ec;y! z>ygi1gy5`xa0Rohe(^?OM$-bboJaU>ZB(P4Kv`d9XQ#d-arTOYp^eM>wq6JO}earGQ1J^Y7w48m4;{!Kipv-+&-dS9aZrekACx+bKziRoX)ZxvnRvr!xGNZsap3{JJw`%evl?Xs*{hk~nW$_YhOItT&J0AHnt>?8j@rHxxfy^yVU1b+;!v z^`!o7Og&{i{0prgVK4F@PCUBvd&I8mUadKmus8Y4PkgNNd_~uL3-x!+ok?SYF=MRu zaXl==aqne&Upx!IS2~kt)|)HfI|$Tk97cSn^JPWXGrirb?2m{1w4SZGEZ$Re-N%J7 z(0e#mHGb22MYrQ`fQR!;mlKo5nB!_bw)6iG{~_>!_|3mfK=NV+hu zvySU}a|8S&`oVavgP(T3w&>P|r=WAZ^Z_yb&v*o}>!An!g223(m=iTe7;8Mau5ze< z=@~dKPDsv+72WD=3%184pX-U4FN`T$9KB_m%a(?hK*JjbI&<9MdRPix8U1kb!53C? z=D1mJzJwWD&0zBR9A?}be^zv@sn~P$5qR!`FU2EP`!fdYxkdfrX!uC<+u#$NZ!NlA z2h^{QqCBdPq0St)ab5RB8kf3HjLQ+zCdSJaUHz^(rVZ)#cE7e0$IZINkk&zLu3H`^ z7?Wq#?fzv(bjD12fOvXm`mmnYrCZ-$2R;tZ-NXwzQxCdlk=~HD>*x2uH=*rM`K$gP zm@9+MA@SdK@aoRn7F}ySw(f8|X(xft#Uq}$=vv>`bGGK$l*=jRxLMac+q^(Hk+j`^y^yX^k>l!Jkg?9!b-ULaADuCfejpyt`Fmp5 z1M{t|6H%_T8mxIo%yF~c{02{oek#ZM1?HTM|66qXZGAu=LfT)6sY_%0jqAF953{m; z8oPIcCvc`uWnJsm;XL#K9P4J7V;bL7^yYtP9}rH*^9S)8&c7F3^K~E+n zy%S}zwHomwMYre67uh}sov3-e<@gt|>(=k6BRy{<(l-}7Q$AbsSHC2&-kmnoqwc}= zZpxS_>-LPUu{|^P&4|Bn-jvvN)t#PE?0Wqs@#M~`Z`bWv)tUvi+&41OrE+uG>!Yz&_c7BD}bn=Yxyhyazvzel;HI$kqo{cv!{*vaf8=X&qUAJqP`oQv}J(~UM>*Awe*EPol>dWSzA@GdO z0J*e%)9~52ZZ0qDVq5lQHNDz}}*6p1YZEp2b)k!)TkL$L6d=A^IQRa_`HMfa5 zuDzpy?b+^bwiiO5lvra-JPEPuc0IY6?VHh+-)YY3`>yL68@6Qo7Rvc0ys`5aMYnsO z$I%Dj$>UB;edaYTz1Pt!lG;5 z30I&qZ{>G7#!BnD-FvQ!=Pr(=dR@zzJhfJ2Z8JUb;sn|zPD{LmbAMvj^}a~!D7v>z z^aZVv7++a*d+xlS?R)WzLwuj}*u<_k|DbHNx!vzQ0MoX{?9Y1hJvEpNXOwQC> z)`RAQ&j_ST{fOUlRvWpl>%YF)wENgu;33YmN!ION;{f!&0A}w_gXC+?InX;+>N^ky!|7zlg@Q_zH z-I?>ty2Trz52wtz{>5r@*Y(^MUSa!T^ts`eod*=%>V6yaNANHg*jl0ZM%Z<|e+}2O zO~2{xtHl!)UGs>&1A7$x26#ArG3l~y_ZR9DTao`y#A7)BNbI_ON3bK?kCApB;=#_8 z-|o@T?Y%Vp>;KLtX=2hKOSgWsHB9?-=OR|w{%m!74@uu@XwRr~rQVH|&UM|7goD}c zA??C2WjEF_T-W%~_p^HE*1aI`&sg#oot+l*MwaU%dr1<0&S26693`66tU~lY`%Mr zw7;SMn;`zR=(eu5J^J(L8aLZH4cvgf@aUN9kFdS`K!b^BG-llPWu;|TD{Fkx) zGUd4hzQXz9qTAY=JdClp5;5&<%yBg@i#7K24R!M>9>%l1*AR2utlPVzRq^bEJ{R$7 z&T|sGZtuOPXZtnEoXaU@KC)+USl>(Od01;z=?P-$!1(c^Ywipj-<~B0z$zo-t$W`A z>;A>o_IuE)ex4RAy7i-flJ<2x8gzd;2V&RNcWs`0gY$Y4{+@ke%9eFK1KaxTo9HLO zN8k~kSoCHTSm&@fdV=Xk#vC{6_N<^j{1)X|8hupffyAyi@1VcUHX-8Edn9AxtlPgU zc@R3@$obmykC;BJ_mk2!M}&`w-$j26{>1swqTAZoBzZ4&c9nGA*E&C6bloF_+1Xwk&o=O)&RZ8<@4K`XpnLtum=C`>_ba-t z=V3n5zK>@kcz$Qfmi1;J+RlW-@GMEZgYyza*Vwl2Md$~S`67JFKJl|f4_~7VB{1iv zFNsfb{(^XD%eE%>BWXyRd|oovab34DbQ{|r;K_9&=D50dv-OBu$m4dH{vN5zZXM&s zqU+kCuX1Vc=$MmSl5s+ z8vHSy9(Ww*EsAdQ#8K$G;9<<<=laBW(^{Z(y=&2WrJm;_{lnhHi+hT$@n&n{pQ3Ay zpl$UXLu3xfx{ZS&=$~<{oWB^q){5+2N^{zggwIL40`UpX%NIQ`e}#3~rVSJQBCO-Q zebIGaX!oPEdAu9G3Xk}%qKB2>9(3v@4T1+dbKI<3AAAb^GScoy{Dd>dwQDK5o`0He zNHaQ~)#0CIcTEC)e#c?0mL4PFjOJj&~-{;JW&mev_o*Mf$X@ zrHj>PT(@uHp2x#@h^K|FcU!{_itgw@FBQ{pR}KPkHUN;r`1DM?FzwRI)&M@83qv)&DB zOh&wc{EQDMy81-e4V^ZKpTRpjD}UD;%`*eg|BYvTcy8zQif-Qrsm@jAs+@_k>G@51 zP(PiO@H3vl#4|aoo?N#zsTJ6!9U|%S`=jprKy-U|M;&XOEBTybtoCtT&v{`L0&SkA zBUV|((-z&Xdy|rec|FnI`aZz;8)DaO?R+5Hzfhj(iI;IE&t_oD;Y4D}W$Ov*gC{$y zFSxEYwr8bZ$wz&Kax`L&oAss#R{p=CZw@c*yjjsTA6q^Cj^_ke#}ISetlM+>f6>q5 zytY6e&6zyyJr271xAoyaNc%Os1e!SaZ8*$9&|EzZ`OF4C=1f~U~A?7is4sKGj*{)pfhZzDXLSxE=p{ z!FgNQb@j`@xNQ34Vf^Ix=}~i@>vm6fC!QN9!)e6#I1eFq-PSc%XPa|P+mm)(XO3&{ zU(juxbyW2KQ*VjmHm+;!KG2V~b{*||9V_;uA%3}-XwTd28PU=fU$>$t94|J{^r>Lp#naW-?l8g@NQ4PTEwHXe;je8y80-S$6DjUHiq> zw$BhVh7&>evBu;X83#7D55)T+%rVpc=%YC+PuBx=pzD+FSJKAB-#c$qbhVQ`$Eq!8 zYkS`;*10@|4{ip-I}q3(HMVzj*4*K`)xFA2+r&+X7j)*hwjQB2JA%CCBIcNhGU?vH zm^`x{W|UT4T_CfUYs|R^p?bId0bVK2Yx?wFaNpw~aY=)`QObIRgDI%|ZN{ z^Xx@$7+dOJx_-p1DZ{tUTNT}|Gk39XA@ZS2TIV*V+_tWauIDaWE7^&B=7d)zh&gW7 zb*&5g6Q)8xmRNNtKBnmQeZ*3v8OE`WBi_>)e}1QCzv)?!G>o%!54!q*_-@#Bn@iqB zpN9P3B!1iZ4Pw`IzZ=dW^e6mDIJ@Qi?m&7o9bqx_X~{?1i#wBV)~(+?jE*z;o{g}-AT=VoL5gO+Vg`bPK$@)<&Wr!!^KyD8~*ZTyM!^!NNu z*_h+%8whbT8({^QeB&(eAZLvi*Y#W*RwSS$)$z*Cs(aV%`DS&t$s^89TFnV!^*z^h zpKAS{aURvS)R(RYQEfX{%hr!}ABW4MQJZsx|sf$b-mLH z!_hf@q&~X!2kIs3T2l!xwK59Z%gvgaV~X!k=S*;b5=jq{dhc+n0{n@M$zrLmT{@?fzm;w?eBab z?7H0_eThz;M$S*qY{nc{-?Ca=t8FJD%{b(<987-3%NE_{(GA#E9Ue@)xiiPLZ#&S{ zU+nplI*ZH0N3u^$o>{m0cm$m~&TBQs@1VJEYwi29Jue=O1M1Y6KB9M1V$HQ$r&hZq zj-xr<_=uuw9<^sn#$0*@R-Y5AoiA)TsNZhIb`Lt^IBep~akH*_?Qjv{Lp-YzE3J5y zqU*b@uqSCb@A}MY_9cQ_9%dN>*X1#EM!=|q_H#wQfr?o%dbdlx)!5s&Nq zCb8>!53lx;-PRuhS-xxkT$p#_CtD+dbNS z=$ZqrB7V^MN@CaT8G`oF^KD*RGo}xy-Nd#|a0>AhlzAoMi=8>H-cv{q*K*uVh^gyz zHN2@a$IZIdA|LY5x?K>Hch*&|hBgQT(MP~4gZN*t>-xUj z`s>o1*JkiC1hLAsSj*uo{13MK(i!k0&ZigMj(HIJvZVchSmR4Pg4p$NEB<}hX6$zN zPU4%2uK7dXo9Nrb#5w6Z7vs;0u4j(0J%KqUenGsYv+BTgJ#%P%Nb5dPeYubG8b#Om z)AuyG#-t12t(?y|UvyU8yRPwV?~hl;Ls@KnK)g-S^$x-MFmp+~8h(f%rjKPk z{D^-7wpXPL-^1fOe^+$fzvwwc>wSql?4C(X*|Ki$&DLYPANnxj4V*6{-Cr%+x~%e9 zoihADJhd~&)jgVY-CyYbPv1qx+lkfJ#kUn*_vv9nygeLiU3fNUwUO)AUz8Vh94{xn z%bBtT*R=+tXM?a79v@T2%#T@DdpAoH`f{xP#Pc{)-mGg~Q)Se>e%b{lHr~1DnlGEp z3FG3qj^mB)OdDlg?`oPz8qOpA0te^+7G2+E=o)43Za7z6myD_JtcR!3rXWyH=}F>+ zou4Rrvpf7SX{f)rEBt^n<)v;4 z&rEqVKGgPN%CGfrvEI>!ZwPad&kMv~J3n9a=0*5h0_PgDE`F})c0Z*$-IDzA=X;*| zotpZltwnPD$hqmhL;WVIFU`@i-o1ofNzeQfkAQb~9$fUM4@|x3{Z3T7J?^Y_bKT~W zf#{#$=|Nx0c?;O}upip51o~lOUetRM9VhX3t6R?+P~^gXsW!Se?3yUwo@yRP|O zb))B*?s_ENpERSjx}Fd1{qd)0JHSt&i?=7Jeqqh8dIr9O;CeGA{0I6Mc>2M=JC9y;Tc3N6?X5W0 z80>%58Nc33+r8#q@S`y8ANPPYe#Gk6uG@DOv!icAK1ZVua6SrlU2}?_w{-pM#*3Ia zE9-%NtNS$T!+XMgojGpS?fHg&uWMxY>@ViH8V}O#{eb!$eIY$U9uqo047+aHv*?SE zc6?&>AMtp^u7@e{Gk(yo)HlD2L%?Py93G|)(F3Y<{B|#ku5S>u#-??RcmTYxGkqoN;R7`4 zHta$^|AJ3+{%6s(_M`hp&1LBs_y*^viykzNrbgcl&w=n%&Kx)Ec3-J>rN6{a+x^C$ zz^+@L`k8IoIjZh|aOSwdb$f23yn%iZ2NP2+V~tJM?VFJ+*rv~>&nUyy&Ky_oF725> SeR3w4W2Ylv^-1yItp7i_&lKhW literal 247148 zcmYh^bwE_xx4>~wQAq_wqzpg>L==M*&K~R@yIZf_BIZ?0><(-NyRe&C+rY%aZtTR) zYrM18K8xRb|ICN=+YB=&N3MRKl~t*cmUS~KNzW%4nyaT~S*=}@UJXZ)XMeVn-q){_ z6ViXl;*0i?`^<2bB`0g-mcKRWyJ9Z6_OJ4?)YXgRnB?Ws-_M&I;nYF~PFPM3Z|N?B zUJoQ!U9wh|Z+e(qdeDvpr*>}e=N7Y!%J)h;B%CQK$L zJa{9+U#jPy_MxGS+&q@%3!_qH)eTR{t9|ClnB#NETWp6)@gR!4x9N2mdv`54t$Vnv zzG4FTr`t>embI?to!!?`E!pMvi?YV zosg?WUD;qKy-u*p%#sb0N8%bNbSz9ZY6xVnk6&b?oswL-wna8Nn@ujiK1w!Pl1dKG zE+iYdtLKc(^+`6Yw~gj?PmPof${ka_dPz1YyH)weUfH13TXMaS{<48LZBM8dUr#o0 zX|3kz^JRm)R^<8~vt|A7FO>UFm-Sy~Dj&_1^&iBO8{|%v^{*~ej_M`rpQCLH4LUWH z_0vnKdA}4{|AaHS`TSY3UesQ4yUnh$&ZukTE}N&zS~D7wd(6^gjiJBDeHu=Y)uL%% zL%$~*rO2k^1P0XkA!BB}r!@oO&&aA}yvY4~{39dMu8{k>_{y;MYE92U^<@=@Ml|pG zZ-}gTS-qDotH;WUqg`p9 zhs+6<#Vp-?e$ms+!Zel0Qla#xyf?&K)q-8PZe zmzW{qCY2$txq4Czb$?D?F?z2Ud<~ChGb9ylD+V1bPF}EKzZiIY33+~&y%;#IhjJ+& zG0p&&_-*`Y%)Sxu&zC-$oyr&w(SN?>xK?m|;$n)}l`b_1b2CuPk~O zSV8mIyR$^k&3Js8VfN&2qDROYscHGB4C(dEkk zHD8q`y8QD)d3SHo`SuLuv!g_3b7$ozFGZ)*2gq}BC5ukgE-Cvi7aiprSIy0L{ZC(vOmeoVTol{sU75b{)a77!%LGV|4OioOus-L z7Jtpsyx|ja`;3nkpZtBv)&6UqCZ8812UuAhos$qvcDVCCW??m2V|h@lnO4Pz)>zh7 zYOF0f&cWw3R<20W)CR$rppN@IUjQ4G{O{eIXv`mRk)wUO) zW6YB9&kAjq-w9ej>{ecFU*1@9?=|bRgS(58I|S_4js~iq)p)4427Lz8y!wPB?RXq* zPfJ*vS6X_lAevXcC$#j_bnaWq{j9E?E`N&VzVl0IXB%XaizHsq&VOk@&Ud7PcJX_A zblQ9GRa#~M9Y1N8j-_bV+u;4koVGjQxOS^O9S>DRm`u5)mHv|4V^p4UBujt(drt-ah5hmOfxqLlVJTqAes z+C+Q(fsXB%RqgU=uWx*zc}8b@?bYkA?tIEJ>T zCMxaK9yqn2dGoRBwcAc~Ez*`fYotLxI)Al{pn<1AVC=$H`?+m3+Tv2>1zw_6*4 z>rvVc;^))(XsmtgTa+9syJc{Z>(gZ7Il@Wwt^Qnf0rDJy=%lE;gcPke!- zy=r|>oBgmfc_7V$esqLotJaarEy)MVm)#}@mpcn9rmEKvyi>x;wtHw^-qRLV<#tl; zbO=@rx~@Fp9jr=vNe=0K8&E(LKZ?I?U zBjr`U;NVQUUzkFV-hs5S_}Rm33Z1qQjt|+cY%>&2x3VHvDc2G*yxNf~TX%uWsb$C& z$8Cb^xy~uK^M~v0J}QTmg6sRjl$}??4JWmILS8R|8~+rddB{mexN$^nlaQ5p;HC?m zcczeGqv2)`JGG`^Jls5_-g`)?&v46e7tJgD`UbZ;E>+GP3%62dDQ}tqx2+PD*O!6Y zd6Siwr^9VGI>t;DW-W!=73i98sxbOG+%~^gYkF>j+i?|?n>K;l%N8m}e}~)huX4ae zxc!XIM^lBO_HZX}h??6zfIG$2cB^1D2JTdtLG$vzi^84I_2l5RCUCE`+DGMjoq+o{ zy3xGs-+u70c13dF*oKfbfa@Yt&vxzuO@k7v=f$mE;y2OdKL z%}eh80*`mwl8f*4g~#1*lD(HtgGV>%USsm??+=e0)bn`u@`Xos^!dT$*)|p)2JjE!GD$fa!mdXukT$CP=(M*K@J#W+F`bQkmw9$G(IKgDm9v zyUs&Gb$VZ7&Y+6$@9h;dpLy65M%|=iQcRzd2qPxsqWRPh!yx_^?O!qVts}%=o2ljx zA3*%sQpy+NA^yNy<^7!@KAAqZh^Z?oK>V}|YMw9z;s?^U5>vbHf%q2ceNC-55#nR$ zbFY|Mc_765)4ftm^~n$MZqwEGy54|z2fDtAsm=o+K7VeSPiems;x4OgH7R*H#1)}? zikR?XEDX(DNo&T3?1s2Jbe|IACeDJm6uNeaG3Nn>?V#gOj69eNhL@ycNyOir0VBS4 zpzn3X?VX*onHk!7Q?3w>U#?oih-{! zLupOH8;jw`#3E$pe~Q7cTk0C!kGy-2S>PD`f8N_!&=kk3G_6 zkT<#Dm98>h+4JNAfBa?soA?=6GZnbMRoXgER8FfUZB5^mm;aKsaaWZ`o|m?pT$NiM zmbQ2HDOWlx?Hmm|{U_}-XPP^`Y%J{toKQZNA?;ROR9-ej+FcA%9#UP}{l?D~n#rkd zth6tyewI_MG-)3^OwGj^XP%+jGZ?k~;cP&rOIdZ_JY-|~`lls#!~H=v7j>WJr{X0ja>D4jl+Bj_Jx zOa5fCl~Zo%(t_TL_#IS3y3C;U;%B5LT{e5-8u6`mxOCZp*G5fzZZ%%ItjI_H(66&} z8H~rjCbFmcNS6wDoNMCs_JY#+#x(Ma`$MJkKd;Hpyq3v=4`_dh$GtDgf`ayoczCXj zEHDkP+nTr^(L*|&!_N|$xKXTwbU4(Ie7?(YX}gs6uSk3QM%twArTLDHAEmW6guH6h zQTX9nUAI}xZa5v@ZNX#MEXLW+hG%E+xHXIJf%b6!^L28gT`_QTFTOUjFpVw;SLcr+ zS8Y`bG7IDOF^hg@YEplk5sc`u^9@}P7sZJtXPAp2UP;LcW?x(I5<%;Zu%aa3W z9_X|SE?@E@mnl95uGDQr_G|JBu6&|%R+QXb5HioIYjyED>)>j}PFmw#VijEbMfW)2 zX?hAbn$4xT`|$^G^YlA%(cSsrcHK704jQ_&tSsi;9Pjzpfb(9IyHnREAconi(;LY!qcn4F|Zl9kDxjg>+tDlh(jdU+H=ppHma(W*(RBg}aik?3*M#tND7Dln`R2Bp(tEj@-x~f%7K_3Ag(hyh^_In67gtUcviNFi z<+I_kM4KhbcT35VMdOr@+?FM8lvC~#Abl1zCf|DcO!_t$s$BMw^t19;_IxY-9Pt>? z#4Y>X($D=r^3DIkq+e;gmuceWs}a(#(g@{S@zPHeQ9fN+`qf{qyifn$)(*-k+0w5& z-aGW~o%cfe4Wet5xH&FG`i;4)=KV`Zzo}1@+jfwC3m=lN2Yi>M-WMca&D}?qse;Ft zCN4ieBK^C^kS|_;DFeo77_Qva_8#N{6zDgGPs92_m9mjBZJ@J`K1ZCQBjuf{F9tEJ5`py+lqX|BUn~2t_cT+ zrOFDkTF`vox)5366Y_)7B6`zgCDEyHuuLzS#C-LS~GQYC0Ta(9`cy&snY+6 zdcWN#SC*x|O`v(b>?YFZ-b-@D7K3E*6K1kUxi8Y|Mi@EIlWNkVS~0Zt{BnXUTA7Z2 z?Q-+2vd9fQuQlyVrDL*4Yr58H$7(&5u76+9{BWqNbUpEvyrADfmQ%&3YwTo^# zceHh%`bgK4?PGp6m zdHm5QvgpD{@|dJ5`tNL`$?=y~N{@2tXAOC}SbAE~Jxd#OE|2uQ?oMk44f#)cZTUtX zoHTN0u%oiXzthQy7pBUR-o44Q z+;_^7oA7g^rY&&UE`3Ub)!s{2+ZQ(tgwy4s0cTLh0Pp7Vdl`eWE;R{leEPrBBRJ@*@2;_?VKF!}Xt44X??X zwy0Va=~KNLT8t|=ONJe}O->m2ScVs)*CWPn4VK{xs?vM{9Fq~A^xDM4tsi8>PIYWg z8sI1+o2%n(vQ1AJl{=8uPwwARMjZ@M-WVvW#@Q(E43*K9X+Mg|Q_joi&)d{IP?Isc z@iVO^CM|j(wE=aN2lkNKBK318)!HhxqxNd9pF7$k+MZ(KyVX+U52g7;XfH+33FTRT zq%f;veq!4hQViLz=A|8_SX6*KA$z(M`&TLNb(Z2L-q$oSVZ;V0zN>R#Le<97B+c6nJSl6{YeQ~Q z?vSkYS8e~=jW5XBOTW-O`ku9{Q*02q;>DJ-&Q$f8p^X1&S?BICntQx#DeJna>%3#- z=CW>t+P{CTG~MfPjrKUHqrQgTmv*|chpdySj^VABddfQe;%Uv?{p5B0 zjw(;{D(%-dr~UIHK*n}aKWlK=(K5CXz2>x0Wv0qlLD%iHaWeyDY-lrjo`lsiWNgL5 za8?qnMoSzf)i+ZA`pNJsVFZya}&5wGb!n076!y^J`!nbu#K z{YXY^wkBW9$SotL(ltEo{JWYmqPN<%XTENd5%uUEotFOix{N4C=VsdR{RL!1fpPS` zi;tF(VXbMur*#|XBdg51P4m(Xr^`yI6VXRsm0cl2(#nz7Ogk&f@4rUwKBS~9w_+?g zs{eIab^ty9(Hi-8%YYzyo}&rH&dAc&XVRL3Q-t*ETLYbDb1zet%+5=Wy03qRX?uY@ z;asxx8t|38!}@@92ld(>%W{*?#qMZT=~|fXH5UI4^JF1++WwZ>TUSZv)@Nx= zpAExgf$Qzbi5n(Jr`fs5%P;ScjuYtEu;ui8 zl^QDTCEY_U&mFv^z2zU8KflpI+8@Q=foPT&BlJI`9ie-l<;9cR(*7_V50;nqJ9ICi zHE)9KquQ2CMShq&5BSNCWHot>Mq2ZTj2{x$bmta86vJ|f~X7H%Fi+_g(#RuBL z{j+#%o1s+hS8%r+zDF~Z&D9KUoft?C=~EqU%)!@bhVYmpaBUu*<7UuCTOji^UgynF zt5i+6QVF-Y85)JRf=iir?=VBly&vJ?Mm)yM&}pR`T-c@D>%9dsKHxpq3`4ekf{gB~ zluy=&jBdDJ%rMmE8f2*7&%@9jZ6Koq9=G~DYcXWB9zc%ktFLeRPWf*&$Y_Yij2VW_ z3x$l@c&#%-yw^L(h*jGsesKU~MB}|fpMT#58IkyT#tg$Fq97v-Ka=P-FMy0tybqdT zMA2f9;g8oG-PaaEhEpE$$SJMi{Bt~J%rL6#IXJ%$_pfeQ9nO!oC6BJ@2j|1_7%;== z1IOXq8$6cGFve{{Rpe7wIxrB2!f+%dzd=Khe_$ez5u`g54%xs1H6%0?K!4X;aP z*!?~U5`2D>55*mTabrf4;iN5$J2H)&et#+?JS;&ze=Gtfyuj<58LkX;hsjqzk#D>R zfNAT?lkWxgg4u1qkspQLgau#gke@pahh=eP$gj88fwedB^Q!)L13t`!}@8|?-p zFKkTnH;Xqxa#khfZ}T9fL^bl;4kaL^iHGu;hmbO?IXOF`9i+@ysJx{#q%6Suf*Ia< zABU8g>b<|4eF{?Im#X>Sqx$m{BERoj9#Xv4E6;rdDK?49`|3mTn+?jhnnUuH0?I!> zL-JnyY;1-Pp6-ymB)4+JK}a6HNx8*wNN#yud2k>kS5ZIr!}JG`?4pjz56RbH?OXiw zvi>{=|G?T)YQKEAP#e~+Qv3R|`3|hutIq4MuO>lK3H)qeh9Apn!-9uu{;R7W%=w~@ znZL0`U}mQXnV?hqh`Rk!L;9{ zZH4ME=0F=-WA}a%jH>dB>~QrNjHre87qfJ_cnXHA|86S_W|e{XLGx)|$Tly;Po?Xj zbgk7DhBu`1RJtt}Fal_wN{@WYVbuK;TJJS=82r2GHo17oOOQ~It`D;0rHwGbw<*p2 z7XE=rGw9rxWd>b?#Cmib$})$WLgI|lw8lSg8YCWZQ*Jr{67SSgUY!n!ukc=Gmj2o9 zkoba*4H*!50urykrg^|*A4uFgSNY;BNSvr%e_)YrkXU^<%>!HigehO>9G8JfJ7CIU zM>W5C7p4T7$z@9ygvkm0$U%8$!o=<4$>myahlIBQXaL zp>IYkx$@(7&~0p8a_Gr)Xtz;q!|?u(pt-RPBaY<)bM$0d6S;OA)L*Qpk+>R+8)b@VN$W?n#!cKHJ_-KKTA2v8+0ljbpQsZilFoeMH1I23~1 zzpJ_Le^4euZMW#}TfwJeQT04q-huamn#$1wpy(6zzN&7$28COv(mbm38L+P!Lk_zz z-SR~J-3(c=#|O*e?5{L0yEZc|>nEMp()V-Tn2Vw#%{?!5(bms=OfIz5A{^GK*J=Oz zqlnE=+tw!hsu(<}HLiibDMQ7KdIQMc$9xw{o;s21CvDb$51FCdGz{LI7)-9--3dPa zs7;QZ`5L}1=}ZpGYym&#J|tI)`~-il;qj?KdHwgd)|)$!%T2MBx&Kxn2kE~j$=eyX zvj#yc@5=mVW|4z!N=f_j;p7TCyrtu`jpWK}JIDf=@5vEQ{*^Ad@j9tN)V|UB?|bnW z)L57E&BqtqqlM(Hb$t#_o$jB%>7c^Kqe}#;^g8NH@4IyJ>R7v~{qrsND z=`yOcdcUcY56Q>}aWvmsVu6gTkH?h;2bU%3pZW1VtHIHiHZnZYQ~BL){pa2xr{xNi z;URdf)*!8zvkdpIrEJP4!@ckv(dRu6$nXNe%JYuNaBDn&_4$!=GVJ3U%4B?)-vqU5alYDWY}3ehV^;XF*58FeooNfc%^wVw4B=S>8r}f${q64 z{LJWqvSQ~t1eP)IW zT@$6>s9frMon}g(;`DnAI9K?MEPfr2TMbSRxhuUl6eORTc29c!RqyL$-W}32L~VZ= zu}~I`KS67b#GR6^4r*WTcN{03%kHQ7&L)4PV}ZToElWnr{GWD{*H;LYHZFLb(O^yA zp3-`QdYvm)HGtoD%IR}6Ec5h(pE2rl#nOtt@clhLrx_OKZ3>@%H6za-SO7lETSuNf z)*rI>jU-R6HWJ?S-b9{!{xZDUWlbJmHb1-9;SO4Y&dur)?USJXolot>tTIEN4g%u;&bs}xq{nAe~%Al!ilwb9O`T4 z?SV7>=)MU_&r{)opZZzLvh>eS`_*-6<@io;!}S5JU$yNf+&n&sy!K@}-0OkY7Bg%( zKMJ1o!u@52ZEtGA+e&n;hCL64!nd+}Xnv$>3u$%lhi?5i)PFaaw=~`>H8?w?yR`TD zhkR*k1zBK~m2@5uS&56$06@5|rFUp`%w#Y(8-8>lw}SHs2;aBj|jQd0Xqh&kUpEU*_#1q-TW;wPv9H z_s`4pQBKg0bI&cx3nxoYCp_LXnRoLH{r933l`V6n$49!3$-J38rN@&)YX0P@^tg%p zRA2w`hV;0&MEO@C>2aou^55RlE%YmdjjCLM}*mad)plO1b} zl!anw`%9;i$+DpSODtUDv@1?JZ4OZWI$b){I;;FX(x%ux zvcv0DGS@XcJ~e5-%uQOYucB#(%#(G7m8zvChEezk>9-|_lymbst#!Rzw4 zug%h`?+nNa#cQ4Zd2)0FTwmXk{IPf&IA5eF`E^hr9P`Heiy59ebcBP={K*dkHp8yQ z$H;fz9)xY%UXbq`s}5VOOyrx3hQdaBymy%4npH5Qti|nbhRX%&!J72E4wxtXT+aV)1&e zZ>ydgVcnnbmRH+^xXny_y44Mo&}BJTt&JbN*n8JI6o%Y6j=P8z|ui2;GW64~-;NyWN zH21Bw8a{ZbZB=TxgzSfpXUiZwh)Pc#6 zJ-3^3hVJ-qpyG# zKsXd&tNia7IJlke7qYB#5FBV*mF9tc7QwzY+2nxbHn97q+P40w!y)xA-J4{Yec7<> zKeeXx(XO!h+kIMJ>hd+%Slrm2xoW_=<*#Y(*KP+SFIVT6?>iS*TW1u_eNXj;HR|tW z>Hi(3C#*=jO!E>`&cf0v_*p{V@5}qZ;!w4}yru@gf|K~!#w{N;skV%R;e}{=S4+ zEO%ciwy&gPKy0va5L+(N=LE59$~Cdc)rr10?eGh+e%c%IxxpCyqT;A9T%(nmB6_v zProH%bt=6EQ@+}z#G2v5h)M%lZzA|D^dpZAiG&7iRAP2naAXI zYn@p86Yoc6Q_*!x#hM>@Uo)HByY>^SGknP&&PBwkxZlcKr;8O|>Dq4ctR%(qMs)2m zd3CfBOG=KVHN}^<5Hsk%)0s_vqy5A%(+QdfEdTwgj(b1B2bxVW6Re@%imS>6PQ!rO>h(lx z6=Be4b(~b~cnOA<%S&sbhPH>e_i7$Fc0R;wbpDzmCI-TAcXe!pPrM7m$IzesO<@x| z!|*<8JBLov|1Ra@&h$K0rk#gjj}MY7>%SY1>pPuXXCk7$TgiDRO$z` ztCvPDHS!bGx-gVn?817ewBiG~XvxA*{19E|P0oX(z`++kznM*T$Gj{bcB=CtPr-eb zbNim+T>L!ZVp-q3ANg&wAWOnb`Ya(HygXuwOe;e3E29smJ@=nPKIvE?Ei{g4e%vwD$d9$Tt)4Wr{njBWd$Hm?tzkD|-(@7k{YYiUi* zKH=JxvGivL5sgtn&pix%2yya>~u3)lEp87abd(>boWKNuz=66t)=>^r{|k-oWcP0WuumqnyH z4rA^{=Mjf%aES!>3zC`0f5Qcir?_gsI<+ zNB>M*W3V!7cdD%Yp?m}aN{v&)d5bUdU@E?-2HZ?y{7q@Ddc zTLjIzj<)1`kw*labR_$CX(-D0(m80UVRc>jU0y`#+>% zZ6``Lu%6rP6%s=I)}viizayw&jFVCS7AKsh;k_am@mn@7mo`IQY8uB!9a4M%$wShD2?o; z|G8mGJKERa*M5>VAe+uFDEqCr*35k;t*KOOmKGKMoE(vPPb*bFo-B&|)?Av=_JkVG z|I>1r>3oOQpKr#jy`_F`Ki_gOzSC>d`mxPFMdzDF`xg?!?T?OYN7q=G6KG1yJ&Qgk zz~UjEX#u5%)B2Tp9MVGW(C1-DzAz`P*b=&K!^RU{M;}fsPHVPa4?0?0{oQQX@ijcU zr%f`=cex&jsa*WEa<|PfbIXn+@2pinCM!CQy#443t(4CJ^5#>^w0}yzBCqRSOG~;y z#}BMrv{wIjOtj5mQQJ-0Pb>ADGxoF>?uT2@`h?YKB4WWea&OZj(Qalta>HIWBB6=e zw&nMq7YpCgaRNaJbH(BhYI_D0Ss;?`<)ihbMl==6wxy9vZmlO)bd4Z;@BB}!{I!(q zKI5@iJ%Wx0aMcpTnj3p)UhsTVk?cnI2ym!!U8ICJp?SW4=ZbaV3(2`Qei!TAXrEgC z8{i|>U%h~H%W1!PVzaM0?-n|C72EvPF<-rDl-QvkH+WtjeezuFYCaiV6|(b*J!9w^ z7;~+PkJ#6aj%Tf5`hBtg{V!ajCDrs32i3pX(awGuAPz;}r}?izW^w4tBeW=T_lY>% ztsz=^@7^!I#nL$M5fmfF}{zrCv(L~I>K8Wo4VU6hX^c}f)!KNZ8 ziLT+&|KNTt)0OtGtk~6CbAM0gtc*&yoR*%@gVtA@Uc#~_*hH@LxwYkIkeWBFcn&H zku5H}LF5R!kH}UvCPLJL09xN#dP3AYI^JYk%?6?-H>Y{KL;WC9U2kQF;C~^!@g16X zT+{`sjHchY$xgOeP`S@Kns=^K2||Xeeblw=JSdl^Db2elMnjqYbnMBVp#z{~(djhr z-B5n~cv0uzZ{Jp60`|<1Ozx&n1s|?reEhQ*En}d-q%JwrNE3QLTe5mygl!K;)=P zp_cUIvHUaLJ{9ZdoTw%lJt0(C=|+$G%P=_g~``vu3P%@BeI%(3ZHWZQg$4H(}pT(3)l* zlSRY%8RWV%Tt(tNb)1_fXNrxp;%FW*|GhXd>O8qp)g|Kg@har?7Ce;(! zH|vpuQewo1p=uwMUAaYkf*Ujs9Py9%awtDJAi^ZRwLd{F^VnH@-!zO|dejE-W9e*i zseCuZ&)`vH-x z`remWmWeHTDQ_)jnLV|$a?8h-rRv|Jnx?(oVoC9(Yp-cq{|c6ERkzZbskc2Wds_r5 zS1e>XQit}PDe+snC9N%8i%f|vmRL^E-_tXjrgZhToQKx5esah&%Z+6n$rEo(wLE@X zfIOk+63hFabe%LM{Mcyuldl}j$E~UdHbDc(|K9ZnyQGig(O*KqDO+uaQM;~z^Z8Jk zkBX@ZF4tC&M_ii(uCrH>hj*R=Zt?294|{G6Mdv-Ed0g*ZQ1lrc8>S&2T0_xz^_+vp z?gh8HUuexBj|t%VPY`)P`UG&fpng{W#5gFBSf1wny1RmX5*DzELKAUqNO78b?hh9?2dMA$yc{X+82^sX%d?=k z-=K^7-uXjBmRDu6cZ7#{d|DkR#q6YbR>z;_#q)WI7Yl62C4!!bSF4iAB}d*AZ@RQs z{s`jD+u3B_m}(-sKYeyJm8#?<-tVS!&{SsqCGly-P+Ai>AWVEc)sI}R^E>gg(iC!q zW*fxsRcpwVyd6ze{pcQQsxs%I$@&(Zcc!pO%T2k|f8Q~MUoK|KeZ)fRBkJTe<;kUv z)yUn=O?h^ypIbG+%VZNwpLtBt>n53O;?(Qce23V2X9=Z?f@u zNAqeUqD*-<&L>yDu)vhZTAeR79XFYBmrJC1t&k0-T;=1)wX39=tn(K|=k#he+8@s8 z)u6dogXUfhntL^9?$w~VSA*tW4Vrs3XztaZxmSbcUJaUiHE8bDpt)Cr=3Wh&do^h8 z)u6dogXUfhntL^9?$w~VSA*tW4Vrs3XztaZxmSbcUJaUiHM(>HDse#LpFLfXztaJjb07e=+&UPS3@>>HE8bD zkd0mq+33}vxmQCrdNpLDSA*tW4Vrs3XztaZxmSbcUJY9HY9485?$wa7SCcoA=G?2n zIrnPN+^a!zuLjM%8Z`H6(A=v*bFT)?y&5$4YS7%PL36JL&Al2l_iA+K^lH%Dt3j_Q zp?WoF?$w~VSA*tW4Vrs3XztaZxmSbcUJaUiHE8bDpt)Cr=3Wh&do^h8)u6dogXUfh zntL_6b9yys?$w~VSA*tW4Vrs3XztaZxmSbcUXAXYUXAXYUXAXYUJaUiHE8bDpt)Cr z=3b5NoL&u@do^h8)u6dogXUfhntL^9?$zkd>D8dQSA*tW4Vrs3XztaZxmSbcUJaUi zHE8bDpt)Cr=3Wh&do^h8)u6doqdTWpgXUfhntL^9?$w~VSA*tW4Vrs3WTRI@HhMK^ z?$wZuUJaUiHDse#gXUfhntL^5qgR9GUJcpk)sT%|4Vrs3XztaZxmSbcUJaUiHDse# zLpFLfWTRI@HhMK^?$w~VSA*tW4cX|`kd0mq+33}vxmQCrdNpLDS3@>>HDse#LpFLf zXztaJjb07e=+%&oUJcpk)sT%|4cX|`kd0mq+33}fjb07e=+%&oUJcpk)sT%|4Vrs3 zXztaZxmSbcUJaUiHE8bDpt)Cr=3Wh&do^h8)u6dogXUfhntL^5qgO*VdNpLDS3@>> zHDse#gXUfh+33}fjb06Tk?Pfujb07e=+%&oUXAXYUJaUiHE8bDpm%Loy&5$4YS7%P zL36JL&Al2l_iE7Gt3h+G2F<-1H1}%I+^ZoQy&AI7t05b`8nV%=Asf9KveBy{cUQd{ zveBy{8@(E`(W@aFy&AI7t3h+G2F<-1H1}%I+^a!zuLjM%8Z`H6(A=v*bFT)?y&5$4 zYS7%PL36JL&Al2l_iAWv^lHdPuLjM%8Z`H6(A=v*bFT)?y&5$4YS7%PL36JL&Al2l z_iE7Gt3h+G2F<-1H1}%I+^a!zuSU0tdo^h8)u6dogXUfhntL^9?$w~VS3@>>HE8bD zkd0mq+33}fjb07e=+&UPSA*tW4cX|`kkeGJhHUg|$VRV*Z1if#Mz4l!^lH%Dt05b` z8nV%=Asf9KveBy{8@(E`(W@aFy&AI7t05b`8nV%=L36K$Z1if#Mz4l!^lHdPuZC>& zYRE>f2F<-1H1}%I+^a!zuLjM%8Z`H6(A=v*bFT)?y&5$4YS7%PL36K0cTTSc&Al2l z_iE7Gt3h+G2F<-1H1}%I+^a!zuLjM%8Z`H6(A=v*bFT)?y&5$4YS7%PL36JL&Al2l z_iE7Gt3h+G2F<-1H1}%I+^a!zuLjM%8Z`H6(A=v*bFT)?y&5$4YS7%PL36JL&Al2l z_iE7Gt3h+GhHUg|(A=vb8@(D@WAtj!+^a!zuLjM%8Z`H6(A=v*bFT)?y&5$4YS7%P zL36JL&Al2l_iE7Gt3h+G2F<-1H1}%I+^a!zuLjM%8Z`H6(A=v*bFT)?y&AI7t05b` z8nV%=Asf9KveBzSbFYSM^lHdPuZC>&YS7%PAsf9KveBy{8@(E`(W@aFy&AI7t05b` z8nV%=Asf9KH1}%I+^a!zuLjM%8Z`H6(A=v*bFT)?y&5$4YS7%PL36JL&Al2l_iE7G zt3h+G2F<-1H1}%I+^a!zuLjM%8Z`H6(A=v*bFT)?y&5$4YS7%PL36JL&Al2l_iE7G zt3h+G2F<-1H1}$B=k#jO+^a!zuLjM%8Z`H6(A=v*bFT)?y&5$4YS7%PL36JL&Al2l z_iE7Gt3h+G2F<-1H1}%I+^ZoQy&5$4YS7%PL36JL&Al2l_iE7Gt3h+G2F<-1veBy{ z8@(E`(W@aFy&AI7t3h+GhHUg|$VRV*Z1if-+^ZoQy&AI7tI?g)t3h+G2F<-1H1}%I z+^a!zuLjM%8nV%=Asf9KveBy{8@(E`(W^mouZC>&YRE>fhHUg|(A=vb8@(E`(W@aF zy&AI7t3h+GhHUg|$Rkv*hHUg|(A=v*bFT)?y&5$4YS7%PL36JL&Al2l_iE7Gt3h+G z2F<-1H1}%I+^f;8ajyo=y&5$4YS7%PL36JL&Al2l_iA+K^lH%DtI?g)tI?g)t3h+G z2F<-1H1}%I+^a!zuLjM%8Z`H6(A=v*bFT)?y&5$4YS7%PL36JL&Al2l_iE7Gt3h+G z2F<-1H1}%I+^a!zuZHGEuZGqey&5$4YS7%PL36JL&Al2l_iE7Gt3h+G2F<-1H1}%I z+^a!zuLjM%8Z`H6(A=v*bFT)?y&By)y&5$4YS7%PL36JL&Al2l_iE7GtI?g)t3h+G z2F<-1H1}%I+^f-@)2l&quLjM%8Z`H6(A=v*bFT)?y&5$4YS7%PAsf9KveBzSbFT)? zy&5$4YS7%PL36JL&Al43(W^mouZC>&YS7%PL36JL&Al2l_iE7Gt3h+G2F<-1H1}%I z+^a!zuLjM%8nV%=L36K$=0>lE=0>kZcTTSc&Al2l_iE7Gt3h+G2F<-1H1}%I+^a!z zuLjM%8Z`H6(A=v*bFT)?y&5$4YS7%PL36JL&Al2l_iE7Gt3h+G2F<-1veBzSbFYSM z^lHdPuLjM%8nV%=L36JL&Al43(W@aFy&5$4YRE>f2F<-1veBzSbFT)?y&AI7t3h+G zhHUg|(A=vb8@(E`(W@aFy&AI7t3h+GhUP}E2F<-1H1}%I+^a!zuLjM%8Z`H6(A=v* zbFT)?y&5$4YS7%PL36JL&Al2l_iE7Gt3h+G2F<-1H1}%I+^a!zuLjM%8Z`H6$VRUQ z&Al43(W@aFy&5$4YRE>f2F<-1veBzSbFYSM^lHdPuLjM%8nV%=Asf9KveBy{8@(Dd z_iD&SuZC>&YRE>fhHUg|$jPc#LpFLfWTRJu=3Wh&do^h8)u6dogXUh1?wno?ntL^9 z?$w~VSA*tW4Vrs3XztaZxmSbcUJaUiHE8bDpt)Cr=3Wh&do^h8)u6dogXUfhntL^9 z?$wZuUJaUiHDse#LpFLfWTRJu=3Wii=+%&oUJaUiHDse#LpFLfWTRJu=3Wh&do^h8 z)u6dogXUfhntL^9?$w~VSA*tW4Vrs3XztaJjb06!do^h8)u6doLpFLfWTRJu=3Wii z=+%&oUJb1`dNpLDS3@>>HE8bDpt)Cr=3Wh&do^h8)u6dogXUfhntL^9?$w~VSED

jnG`DNe z+^#`$y9Uke8Z@_S(A=&e8|@leW3+3~+^#`$y9Uke8Z@_S(A=&;bGru3?HV+jnG`DNe+^#`$y9Uke8Z@_S(A=&;bGru3?HV+jnG`DNe+^#`$y9Uke8Z@_S(A=&;bGru3?HV+jnG`DNe+^#`$y9Uke8Z@_S$VR({Y_x00M!N>h?HV+< zYtY=TAsg))G`DNWM!N>h?HV+jnG`DNe+^#`$y9Uke8Z@_S(A=&e8|@mh(XJsI?HaPtt|1%k8nV%@ zAsg))veB+VbGwFYv}?#lyM}DEYtY=TL36tX&FvaAw`n%gyKZr6~Fb`9BR*PyvwgXVS(n%gyKZr7l>U4!O!4cTbdpt)Ux=5`I)XxE^* zU4!O!4Vv3EXl~b_xm|jn-8tT|+k7 zHE3?vpt)V6??)52YtY=TL36tX&FvaAw`jnG`DNe+^#`$y9Uke8nV%@ zAsg))veB*~8|@mh(XJsI?HaPtu0eCVhHSKJ(A=&;bGwFYv}@4Zu0eCV2F>jnG`DNe z+^#`$y9Uke8Z@_S(A=&;bGwFYv}@4Zu0eCV2F>jnG`DNe+^#`$y9Uke8Z@_S(A=&; zbGru3?HV+jn-8tjnG`DNe+^#`$y9Uke z8r?bV8Z@_S(A=&;bGru3?HV+jnG`DNe+^#`$y9Uke8Z@_S(A=&;bGru3?HV+jnG`DMX=d^3k z+^#`$y9Uke8Z@_S(A=&;bGru3?HV+jnG`DNe z+^#`$y9Uke8Z@_S(A=&e8|@mjYS%QS-(7IK2It(aL36tX&FvaAw`jn zG`DNe+^#`$y9Uke8vQ;C+^#`$y9Uke8Z@_S(A=&;bGru3?HV+jn-8tXl~b_ zxm|U4!O!4Vv3EXl~b_ zxm|U4!O!4cTbdpt)Ux z=5`I5+cjuz*PyvwLpItqXl~b#jdl&$XxGqsqg_Kb+BIly*Purj?HV+U4!O!4Vv3EXl~b_xm|jnveB+VbGwFYv}@4Zt|1%k8Z@_S(A=&;bGru3?HV+jnG`DNe+^#`$ zy9Uke8Z@_S(A=&;bGru3?HW8zxLt$hb`6@_HE3?vkd1Z?n%gyGqg_Kb+BLM^XxEU9 zb`6@_HE3?vpt)Ux=5`I5+cjjPU4!O!4Vv3EXl~b_xm|U4!O!4Vv3EXl~b_xm|N*M@_@m=WcaZyx|1w3tR1A6{{Qc)P3Fqzz3)oM0`n)MMSPbaNN-nI z_j-{h?>7k0|9`jWwsf@57kzYKite>g`$B>!U>%6-VfD8)VnSsf@)1ufv98(<^2QP_ zV(*{zXi>qGpjkOr)xBPPfx=L+`di)GO*XZjK&@zRa)BC6q4}S8Q zK;zK8x_6uE{`et6k5Z^HGDka8a^H>KB_Hlzica(I-B(M)pD%A zN73QkQgOP)VtuaVxJ~9}t==zd@z&m1pGRr+{(Dcx?aarOK8H=~hM9`z_SDyeJ>%StX=O{Tgp^?9)F?PNSYHS-ixZ02{GYvx4q z|37YVJs-E|I*T8hOpUT=eVxTm$+*73%$fS{gErEN-rVy)ZYQFzEna&Zn>89W| zxQ_y5E4P_sn)kb43Va!@=KU^`X}%%bRQl&_HQ(@#O!M6lbl%bP80Q_j@x7|z(yB(Z zzVW?iGOn*RDZj8Cj<2V*Zd)?WqpDwoQcJtioQ?C~H^1Rg)=z!zlVhCwHTX*BHO`A4 zJ|ttr23o_$^WFXD8(Ht4{xo<0nN7xdq4s@cvzQ|EvkJBEPsZnTs8X1&5BS>hWS*ew zgYKN`1DdZ7`g;VvKA;zF>L;reJE}kD|ExbJ@O48!9>7)qH(3Gq!}T@)v%Y_Gt|$6& zm~%bRt!*srC3BgJ>FdLCtRKUo?B1F1JWg+1J_^e*ULW}SqaXibQjsmNY2bBz&Hs#R zh6FZ*Sv|aI&c^37_5BCBKMkZg8`tx749~UcofcZ|U0H~0a*XF4U*GUt49_z)%ajvw6jcX21=_$6>x~tFi=P``)L+;KZweTC7 zvvIzE%22Ue@ATn%HqQ6tD>a;(oSu4%hO@SB!6Ⓢ7zW(EW zeCRnH+={f<*Zj|To#gw1e*M(%3(x4jfG$v@8QmAqd|yEOSUrbM54P#ggMLQFdrG;4 z8_+Jytj}xfzDCA-N7U4nbRWTa-5=NKK2q^feN&q~g`oTiAALRAnT+?8UP&Lp+xrpC zdnJ7!<9ww3QM&KodcN=AyVvM|Ns36=K-y3VDk1MF<*|&wz6^ z_qR}A&)KNHp8i;Utsk)Z|7q2p&rxQm-?{de>U|+P-pUdbG}SjUKI9=2!Da!T1>cxAA*={QZ@-Z}hLF zhw1D8w377rf=p%e7QIVA7dP&&(PN|qLS(H*+W};d^&LeJwEZjijOgl zuNTpyQ&Lx&Kgx)tuM5=sK3Zb~fKpkAKvDch0Or|NHd? zHRO9K-w;BEKwt=VcF{Yc^o|@g{!8CV- zO7v*A^BFzn-`Gz*X43Z1tkrR>SsTZ-wQ;=L-D^$javA4=;{tX5cf9 z_!#q#+OL{@e%cONF5`U4-*_0UbL>@>9_=fe)z|8{(2V0-b9ABORm)#my?=*ik7%94 zVLDDU<2cmpJDyPUZi(voriZDoBl4)PjqT-NY(INryXE_-_NUdh|D)?Xz^f{nho1xp zkkESzgx-56xjXa@ArK$|LMPPF0wE+Mp(r3lMHB&%UIe5|m7E0usUk&0L;-1vq9`va zoo{w#uHT+NNuEb{&Ya)QX}hztvwQWL;neUCr%^egRcET_Cw?L;_gnB2KjJyfc0K=0 zB2JZlMx|%PyHsXfvysaL`hMUi{wZrmYDbVs`g5m4`3$E@Eu2hca5HL`P_s7MsTs}B zU2`_SudJo1|A7DBr^&wmsYog_iNEt-ew+1i!ATKtiE+JxGpdb)tFqr^X{C-YVk|D^t6Dj&}}#pSgfRQ@}Io=g3E zs4m5{ub zO6lLKL$)93xP9+DRJPmFg37k9>Tnr8gvvH+_04~QkF{@w`P_| zq~n=!{kc3fjLKOu4$k6!q3$*1c7N}~esq3$!!#;?x%VEI?`@`1#s~Ft!@PW4hx~@R z`&Jn`mT^Pfxk~;*y|cU#>EEit@Bgi7nvdCEt9ROTrQNnS@;IyJvp-bx8W-gA?9bFZ9xv5A_FroEx_os0CdV^s zcV`;^pyK?WjUFln&gZhBDe!n8x6>Ou{-}dvB8^@h{1T`s`3&_(wY@=0(tlc(``5PX(R`f9{cs!m8};e=VA5}6f26il%1XyuzbF5uwxs;d z$1{#lx#iN|d|d4ZQ$mqPaa0y9b(fD%n!-n&pW@;2VmT^L%J_M{Jhd}*R>s{kpL75F zDqoD@AVuQC6p05@Bu-38;Bg^U;=zzu#6PDduP1%7`0dn)py2%rQs2rEZ&y(DC6CeM=&y^g+etzt2iUVL=2-_W(o3A%6W*+fV{-XB; zWA|<4`U_rBId*;smmEjIps?|L+VuSRcUS^qA}XoKu#bA^n(L zFh<6!LFf5C64`IVpcj0LOy z3!3#N{|OSmLQ5Hs`~9kjZzC&%IzM0Kpz`e{+<#kfJmh&t<{JxmUg3G~(}{+Id|Z0o&z6Vk zeK3gHvuBYeKkHdsoW^O-l6dNOo~0L-61S{IJt{wb>#QjuCYs`D&+ctz;+IBoa6bN;~S5RM;?dc8jnt% zK=lq?$wlQC^=ndjlk4fN+_=wOSf%>OsC~-2c0F z=lCC=2VLd6gm0kdgs$9vpzqrYseU+*KhTZaErfSDMfz^s4e8_gACKqpG4kVid`!*32O=e2h?00AsssDQz70Pmu1hfY z_o(=<%(3TGFDfBwHT7SJ`HZg<_ID}bTgg19Z;r-v9QD;vD#K2aJpGQT9G61Ojbi55b9OYpzuuL{(D~jGx2TNn+ndU~(l5e_bN${^ zdysy#FSncMI_z)1K6#MqWu^WIy*JYfhXje|JO9b=xz7*2#Pz=Hp;G1%&}aMG=GY_g z8Av_@`n*}3xIXO1pidP0|ISC*?_QYt7uCDApW~0%OI!|>__p&BzMt_0D4y_K{DIrU zc;N5*qvTV>zry&D{GAhIKGIs|xt&MTeS0o7szCQMei40V&kvk;f!IysSpP*sE`R6m z8k_QxjypG>Pi0(D`koNmjr(U@Oa7j*mB`;gUiK%d0Q-4}8=INx4JETa&|2o-qn@*$ ziTfyl?Q=W}abNQH9(6vL^a-`tuf#p%?>lPU7Sc}$x@k&PVE2!F+>XENgbDoJMsb`D zog@!6VPz`KV=@9$3Hj?KUxsuu&4CVO>w2?f>#Lm>7VdO*}FGsfbqw7rKc{;R_ zylA1k2S`7%B(*n~IGM{flBb!pmHpR<|8cu(D|w-b>$u(K6+b>{hCkWq#Pcy2ar_fH zZYz1Gi9GLzNj!gtwvxY^_>9^uOsdBIBcAgFFk+d!Cm9#oO1^B85BsI~uGIfjAw7$( z6Mu>QO?(Rbfwq!Yi|4!n~}}B;{KUO z#*d-cKYG&fusnR9?RXvrdBo2S|API^ zun_iRog_au{KK(SZ}`X;ROS|cJ8UTX(cw+mzYXL0I}9(#{;wU+zacmKUl``ldsanc zoEXOQe#k9;Hn;fC_M9Ju+~OZQNnS9w_`O{0zf_SE59of{OFlFg`yt3Bex|+TM>|R$ zF&Fy{RWzRcV|$+eLoV?L?Il0jUh9V0&;N%p!o8cuw6ZVzfu zQdZJO%vnZdw;#Tya`3mSsFeAT>Q=)s$KcEJ0wwXc>dJmvh0A<==zNOzR56ZI!AJ5! z!#H2BBtBBZ?tMn~C9Y83e(A&W85PFkjuOA1iccL%{HV^msSGPl-%E{pKEoV?56_cS z?4~YstYjYV;rX{39oe7tGT-;`JY0?8bqCd1#>-kVZ}yRSn1|=*YRs;uRKJ$Yvunw` zJCx_;ssxW?ssxXNDv0B9RkGnnrk*OvaXFX+{8MASc4R&u%JXy8DPJpd9%}M@Tm?VK z&&M)Ptts>NTAVLXrI+2H^Pw`2uOaiqT0GBJWq6*d$~;aooO;FcQB`(*TdG%s=R>Mo zL_s<(&GS?>F82p?TwC%GH6*SMmHa@cEaql~9A@IrXY5`}^9G z-w2UBg7^N)^LzwqNW2sx`Gqnv|E|q>5H*h1jUa^c4XQ%)A#*+T@>xf^ZVicF%E&rj zb%`57Brj2$^CrrhCkv50MH$YgL3JMQ)yuUl$zE;A+k|i)LyaFKrGiN<6=UCY;|;FFW-m`%Q-2pt7v2W7gq#MpZ6AegK+qo5-R zdM%DaTmXRA%+ z|GxZ<%0I8W7>LH7maINzlf^SGvJ@_bu8l=olr zdMZ6fEy>eLe^Qc9P~P@ej`L({@%U`S*IBfS%DOG5Qu$EYLtTz5)nXq1RO9~a=NfZf zM1@M8cu6T5XVk+2BTRj$%WZVVmhikuy(ja%dK{lZW1g?8 zr7};dc0QQw*5i0p{T0LhYN^bN>Ph@skKiwd~E}WG7hiY^6Dm zr{a0N2`3arq^GP>%DLYMIQh8cE#WNaE{;vR*am z$`4e(p~SfjC61MKCTPfUsrpm$zYQh+4CeJ|XdrQ?tWQA$i9Z`ie7ax*$D8>jkCC7A z7f_$$bCtmB|InafZ@Q0Ck|(S${r!QApYz#d$_0c{b(ECzs-Uqmq3FP(bo3)p)+6B#)+&WIQOv z`A7A~HXhFkh@Yt@>mEtG4hdCd-cz3Q$?DxF7wP`~h-80Viu0FHfb%xWo0s(ZsgG}P zJd@mZHrJE!tAONnN^;&2s`C6uCI7RSxOZ3I=jZ0UwfddMEhxZwAeFKzd6W8G z#)pEkj+!dtaY@d{si}s>_j>>NS}LbXJT-O8SFB%0@t>NOnd7$m5{FIeebAhTsyr`K z(_~)>{`XL+-gI8?SJP$R$#3!;(|J8y{U-Hh$h!8gGCwQNd3g0k{(NM=Am_8x8^fQF z-8VS@tbXPBm3ou&#_CPZx2iWeZ>4_a^>}sf4~`!tf2)4sd5QX&=QZl*`H#u&o$CA@ zZgcz#Re3(CX7hYe-A?6knbwuEIBBc>v4RbmP>mmD0#esyw3y5%Q{3AnQs=7yk1Gpf2o`C zb&MUTAnONJc>bt9`?oCF-!1FYpNW6nBmI7b^n*RJZvC0$6Dr6$>R$FEYL|=$dwVV< zd%Hg3d0ZjRE2_O)CzJkWDIRyL@H|xQ%hKQIp#tZx)vlJS>9{24-PFE5!_2W-!TlPl z@ch&h)t=%bPu~MHukrNB)PT5syE>cF(_`TwDhG^PVM_JWi57I+P4Yw)IKS$V{Vi(0 zj7K|vUrL-ek6VcIphjo@pt8(+E6e=0vdm{I%Y3%7%wH?ZytR_7NAH*MzY@<|p_0sR zE6KdK61PVPlKf!>$wyX_`E^BUrz_a6dSt$$_H&%or21FY&HbsB&B$Lh*}}(Af%AbN z@v8bs=9McK2O8efVbAYW?|{UOJ2_5(AkIUol|27Y2ZnHeUe$`@gCNd3hWJI@Bs*ht{UM}Fe*G^F~EkBDC_^OT*EziZuw#&;#_0}#Y{ zOSO8{`^10F^8>Y7<~0X-eKI5}ys0_wY4I+7Z?z_j=Z8T&j;OSt3Ut0HuPdmu2{p{I zN;}Qtio@%@%HesUa(JCsXzI{5?Q^*2+fJS6kmHS0MpD#Uql3JO$Y06sx^3sFThYs?kFU&i|^7++RF(ThTlrbm4VHjUj* zcDLVVzg2?cEVb$Qheq$IHSd@yL$0)?xJO;jL+uz!NFKQ`uRnOI^L>Uq@SARUb?pG< z_dHd3eG6pX4wC2c$UH67PrlPN_PdXL!o+x*8Nd%J1PC`>oKNP{dph zigP~P6WombVPRhHP(MnZzc}a9LyPeD2=&^Nyq5a0?l-Ezx zVcypl+Gyusb6@JmtZ!2Jh3xhfalmq$P7&F6XlrKcdT z->Recn;U&-R40n-)wjQLzdqKYJ@Lnu^1Sq0@sG!Ny-CS>ruuUEZQ{O^eObpl?xf>y zWjvL2Lv{S=O46SQpT#BTmqQ0v{)vt+aeUyBbr5xe^Tq0<u<79P_<8^hB<9~Ir#tk}u;qntMr}6i?P=&^o&@ukINPmv=(4O49{;f`B=K1J3 z&Nqij9IsCG`h)r4HKz3Bnyde(D|XSsQ&4GN2&aJ zJjJP=fSH$B&-*yl*Tv7$@tK_DztmaI^Qtqve=qdCE$k=G%DPZiwy(Y#-ihjc#p@QK z;y*oE3e)=v{h0fw$B*|Bgv!3@P}zSN`iS=}gg)T+5_)ejwS&;x6;Bwuq1X0PJ}C4G z$2Fm{o)s$Vc%dhFd<{LaAdGlf&kuFV+@)jj>!JI&KZc5b4&Bv)$Ln!#&4t+6*eg> ziVtD9-U5?Pore)WM#1Da`ohS>elYoQD2!p{n!O`uE&1C}AXqy|lj*f@kgZ_r@+qOgR@8h7m zj)GqQV7d4lMAv*5x)0a|(Nn5J#H$t%xwAP$bod*h*Z&L=^KU`)zWfjoR1~^pI|E%d z44~s~2j7M0ZKI%D(ofLq?Ew&Wv?G*iHXl0NPk?Tzy`b&cf1usdGSGf=1;}||47BW& z4>|-+fu`s0foEntXx_601UxPTEsFR;wo~Jv*`4iBeTxq?-25SAt(^)@_vD7S@e85B z#oW;1^C!^6?-}@4ZwByINyw764piSC!N1fB2p#1MS+_ldCcl=3fJX7qcuQ$$S}Y4R zSX>TrPM-~p-pUSndtQTv;ai|;#n#ZEP)R6o?nh`4G8sZ=7J|C@|AZn*J)wS$Cr|>v zVZF9fVC;JZphC9FP%7#g)Lk166=Lc^J>MWGldU(@?Ry2vRrvwxPFoL+SNcQE8);DK zKvyvTKj21fHB>v0+vKmHa_=+5McP7<_Um) z=N>|?lT~0u`9YA|ClUr#`v7t-cmTr^+e6N;Ejo_AD>(sr(#Di|7iS|Da}8C|7vu8Z(*+t`9GKj;ngRZW8L8E=1{k8U6NDc zPkL@#yJ+OJ38hNw)H&HnzCX7mq_n+fWT*18pJB?loJNK&+aKxzttS{c^qUutbn5+{ zM%I1TZdA`d&1PiqoEZ#Nzx;&c)Ee#5*8W)2$j-Ae=XJjV`HZZi$F9{r6aOW-?vIP1 zLDi8Yr#`%MaCO~fMuw4ximBrZuNhf=d?i)K&5kj$xyQ6gLtc`c>EExRck~&Ovret2 zqiQ)uhTtdJp-rCCMs|*!4AP^@3^TI&`0hvl+3E433bpxGE7U2$sx!#Ici%R_AOal{u)On|WOwvycDpQ^eP%j!jF1Kl^d z2k8@z-%{fyzHMafGb0~Fk0@khb@px@J)-h)k`Fe>3!@7p8Ce&=cGBf^Wg|n*5rv?8 z|K_Bh@~D&()UKE+S9EaB;zow#c3oA07mtjb_UCu4bV|rqq|cr@ zNca4ws*#<;`I~z0Uxh3_p_4x4X9-_3TIc&~6YlAs<;hjTuetyqstA_<>Y?s7;s(0wIuRbJs+N&CR(o$}R)Rr1{Bz>{) zVvtK$PI9qlsnFq2F_I%^M(J!z{fw;E zy}wP5Z@SOOx@(1Lkgs|!lChmT-gaJP*D#neg4<+bcrmBPs)2@q0R!%+hiRckPP@5h zE2NAKF|rEZTUaM@Th-X+wX}JF`2M=`AKWkc?Y-wbeo)`=I+t@pM@$=IWT@47oo>8j zsga#^nWyRT5d(~zb}#o6ozf$-kwZuR{#2(v8E<5r>%v<)VnT$G)kih&>$ty~kv#Uh zR*-OZtdTXgbLDO4{f4(xPyHs6-mmFC-Dl8WB;&tAHU!Z(f=tuC)4kVmADQ@Ku9|=0 zAu+zcy{Y>wI8Sm&!QHxsbHm8a&ZJ#>%)>iIRuiK>)AFq~_7{-;00&c$9c_3$dSjNaMw^Cdklf_-?i%RfNHMnOie?!1@_gLnUEWEg+V*I9M>2h!h# z0xJlOkMvoGywp)GhZ-58 z&kS~6t!+yBhAW>y9rp9kr(h@WJ3{y4Iev4xPB|7!d`RVfy2jd#B$to*TDKUGpXz3f zE2^VB+*Y%Wn(LLFf3Nrn=Z3w6q6jL#FL|+^ZT! z@BB967d@!kVoz+ zVRUc&?wLO*LUPSwD|M6of0G?^{ZxI8ZF@x7CPwd^yVG9}KhW36o|5+udHbMK zZCp;6(&JmBhZ^`?GIpEsP`%*(3*$P6I-4Gmzj8*d=mC?nKU=L+xNYk!_$(49 zV4V9dL=CA%Hpf41I{ddci64C|R_&8MRWZ+LX!dxO(L2Wu`g!A-gRrCbfBt9r@GUxSG{su#y}vf; ziH#l*|I6P;^q_ygHga0*f?<&QE{}JcunmkG7H9No2Hwx4$eSduzUB+#_t5=AdAwE& z`CdM~4?%RYHjHP|*()HiqRuz5ybkAk1By@hz3EXH4;((l{RR6nNMClEJ^8VPJCwW0Wfw=lh~DFLL3iB9|Hx{ zb&hkKUg5=bVu??UUfrlS8e+;(zgCMI?uH4mUlQN%La_6AA&paD$D%bVmD3?BdJuzs zPM433COPtX7sz^v`m&DRyaIgu-!^)unSXhmG=hC>yLl-(=n9YHnTsscz1x>HjB3)i zJ|yj*XJkn2Q`z$lkFAjS#~{^yeMe%h4(_FgcBOGv=ekl@NAP_*GqQApNs~7a(__>l z!1%z(y56)gP=D6@Ms|9Q4EH{-9^2%Z+WwGZ$e?5m?Y^OY1nBz##{k2tRLBW0=}wd`QOFC+*x6ZlCcuHqGI_roIeVuSXT^L`=-m zZ=7p=XuNZLFvduJ+S2Hu)|$(@aeL~sp7^RGy>kucO7>BD=vC4~QknCrb=-8agY7{} zdw^Ddj?ra${XzQF3&Ck6CM_kK1UhTBzj#wBRkj8A4+_pI-dCo62GZt^tx!nj=EEU+azPV zN|Sb_wquNq?ZD{O67)qAc+O(xZK0npK4J8bm@vxeHsK)2?F!A(B{{Z)zQwbvmka2- zn{%e)o6=c0bd{c1zO|8|JNkzlKW8R+NZfDEtt{P)tWpc)gGmpTlYacUJI-p3dsXzH z*?Ka^rO4pcr4I8QdR?y)sl z2Xf2_g%a~X7{_=J@o$XImGgJvLw(oiB%Uwm9#uy|juzF89wM*KgKXI^8QHnlcR37_ zxpoBlhg>sm8@-Mh^+;Xk{DZpjaXTFou%7f?aNb=&`h}%##G+159593P`%N_XMtqhYe{V*vv1)s<={IQ-(q}2`WhHlhwOZ1WGA@y zAw7j-ahPTw1$00cgb1&_#(s%@o@VnP~lHKS%hp|1UTq$g1=#Kp* z=kJw`>^$nfN%!Y*1iGHPqw_W)AEk3+3>E=*4Wp~q|3rtrvB$`st(Z4RWnTvqhBi`* z`(-tH)j4ZFNIW!yr9F>Vsw*y{?1vnuhoC7#Z?DUIkrc9*1c?r}@P4 z#L#?s<`=|t8c|3WIeyE?o`KVwX~_dX?yy`sq7=1xT?OawP@39_@p}gk9M4O3lAaZE z>a8Y!;tc(~mY&>~{8i}nwM}*E9ch!bpFoZV#5?*Q};dn%z0kvA7e+oz2m5! z_`{bZSHRrb6q&aUsWU*`4oon5o|Ce#P}4AvF=@jr(l-r029+ge)wy|ZU3ldaqjzwQ zuZQrM4(L~me<6Jo=1CGcC*!P2Tc>f{B0FP>tyFtnlrggUbuh+zA51f{ZiX>@MV@Ob zoR8{B+{bnDoU1CQdF+ ztObMlyXXe<_v^YmHmS$`vO>S>?1!)HI;SPBhQbe)YiwI&r!mHjwPfyN#<;^WzZfqBYI+okHnzOzm#E*Jp?C4_SuIY~QeaD}QgoMu;8@-c&u~0(f zWMXK(!*PQ1InLil%N&{VmfSwmE*=@6Q+S>T`O-om{AgWM7ckGG70>USTS@Kp5RP3n zen&^XBgcL+_F<0U;F}WT;T+|^++ERxOVIH~JlVv#tlGr=OJ|+DK}T`^N*Bg=+qpg% z#_92AR!HP`uJPMx@3*7;0O!*b`Ux%hUL8|1Ox@^x$kg?$czDM1K>bS;-ofRC-t)6oSe4VFNc==fEfpzd*S4B zOdcy#-XR42Zx6Ifpz%WY>~LHMq&zh?@prRvfH^giJ?PUgRxomtCm5rmU}PQrdu8WU z+o>dDt^@P-!$}_gi&E$EZ!|KLJu(1VenInS=jk`qpdaTOb(qg^C?vi;YJ3}=Rq|ki zTTgI)KGA{d4vZL}9)#s0IlJeIjtojMvKsKJhBy9np8XuF`(9sb^x6mKxzRN#7oqb! zoT9r)40bmr1_pmbW1Q#equG!$<2LbyqB=mB+)pi>zc=RhpzynR^BZa!js=nng;dOG zH{*WfJiHvI2lVb~>^NDU@7KxuJ|~;GaDE-pf0L0Rb$Cn9TPw+*IQ=L7t0y0)co+ta zuIc=iyAm;dkHtFAdF*!XC0x>jE(ef4BxM2A2&49_9#+o<1KuH@03n!{sKK#4Bw_5- zj=!nNpJ~janYzm7{9f-|BW)Ju%2LN%FnXO6W6tg|H2+oaZwu2C{*5tuC$7kIoglFy z&e1^TXr7>*)xEJOuWRftXLt|hnRM!mBqPJvO+%cmoIg*qatjB)spj#niKwSI?)2mD zsBrxOCQA+9(e*zu za@ubtTIdvh=T6wBvt~|COlsSyo+a$V_3&puJ6~@)OM09mDx51CS>@kY1(JKjlHNDC zkB-jO!^nU!g~r%|1DqGA)fH%*0(^(imcNBM*S4@8F7ZiE z%xeY67=iO7&)4z&jZO8}#J6EU+B&j7#HYR&~&mkIrS zfv)x?`BiB8>O-i+F)idr`{B|@?&EhKRDp6Mr(2?|2v2 z`Uhu)wA+d^zkp`k{`I7Ld7RWKH2;O77(aKaG~d{9zI#yrzqozYi4Hpc(mAr<=(w8L@3==!nIP>+2G&k=Z@ zu1?`tIkF)8VY6l@F&-pmJ)w$!A5Qjjg?y!x-{?ek^5Qy0*CgtvQ1s0|wRga+%KH{I7c4+A$@D8l06eZpUPyX%2zA2+HsWRvDYp- zTX@Y*7r~r!C+?5XFu?QQoHX#pb?6a8eox!^)d6j`s{ip?Fyv2a58=&%jZJm^^m`if zXhzlv$8R~ZJ_t$U;+>{E?{g|%8mgzvZD|<5zM1xQ&NoONzNLk8z9{($=g8=qderjY zjb0C}{jPJB=i_Px#s+cnPCOSLYFRJVVRN$Ug0~{b4zA&7T+1=Cvl!d?gigLj*5jsc zQX4s!<+OkFm&V)~=`sHU-nr7y!cppn=)t7Nbq(!Z*T`Gpp6+^$>_FEA>Nn7Z*HRCfd%Y!sT<;qv&x<)=2Xn#1Ps`s_Px`!;k@et%Bb+;bjv*N^A5}%>BadRg z{BNFUzpJ7+XG!MuXx$vwYAf8M_}N*Fa~yA;IdSk2r#r7x=%_6%wEyQz$o|mCo6gmm z_l@i<+*n0VWWR0l;u`bgMz3&Q2sl3^`Q?n;(6{s=BSUJlhiS`rPl9s=^IDQ))R+g- zm=7|HGiCYjI-$^?#80l}s1ckaa#jxe0Wdx=dL7xJug=Enr)f(upCdlp%=sLg`w=q{ z{nfj7Xl#P24HC8D@f3!oo>AYnT5TApl>HJk<97>T7lL)cY5r8V9loESyEK03tk}k6 zoyfV2>-EDp_S3j-?#Q}1wEW~Sl;!ouv_)OhbSlRfI$_~NXTm{>0U#uIC0&ExkH$GN z$Q&6cN6N9c#$31d?z_kuc~j%wa&tdwVcoiVVx0j-hDcmH$SU*k)_-QzrMX{2;ph9I zvk%2rs&}@fIt&wDOT~!f1{K3=Ic7voS_q? z-UEjzrFE-MxSw{wII1}BAyKzG`N9y+9qBr_7SmAnqTrqikUbSp`Otk0 zyl=sC-Tz;+o?))#42HXU^1Kuyht~PvS2J%hGK|@KPwm>%n&g(Z(sWtQ-Kj2%4npDz z$LJO2<@Dt7ZHO7RaH6`z{!{(9v$~GqIsQRw%^Glx#UpzR(iY9C>TOHV71wm~@?2H> z;@T_b;*CumxbBwjF@L|2okyig!vO#CB;&a6^>1lruSm-MLq@MNVV~_im-4ZI<2%Us z?tHp)k$2w(1mRwk_PkF3;-fk^b2)#meo@W!;PTtZPC?8whsl~L_ESgtslqi}@UG#O zGHZpSCZ8sCOVPV;M5F!50kw2Jba7imaOIVGizSF_5o9hfA7@ZNWKmdFi#T4 zxn-SgvVzE^{0=)O_t1rTO)9M&#&5E>0kZd9t|K|`s@`8+4`gm-)=1O#Y)z*7_xZS; zH%5YN;rDf<%(;S(E`v6_=B_j0I)3lppBmmdxupe+ccUmm-)@5Hxt zAI|IQl;K;_dW6Sb$MR|_oK9RxL*t7PNO&PTjP5-vgcZTfE3xU zRcu~C-BJAH|8W1z0BH|U@3O8U`^_5l%c^THBi{wxF(%0&`#QQ-&!zKmY-#pqDcq-J z>_gdY`=I5wtLR#l7h?WI)?|m^821y;{dLdCn-DOPVte)d3P%r>wa9O`Cc`l4cLCVH zFrQ-V=+>AEE!{cP$WRCK#tmz~Yh?8?#zJwcmywKd?0@^6vSZ%6=X3TgxPA@Z^=q6T zX_+6X8Z~yp6wVvye7KJ*ocArH)oUCHxGrLB9yB=z@tL7ZG4~?5ca`VWhdNo}WZWMD z-u)rO>m54cTmhX+_Tk{%Md2LA*n}>)23Jtx6Wpr?J$Y@*_(J0oiNWy^O7r-x z9^khaDC?CmF)`{o=Ube;*ndagtwVfZ`?AnO*0P&puA_p?-8!OgEP9Azp1Sybr|>+~ zd5pRGe!Qp1JX5H5&Nb}pSm&ERzcV&9;9jH3oO^+uhaH_=axbBnudBAdoMF_tft_JE z$Im)Pk8hzz;V+EdDTMc*EIEPPeJVpLuc1Rt+!NJ=#}{1~_aWf=rQu=xvIMmzslAca zn;4f);_qt$v5-5mZ-nA5St~DkHY;@GeM&GsM|)?z>^rK8`@0nPYxQHY)-hieh$;2zy8#M6AAV<#xoXr>P1IeXgAje;OW*0tA88>7dMUTk>4 zwP(Oau?~1o?mRQ^mWIrlk{tdkOx5$<6LN?wr1C4_UdhbWwE%ze~-bUkK zS~0(gI+f?MW9dRYSLF~4r|>?Fq|=26$KuQf8S3vgT2W=*Zl{4PeHHV^xe#F@|zbJ{_?w@3Ay z-vtucZ>t9tKlk=i$X}s|4xduO)a5lt+3%XTYnTdSpRD#`-O-W@8vnts4(^3Ayz#yiM9i>u#C(iK&~m3fCiKAE~qV>=iwlV<)u^_aTqx z^)HoaKz>NRk<;+bDO{Tv$@v_e2itHrnMY4(9I2LYjKT9k-hb<0JfbH{z7*q4jd7>3 z1DL}|Tj5<7`>>qHJNIdxqrH~>IqKSzt2&1FV?fWX1t2@;8zG|g1hf8U?C6H&Cg?gm zPt+JoLg1S;$JDs4tz=yrT3<7K zK}I(Fq@1-9+qc-ZPnQqOZS>9q+~Ycs_hvX(%C6BvxsR(6DNg}oM8lZ;tt0!=bs1cL zX(em-Nx3UIZ8=|ea6PU!$ru5+rl5<+URla@bf(xt`vf1;vIj%w+g=*Nd0&&`U>+cL z&Q)_QGnRsP&$HieC3Np+g^b?Wf_sFfe!TZ(}?rYO{A4aeHKgq5h@%~a3 zpSK<)a6Z8k|9)$bwPwf_77r08XOf)~pJwy!W!1&@|E)VbnoatT(3i&XUN4BkysLl5 zT4X=EN38bYeFBgZ*SNd0|54j;ZZ($k6_D$Ho&NJ7<*?7TVE<#r(u1>jTvpSUB>?VI zA)CI_H|ajSW~6K3xrh%P33lW;9gC2))vnrqH@Gxiue4z7pj z$$$4Uvf9$;8DNgg$j}Mbbc$xDSk6On0?)s6$@-w%$^J}}&&2*|c;_b0gS`7aOdjw3 zd^Bf=F~_o~T^uJvGhAn{C^2>s%msCl_VCZFs?dL6XJbcwRsRzhF|Q!WXKK!X5wZ?` zIw2E``1um)Phq>2eyvXCegY%M#gqO^^erRh`yRw;`72ziR8+jWCwK zubO-D2*h*F!SnK1tjS*+KCQsEFz>pClO^*skp0ijSpT;n;bu|882<{RIsVbv&W?ph zUc1-z4vv8O9cjGN5xakcTs&Uu;qy||d7e9%{f1`Wp|NA;^a|(pBqt|pl{@DfB;%e| z&vDs*h2xHA6t5$jHWpe_@)$TLO^f2S5}i_dQQAKoBkAPO22MfQ&wzP)r!4Pv)Kj{& zb*k|=tCN0z>UeV+300OjNj$#j5pT|RzG{Ay?x7>D`4)}LLvq2^fjW%m*Ul{5a~sdG zhi5kC&t?5cZEbr`kKH@f@IdP(5;Nq({2T7$Cw<=Sb9C3~%}A#8CfO^P8{@zT-dh5B z@V#`~ScRC}Q~uBqvTrRX{s@}Lx zc5rPR8obXrftuKtoA5jZYQ&#}5YCA~&F{8CliUlK--ExK>Y7G!i^~B}j(?j2xQ?fA zJ&*MGul?TN4&m<}9E=r6Kjy=7&S$d5*Y59LI!N{p_~UwRFJ=_(HPZ<^j}C2!zsHd{ z+{uFT_vAB!jU6W({YIkvz6RT;?kjPHJ$J~7bA;~i^V}c(o{7s%U9+#;>@O!dTe(0T z$-g^r%(~cE-UICP!@c^GdHpDDI_6O&CiI-e^$6K(r&{6f9g-x^fd0d~rmyB*`9;Tb zu0T=FS$s0iBlHCRUTOp8y~kY}VeUcU{!=~V#atspZQR$=m-;|l1EZKg193b#GTcjT0JkB7R9v7+o%01u8w)p*Y;?;i*mOwVZc56EvN)ZMu0-t~ItA?`<& zb#_f_>+&6G%~#e&Y5i2*39X;<9u?jE$SGZc_c_zru|icf{Y96lq?7gQei~c*@zc*C!30Ye; z)=@Gx;a++O;5;7B<0OVW*>dQA^Cp@TNv>@2lBJIPc7x|T;-AOA)5kkc(Rmgfbk7%f zeIICEz_|jQigSUH{0>#y)HDCZsKpM=&>c8Or#`}*|9^2N&aM1qtuPwnXP-?&%=2oB zt&X@4YAB3vSri7 zG{E!zuk#r(wm$O^te2JRW=_H~o5)kJ%r0^=mH{H$jIB?>^MS%7VwocyJ|o7~r((UF zQgYX2jU~saP+!)V1x{`e}F`qZ#v;IRXEbmqee;HlGn=>!)MAd{TE3mia}t zZDz#S`WaZSfYgo0vY^PeO`DmB=L@C7XT;e0H?Uq|sXGD7A|l&1Z6*%S7fpw^7@uQ! zz8Et;Ut(EYy?(e zUtn2AWZPy&jIBS7^~y@!!&sIR*|wPxW9!dgz4B7`5SA50wr$#s#`6`0IfSK`&xo=0 zUm;&f>N;3f7TLCGGii9fN;-T-jIBS5^{PtUgIHD**|upjpX2%J>F_pl0MFMD#^!Bi zKc25CjLqB3K0IGb7@N15y?DO1Fg9;9d+>Z6VQk)JcH{ZF!q~jce1_-i31jm%vkTAH z7slo@Vr>1_Sg(Q9-HByGk!_ncvjfjJN{6?Z?RdViFg9;9+wgo7VQk)Jw&M8^VQk)J zw&3|tVQk)JKE?AMVQfAl#@3(1dP?eU#u7xfZQ9HxJl|9po41*bc)po1Hg7YZ;Q8jl z*nCEetv`?TT1Z{nj;+6d=UWQ10n1kD@EI|-{vy_EosJz_{|%mRBg}d%+or>3#Mt^v zSg)PbU590Rk!_n9F}D6&tk)qOJGTBZp6|#^rrua~5`H?_UKDV$m?*;#S&9(ZF=;LebM6>K-nxd{R>wQhz@5i#uxbE4$H{<*J zGw*Bq@c@xczZ}T2ZO7O6j6uQ}-!S-fCbRKNLs*}A8d%dY#e?jchRJU=WQ z#@5%w^TUOyh~)^8D`7d3Wnc4cM~UA4UUuDDcs^Db)2BzL!)L_U`r24;jMOcUL+ zY1=7>=M#jn@87cH_ZZJlX2$OcmWeF;nm&}oawhv)w*9(zeu^;Gwe0)!dxhtdg(-_= zN;tVgAQnx9V(?qs;o3ZZ4b)Tl%bg2ti&JejNmR_5-oieC@ zLm10uCZqD&F@5t*VQibW9n+U*3S;v&WBTtbVQfAl#@5%zdb6dj@drMRiw$v?+spygqW&XcY(68#)|&>sOzH+<`LW2h&5RgZpBd{d z=eoYex36H?=Qk`@ihLi-RV-)DisfpNvthYL27R7R-$hJ+JDT3!WrNi4yVLZQC7@N&-XXCUpy7xm{%2rp@HX^E=YvZ6+U{-zkjEXT;cg(@u6t-Mmt9zwxE-d$nY}?F;vGoC1Z+|*=Y<(b}KOjs_ zEI&_&&xo=0Ik4VAuIp>=J&k3*yI4A+ABv?G{VgmHiF_N&!z{b%{)D|3k#v|F zs5{DfKZ|$SxsKP`ytJ(j1^VZKA% zX<;nhW#=-UKO>CAyO?kB{8z$Qyo1YrY)ai#-+Eusc&^W ze_j~V4ljso+S^5uZN{`8b8YqH0=QYTufn9nD&H!zD4j~raj@G zi?Q`Z@#GCd{2#{Fn{mOkZ~XJEhW|4C0smY!ZKf)oG<^*JT)fRx!IP%%;h(R~+e~FV zd4~`mUz@j?N_gJ%bNutQd7G(-Cx0fy$JgdXyRtPmzPM^xDjb zvGpeA`Ah1S#PXrYw#|$fTW{i}|8d>S9xNY;tg!rBWYbRmVcB;hmj8-81Ix!Ezk%fw zk!@x!>Yj>z9+uD2VdkUmx#-`<@u=8&J-g4zm{Z*@Rh#a`x95UsE?g^zWk_ zDDnp=8{dk5F2>d`!gI#Y8phmDE|G1U88Np0L#%6jG5-0Q`!v4T$hOUl7+b#>>zFvq z)HTm;e7BKpn;9{-ehJnwKHb!{?b!OIc+U8A!>qx7j88YR&1b~e`j4<-#J{ zHZx*u{W7duMCz_W*^B}B=WE-{h_Uq_W1V7BcO}ZjMYe5b#Mt`fShs}KU4e2?IyNoF z51-q&Br|^IevE&?KRi|Z^j<{^J|E5Ws$LO(b$HEzK`)Av}OK$pWr`e%l!G-jHUN| zicEE3uYir!}Ix?_-u5@sCAy+j_1GPYfMCpI%4RoIS6Z}WRl6)k%ETJ}ARMy9VYwjJBP z&BP&(eTlAR^RcMvFM6A?>yAQZKstu$r-*q&Zv?7H}leX)HL6O4uT zd)d#j74_J@U$bM|--4&HUB1THbw9<^*hXJt?7ExrH1_k?7`yH!JdNM-HO8)MKUZl) zF@b7`twu&2&M2 zX*zs<)PE#;i?Qnl+Dtg|%hKToq5fmm2io7%{?;~A6Zz%o@cB@`LhM`DvhN|#X1XH3 zG95lI>Q{;0V(hwsd62<&PyO9y?7IE&d^TYQVi_Rv04%eM+#gFXgU?9&{EZK>`F^O+ zf&Uo2&Gbi|x310Ld-KVe4&N7bxkPU>c3qo6UrPJ@&2=r__3Yj7w$_ME`#t1F{aVpm zjH|AFtr%qSozgSf*NsLUzEjfMj8!)fpULF=h_SC_--B&uD6;upw;8w!O{{0V%a2+9 zEuasc$2LvZvh7&*UH21#=mz1fdvn4b_zitO5xr%{W#7!7u+LLn+m3ag zE<4>3-T1oAfL^FWAM~0X%f8D_4@5T!Z`-u(49D~6LtnEQg*x=1q_-KXuIpMo5#21j zb=^Sh6TY8{-eO#JBk?@?^w+Ls-Gj@H&D%EZYuWc~@h&?f@RD0zziwb4>bHvCV(hvu zW+d|4Ugxv7LH%~t`!_*(hscdl-pO(x`WxR}QrEI$+jlXekpCzn8C>WE{w&ym?6mgA&kYlm>6Up2xIXsW+*a$3S;puW*9Pm31jgt zW;ikrg|T=SGXk0a31jgtW+XC?gt2%RGYXl%g|Ya+%&7l|^#PV23$*;3%T6rv|B4;U zri&Sk%wu6J-o=<}JrTy@UCdZyo(f~}E@m7u&xEmf7c(B2=fYULi-|+#g)kQHVkRK- zQW%SOF%yw_C5*+pn0QXJnepA<;saNp9(6SC8$J3al2>AJLS*bCetsg`KFaiqFGX*E z(*ww7V!i!+18n_%WU!98mW#3V_-_5MP5fUbdkfV2v)RB1A-rWX5Z|j`PSIP8tL`3T za;0-E>mFQoH1fG$w;8Y-^?A~1=3AFp8-8Qga`jrqnmQB~Sjw2H!jK#Yc^Z|Y)g|Yb^s4pdYyI)xE z)@A1;^1;GeHeJjqWJ(KT@h;{xGG&CZco%a9nXn?nR3Edyo))DOnG4}-o<>4 zOa);q-o>0lrlK$w?_$m)Q%M+$cQF@`sVt1e2l}DDis&uIuIpkhB471&KEVE_2Of6w7-o;!-rnWE^pS=a@z2ij! z%GiI*nBs5sS(lyfkf|$nESoOo3NrPCv3M8rJu>x$v3M7A6`2OYSbX;8sBg%6f9sy@ zXK~s20r^H^$Fdo?9QBP^@5f+nh1mM=0D$J`y9KC{fJD6T+6zy>wc~w6Do|& zZ$rID^mhBP+Lg=Bb>x-smQ5FP0~rv;;$6&7$TSt^#{cJC%uUoc6UO3Q%q?W_+fYnm z@h;{zGT7#bvG_n=)VCD9#klHjMW&T7_WQBkoBu{UFJpxNW|YOx`)@*7#swGiDeA?~ zyZBE~UlRYp`|`IL+rG_gLAKQEyz9B{;QhB|Cct_|{|%@Mmb$hb+rG`cJSTOe;dbK%eJ`=_2s0l&DeEq2HPF;-ny`?-tXt1Z^S=L)delK*nl)nL8Lj%7cvKi2j7G4$Vl z?U)a=d|CjuCBOEp53u_ees^!b^Zyvn*JQ?ZE&Cpp;rUwWFm~OK@Ovw|NbAKPR2fe+m3DjePm=DbTM|_ zg~&+zaWPii0Q8f7o#h_v?`5?s|M&2`jE^ommVK9xN<^DsY}4QNR|`-lW2noHW#9FF zenC53 z<+b~x}N=4tlLwrYdxdu znDR!*y>$3A3GErj3w)qnEy+m&__PgDLOmAWAXSd#o>$&zI+md;I>lp*=Yu!hi zebTwEeXTfTqSLvqZRdAn`U+#&^q-5mR;>58@5g%ouKW1|?O-B#{x9ez`o}P$P8vCz`lQ* z`4gET!r1(C)W`fkw$1|DZKG+!LR<1JGdE>s=9HP4Q)cG&Ynw7NbIQ!jDKr0NN|~AY ze@45q-i@7eeEfLy?(FRB>`IoMYj0PLv@Hjt*~V#F5>F7P&c$75m-TwdL+2{|Z0qbD z&7tO2R&ZKqTjh!KX5+wU7S7GTQ0!v_ncr{ccWe2>2-{qE79-j{cD~z|9_y_ z&1*CsjZ-y0p=V#H){g46uRYPwU!~E0f5*lz9A;&^h1)3l`Dzz_4E9P0gu&(=}c5A$s` zKbkky+=u?~UVYFPb&(w5`_g{T!+xZewYG0~?{SbFj75+R&QOzNr1=1h1EVgP3iu zR`LB3Z#RC8=YEc_;WZLlFs=h=d!o|}NWU$cpZfY){fPg84QXrFxFe5C#@pe2dUCSU zbaXCcj)HMnt*z?xEg54F^Z)R9itktAZ&}@~=G$t_GM1n()l0tv8{q#`?_cLj#vAz2 zzQkt`^MUw0&HL2&*T;T(pS~o9a#1vA^o~no2s96%KeJaK#KZoSoaOt~*fgGb(VX2I zTQH}#SDfQCI==(!VL#WmRX^(gJT&!sw|$A%RV_(uolCHv@BM3EQdhyahN8c~`%$0k zV!zPaH6D$Vc$15~M*V1=%2x_N6hXAL=||oYmOHXE3J^qG8OYY03N! zs2^%LVO>>z)Te5w&xC!j(x`rI>{ocZ#w=s$Fs9^6r|Iks*YhrO6vV^2OSs0W`jUPF zKeqp0-RpB;E$r9yiAUqqaoN6ft=DV6Yhu5yk00?L#AAE=^*$bnEtrepXl`(tmdr~q zcH94N^!-X~VB`X6A=PHy&XbuMHqLCpK1zs2c068`}6lice4Xgrd)z|a2Z zZ}Wb{=K$w{;sw~jZ-!A zp}(hBAH-vO^1Z$<={LwB*9ggd-j9xv^Hp-cw`*S-1Lx|5bz7|k)o9zZ(NIs7M*EW7 z1~J>dJ>2O#5`R!*524{V+EkvN0C4o3fk?@Rg(`r^7Qd9t_Pa$)RGIeSa;qj?)R6V21U zt@@F%bS^^kjE_O%8HW8%-*!d#S^e`g8oI{*U+Zl0rhhN_Lutj+@z^G0Rvw7oz#tw^cv7HdSNi;!k?@1IuCm)Y%6# zX30ru_RspnBXI_P%>H?=&(d=HMIS%ne_&ZOU;4J{N8${|Zs+%}oW3Jt4EkdKPQLE# zH|Wc9`%Q1ZrJZNL^=-wE`X5*Z&3C@7`q8nd#@6-sz4~BWN2B?{X*x2-avtnI_K8R0 z99SC7Pu{=wr7@_+_LHA`^_>f_|KelNc%-fdmO}HZZ>xUP|B`5a>!Xpj<=kj~cbb;w zS;jk{eilLhM<1U{VE@zGRikZHvncw%`sf$O{+*V}L4=TY}x>Z@xT$<@GM?6GgFe#Cz{Cz`~^BYxC>IR~1wk4D-CV?P#s z=JXxOLpeM4ypJF8-#H&m%ePfOQhViWXxe@Ji2rg{G({hcv<)9=zh_9=W@^&?|xQ~%X(;*1=R#M!odZtVO7F-zOF&BaE2G}5*`9q~-rMe9iFn>Kcl-ve>&Op0Oug}2GT==xQA)mp#=$Mb$ z`}zRwp5D(0o@<}#XFhz+<}~Uv$l-V#-^*!A$!GB{w*7ru@e{AEEu3B;!mmT8$ zYhOAR9s9><4|V!N@({$c5dBgURXh?~ITg0UoW0b(G=>((4|keE`qKQDQ*!)>K7Q2y z6dXUYk4D=L;`mX0G}=}*)MWL0Ud)}wU%Z9=Wap$eLaOAixodQFF{{}(a=ZL zm-HL-^(n{Ca2oBm&3P)NP32$u(inoi7DqqW>DxTl{T6S)9IIjwjkfJ9!SOSlrn3~! zXM0|f=d(PUk8?b$M%tDs$Io?|LdF%0SL2~=^*f6(b0M*Hw6CSnSR81A*al;_ILxjZ zX&a0kA1S&j57KW({VaoqM~_dNyJfvyHPSZdi@4I|oW8C7a!r^n@9Zs|Q<>|I^i}?d zeudtCi`TKQ=>1Dy8bilwdnKm{{HXtg4+Lz^d<=%cv_466W&+qja#Pbt= zR&kmjHjVjbG^=`z=sT>rbTw}mjrwno&GCzzCdjkoKhQjl&(-_r)z33%*6UGKF~aeW-YG~eMucxzb(jfAvx6C27aE$&)VLP_$*$-zK*lEWxlj#0*%%4y1n`! z&%dBq&uL1{Is0h3zPF1;+XgYefOeSEw z-|~E!=Wlqv)Ny+(V&1@UOZ=$+z|VK+H}rnQXW-{0G#mB$EWg6Ov2Uw>G)~ogkA9P0 zeMj^BE1FHcMsgm+^D>$tPScXuN=()7MOuwXo;Cj+&ZX&Qu5BrO1u=YyW^=F6m~||w z`2qbFz4{>LSI}(fG%blg(EJ~ot-MC`#jDu2cJ{W^b5Q3x@220z`w^ez7udIT_EKY( zu>|qhTHDV15ubsd3(#!e>obU%b4$8|(`fv`T>OS+NAE}GrDPt{oxEN9lCgBShDvw# z8u6q4J6wOIyY$gW+u}ctU*R-C{a~u=Du{=5obKxMrNmbJi|tBhS3l}M@WWo7?&kf7 z&%h7kt$v4eq}ne2!G5*xOEnt9-yFZDk4D-C^KR$F-JQNAHBkJ8?b<$m)W2$|tLnE( zEoP1FPwdxwKdRBTe{lSUJ{oPS8rEj@Tcy^Q`urXHP2P`cq-|$@#=D2plv+PhGX?hQ zw@uBz`cePXZS~uxBWtv+YHXjp)%6?rWZ$cP+tmE1M%!|ps(#yaWR14{3C$hezxvU( zs`T>eo0?rU+Ez8}&(-glj-)TS z#z^;cF_gN#WIrivZ`{ji+OkLK-WAjabDi$(eQKS|hkYM!7fsMs;~9p2U$2+gf;IRC zn*E%n^*X$}*MAD{?|GQ`5&xZeu^-?y8jr@QelAA;zh0k#AJ$8HV6V?0hs&Wk$Z0g6 zoq4by?AwYT^&gD=P4q*Zz9o4mUcr8d_b+{E4CN+PzMw#Cb6j&qu}=2`L|#KXRw9^WUnIkBJM?V{1PL0`+GKe4ypAU|)TImu~S zlB>=f*iY`$m&TxDzYP5;UN3nF{BT}NPwnG#cI>BlyJ&*8AEG(kYqT$kAsE*?=+AKa zmW;788}>8%^d&JAFQGZhY1)!Q&248^G-vnmqy9DK%h8|X^%8&JhwF#*++Lr-xZXu` zp3}5sjGbAqpYPj>ANAiJljDrd)=NwLsQ+N>E8z12r`J4`I<70waE(>1K^bEZ57$m9 z`*Nj`*oqgi5A*(|FO8x601f+2)mHnG7&`+MlA(UJ2I^mQc~=4s@9 zgTDSl!v(#Sk6q=j8A6tL-I}ZGdy{%)H7>Xxp_fQ`{;y=hw zLcg~-eMfRtJb`U^A3x&1Gb3$p^=;M9OxS&W7LRlMkv@LJfAJW{AMT^kwz{{B!2fMd z-;&xc9>r!4#?h8sssF-avHnKZNZZ0!8%B9 z@1v2nh1HkM@yLFpZDIAo9QSCXZE+vRsmmUXv@P!CIQ8A5k+#J>9A};MXryg%H^>EKoHJ%IbLv2-h^~v=`I=qh`@!y#N%|lMp(U@hg2+mC(p!aLPH3IhQIvCf5*lq1u zt~55TkJ5U*>$oJ&g1s%R*Sq*p|AFQr^!3^oeVgmGv|h{Fm&6d%*fr?={!mK21$_-e zQ?FU=m+Qy0UhmqM#87aqNT2aJ5kKlb&|HkZUe}@z<|{|z*R{@Fo9o=PUdtMf#2NH; z3Ho|nYrpDeB{Y3%vfwxyy7&i58#KrUe75XVgEm` z5q)QR?5{d|NAn|fUcQg!HK!?c-bY~f=lvj_kFme*`;vZxzFKJB=)VQ-z`y$W4E=lFkN6D6^*I`H zYU{lv`atsqnh{GX)(|Eo_&wN*XiO(R1*P&saOjAlegRx(ZhB>JE zl{^G7e}#tJReednf#z#8e)9Pj~c8;^Uv6vZ!YJt~@dZ&yFkwmk}( zPk9h?;78iF2RQy&AC0taleg&eJ{oD;X0D?z`e>wWkVDI-&G$(8Y*S0omwo(*|2Atj z`l^pc+O}I9|GJMx+O~6!f73@JZQB{g{oWGfP}&BX|IqurMfE`)lDE`qi?MgePhFGk z6r0~qTH;6j2Y#5N)aKs&h)?xn!;Sp@qdtSVxDG$opUs8NOMitUe zooU=pC0B83%(6CvwR{75^Tk8gb#V=L>(Anpm~||HhCLy(oQ|Xq_PSNj*c_W?W%A(1 z8~Cw!Y`#sSK2ODNwPJSlBYSD!=SK84A*L6fL4HO>V|9$Cqq&+IyR8AUt44BLT#d%o zoB5Z%G=@NP6ME`qWPN!ScKSAZc@9i}6`u`{=2f1UOtD+g(_a*bv(Ht_4Y#gW2e3oZmAJ_ZWz9fduR2=u`%8vRG z|AC+L@i|_v&*CcV<2!p>@}qexxo*lP@NI8^$y1f9_o!8W?hD4g8kz~cPsu~cc|4oQ zx7B!bysB9a{ltCr8jsc3Bwi!21^KbM_|<7NSHakC!Ox^lqj~5|iS1|KR{d!Hr=aa* zeKgv35Sq#RXtXWIGjx{Qj`k&OgFLT}p7vEeOU^sQl3Cv)`%(XlHM22{tkJgQHKU$- zG}@N=$yonA8fjZxiH3dFG;PVV=D$N-WYhKWBmPVFv}}5(DYZ7FW;)beHbWmj>YrN9 zX6&QUwycS4ral^N%X-RY?xT^m?NiXq;xuiYFWD=CaV?L2R;LffsAFFN&1_yH`i{oK zK9|kj8(R?18ffO|jjhAplg;Vdsvq%RTKseQ7&IPISbJZCeUeLEyKN4s84w{90 z3^&5{9`!El_tIeOw_;z|_a%8KPr<&3_oL%F75iMyUR(|@>f4H+z`yya>u@c2F|S_} z_G1kCS_%7Lrzy2x9oJ207WWz*id=W%QvyF z*2jg}qLxh}OY+XIL6_FD|YzM1!< zW0#ziIxgxf+uZw+F}5`xa+7W0eM)TQYuLB+Z8aW=Gl=I7rYi0e+eP@<%G*VwZG)Jp z{cLOBuf!k3%)DjWc%Kq~c^vj_eOvV-ISKqQx7l{ykN7Mu#J;_^Ys@+p%^`E1?cnw5 zQ#H(gwxidGzPJGUPJQ~)7*62$Z(gH*)W2$m;B)6*eQ`eaUA$e#r7@@&0jJ zD)!x+z0}%x4ZE+Iw)&w4v)#QP@mZXQeGhNfcr;G+L!D-OdcFEo4gF_(d5!3cbFuH; zr!S2`{ZO;nK3*?Ai*vB=+sBXkS3lHpwx8FlPt{m0|L!%SFV3dz{(btA7=pR5^Xvgm zuk#Yjg{_Z2yie^{<6%u?|MMEr2kVRTPj;a1OV(P@7i%ax$oo;B+8664JJ@SPUz~+~ zsJClvXin4*Yb!g%>(!@fc0zNg*Qj1KtefmGuMvH5CicVo#G`SlA6sXCdcFEojjgS} zyhilJ8T568x9iw72K8fW@o%qJpQ^F-_m9`8UNyEB|MeQt7pGUJVRtUpcr;G+!y3(w z^nS!=aT>P&yj}f>|Ke1-N&0A{ZE*^kw2wyG7AF(KQGGPhwy^W>(S0=1wy-_+m_8b5 zTQK%G@1v2n1?QkR>!Xpj1?R80-A5yBi(}EW`e>wWLA-I+fqvfYa%13J$-2m^pi0+ zl}7zYeFlE+M9+MW?6YLt8MR{ea!t72>lkZ&jnUS=_Qp>Ajofd+o{?GY+E}D7jUni3 zE%dC1k^2q$+6N75ukxw=YCN2y;sLJ_eZk(Ao!KWIiL-nK%~?JMoiCZkw$)q5`_aBM z2Gwv5j7RCCR}JU7cvPw%Q)ew^cvlKgjdi_~ATS`H`F#oFB4t zy&s(~&71Z`Eyttx>DSiL7~ZZLZL1p2xAB;L^tRT<@^;l|Th&mf@z}lk@@2+#p0k&l zL!E1UX6Jj2=7*T;wb0hSIJd{+_`amy;t=!~c)R9MbIbk^kLxw+NBjqV?!xDVy*}IO zhwF%VygokJAL8-7T{Y6S)UmHaUl%!jDS2qCpP~4ippQ@XsCYteSBZ4~p z#uIzHYP79t$Zb4HA3b#&PwMTek+#9u*JbR(oW9gNX#L!d=3=jrS}KOp*W}LLmif|o zEMKDSCBCitQU5v@>!H8Y>oqp&B)iPpRU>T+<~qCF$MYAlP3Aa=Q|#?O(G2RN5qmJM zq0M-Maos_`S2#bVj`2n8S9-f@Bq!}Z&|Kv-+E);pj_YsqS9`sV<#+7Y^zkG9gZ%u1 z{#vhBpX%psG}ra|4E+3y=6bJDpTA+h!Q0i3_%Ag-ccQ=1=}XB~(AR%xZt_00-(Ruc z+@~*zLH!g+vs=7geg1--b4+!f)tJS9sdczMde%dAPLY}n`ijv|6QpoG z)f-#;C+trY+6UnrFO!?MucI)W!zrpLP0D>O}qIAESA$*Jp_>WA3Z^)Uj(l z;5(xZdNkUWcr(^Xk4D=v?u@;-N26`YS;o1lN26`YefCNpjkaYDv;XU(k+#8nwa~xn z^o7h_N$q5>_3@+rsln{^J{oOH{bq0U(P&%NMD}JMjkY}!&0Aih^R9b^`mq{&yN^%S zW%iD@t47M6pQ8E5`w^d|j@{a_eyW<(Tn)!go64>lXZHd1%8}`qgJ(rkuEJ0rd`Y(F>ZU2b0?k)WQ)-PJiTy3#R{e0^ z$iD9NSq{fu=ZCSxQ+l78E6ykJ6yB~HX&a2I#OF6oU&t7Pap5!j)@j-jTX{J4?|ff6 zE*-DNLw@3^yk24p=7PD(zIPg(my&+tseN1ZBmP^n()I`6R{W^{U|hq|lXt77wu~{z zPX`TiS=F25Dj55QXgJ@PM&~!^>mf8;i&T9LZ~6`T8o>Um?@RkV0Q+y=uA2X0_iG^- zJ9VA??)16jA&AHJoIjkVt+A26>`!l3jnrpr7Bqi(|I(MnP-x7fp#R(H3yHrx4EsOM zUTO}duG$*UBk2F_jVdQnm~8x3o((x_fFv!+cj7)vIPgG|XA0QN3y=;_&odqxxDy z{S_0VnE{P)tv9YU%zH5jeKAi}U$q{4P-BmyVGc~wmU;{7XCpMsfoZgs+U(gmd9T{4 zA6dVx8PSk;(*(64H52%G0v&TOvd_TJmuQ%Sk$nb!oQ(a$8s?zVs9rVCqG1jyjp|kN92(}V(x_fF&!d^tYgDhA7tl=RHL6$5i)beI z8qpW~VISn|LH$Tw1$ll6{S@Ah_-s*|`IOF{%Y5lPmWQC3%4tfiu|u)@y({SJW$aV? zzO-K**DGlJ-q=>XYW@$6-=Eu}4`Tibjo%M7{ve)L(fD=RR-fNtx3x*lw^buCv}l*l z=<_3eX$(PrHby^FZ?1}cv9r%wU%`CIJeEVz%;MXsAIX1PV}1?&tWK}-2Qhz*W;UnE zHGXoI&+hG_(Y8TfucM#C_oe-Qi+xUSSB=D3?1N@5rwPU`IVlfDGq=-}I`*O1eNNii z*BjX9>Fu{gz2x&cd#>Y>@dlc2(9hSa5Bho&&HTPE={JaZ6Eq7rjmBT>jeS9955_Jz z3Ho{q{X)Jk?bqU5*xOYjIVlf9vxtvD$#eRLYRU>g0d*Od^=Re4yU%Qxd}peex{%4>WduT(MVQ?16nH zXAf#aYNk8@&B}hfL*RPsGLNk(u&?6%OJ5p8;Ab=RtM>YA4Z^-!A3x$h@UuDk)x96_ zS?rE|4QCI=CF2eH`T_l#z5SN^V_(br*S;htt;x}>?c0hU^&j}z0{uF@K8xM3uj}kV z%rcg8KQ!z4w(3XX4C46_{rY`k)0lrkvw_!$KIm&pG#mEzTkMK`BWDj{ma()ZL$k5> zFMVm8f#zrQoAl~~z9vP(-ZApES-CIvAq=C87=M%!Ba)IpC%+Lk(YY9yz&OkYZ_3e!-RJ$}T0 z$z0{schy$?i2uSgtdkx;>YuvES#LcWZL69o(6fJytZ!MpvCo=4m$}e6DyYqz^H9}R z{iuKHJwLFIM%%J(@`L(lw5{dj;655@8|2XJL!G|Vd=gu{u(zv5@?Y589nz;SjX^bb zJ#c6rz3qXAdAn+~t(`{>@1v2n!Cd@`{s^bnc`0>VU%6QeoRX>u8t zj<--h)1yDF*Jt48cQmK>`Yblaeui(We$>BeWQyr`bg`VFyP=ZITrHowfbRX^gtH4&Q2eOvLP z{sTXAqrak$Pwi_SG*^0!>et79mA9)#+pdS^>OLB6yDpk*`e?N6I%ux#qtUi&qq(k+ zM%%81=K4MwZL6Aj+0O^}(XWZ08@ydL+I9^zH}=tJ+ttzB)JLOjS3`4iAC0zM70oSu zG}?9*#@zFf${YzgOL!o{aM*mnJpUYr>+}l;7ZB?@f`X~D6m&X32 zx2s0ms)luzKh>)b#`PbXr=2F3F&0ZZ2bA`^(<08f`l^npgU0wCz}E{;!Wl+m4Cm)jk?+I|iE9`e?N6=xAQ=qtUjbp?RZ^ zM%#{x=FL7DZ958@xB6(b?Esp$`)IUn2hBTuG}^XA^KKuFwk^=S*GHpmRg<89zmL9+ zeT28GM%$_;MgKt`J;j%Q=U<_KE86$k9*t@3X-%`$YA3 z;oxjt{;t>h_`yeqJu2n;z&Kk^cp3N#?DX0F4G!4;Zc6pLA#idnua8DU|K0zK3MbcL zKg!voVLY3E#@af9XRcR_tKXKanQM>gyXfS#`~7y<+Ew3mH$IFpe9tp;*xDBU!Lj{@ zcFp$P;e_!;)I#T8*!qF(yTdix?@}gbV5g=^_N9nx5#w~jhU1NR&3+nDn{D==bg<)i zo z*KcsNcEfg!5I>2HbvbY`Z1ZAk^uC6ptFSG>V+{P9z%y|hM^`tT;3wOP*X$F;FnBY^ z34Us}`L4d7X8X;TJUD+uu+4GJ_I>1JTx{%Hokw8K!N&Hz zaIzcmQDaz6+2vL6do=cm(98`V;n@COPR-Td zmR<(?#Ek1Mo|ko8{XJ>V@pHsx^D_xGb_+bImAtU%<}bn!wK_V{Vh0h*Zuo%aKgM-e}@oG=|9_?c2hB5YrxEtaY~Fe+y4`- z{s#5b^z|#p?fe4AV>N95k3VJ1(KKj2g6-T2+yB3>IcCnQzbP~=c|HZ6h2wC1eZ%Qq zFl#cJj(FG~s{h9Ur+W(%Z)|fpfQC7&*Q~DJjJirULo+=&To_*8ad*GPZnd6Y$}@A8 z|HGuiR&P88K!B07khBR#d z-z&Ki``q+J4icL?*#3`K&G`uQHg@K0;BnaU3ETBT&B;BqAx9B&SzH8f<+!_VW4AR> zUE9n@JSF@tHrVRE=5!FRPvc*uFoQ5Nos;eSHP5@7TV-TywfVxw4#1M}DZ2>N`1bdO*W=%^NR`W-#;q5WK8o zyUwlI_PqE+?2FSEamMUZ#`gE0YEE9k?;Y5eV2bYI`31)b>!RlP3;Lae*Gn?4=ix~m z$6q#_ypQcM9@KL8x251@1hz+=-M*)s>u?Gq&$0*PI^8>%Fiq!`O*4AL=+| z?bmGAbjh~Z8FS}qcr(Wt{nT9j-jv13p4Ymb=gA#Mw$40f#1dc1>*evY7JQ}SY?p=; z@|@m|eFerfoaZMTC*-;2nEq2+gVacyxKo>7INrSB=tFo6?94;Ud~E1A`l#XfW5zf> zukqC;&gwhBaQunz*}NVT%_?XPgvWLqpVP2?$2J)iJ8NYi!~Uyd`(AC$_IDPmziGc3 zV`ptuzuN-aIj!bsC-iU9mbz|H!|_{=Bg>m-`+E|}aO@oK90W55#u@R{9PNpI1ok!Y zvp!5Nj3ef`=IZZDjf;(W=xoHZjSH^+j+E#4JoMvXUz@QHg(q+vpWm=uJ5=BCScm$t zb%c)yPS0%EuIsDs$1+dt*Wg*v!10d_+jqSa#&74V&R_5jj_q2t=JZ(fW@k*@&-CH+ zIPBXyd;Bvz54-_=y$R3nIR2&Kgf*Amhnhn`LS*+oBPJAweW*hvB58Ir=mZzHS{2a61BKE27-*A8va+2{dyZyi0 zWGr|)#(q0&`vYwM*S2OmSL6?4r=E(1;l~^&)Md@_&Gh>`_GyWSI!~W=Z14GM&W?fqf(9i$m} zwmRPx4IGUrd=mXqPZ6=S_Jsd+9G%>7@)JH+#J&?_e*<3Jal)FaIeVR471-I6I`_jJ z#~J#Xt9key`!3|i2Jo%pcu>R18N_ChMc!_iqVHD`Ny>whro z&p0}};p%VyGfvyrOUvWV@!}#am^?u};F{QIRj^}OIek&lgvFuOGtV??@VVvI8 za6AsScX%8?JnSLSyN=^=8_vF??^$_GZaS~RvpKf^KU#CV3prl^`+>x>7R;Vv98+gC z+dYzGW$Xvx$8ut0hwcC8)tucLm2zW^ftygDmM0x z?r$Z)c5Ri7?(BBoB3%zY49&0brjG457HW=ZlQEwWbyX<@Nd^}#&*qBb215S7@O_=h0O~!VVq3bu>C*I zWFzdS(APKcCXVg@Yu0SPZ)xi`I+grf13&3FeXL>JyWbN$joSDGeiH*6bD-vQV|=cT zeE>g8!1Fmy>9c0LCe9whPJMO%UW(P)8rX+Bd%Pt+S-aKyg5_cISG_OTs$u&-m&xAP z&tP1?!23G3{~uX%%zReA+ju5(aT)wJ8aN)_a5g>tk_+3XyT4Td+ix0V<2ZZNBJbnD zXY>3OkLesoFeSF5wyrsK2PVW(37~4@isIPJgo~a4rbdiRmJK;Ha%uIgH z=XrL=dhaNGme?%M#L@kmtFYBnHpJO8+Eu?Pz}o2kP63?ZyZQ|U*!~YtydQdMYhWt) z0LS)!eQJ(hhHdhxwKlP3Cp(T`X*eO)nEoT;Eylzz`7%zZ;hOWM(Hw>S0{WT>KE`pr zOv5R4Vb{3TeaI_e=B&C8`EbL@-1r;~JGx>*m^v`Fdv7({d%{ z{3`KZhuy}-9A)=Aj$aeLjec1h(J(YNPs1I@w>KP7V>S=fd|ABHI*x`nZ2xaEzL(b* zGj?h%wmF9F8oy?{Kbk#({SxNX;;~wV?LB49+59kVqDvXqWH5e>?c7+i{hx_sV(i2+ zFc-}FG0sg)>gED3vB-D6xJDTAzc`~-^%9>O9ul^p<9gOPkWxUw~*w-PR7hw9S?xlR$ zaIz9UFT#E|^F9YW%&}d=)|_v}7;P+D(ASDEb6{-$C!^-*2gbP#_It?BYw&iCqaPcN zi6fl{`@PHsb)L@WI9|75yZ*NOmC=3p*$gID~4*`3&8vP!Oo%-#}3m@Rv&apM8`2sZ9i_W zg8$5MynVyjF#J;A(PPAXB>aiv?Ba&=1M&Gdb{+%NO?-i4`#%RYM}N}SrPx_Ft@q(8 z9Y=pPoc;mxsNM^khB~X>n_FAY`E2++2m6!sH7HTt?JF=Ng!~H_jMm&34}~z90KD#JnhMYYmPzXt;YHl{M30ZWG2A!P&VD+w1D{ zN#?0_Gdw*Hn=^ZO*3Zy87Tbgz8yi35q2}~!UfVuEt#$wAEu4OX{XA#4`mpbU*k=Q+ zWnhcf*3jk+CtFen4`O?f`dJ>n$8oZi@PF8t*XSiQAM<>uoeN!$#FPK8n*Xy`PJBou~;9z%5lQJRC7KbHp}gs@RlS8`uNh)Ny`d!`Zj^ zoC*88_+dV(`zmnv9t&)LW57ONiQdD{Aefpnw!bA%b4Ja?Hum@NvkrWX<7_wK`|*E1 z_7P|>D=e;hM*e>I7D0%*l^w?U4vrfYidti<)yN1aB;W6B?-BYVMT@|1IV*e07 zbHl$ow(m)G`Dgs{+CCR5Ex+W^IQ^yJY+r0+@?hO`HsN_R$JKoi&-oenB-ha=C?b2{YomBUHzGp7}gD>YeoK4hl`Zs(rcJ{E6 z8cJ=g!724tbNBugbCwgk-G8)eD_hewC)8NFIJO_j59>T#&~ZYI)ok~(lXb8&wt)-b z1svOTO3m36=-f_n{xaq#BKG!!F!?sNT-KZ%j!)(|VjSK7+XyE|V7Ix3^JQssENrzp3w)eo`Fs) zR%;hWZRXL|y4??or))S~huGf3mN2e`;8z{n=lM0)-(|J?0i8t|^GaxJZLQyM%skk7 zwtEBZ)nWQJw(rE%Y@emr=XY^Vt&->b3C9V3YPR>Q(frtnw{<4Wn2hcHYR&oe#KzjN z_v-_v!LK{cZ)iAO3O!?s3&zFzwEP;UOE+xunLN(xE$~AfCJ#H#w-sK2b{As53=L}{ zW*r*mD>j@hz!)v3*OH&f;X#h|enoORZDyuT$=LUU(HPgC!Bu=R_GPel&``_y;*Jy6 zUClA|9aGEk0C^t4^Bj(2>b2(R?x?DFyQk8!*k|Pd+xyI#bN1on8rqD)xYmZRaGdWd zOsyu?#>UQ^Bp*1=$z{#SxQzEI+Kx&*fAT!YaWY=RRo*}4^=QQN4L)9WY-6rD-vFPi ziP-ku!OWA@DV%TEa7@iq*WzQ)m*snNG;mB!c6m4ASqj^jXqf-Z<`0f{Z@9kq5|71v zO^5%lI1Xn^G@Ro*`4YcY8_U7OZ=Ca}xxQC#-$yAD+TVpAIGIeC@up{C9|sNNPLFe( zeA}>HL&YcH-^P9^e5B+2frjJz&_Bg%^4-1|e%7(Qm+G?lpbo0fFBq@wPsTBiE;9#q zO&v2ot)JjG99ynyuJ8TE;}bJ^vCkWf?V7Y^d#@f%jeP?AP&?6-j-!VguGTtrZ1V1_0qb5ex^VJ+k57k<4uTd3GD1E?ImIMFJpTT zQM2Cb=*)+GAKH`8Yz^T%;TG)%k>?A@i^T?8&DLDsAGY&G!F=Y2qJfh|8@79~F@CH3 zSPoWmoWIs^avgq;;x#_%-`+A#uE&--d%`&Ex;&l=&5ZC_j_otXnsefdZ9b^80gL@U z$GPRnbGkQuu@-NnRJEJz;@pn>h0y5?%1eg-=+wwC3Y zxihxCwdRDm%`89c2lel_8YlN--@w`Ja}2wOSlu5R0@I¥7+VL)84o=*eUI3iu1h zc70uQ#vIo7-#W}o@)dp_qn}F}u0Cu3fwt@kt?hXJ(XoBLUUPmDyfzQ&Vqh(>cHye(>C0Fb#F?G{^1!iwBj=yWTzGo6Igr9Xeb}bJ$V=dHd zp99!=D4LC!sfUDd8t20r&PKq@QN)~e7+b=*$T<6;VarSY4tDxz4Zv?ZwtcPU`d&x8 zFn-woBO4cNYq#cPEA;nZXAi6YZ?$ob}yV zzInv#bM1ZLGaTDJ@|yEwv8~TzF!`a+ctgkeaSbOs;qxZ?pMaRx zfNyl1?A)+@wrSs$iWg_>&%@I=&b|^TgV;i`F=Yt*R4>cVB3(v!2 zIp)j8H=kpBPhWFlHTVRtEoR!3w>Uc3IVbIHKuJli^ib6Y>2?Y(%;80`O6 z)qfwuIN2NfWzJrIPb^-M9KOb}*|Ed+`F58Xligp6S3JSV z{=%`H?`zJf(}XthD#W}me1zkiTCG{X1J-#DJ8R4GYu9cy+x@ESAKI?UHRR#&caGCx z4cGVO?Aj>jc=i1W*uGm+b9xv&l(wtmXIq|GqsA#dyByPo`0RSC_!K_FaheFX;Ty59 ziRNqgR>yWdTeIF%>g>XCTLa8fW^2=PLR%X{ycT|_!RkE=Y@hAdoS)0<^U$o#P=>-6 zIL@)vT;Feu*TD~cRM$GN-4m@jwK=lAXk9el!mN$z^UO}evF#^YU|)|p-3VsxjbrAn z%OB!%Ol<3;p=R@O9os$BF0&t`%wxO(n!&K`VX)ng?=rO>ZHx_Vdqx<4)jqXM!|CYo z9j;yRGkm-EL2cGt-v^8F)gu060yMDAVa>K*CRbzMgnDKy)ip7kndW+DukT;k8fzVl z{Q&H+eb=YvYVWxX`w(*YE5~keoQ~CSec#EhHCso~mYOrRYs8xE8Z`O@J9E_@4gT1% zT_e`qz3;?)v`)gl7#i5lRbAc{+dDkAL_>Yp`ybntA6 z*%0PsN!n~he#n2y!`Q9|YfdMmo#k+A#{MsSrQ>v>hVAnYtLb+tG1MzH3hYrp+GMx1+BQ;5{8D|1@l$`^AUxni?6n96rQxKD=T3Tq395 z?fqo^w?>T<_R^g7Z5%&AZ1fisQ~NsjKgaQt4R`N@5o_x#`k4m}Y-_#dG=ne1z7u_Y z0bk`f%^R-nx7oOMCT6R<-5uxjRdaj>JPMCph=*L+JsxBGjH~8!a(tf4Yv#YSeouFt z4r*9GyX;U8_MNk8|2e+lbP8-I(U#+73qIVjUANX8+dO`comktVN> zar|_{8Fs7tcqn;3oqo4=oZZ-P_dXbVLF-EFgV4ayBMs;8V_T62u?#%M^U99%5yH0+ zpB+044Yia!=s0J+*KGTDx(I&nr!V46S9ffm-PN4k0W+8OIZEezxaByzv*Gwy#z;T$ z5saNViT-pPAJ=elIku7q>$3iBapUU#vH674#nF?$>OR}FFg0740A zz$ZFR=Wn>W2455VQH-6nRK353^OG9Rn6G4MULVc4$bUi}j5G33v#rBy9sKg#ULWRB z?c>y1mp{kv#I!vI&2um@8Qb@&YOe2JMU1oiyYp~DJ;Vt<;qLYSAmSm;YQ4ePHNwnc zLX4L04*5(hSC;$X4X2CY&*p;Mm#n{t+A&TC3(pL%i=8}{)Oj?-aXL%GF}8F$UQ=gn z@|03z#&#W0v%OzTV(g=n=V2Us(s6Z<)3be!m=5LG2@LZsn0ct~S^p}$4YrqfFqf^B zcz)S&v~9!b-1s&>YG3r{P_AuxAY1#PiOM^Jg0F-cLJ+99}}+Y^}k`0}b2$k^G3A9G8s6 zKDRJV*J!wVZ|Xei`A+NuXyEMSh7-cKdoVG3Px}*|7j$fO*X2=Z^C!aH(9mc0rDMAX zR&)3I;i`eF{!=N-p4H=MtP zo?5Zb{|1Kh%=$65`!O}!-fZ8Ai7z6D*T4+a*gjXRIX?&+F;@4rwuGtk>b{n(d(Yi_ zQ^UyNgS5B0g)?HPxjF~h7%ry9R^ji+`&DT0VV{*6Ckr)fYc8_5ucogtVe(^a_q%J( zH>J(5yxxLwEe(?&<9tZNDL$iPXh-dogW#ha+k4h76HB%%_G{5F@7crrIX`Dm|~ z_rTBbfRoo6PIp7kUJ^}5U+cgZIZk&MW}izw!~czF*c+0M9H(nH9PNwk6CSMB*2X-4 z>Nwi3VXM2G@z~mJzX8wVIR07qa%^MpV9wje@;sVjtCgBleC9Lxm^Xom$>LAym!-si(+_8P1rDnU1&-SG4z2up_ zH?w%)cxc0Vf3NdC{uiY^bztYBn$wM7=ELscm5alxJ5D!l*y7DQ_`Z*L#)Z)uTkKu_ zg!#Q0JGm{M#>WGWtM3$ePWPejpE*YDb$^S^>X5aNGv8)U=7-0iEp6)GSujqhS=)Dv z?H*0K1Ns#i`*QF>j_tlomu>A&hW0@;R(pdS+k3m3Q*xNIhU4MHLtFb!hH*Ny;hb|s zLLc^-Tjw(vzs7mea59+JM`LHMifQ2E94F+n=ImVbPhfupKlr!(+BiF}VS68ykt4ew z(5A-ha}i^EAJydvqUt-a@nh8LKkx{S!}b4vF}Cw|YGa{p%J1P#9B0g1m#O3A7wp8; zxe)%?aYpUd9J2>x3)9CW#B&?W8ZnMvY&c_1qO-A4ubrjwzog@ANWI8HZcI2s?HcpiLpOVU&NWs>Nwr1;bb-1T!EcADdvH%bZqOjX4|h*=F{e< z&77oGJFxA)HK*sGUjo}p^mP!th~t!;b@?QizU_TZ$sUsvpK*G!F!{@@#$G`~44KUr zobJ?cMl8uH*#D2QUk|U~IHOj&JP~a!cX^|1qx4$GmXDgF58#rvuTt~WbUKFP=);D) z_nFzVJLEgL1r2O_aLv*5#Qzrd*YPtd{HEh-{yb+>;`4JKPXT}DZYEa7Rjn`Tqs!aU*NfO!WKLIx ze{^j3ZEMbE#P%zXIT<@XGWs^oW@^|z>&R&z6L0++UdAbPk}v1%DRZ4&O55qstPkJj zINhsZyWyODkN$1ik*Dl;$5GaBiY=RfwmabGJ^J{=u|3xuO-_5})$XmgXj@$q!_lCI z?YjWU258=8T>rsqIL;?(IK7O%cvO8I1E25vqNZxL_bB!~Ec=d9`%s=Iacu8-YPRoU zXJ2_gN5bUBe5RK)94$p`mTP>qW`L;`<7nxIlOgak_tSKU{Evj-ba|A)`zX=C$c{#SLJ9w>Y`J{I9YKP5F|pYt21 zM+jey-?eCK^K~M;qT}?Mh7;;1`;9gq5i|W}pE~Z|2gV)`Lew<#&!)?b9yDQnIFp!KC_J+r&kG|j?W?3_dv5B zyq@EfwO(_wD||h6)<&^5e4XROV)Ja*P}#Wj|2clngvWH8-qLV&Uzzo1_wZWGTlM)A z9O1v_dGEH+ zAxH5yXhy)dIgb8rI6WWzEZD!LuS4Le9H->G=4f{KWqeiH&cijQccI@N`wzr(A#AyWQ=50scJDKN2m6oo zMNOpdIkxZm)!h9)Fm>G~5AkF?;AH%UE%y5Jnt?lDVyedUQp5IsF};!3tb^iN_y)%b zbx?DD7&co2zc8ovyp7}h@P?BDwmoV$;$c4Wg&ikl!|8B*o`dcc#(o9N_^WgGL&6Wh z$Iy0mG?&4rIJPxWb21d478B>5`gfX)6PsTi#ukU|-}e2Q);c^}4&i9`hVvQV%X$3H zxJKuh{)}y}t=aa!d~aU=L0>z;dpb^tvCHH>V_xGw(J)8ZeU6jK8&01j{vYUnI>tqg zv)FO^l<=mEfm*Mw{g%SV8;;Wb@I`^J&w z#82YiL&^reQQt!ZO5{V#r2cGevC8Xt~p^IV(Y6#4)I~%pD<3C$C}d- zv|;Sk`+~>e*BqxG2xH4Wrd^x9Z2e8?IJI`3>uX^99>&1<*eySBK4-(}y~MUJugOzM zJ=(R7af;8HZ7-?raTL_gBQP~s?SJnJFM!_0LQS+MgQs;IFW7K)GyStZlMeHB7WOF| zXSXz*;@{5qc3n_j4d3P1-dEKeZw<5ds%v%TI(pEt?b9{edy9-ZO9t>`^+qikr(ZN2 z9|a$b|09TbNB9uO@zKKUpH^q~9nki=@T!jOv;Qt1PQQQfI1$Zu*vX->`K{UJIHpFE zQPF$_&+6FbuVy>f*?s)#I*RdTtR>^r^6WWYgV!_Db~OCV2hZl%?s?a2_ouVPX*(Tb zC+8XK$JqX#N6pDH)B$r~pA8f|-Q?&Y6dJDE`M`4NeE+)3~}f;JLmxm5j@}IE3T)G`9CuHQV)m^c}Cq zBOWj!chxn~B*J&V)^>a}=fU?ow)?F$XTz~k^LC%Ua|O@rTh%>#%adojkC0tR8+^Ad z&(}G&`vNs*R)_mwp9nwm!_1SheFj*woe%Q|@H-)Sre^GOP~(L8t=ZmJ#V6DDGV(JU zZ2iJHYp&+*{VVFaB+iVQvwKr^%~-R2MrG&Mgc#aK!Q{_4zO>X4oF3$)v>0TC?{*#wq@5 z?#|0(#C$%-ELU*-Udh<5J2HG$HTD$zvg7pQhP!K@HQHt_q66>)$7?m5Y(kvRV;{s^ zEXlDY94DI!Gj3b+$rSjZw(T0i*v|Jgr@zv#!Up%H`T#NBcf5!O+ z4X0nBzmiyKS2C9D632EuSaVG7>>j9nuF_^)nXL)fzK2(H!k&}g$T+C8Vomr4$9C=6 zP`)>I87M|0wonLFNt_5ulW#$?wz)tr6+lb32v|86+B3VnvX zMLZ|Kx#Q&OhHZQaxrsw!I(Andj&r7(dC3bhia;a{*W1 z3G!_3J>prg&&0UihuJ%f?Yh6q#1WB~WM(uL?>CO)DH_gpM}IALe0A2tZgT-=do-N0 zZms`hR^~nBc~r;wWDRGJ!)x;(j?Q&Fuj1IwQ8nkA!QbJRF%2vWf9W{iyy1j-h%qO# zljk#tgL*YiZf-c+AHgWt=Af@3aN)SRruJN4S5&n@&g%E7`o1+el{#6Fw$x3r4?LIS zDH|ERs8OCgE=kG3Kk50xmFY&xhebSF{!v0fpPMs!e@}TZJQ?s3`?DK2;OsxGce7$2kuheYcTg_}QAdhY4KU>OiOx!hRhY~Ym zu+RTH+rr~Gwrh%->wDwXJ(Hr?FXneunRHY}aHp=T;Zn@nB!* z{K)gpj&rM7&(U$@{14jh$XpP=ttI2=_=e;C@M(S)p|4F~=BfHV-2M&M_W z{R9mh?b~pMPg{QxHQw1BUeR%OLc=+=k=&2n*2QY@-HvnX({uDZwwZWMu3J_kHs^5k zLc?~h%4{A7Qyc74nbjL?=anvxPi&K6TbyyRzhzfDuC9UppRKb1o1<3S@MMzg?zj8l z?!}4}cc(xp6nB^6?(RLfb2zvccXvI--Sxl$io3i2_mfO!(x21o8s^?--`JZsnMr2$ zqvGNev`IOZrYzc`@gXiwZP;rZ5TE5T)LF51O=K@0SDc=Ym&8P8Z2FObE!JF;*ixV3 zYP4msp+3b`kuBxdygV`4PrVu2eY3;8$aYx6^?GC|?OKm^twTPr*|XvDM9N(Qow=v8 z2fR|`@}!0f`d$0GdcN19-?c|8*7`Pa+UF@Lzr$E_4`2hA12TS$x_yVX0yfveUq&t; zZ@4%I?EsDyDQg7he?%_MZMdA9x~aYQkk7=h`~a&@66-$9y@f`5+I;8Ujja8o#2QQG zVH_({*3p~~jI4W<#EOgJTRyKsJ{JBuvYDn~UGKGDq_skay6C+Kae7B0@SN1G4~3~&-6=Txib(ZcEuWpiRBMZU+EsO zH62W>iFIF@*o>mwH%PZWWnButA6e_d#Kp~|nIC-v@;MWpFLH59!-{Wz4*G`FXAbz> z$cpcp7sOw)pl^iDl<4C|E*EOp<6G^olpEti;=)k2*yH=eZ|=LvAw8O3O*omv2eqhXZ?}r zn^7O?uXixS<=~7*7e(<9+UD3i3_lRLd?(}cDfevjEwCX59I-3b{#?zB0e?B#me?$S zPXG`iXJqs4=UfAkPT{^G8>qOSOv5ECQf?I_8 zea^LVLRjsG9rH z+f$#X;cFt7pERufLU$TEzH9GG+FoS6mz+3%x3>Kq_D|p!`EZgB&i9>{Vfh@c{SOxp zatuHtK3Z46Q%6?(CJyg(m*hJg`QV4*ugK-~4ZFukw*m+4?aG(SMh^EN6>IOx{fWLi zZ6|+EaldgNl}hQr)*25I&u zpF=p~YjK!+DlQpox|h=Ryz?f^_u*dWmxeV~bWg4OkM0eeXOA5Ar7G5Z;cr1dh9e?VhgpG`gT5mPl;@ar^MzR(m3=H^w%Tsc#+M! z4Ht95>aVNu&xA028tzl(YS`ULy7xK$LAx&CtQdpcT@7phz>elKb!rjImNLYq)o}3| z+Tk3BVRJ9#tP#2RPsR&S?xoSLH3h7`Bu%kk!y5md@fr3~)`G8%T)!tk%$W@+cVW^V zLEDKPi%-R7!-msuI?5xd&jWlwp^4*x6yGZ%=>It|zRGsokfE%}c2mvAwnVZ%7m z@5;0n(;kcS2a$E(l(>9`JRc_Q3HT6S>RFUn??>0XAN4y8?L=%gfw{(r!#J$iU&&{+ z^Ca5Eq5G<^*10NU;z8HK@}Jnyu9A9*J?%|guf@o>^9S`*zObFFVMm^JLUiJd^X^s`h=WfnVMJ``$xZbZm1^*BeW_q}dTa?*M-vIlS** zvBtSSoV2G>7JcCvL*jBo!+s+^|IUFQdrNcvHL~BhVZEQFYk4sN?HUD-7umhhaDDH3 zI{Ead&vkqU`+*H>{Og`f>ypmaF!d8_%qI?OwW+GI9^<>ItFqo}xMZy9o-X+CLC(a9 zxO}_eVs7$$4(&|*Gck;x!+tdJn>eh`Hbp;+c74SeABn^ItYW=4Y!we@(-&93Uq{xy ze&Y1rwXOl3C(*CR22Ssp1U`m*_e47vo1Ni3B5NGh%-Hq&qMwHi{p$CQoZiQf?r%hU zg5!MrEZ=F2!2YI;Rd@Mf3vA?SE8g`$;^o{PjyYkaak=@N+?V?UUd&B5Thzv8TP|tsKm4J-!e7DzM+F zVLLPFcHr~H%$Z~1XVn?D%o~Z_w`lZzF^G0)tj`>^yjH)mr>^pIR7iM->YFe7v-xBms4lv1HDfswyI;rPGb(g zg*uOhmyGOw%UI>y#6b*p_vehS#o^w(Vvj$}HR#MuJ^W+%UhMH(VvS*cJo)1@|1$^q zii-&wwhQrD^CoZaeDVgdtt4usRQ4Mbq|u* z--)Jt$Dz)|qTV+V`@0%8kCEqJe7=_W;n2GjV)J;zT8nz@bkE+QfBYknwH8fWOb5S< zem(VR!=ob?(>H7fQ@+}A18tuXJ|wbTs$rFHcS3jAd;)J9+3`8CSq^)}1mm?m8~T)y z&GHTV`)Pynr(b)-ggGd(f1qJKC)RbPyqSD{fv<=ho()%Q22$3?9A9A5f*? zm142;9!$GJT+)X%UqHF1lRx$7P_8>Aayhc$VlZV7A2a)@|(r;qfAyGaJ_Yqdu?PlWyAF| zNBX&QI{6+o{ngt9*>IEPQrkJ59r881|E+KTcoFfxcE` zm7myOf_4v|;Ws@;4q#l*1Y3(;=3pD^ZD@hku~NMo3Tju3i?xo5Oq!+R;j zo?<<`m$H7t+V3fTBi#}BXE*rw$cB2>On+Oo{b_87Ba4k#zjI6M-{JGB=+EFobR)mO zx(+8cpYnMs^k>P3BRo^*Y(8sPabT&Bo-K5)ftl~b>f^+2Ui>gC+Vl8uGMKm!%ioFZ zKO2%$q50(#M-9IL-_YH{C7GuF5iw#`wlZ)}K-46XFZ1Az&J#z6~!=8GUZ*sg$ z+yBLxI2LQ~A+hEow*;T*v(9C(Vo3e>K*NTzJTa;@Vw=Oy9a-zY#D&A2zRpBayaNmjm%&BL(#02jo0 zVs|kbzAXmOcIs4;uh?lmso3KGf_j&usk3}bUB!0JhPAii6|3ak*%jU>vhE!c>$+qI zqf_7Z(lCcud*q4r8w+6?1n02$0 zb|C)2cdixLT-UJX8Y};Ngnw>>Z;u@2mx{F}H&3Ax%dO?%XCmvqAhGr*%ueJ#H|@F! z-Z8R&x?wXH`41!QC)8&mm^c<2(j>OTd~pQ&r}%Js_^`x`epfyuRVS0SBzZr zH|&|?%v$KG5A8E+ME3YBu^oZ^hUoNp-&U~d3~Mb|v*P?l>hKx<(Oh*yWbK(HE@s4@ zm@7ZWKV6u(6wB|4?a}bgXxC5{e$pO+*dEicqaF4XbjEmBKB2$GZl#9pP?$J09r76j zj}zH0*Km5?YVc9#KJs`18(8yQVypPP4DAc@0gFo`Yt5Hfb=R6u>*n4AFlCF?*2H!d z$}Q2qBAiHn74!vUo8-5>pT`s*#) zJV#{Zo7fWP#d_#};Gc2fbtBu^8m{l#iN8*lqUiq+ivt@rBjCNz|Dw)Y!TUrujQ7ND z2YhulWs`Mxb(pvmyB!-gs?U3THsquF5XWMp`Xr{Vh8WUwsmYdP$o8y;wU)5Yb1=3# zH*$V5vhMp6yZb4dIMn@6_i}jG$l)Ea#Q0QuWtRBr`;_zMksWQT`6hT;4*cAuZg#53 z?&geXS3zBL57ONXrcAM;U5O3jz;3`X7HyvZ{esA5&W0`hSg4=Kt8Zp_oyc}b!v*R6 zntYyxGjpX^e89!n4cn2F{T14K+|Mobhv%I}E!iDeG2vy~tXh zC${*;QExjQW#I!ye26s%CpMFiPV>(Al=VBzwIp0$CvDi$o)CBP^IS0fEuY(!8V=98 z>EnX7^q4>Nj6&?GTVi)Nd^>6A&n~_#i8Hagr(t^;pHC(&e(5_7-ZrwuHgUMV{)4m= z5=Jj^-Yc@Msfi1<_aQ#x%hp2hW0AE_Q1cgP8*$**)(f16M=ri>Sifm=*o69=0FyrS z*_90&#TzzeL;6CowQ*##Y{L$=_@^9B+Xun4Q|yK|tanwc+C!hT-sk*kWJ5MJKS`Q4 z!jzPC1Kf+O`_sgZ@6x_dm$}t4Cc}P<#$w{b&?e+F{oLISrcALrykT=NpLa)}jIxMf z&8K4Re~)qU935#X6o!$N5cnw)Y&s9h%I$aoZbUhx;8#{_))Cq=ZUp;F^s)% zEud}Yx5x!Ckk}pxFUIjWW$i%z`$V=!HEi&=eS)+DDeDaQ(a45aNUZ%HJ)6@WSnD3@ zK_7(uu-7tPo;)pf_^mZN^;CV}VpzlOH0*C7?KJf10q`A>!=8P`<#gD;j6Q&|Lmau$ zk;~~brXO{E)jZz$FJ{7b#shGu_ay-yAAow z__5ThyA*kx6*-K#ip?|FtB>i&Hh$B7gxEaWa4{?X!C%Ey_($`OdMK0w3iWSSA*fmcO z8+*XY3$`aUT+Rv;#}=P;sI#64iA(C7*sO{+Gl$}bK2bc1&1wyo1MtHG=rfUzhlxjV zN&h7_)YJtqcd*0-@|)H_V_$;`rTP^2KAvD{#pJ5E6x(zf0OQHjyb5$rJNO? zupQNKT7zp($bZAJCf~v7J|yt|`1~XExhQK>_~Xb0V>Yqw9o*XJDhpqSaiX$zY*?}E zPehxWw$B9rGqPeivHcYL+iB<4U&TWlX|xVVIL2lAQz zZ_!uUe-vx2oH)Hxt$X&4+D~7K%M}|o^qpZWYkp}T4o?x;jBHrzMaSn*pY>q+GSp|! zh8_Lw$U}Qz-SOdtB5S{==BvqDbI$zOsNaZJvAd?>;tBF*oY)0u*Y)u9k&7oA_S_$o zJD@K}KEGG~gFX4luVH_S@69VP^=Q#w=GDj=uZiumlznDwOW&>Vg^{iLrQ&i8><5!} zVSK1EZi`$JM~N+Q;+LuN84eGt@}Ykc7m6v;6!%h}r{T3C7oTK|ABx5Kya+bd#ajZ^0)XCsyv3;%K z;uh@bQ@z92Vr&(}j<~>AiS@pu+XS6@w>N~hh^#%u#N`I~;c@gOsLzt*kFUff_K6L7 zhH=aH?X$_BKF}VU!QY8Jv0{!#AI!C23Unq0v0tEJGdcVY`ci!T7yMOZ#dTuEshfq* z#A6qGCqKfD{1ca>;Gv|&-yO!3o-c&G;QJf4Z^QVjp#6Oh!}wHeM>kwK1qs^V= z;0Gg@_$hJm5gKt8V&f^eijzEM>~Yv{UzN2hylqt${z#nf;dB=vpPjK$`_|6*4E%mK zpNG))gWyq-H4YNzYcc;F`ENiz^4B;GTl!A>GDVNJ4<_w4k#+x`*epcevvMp;pH9V@ zJj8~vl-Sbmj(iP1>N^K!?hsr0y=MI57^`}g)yLRz&qTJ2sl?hxFJ_BJ>q5?y8$J`; zHGfFHit(Yu#*>`!xj6Y>oZhvw^i{8)a<0J!_A@oC`yDqm>8{3yjG^ND$c{0PIK87{ zm#6KslL!4EHp3b&9>Sh{EL!VIST=A$EG4$o-yTLf%IdoqJ|?ogFXL0F-)88{oqhYl z!z0^MGai>b@wHunIQ#*=C9>9^HB+vxF$Hbyqdfb1Wcx_NVJ~DZKCei-7*o22i_L-= zYo1WwuY}E{oEe{D!?;VV=g;nVJ`+QIFT=Y;4D!b2hAZRkY3z?NZ$?soKRkv7-!o0y^>6rCt`hFmI4oVzWK=4qg4e zDm+1CgTE3hKkbPse!It#R`#&FwBfQ#{pLZZzuRBIvqUa?4d>4ny4a?=<@LmMMag)z z)TR3&ynJNczb7_FQue{(@HKGXARu{*zEzXatTfW97mL0Q^Y75gO{ zPQO_w=BKRtNP9YUfy49m#J`j77LN6?d57}@kqcroae7}`dzzhXDC1zhgG=g`xR5Vy zLf?>l7J+Y!T+q(Meq7S*i@p)<`VrnQvL7$wq1ZG2?Z&igHdtc=_RD2FCHDAM`{F(P zrnRWpPt~yIo|1eE#$NY+SYwdG{kLIr7wI14pugJ}aDF7RAyyN6#&tQ2w3krUeDLOx zJ!2_xdPZZ1)ApsQ=fk9j6}yS;50p(_Ar7gVV+@Kden_l6p0E$N8D%X7f6w=@r|%P+ z7qKUfHD20xz~@IcFE#Am!+vUXwf%8;KxECqiM5yS_aJ}T)7b^yEpkb0CpK*~#-ZJU zc74uS@d}6i(~9-{SR*i$`LJTM5msG-K)gud7|AO|MZc^uGqlZbE#Ql_EbI-SAFln$40h)Htfl_ybqmz>?wxt zjja3S#9BxC(dcK>_7413sJe@CA9s~Ch0b6z=LWcPi; z`c0m@p0xO=Pw{+bWW5WMSZnTrytIGNF5zz@o2eVto?^+|r*%O09e8kL_j|?%qTxG> zU%SM8(T(g5YS^5M&(*G-DeE8bF@3*@S2gmYgqX?{GxH#xtcS+5T|$8#D+OU zYkj>p)?SRdoE+J#*Kn~1cB%vC7P=W7xuCBT`7Re9`J1l z?2c&I_sEku!tR63H}H0m!(L#;D$^Z9UM+lh5`1*z5`QN4lu`1X=C$5N@bQtgcb?e3 zk3BK1>u28+@bi&1k0y3ElWr;wu7BOLI4j;@cT2`&!7Fg=Pd?vqX3i2je4f}4$8K6a zA3&e30nZ)T;MuIqW2KQ=8J~Ya{)aIZV?~mcMkR0i4B_z;mJsQ5cwPl z%jdAUs9`?=e%KTJVA}Nyyjx^HVZ)9X(6a|U)96#2%7?Ji{84ebrz!?g7Mj*4V#Qrz z`z^dNX$FzcYw)^}Ext-zoJP6Jp^uD-J(2Q ztE^)D{EWXu8_s9SY`q9?89D6PRP5D9Tksv@ptmEuS!91y!}eFSS4g`9J{%3-5IM{r z71z%)$gjIJ-{U*=pM0O#F9fSS53%`Y!}WeFSc>Z!_O#Wg zj+fA`Ibi%E)}CnMdVhEb^{oBNpkK5m(K@JwZ#{NlO++ju z_S4gj+sT)5dVTP%k@ap=VzUJ4HYeXr@H6(|Srcr?JF!2X@9~-5neQDAUmDq8&~Vz1 zEoP%WXY>6$9B^@4!+t&Ne<9yf$cJ+E4wP8$UnI_-E44_k>vU)r{g}AkBfSbAPJ!=; zIX%~N_#m+#L>n$5|5GVzJov)Mo;+(FPPyNamN@GTg};ideXPVKv22M0%beGFo9}mz ztokPQmtp@HpXHz9;b$WI%Ny35lJ)>w)Jx+d_~*Wc{kGUYz-QHG6#u7VAjCQYpX@gkz`-u&)SG+*^)VcK~{9;Inx*M=L4;$rqQ{-~WhFzO46szact}oz= zBReIi*wd!+RdmK&kC-m;r`TWLaPc1Y8={ZI&yR7QH*)cQ!{$V6{^0Y4_-7CJ&&c(4 z1YLbq3_+((E#?nB0~V{V5_|GC|3asJy~*H{B5S`ev3Y|weu<86+N0oaBkTEGV%^{Q zjnFT}Kg5;RUKKC$}Ty^BsPw(o^MifsPVa5+6Z8l5rM!Ef%9$mI+TYmZ-hb;URM znQ^0i9kClXP&cc`bH*^9N_O{{fHsqz>H-Me5LS?{wX_9JL3 zeHQv_Yk1el{vR1H10PP>8}K3Z(0nQOLo&wq<&mT%j(X?9yF~Vkk;Gb)`&ZE~rtRax zuSC{dpV+LAMqk()iD%|*J=YbR4I0*UK-W3l*LH~MaQ_6C4>s&qBn>eZ?i1#Q--+y3 zYS{io9<(dmi+%tf8X1?>?C--qwd)f2FutUXp1c#6#F*BQ_Gaoc09Ks9B{5brKJy2n z-+~QeLgPU!pC#5FTX_`uZ%%&^r{!6Z-N_A?^pSk3=W-p|=*dG|Zqu+?i*yH|(5X5!q9(#3l9g^qD0_ zIy1wkL@tLkobUa1AD|8sQP&A5=go}g#tZU!2GU-Q%~bI8k@X%;;&M&uMqk;7sWZAK-o+(xn7G~_euR8p;JaC{fy3{K zEB0riE3SyU-ofx0k^NZ>YdxejwtbAUwtx?hTprS}p{;gV>Peg0L*V5jhjCeP@gy2; zv5ymDH^4JSE}m-G>_z?7N5{u)=47X_4C}g@xZXo1zb<|-7h?nK9yW2fN4p)JygNF} zS8(}a!^PL|R+N1&^?4cICbI5J66?C5Yjubp#uz!DW!zK9_ z52C+ByBI&ksL17e4f`D^_fGVe$zpX_ZHN7i4V#D2zULs;+E;P@IkI7_CN5PseMj7N z@UQM|#pP!iQ%|q@yoSy4uzU@dTQ;oU3KYbcp4WEBv$!U*e(RFhFrQlah< z*eLIc{T}3dHlOLk-um#Vk^PvZG zhCTHyi3?o=dMCmf!?4E(iQN&@?^<+Xq>Il(*|0mZVXYOkw^F=BS*w!%rpP7siS-_+ zpPYP%sW$V4pCYoZjWsWWHXUVeg3Zk2q3aE-v7T7(ITqJpH=443g;h7W-kXK%do%pf zQ62W>dsz2qiTwe5UWD|-LT@v;jI4XT#BMp#UBvM&ZJ(XXpToS8^iyuix{q#(rMc->rPOR%*;*x&Uy8wDV&>=?cijlS7 zlh|EAzN1MufI8E6VJyLJWX9*i#6_?O?43?*O2mHmwV8U$|;+0fUC3*y3Wj84C|rh(Uvti9O8W-#`| zX89ob(EqyM6`Q3Rb}iD8PjMXc{O6pBC2`st5!ZY5eBU~Z&+>z8>Bq!Q8hxq#obLSa zA(0)ilvvM*^gKZGNM8w`6Isv96Bn1kirp_MOJy$`xwyRHdLQg7`fFX!HL> zZKBWgPFZ&un0^xLJ|eMI9Zp04hW?`O3ymGv+J+r-k)BT#M^fkSVcIEn<1}0n5B?-R z6Z@Uv@ClL20~^+!Zm}ymMYg?$>vwN{!)9B`I0ze9zrRUbKkxV* z|Exg%&tU@>TW5SMOdZ2`-vy>FVZ0MdiM@D3(*8la=!dZWhyC#l7wf^Q^PiNpIDBtp zjmyMtVl>j|-l30rXrD*yCTX~&jeZt%%4rjSeuBtlf5R4k7Q;#N7y01lg7$}du{jzp zZiDCHn2q|J!+Gw=#qAASrM-#rId$mQ;>O5UWmfDMYg!+N{T~c1?F#!p(===uzs1p{ zHPnakT;Nl&U7%s}9`&CHoiWrV);w(%8{#c-ex2%V&UcTHoR?1@*+d98oL7e_AMXjspt zbl;%)ue}#%#RE&tzzK2-rDnBn;hj#4?({EzkD<#%GLCCj{ zd{&0}&cSZmhVA0`LG|g<7t_HzfrDVpkmY1}aX^<{Uom;!isbb%w)phKjAy&VV)+`HVw3j9amuqbGK|koV>2 z%;nv+;VUESSw~_sJND0`lSiBK^**53Fa~RW1&uZpQ(|*B{8nW1YR1&3c%K8`v{j$? zA{*5w@o0R-N9}*NABJ6I?IR|(D^spTACGp;12eY7x)#-pUhIWVeft=H+OHAo`9os2 z4?F=nM|WeGJj9NeteJ7`X5=&d-=%F~{{eRNZQ_zK=q}~pTG1JSU*vzdJhx%3rL_KW z6H%WU9@3C9275e(D$ux zIKL8E*P_Jk5SY)}YwvCa(;s3tqG7WQ{BMpG>5G-9>vNH{Ka|)VMH_EHXAbM`1m6|e z9i8zKXg|=-GqF)TG9JWk$%fN2H8&Y$k(b+@12!6q6?=SAzQO0o8G|RoZ$|dlG+Z!8 znLjz`$JSn)|B75-pSV;E-cMS5-Fck0+!(q1py9CJ#+VCZa8C4g$WCEC>VDREVP64|cVa6e`0nV8JlaW$9l}_7&%4^%EEV(`Xay6Z=fhZB&O;x7=nt^v|k% zWdC`^nN9Bn^e-x1_7(S@%{aGF+A7a6Y+gjipZXW_{Ho$SpO>)ty3%EzIJ4=e-~2a~ zjqDTWHjEknZL|sYiJ6mXJ+le*tm@XE+Yr0{U^ zZL3Wh{R?@fw9+g4{`FzzhriiKPidK>JZ1cUn;!Yq`o@g; zXj1f4hm=;jsnTZk$!+p{dW@A8e%HT#rL8!(=^u`6gGmwWEAC&n(fji{t1VUi$H-@M z>|M+!Iskk9HF=lLitbE*D~QJ*c*nZNX}Uv;bU z?|qQzc|OWN*{=e3tF)O-NZX5g?|p149;41m+h5r*KPT?b>Z5wr{hQltjXqXYuI#Hi z^tiUydR`yZVeG1`r{Hm_v{^nqv~?RfBmwr()QlX^t>$9VZ3NRhRs0q z@uMz3r1Jx%k(d|>E90fi7H+86IaZ9mh>@flz(O4 zKMbBE+V^L54sEIG-+KZZ=12V-BOm2o>AlC{$^M6p(lT%AUyu1d@fi6i?G(|b|A371 zb}21$tN!)AYBOx6$FTVfown&;PxiA! z?%yTTGn)&8(Gu=AYoVL6yEVHnaT?8>O8+>b=no_viU2?HpCwB{R-!LfSe1 zZqs`e`?)Gz_EjJCFW%^5*eL(XzV|jfcT78mjnd9j>2GD6l@-#?Ta~*oHWlaj^ptkK zDxWtq&hqJ3+WG%((~nz327_)UT*Ur?8m9n zDo^@M|I)nb7`MG|(3vL#KMqe(aW#j#0oZV#t2s9C6P3O6Ct>CX{Z^s(9Xv_J)%+av zpU|1l9pk_E13Y2HN;^@-Pr=kv&-Hsh!pc*uw6YgJ4fn&0|K88s^L$vb(vDm4Z}DD8 zYxv$T=v<2fEA3bn|A7s5+Pmugif$@KYvG%q|Ah_dwU5>N9p(tEv>bt-fvJaMJoWyB zm8V!~Weu@V%dLE>GVlR%ed_y8&>_r*tf_p@HmzIJm~auXp30(@&g>! zeQM*pnT>cnY`%zkZ8IM_@fG|g9v}V+8@TsUr8C#mHgNAn^sljzK5@m&0sRv;9MUqD z^o~*gr08Pih<;+cW~KeM(v!_X*f6$2UyB(-S`X?ym;Na$ec{YT%y`v$(20}HBJfn` zKcb7LXgI9tq%WG;h^NMeF($qDO2vzzGcN=kPU}G@oiQBxadDXOAL1VlX%!pN8J}8n z>3#5i=7rFYVx|49(iwZYSJa+RKVw_#m%yYA<5Bv|Fyq(_hB=2hM69&*pY(7YQJgG= z&REqwMqs5S-@t=l`pqqk4dYF7vN)tA)`CvlYtDDeU^6ScK*dU%^kg#x8^%D3@0^(N z7V?C{oQ$8`vYCyTI%*D=-un-XpWIM%#)Ia0aY$R~X%5#j?SASQ=0;d)!#EYcflmMH z`F1~JAmj;$w2T?)waqYWi0@EOF=Hc?3#aRsTLB$Eh4zYNul&XMBlu)Rn3xX!6w98^ zPK>Rt?{1~c2JXFCr4_#gQ&+b#HuzQ7{lH4AK0;6T8*UYB=&O(?obD5Xj-PaY;#S25 z|Ajo^biWbwWV0GJ#9xR*G5rwi#l)HJsod%?@l>!AwJiFiL;QWSZQSsr~7cXHaf8qVpy!SiZ?NR7Ou1Fz{G*p z5e`oG;ep>p9~XUHY={G`l>#g6WRcSv)~$yPeH_LkoYr5`)0*0?j}3hs;t&pL$0Hx< z^o`cVZUdM;4%cWnq#ZlzX^rnT#D+fBIz6z`_E(IrwYT6l!iK&KdBSOpAM|9iF*fu; zuou&p+ADBke58F0J>RZv#PosoC4!D$w8!E$MaS>jiwLZ=s)Kae7OwTfVf@?j=whW+ z{$kn_uJxP2_$$nNVx|2H8*#GP9Hu=KRX8y|3ifc==aIfeW+SFO+9L`&GLU&CP!K{2o` zI{AkCE3wj!6ZP6=J9NGa_j_W}hj@d-x^DpX+h;anz6)^$RE4hwqb(IIRZ*e}?@m*zAZ6ht`1NwAKsyF6c9(?}QCU;-1pZTItDVXKZ#wSDs>y zFs?cGK8I&O$F{Z+?}o1Y;j|WZP8T`tIXLp@-y2;%7b~suhie=1=-&^0Ds=I_mA&`?cnWm#u5IA7cMgOwGABhYNjNA@e|lj3e&cF4I=)g%2WJ3JP|gur(T1IzeS(C z(w~GUfN5vF1`&UUuKdM6!Q;dDt6qbMe?V9M;-}zo;OXI?8NVM^{3H5=6+aF4!}LwP z1`*5tqe}m+njh$=dJQ7}g|uT~BmM&$?818FcbKDIvlJEog-)8V9{IDfCx*hBh4lY_ zokF$Z{TuNY)-1{suGb*MalgR^pVn&@+umM;4_DEGOB>orKFr*%qLkI4UXl1~r& zPa==8PQmx}+5~5X>-${TOIO;tVfw#br;H7&jY(IY^I$U`y4ouq7ycr0y#|>Vomfk2 zliCKowwVup5t}bb3y1Z{*OA9qrx17b+GK)^C$4w_(h|R64I-934&gRVVs0}?`6alKBN zA0}r1|2ieCJNPcFP58cEzYvRIO|cUBj_R13;W1X@nHngW+ zvrzB9ty73m?N7Q@$w&71A~3!TYmL>=>7Nj*Vq$R&o&M8$q&FJ9;(lT)*rSiJP9e6! znqm#~WFw~U>valo6Yf>kM3=qt6c2?J!)w9BL5NSW?1`;0)+zg;)8AnYB9^^kRZO4N z>lFGsTxZv*>=~G*M=STo51)t+lAz!?%_AB?AxRj)3$n@f?vX%HXL2{%3n;q>valk z4)&X&%lbVsU9eFhBe66*vOvB{cW8>`f%^G4K}h@U&HkpWLtDThjp=7_KGFAw%HDy zqh6=*U5H_{v<3<5lwD1_~l-<#1!iIFU4Lrs= zWe;oyVM88a&7%5?_d=IXc7ykXXRKKE_~CEsl)cdhpi^eBpDuE}1|eNocT9sWmc8yD|=;jkW=y5a+{p8}>{Vcjuh#rvVlMtZU#@38KWJsj2}vX}li_LIT;z~8`= zN3Lzq%@b(8po4jz?YfMwhucxtyk;4zdMUZPSjLOP%p=m>Q1~*Kywd-VBk*kK7e&3i z8oQ(67Vop2l<_~|qoQ7n=34swd*Hj#RSvq|8!b=cpr87d$aqPoMNj}q1f2x^=9T;ZOIy8ec#QUCR@p>J!h#;kPRM_P@enepMG87~Ht zuXM$_-s#tG1GHaK^RMvDQP(=eo(s=PKGd;hV%(k?_4;?p^l=w|l=GvD>6dbW$olPO zF&D>d_(%CAJ`dKoKrhy%Ew^!|oECMinL6vYHq!N*W4|g)`F*snW_;r5Kk53tet8j0 zzP&>;J`BDj>UMj4v@%RR`c}!9yxrPS_w=X1kNPc5kNVe4UBchFKv&%R=Q%SsXzg2b z3BMin`uD{j zE*7Ldos9e7H=}L`a6Xk|A^hwz_V7tj*LBy=1TW0_vy4B7=|kz7&kQl4-@Ns0moarT z#D{eK=3eEwgSl4HA2s7IJ9E_a_dp$O2;&Ps*NmUt$fy^iI1l6?-*Dd?Dm3(5*yUN=562+QP(|Pxh+gP)89i2d?os3Q7<0jOx=p*>Gx|g zz80P)>RKn5i{WA9vu4I?!Iwu}zt6C@!Yk0Oe`h=j?a`}aT5GFf_$id&5y&(CDP5A9OD&5u?jW^W_%DlLDc=!_yJ$* z{X zu~hRe@b*zR-^24`zX4^vmN9Ii}?E#+1c4s`)TjY0&MzD0g#s6Y|+R<9%R_9dz?M$K1r*Kgefv#_z!MMqTr= z?oEo}_-BiZw}i)vx;>9Pr-#Y6kGyK8Zkh+ByOZ(fSul0V|5jC(`jm`k>7M+{4`I$d z#&gY#+c59wdt%wjp7PV*%?SJ)`pBr8U#P$4;jL)bn;E|a&mQ%13Cg2>`kirSx{PUu zKQiiO9`ali-iCZ8&X}=l)u-sXKI?aL`h9O_M8^2R;TP$SelN#|x1;U!bGc-JzEqnDN)WC*ynJZq!3Rd=2k{e=O(3YRs2WFY%in08_ut zei_pyGh@`XR!sNOdd5=oZ}1)1%tE~`!bh*e@*zI2`6yUp8NKYsegb$m>O);>{stTJ zm2R(v7l(HzAADakWuxxircRT= z9NmX9ei)uS>ctuGdNBRdIw0c%VaA_y{pPu#KlMA+^fxvG%g2{Q-F<}p^e}Tz_o)Qed#aiU-M{~c#>}Br~Pxo^k`$HXf6a_htt+IP2|53lgLb!m&iEJj&8WMtsQ(-={^-7x@yqa>Q8&BbqlMvv zsLz@iuLUm|b?uRqE5iqqk9?K*V_0oRPk%q8I0T!ssV8w6_#Alb$a)@NSAs`ivqZ*} zW0#A%`-wakf(Kzk`)a05<)Tq9F6XQ`Vcu#Tm+|rN(oxsnvG8ldvtlz%#sgs08QtDO zy~lzTt7m0Q{oOcG*S>{a4}ZUb%?}y>2yYs7LwdI#2XWEfI^%7~gT9fT{)UErKi@iq z&x>$~PvtEC!-c{29nOr=@Ekrd^O$=t>h3T6unc?@{&_#+58$Cu*S?@x06v=fe3UW$ zW#)^zuI-k%(0xwdg&AK2tG=3RCx!8a{{BMW9~mh>YZy#xLi{<$*atKi3?PL_pzm3)~?TJ&kn^r`+_Zbua<-Soj^rw9RrqA0K zXM73FSdp%GT*CZ&2KkJYG4p|&5F7M@ehGW6XL9~D)m?o z)fSA6^fxU7PmE69V!t@Cv>!}4z3DQZ9zG!Ix<}XFuq=qR_H7wcPeD1pQ3k#f`(?3F+s~t{Su-949}{&;Tv&V;_8~9J_;Q#&lU~k8Ug{ghSNglVfhR*J zCd69*m0M$v@4LTe%=}OekGgpo+iPIz-=^bk$v*eFI~qdrbd|JhMdFNiVq zL+CGJtY+1BVAQ>QdpCR`ZEt7Xfz{vWVSn^d_#$FM^+~Myyb*P`5R4Cst7+F%8BYyU zhIGF&ZJYw8{2u*Z^Sm(QN4nPJ?iD_=nTksT6q7cyX!g2 z&zDo5Q!{2v>Rw*Dv9#?i_zKGUC}Ya8Z%19%z>@i>xRN?AlJTPO*HO2RQ#S+8gnzEf zm^wK6F!|lTLYc2p*0|I&vEq>amag}T+Ogl$?I2)Zor32XS@uIjdab^W(F7^^xc;+F>L5p>F!DFXNPa3EYj4> z=Mw)&Hq^ZU6;UjkPr4X6L03Cs9W0T@Nd{lc_!m$Vak_Yu0);}z>M|uH+2KgjXpB! zek<%$|1BtsFfqe|07{{@dCANr)`4dIibUap0&@LzF1`7k%uyfA!E)E)IKCxjWh>F=%tz6E{! zsJqoD_Yin;Z17Xf3&00N-Qs7xpAzF4&!8LvWFF6wS1_1F9}fI1(MF>^%uLDc<0IP$+O z)+3(Gc~LKZCI5@zN9ohIGJYGrJnHrrm?Nx(Ws_Jo_(Hm$lRVFYAEPY%UGqfn8By05 zE!!~t-@Q9y`YP;2pgYb!WyOTfgPbVpsnJ}Tp+ zdvM0|b4gnZjUOE|a?m#|=DM1hFPW1m>-dp_eA z;B%s`xY4^HdN$BnHshf%^_5<3i68$BKS%s5pYbsGuBexPai(7j%IUn9@%!+hQFq6Z z=S%SB)OnYTccly;bx*vN!(r;!{UhT)VaA(ue*|f_hF_#lx6hdVHpGzha!2gsFUqU` zCaQRKbomr686&~hE1=WwHEWEj?dX1C&ieNq{GGo2>6@eJuMbI^_#=4FsB1mviNE4C>bzdY>%&(>-7m;l z{`?Pho-*U9V9Jy3$iJKpex0_^)|!dEu%CnOwxx-uV)F(zjQ5%u@823t)aX2VH{oT31 zTceE|^2b>25N7egXV7O(aHY{tLb|>Xx{&7s5MW!yHgEKC>Ek z=tW6h@)i9Q-cL_VI~;jSFNv|RfBr50c`ak&%`Sosy7se6#z}ZL?7WQ6hZl~zep6&g zANGG*8Mon&qi!hE4}^)8_DdNvC;FMAuKCN{1rtO0-`wlUZx2LW{&Vz+JC1zr%lO|g zzL#DePM!y0{{!t}E~8 zl%a3*?ovx}n|N>1BTLtBirj?o&$Mgoj1@1+16|L7v^P=wLOv^HyfXY^)cw-%q42N7 z>P#8qKSP_P7iUrKj+}oZAAC?Vv0PF=>7F<$AB5*5AAC@=eD_$?{kkym;f}{>@Hk@1n_BR`|-Ik6kX8Q--Q$aq2cp{Q#u zt#=j-rxxYbd?GwJ>TYiAXX7*Jx)WzS2|Ot3hFA^bl|0(?Z_UK5#=1kd>rl71$g`wf zi)6eg{BqRwUcOxowv>fWYF+|fDe7iN@|z5Hl!a~0_(Nkxx}K%z`JJII9sFD~dHP4A zt~F}05KJ9gr)7LPOk1VJU|%J^dV$f%opuz#G-_`5wa;|t-Zq8{@2owAuH+W4VJ zygU3y)YS*NzbEh~Gv=k2#GhiwOhJ8)&iELZaU;E)pYrgZ z_O(0YTQlj+%u%;0i}9hn`e%A<)oYA^Ah4AAq&S(8w%?KQov@3#Sr1#)ZynI}55 zv*vl=3!`382km1h=2}Z+%$#OMMcvCcn{m+Y^#6Jeyc62+s2B9FpQ{Lc+M>Lg$=Bl} z^>r~jOn>P8gVuN%6PNy_sQWj`Zzu<8dJkm$AUrJUVl38t7QAoN{qD5? ze0VnUSvO<+R-PU8a&5|0zfiBv!Wl0D%O~hzo_-Q$%(Yan#LL0-qx6zI^cxCY=Q<-Z z#>Z}hs4F(LhZy$9HqCfAOnK7H{lv%nobhA((u^;IKZ&{{&$Q>(Ju+kZsQiq425=mX z?KhN7e6+UBcsuypsC(u_L;H2#+}ktbyG?o{n&Z}g+Doi{{H&>7rABB95&-etipQ0Y-m>u|z za(dg4Cb4`@8Pc_X7WT9$zqMJ$o5S>%LwB!H|1O`2!S1~o6N7pWNxJzGUon3eVx|2; z#xKIm6VlyooUh_olzi67cwPAFsOvdENo~D zFaEzU`L?Kg%{};ysOudN?RA*N$Y+y`iT^_FLNB+%{w{cNVr*E(E5Nr$UHd40SJKSF znLe!fN0@p`*E1GRyUh~#=k<)Ki${~LJ#Y1iVQy>ho$)^KX;Jsba$cWfFnzj9#*`oK z*U-zI$nyruos>GSp79#+^-ZM}vQCM{*&zkRtAB(!DjoP==^`o~(#?!zWhv-^=Yp+$mt?JPK zHE#f45_Rp(=shvBB0hXM<5%FhqV8x@F)q9kHd|-B4Lp9-bswNTFtal4>SWvpe-d?1 zoR){et59d+v*vx_BckqphKc#GU-xFlZ^4W$>Dr@me_+2V_mGEWd^r47)Qc`{91O3< z`OA#?-s4y4mb88ZOuYBemYTOkW9&-Tx~E`1)BRTGgN#3fPm8*3!`H)WV)I$XpTjpt z-5taE0Y1|=`TkP=e4)hNj>L{@YUjC(iNUabLHB3lhyQEpJix9dwl$n&l3lGwRO}!Y zuw(C{V#QujQBkogh}bJCg1z^O4eSD97sY~t*eiBaJa!SWU(x%1S!B+-&&`u}fB)Ju zYt~vbJDCK}_1Nr645_KegW(%Z&rZco{q06O`#GlX^125-C@)%zcE{!i$HYqauI29~ zIm!>q4GF{h+86Q*HsvYN8_14jJt(Vzd@IK^1dc~^4`%KsS zJ(@q7W3|&9E9NJgUamJ|8RJ#>^DCWJ{2M&R^yF6T&&QrT)P_1922+34HE2R@rPNw| zPQF|5T(H(U)!^M6J!tc4+PTQ_#V|3Io*aekM;!gI*~Rg$@W-YX@`qY2*E;!7@i{QD zEq^Qf66;N|Kalv4m&lvL9MZ!=*b=w=8pb}$@jviL)Ah_lHJu)eKhHUSp6_EOJv|BA z!#OkO>f|FbanFx1J^LHuLGYpUHP!KF@G++AxnD{=lew7}w>!QAKErf9m(V_=?jfuH zJ^GT5M&HTw^hJE5KVA3K?{R!D{IBWCZMhGIe>HL+Svgn(8}yLFH^E2J*Vm4}f$ucE z+;7vk`r|Y0rxmLP@kx4mCC3~b1MufW$HYzhJ<`Jxv`M|D7g^{i?K&*>hBfT;31}`&(q&eF#gpUM`UUt{9=0X8fWrZ-oKA^{1AMg z=>_$iP2n?RZqrZXOW+Sp*E<>2URjM;M!p$dkpsU2u}Pl9o;qmYSL7M+6Q*a>sGcKg z@1t>w<5S@YrWY;x?FS!6e5O05O@8t~KX(yZ}thq=%JZ=AWKjHRp4zu^ef-)@VJmO^Ivm7stQy z{clazZ&c2qXI%~EW#ltq)h&8D38s#9%~Ze7v0_u0p2Mp9bTDzg-0>CkdywhLv+$BI z{nSP{9tn3cz4(-KFAn-|Q`?azz}uQ$FyAwMW_@Wh$0Ji$+0&+L%?=yT?l}6w|Hv=F zJDQ$949|uA5PZJg@eMF@OuC*C<@BRi)cZRoKgnOFXLn%NDRPCULjj<}2K6)y^3WO{iGzB4?Gu}|b&@iFkOrss@Tdr9dzjElTP zegGyW(ltNx-DsC{y|?2%V2*Mf|C)J(A1Pz1zwG!G7@wqOuFtDvlO12IN$7eIBiTcUC$B2U_M{S@R?_kKY+p>m=BYzAtHtEGnoCk1RgU=5*9tHO|JsU@?_JoOF;}*xa!kTO7T0gR%VdC0c z!||H%kEZA3Jevze+_z}2mx~50E4#y4nJk9Z!@VcgFbJFi$7!Jf{hGY8Azcsy} z9?R>K8yVMqj_-&0p5Bcs-sIdH`|jA_L*z%{-Aqr3gWf$Yf1AinWO5K*HNE%%`z<;6 z{ckg8BaerfKhm`x=Pj6d(_rpLz8hxH(hL2r;8(dA~_bk&WXeWkaPQ^ld;)8Pe7FFxnIBgY-Y z86P4m*E^e@Y(l@(T(U5IE#r7ucooyN|5q$dzr?zZ?~z}JmoPnhh5SyYP3Cc9wBs=_ zxs;x*i@nBkCpNSfnKty?RJ!Jw-f7BjqOW-z&kGYD>BYXZ^&6kbdAq0M&0yjqJ&>d1 zT-u{vs{bv>k~^UfGd_Hsn1rdCye`==nFaxiow)Ii-Fh6Nij=Ne|m_6!3kt zL(C#~hlA<5Pt|W&dOzd(+wm-zex$3uw11UsO?)16{5VW}rH6sovwoD%Wp;JU{L61P zJ+QWAU)ks8+KyQ#vM*-aoj{*oa*QJHeH`x%|JQWYTEQ67(fItH<0 zy5e2&dGK7OhZC`1ezwoFA9)`bpEMTjM`l`I9weu%8KUG@#z;nQ*X_^9OFYlzNKet!}DOzcN&X2 zUJTyX^i=E1;n??L>{~eA5)u1}c&E?N4*fETjh zMGg}DYf`_FkAwF&UDxA<;xic=@*kObS@btu`O$u^)`!Llj#q@QH$A7;0^iXZ)BN4> zA29t%4|@=YQE(fZ4IFO>Uuk->AZ-#y^;P_zWAajro2}1_y>ds6TfaG`-%Mjc5B-S4 zA{@8S7yd^k#`#L7YmOBouqP*t)g7+^k2GCtbReJU>*VWd$K)rdcF@DM*lz;AL0_jj zJ`HA^(!<3t^_Mbtn}Zx51LLc7#V=Qly@d_FMcxr6U($1Y$+m;vX6*Mmz7O8o^n793 zy2E1C{P%xM2`Awm)05BOCid@8^Aj9X-(eop^?bCvkA0WEPH;@@voYA9CtdMhwfG+G z%;9)W_|0r*PO z^0@1*$H zJlXLn@Rp_r@|)j={j%8fcDx5X)^u$$=RaZpA>aGTF)`C~Ch385-Vyu5Y3F0dpYXRo zO;48K`{Y%7>owYpoWoz3u6F^lJz?5t{o|NA$#yb5+)n!(WnbqwJ{P{hbls!qeXErI z>t{GV6IP7n7jrNFZgx9oJ01!vuZ$(>iEoNEZPmIu*8Hb#q-TBM$+Y10@cfp=9HZOF15!}o4jQYuc$DZ6YsGrFAkpI{8bU5clIHnP2^;5H0=toq&1^fFGW6Z)?0$+_aaVEU0BE+7tS z>m~X+%JD$>VAFLy7l?IAE!U}+$ka@D+Vn6I-)N_d&-spNKks9DxPmtO!h`7R1ji@B zy-m;L!+mf^#znj%?+V{*x~`#etruU@4(mkZtKfM}PX=)Qkk7X=_MIKmrsk9MqBHy? z$G5CMHOF=M3DX1hRrI6Zedy~L$H&44n4Zv1`EJ1X^i?>f&GP;hJ^4RkMU2uPu%YfF zPld;t9*AwRBK#wL4R(A6+{N@{75Gi+o3Yh8I3^y&>!v5Fq1CXTj?F~JlVH_3dZzea z1OG&v$xr0HVPYyhJj!txJOh7}>xyrJk1}0*pF#1wjlNV*6;mtW6Vo%T=bbpH>-t}g ziHY8SEbrm)y?RE|e#r5|Fg|HNNB4{20ouGBpII{^zYO1RdT|!^%-j49a;mznm~(ot z=~)9_jy4D454njax(#90i!@byV z0&C5@#4)kSsYB_>VC;!|N-flgPh{ewc_3YT7&*0*{*BKq$8DJSNe?e@d_a5h`5wpk z5WXP+kK_5^rs?{(O=%a7&xzqU$4|janXdiO{N&kVf6y^&n4ZZiCgq;} zd-O?7)pp=}74HbYZ@S*c4_9HkaFVoEcDxFFx#`+R&u)g5uj?FN4-YlHTm!oDImc(d zmsflROxw}}dC$pfauPP=J@S??ahIIu$6v$DAL$u+NY#Fg7}9oR+R!_^ z(!*5RV!Y+=#RSJM!0(zKIOo&g&FSk2$4}DElBSn?T35o@weelo!zC{WD?aFf?}iij zOq`m-9aEdS?vbwbquk?YP(RN)eh#KK%e8PF?D0PziOph;7l)TIJs(Y<%*l-T*SgB_ z)!1}4Jf?Dl}s;x>!|IVaW@s)il2v>SJL$^m!8|{c}aau$7{jN0qNSG*1u6H*B0h)Wa6JQ zf23#BO+noCY@o56cUA&6b)Iwx5-2+Qc_Of%v`c&J< zaS!+z+CkU7a&Zgi`561Ej#qH0TG`Rnw#5B@0T6~7F> zW_m#$(!sRZfjLMlBa;I?x0kMGE!vyP=4W2Ww&F8j+LW$q{A4=30OR`ie_RKX8K!H0 zHj({;_ou~+~7fs(gG&rH|5JOwdI z?xr2;DKhm`yk&aWk7k&+<+aUbjyH#isdVjkmw8znpRad(17lX)&~@FBtId5F`$Wf+ z;5SXzGp=&(FF`xX1+mM-F!Qi^K8fL&wbfd_B{P9kIOzR!-M+jBnZFrmIeq4f(tzF&yjoAsC;e=ZDcR?POiZ z#rBSOfUh%M^;bLtFU9#E$N$1FnVt=&t;^x18T$~&XTuknu4{_?D|i{k&RmK76#TvE z#U7mhk7HTJCEqLF2&O;j;XCX{;@=0vhcQNe1HRStl-T9-Vc(U$7*}M*l`~hQXZ`X2 z0b)U&HJEFW$#rqR=~)wAA09|MKREsoUe)yS`cHB1hRqlBU-2|}9n%Bj2&1r9PNzEl z48Fzm>`v@+xQ0I$IKB`rOxO4_#-B_eU&9=q1J5wM{I{XBQMPj)->vw3xNdrK8caL+ zU6}3f_yCw(NY}kbx+3i^&$vEu{3)#ZM^8J^9$kXogG=>@sYm?s&v-ulKdG0w=bbnVUPeoxQA z>Nh(c4o@;&zgv1{oiR`9vmE~e-)DMy6uc3~-Pr8ncvrZm>AH5%vktY@I@s|ca0k=N zXB+R+<{QL^n$kXb$#cO|jCHM+zr=UQU45qGU*N}0FH{$YaKI8wB z<2L#tw~-l3Ij_*u6KPZJY(QUoJKhIA-1LMx(H>y7A?@ttxDWiL>G=hmSHL&saSOjA z9}V|1y`VO-aj@nE^$>Xn_%YLyS2-`wXJTC&<5=}V&ZX=3DOc`#P#etg$gDBBY7br4 zM%pjRHfCI`dy)Uf<}TBd%Q<)C*o3|qW8@RyRZTBc`=j~Jz4*M7W7Qp+bgj91KAuqr z4RRV;Ic1Vd5BQVZ18;^6{zS$fU0+BKTXM{SugvY{3XWHV+oq?3XkW2oU8(QxxHr6; z>Dfi}D_>b}8b>?kyTvx9C*)mwx~lIQd5=uqwRc_PhY1y9t@vhy4JWtW2C>v{EioZ6%%yr4dkEj9mY_9!ZCl# zKQ}$0rn9p+wxzFOj?aNlFD zasAzNtzQN0W~@(*#T+wUy_+OGrJq1M={$_Ri{qu}3;(1S)JDc!O;|VEXpv{PEnW93 z+EdWAe`BoUhhWwy>3SDA`Ge25(AU9^4}t$QUGr1V^fT(WfnSlAfvIEZihP~t(p7uV(eh>P(-SHjpG}Ds@v0Ve+lXk9ld=0$1>8kbOdSdzj{xI(%uLR#< zdilH34f{UWEJEKEFNzKElU@){?WttUt#;Efb&=wS^lS?KPUc_?jVB$CgD07u5}!nI zCl7Vv6Pfq~@+Un!j9>qOv1`irif@1yFg;ltpU#8(GIse{@nZ1FrfY32hVq?J_(R)~ z8B4+Zk)BP(hvzx(j}7O@6X0h}&u+r@I`{x=&U8#YD ztK6eF5S!&4uK=rk^m1SPDEg)*+XwO8im5kUf0wm75B)w447iEP1U=#^`9NjgkK^?#4x=Sz7YE(Xy;hR$HAAGu647x6+RMw zR&&h!D@K@JoJ(8OwXS2@9FYgW%E%1!8SO4fJNTGZOiYr0P0uG{yEO-6Y~ANraox;x?Oo;nz(+H7`i;ySDQHT1at`hN z%9;4oI3g1ZbNKV zOg6nB=6a7lBaZEb94`!CV0ykMvE2fuzt%>Md%(0MUGJ8K*I;U=eyii#;5SWATloJL zpD$tTKRTWcD}U%2?c_UirtTWF6Pb4MZA@29ryKH}j@WGLcsm&Xq?f<3gZa*A#-%t_ zjDOjgrYFl{$DGk`Z;cv{JO})N>E+sUHTGj@=QO@s@#(N)jh_91?TMUE#vkTgpl@PNwVHzqrHxR--;6F9KgS`#S?*=482- zva{n|VCJp#RQ0?L_GdHp4INWEf%r;K$X)gf$58yyx#DNx_e~F)kHjwAL>SsTnBR^c$5wM0^f# z+z)2_()GM6`7h^`cII$AC;X-9*{ifUfi^EBhGQHP*PuE;&rT#pS8~1xo4p$jjZp_Z+iAF_OEbkO*@Y}egb~kblsDuvcH`8ki*E-MEW1o6Y3$I$$@R{Fvo|( zznHFhUTE%IL0{w|GP%(E1Ja8=oEeYavutndcoX<9)Adf4_8pS>7}wK|$HS}%(u<|( z^FcmeMLR9W)LMGK=~@ePO_o!GjRPGY1mmmp@?LGR*?qmp_bQ$UFK&AF3Fj9$6hr1+ z-{%l|PTE_Jw=ZdGp#7Mf{6%ML_>&V4O$9KX% znVwP0dhc56e&Z#_ld*Zgbj`!!82AQkj&$4~9%Q=Ki{b?MMr_Dq7!-=74wPMxk zHl`qC7)6=`jE3r-Jug)Bdd@;O}=>=oV9^$wapLcZ3-?hggJ#@vE zxMa7nX3pVwPW~pJ(es}_SdvLCJPxvy^!z%PizO#||+`%z5sdvky=YMe~R;AD6E%H=& zBhz!WJqFuH8P|!9PlCsqUJwKQ8=Z{xs7-t#6Q7iNm0r%(3pjUU9KUl^{0B@Q(!<)E z$x}w&nu|KtT)fcqjQJAIhwmXKZ#sSpW{#J?Rh(1oGJL8X==dOby6MGZoY$e9Do39;z10P~~x&`*C18TQUEk<4e8)7P5&#Y3~R9@R7 z98(kNsiv3DhRH+5+^Ul!{l=91Cw!-Ix(w~(NBMi&a@>Z$GF@v~J^_1br9s<~PlF#e zUB3_M!F(ns?L!?O1|MX4@;zv#wUlFWQEX&-Addf=t@+@8ZKE;cinLCXQ z95d&NNv3Narge@bu{q!I1#oVo4e6{Jt`<%DNp1ImqtyD~{q+6Pvcfq&mvwfzo z$n>T663XAN#W~ZLowJj!(K@g)DpLEY7lay$_J z+w_!t2aWv|Z0>e^4~&iU;xl~O9)6V=Vjr0tr#qUSev2Kx0PcVjPY(y}&p9`_k+k#(t?|wf%wVTAT6>VcKZi;dlhB8bVL$tDr73 z+OG3CGN1K+r}QM}|H*~!tBbE4f5T_Z0rX@mbj587K2!6NX*-``y6!I%`NmwV{pR?0 z_(RjnXWdO0yB777SG+Wgne==;jwSeT8#bLBcZM}T(e>YkNaw@;BgS>AjO{Cl|*!*58Mjo^Q(7 z-r@5QY`Qw`1~Y!?>3#IcoGI^NFLg}p@|x*dcY@;c74dn<@x$;Vrt6+OeHs3m`l0S3 zZwa&ZN!R{FdL(UjXI!HlkAaUcUGEWxt+4-wd@)xd&kt{8dZ6Z$v+?gKVz{K^F7R2V zC*-u)jL*ckAg7VZY0+!8{xE$1IcBWsPNs*!*zX0C=Vm|02g33hJ*c)BPyRIV z(Rxy`)~!*dCre}hF+865G#$5K)hK#62ky^z?xioLP;-%qY4VckK{ZLu=hRB$-~Tc0C&?YA%Xi%q z>b|*+UF2tB{3!3Ix1-+-d$i`Nj#uOF|Cp||pnR4}ei{=TzW_gn9eREP=hr!AF!nPX zp9%B(QLas&aAs_}Myb(XWVP|V>8hV@TvZW<2T`@Oix&sQu35hr?noAH-;4>bluNo13CV{pFbV{1yhI8 zlWl2lGR)s=)LvxrTfQ%du4jD(_eOf4wv*oQEaF3rN1g}X-E_SpTVA*SLpv04nZb4ok%r(*f@x#{}1QYkeQWb>J0{e2D7lV3QW z$U%&1QydddtxeMPZyA$QIMZ=+LB}0o*`VvbDp?37rY+(Wc@G#n>E*rnTEt;7+S!D2 z#hb!4({(M9{?2z;pK8=X4u3)SLmZRC{5#XbLGa4h&V|j^j(fq>lJrzD*d2Sc`sR+efDboa zd)~Td(Qj3=?U*qq*p$Cv^TQv*%%|F)j{idY-t_c!`rV4ZElOWw9X|y3Ha!rV9KXZ7 z^tF>?;*nDy($fX8)mlT0Yphd||As#`Jun{CS{Y}>pyE|vYFT>utouQ}!?@blQZp5^ zmgsqfbnR_vA4Jy_t>KPufk&DiMqqa-_Qaxjp5yajYEODL9osWFI#4=qIer^veUqN- zjQ#U4v8<7w$jmvt{~85o1Sk*o5UpR%h;E5ygba9rE4E6Fb4g`)TqVC)8O|^PbYIG{$<`Da6Afbo1QO< z{e3X~w^GNfIbn?H`B|Kalb(^b6xWImg{cYY>1niiG{=jKi`tHS0DO$;8FiD7<~swi z`OWd~@cpI-a-r)I#l1-`B9jYUcS}zXq|b}6??pRXIcBbf8%+<4OV?()c58x>8DoNt z^nlOBj-0V=;&WttE?5(!>)#aR#7FB&7r{mrO#@rRU^2+k`f|(AO7^nP1tarWdEv-#N7R z0_#{m$JA$fg6Rok$yUXl7}U@r6C1tbC|$K&9EANo)W*?{2f?%@J(JJWZdjT)%jb&m zIi)V7r`vPx%E9OQYL3ZIS%c_VC&us>@TY8GmdiPIl)$utpKBse-o@|Z} z9cY)F)#O{n%fr-%bd9yZzI;b|0mlo%bDCb%IPXE5)IjSy$KS(!OfUC`&VcEsHWKnkLmdx;&ojLswi!7H%$3$m$G^bGnVu{{ z`!6xZt2wg{RLoG4;x*I5)7W0hu@e5=?)VN^wThk)8{LD4l{x?9cm}+)>AJ>Gzk*j` z?9@Tzec`W7*Y!faE3Ce#fyg_+nltFC<>Df^J7ZtQG5IboF+F^X{Ug{OL_3Tl^6T(O z)3pu-=0mx+bFX8qk@ziL?-FIF@R|JAm>-eJmEPSb-z(x=+yGOj4g8C&SlnoOdNX5W zE^B?MlgG$IU~*8dJA?3Txb@rI-EnXDHq&$RozsT)z*_S<{tvvi>G?ghr*&oxY!r`* zFNLXB>DmuSI>T!+uKOK70CzFHpw2V$5!Rxe|8x8|OkAbw`XGH5rtcd0icG%J_e>9p z|25bW&*oUi55c#Xu74Yl_P~A}Vu(+X>7#hq^l&n~>Fjo>naF+NtxQi;N2)h`uf6Q} z6?hlZwday-0I!P;@rg`)lJ!m3eq?eyel+lz8jGx&=x@6A8I$qYuZPdnQsjy7Gp6hM zC0&wZN7{MP@i@4P=?O7O$f@4jt0_(uGqsGFec~ov@A8N79B6gT-HNZHFXo2yg8E1=fP3&;u(0Dru&J4zq9>oh8zcSW_+NOs z>8jJb8=tAi)%!DV zc};RPV|xPsm}jk19G^OS%$k35(dHhUiBa*hE-?O za`e3!IbD=<#f!nTEj?(i%}p+eQS&;-*TbwG(gX3ynX6@-iAiMUPX4Ot$&;K{u%kBI z@hvd@mVf&%ZBg Auo4XUAN6u?&6Q&)>*To3TZn1HRXEUE}17(%v6?sLNI+LDIGkQ-xY(=f!>G&>KHt0dQKa2M6AwIV{z70Ot^l&+T@5gt@ zS(CLP@(FNX({=BfXpU`79m>awe}%`I9;n+eki1lFxzDsVybU%Ba;~@|tnZ`inX}%}4b)KcZO8Ax15FRgZ{OMejB)%Re6s2JMbz8g zF!Rhm=k?Di@}9K!40dl})6Fq;QQiZhhu>*)J=!@Oe?D^jF^u2R^?W1$knuf=&Et-r zfTx+RYt{S=j_Vlv5sr_9&on(yUwY1(6|{4ivv2$Rp&s*dq7U?)924Er2b-svy$_Aq@* zS9{tMO*+vIwHf(5+R=B>vljl-M|pqxqhso!AUD!;)yE~U{ORu4`9|oHY;*ob|E(__ zGsm+nO;3l?)@k^DHa^S$ipgb8Or;mpWBJ>`y3k(4F>_b@@meFw_n#)iJJHw8v|sUX z_z~07H?Zr?clchNxfS_g`bkX>_?csuzDZ7Ba!h;q>!$0sRM)(^R%mVNxF>v#>3ZKp z`xj+SFLq4K@=Z)H8u&(Ay0&Qj;Fy@}eJJUA#+c3p?~2dlDDwF*d6KSwD_K3;t#xs{ z6fB=q8;mc!&#@b!WQ>u?MPM#T&u^sPcj4Xfhj|eBELb+^#fG$XGE5xX^c9)D(o;-N z=qDi$$r|)E&hb;UbCv1I-`I}jU_Go&b^ICptm*o9D!RASo@V19#|OiwnVvBIa=&0N z+F8f(y6|Xh(93_1cmmvqas7%975@gGXnL_Z_RNQ{H{)8~@d_|;mtHK2J@M4Oc$;`e z&fw)t*V>cK%NUt&t?`bZfi(v?(#NrVj)NT6Z*qJy{DSEP^EcZH``hVjHOH&N`^7o#XFe)hoK5 zKL^<}H=2rD#lvCc7d_P)wFpN)d|t(IcNjmVm$gQW!@RUJl5@p(!aC4%?2;TlkZ~y| z6>km8SM(e|vt?oGwDr2^N^Zo2km^gJ;f zMtmBMoA6PlhgqDj;4`(<{M_*uF!?TPj6SlbU~<)x@L%K19RUUy8t z#V4j~4>jpXyY$s!?TEZ5OuWiHfSI&OOq1oYnd10;nE4}J|0XXdF6Ex5>bc@a;m1r* z7sHme0&%LRjx+dY)3uLSzPtW4eNA=z8QddDbWfR|!kKvKUFsHdEHZOIFC3PAK?`XfH`K{ycVAdz;+CR&vpEAz99B%_tdu5!_b8L0*QCrzDb0q)N zbnTmJzbcU97PgVUfp<1t?d8NmbFXo?<9pDEi}ZAN&TDZT&A3=wBCn4xmztgo!j69P z$@qhPP5qTGw zF_h0jKBv#Ov1gt&UvxYXe#`WH2BVu_@mcFydoRa*;0sI-)3B$e^*(fSlH-@)H%!kT#Fm=Y^W)Yv zj<1C~nw}F|-G79WXh$_(@l1F-(^Kj-?+l+zPIq*?6WrbO^m}5y1fO5Q=5@#TQofUb zo?J+*s1xnU)&@GJR?@#sPj7)2qMcW1=WNGAVZ|T4n2$IdL%*jnF7h6kyl1p4z1%zJ zJK=Q3^%v)g=|3oj=;=s~7X2X_89*9ZKTr2li-*Y?#-re-%O8VUb9?ZCi zb!1|iZEw2nW0U*%&THfyenvL5>fGsVC{_ILn(_U+1w2C)@uQI(@8`c3Y}_XWf(3 znP-tZ!T2FvHC66OUW7lFI=&3%`vJX>pZHZ?XRhdYCHNB4bM$h5xF`Pn$1(FRUl%*{ zLO#=8Al_~HT(NwnZ|NyxOjuXLBlt7j@lWtOrswx^W?t)=K}+AO7@xyJrWZTVCb=km zUc>R4@HM6<)J(AvyfA$c^T_0@yq`oby5JMO1ln#l95>;IOiwqYjs0nNAL6{EW4^0r zP11{-IN#3SR;Hb^91nr-FkO2&+K<&9SB+YZd>y>1=|yks|D@f^X=ek+_@MWpq$gX@ zU!AkYwY+26t)6w}#H8FKy^R=R7kLpFpA&Swf12J(n^(}+JdWpuZ!x{-OTRO*KLDG} z9B&RQf9Tm?*itLuO4hMY95b(zqfIYHU^kJ^iVw9GnL5s1HC<~;vK)uvL;sQSv0R@t zzC*Bome2BMTgThMPnn(*H|_7~H?O69Ron&s)%3F7)tx=k3F?h@9TI!SnZ<+^mGdCF2=gboQzEF(&tUrJ!pPEw%5_l?~ea~8JqO-xfy-w zdZM*1TE*+Z>JMH2r{DH+4{Vy_FX7Kj&z^?2fp4HTZgYG)ObtoTRFk9N8}aAg|8Ya@ zk1@S`cY`_z%(LeA{GnpSigu+Jj468$zL{JwPa;#_8U9L7zTnsk9!{KJbUYDlHPh3J z&}YHquYR=SLGVAOD_05e4fs)e*zqH<#)V$cUV0gff9;Nr7lJP~J^hd|{s&{cz4s4=lpY+TC6|mcpUtd=~)+eDohPF>W&F?{*CF{;}6?2 zh8e_}c@vp=qx~M~y57x};Pai-#%RZ5VCq+TaRPiQ_AfB@y&dlZA7*;818p(pz}%{> z?syIO8PhYZQOochY#aC%c^-IK(-Y=exz9uG)~MCU)M`p@0=nKUP5Z(3;7=#Vo#Eq5 z&lluOzEb*X{_R+`z?_g?-U}Yh=X>c(wN^3l*EO~DoIHgbTl#68=a_Xbv`kO=d-+`I zE!z3ovGOpLHqdj$nEaL339_%afSGsFb&p%j$!BW6f&Y;^!gHCf`p;f`!AF^1Yzhy-eiSk6>KH$?M=QM`-q}#>$yNJ$$C~E@OxL}4LF}?O z7&~^6=YiifJ>3IaauKMn`UZ|SL|eyn{SN4NPS>@K5ssvqhH+%nSiuQw)>xx5xR2>VB{e~5OrcFcGS+K^uUJBE{Ca#CNL z?^Ue$t!lci3j%9ewiJEM;h37r8>Xj>Em3{bUu~x2U*Pvm&xlF+-pHf)gYS{g!4KLA z=!Lj1{1~-yq~rcD>wlw$-!tG^@2si*Kf?QHEBA9Q^nJztB1d86x()}oFV zgS(ineKM_yftqe$ADNmgsCVf(wOsBGzd$>ziILxgyJ3S~TmxSYzes#eb$l9pwduMa zDu%%m>1%(-2f#y2PZ^({=akL^wT9{WXPI|$ z6Irp_)%0BBZt?joPSkwl1K_sl8Exv{i-ort7jr2xb14~bdT}`YK1Q70=W9DS-VtW( z()GI(eu0To{VvCM!+)5beGBXJd-NqgD<9VgC{1>g{+B_zKfg=D3~_mg}L`n2Py( zAUD$W?@5v;IMYsJhU1^%M@=vASJ!k}_uCgbz6d5i(sSmE_QnG>(mKpB@h|;A*Zo1t z{M0^CV>`#&6Q41r>)p>{VcPkWu}^l)dQmK5dO6pZq`iHxSr)D0uC&p|^zz>`+|S>p z($}Bp75@dxPjp?+7AL~QqJeLb@mcpd(uo3k8O_UIXPSlmsU|D~_p z9ruPcFVGX}B>kK75%_$xW4@ctGQAi@Td!eH{@YhNz6yTHbnOk7d+cA+&Pk4yBl-*I z+41y?-R)(>q|La8s69RyoN39Bd|UvIwmg( zwGz;Coyni}wpyz@UIRYe^zz?w+{ou2=qp95ID@Y@JsAOS3I9l6=Q)-io0(qzoBmti z>EvrS;$AT|kSYG?xyD4!^xv3kZQ^)S_-fOG`X%3iwWpz4shB#@JMq%qNPKPTRH19A6HTZ~abW zWAKSNp!KxD_#!i=e6Z=sF7QP7H`-bIe_Tw1UokyhnKo~Rf2TI)bKC)KE7OY=s1e2X z58^zp6|d@T>T`+#3Y^D^m2dVG5Y=(pUG=d@pSlc(=%$ReD~)6usPWA zA@HfRgPt5no3Fvl=Ndjn-Wq=0^n{v8@vEHg{T&a0@lkp~Ev0*5KZ|jZlgQ*D-P81> zH;kXUR;sPG=YjFQCnD$tnIt#y{=(NYC2z*A1raI^&H@UF!K_nfnzv_vJhP z(hhNsOq>(OFFkpfV^t1vQoGLa^>BC7gY3r;&rgUUxsObalhLN@GK z>_5Y2VjWpy9$|XH7_%E;d~6SPd=rRU4w_bl4IlC_2WMxFy^4AOO9rM+71cQlT7d;&}krE8xc zy_9p4cD8Z6EqsOPdbeI{Ox_|FogFU;pKW@=Sd_Q2Hg0vynDjo5bX}(;L$Jr+CgYFH zc#_jhFR;&4XDbtD@*nwJ_({_f{4V&r*7V|g$3MVpnVwMRp&$0tQ|&FsZ^O)C>E-?6 z&Ww}xn)1Ek<@g(QEIq#urvCCdh|gt?FNc>fJ;;73cuv}x%kkW_$sCrR51_q~ocVie z7stE8cbT59i2WNd->c8-7+>_Bp!D=z&iG!wtM<6#C*V&^Pw^+2#_h5?|I5S=QZHejy`^bZdi*kXk`=^XC=JVsvI*!+ciH~&6 zc|GUS+F85X@jbBmL)X87(RGLR&YO!nrk{jbl%7%($vfCSLOZObk!Qf~nx5llqWpJc z?EM_82FZu?lsT9@&C!coa75mQHeNS9ABNpncz@bC!ts$Xbs$~;E=11(vum*F;+Xhp zeoIeJg^%K(rt7SSk@fwfO)rQ;_9475bMO+!m%<;Lo}j1yaFDy&F^-Rg|1~|Eh7ZqR zPplgg9ZzChqfHN6!_2dC4zA>QWteqAdV=4&x70g-wNo53mW)_P*ENNn(d3IU_A!nh XgsBVZVJG-Un0z+Zbi5Y)jr9Kq50X@- diff --git a/TMessagesProj/src/main/assets/night.attheme b/TMessagesProj/src/main/assets/night.attheme index dabfb03f27..62214bb4cb 100644 --- a/TMessagesProj/src/main/assets/night.attheme +++ b/TMessagesProj/src/main/assets/night.attheme @@ -476,3 +476,6 @@ table_background=177390847 table_border=436207615 dialogCardShadow=1073741824 dialogTopBackground=-13473128 +share_icon=-1 +share_linkText=-1207959553 +share_linkBackground=352321535 diff --git a/TMessagesProj/src/main/assets/shaders/fragment3.glsl b/TMessagesProj/src/main/assets/shaders/fragment3.glsl index 5a6c1b81fd..3a4806765c 100644 --- a/TMessagesProj/src/main/assets/shaders/fragment3.glsl +++ b/TMessagesProj/src/main/assets/shaders/fragment3.glsl @@ -22,10 +22,14 @@ uniform vec3 specColor; uniform vec2 resolution; uniform vec4 gradientPosition; uniform int modelIndex; +uniform int type; uniform bool night; uniform float time; uniform mat4 world; +#define TYPE_COIN 1 +#define TYPE_DEAL 3 + void main() { vec2 uv = vUV; if (modelIndex == 2) { @@ -55,11 +59,22 @@ void main() { vec3(0.39608, 0.18824, 0.98039), diagonal ); + } else if (type == TYPE_DEAL) { + baseColor = mix( + vec3(0.91373, 0.62353, 0.99608), + vec3(0.67451, 0.58824, 1.00000), + clamp((uv.y - .1) / .8, 0.0, 1.0) + ) * 1.05; + + baseColor = mix(baseColor, vec3(1.0), .1 + .25 * texture2D(u_Texture, vUV).a); + if (night) { + baseColor = mix(baseColor, vec3(.0), .06); + } } else { baseColor = mix( vec3(0.91373, 0.62353, 0.99608), vec3(0.67451, 0.58824, 1.00000), - clamp((uv.y - .2) / .6, 0.0, 1.0) + clamp((uv.y - .1) / .8, 0.0, 1.0) ); baseColor = mix(baseColor, vec3(1.0), .1 + .45 * texture2D(u_Texture, vUV).a); diff --git a/TMessagesProj/src/main/java/androidx/recyclerview/widget/ChatListItemAnimator.java b/TMessagesProj/src/main/java/androidx/recyclerview/widget/ChatListItemAnimator.java index 7c82d91ae8..fa77ced086 100644 --- a/TMessagesProj/src/main/java/androidx/recyclerview/widget/ChatListItemAnimator.java +++ b/TMessagesProj/src/main/java/androidx/recyclerview/widget/ChatListItemAnimator.java @@ -439,12 +439,16 @@ public boolean animateRemove(RecyclerView.ViewHolder holder, ItemHolderInfo info public boolean animateMove(RecyclerView.ViewHolder holder, ItemHolderInfo info, int fromX, int fromY, int toX, int toY) { final View view = holder.itemView; ChatMessageCell chatMessageCell = null; + ChatActionCell chatActionCell = null; if (holder.itemView instanceof ChatMessageCell) { chatMessageCell = ((ChatMessageCell) holder.itemView); fromX += (int) chatMessageCell.getAnimationOffsetX(); if (chatMessageCell.getTransitionParams().lastTopOffset != chatMessageCell.getTopMediaOffset()) { fromY += chatMessageCell.getTransitionParams().lastTopOffset - chatMessageCell.getTopMediaOffset(); } + } else if (holder.itemView instanceof ChatActionCell) { + chatActionCell = ((ChatActionCell) holder.itemView); + fromX += (int) holder.itemView.getTranslationX(); } else { fromX += (int) holder.itemView.getTranslationX(); } @@ -689,16 +693,46 @@ public boolean animateMove(RecyclerView.ViewHolder holder, ItemHolderInfo info, params.changePinnedBottomProgress = 0; } - moveInfo.animateChangeInternal = chatMessageCell.getTransitionParams().animateChange(); + moveInfo.animateChangeInternal = params.animateChange(); if (moveInfo.animateChangeInternal) { - chatMessageCell.getTransitionParams().animateChange = true; - chatMessageCell.getTransitionParams().animateChangeProgress = 0f; + params.animateChange = true; + params.animateChangeProgress = 0f; } if (deltaX == 0 && deltaY == 0 && !moveInfo.animateImage && !moveInfo.animateRemoveGroup && !moveInfo.animateChangeGroupBackground && !moveInfo.animatePinnedBottom && !moveInfo.animateBackgroundOnly && !moveInfo.animateChangeInternal) { dispatchMoveFinished(holder); return false; } + } else if (chatActionCell != null) { + ChatActionCell.TransitionParams params = chatActionCell.getTransitionParams(); + + if (!params.supportChangeAnimation()) { + if (deltaX == 0 && deltaY == 0) { + dispatchMoveFinished(holder); + return false; + } + if (deltaX != 0) { + view.setTranslationX(-deltaX); + } + mPendingMoves.add(moveInfo); + checkIsRunning(); + return true; + } + + if (deltaX != 0) { + view.setTranslationX(-deltaX); + } + + moveInfo.animateChangeInternal = params.animateChange(); + if (moveInfo.animateChangeInternal) { + params.animateChange = true; + params.animateChangeProgress = 0f; + } + + if (deltaX == 0 && deltaY == 0 && !moveInfo.animateChangeInternal) { + dispatchMoveFinished(holder); + return false; + } } else if (holder.itemView instanceof BotHelpCell) { BotHelpCell botInfo = (BotHelpCell) holder.itemView; botInfo.setAnimating(true); @@ -902,6 +936,19 @@ public void onAnimationEnd(Animator animation) { }); animatorSet.playTogether(valueAnimator); } + } else if (holder.itemView instanceof ChatActionCell) { + ChatActionCell chatActionCell = (ChatActionCell) holder.itemView; + ChatActionCell.TransitionParams params = chatActionCell.getTransitionParams(); + + if (moveInfoExtended.animateChangeInternal) { + ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1f); + params.animateChange = true; + valueAnimator.addUpdateListener(animation -> { + params.animateChangeProgress = (float) animation.getAnimatedValue(); + chatActionCell.invalidate(); + }); + animatorSet.playTogether(valueAnimator); + } } if (withThanos) { @@ -1141,6 +1188,8 @@ private void restoreTransitionParams(View view) { } else if (view instanceof ChatMessageCell) { ((ChatMessageCell) view).getTransitionParams().resetAnimation(); ((ChatMessageCell) view).setAnimationOffsetX(0f); + } else if (view instanceof ChatActionCell) { + ((ChatActionCell) view).getTransitionParams().resetAnimation(); } else { view.setTranslationX(0f); } diff --git a/TMessagesProj/src/main/java/androidx/recyclerview/widget/ItemTouchHelper.java b/TMessagesProj/src/main/java/androidx/recyclerview/widget/ItemTouchHelper.java index 1901e21f3b..c667072d32 100644 --- a/TMessagesProj/src/main/java/androidx/recyclerview/widget/ItemTouchHelper.java +++ b/TMessagesProj/src/main/java/androidx/recyclerview/widget/ItemTouchHelper.java @@ -694,9 +694,7 @@ public void onAnimationEnd(Animator animation) { if (actionState == ACTION_STATE_DRAG) { try { mSelected.itemView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - } catch (Exception ignore) { - - } + } catch (Exception ignore) {} } } final ViewParent rvParent = mRecyclerView.getParent(); diff --git a/TMessagesProj/src/main/java/androidx/recyclerview/widget/RecyclerView.java b/TMessagesProj/src/main/java/androidx/recyclerview/widget/RecyclerView.java index 9266c70d2c..ed8330692f 100644 --- a/TMessagesProj/src/main/java/androidx/recyclerview/widget/RecyclerView.java +++ b/TMessagesProj/src/main/java/androidx/recyclerview/widget/RecyclerView.java @@ -778,7 +778,8 @@ String exceptionLabel() { sb.append(" ").append(super.toString()) .append(", adapter:").append(mAdapter) .append(", layout:").append(mLayout) - .append(", context:").append(getContext()); + .append(", context:").append(getContext()) + .append(", ainfo:").append(moreInfo); final String lastNotifies = mAdapterHelper.getLastNotifies(); if (lastNotifies != null) { sb.append(", last notifies:\n").append(lastNotifies); @@ -786,6 +787,11 @@ String exceptionLabel() { return sb.toString(); } + private String moreInfo; + public void setAdditionalDebugInfo(String moreInfo) { + this.moreInfo = moreInfo; + } + /** * If not explicitly specified, this view and its children don't support autofill. *

diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java index 6d8cae3fec..24a3b15e29 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java @@ -305,6 +305,7 @@ public static Typeface bold() { public static Pattern BAD_CHARS_MESSAGE_PATTERN = null; public static Pattern BAD_CHARS_MESSAGE_LONG_PATTERN = null; public static Pattern REMOVE_MULTIPLE_DIACRITICS = null; + public static Pattern REMOVE_RTL = null; private static Pattern singleTagPatter = null; public static String removeDiacritics(String str) { @@ -315,6 +316,20 @@ public static String removeDiacritics(String str) { return matcher.replaceAll("$1"); } + public static String removeRTL(String str) { + if (str == null) return null; + if (REMOVE_RTL == null) { + REMOVE_RTL = Pattern.compile("[\\u200E\\u200F\\u202A-\\u202E]"); + } + Matcher matcher = REMOVE_RTL.matcher(str); + if (matcher == null) return str; + return matcher.replaceAll(""); + } + + public static String escape(String str) { + return removeRTL(removeDiacritics(str)); + } + static { try { final String GOOD_IRI_CHAR = "a-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF"; @@ -971,6 +986,16 @@ public static void getBitmapFromSurface(SurfaceView surfaceView, Bitmap surfaceB } } + @RequiresApi(api = Build.VERSION_CODES.N) + public static void getBitmapFromSurface(SurfaceView surfaceView, Bitmap surfaceBitmap, Runnable done) { + if (surfaceView == null || ApplicationLoader.applicationHandler == null || !surfaceView.getHolder().getSurface().isValid()) { + return; + } + PixelCopy.request(surfaceView, surfaceBitmap, copyResult -> { + done.run(); + }, ApplicationLoader.applicationHandler); + } + @RequiresApi(api = Build.VERSION_CODES.N) public static void getBitmapFromSurface(Surface surface, Bitmap surfaceBitmap) { if (surface == null || !surface.isValid()) { @@ -1018,6 +1043,13 @@ public static float[] getCoordinateInParent(ViewGroup parentView, View view) { } public static void doOnLayout(View view, Runnable runnable) { + if (runnable == null) { + return; + } + if (view == null) { + runnable.run(); + return; + } view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { @Override public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { @@ -2666,6 +2698,7 @@ public static void checkDisplaySize(Context context, Configuration newConfigurat } ViewConfiguration vc = ViewConfiguration.get(context); touchSlop = vc.getScaledTouchSlop(); + isSmallScreen = null; } catch (Exception e) { FileLog.e(e); } @@ -3212,6 +3245,14 @@ public static SpannableStringBuilder replaceTags(String str, int flag, Object... return new SpannableStringBuilder(str); } + public static CharSequence replaceTags(CharSequence cs) { + if (cs instanceof SpannableStringBuilder) { + return replaceTags((SpannableStringBuilder) cs); + } else { + return replaceTags(new SpannableStringBuilder(cs)); + } + } + public static SpannableStringBuilder replaceTags(SpannableStringBuilder stringBuilder) { try { int start; @@ -3753,6 +3794,23 @@ public static String formatShortDuration(int duration) { return formatDuration(duration, false); } + public static String formatTimestamp(int duration) { + int h = duration / 3600; + int m = duration / 60 % 60; + int s = duration % 60; + if (h > 0) { + return String.format(Locale.US, "%dh%02dm%02ds", h, m, s); + } + if (m > 0) { + if (s > 0) { + return String.format(Locale.US, "%dm%02ds", m, s); + } else { + return String.format(Locale.US, "%dm", m); + } + } + return String.format(Locale.US, "%d", s); + } + public static String formatLongDuration(int duration) { return formatDuration(duration, true); } @@ -4898,6 +4956,10 @@ public static float lerp(float a, float b, float f) { return a + f * (b - a); } + public static float lerp(boolean a, boolean b, float f) { + return (a ? 1.0f : 0.0f) + f * ((b ? 1.0f : 0.0f) - (a ? 1.0f : 0.0f)); + } + public static double lerp(double a, double b, float f) { return a + f * (b - a); } @@ -4946,6 +5008,24 @@ public static void lerp(int[] a, int[] b, float f, int[] to) { } } + public static void lerp(float[] a, float[] b, float f, float[] to) { + if (to == null) return; + for (int i = 0; i < to.length; ++i) { + float av = a == null || i >= a.length ? 0 : a[i]; + float bv = b == null || i >= b.length ? 0 : b[i]; + to[i] = lerp(av, bv, f); + } + } + + private static final float[] tempFloats = new float[9], tempFloats2 = new float[9]; + public static void lerp(Matrix a, Matrix b, float t, Matrix to) { + if (a == null || b == null) return; + a.getValues(tempFloats); + b.getValues(tempFloats2); + lerp(tempFloats, tempFloats2, t, tempFloats2); + to.setValues(tempFloats2); + } + public static void scaleRect(RectF rect, float scale) { scaleRect(rect, scale, rect.centerX(), rect.centerY()); } @@ -5401,8 +5481,8 @@ public static void updateViewShow(View view, boolean show, boolean scale, float view.setVisibility(show ? View.VISIBLE : View.GONE); view.setTag(show ? 1 : null); view.setAlpha(1f); - view.setScaleX(scale && !show ? 0f : 1f); - view.setScaleY(scale && !show ? 0f : 1f); + view.setScaleX(scale && !show ? 0.5f : 1f); + view.setScaleY(scale && !show ? 0.5f : 1f); if (translate != 0) { view.setTranslationY(show ? 0 : AndroidUtilities.dp(-16) * translate); } @@ -5413,8 +5493,8 @@ public static void updateViewShow(View view, boolean show, boolean scale, float if (view.getVisibility() != View.VISIBLE) { view.setVisibility(View.VISIBLE); view.setAlpha(0f); - view.setScaleX(scale ? 0 : 1); - view.setScaleY(scale ? 0 : 1); + view.setScaleX(scale ? 0.5f : 1); + view.setScaleY(scale ? 0.5f : 1); if (translate != 0) { view.setTranslationY(AndroidUtilities.dp(-16) * translate); } @@ -5427,7 +5507,7 @@ public static void updateViewShow(View view, boolean show, boolean scale, float animate.start(); } else { ViewPropertyAnimator animate = view.animate(); - animate = animate.alpha(0).scaleY(scale ? 0 : 1).scaleX(scale ? 0 : 1).setListener(new HideViewAfterAnimation(view)).setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT).setDuration(340).withEndAction(onDone); + animate = animate.alpha(0).scaleY(scale ? 0.5f : 1).scaleX(scale ? 0.5f : 1).setListener(new HideViewAfterAnimation(view)).setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT).setDuration(340).withEndAction(onDone); if (translate != 0) { animate.translationY(AndroidUtilities.dp(-16) * translate); } @@ -5629,7 +5709,7 @@ public static List allGlobalViews() { views.add((View) getRootView.invoke(wmgInstance, viewName)); } return views; - } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { + } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { Class wmiClass = Class.forName("android.view.WindowManagerImpl"); Object wmiInstance = wmiClass.getMethod("getDefault").invoke(null); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/BirthdayController.java b/TMessagesProj/src/main/java/org/telegram/messenger/BirthdayController.java index 31e27942ab..67e1dc91a6 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/BirthdayController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/BirthdayController.java @@ -1,17 +1,18 @@ package org.telegram.messenger; import android.content.SharedPreferences; -import android.os.Build; import org.telegram.tgnet.AbstractSerializedData; import org.telegram.tgnet.ConnectionsManager; +import org.telegram.tgnet.InputSerializedData; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import java.util.ArrayList; import java.util.Calendar; -import java.util.HashMap; import java.util.HashSet; import java.util.Set; @@ -62,7 +63,7 @@ private BirthdayController(int currentAccount) { MessagesStorage.getInstance(currentAccount).getStorageQueue().postRunnable(() -> { final ArrayList users = MessagesStorage.getInstance(currentAccount).getUsers(uids); AndroidUtilities.runOnUIThread(() -> { - TLRPC.TL_contacts_contactBirthdays contacts = new TLRPC.TL_contacts_contactBirthdays(); + TL_account.contactBirthdays contacts = new TL_account.contactBirthdays(); contacts.contacts = birthdays.contacts; contacts.users = users; state = BirthdayState.from(contacts); @@ -104,10 +105,10 @@ public void check() { } loading = true; - ConnectionsManager.getInstance(currentAccount).sendRequest(new TLRPC.TL_account_getBirthdays(), (res, err) -> AndroidUtilities.runOnUIThread(() -> { - if (res instanceof TLRPC.TL_contacts_contactBirthdays) { + ConnectionsManager.getInstance(currentAccount).sendRequest(new TL_account.getBirthdays(), (res, err) -> AndroidUtilities.runOnUIThread(() -> { + if (res instanceof TL_account.contactBirthdays) { lastCheckDate = System.currentTimeMillis(); - TLRPC.TL_contacts_contactBirthdays response = (TLRPC.TL_contacts_contactBirthdays) res; + TL_account.contactBirthdays response = (TL_account.contactBirthdays) res; state = BirthdayState.from(response); MessagesController.getInstance(currentAccount).putUsers(response.users, false); @@ -171,7 +172,7 @@ private BirthdayState(String yesterdayKey, String todayKey, String tomorrowKey) this.tomorrowKey = tomorrowKey; } - public static BirthdayState from(TLRPC.TL_contacts_contactBirthdays tl) { + public static BirthdayState from(TL_account.contactBirthdays tl) { Calendar calendar = Calendar.getInstance(); int todayDay = calendar.get(Calendar.DAY_OF_MONTH); int todayMonth = 1 + calendar.get(Calendar.MONTH); @@ -194,7 +195,7 @@ public static BirthdayState from(TLRPC.TL_contacts_contactBirthdays tl) { tomorrowDay + "_" + tomorrowMonth + "_" + tomorrowYear ); - for (TLRPC.TL_contactBirthday contact : tl.contacts) { + for (TL_account.TL_contactBirthday contact : tl.contacts) { ArrayList array = null; if (contact.birthday.day == todayDay && contact.birthday.month == todayMonth) { array = state.today; @@ -244,9 +245,9 @@ public boolean contains(long did) { private static class TL_birthdays extends TLObject { public static final int constructor = 0x114ff30d; - public ArrayList contacts = new ArrayList<>(); + public ArrayList contacts = new ArrayList<>(); - public static TL_birthdays TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_birthdays TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (constructor != TL_birthdays.constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_birthdays", constructor)); @@ -259,7 +260,7 @@ public static TL_birthdays TLdeserialize(AbstractSerializedData stream, int cons } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { int magic = stream.readInt32(exception); if (magic != 0x1cb5c415) { if (exception) { @@ -269,12 +270,12 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } int count = stream.readInt32(exception); for (int i = 0; i < count; ++i) { - contacts.add(TLRPC.TL_contactBirthday.TLdeserialize(stream, stream.readInt32(exception), exception)); + contacts.add(TL_account.TL_contactBirthday.TLdeserialize(stream, stream.readInt32(exception), exception)); } } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(0x1cb5c415); int count = contacts.size(); @@ -299,7 +300,7 @@ public static boolean isToday(TLRPC.UserFull userFull) { return isToday(userFull.birthday); } - public static boolean isToday(TLRPC.TL_birthday birthday) { + public static boolean isToday(TL_account.TL_birthday birthday) { if (birthday == null) return false; Calendar calendar = Calendar.getInstance(); int todayDay = calendar.get(Calendar.DAY_OF_MONTH); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/CacheByChatsController.java b/TMessagesProj/src/main/java/org/telegram/messenger/CacheByChatsController.java index c3f23d1782..9f87b7ad2b 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/CacheByChatsController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/CacheByChatsController.java @@ -28,13 +28,11 @@ public class CacheByChatsController { private final int currentAccount; - int[] keepMediaByTypes = {-1, -1, -1, -1}; + private boolean gotKeepMediaByTypes = false; + private final int[] keepMediaByTypes = { -1, -1, -1, -1 }; public CacheByChatsController(int currentAccount) { this.currentAccount = currentAccount; - for (int i = 0; i < 4; i++) { - keepMediaByTypes[i] = SharedConfig.getPreferences().getInt("keep_media_type_" + i, getDefault(i)); - } } public static int getDefault(int type) { @@ -122,6 +120,12 @@ public void saveKeepMediaExceptions(int type, ArrayList exce } public int getKeepMedia(int type) { + if (!gotKeepMediaByTypes) { + gotKeepMediaByTypes = true; + for (int i = 0; i < 4; i++) { + keepMediaByTypes[i] = SharedConfig.getPreferences().getInt("keep_media_type_" + i, getDefault(i)); + } + } if (keepMediaByTypes[type] == -1) { return SharedConfig.keepMedia; } @@ -129,6 +133,12 @@ public int getKeepMedia(int type) { } public void setKeepMedia(int type, int keepMedia) { + if (!gotKeepMediaByTypes) { + gotKeepMediaByTypes = true; + for (int i = 0; i < 4; i++) { + keepMediaByTypes[i] = SharedConfig.getPreferences().getInt("keep_media_type_" + i, getDefault(i)); + } + } keepMediaByTypes[type] = keepMedia; SharedConfig.getPreferences().edit().putInt("keep_media_type_" + type, keepMedia).apply(); } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ChatMessagesMetadataController.java b/TMessagesProj/src/main/java/org/telegram/messenger/ChatMessagesMetadataController.java index b1976116a3..4a5233dd54 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ChatMessagesMetadataController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ChatMessagesMetadataController.java @@ -10,9 +10,9 @@ public class ChatMessagesMetadataController { final ChatActivity chatActivity; - private ArrayList reactionsToCheck = new ArrayList<>(10); - private ArrayList extendedMediaToCheck = new ArrayList<>(10); - private ArrayList storiesToCheck = new ArrayList<>(10); + private final ArrayList reactionsToCheck = new ArrayList<>(10); + private final ArrayList extendedMediaToCheck = new ArrayList<>(10); + private final ArrayList storiesToCheck = new ArrayList<>(10); ArrayList reactionsRequests = new ArrayList<>(); ArrayList extendedMediaRequests = new ArrayList<>(); @@ -38,7 +38,7 @@ public void checkMessages(ChatActivity.ChatActivityAdapter chatAdapter, int maxA storiesToCheck.clear(); for (int i = from; i < to; i++) { MessageObject messageObject = messages.get(i); - if (chatActivity.getThreadMessage() != messageObject && messageObject.getId() > 0 && messageObject.messageOwner.action == null && (currentTime - messageObject.reactionsLastCheckTime) > 15000L) { + if (chatActivity.getThreadMessage() != messageObject && messageObject.getId() > 0 && (messageObject.messageOwner.action == null || messageObject.canSetReaction()) && (currentTime - messageObject.reactionsLastCheckTime) > 15000L) { messageObject.reactionsLastCheckTime = currentTime; reactionsToCheck.add(messageObject); } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ChatObject.java b/TMessagesProj/src/main/java/org/telegram/messenger/ChatObject.java index 58f130c00b..996449277e 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ChatObject.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ChatObject.java @@ -21,6 +21,7 @@ import org.telegram.messenger.voip.Instance; import org.telegram.messenger.voip.VoIPService; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_phone; import org.telegram.ui.GroupCallActivity; import java.lang.annotation.Retention; @@ -270,7 +271,7 @@ public void run() { } }; - public void setCall(AccountInstance account, long chatId, TLRPC.TL_phone_groupCall groupCall) { + public void setCall(AccountInstance account, long chatId, TL_phone.groupCall groupCall) { this.chatId = chatId; currentAccount = account; call = groupCall.call; @@ -308,7 +309,7 @@ public void setCall(AccountInstance account, long chatId, TLRPC.TL_phone_groupCa // }, ConnectionsManager.RequestFlagFailOnServerErrors, ConnectionsManager.ConnectionTypeDownload, call.stream_dc_id); // } - public void createRtmpStreamParticipant(List channels) { + public void createRtmpStreamParticipant(List channels) { if (loadedRtmpStreamParticipant && rtmpStreamParticipant != null) { return; } @@ -318,7 +319,7 @@ public void createRtmpStreamParticipant(List ch participant.video = new TLRPC.TL_groupCallParticipantVideo(); TLRPC.TL_groupCallParticipantVideoSourceGroup sourceGroup = new TLRPC.TL_groupCallParticipantVideoSourceGroup(); sourceGroup.semantics = "SIM"; - for (TLRPC.TL_groupCallStreamChannel channel : channels) { + for (TL_phone.TL_groupCallStreamChannel channel : channels) { sourceGroup.sources.add(channel.channel); } participant.video.source_groups.add(sourceGroup); @@ -504,7 +505,7 @@ public void loadMembers(boolean fromBegin) { reloadingMembers = true; } loadingMembers = true; - TLRPC.TL_phone_getGroupParticipants req = new TLRPC.TL_phone_getGroupParticipants(); + TL_phone.getGroupParticipants req = new TL_phone.getGroupParticipants(); req.call = getInputGroupCall(); req.offset = nextLoadOffset != null ? nextLoadOffset : ""; req.limit = 20; @@ -514,7 +515,7 @@ public void loadMembers(boolean fromBegin) { reloadingMembers = false; } if (response != null) { - TLRPC.TL_phone_groupParticipants groupParticipants = (TLRPC.TL_phone_groupParticipants) response; + TL_phone.groupParticipants groupParticipants = (TL_phone.groupParticipants) response; currentAccount.getMessagesController().putUsers(groupParticipants.users, false); currentAccount.getMessagesController().putChats(groupParticipants.chats, false); onParticipantsLoad(groupParticipants.participants, fromBegin, req.offset, groupParticipants.next_offset, groupParticipants.version, groupParticipants.count); @@ -530,7 +531,7 @@ private void setParticiapantsVolume() { } public void setTitle(String title) { - TLRPC.TL_phone_editGroupCallTitle req = new TLRPC.TL_phone_editGroupCallTitle(); + TL_phone.editGroupCallTitle req = new TL_phone.editGroupCallTitle(); req.call = getInputGroupCall(); req.title = title; currentAccount.getConnectionsManager().sendRequest(req, (response, error) -> { @@ -596,7 +597,7 @@ private void loadUnknownParticipants(ArrayList participantsToLoad, boolean int guid = ++lastLoadGuid; loadingGuids.add(guid); set.addAll(participantsToLoad); - TLRPC.TL_phone_getGroupParticipants req = new TLRPC.TL_phone_getGroupParticipants(); + TL_phone.getGroupParticipants req = new TL_phone.getGroupParticipants(); req.call = getInputGroupCall(); for (int a = 0, N = participantsToLoad.size(); a < N; a++) { long uid = participantsToLoad.get(a); @@ -628,7 +629,7 @@ private void loadUnknownParticipants(ArrayList participantsToLoad, boolean return; } if (response != null) { - TLRPC.TL_phone_groupParticipants groupParticipants = (TLRPC.TL_phone_groupParticipants) response; + TL_phone.groupParticipants groupParticipants = (TL_phone.groupParticipants) response; currentAccount.getMessagesController().putUsers(groupParticipants.users, false); currentAccount.getMessagesController().putChats(groupParticipants.chats, false); for (int a = 0, N = groupParticipants.participants.size(); a < N; a++) { @@ -915,12 +916,12 @@ private void checkQueue() { } public void reloadGroupCall() { - TLRPC.TL_phone_getGroupCall req = new TLRPC.TL_phone_getGroupCall(); + TL_phone.getGroupCall req = new TL_phone.getGroupCall(); req.call = getInputGroupCall(); req.limit = 100; currentAccount.getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { - if (response instanceof TLRPC.TL_phone_groupCall) { - TLRPC.TL_phone_groupCall phoneGroupCall = (TLRPC.TL_phone_groupCall) response; + if (response instanceof TL_phone.groupCall) { + TL_phone.groupCall phoneGroupCall = (TL_phone.groupCall) response; call = phoneGroupCall.call; currentAccount.getMessagesController().putUsers(phoneGroupCall.users, false); currentAccount.getMessagesController().putChats(phoneGroupCall.chats, false); @@ -934,7 +935,7 @@ private void loadGroupCall() { return; } loadingGroupCall = true; - TLRPC.TL_phone_getGroupParticipants req = new TLRPC.TL_phone_getGroupParticipants(); + TL_phone.getGroupParticipants req = new TL_phone.getGroupParticipants(); req.call = getInputGroupCall(); req.offset = ""; req.limit = 1; @@ -942,7 +943,7 @@ private void loadGroupCall() { lastGroupCallReloadTime = SystemClock.elapsedRealtime(); loadingGroupCall = false; if (response != null) { - TLRPC.TL_phone_groupParticipants res = (TLRPC.TL_phone_groupParticipants) response; + TL_phone.groupParticipants res = (TL_phone.groupParticipants) response; currentAccount.getMessagesController().putUsers(res.users, false); currentAccount.getMessagesController().putChats(res.chats, false); if (call.participants_count != res.count) { @@ -1468,7 +1469,7 @@ private void checkOnlineParticipants() { public void toggleRecord(String title, @RecordType int type) { recording = !recording; - TLRPC.TL_phone_toggleGroupCallRecord req = new TLRPC.TL_phone_toggleGroupCallRecord(); + TL_phone.toggleGroupCallRecord req = new TL_phone.toggleGroupCallRecord(); req.call = getInputGroupCall(); req.start = recording; if (title != null) { @@ -2275,8 +2276,18 @@ public static int getProfileColorId(TLRPC.Chat chat) { } public static long getProfileEmojiId(TLRPC.Chat chat) { + if (chat != null && chat.emoji_status instanceof TLRPC.TL_emojiStatusCollectible) { + return ((TLRPC.TL_emojiStatusCollectible) chat.emoji_status).pattern_document_id; + } if (chat != null && chat.profile_color != null && (chat.profile_color.flags & 2) != 0) return chat.profile_color.background_emoji_id; return 0; } + public static long getProfileCollectibleId(TLRPC.Chat chat) { + if (chat != null && chat.emoji_status instanceof TLRPC.TL_emojiStatusCollectible) { + return ((TLRPC.TL_emojiStatusCollectible) chat.emoji_status).collectible_id; + } + return 0; + } + } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ChatThemeController.java b/TMessagesProj/src/main/java/org/telegram/messenger/ChatThemeController.java index e71d7e30b4..168e02356e 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ChatThemeController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ChatThemeController.java @@ -11,6 +11,7 @@ import org.telegram.tgnet.ResultCallback; import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.EmojiThemes; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.ChatBackgroundDrawable; @@ -72,13 +73,13 @@ public void requestAllChatThemes(final ResultCallback> callbac boolean needReload = System.currentTimeMillis() - lastReloadTimeMs > reloadTimeoutMs; if (allChatThemes == null || allChatThemes.isEmpty() || needReload) { - TLRPC.TL_account_getChatThemes request = new TLRPC.TL_account_getChatThemes(); + TL_account.getChatThemes request = new TL_account.getChatThemes(); request.hash = themesHash; ConnectionsManager.getInstance(UserConfig.selectedAccount).sendRequest(request, (response, error) -> chatThemeQueue.postRunnable(() -> { boolean isError = false; final List chatThemes; - if (response instanceof TLRPC.TL_account_themes) { - TLRPC.TL_account_themes resp = (TLRPC.TL_account_themes) response; + if (response instanceof TL_account.TL_themes) { + TL_account.TL_themes resp = (TL_account.TL_themes) response; themesHash = resp.hash; lastReloadTimeMs = System.currentTimeMillis(); @@ -99,7 +100,7 @@ public void requestAllChatThemes(final ResultCallback> callbac chatThemes.add(chatTheme); } editor.apply(); - } else if (response instanceof TLRPC.TL_account_themesNotModified) { + } else if (response instanceof TL_account.TL_themesNotModified) { // if (allChatThemes == null || allChatThemes.isEmpty()) { chatThemes = getAllChatThemesFromPrefs(); // } else { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ContactsController.java b/TMessagesProj/src/main/java/org/telegram/messenger/ContactsController.java index 22fc644386..99cbbc8261 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ContactsController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ContactsController.java @@ -31,12 +31,12 @@ import androidx.annotation.NonNull; import androidx.collection.LongSparseArray; -import com.google.android.exoplayer2.util.Log; - import org.telegram.PhoneFormat.PhoneFormat; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.Components.Bulletin; @@ -2585,10 +2585,10 @@ private void reloadContactsStatuses() { editor.putBoolean("needGetStatuses", true).commit(); TLRPC.TL_contacts_getStatuses req = new TLRPC.TL_contacts_getStatuses(); getConnectionsManager().sendRequest(req, (response, error) -> { - if (error == null) { + if (response instanceof Vector) { AndroidUtilities.runOnUIThread(() -> { editor.remove("needGetStatuses").commit(); - TLRPC.Vector vector = (TLRPC.Vector) response; + Vector vector = (Vector) response; if (!vector.objects.isEmpty()) { ArrayList dbUsersStatus = new ArrayList<>(); for (Object object : vector.objects) { @@ -2624,7 +2624,7 @@ private void reloadContactsStatuses() { public void loadGlobalPrivacySetting() { if (loadingGlobalSettings == 0) { loadingGlobalSettings = 1; - TLRPC.TL_account_getGlobalPrivacySettings req = new TLRPC.TL_account_getGlobalPrivacySettings(); + TL_account.getGlobalPrivacySettings req = new TL_account.getGlobalPrivacySettings(); getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (error == null) { globalPrivacySettings = (TLRPC.TL_globalPrivacySettings) response; @@ -2640,7 +2640,7 @@ public void loadGlobalPrivacySetting() { public void loadPrivacySettings() { if (loadingDeleteInfo == 0) { loadingDeleteInfo = 1; - TLRPC.TL_account_getAccountTTL req = new TLRPC.TL_account_getAccountTTL(); + TL_account.getAccountTTL req = new TL_account.getAccountTTL(); getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (error == null) { TLRPC.TL_accountDaysTTL ttl = (TLRPC.TL_accountDaysTTL) response; @@ -2660,7 +2660,7 @@ public void loadPrivacySettings() { loadingPrivacyInfo[a] = 1; final int num = a; - TLRPC.TL_account_getPrivacy req = new TLRPC.TL_account_getPrivacy(); + TL_account.getPrivacy req = new TL_account.getPrivacy(); switch (num) { case PRIVACY_RULES_TYPE_LASTSEEN: @@ -2705,7 +2705,7 @@ public void loadPrivacySettings() { getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (error == null) { - TLRPC.TL_account_privacyRules rules = (TLRPC.TL_account_privacyRules) response; + TL_account.privacyRules rules = (TL_account.privacyRules) response; getMessagesController().putUsers(rules.users, false); getMessagesController().putChats(rules.chats, false); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/DatabaseMigrationHelper.java b/TMessagesProj/src/main/java/org/telegram/messenger/DatabaseMigrationHelper.java index d53f437793..1f6d1eeb8b 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/DatabaseMigrationHelper.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/DatabaseMigrationHelper.java @@ -1535,6 +1535,25 @@ public static int migrate(MessagesStorage messagesStorage, int version) throws E version = 159; } + if (version == 159) { + database.executeFast("ALTER TABLE dialog_filter ADD COLUMN entities BLOB").stepThis().dispose(); + database.executeFast("PRAGMA user_version = 160").stepThis().dispose(); + version = 160; + } + + if (version == 160) { + database.executeFast("ALTER TABLE dialog_filter ADD COLUMN noanimate INTEGER").stepThis().dispose(); + database.executeFast("PRAGMA user_version = 161").stepThis().dispose(); + version = 161; + } + + if (version == 161) { + database.executeFast("DELETE FROM popular_bots").stepThis().dispose(); + database.executeFast("ALTER TABLE popular_bots ADD COLUMN pos INTEGER").stepThis().dispose(); + database.executeFast("PRAGMA user_version = 162").stepThis().dispose(); + version = 162; + } + return version; } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/DialogObject.java b/TMessagesProj/src/main/java/org/telegram/messenger/DialogObject.java index cb2e354a6b..da24d60bb2 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/DialogObject.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/DialogObject.java @@ -10,13 +10,15 @@ import android.text.TextUtils; +import androidx.annotation.NonNull; + import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_bots; import org.telegram.ui.Components.AvatarDrawable; import org.telegram.ui.Components.BackupImageView; import java.util.ArrayList; -import java.util.HashSet; public class DialogObject { @@ -153,6 +155,49 @@ public static String setDialogPhotoTitle(ImageReceiver imageReceiver, AvatarDraw return title; } + @NonNull + public static String getName(long dialogId) { + return getName(MessagesController.getInstance(UserConfig.selectedAccount).getUserOrChat(dialogId)); + } + + @NonNull + public static String getName(TLObject obj) { + if (obj instanceof TLRPC.User) { + return UserObject.getUserName((TLRPC.User) obj); + } else if (obj instanceof TLRPC.Chat) { + final TLRPC.Chat chat = (TLRPC.Chat) obj; + return chat != null ? chat.title : ""; + } else { + return ""; + } + } + + @NonNull + public static String getShortName(long dialogId) { + return getShortName(MessagesController.getInstance(UserConfig.selectedAccount).getUserOrChat(dialogId)); + } + + @NonNull + public static String getShortName(TLObject obj) { + if (obj instanceof TLRPC.User) { + return UserObject.getForcedFirstName((TLRPC.User) obj); + } else if (obj instanceof TLRPC.Chat) { + final TLRPC.Chat chat = (TLRPC.Chat) obj; + return chat != null ? chat.title : ""; + } else { + return ""; + } + } + + public static boolean hasPhoto(TLObject obj) { + if (obj instanceof TLRPC.User) { + return ((TLRPC.User) obj).photo != null; + } else if (obj instanceof TLRPC.Chat) { + return ((TLRPC.Chat) obj).photo != null; + } + return false; + } + public static String setDialogPhotoTitle(BackupImageView imageView, TLObject dialog) { if (imageView != null) { return setDialogPhotoTitle(imageView.getImageReceiver(), imageView.getAvatarDrawable(), dialog); @@ -262,28 +307,107 @@ public static int editDistance(String s1, String s2) { return costs[s2.length()]; } + public static boolean isEmojiStatusCollectible(long dialogId) { + if (dialogId >= 0) { + final TLRPC.User user = MessagesController.getInstance(UserConfig.selectedAccount).getUser(dialogId); + if (user == null) return false; + return isEmojiStatusCollectible(user.emoji_status); + } else { + final TLRPC.Chat chat = MessagesController.getInstance(UserConfig.selectedAccount).getChat(-dialogId); + if (chat == null) return false; + return isEmojiStatusCollectible(chat.emoji_status); + } + } + + public static boolean isEmojiStatusCollectible(TLRPC.EmojiStatus emojiStatus) { + if (MessagesController.getInstance(UserConfig.selectedAccount).premiumFeaturesBlocked()) { + return false; + } + if (emojiStatus instanceof TLRPC.TL_emojiStatusCollectible) { + final TLRPC.TL_emojiStatusCollectible status = (TLRPC.TL_emojiStatusCollectible) emojiStatus; + if ((status.flags & 1) != 0 && status.until <= (int) (System.currentTimeMillis() / 1000)) { + return false; + } + return true; + } + return false; + } + + public static long getEmojiStatusDocumentId(long dialogId) { + if (dialogId >= 0) { + final TLRPC.User user = MessagesController.getInstance(UserConfig.selectedAccount).getUser(dialogId); + if (user == null) return 0; + return getEmojiStatusDocumentId(user.emoji_status); + } else { + final TLRPC.Chat chat = MessagesController.getInstance(UserConfig.selectedAccount).getChat(-dialogId); + if (chat == null) return 0; + return getEmojiStatusDocumentId(chat.emoji_status); + } + } + public static long getEmojiStatusDocumentId(TLRPC.EmojiStatus emojiStatus) { if (MessagesController.getInstance(UserConfig.selectedAccount).premiumFeaturesBlocked()) { return 0; } if (emojiStatus instanceof TLRPC.TL_emojiStatus) { - return ((TLRPC.TL_emojiStatus) emojiStatus).document_id; - } else if (emojiStatus instanceof TLRPC.TL_emojiStatusUntil && ((TLRPC.TL_emojiStatusUntil) emojiStatus).until > (int) (System.currentTimeMillis() / 1000)) { - return ((TLRPC.TL_emojiStatusUntil) emojiStatus).document_id; - } else { + final TLRPC.TL_emojiStatus status = (TLRPC.TL_emojiStatus) emojiStatus; + if ((status.flags & 1) != 0 && status.until <= (int) (System.currentTimeMillis() / 1000)) { + return 0; + } + return status.document_id; + } else if (emojiStatus instanceof TLRPC.TL_emojiStatusCollectible) { + final TLRPC.TL_emojiStatusCollectible status = (TLRPC.TL_emojiStatusCollectible) emojiStatus; + if ((status.flags & 1) != 0 && status.until <= (int) (System.currentTimeMillis() / 1000)) { + return 0; + } + return status.document_id; + } + return 0; + } + + public static long getEmojiStatusCollectibleId(TLRPC.EmojiStatus emojiStatus) { + if (MessagesController.getInstance(UserConfig.selectedAccount).premiumFeaturesBlocked()) { return 0; } + if (emojiStatus instanceof TLRPC.TL_emojiStatusCollectible) { + final TLRPC.TL_emojiStatusCollectible status = (TLRPC.TL_emojiStatusCollectible) emojiStatus; + if ((status.flags & 1) != 0 && status.until <= (int) (System.currentTimeMillis() / 1000)) { + return 0; + } + return status.collectible_id; + } + return 0; } public static int getEmojiStatusUntil(TLRPC.EmojiStatus emojiStatus) { - if (emojiStatus instanceof TLRPC.TL_emojiStatusUntil && ((TLRPC.TL_emojiStatusUntil) emojiStatus).until > (int) (System.currentTimeMillis() / 1000)) { - return ((TLRPC.TL_emojiStatusUntil) emojiStatus).until; + if (emojiStatus instanceof TLRPC.TL_emojiStatus) { + final TLRPC.TL_emojiStatus status = (TLRPC.TL_emojiStatus) emojiStatus; + if ((status.flags & 1) != 0) { + return status.until; + } + } else if (emojiStatus instanceof TLRPC.TL_emojiStatusCollectible) { + final TLRPC.TL_emojiStatusCollectible status = (TLRPC.TL_emojiStatusCollectible) emojiStatus; + if ((status.flags & 1) != 0) { + return status.until; + } } return 0; } + public static TLRPC.EmojiStatus filterEmojiStatus(TLRPC.EmojiStatus emojiStatus) { + final int until = getEmojiStatusUntil(emojiStatus); + if (until != 0 && until <= (int) (System.currentTimeMillis() / 1000)) { + return null; + } + return emojiStatus; + } + public static boolean emojiStatusesEqual(TLRPC.EmojiStatus a, TLRPC.EmojiStatus b) { - return getEmojiStatusDocumentId(a) == getEmojiStatusDocumentId(b) && getEmojiStatusUntil(a) == getEmojiStatusUntil(b); + return ( + getEmojiStatusDocumentId(a) == getEmojiStatusDocumentId(b) && + getEmojiStatusCollectibleId(a) == getEmojiStatusCollectibleId(b) && + getEmojiStatusUntil(a) == getEmojiStatusUntil(b) + ); } public static TLRPC.TL_username findUsername(String username, TLRPC.User user) { @@ -306,4 +430,24 @@ public static TLRPC.TL_username findUsername(String username, ArrayList queues = new LinkedList<>(); - private SparseIntArray busyQueuesMap = new SparseIntArray(); - private LinkedList busyQueues = new LinkedList<>(); + private final LinkedList queues = new LinkedList<>(); + private final SparseIntArray busyQueuesMap = new SparseIntArray(); + private final LinkedList busyQueues = new LinkedList<>(); private int maxCount; private int createdCount; private int guid; private int totalTasksCount; private boolean cleanupScheduled; - private Runnable cleanupRunnable = new Runnable() { + private final Runnable cleanupRunnable = new Runnable() { @Override public void run() { if (!queues.isEmpty()) { @@ -52,6 +54,10 @@ public DispatchQueuePool(int count) { @UiThread public void execute(Runnable runnable) { + if (Looper.myLooper() != Looper.getMainLooper()) { + AndroidUtilities.runOnUIThread(() -> execute(runnable)); + return; + } DispatchQueue queue; if (!busyQueues.isEmpty() && (totalTasksCount / 2 <= busyQueues.size() || queues.isEmpty() && createdCount >= maxCount)) { queue = busyQueues.remove(0); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/DownloadController.java b/TMessagesProj/src/main/java/org/telegram/messenger/DownloadController.java index 56dac2155c..21fe48d2bd 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/DownloadController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/DownloadController.java @@ -24,6 +24,7 @@ import org.telegram.SQLite.SQLitePreparedStatement; import org.telegram.tgnet.NativeByteBuffer; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.tgnet.tl.TL_stories; import org.telegram.ui.Components.Bulletin; import org.telegram.ui.LaunchActivity; @@ -352,13 +353,13 @@ public void loadAutoDownloadConfig(boolean force) { return; } loadingAutoDownloadConfig = true; - TLRPC.TL_account_getAutoDownloadSettings req = new TLRPC.TL_account_getAutoDownloadSettings(); + TL_account.getAutoDownloadSettings req = new TL_account.getAutoDownloadSettings(); getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { loadingAutoDownloadConfig = false; getUserConfig().autoDownloadConfigLoadTime = System.currentTimeMillis(); getUserConfig().saveConfig(false); if (response != null) { - TLRPC.TL_account_autoDownloadSettings res = (TLRPC.TL_account_autoDownloadSettings) response; + TL_account.autoDownloadSettings res = (TL_account.autoDownloadSettings) response; lowPreset.set(res.low); lowPreset.preloadStories = false; mediumPreset.set(res.medium); @@ -666,6 +667,24 @@ public int canDownloadMediaType(MessageObject messageObject) { return canDownloadMediaInternal(messageObject); } + public int canDownloadMediaType(MessageObject messageObject, long overrideSize) { + if (messageObject.type == MessageObject.TYPE_STORY) { + if (!SharedConfig.isAutoplayVideo()) return 0; + TLRPC.TL_messageMediaStory mediaStory = (TLRPC.TL_messageMediaStory) MessageObject.getMedia(messageObject); + TL_stories.StoryItem storyItem = mediaStory.storyItem; + if (storyItem == null || storyItem.media == null || storyItem.media.document == null || !storyItem.isPublic) { + return 0; + } + return 2; + } + if (messageObject.sponsoredMedia != null) { + return 2; + } + if (messageObject.isHiddenSensitive()) + return 0; + return canDownloadMediaInternal(messageObject, overrideSize); + } + private int canDownloadMediaInternal(MessageObject message) { if (message == null || message.messageOwner == null) return 0; if (message.messageOwner.media instanceof TLRPC.TL_messageMediaStory) { @@ -756,6 +775,89 @@ private int canDownloadMediaInternal(MessageObject message) { } } + private int canDownloadMediaInternal(MessageObject message, long overrideSize) { + if (message == null || message.messageOwner == null) return 0; + if (message.messageOwner.media instanceof TLRPC.TL_messageMediaStory) { + return canPreloadStories() ? 2 : 0; + } + TLRPC.Message msg = message.messageOwner; + int type; + boolean isVideo; + if ((isVideo = MessageObject.isVideoMessage(msg)) || MessageObject.isGifMessage(msg) || MessageObject.isRoundVideoMessage(msg) || MessageObject.isGameMessage(msg)) { + type = AUTODOWNLOAD_TYPE_VIDEO; + } else if (MessageObject.isVoiceMessage(msg)) { + type = AUTODOWNLOAD_TYPE_AUDIO; + } else if (MessageObject.isPhoto(msg) || MessageObject.isStickerMessage(msg) || MessageObject.isAnimatedStickerMessage(msg)) { + type = AUTODOWNLOAD_TYPE_PHOTO; + } else if (MessageObject.getDocument(msg) != null) { + type = AUTODOWNLOAD_TYPE_DOCUMENT; + } else { + return 0; + } + int index; + TLRPC.Peer peer = msg.peer_id; + if (peer != null) { + if (peer.user_id != 0) { + if (getContactsController().contactsDict.containsKey(peer.user_id)) { + index = 0; + } else { + index = 1; + } + } else if (peer.chat_id != 0) { + if (msg.from_id instanceof TLRPC.TL_peerUser && getContactsController().contactsDict.containsKey(msg.from_id.user_id)) { + index = 0; + } else { + index = 2; + } + } else { + TLRPC.Chat chat = msg.peer_id.channel_id != 0 ? getMessagesController().getChat(msg.peer_id.channel_id) : null; + if (ChatObject.isChannel(chat) && chat.megagroup) { + if (msg.from_id instanceof TLRPC.TL_peerUser && getContactsController().contactsDict.containsKey(msg.from_id.user_id)) { + index = 0; + } else { + index = 2; + } + } else { + index = 3; + } + } + } else { + index = 1; + } + Preset preset; + int networkType = ApplicationLoader.getAutodownloadNetworkType(); + if (networkType == StatsController.TYPE_WIFI) { + if (!wifiPreset.enabled) { + return 0; + } + preset = getCurrentWiFiPreset(); + + } else if (networkType == StatsController.TYPE_ROAMING) { + if (!roamingPreset.enabled) { + return 0; + } + preset = getCurrentRoamingPreset(); + } else { + if (!mobilePreset.enabled) { + return 0; + } + preset = getCurrentMobilePreset(); + } + final int mask = preset.mask[index]; + final long maxSize; + if (type == AUTODOWNLOAD_TYPE_AUDIO) { + maxSize = Math.max(512 * 1024, preset.sizes[typeToIndex(type)]); + } else { + maxSize = preset.sizes[typeToIndex(type)]; + } + final long size = overrideSize; + if (isVideo && preset.preloadVideo && size > maxSize && maxSize > 2 * 1024 * 1024) { + return (mask & type) != 0 ? 2 : 0; + } else { + return (type == AUTODOWNLOAD_TYPE_PHOTO || size != 0 && size <= maxSize) && (type == AUTODOWNLOAD_TYPE_AUDIO || (mask & type) != 0) ? 1 : 0; + } + } + public int canDownloadMedia(TLRPC.Message message) { if (message == null || message.media instanceof TLRPC.TL_messageMediaStory) { return canPreloadStories() ? 2 : 0; @@ -963,7 +1065,7 @@ public int getCurrentDownloadMask() { } public void savePresetToServer(int type) { - TLRPC.TL_account_saveAutoDownloadSettings req = new TLRPC.TL_account_saveAutoDownloadSettings(); + TL_account.saveAutoDownloadSettings req = new TL_account.saveAutoDownloadSettings(); Preset preset; boolean enabled; if (type == 0) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Emoji.java b/TMessagesProj/src/main/java/org/telegram/messenger/Emoji.java index 5acbf16860..a2b0a3d614 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/Emoji.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/Emoji.java @@ -28,7 +28,6 @@ import android.view.ViewGroup; import android.widget.TextView; -import org.checkerframework.checker.units.qual.A; import org.telegram.tgnet.TLRPC; import org.telegram.ui.Components.AnimatedEmojiDrawable; import org.telegram.ui.Components.AnimatedEmojiSpan; @@ -563,8 +562,8 @@ public static CharSequence replaceEmoji(CharSequence cs, Paint.FontMetricsInt fo return replaceEmoji(cs, fontMetrics, createNew, null); } - public static CharSequence replaceEmoji(CharSequence cs, Paint.FontMetricsInt fontMetrics, int size, boolean createNew) { - return replaceEmoji(cs, fontMetrics, createNew, null); + public static CharSequence replaceEmoji(CharSequence cs, Paint.FontMetricsInt fontMetrics, boolean createNew, float scale) { + return replaceEmoji(cs, fontMetrics, createNew, null, DynamicDrawableSpan.ALIGN_BOTTOM, scale); } public static CharSequence replaceEmoji(CharSequence cs, Paint.FontMetricsInt fontMetrics, boolean createNew, int[] emojiOnly) { @@ -572,7 +571,11 @@ public static CharSequence replaceEmoji(CharSequence cs, Paint.FontMetricsInt fo } public static CharSequence replaceEmoji(CharSequence cs, Paint.FontMetricsInt fontMetrics, boolean createNew, int[] emojiOnly, int alignment) { - if (SharedConfig.useSystemEmoji || cs == null || cs.length() == 0) { + return replaceEmoji(cs, fontMetrics, createNew, emojiOnly, alignment, 1.0f); + } + + public static CharSequence replaceEmoji(CharSequence cs, Paint.FontMetricsInt fontMetrics, boolean createNew, int[] emojiOnly, int alignment, float scale) { + if (SharedConfig.useSystemEmoji || cs == null || cs.length() == 0) { return cs; } Spannable s; @@ -624,6 +627,7 @@ public static CharSequence replaceEmoji(CharSequence cs, Paint.FontMetricsInt fo if (drawable != null) { span = new EmojiSpan(drawable, alignment, fontMetrics); span.emoji = emojiRange.code == null ? null : emojiRange.code.toString(); + span.scale = scale; s.setSpan(span, emojiRange.start, emojiRange.end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } } catch (Exception e) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FactCheckController.java b/TMessagesProj/src/main/java/org/telegram/messenger/FactCheckController.java index ed27c10688..f22682bab4 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/FactCheckController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/FactCheckController.java @@ -36,6 +36,7 @@ import org.telegram.tgnet.NativeByteBuffer; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.AlertDialogDecor; import org.telegram.ui.ActionBar.BaseFragment; @@ -175,8 +176,8 @@ private void loadMissing() { if (!req.msg_id.isEmpty()) { ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { ArrayList factChecks = new ArrayList<>(); - if (res instanceof TLRPC.Vector) { - ArrayList objects = ((TLRPC.Vector) res).objects; + if (res instanceof Vector) { + ArrayList objects = ((Vector) res).objects; for (int k = 0; k < objects.size(); ++k) { if (objects.get(k) instanceof TLRPC.TL_factCheck) { factChecks.add((TLRPC.TL_factCheck) objects.get(k)); @@ -481,7 +482,9 @@ public void afterTextChanged(Editable s) { ignoreTextChange = true; s.delete(MAX_LENGTH, s.length()); AndroidUtilities.shakeView(editText); - editText.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + editText.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignore) {} ignoreTextChange = false; } @@ -573,7 +576,9 @@ public void applyFactCheck(MessageObject messageObject, TLRPC.TL_textWithEntitie progressDialog.showDelayed(320); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { if (res instanceof TLRPC.Updates) { - MessagesController.getInstance(currentAccount).processUpdates((TLRPC.Updates) res, false); + Utilities.stageQueue.postRunnable(() -> { + MessagesController.getInstance(currentAccount).processUpdates((TLRPC.Updates) res, false); + }); BaseFragment fragment = LaunchActivity.getSafeLastFragment(); if (fragment != null) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java index 5926d04686..9b4e4e131c 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java @@ -13,6 +13,7 @@ import org.telegram.tgnet.NativeByteBuffer; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import org.telegram.tgnet.tl.TL_stories; import org.telegram.ui.LaunchActivity; import org.telegram.ui.Storage.CacheModel; @@ -778,12 +779,12 @@ protected void removeStreamListener(final FileLoadOperationStream operation) { } FileLog.e("FileLoadOperation " + getFileName() + " removing stream listener " + operation); streamListeners.remove(operation); - if (!isStory && streamListeners.isEmpty()) { - Utilities.stageQueue.cancelRunnable(cancelAfterNoStreamListeners); - Utilities.stageQueue.postRunnable(cancelAfterNoStreamListeners, 1200); - } else if (!streamListeners.isEmpty()) { - Utilities.stageQueue.cancelRunnable(cancelAfterNoStreamListeners); - } +// if (!isStory && streamListeners.isEmpty()) { +// Utilities.stageQueue.cancelRunnable(cancelAfterNoStreamListeners); +// Utilities.stageQueue.postRunnable(cancelAfterNoStreamListeners, 1200); +// } else if (!streamListeners.isEmpty()) { +// Utilities.stageQueue.cancelRunnable(cancelAfterNoStreamListeners); +// } }); } @@ -1767,15 +1768,15 @@ private void requestFileOffsets(long offset) { ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { if (error != null) { onFail(false, 0); - } else { + } else if (response instanceof Vector) { requestingCdnOffsets = false; - TLRPC.Vector vector = (TLRPC.Vector) response; + final Vector vector = (Vector) response; if (!vector.objects.isEmpty()) { if (cdnHashes == null) { cdnHashes = new HashMap<>(); } for (int a = 0; a < vector.objects.size(); a++) { - TLRPC.TL_fileHash hash = (TLRPC.TL_fileHash) vector.objects.get(a); + final TLRPC.TL_fileHash hash = vector.objects.get(a); cdnHashes.put(hash.offset, hash); } } @@ -2548,19 +2549,19 @@ protected void startDownloadRequest(int useConnectionType) { req.request_token = res.request_token; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response1, error1) -> { reuploadingCdn = false; - if (error1 == null) { - TLRPC.Vector vector = (TLRPC.Vector) response1; + if (response1 instanceof Vector) { + final Vector vector = (Vector) response1; if (!vector.objects.isEmpty()) { if (cdnHashes == null) { cdnHashes = new HashMap<>(); } for (int a1 = 0; a1 < vector.objects.size(); a1++) { - TLRPC.TL_fileHash hash = (TLRPC.TL_fileHash) vector.objects.get(a1); + final TLRPC.TL_fileHash hash = vector.objects.get(a1); cdnHashes.put(hash.offset, hash); } } startDownloadRequest(connectionType); - } else { + } else if (error1 != null) { if (error1.text.equals("FILE_TOKEN_INVALID") || error1.text.equals("REQUEST_TOKEN_INVALID")) { isCdn = false; clearOperation(requestInfo, false, false); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java index f004af5d86..8ff8c32458 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java @@ -215,9 +215,9 @@ public interface FileLoaderDelegate { private final ConcurrentHashMap loadOperationPaths = new ConcurrentHashMap<>(); private final ConcurrentHashMap loadOperationPathsUI = new ConcurrentHashMap<>(10, 1, 2); - private HashMap uploadSizes = new HashMap<>(); + private final HashMap uploadSizes = new HashMap<>(); - private HashMap loadingVideos = new HashMap<>(); + private final HashMap loadingVideos = new HashMap<>(); private String forceLoadingFile; @@ -225,7 +225,7 @@ public interface FileLoaderDelegate { private FileLoaderDelegate delegate = null; private int lastReferenceId; - private ConcurrentHashMap parentObjectReferences = new ConcurrentHashMap<>(); + private final ConcurrentHashMap parentObjectReferences = new ConcurrentHashMap<>(); private static final FileLoader[] Instance = new FileLoader[UserConfig.MAX_ACCOUNT_COUNT]; @@ -1400,6 +1400,17 @@ public FilePathDatabase getFileDatabase() { return filePathDatabase; } + public static TLRPC.TL_photoStrippedSize getStrippedPhotoSize(ArrayList sizes) { + if (sizes == null) return null; + for (int i = 0; i < sizes.size(); ++i) { + final TLRPC.PhotoSize photoSize = sizes.get(i); + if (photoSize instanceof TLRPC.TL_photoStrippedSize) { + return (TLRPC.TL_photoStrippedSize) photoSize; + } + } + return null; + } + public static TLRPC.PhotoSize getClosestPhotoSizeWithSize(ArrayList sizes, int side) { return getClosestPhotoSizeWithSize(sizes, side, false); } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FileLog.java b/TMessagesProj/src/main/java/org/telegram/messenger/FileLog.java index 8323efd85b..0eaf0fb266 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/FileLog.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/FileLog.java @@ -166,7 +166,7 @@ public static void disableGson(boolean disable) { private static void checkGson() { if (gson == null) { privateFields = new HashSet<>(); - privateFields.add("message"); +// privateFields.add("message"); privateFields.add("phone"); privateFields.add("about"); privateFields.add("status_text"); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FileRefController.java b/TMessagesProj/src/main/java/org/telegram/messenger/FileRefController.java index d1f1df2f75..ef395d117a 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/FileRefController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/FileRefController.java @@ -5,6 +5,8 @@ import org.telegram.tgnet.RequestDelegate; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; +import org.telegram.tgnet.tl.TL_account; import org.telegram.tgnet.tl.TL_bots; import org.telegram.tgnet.tl.TL_stories; import org.telegram.ui.ActionBar.Theme; @@ -499,7 +501,7 @@ private void requestReferenceFromServer(Object parentObject, String locationKey, } } else if (parentObject instanceof TLRPC.TL_wallPaper) { TLRPC.TL_wallPaper wallPaper = (TLRPC.TL_wallPaper) parentObject; - TLRPC.TL_account_getWallPaper req = new TLRPC.TL_account_getWallPaper(); + TL_account.getWallPaper req = new TL_account.getWallPaper(); TLRPC.TL_inputWallPaper inputWallPaper = new TLRPC.TL_inputWallPaper(); inputWallPaper.id = wallPaper.id; inputWallPaper.access_hash = wallPaper.access_hash; @@ -507,7 +509,7 @@ private void requestReferenceFromServer(Object parentObject, String locationKey, getConnectionsManager().sendRequest(req, (response, error) -> onRequestComplete(locationKey, parentKey, response, error, true, false)); } else if (parentObject instanceof TLRPC.TL_theme) { TLRPC.TL_theme theme = (TLRPC.TL_theme) parentObject; - TLRPC.TL_account_getTheme req = new TLRPC.TL_account_getTheme(); + TL_account.getTheme req = new TL_account.getTheme(); TLRPC.TL_inputTheme inputTheme = new TLRPC.TL_inputTheme(); inputTheme.id = theme.id; inputTheme.access_hash = theme.access_hash; @@ -540,7 +542,7 @@ private void requestReferenceFromServer(Object parentObject, String locationKey, String string = (String) parentObject; if ("wallpaper".equals(string)) { if (wallpaperWaiters.isEmpty()) { - TLRPC.TL_account_getWallPapers req = new TLRPC.TL_account_getWallPapers(); + TL_account.getWallPapers req = new TL_account.getWallPapers(); getConnectionsManager().sendRequest(req, (response, error) -> broadcastWaitersData(wallpaperWaiters, response, error)); } wallpaperWaiters.add(new Waiter(locationKey, parentKey)); @@ -897,7 +899,7 @@ private boolean onRequestComplete(String locationKey, String parentKey, TLObject String cacheKey = parentKey; if (response instanceof TLRPC.TL_help_premiumPromo) { cacheKey = "premium_promo"; - } else if (response instanceof TLRPC.TL_account_wallPapers) { + } else if (response instanceof TL_account.TL_wallPapers) { cacheKey = "wallpaper"; } else if (response instanceof TLRPC.TL_messages_savedGifs) { cacheKey = "gif"; @@ -1140,8 +1142,8 @@ private boolean onRequestComplete(String locationKey, String parentKey, TLObject result = getFileReference(res.webpage, requester.location, needReplacement, locationReplacement); } else if (response instanceof TLRPC.WebPage) { result = getFileReference((TLRPC.WebPage) response, requester.location, needReplacement, locationReplacement); - } else if (response instanceof TLRPC.TL_account_wallPapers) { - TLRPC.TL_account_wallPapers accountWallPapers = (TLRPC.TL_account_wallPapers) response; + } else if (response instanceof TL_account.TL_wallPapers) { + TL_account.TL_wallPapers accountWallPapers = (TL_account.TL_wallPapers) response; for (int i = 0, size10 = accountWallPapers.wallpapers.size(); i < size10; i++) { result = getFileReference(((TLRPC.WallPaper) accountWallPapers.wallpapers.get(i)).document, null, requester.location, needReplacement, locationReplacement); if (result != null) { @@ -1165,8 +1167,8 @@ private boolean onRequestComplete(String locationKey, String parentKey, TLObject if (result != null && cache) { AndroidUtilities.runOnUIThread(() -> Theme.setThemeFileReference(theme)); } - } else if (response instanceof TLRPC.Vector) { - TLRPC.Vector vector = (TLRPC.Vector) response; + } else if (response instanceof Vector) { + Vector vector = (Vector) response; if (!vector.objects.isEmpty()) { for (int i = 0, size10 = vector.objects.size(); i < size10; i++) { Object object = vector.objects.get(i); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FileStreamLoadOperation.java b/TMessagesProj/src/main/java/org/telegram/messenger/FileStreamLoadOperation.java index cc560f0f63..c95b5ef296 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/FileStreamLoadOperation.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/FileStreamLoadOperation.java @@ -220,6 +220,9 @@ public int read(byte[] buffer, int offset, int readLength) throws IOException { bytesTransferred += bytesRead; bytesTransferred(bytesRead); } + } catch (InterruptedException e) { + FileLog.e(e); + return C.RESULT_NOTHING_READ; } catch (Exception e) { throw new IOException(e); } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/HashtagSearchController.java b/TMessagesProj/src/main/java/org/telegram/messenger/HashtagSearchController.java index 446ea747f0..7c2b620378 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/HashtagSearchController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/HashtagSearchController.java @@ -167,17 +167,17 @@ public void searchHashtag(String _query, int guid, int searchType, int loadIndex final String username = _username; search.loading = true; - final int[] reqId = new int[1]; TLObject chat = null; if (!TextUtils.isEmpty(username)) { chat = MessagesController.getInstance(currentAccount).getUserOrChat(username); if (chat == null) { - reqId[0] = search.reqId = MessagesController.getInstance(currentAccount).getUserNameResolver().resolve(username, resolvedChatId -> { + Runnable[] cancel = new Runnable[1]; + cancel[0] = search.cancel = MessagesController.getInstance(currentAccount).getUserNameResolver().resolve(username, resolvedChatId -> { if (!TextUtils.equals(search.lastHashtag, query)) return; final TLObject resolvedChat = MessagesController.getInstance(currentAccount).getUserOrChat(username); if (resolvedChat == null) { - if (reqId[0] == search.reqId) { - search.reqId = -1; + if (cancel[0] == search.cancel) { + search.cancel = null; } else { return; } @@ -231,6 +231,7 @@ public void searchHashtag(String _query, int guid, int searchType, int loadIndex request = req; } } + final int[] reqId = new int[1]; reqId[0] = search.reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(request, (res, err) -> { if (res instanceof TLRPC.messages_Messages) { TLRPC.messages_Messages messages = (TLRPC.messages_Messages) res; @@ -340,6 +341,7 @@ public SearchResult(int account) { } public int reqId = -1; + public Runnable cancel; public boolean loading; public int lastOffsetRate; public int lastOffsetId; @@ -366,6 +368,10 @@ void clear() { ConnectionsManager.getInstance(currentAccount).cancelRequest(reqId, true); reqId = -1; } + if (cancel != null) { + cancel.run(); + cancel = null; + } messages.clear(); generatedIds.clear(); lastOffsetRate = 0; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java b/TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java index 548ea4083e..780e3096ab 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java @@ -35,6 +35,7 @@ import android.util.Pair; import android.util.SparseArray; +import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; import androidx.core.graphics.ColorUtils; @@ -4073,6 +4074,62 @@ public static void fillPhotoSizeWithBytes(TLRPC.PhotoSize photoSize) { } } + @Nullable + public static TLRPC.PhotoSize fileToSize(String path, boolean forceCacheDir) { + if (path == null) { + return null; + } + + int w, h; + try { + BitmapFactory.Options o = new BitmapFactory.Options(); + o.inJustDecodeBounds = true; + BitmapFactory.decodeFile(path, o); + w = o.outWidth; + h = o.outHeight; + } catch (Exception e) { + FileLog.e(e); + return null; + } + + TLRPC.TL_fileLocationToBeDeprecated location = new TLRPC.TL_fileLocationToBeDeprecated(); + location.volume_id = Integer.MIN_VALUE; + location.dc_id = Integer.MIN_VALUE; + location.local_id = SharedConfig.getLastLocalId(); + location.file_reference = new byte[0]; + + TLRPC.TL_photoSize_layer127 photoSize = new TLRPC.TL_photoSize_layer127(); + photoSize.location = location; + photoSize.w = w; + photoSize.h = h; + if (photoSize.w <= 100 && photoSize.h <= 100) { + photoSize.type = "s"; + } else if (photoSize.w <= 320 && photoSize.h <= 320) { + photoSize.type = "m"; + } else if (photoSize.w <= 800 && photoSize.h <= 800) { + photoSize.type = "x"; + } else if (photoSize.w <= 1280 && photoSize.h <= 1280) { + photoSize.type = "y"; + } else { + photoSize.type = "w"; + } + + String external = ".jpg"; + + String fileName = location.volume_id + "_" + location.local_id + external; + File fileDir; + if (forceCacheDir) { + fileDir = FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE); + } else { + fileDir = location.volume_id != Integer.MIN_VALUE ? FileLoader.getDirectory(FileLoader.MEDIA_DIR_IMAGE) : FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE); + } + final File cacheFile = new File(fileDir, fileName); + new File(path).renameTo(cacheFile); + photoSize.size = (int) cacheFile.length(); + + return photoSize; + } + private static TLRPC.PhotoSize scaleAndSaveImageInternal(TLRPC.PhotoSize photoSize, Bitmap bitmap, Bitmap.CompressFormat compressFormat, boolean progressive, int w, int h, float photoW, float photoH, float scaleFactor, int quality, boolean cache, boolean scaleAnyway, boolean forceCacheDir) throws Exception { Bitmap scaledBitmap; if (scaleFactor > 1 || scaleAnyway) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ImageReceiver.java b/TMessagesProj/src/main/java/org/telegram/messenger/ImageReceiver.java index e0d0654256..b87cf3def9 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ImageReceiver.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ImageReceiver.java @@ -290,7 +290,7 @@ private void clear() { private boolean allowLottieVibration = true; private boolean allowStartAnimation = true; private boolean allowStartLottieAnimation = true; - private boolean useSharedAnimationQueue; + public boolean useSharedAnimationQueue; private boolean allowDecodeSingleFrame; private int autoRepeat = 1; private int autoRepeatCount = -1; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java b/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java index d882a7c677..402ddfbd80 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java @@ -17,6 +17,7 @@ import android.content.res.Configuration; import android.os.Build; import android.telephony.TelephonyManager; +import android.text.SpannableStringBuilder; import android.text.TextUtils; import android.text.format.DateFormat; import android.util.Xml; @@ -24,6 +25,7 @@ import androidx.annotation.StringRes; import org.telegram.messenger.time.FastDateFormat; +import org.telegram.tgnet.Vector; import org.telegram.ui.Stars.StarsController; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; @@ -1456,6 +1458,20 @@ public static String formatPluralString(String key, int plural, Object... args) return formatString(param, key + "_other", resourceId, fallbackResourceId, argsWithPlural); } + public static CharSequence formatPluralSpannable(String key, int plural, CharSequence... args) { + if (key == null || key.length() == 0 || getInstance().currentPluralRules == null) { + return "LOC_ERR:" + key; + } + String param = getInstance().stringForQuantity(getInstance().currentPluralRules.quantityForNumber(plural)); + param = key + "_" + param; + int resourceId = ApplicationLoader.applicationContext.getResources().getIdentifier(param, "string", ApplicationLoader.applicationContext.getPackageName()); + int fallbackResourceId = ApplicationLoader.applicationContext.getResources().getIdentifier(key + "_other", "string", ApplicationLoader.applicationContext.getPackageName()); + Object[] argsWithPlural = new Object[args.length + 1]; + argsWithPlural[0] = plural; + System.arraycopy(args, 0, argsWithPlural, 1, args.length); + return formatSpannable(param, key + "_other", resourceId, fallbackResourceId, argsWithPlural); + } + public static String getStringParamForNumber(int number) { return getInstance().stringForQuantity(getInstance().currentPluralRules.quantityForNumber(number)); } @@ -1561,15 +1577,13 @@ public static String formatString(String key, String fallback, int res, int fall if (fallbackRes != 0) { try { value = ApplicationLoader.applicationContext.getString(fallbackRes); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} } } } else if (fallbackRes != 0) { try { value = ApplicationLoader.applicationContext.getString(fallbackRes); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} } } } @@ -1585,6 +1599,75 @@ public static String formatString(String key, String fallback, int res, int fall } } + public static CharSequence formatSpannable(@StringRes int res, Object... args) { + String key = resourcesCacheMap.get(res); + if (key == null) { + resourcesCacheMap.put(res, key = ApplicationLoader.applicationContext.getResources().getResourceEntryName(res)); + } + return formatSpannable(key, res, args); + } + + public static CharSequence formatSpannable(String key, int res, Object... args) { + return formatSpannable(key, null, res, 0, args); + } + + public static CharSequence formatSpannable(String key, String fallback, int res, int fallbackRes, Object... args) { + try { + String value = BuildVars.USE_CLOUD_STRINGS ? getInstance().localeValues.get(key) : null; + if (value == null) { + if (BuildVars.USE_CLOUD_STRINGS && fallback != null) { + value = getInstance().localeValues.get(fallback); + } + if (value == null) { + if (res != 0) { + try { + value = ApplicationLoader.applicationContext.getString(res); + } catch (Exception e) { + if (fallbackRes != 0) { + try { + value = ApplicationLoader.applicationContext.getString(fallbackRes); + } catch (Exception ignored) {} + } + } + } else if (fallbackRes != 0) { + try { + value = ApplicationLoader.applicationContext.getString(fallbackRes); + } catch (Exception ignored) {} + } + } + } + + SpannableStringBuilder builder = new SpannableStringBuilder(value); + for (int i = 0; i < args.length; i++) { + String formatter = "s"; + CharSequence replaceWith = ""; + if (args[i] instanceof CharSequence) { + replaceWith = (CharSequence) args[i]; + } else if (args[i] instanceof Integer) { + formatter = "d"; + replaceWith = "" + (Integer) args[i]; + } else if (args[i] == null) { + replaceWith = "null"; + } + final String placeholder = "%" + (i + 1) + "$" + formatter; + int start = builder.toString().indexOf(placeholder); + if (start != -1) { + builder.replace(start, start + placeholder.length(), replaceWith); + } else { + final String placeholder2 = "%" + formatter; + start = builder.toString().indexOf(placeholder2); + if (start != -1) { + builder.replace(start, start + placeholder2.length(), replaceWith); + } + } + } + return builder; + } catch (Exception e) { + FileLog.e(e); + return "LOC_ERR: " + key; + } + } + public static String formatTTLString(int ttl) { if (ttl < 60) { return LocaleController.formatPluralString("Seconds", ttl); @@ -2843,10 +2926,10 @@ public void loadRemoteLanguages(final int currentAccount, boolean applyCurrent) loadingRemoteLanguages = true; TLRPC.TL_langpack_getLanguages req = new TLRPC.TL_langpack_getLanguages(); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { - if (response != null) { + if (response instanceof Vector) { AndroidUtilities.runOnUIThread(() -> { loadingRemoteLanguages = false; - TLRPC.Vector res = (TLRPC.Vector) response; + Vector res = (Vector) response; for (int a = 0, size = remoteLanguages.size(); a < size; a++) { remoteLanguages.get(a).serverIndex = Integer.MAX_VALUE; } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java index a5e0668ed7..bfafee5429 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java @@ -76,6 +76,8 @@ import org.telegram.messenger.voip.VoIPService; import org.telegram.tgnet.AbstractSerializedData; import org.telegram.tgnet.ConnectionsManager; +import org.telegram.tgnet.InputSerializedData; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; import org.telegram.tgnet.tl.TL_stories; @@ -230,7 +232,7 @@ public static class SavedFilterState { public float blurExcludeBlurSize; public float blurAngle; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeFloat(enhanceValue); stream.writeFloat(softenSkinValue); stream.writeFloat(exposureValue); @@ -259,7 +261,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeFloat(blurAngle); } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { enhanceValue = stream.readFloat(exception); softenSkinValue = stream.readFloat(exception); exposureValue = stream.readFloat(exception); @@ -312,7 +314,9 @@ public boolean isEmpty() { } } - public static class CropState { + public static class CropState extends TLObject { + public static final int constructor = 0x44a3abcd; + public float cropPx; public float cropPy; public float cropScale = 1; @@ -331,6 +335,7 @@ public static class CropState { public int height; public boolean freeform; public float lockedAspectRatio; + public int orientation; public Matrix useMatrix; @@ -358,6 +363,7 @@ public CropState clone() { cloned.height = this.height; cloned.freeform = this.freeform; cloned.lockedAspectRatio = this.lockedAspectRatio; + cloned.orientation = this.orientation; cloned.initied = this.initied; cloned.useMatrix = this.useMatrix; @@ -370,12 +376,91 @@ public boolean isEmpty() { transformRotation == 0 && !mirrored && stateScale == 0 && scale == 0 && width == 0 && height == 0 && !freeform && lockedAspectRatio == 0; } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + cropPx = stream.readFloat(exception); + cropPy = stream.readFloat(exception); + cropScale = stream.readFloat(exception); + cropRotate = stream.readFloat(exception); + cropPw = stream.readFloat(exception); + cropPh = stream.readFloat(exception); + transformWidth = stream.readInt32(exception); + transformHeight = stream.readInt32(exception); + transformRotation = stream.readInt32(exception); + mirrored = stream.readBool(exception); + stateScale = stream.readFloat(exception); + scale = stream.readFloat(exception); + final float[] values = new float[9]; + for (int i = 0; i < values.length; ++i) { + values[i] = stream.readFloat(exception); + } + matrix = new Matrix(); + matrix.setValues(values); + width = stream.readInt32(exception); + height = stream.readInt32(exception); + freeform = stream.readBool(exception); + lockedAspectRatio = stream.readFloat(exception); + int magic = stream.readInt32(exception); + if (magic == 0xaa23a61) { + for (int i = 0; i < values.length; ++i) { + values[i] = stream.readFloat(exception); + } + useMatrix = new Matrix(); + useMatrix.setValues(values); + } + initied = stream.readBool(exception); + orientation = stream.readInt32(exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeFloat(cropPx); + stream.writeFloat(cropPy); + stream.writeFloat(cropScale); + stream.writeFloat(cropRotate); + stream.writeFloat(cropPw); + stream.writeFloat(cropPh); + stream.writeInt32(transformWidth); + stream.writeInt32(transformHeight); + stream.writeInt32(transformRotation); + stream.writeBool(mirrored); + stream.writeFloat(stateScale); + stream.writeFloat(scale); + final float[] values = new float[9]; + if (matrix != null) { + matrix.getValues(values); + } else for (int i = 0; i < values.length; ++i) { + values[i] = 0.0f; + } + for (int i = 0; i < values.length; ++i) { + stream.writeFloat(values[i]); + } + stream.writeInt32(width); + stream.writeInt32(height); + stream.writeBool(freeform); + stream.writeFloat(lockedAspectRatio); + if (useMatrix == null) { + stream.writeInt32(TLRPC.TL_null.constructor); + } else { + stream.writeInt32(0xaa23a61); + useMatrix.getValues(values); + for (int i = 0; i < values.length; ++i) { + stream.writeFloat(values[i]); + } + } + stream.writeBool(initied); + stream.writeInt32(orientation); + } } public static class MediaEditState { public CharSequence caption; + public long customThumbSavedPosition; + public boolean customThumb; public String thumbPath; public String imagePath; public String filterPath; @@ -4080,9 +4165,7 @@ public void startRecording(int currentAccount, long dialogId, MessageObject repl try { feedbackView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - } catch (Exception ignore) { - - } + } catch (Exception ignore) {} recordQueue.postRunnable(recordStartRunnable = () -> { if (audioRecorder != null) { @@ -4349,9 +4432,7 @@ public void stopRecording(final int send, boolean notify, int scheduleDate, bool } try { feedbackView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - } catch (Exception ignore) { - - } + } catch (Exception ignore) {} AndroidUtilities.runOnUIThread(() -> NotificationCenter.getInstance(recordingCurrentAccount).postNotificationName(NotificationCenter.recordStopped, recordingGuid, send == 2 ? 1 : 0)); }); } @@ -5605,30 +5686,24 @@ public void resumeByRewind() { private static class VideoConvertRunnable implements Runnable { - private final VideoConvertMessage convertMessage; - private final Handler handler; + private VideoConvertMessage convertMessage; - private VideoConvertRunnable(VideoConvertMessage message, Handler handler) { - this.convertMessage = message; - this.handler = handler; + private VideoConvertRunnable(VideoConvertMessage message) { + convertMessage = message; } @Override public void run() { - MediaController.getInstance().convertVideo(convertMessage, handler); + MediaController.getInstance().convertVideo(convertMessage); } public static void runConversion(final VideoConvertMessage obj) { - HandlerThread handlerThread = new HandlerThread("VideoConvertRunnableThread"); - handlerThread.start(); - Handler handler = new Handler(handlerThread.getLooper()); new Thread(() -> { try { - VideoConvertRunnable wrapper = new VideoConvertRunnable(obj, handler); + VideoConvertRunnable wrapper = new VideoConvertRunnable(obj); Thread th = new Thread(wrapper, "VideoConvertRunnable"); th.start(); th.join(); - handlerThread.join(); } catch (Exception e) { FileLog.e(e); } @@ -5637,7 +5712,7 @@ public static void runConversion(final VideoConvertMessage obj) { } - private boolean convertVideo(final VideoConvertMessage convertMessage, final Handler handler) { + private boolean convertVideo(final VideoConvertMessage convertMessage) { MessageObject messageObject = convertMessage.messageObject; VideoEditedInfo info = convertMessage.videoEditedInfo; if (messageObject == null || info == null) { @@ -5743,7 +5818,7 @@ public void didWriteData(long availableSize, float progress) { callback, info); convertVideoParams.soundInfos.addAll(info.mixedSoundInfos); - boolean error = videoConvertor.convertVideo(convertVideoParams, handler); + boolean error = videoConvertor.convertVideo(convertVideoParams); boolean canceled = info.canceled; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java index b5afa38e92..558be0a3a3 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java @@ -35,7 +35,6 @@ import android.text.style.CharacterStyle; import android.text.style.URLSpan; import android.text.util.Linkify; -import android.util.Log; import android.util.Pair; import android.util.SparseArray; @@ -60,6 +59,8 @@ import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; +import org.telegram.tgnet.tl.TL_account; import org.telegram.tgnet.tl.TL_bots; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.EmojiThemes; @@ -4227,8 +4228,8 @@ public void getMediaCounts(long dialogId, long topicId, int classGuid) { counts[i] = 0; } } - if (response != null) { - TLRPC.Vector res = (TLRPC.Vector) response; + if (response instanceof Vector) { + Vector res = (Vector) response; for (int a = 0, N = res.objects.size(); a < N; a++) { TLRPC.TL_messages_searchCounter searchCounter = (TLRPC.TL_messages_searchCounter) res.objects.get(a); int type; @@ -4301,10 +4302,10 @@ public void getMediaCount(long dialogId, long topicId, int type, int classGuid, return; } int reqId = getConnectionsManager().sendRequest(req, (response, error) -> { - if (response != null) { - TLRPC.Vector res = (TLRPC.Vector) response; + if (response instanceof Vector) { + final Vector res = (Vector) response; if (!res.objects.isEmpty()) { - TLRPC.TL_messages_searchCounter counter = (TLRPC.TL_messages_searchCounter) res.objects.get(0); + final TLRPC.TL_messages_searchCounter counter = (TLRPC.TL_messages_searchCounter) res.objects.get(0); processLoadedMediaCount(counter.count, dialogId, topicId, type, classGuid, false, 0); } } @@ -6852,11 +6853,15 @@ public static void addTextStyleRuns(ArrayList entities, Cha public static void addTextStyleRuns(ArrayList entities, CharSequence messageText, Spannable text, int allowedFlags) { for (TextStyleSpan prevSpan : text.getSpans(0, text.length(), TextStyleSpan.class)) text.removeSpan(prevSpan); - for (TextStyleSpan.TextStyleRun run : MediaDataController.getTextStyleRuns(entities, messageText, allowedFlags)) { + final ArrayList runs = MediaDataController.getTextStyleRuns(entities, messageText, allowedFlags); + for (int i = 0; i < Math.min(MAX_STYLE_RUNS_COUNT, runs.size()); ++i) { + final TextStyleSpan.TextStyleRun run = runs.get(i); MediaDataController.addStyleToText(new TextStyleSpan(run), run.start, run.end, text, true); } } + public static final int MAX_STYLE_RUNS_COUNT = 1000; + public static void addAnimatedEmojiSpans(ArrayList entities, CharSequence messageText, Paint.FontMetricsInt fontMetricsInt) { if (!(messageText instanceof Spannable) || entities == null) { return; @@ -7324,6 +7329,13 @@ public ArrayList getEntities(CharSequence[] message, boolea return entities; } + public static void offsetEntities(ArrayList entities, int offset) { + if (entities == null) return; + for (TLRPC.MessageEntity e : entities) { + e.offset += offset; + } + } + public static boolean entitiesEqual(TLRPC.MessageEntity entity1, TLRPC.MessageEntity entity2) { if (entity1.getClass() != entity2.getClass() || entity1.offset != entity2.offset || @@ -8260,15 +8272,15 @@ public boolean saveToRingtones(TLRPC.Document document) { } } } - TLRPC.TL_account_saveRingtone saveRingtone = new TLRPC.TL_account_saveRingtone(); + TL_account.saveRingtone saveRingtone = new TL_account.saveRingtone(); saveRingtone.id = new TLRPC.TL_inputDocument(); saveRingtone.id.id = document.id; saveRingtone.id.file_reference = document.file_reference; saveRingtone.id.access_hash = document.access_hash; ConnectionsManager.getInstance(currentAccount).sendRequest(saveRingtone, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (response != null) { - if (response instanceof TLRPC.TL_account_savedRingtoneConverted) { - ringtoneDataStore.addTone(((TLRPC.TL_account_savedRingtoneConverted) response).document); + if (response instanceof TL_account.TL_savedRingtoneConverted) { + ringtoneDataStore.addTone(((TL_account.TL_savedRingtoneConverted) response).document); } else { ringtoneDataStore.addTone(document); } @@ -9156,7 +9168,7 @@ public void pushRecentEmojiStatus(TLRPC.EmojiStatus status) { emojiStatuses[type].remove(emojiStatuses[type].size() - 1); } - TLRPC.TL_account_emojiStatuses statuses = new TLRPC.TL_account_emojiStatuses(); + TL_account.TL_emojiStatuses statuses = new TL_account.TL_emojiStatuses(); // todo: calc hash statuses.hash = emojiStatusesHash[type]; statuses.statuses = emojiStatuses[type]; @@ -9177,8 +9189,8 @@ public void fetchEmojiStatuses(int type, boolean cache) { if (cursor.next() && cursor.getColumnCount() > 0 && !cursor.isNull(0)) { NativeByteBuffer data = cursor.byteBufferValue(0); if (data != null) { - TLRPC.account_EmojiStatuses response = TLRPC.account_EmojiStatuses.TLdeserialize(data, data.readInt32(false), false); - if (response instanceof TLRPC.TL_account_emojiStatuses) { + TL_account.EmojiStatuses response = TL_account.EmojiStatuses.TLdeserialize(data, data.readInt32(false), false); + if (response instanceof TL_account.TL_emojiStatuses) { emojiStatusesHash[type] = response.hash; emojiStatuses[type] = response.statuses; done = true; @@ -9203,24 +9215,24 @@ public void fetchEmojiStatuses(int type, boolean cache) { } else { TLObject req; if (type == 0) { - TLRPC.TL_account_getRecentEmojiStatuses recentReq = new TLRPC.TL_account_getRecentEmojiStatuses(); + TL_account.getRecentEmojiStatuses recentReq = new TL_account.getRecentEmojiStatuses(); recentReq.hash = emojiStatusesHash[type]; req = recentReq; } else if (type == 1) { - TLRPC.TL_account_getDefaultEmojiStatuses defaultReq = new TLRPC.TL_account_getDefaultEmojiStatuses(); + TL_account.getDefaultEmojiStatuses defaultReq = new TL_account.getDefaultEmojiStatuses(); defaultReq.hash = emojiStatusesHash[type]; req = defaultReq; } else { - TLRPC.TL_account_getChannelDefaultEmojiStatuses defaultReq = new TLRPC.TL_account_getChannelDefaultEmojiStatuses(); + TL_account.getChannelDefaultEmojiStatuses defaultReq = new TL_account.getChannelDefaultEmojiStatuses(); defaultReq.hash = emojiStatusesHash[type]; req = defaultReq; } ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> { emojiStatusesFetchDate[type] = System.currentTimeMillis() / 1000; - if (res instanceof TLRPC.TL_account_emojiStatusesNotModified) { + if (res instanceof TL_account.TL_emojiStatusesNotModified) { emojiStatusesFetching[type] = false; - } else if (res instanceof TLRPC.TL_account_emojiStatuses) { - TLRPC.TL_account_emojiStatuses response = (TLRPC.TL_account_emojiStatuses) res; + } else if (res instanceof TL_account.TL_emojiStatuses) { + TL_account.TL_emojiStatuses response = (TL_account.TL_emojiStatuses) res; emojiStatusesHash[type] = response.hash; emojiStatuses[type] = response.statuses; updateEmojiStatuses(type, response); @@ -9232,7 +9244,7 @@ public void fetchEmojiStatuses(int type, boolean cache) { } } - private void updateEmojiStatuses(int type, TLRPC.TL_account_emojiStatuses response) { + private void updateEmojiStatuses(int type, TL_account.TL_emojiStatuses response) { getMessagesStorage().getStorageQueue().postRunnable(() -> { try { getMessagesStorage().getDatabase().executeFast("DELETE FROM emoji_statuses WHERE type = " + type).stepThis().dispose(); @@ -9450,7 +9462,7 @@ private void loadAvatarConstructor(boolean profile) { } if (emojiList == null || (System.currentTimeMillis() - lastCheckTime) > 24 * 60 * 60 * 1000 || BuildVars.DEBUG_PRIVATE_VERSION) { - TLRPC.TL_account_getDefaultProfilePhotoEmojis req = new TLRPC.TL_account_getDefaultProfilePhotoEmojis(); + TL_account.getDefaultProfilePhotoEmojis req = new TL_account.getDefaultProfilePhotoEmojis(); if (emojiList != null) { req.hash = emojiList.hash; } @@ -9493,7 +9505,7 @@ public void loadReplyIcons() { } if (emojiList == null || (System.currentTimeMillis() - lastCheckTime) > 24 * 60 * 60 * 1000 || BuildVars.DEBUG_PRIVATE_VERSION) { - TLRPC.TL_account_getDefaultBackgroundEmojis req = new TLRPC.TL_account_getDefaultBackgroundEmojis(); + TL_account.getDefaultBackgroundEmojis req = new TL_account.getDefaultBackgroundEmojis(); if (emojiList != null) { req.hash = emojiList.hash; } @@ -9531,7 +9543,7 @@ public void loadRestrictedStatusEmojis() { } if (emojiList == null || (System.currentTimeMillis() - lastCheckTime) > 24 * 60 * 60 * 1000) { - TLRPC.TL_account_getChannelRestrictedStatusEmojis req = new TLRPC.TL_account_getChannelRestrictedStatusEmojis(); + TL_account.getChannelRestrictedStatusEmojis req = new TL_account.getChannelRestrictedStatusEmojis(); if (emojiList != null) { req.hash = emojiList.hash; } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessageCustomParamsHelper.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessageCustomParamsHelper.java index 18e774033e..e0297ef8cb 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessageCustomParamsHelper.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessageCustomParamsHelper.java @@ -1,7 +1,9 @@ package org.telegram.messenger; import org.telegram.tgnet.AbstractSerializedData; +import org.telegram.tgnet.InputSerializedData; import org.telegram.tgnet.NativeByteBuffer; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; @@ -82,7 +84,7 @@ private Params_v1(TLRPC.Message message) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(VERSION); flags = message.voiceTranscriptionForce ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); @@ -108,7 +110,7 @@ public void serializeToStream(AbstractSerializedData stream) { } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(true); if ((flags & 1) != 0) { message.voiceTranscription = stream.readString(exception); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java index 8e6986d69c..aeec99c541 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java @@ -10,6 +10,7 @@ import static org.telegram.messenger.AndroidUtilities.dp; import static org.telegram.messenger.LocaleController.formatPluralString; +import static org.telegram.messenger.LocaleController.formatPluralStringComma; import static org.telegram.messenger.LocaleController.formatString; import static org.telegram.messenger.LocaleController.getString; @@ -75,8 +76,11 @@ import org.telegram.ui.Components.URLSpanReplacement; import org.telegram.ui.Components.URLSpanUserMention; import org.telegram.ui.Components.VideoPlayer; +import org.telegram.ui.Components.WebPlayerView; import org.telegram.ui.Components.spoilers.SpoilerEffect; +import org.telegram.ui.LaunchActivity; import org.telegram.ui.PeerColorActivity; +import org.telegram.ui.PhotoViewer; import org.telegram.ui.Stars.StarsController; import org.telegram.ui.Stars.StarsIntroActivity; import org.telegram.ui.Stories.StoriesController; @@ -3159,7 +3163,7 @@ public MessageObject(int accountNum, TLRPC.TL_channelAdminLogEvent event, ArrayL prev.setSpan(new AnimatedEmojiSpan(DialogObject.getEmojiStatusDocumentId(action.prev_value), Theme.chat_actionTextPaint.getFontMetricsInt()), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } - boolean hasUntil = action.new_value instanceof TLRPC.TL_emojiStatusUntil; + final int until = DialogObject.getEmojiStatusUntil(action.new_value); SpannableString next; if (action.new_value instanceof TLRPC.TL_emojiStatusEmpty) { @@ -3171,17 +3175,17 @@ public MessageObject(int accountNum, TLRPC.TL_channelAdminLogEvent event, ArrayL SpannableStringBuilder ssb = new SpannableStringBuilder(getString( prevNone ? ( - hasUntil ? (isChannel ? R.string.EventLogChangedEmojiStatusFor : R.string.EventLogChangedEmojiStatusForGroup) : (isChannel ? R.string.EventLogChangedEmojiStatus : R.string.EventLogChangedEmojiStatusGroup) + until != 0 ? (isChannel ? R.string.EventLogChangedEmojiStatusFor : R.string.EventLogChangedEmojiStatusForGroup) : (isChannel ? R.string.EventLogChangedEmojiStatus : R.string.EventLogChangedEmojiStatusGroup) ) : ( - hasUntil ? (isChannel ? R.string.EventLogChangedEmojiStatusFromFor : R.string.EventLogChangedEmojiStatusFromForGroup) : (isChannel ? R.string.EventLogChangedEmojiStatusFrom : R.string.EventLogChangedEmojiStatusFromGroup) + until != 0 ? (isChannel ? R.string.EventLogChangedEmojiStatusFromFor : R.string.EventLogChangedEmojiStatusFromForGroup) : (isChannel ? R.string.EventLogChangedEmojiStatusFrom : R.string.EventLogChangedEmojiStatusFromGroup) ) )); ssb = AndroidUtilities.replaceCharSequence("%1$s", ssb, prev); ssb = AndroidUtilities.replaceCharSequence("%2$s", ssb, next); - if (hasUntil) { - String until = LocaleController.formatTTLString((int) ((DialogObject.getEmojiStatusUntil(action.new_value) - event.date) * 1.05f)); - ssb = AndroidUtilities.replaceCharSequence("%3$s", ssb, until); + if (until != 0) { + final String untilString = LocaleController.formatTTLString((int) ((until - event.date) * 1.05f)); + ssb = AndroidUtilities.replaceCharSequence("%3$s", ssb, untilString); } messageText = replaceWithLink(ssb, "un1", fromUser); @@ -3627,7 +3631,7 @@ public void generatePinMessageText(TLRPC.User fromUser, TLRPC.Chat chat) { messageText = LocaleController.formatPluralString("NotificationPinnedPaidMedia", (int) paidMedia.stars_amount, username); } else if (getMedia(replyMessageObject) instanceof TLRPC.TL_messageMediaGame) { messageText = replaceWithLink(formatString("ActionPinnedGame", R.string.ActionPinnedGame, "\uD83C\uDFAE " + getMedia(replyMessageObject).game.title), "un1", fromUser != null ? fromUser : chat); - messageText = Emoji.replaceEmoji(messageText, Theme.chat_msgTextPaint.getFontMetricsInt(), dp(20), false); + messageText = Emoji.replaceEmoji(messageText, Theme.chat_msgTextPaint.getFontMetricsInt(), false); } else if (replyMessageObject.messageText != null && replyMessageObject.messageText.length() > 0) { CharSequence mess = AnimatedEmojiSpan.cloneSpans(replyMessageObject.messageText); boolean ellipsize = false; @@ -3635,7 +3639,7 @@ public void generatePinMessageText(TLRPC.User fromUser, TLRPC.Chat chat) { mess = mess.subSequence(0, 20); ellipsize = true; } - mess = Emoji.replaceEmoji(mess, Theme.chat_msgTextPaint.getFontMetricsInt(), dp(20), true); + mess = Emoji.replaceEmoji(mess, Theme.chat_msgTextPaint.getFontMetricsInt(), true); if (replyMessageObject != null && replyMessageObject.messageOwner != null) { mess = replyMessageObject.replaceAnimatedEmoji(mess, Theme.chat_msgTextPaint.getFontMetricsInt()); } @@ -4033,7 +4037,7 @@ public void measureInlineBotButtons() { if (str == null) { str = ""; } - text = Emoji.replaceEmoji(str, Theme.chat_msgBotButtonPaint.getFontMetricsInt(), dp(15), false); + text = Emoji.replaceEmoji(str, Theme.chat_msgBotButtonPaint.getFontMetricsInt(), false); } StaticLayout staticLayout = new StaticLayout(text, Theme.chat_msgBotButtonPaint, dp(2000), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); if (staticLayout.getLineCount() > 0) { @@ -4365,7 +4369,7 @@ private void updateMessageText(AbstractMap users, AbstractMap< boolean isChannel = ChatObject.isChannelAndNotMegaGroup(chat); boolean isStars = (giveawayLaunch.flags & 1) != 0; if (isStars) { - messageText = LocaleController.formatPluralStringComma(isChannel ? "BoostingStarsGiveawayJustStarted" : "BoostingStarsGiveawayJustStartedGroup", (int) giveawayLaunch.stars, chat != null ? chat.title : ""); + messageText = formatPluralStringComma(isChannel ? "BoostingStarsGiveawayJustStarted" : "BoostingStarsGiveawayJustStartedGroup", (int) giveawayLaunch.stars, chat != null ? chat.title : ""); } else { messageText = formatString(isChannel ? R.string.BoostingGiveawayJustStarted : R.string.BoostingGiveawayJustStartedGroup, chat != null ? chat.title : ""); } @@ -4401,7 +4405,7 @@ private void updateMessageText(AbstractMap users, AbstractMap< TLRPC.TL_messageActionGiveawayResults giveawayResults = (TLRPC.TL_messageActionGiveawayResults) messageOwner.action; SpannableStringBuilder stringBuilder = new SpannableStringBuilder(); if (giveawayResults.stars) { - stringBuilder.append(LocaleController.formatPluralStringComma("BoostingStarsGiveawayServiceWinnersSelected", giveawayResults.winners_count)); + stringBuilder.append(formatPluralStringComma("BoostingStarsGiveawayServiceWinnersSelected", giveawayResults.winners_count)); if (giveawayResults.unclaimed_count > 0) { stringBuilder.append("\n"); stringBuilder.append(LocaleController.formatPluralString(isChannel ? "BoostingStarsGiveawayServiceUndistributed" : "BoostingStarsGiveawayServiceUndistributedGroup", giveawayResults.unclaimed_count)); @@ -4418,15 +4422,48 @@ private void updateMessageText(AbstractMap users, AbstractMap< final TLRPC.TL_messageActionPrizeStars action = (TLRPC.TL_messageActionPrizeStars) messageOwner.action; final long chatId = -DialogObject.getPeerDialogId(action.boost_peer); final TLRPC.Chat chat = getChat(chats, sChats, chatId); - messageText = replaceWithLink(AndroidUtilities.replaceTags(LocaleController.formatPluralStringComma("ActionStarGiveawayPrize", (int) action.stars)), "un1", chat); + messageText = replaceWithLink(AndroidUtilities.replaceTags(formatPluralStringComma("ActionStarGiveawayPrize", (int) action.stars)), "un1", chat); } else if (messageOwner.action instanceof TLRPC.TL_messageActionStarGift) { - TLRPC.TL_messageActionStarGift action = (TLRPC.TL_messageActionStarGift) messageOwner.action; + final TLRPC.TL_messageActionStarGift action = (TLRPC.TL_messageActionStarGift) messageOwner.action; int stars = 0; if (action.gift != null) { stars = (int) action.gift.stars; } - if (fromObject instanceof TLRPC.User && ((TLRPC.User) fromObject).self && !action.forceIn) { - TLRPC.User user = getUser(users, sUsers, messageOwner.peer_id.user_id); +// if (action.can_upgrade && action.upgrade_stars == 0) { + stars += (int) action.upgrade_stars; +// } + final boolean isForChannel = action.peer != null && DialogObject.getPeerDialogId(action.peer) < 0; + TLRPC.User user = getUser(users, sUsers, messageOwner.peer_id.user_id); + TLObject obj = fromObject; + if (action.from_id != null) { + final long fromId = DialogObject.getPeerDialogId(action.from_id); + if (fromId >= 0) { + obj = getUser(users, sUsers, fromId); + } else { + obj = getChat(chats, sChats, -fromId); + } + } + TLObject peerObj = null; + if (action.peer != null) { + final long peerId = DialogObject.getPeerDialogId(action.peer); + if (peerId >= 0) { + peerObj = getUser(users, sUsers, peerId); + } else { + peerObj = getChat(chats, sChats, -peerId); + } + } + if (UserObject.isService(getDialogId()) && action.from_id == null) { + messageText = AndroidUtilities.replaceTags(getString(R.string.ActionGiftSomeone)); + messageTextShort = getString(R.string.ActionStarGift); + } else if (isForChannel) { + messageText = AndroidUtilities.replaceTags(formatPluralStringComma("ActionGiftChannel", stars)); + messageText = replaceWithLink(messageText, "un1", obj); + messageText = replaceWithLink(messageText, "un2", peerObj); + messageTextShort = getString(R.string.ActionStarGift); + } else if (UserObject.isUserSelf(user)) { + messageText = AndroidUtilities.replaceTags(getString(R.string.ActionGiftSelf)); + messageTextShort = getString(R.string.ActionStarGift); + } else if (obj instanceof TLRPC.User && ((TLRPC.User) obj).self && !action.forceIn) { messageText = replaceWithLink(AndroidUtilities.replaceTags(getString(R.string.ActionGiftOutbound)), "un1", user); if (action.message != null && !TextUtils.isEmpty(action.message.text)) { SpannableStringBuilder stringBuilder = new SpannableStringBuilder(action.message.text); @@ -4435,10 +4472,10 @@ private void updateMessageText(AbstractMap users, AbstractMap< } else { messageTextShort = getString(R.string.ActionStarGift); } - } else if (fromObject instanceof TLRPC.User && UserObject.isService(((TLRPC.User) fromObject).id)) { + } else if (obj instanceof TLRPC.User && UserObject.isService(((TLRPC.User) obj).id)) { messageText = TextUtils.replace(AndroidUtilities.replaceTags(getString(R.string.ActionGiftInbound)), new String[] {"un1"}, new CharSequence[]{ getString(R.string.StarsTransactionUnknown) }); } else { - messageText = replaceWithLink(AndroidUtilities.replaceTags(getString(R.string.ActionGiftInbound)), "un1", fromObject); + messageText = replaceWithLink(AndroidUtilities.replaceTags(getString(R.string.ActionGiftInbound)), "un1", obj); if (action.message != null && !TextUtils.isEmpty(action.message.text)) { SpannableStringBuilder stringBuilder = new SpannableStringBuilder(action.message.text); addEntitiesToText(stringBuilder, action.message.entities, isOutOwner(), false, false, false); @@ -4450,7 +4487,51 @@ private void updateMessageText(AbstractMap users, AbstractMap< int i = messageText.toString().indexOf("un2"); if (i != -1) { SpannableStringBuilder sb = SpannableStringBuilder.valueOf(messageText); - messageText = sb.replace(i, i + 3, LocaleController.formatPluralStringComma("Gift2StarsCount", (int) stars)); + messageText = sb.replace(i, i + 3, formatPluralStringComma("Gift2StarsCount", (int) stars)); + } + } else if (messageOwner.action instanceof TLRPC.TL_messageActionStarGiftUnique) { + TLRPC.TL_messageActionStarGiftUnique action = (TLRPC.TL_messageActionStarGiftUnique) messageOwner.action; + TLRPC.User user = getUser(users, sUsers, getDialogId()); + if (action.upgrade) { + if (action.peer != null) { + long peerId = DialogObject.getPeerDialogId(action.peer); + TLObject peer; + if (peerId >= 0) { + peer = getUser(users, sUsers, peerId); + } else { + peer = getChat(chats, sChats, -peerId); + } + messageText = replaceWithLink(AndroidUtilities.replaceTags(getString(R.string.ActionUniqueGiftUpgradeInboundChannel)), "un1", peer); + } else if (UserObject.isUserSelf(user)) { + messageText = AndroidUtilities.replaceTags(getString(R.string.ActionUniqueGiftUpgradeSelf)); + } else { + messageText = replaceWithLink(AndroidUtilities.replaceTags(getString(isOutOwner() ? R.string.ActionUniqueGiftUpgradeOutbound : R.string.ActionUniqueGiftUpgradeInbound)), "un1", user); + } + } else { + long fromId = getDialogId(); + if (action.from_id != null) { + fromId = DialogObject.getPeerDialogId(action.from_id); + } + TLObject obj; + if (fromId >= 0) { + obj = getUser(users, sUsers, fromId); + } else { + obj = getChat(chats, sChats, -fromId); + } + if (action.peer != null) { + long peerId = DialogObject.getPeerDialogId(action.peer); + TLObject peer; + if (peerId >= 0) { + peer = getUser(users, sUsers, peerId); + } else { + peer = getChat(chats, sChats, -peerId); + } + messageText = AndroidUtilities.replaceTags(getString(R.string.ActionUniqueGiftTransferService)); + messageText = replaceWithLink(messageText, "un1", obj); + messageText = replaceWithLink(messageText, "un2", peer); + } else { + messageText = replaceWithLink(AndroidUtilities.replaceTags(getString(isOutOwner() ? R.string.ActionUniqueGiftTransferOutbound : R.string.ActionUniqueGiftTransferInbound)), "un1", obj); + } } } else if (messageOwner.action instanceof TLRPC.TL_messageActionGiftStars) { if (fromObject instanceof TLRPC.User && ((TLRPC.User) fromObject).self) { @@ -5117,6 +5198,10 @@ private void updateMessageText(AbstractMap users, AbstractMap< if (messageText == null) { messageText = ""; } + + isEmbedVideoCached = null; + cachedStartsTimestamp = null; + cachedSavedTimestamp = null; } public CharSequence getMediaTitle(TLRPC.MessageMedia media) { @@ -5423,7 +5508,7 @@ public void setType() { } else if (messageOwner.action instanceof TLRPC.TL_messageActionGiftPremium || messageOwner.action instanceof TLRPC.TL_messageActionGiftCode) { contentType = 1; type = TYPE_GIFT_PREMIUM; - } else if (messageOwner.action instanceof TLRPC.TL_messageActionGiftStars || messageOwner.action instanceof TLRPC.TL_messageActionStarGift || messageOwner.action instanceof TLRPC.TL_messageActionPrizeStars) { + } else if (messageOwner.action instanceof TLRPC.TL_messageActionGiftStars || messageOwner.action instanceof TLRPC.TL_messageActionStarGift || messageOwner.action instanceof TLRPC.TL_messageActionPrizeStars || messageOwner.action instanceof TLRPC.TL_messageActionStarGiftUnique && ((TLRPC.TL_messageActionStarGiftUnique) messageOwner.action).refunded) { contentType = 1; type = TYPE_GIFT_STARS; } else if (messageOwner.action instanceof TLRPC.TL_messageActionChatEditPhoto || messageOwner.action instanceof TLRPC.TL_messageActionUserUpdatedPhoto) { @@ -5925,6 +6010,13 @@ public String getFileName() { return getFileName(messageOwner); } + public String getFileNameFast() { + if (getDocumentFast() != null) { + return getFileName(getDocumentFast()); + } + return getFileName(messageOwner); + } + public static String getFileName(TLRPC.Message messageOwner) { if (getMedia(messageOwner) instanceof TLRPC.TL_messageMediaDocument) { return getFileName(getDocument(messageOwner)); @@ -6088,7 +6180,7 @@ public void generateLinkDescription() { FileLog.e(e); } } - linkDescription = Emoji.replaceEmoji(linkDescription, Theme.chat_msgTextPaint.getFontMetricsInt(), dp(20), false); + linkDescription = Emoji.replaceEmoji(linkDescription, Theme.chat_msgTextPaint.getFontMetricsInt(), false); if (webPageDescriptionEntities != null) { addEntitiesToText(linkDescription, webPageDescriptionEntities, isOut(), allowUsernames, false, !allowUsernames); replaceAnimatedEmoji(linkDescription, webPageDescriptionEntities, Theme.chat_msgTextPaint.getFontMetricsInt()); @@ -6119,7 +6211,7 @@ public void updateDrawState(TextPaint textPaint) { } CharSequence text = messageOwner.voiceTranscription; if (!TextUtils.isEmpty(text)) { - text = Emoji.replaceEmoji(text, Theme.chat_msgTextPaint.getFontMetricsInt(), dp(20), false); + text = Emoji.replaceEmoji(text, Theme.chat_msgTextPaint.getFontMetricsInt(), false); } return text; } @@ -6179,7 +6271,7 @@ public void generateCaption() { entities = messageOwner.translatedText.entities; } if (!isMediaEmpty() && !(getMedia(messageOwner) instanceof TLRPC.TL_messageMediaGame) && !TextUtils.isEmpty(text)) { - caption = Emoji.replaceEmoji(text, Theme.chat_msgTextPaint.getFontMetricsInt(), dp(20), false); + caption = Emoji.replaceEmoji(text, Theme.chat_msgTextPaint.getFontMetricsInt(), false); caption = replaceAnimatedEmoji(caption, entities, Theme.chat_msgTextPaint.getFontMetricsInt(), false); boolean hasEntities; @@ -6395,6 +6487,9 @@ public static int getInlineResultDuration(TLRPC.BotInlineResult inlineResult) { public boolean hasValidGroupId() { return getGroupId() != 0 && (photoThumbs != null && !photoThumbs.isEmpty() || type == TYPE_VIDEO || type == TYPE_PHOTO || isMusic() || isDocument()); } + public boolean hasValidGroupIdFast() { + return getGroupId() != 0 && (photoThumbs != null && !photoThumbs.isEmpty() || type == TYPE_VIDEO || type == TYPE_PHOTO || type == TYPE_MUSIC || type == TYPE_FILE); + } public long getGroupIdForUse() { return localSentGroupId != 0 ? localSentGroupId : messageOwner.grouped_id; @@ -6520,6 +6615,13 @@ public static Spannable replaceAnimatedEmoji(CharSequence text, ArrayList entities, Paint.FontMetricsInt fontMetricsInt, boolean top) { + return replaceAnimatedEmoji(text, entities, fontMetricsInt, top, 1.2f); + } + + public static Spannable replaceAnimatedEmoji(CharSequence text, ArrayList entities, Paint.FontMetricsInt fontMetricsInt, boolean top, float scale) { + if (text == null) { + return null; + } Spannable spannable = text instanceof Spannable ? (Spannable) text : new SpannableString(text); if (entities == null) { return spannable; @@ -6551,9 +6653,9 @@ public static Spannable replaceAnimatedEmoji(CharSequence text, ArrayList AndroidUtilities.getPhotoSize()) { photoHeight = AndroidUtilities.getPhotoSize(); } - TLRPC.PhotoSize currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(photoThumbs, AndroidUtilities.getPhotoSize()); + TLRPC.PhotoSize currentPhotoObject; + if (fast) { + currentPhotoObject = photoThumbs == null || photoThumbs.isEmpty() ? null : photoThumbs.get(0); + } else { + currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(photoThumbs, AndroidUtilities.getPhotoSize()); + } if (currentPhotoObject != null) { float scale = (float) currentPhotoObject.w / (float) photoWidth; @@ -9191,7 +9318,7 @@ public int getApproximateHeight() { } else if (h < dp(120)) { h = dp(120); } - if (needDrawBluredPreview()) { + if (!fast && needDrawBluredPreview()) { if (AndroidUtilities.isTablet()) { h = (int) (AndroidUtilities.getMinTabletSide() * 0.5f); } else { @@ -10277,7 +10404,7 @@ public boolean equals(MessageObject obj) { } public boolean isReactionsAvailable() { - return !isEditing() && !isSponsored() && isSent() && messageOwner.action == null && !isExpiredStory(); + return !isEditing() && !isSponsored() && isSent() && !isExpiredStory() && canSetReaction(); } public boolean isPaidReactionChosen() { @@ -11131,7 +11258,7 @@ public float getProgress() { public ArrayList videoQualities; public TLRPC.Document qualityToSave; - public VideoPlayer.VideoUri highestQuality, thumbQuality; + public VideoPlayer.VideoUri highestQuality, thumbQuality, cachedQuality; public boolean hasVideoQualities() { if (videoQualitiesCached == null) { @@ -11143,6 +11270,7 @@ public boolean hasVideoQualities() { videoQualitiesCached = videoQualities != null && videoQualities.size() > 1; highestQuality = VideoPlayer.getQualityForPlayer(videoQualities); thumbQuality = VideoPlayer.getQualityForThumb(videoQualities); + cachedQuality = VideoPlayer.getCachedQuality(videoQualities); } catch (Exception e) { FileLog.e(e); videoQualitiesCached = false; @@ -11152,7 +11280,7 @@ public boolean hasVideoQualities() { } public boolean isStarGiftAction() { - return messageOwner != null && messageOwner.action instanceof TLRPC.TL_messageActionStarGift; + return messageOwner != null && (messageOwner.action instanceof TLRPC.TL_messageActionStarGift || messageOwner.action instanceof TLRPC.TL_messageActionStarGiftUnique); } public boolean mediaExists() { @@ -11163,12 +11291,49 @@ public boolean mediaExists() { } public void updateQualitiesCached(boolean useFileDatabaseQueue) { - if (videoQualities == null) return; + if (videoQualities == null) { + cachedQuality = null; + return; + } for (VideoPlayer.Quality q : videoQualities) { for (VideoPlayer.VideoUri u : q.uris) { u.updateCached(useFileDatabaseQueue); } } + highestQuality = VideoPlayer.getQualityForPlayer(videoQualities); + thumbQuality = VideoPlayer.getQualityForThumb(videoQualities); + cachedQuality = VideoPlayer.getCachedQuality(videoQualities); + } + + public boolean areTags() { + if (messageOwner == null) return false; + if (messageOwner.reactions == null) return false; + return messageOwner.reactions.reactions_as_tags; + } + + public boolean openedInViewer; + + private Integer cachedStartsTimestamp; + public int getVideoStartsTimestamp() { + if (cachedStartsTimestamp != null) return cachedStartsTimestamp; + if (!isVideo()) return cachedStartsTimestamp = -1; + final TLRPC.MessageMedia media = getMedia(this); + if (media.video_timestamp != 0) { + return media.video_timestamp; + } + if (media != null && media.webpage != null && media.webpage.url != null) { + try { + return cachedStartsTimestamp = LaunchActivity.getTimestampFromLink(Uri.parse(media.webpage.url)); + } catch (Exception e) {} + } + return cachedStartsTimestamp = -1; + } + + public Float cachedSavedTimestamp; + public float getVideoSavedProgress() { +// if (cachedSavedTimestamp != null) return cachedSavedTimestamp; + if (cachedSavedTimestamp != null) return PhotoViewer.getSavedProgressFast(this); + return cachedSavedTimestamp = PhotoViewer.getSavedProgress(this); } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java index 8a0c411fae..083a07a749 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java @@ -13,6 +13,7 @@ import static org.telegram.messenger.NotificationsController.TYPE_CHANNEL; import static org.telegram.messenger.NotificationsController.TYPE_PRIVATE; import static org.telegram.messenger.NotificationsController.TYPE_REACTIONS_MESSAGES; +import static org.telegram.ui.Stars.StarsController.findAttribute; import android.Manifest; import android.app.Activity; @@ -60,8 +61,11 @@ import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import org.telegram.tgnet.tl.TL_account; import org.telegram.tgnet.tl.TL_bots; +import org.telegram.tgnet.tl.TL_phone; +import org.telegram.tgnet.tl.TL_stars; import org.telegram.tgnet.tl.TL_stories; import org.telegram.tgnet.tl.TL_chatlists; import org.telegram.ui.ActionBar.ActionBarLayout; @@ -114,6 +118,7 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicBoolean; public class MessagesController extends BaseController implements NotificationCenter.NotificationCenterDelegate { @@ -131,8 +136,8 @@ public class MessagesController extends BaseController implements NotificationCe private final LongSparseArray exportedChats = new LongSparseArray<>(); public ArrayList hintDialogs = new ArrayList<>(); - public SparseArray> dialogsByFolder = new SparseArray<>(); - protected ArrayList allDialogs = new ArrayList<>(); + public final SparseArray> dialogsByFolder = new SparseArray<>(); + protected final ArrayList allDialogs = new ArrayList<>(); public ArrayList dialogsForward = new ArrayList<>(); public ArrayList dialogsServerOnly = new ArrayList<>(); public ArrayList dialogsCanAddUsers = new ArrayList<>(); @@ -249,7 +254,7 @@ public ChatlistUpdatesStat(TL_chatlists.TL_chatlists_chatlistUpdates value) { private long lastViewsCheckTime; public SparseIntArray premiumFeaturesTypesToPosition = new SparseIntArray(); public SparseIntArray businessFeaturesTypesToPosition = new SparseIntArray(); - + public ArrayList dialogFilters = new ArrayList<>(); public ArrayList frozenDialogFilters = null; public ArrayList hiddenUndoChats = new ArrayList<>(); @@ -644,19 +649,15 @@ protected boolean useCache(Integer arguments) { public boolean starrefConnectAllowed; public int starrefMinCommissionPermille; public int starrefMaxCommissionPermille; - + public int botVerificationDescriptionLengthLimit; public long paidReactionsAnonymousTime; public Boolean paidReactionsAnonymous; - public int savedDialogsPinnedLimitDefault; public int savedDialogsPinnedLimitPremium; - public boolean savedViewAsChats; public boolean storyQualityFull; - public int uploadMaxFileParts; public int uploadMaxFilePartsPremium; - public String premiumBotUsername; public String premiumInvoiceSlug; @@ -703,6 +704,7 @@ public boolean premiumPurchaseBlocked() { public int stargiftsConvertPeriodMax; public boolean videoIgnoreAltDocuments; public boolean disableBotFullscreenBlur; + public String tonBlockchainExplorerUrl; public int checkResetLangpack; public boolean folderTags; @@ -1137,6 +1139,7 @@ public static class PrintingUser { public static class DialogFilter { public int id; public String name; + public ArrayList entities = new ArrayList<>(); public int unreadCount; public volatile int pendingUnreadCount; public int order; @@ -1147,6 +1150,7 @@ public static class DialogFilter { public ArrayList dialogs = new ArrayList<>(); public ArrayList dialogsForward = new ArrayList<>(); public int color; + public boolean title_noanimate; public ArrayList invites = null; @@ -1559,6 +1563,7 @@ public MessagesController(int num) { stargiftsConvertPeriodMax = mainPreferences.getInt("stargiftsConvertPeriodMax", isTest ? 300 : 90 * 86400); videoIgnoreAltDocuments = mainPreferences.getBoolean("videoIgnoreAltDocuments", false); disableBotFullscreenBlur = mainPreferences.getBoolean("disableBotFullscreenBlur", false); + tonBlockchainExplorerUrl = mainPreferences.getString("tonBlockchainExplorerUrl", "https://tonviewer.com/"); storiesPosting = mainPreferences.getString("storiesPosting", "enabled"); storiesEntities = mainPreferences.getString("storiesEntities", "premium"); storiesExportNopublicLink = mainPreferences.getBoolean("storiesExportNopublicLink", false); @@ -1615,6 +1620,7 @@ public MessagesController(int num) { starrefStartParamPrefixes = mainPreferences.getStringSet("starrefStartParamPrefixes", new HashSet<>(Arrays.asList("_tgr_"))); starrefMinCommissionPermille = mainPreferences.getInt("starrefMinCommissionPermille", 1); starrefMaxCommissionPermille = mainPreferences.getInt("starrefMaxCommissionPermille", 400); + botVerificationDescriptionLengthLimit = mainPreferences.getInt("botVerificationDescriptionLengthLimit", 70); paidReactionsAnonymousTime = mainPreferences.getLong("paidReactionsAnonymousTime", 0); paidReactionsAnonymous = mainPreferences.contains("paidReactionsAnonymous") && (System.currentTimeMillis() - paidReactionsAnonymousTime) < 1000 * 60 * 60 * 2 ? mainPreferences.getBoolean("paidReactionsAnonymous", false) : null; scheduleTranscriptionUpdate(); @@ -1783,10 +1789,10 @@ private void sendLoadPeersRequest(TLObject req, ArrayList requests, TL if (response instanceof TLRPC.TL_messages_chats) { TLRPC.TL_messages_chats res = (TLRPC.TL_messages_chats) response; chats.addAll(res.chats); - } else if (response instanceof TLRPC.Vector) { - TLRPC.Vector res = (TLRPC.Vector) response; - for (int a = 0, N = res.objects.size(); a < N; a++) { - TLRPC.User user = (TLRPC.User) res.objects.get(a); + } else if (response instanceof Vector) { + Vector vector = (Vector) response; + for (int a = 0, N = vector.objects.size(); a < N; a++) { + TLRPC.User user = (TLRPC.User) vector.objects.get(a); users.add(user); } } else if (response instanceof TLRPC.TL_messages_peerDialogs) { @@ -2211,11 +2217,8 @@ public void loadSuggestedFilters() { getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { loadingSuggestedFilters = false; suggestedFilters.clear(); - if (response instanceof TLRPC.Vector) { - TLRPC.Vector vector = (TLRPC.Vector) response; - for (int a = 0, N = vector.objects.size(); a < N; a++) { - suggestedFilters.add((TLRPC.TL_dialogFilterSuggested) vector.objects.get(a)); - } + if (response instanceof Vector) { + suggestedFilters.addAll(((Vector) response).objects); } getNotificationCenter().postNotificationName(NotificationCenter.suggestedFiltersLoaded); })); @@ -2240,9 +2243,9 @@ public void loadRemoteFilters(boolean force, Utilities.Callback whenDon } TLRPC.TL_messages_getDialogFilters req = new TLRPC.TL_messages_getDialogFilters(); getConnectionsManager().sendRequest(req, (response, error) -> { - if (response instanceof TLRPC.Vector) { + if (response instanceof Vector) { ArrayList filters = new ArrayList<>(); - TLRPC.Vector vector = (TLRPC.Vector) response; + Vector vector = (Vector) response; for (int i = 0; i < vector.objects.size(); ++i) { filters.add((TLRPC.DialogFilter) vector.objects.get(i)); } @@ -2367,20 +2370,69 @@ public void addFilter(DialogFilter filter, boolean atBegin) { lockFiltersInternal(); } + public static TLRPC.TL_emojiStatusCollectible emojiStatusCollectibleFromGift(TL_stars.TL_starGiftUnique gift) { + final TLRPC.TL_emojiStatusCollectible status = new TLRPC.TL_emojiStatusCollectible(); + status.collectible_id = gift.id; + final TL_stars.starGiftAttributeModel model = findAttribute(gift.attributes, TL_stars.starGiftAttributeModel.class); + final TL_stars.starGiftAttributeBackdrop backdrop = findAttribute(gift.attributes, TL_stars.starGiftAttributeBackdrop.class); + final TL_stars.starGiftAttributePattern pattern = findAttribute(gift.attributes, TL_stars.starGiftAttributePattern.class); + status.title = gift.title + " #" + gift.num; + if (model != null) { + status.document_id = model.document.id; + } + if (pattern != null) { + status.pattern_document_id = pattern.document.id; + } + if (backdrop != null) { + status.center_color = backdrop.center_color; + status.edge_color = backdrop.edge_color; + status.text_color = backdrop.text_color; + status.pattern_color = backdrop.pattern_color; + } + return status; + } + public void updateEmojiStatus(TLRPC.EmojiStatus newStatus) { - TLRPC.TL_account_updateEmojiStatus req = new TLRPC.TL_account_updateEmojiStatus(); - req.emoji_status = newStatus; - TLRPC.User user = getUserConfig().getCurrentUser(); - if (user != null) { - user.emoji_status = req.emoji_status; - getNotificationCenter().postNotificationName(NotificationCenter.userEmojiStatusUpdated, user); - getMessagesController().updateEmojiStatusUntilUpdate(user.id, user.emoji_status); + updateEmojiStatus(newStatus, null); + } + public void updateEmojiStatus(TLRPC.EmojiStatus newStatus, TL_stars.StarGift gift) { + updateEmojiStatus(0, newStatus, gift); + } + + public void updateEmojiStatus(long dialogId, TLRPC.EmojiStatus newStatus, TL_stars.StarGift gift) { + final boolean myself = dialogId == 0 || dialogId == getUserConfig().getClientUserId(); + TLRPC.EmojiStatus new_emoji_status = newStatus; + if (new_emoji_status instanceof TLRPC.TL_inputEmojiStatusCollectible && gift instanceof TL_stars.TL_starGiftUnique) { + new_emoji_status = emojiStatusCollectibleFromGift((TL_stars.TL_starGiftUnique) gift); } - getConnectionsManager().sendRequest(req, (res, err) -> { - if (!(res instanceof TLRPC.TL_boolTrue)) { - // TODO: reject + + TLObject r; + if (myself) { + TL_account.updateEmojiStatus req = new TL_account.updateEmojiStatus(); + req.emoji_status = newStatus; + r = req; + + TLRPC.User user = getUserConfig().getCurrentUser(); + if (user != null) { + user.emoji_status = new_emoji_status; + getNotificationCenter().postNotificationName(NotificationCenter.userEmojiStatusUpdated, user); } - }); + } else { + TLRPC.TL_channels_updateEmojiStatus req = new TLRPC.TL_channels_updateEmojiStatus(); + req.channel = getInputChannel(-dialogId); + req.emoji_status = newStatus; + r = req; + + TLRPC.Chat chat = getChat(-dialogId); + if (chat != null) { + chat.flags |= 512; + chat.emoji_status = new_emoji_status; + putChat(chat, true); + } + } + getMessagesController().updateEmojiStatusUntilUpdate(dialogId, new_emoji_status); + getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_EMOJI_STATUS); + getConnectionsManager().sendRequest(r, null); } public void removeFilter(DialogFilter filter) { @@ -3760,6 +3812,17 @@ private void applyAppConfig(TLRPC.TL_jsonObject object) { } break; } + case "ton_blockchain_explorer_url": { + if (value.value instanceof TLRPC.TL_jsonString) { + TLRPC.TL_jsonString str = (TLRPC.TL_jsonString) value.value; + if (!TextUtils.equals(str.value, tonBlockchainExplorerUrl)) { + tonBlockchainExplorerUrl = str.value; + editor.putString("tonBlockchainExplorerUrl", tonBlockchainExplorerUrl); + changed = true; + } + } + break; + } case "stories_posting": { if (value.value instanceof TLRPC.TL_jsonString) { TLRPC.TL_jsonString str = (TLRPC.TL_jsonString) value.value; @@ -4479,6 +4542,17 @@ private void applyAppConfig(TLRPC.TL_jsonObject object) { } break; } + case "bot_verification_description_length_limit": { + if (value.value instanceof TLRPC.TL_jsonNumber) { + TLRPC.TL_jsonNumber num = (TLRPC.TL_jsonNumber) value.value; + if (num.value != botVerificationDescriptionLengthLimit) { + botVerificationDescriptionLengthLimit = (int) num.value; + editor.putInt("botVerificationDescriptionLengthLimit", botVerificationDescriptionLengthLimit); + changed = true; + } + } + break; + } } } @@ -4769,6 +4843,8 @@ public static PeerColors fromJSON( } public static class PeerColor { + public int patternColor = 0; + public int textColor = 0; public boolean isDefaultName; public int id; public boolean hidden; @@ -4901,6 +4977,24 @@ public void appendString(StringBuilder sb) { sb.append("}"); } + public static PeerColor fromCollectible(TLRPC.EmojiStatus status) { + if (!(status instanceof TLRPC.TL_emojiStatusCollectible)) return null; + final TLRPC.TL_emojiStatusCollectible s = (TLRPC.TL_emojiStatusCollectible) status; + final PeerColor peerColor = new PeerColor(); + peerColor.id = -1; + peerColor.hidden = true; + peerColor.colors[0] = s.edge_color | 0xFF000000; + peerColor.colors[1] = s.center_color | 0xFF000000; + peerColor.colors[2] = s.edge_color | 0xFF000000; + peerColor.colors[3] = s.center_color | 0xFF000000; + peerColor.colors[4] = s.text_color | 0xFF000000; + peerColor.colors[5] = s.text_color | 0xFF000000; + System.arraycopy(peerColor.colors, 0, peerColor.darkColors, 0, 6); + peerColor.patternColor = s.pattern_color | 0xFF000000; + peerColor.textColor = s.text_color | 0xFF000000; + return peerColor; + } + public static PeerColor fromTL(TLRPC.TL_help_peerColorOption tl) { if (tl == null) return null; @@ -5483,7 +5577,7 @@ public void didReceivedNotification(int id, int account, Object... args) { } }); } else if (uploadingWallpaper != null && uploadingWallpaper.equals(location)) { - TLRPC.TL_account_uploadWallPaper req = new TLRPC.TL_account_uploadWallPaper(); + TL_account.uploadWallPaper req = new TL_account.uploadWallPaper(); req.file = file; req.mime_type = "image/jpeg"; Theme.OverrideWallpaperInfo overrideWallpaperInfo = uploadingWallpaperInfo; @@ -5567,7 +5661,7 @@ public void didReceivedNotification(int id, int account, Object... args) { if (uploadedFile != null && uploadedThumb != null) { File f = new File(location); - TLRPC.TL_account_uploadTheme req = new TLRPC.TL_account_uploadTheme(); + TL_account.uploadTheme req = new TL_account.uploadTheme(); req.mime_type = "application/x-tgtheme-android"; req.file_name = "theme.attheme"; req.file = uploadedFile; @@ -5650,7 +5744,7 @@ public void didReceivedNotification(int id, int account, Object... args) { inputDocument.id = document.id; inputDocument.file_reference = document.file_reference; if (info == null || !info.creator) { - TLRPC.TL_account_createTheme req2 = new TLRPC.TL_account_createTheme(); + TL_account.createTheme req2 = new TL_account.createTheme(); req2.document = inputDocument; req2.flags |= 4; req2.slug = info != null && !TextUtils.isEmpty(info.slug) ? info.slug : ""; @@ -5669,7 +5763,7 @@ public void didReceivedNotification(int id, int account, Object... args) { } })); } else { - TLRPC.TL_account_updateTheme req2 = new TLRPC.TL_account_updateTheme(); + TL_account.updateTheme req2 = new TL_account.updateTheme(); TLRPC.TL_inputTheme inputTheme = new TLRPC.TL_inputTheme(); inputTheme.id = info.id; inputTheme.access_hash = info.access_hash; @@ -6268,8 +6362,8 @@ public void reloadUser(long userId) { if (inputPeer == null) return; req.id.add(inputPeer); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> { - if (res instanceof TLRPC.Vector) { - ArrayList objects = ((TLRPC.Vector) res).objects; + if (res instanceof Vector) { + ArrayList objects = ((Vector) res).objects; ArrayList users = new ArrayList<>(); for (int i = 0; i < objects.size(); ++i) { if (objects.get(i) instanceof TLRPC.User) { @@ -6562,12 +6656,12 @@ public ChatObject.Call getGroupCall(long chatId, boolean load, Runnable onLoad) if (result == null && load && !loadingGroupCalls.contains(chatId)) { loadingGroupCalls.add(chatId); if (chatFull.call != null) { - TLRPC.TL_phone_getGroupCall req = new TLRPC.TL_phone_getGroupCall(); + TL_phone.getGroupCall req = new TL_phone.getGroupCall(); req.call = chatFull.call; req.limit = 20; getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (response != null) { - TLRPC.TL_phone_groupCall groupCall = (TLRPC.TL_phone_groupCall) response; + TL_phone.groupCall groupCall = (TL_phone.groupCall) response; putUsers(groupCall.users, false); putChats(groupCall.chats, false); @@ -7147,7 +7241,7 @@ public void reportSpam(final long dialogId, TLRPC.User currentUser, TLRPC.Chat c }, ConnectionsManager.RequestFlagFailOnServerErrors); } else { if (geo) { - TLRPC.TL_account_reportPeer req = new TLRPC.TL_account_reportPeer(); + TL_account.reportPeer req = new TL_account.reportPeer(); if (currentChat != null) { req.peer = getInputPeer(-currentChat.id); } else if (currentUser != null) { @@ -8121,9 +8215,7 @@ public void deleteUserPhoto(TLRPC.InputPhoto photo) { TLRPC.TL_photos_deletePhotos req = new TLRPC.TL_photos_deletePhotos(); req.id.add(photo); getDialogPhotos(dialogId).removePhoto(photo.id); - getConnectionsManager().sendRequest(req, (response, error) -> { - - }); + getConnectionsManager().sendRequest(req, null); } } @@ -8138,7 +8230,7 @@ public void uploadAndApplyUserAvatar(TLRPC.FileLocation location) { public void saveTheme(Theme.ThemeInfo themeInfo, Theme.ThemeAccent accent, boolean night, boolean unsave) { TLRPC.TL_theme info = accent != null ? accent.info : themeInfo.info; if (info != null) { - TLRPC.TL_account_saveTheme req = new TLRPC.TL_account_saveTheme(); + TL_account.saveTheme req = new TL_account.saveTheme(); TLRPC.TL_inputTheme inputTheme = new TLRPC.TL_inputTheme(); inputTheme.id = info.id; inputTheme.access_hash = info.access_hash; @@ -8160,7 +8252,7 @@ public void installTheme(Theme.ThemeInfo themeInfo, Theme.ThemeAccent accent, bo boolean isBlured = accent == null && themeInfo.isBlured; boolean isMotion = accent != null ? accent.patternMotion : themeInfo.isMotion; - TLRPC.TL_account_installTheme req = new TLRPC.TL_account_installTheme(); + TL_account.installTheme req = new TL_account.installTheme(); req.dark = night; if (info != null) { req.format = "android"; @@ -8175,7 +8267,7 @@ public void installTheme(Theme.ThemeInfo themeInfo, Theme.ThemeAccent accent, bo }); if (!TextUtils.isEmpty(slug)) { - TLRPC.TL_account_installWallPaper req2 = new TLRPC.TL_account_installWallPaper(); + TL_account.installWallPaper req2 = new TL_account.installWallPaper(); TLRPC.TL_inputWallPaperSlug inputWallPaperSlug = new TLRPC.TL_inputWallPaperSlug(); inputWallPaperSlug.slug = slug; req2.wallpaper = inputWallPaperSlug; @@ -8250,12 +8342,12 @@ public void saveWallpaperToServer(File path, Theme.OverrideWallpaperInfo info, b TLObject req; if (install) { - TLRPC.TL_account_installWallPaper request = new TLRPC.TL_account_installWallPaper(); + TL_account.installWallPaper request = new TL_account.installWallPaper(); request.wallpaper = inputWallPaper; request.settings = settings; req = request; } else { - TLRPC.TL_account_saveWallPaper request = new TLRPC.TL_account_saveWallPaper(); + TL_account.saveWallPaper request = new TL_account.saveWallPaper(); request.wallpaper = inputWallPaper; request.settings = settings; req = request; @@ -9344,7 +9436,7 @@ public void updateTimerProc() { getConnectionsManager().cancelRequest(statusRequest, true); } - TLRPC.TL_account_updateStatus req = new TLRPC.TL_account_updateStatus(); + TL_account.updateStatus req = new TL_account.updateStatus(); req.offline = false; statusRequest = getConnectionsManager().sendRequest(req, (response, error) -> { if (error == null) { @@ -9365,7 +9457,7 @@ public void updateTimerProc() { if (statusRequest != 0) { getConnectionsManager().cancelRequest(statusRequest, true); } - TLRPC.TL_account_updateStatus req = new TLRPC.TL_account_updateStatus(); + TL_account.updateStatus req = new TL_account.updateStatus(); req.offline = true; statusRequest = getConnectionsManager().sendRequest(req, (response, error) -> { if (error == null) { @@ -10577,7 +10669,7 @@ public void reloadWebPages(final long dialogId, HashMap AndroidUtilities.runOnUIThread(() -> { ArrayList arrayList1 = map.remove(url); @@ -10585,13 +10677,20 @@ public void reloadWebPages(final long dialogId, HashMap AndroidUtilities.runOnUIThread(() -> { + getConnectionsManager().sendRequest(new TL_account.getReactionsNotifySettings(), (res, err) -> AndroidUtilities.runOnUIThread(() -> { loadingNotificationSettings--; - if (res instanceof TLRPC.TL_reactionsNotifySettings) { - TLRPC.TL_reactionsNotifySettings notify_settings = (TLRPC.TL_reactionsNotifySettings) res; + if (res instanceof TL_account.TL_reactionsNotifySettings) { + TL_account.TL_reactionsNotifySettings notify_settings = (TL_account.TL_reactionsNotifySettings) res; SharedPreferences.Editor editor = notificationsPreferences.edit(); editor.putBoolean("EnableReactionsMessages", notify_settings.messages_notify_from != null); if (notify_settings.messages_notify_from != null) { - editor.putBoolean("EnableReactionsMessagesContacts", notify_settings.messages_notify_from instanceof TLRPC.TL_reactionNotificationsFromContacts); + editor.putBoolean("EnableReactionsMessagesContacts", notify_settings.messages_notify_from instanceof TL_account.TL_reactionNotificationsFromContacts); } editor.putBoolean("EnableReactionsStories", notify_settings.stories_notify_from != null); if (notify_settings.stories_notify_from != null) { - editor.putBoolean("EnableReactionsStoriesContacts", notify_settings.stories_notify_from instanceof TLRPC.TL_reactionNotificationsFromContacts); + editor.putBoolean("EnableReactionsStoriesContacts", notify_settings.stories_notify_from instanceof TL_account.TL_reactionNotificationsFromContacts); } editor.putBoolean("EnableReactionsPreview", notify_settings.show_previews); getNotificationsController().getNotificationsSettingsFacade().applySoundSettings(notify_settings.sound, editor, 0, 0, TYPE_REACTIONS_MESSAGES, false); @@ -11367,17 +11466,17 @@ public void loadGlobalNotificationsSettings() { } public void reloadReactionsNotifySettings() { - getConnectionsManager().sendRequest(new TLRPC.TL_account_getReactionsNotifySettings(), (res, err) -> AndroidUtilities.runOnUIThread(() -> { - if (res instanceof TLRPC.TL_reactionsNotifySettings) { - TLRPC.TL_reactionsNotifySettings notify_settings = (TLRPC.TL_reactionsNotifySettings) res; + getConnectionsManager().sendRequest(new TL_account.getReactionsNotifySettings(), (res, err) -> AndroidUtilities.runOnUIThread(() -> { + if (res instanceof TL_account.TL_reactionsNotifySettings) { + TL_account.TL_reactionsNotifySettings notify_settings = (TL_account.TL_reactionsNotifySettings) res; SharedPreferences.Editor editor = notificationsPreferences.edit(); editor.putBoolean("EnableReactionsMessages", notify_settings.messages_notify_from != null); if (notify_settings.messages_notify_from != null) { - editor.putBoolean("EnableReactionsMessagesContacts", notify_settings.messages_notify_from instanceof TLRPC.TL_reactionNotificationsFromContacts); + editor.putBoolean("EnableReactionsMessagesContacts", notify_settings.messages_notify_from instanceof TL_account.TL_reactionNotificationsFromContacts); } editor.putBoolean("EnableReactionsStories", notify_settings.stories_notify_from != null); if (notify_settings.stories_notify_from != null) { - editor.putBoolean("EnableReactionsStoriesContacts", notify_settings.stories_notify_from instanceof TLRPC.TL_reactionNotificationsFromContacts); + editor.putBoolean("EnableReactionsStoriesContacts", notify_settings.stories_notify_from instanceof TL_account.TL_reactionNotificationsFromContacts); } editor.putBoolean("EnableReactionsPreview", notify_settings.show_previews); getNotificationsController().getNotificationsSettingsFacade().applySoundSettings(notify_settings.sound, editor, 0, 0, TYPE_REACTIONS_MESSAGES, false); @@ -11391,7 +11490,7 @@ public void reloadReactionsNotifySettings() { public void loadSignUpNotificationsSettings() { if (!loadingNotificationSignUpSettings) { loadingNotificationSignUpSettings = true; - TLRPC.TL_account_getContactSignUpNotification req = new TLRPC.TL_account_getContactSignUpNotification(); + TL_account.getContactSignUpNotification req = new TL_account.getContactSignUpNotification(); getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { loadingNotificationSignUpSettings = false; SharedPreferences.Editor editor = notificationsPreferences.edit(); @@ -13329,9 +13428,7 @@ public void markMentionsAsRead(long dialogId, long topicId) { req.top_msg_id = (int) topicId; req.flags |= 1; } - getConnectionsManager().sendRequest(req, (response, error) -> { - - }); + getConnectionsManager().sendRequest(req, null); } public void markDialogAsRead(long dialogId, int maxPositiveId, int maxNegativeId, int maxDate, boolean popup, long threadId, int countDiff, boolean readNow, int scheduledCount) { @@ -13954,8 +14051,8 @@ public void loadUsersPremiumLocked( } ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { ArrayList lockedUserIds = new ArrayList<>(); - if (res instanceof TLRPC.Vector) { - TLRPC.Vector vector = (TLRPC.Vector) res; + if (res instanceof Vector) { + Vector vector = (Vector) res; for (int i = 0; i < vector.objects.size(); ++i) { if (i < users.size() && vector.objects.get(i) instanceof TLRPC.TL_boolTrue) { lockedUserIds.add(users.get(i).id); @@ -14466,7 +14563,7 @@ public void changeChatAvatar(long chatId, TLRPC.TL_inputChatPhoto oldPhoto, TLRP public void unregistedPush() { if (getUserConfig().registeredForPush && SharedConfig.pushString.length() == 0) { - TLRPC.TL_account_unregisterDevice req = new TLRPC.TL_account_unregisterDevice(); + TL_account.unregisterDevice req = new TL_account.unregisterDevice(); req.token = SharedConfig.pushString; req.token_type = SharedConfig.pushType; for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) { @@ -14547,7 +14644,7 @@ public void registerForPush(@PushListenerController.PushType int pushType, Strin Utilities.random.nextBytes(SharedConfig.pushAuthKey); SharedConfig.saveConfig(); } - TLRPC.TL_account_registerDevice req = new TLRPC.TL_account_registerDevice(); + TL_account.registerDevice req = new TL_account.registerDevice(); req.token_type = pushType; req.token = regid; req.no_muted = false; @@ -15514,8 +15611,8 @@ public void loadUnreadDialogs() { loadingUnreadDialogs = true; TLRPC.TL_messages_getDialogUnreadMarks req = new TLRPC.TL_messages_getDialogUnreadMarks(); getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { - if (response != null) { - TLRPC.Vector vector = (TLRPC.Vector) response; + if (response instanceof Vector) { + final Vector vector = (Vector) response; for (int a = 0, size = vector.objects.size(); a < size; a++) { TLRPC.DialogPeer peer = (TLRPC.DialogPeer) vector.objects.get(a); if (peer instanceof TLRPC.TL_dialogPeer) { @@ -16175,6 +16272,7 @@ public static long getUpdateChannelId(TLRPC.Update update) { } } + // must be run from Utilities.stageQueue public void processUpdates(final TLRPC.Updates updates, boolean fromQueue) { ArrayList needGetChannelsDiff = null; boolean needGetDiff = false; @@ -16677,9 +16775,7 @@ public void processUpdates(final TLRPC.Updates updates, boolean fromQueue) { if (needReceivedQueue) { TLRPC.TL_messages_receivedQueue req = new TLRPC.TL_messages_receivedQueue(); req.max_qts = getMessagesStorage().getLastQtsValue(); - getConnectionsManager().sendRequest(req, (response, error) -> { - - }); + getConnectionsManager().sendRequest(req, null); } if (updateStatus) { AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, UPDATE_MASK_STATUS)); @@ -18513,13 +18609,13 @@ public boolean processUpdateArray(ArrayList updates, ArrayList updates, ArrayList updates, ArrayList updates, ArrayList reportedMessageDelivery = new HashSet<>(); + private final HashSet> pendingReportMessageDelivery = new HashSet<>(); + private final Runnable sendReportMessageDeliver = () -> { + final LongSparseArray, AtomicBoolean>> arr = new LongSparseArray<>(); + for (Pair id : pendingReportMessageDelivery) { + Pair, AtomicBoolean> darr = arr.get(id.first.did); + if (darr == null) { + arr.put(id.first.did, darr = new Pair<>(new HashSet<>(), id.second)); + } + if (!id.second.get()) { + darr.second.set(false); + } + darr.first.add(id.first.mid); + } + pendingReportMessageDelivery.clear(); + for (int i = 0; i < arr.size(); ++i) { + final Pair, AtomicBoolean> p = arr.valueAt(i); + final long did = arr.keyAt(i); + final HashSet mids = p.first; + final boolean push = p.second.get(); + + TLRPC.TL_reportMessagesDelivery req = new TLRPC.TL_reportMessagesDelivery(); + req.peer = getInputPeer(did); + req.id.addAll(mids); + req.push = push; + getConnectionsManager().sendRequest(req, null); + } + }; + + public void reportMessageDelivery(long dialogId, int messageId, boolean push) { + final StarsController.MessageId key = StarsController.MessageId.from(dialogId, messageId); + if (reportedMessageDelivery.contains(key)) return; + reportedMessageDelivery.add(key); + pendingReportMessageDelivery.add(new Pair<>(key, new AtomicBoolean(push))); + + AndroidUtilities.cancelRunOnUIThread(this.sendReportMessageDeliver); + AndroidUtilities.runOnUIThread(this.sendReportMessageDeliver); + } + } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java index 1a7842e56e..99b8eae7ee 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java @@ -36,8 +36,10 @@ import org.telegram.messenger.support.LongSparseIntArray; import org.telegram.tgnet.NativeByteBuffer; import org.telegram.tgnet.RequestDelegate; +import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import org.telegram.tgnet.tl.TL_bots; import org.telegram.tgnet.tl.TL_stories; import org.telegram.ui.ActionBar.Theme; @@ -71,8 +73,8 @@ public class MessagesStorage extends BaseController { private File cacheFile; private File walCacheFile; private File shmCacheFile; - private AtomicLong lastTaskId = new AtomicLong(System.currentTimeMillis()); - private SparseArray> tasks = new SparseArray<>(); + private final AtomicLong lastTaskId = new AtomicLong(System.currentTimeMillis()); + private final SparseArray> tasks = new SparseArray<>(); private int lastDateValue = 0; private int lastPtsValue = 0; @@ -87,16 +89,16 @@ public class MessagesStorage extends BaseController { private int lastSavedDate = 0; private int lastSavedQts = 0; - private ArrayList dialogFilters = new ArrayList<>(); - private SparseArray dialogFiltersMap = new SparseArray<>(); - private LongSparseArray unknownDialogsIds = new LongSparseArray<>(); + private final ArrayList dialogFilters = new ArrayList<>(); + private final SparseArray dialogFiltersMap = new SparseArray<>(); + private final LongSparseArray unknownDialogsIds = new LongSparseArray<>(); private int mainUnreadCount; private int archiveUnreadCount; private volatile int pendingMainUnreadCount; private volatile int pendingArchiveUnreadCount; private boolean databaseCreated; - private CountDownLatch openSync = new CountDownLatch(1); + private final CountDownLatch openSync = new CountDownLatch(1); private static volatile MessagesStorage[] Instance = new MessagesStorage[UserConfig.MAX_ACCOUNT_COUNT]; private static final Object[] lockObjects = new Object[UserConfig.MAX_ACCOUNT_COUNT]; @@ -106,10 +108,10 @@ public class MessagesStorage extends BaseController { } } - public final static int LAST_DB_VERSION = 159; + public final static int LAST_DB_VERSION = 162; private boolean databaseMigrationInProgress; public boolean showClearDatabaseAlert; - private LongSparseIntArray dialogIsForum = new LongSparseIntArray(); + private final LongSparseIntArray dialogIsForum = new LongSparseIntArray(); public static MessagesStorage getInstance(int num) { MessagesStorage localInstance = Instance[num]; @@ -560,7 +562,7 @@ public static void createTables(SQLiteDatabase database) throws SQLiteException database.executeFast("CREATE INDEX IF NOT EXISTS folder_id_idx_dialogs ON dialogs(folder_id);").stepThis().dispose(); database.executeFast("CREATE INDEX IF NOT EXISTS flags_idx_dialogs ON dialogs(flags);").stepThis().dispose(); - database.executeFast("CREATE TABLE dialog_filter(id INTEGER PRIMARY KEY, ord INTEGER, unread_count INTEGER, flags INTEGER, title TEXT, color INTEGER DEFAULT -1)").stepThis().dispose(); + database.executeFast("CREATE TABLE dialog_filter(id INTEGER PRIMARY KEY, ord INTEGER, unread_count INTEGER, flags INTEGER, title TEXT, color INTEGER DEFAULT -1, entities BLOB, noanimate INTEGER)").stepThis().dispose(); database.executeFast("CREATE TABLE dialog_filter_ep(id INTEGER, peer INTEGER, PRIMARY KEY (id, peer))").stepThis().dispose(); database.executeFast("CREATE TABLE dialog_filter_pin_v2(id INTEGER, peer INTEGER, pin INTEGER, PRIMARY KEY (id, peer))").stepThis().dispose(); @@ -725,7 +727,7 @@ public static void createTables(SQLiteDatabase database) throws SQLiteException database.executeFast("CREATE TABLE business_links(data BLOB, order_value INTEGER);").stepThis().dispose(); database.executeFast("CREATE TABLE fact_checks(hash INTEGER PRIMARY KEY, data BLOB, expires INTEGER);").stepThis().dispose(); - database.executeFast("CREATE TABLE popular_bots(uid INTEGER PRIMARY KEY, time INTEGER, offset TEXT);").stepThis().dispose(); + database.executeFast("CREATE TABLE popular_bots(uid INTEGER PRIMARY KEY, time INTEGER, offset TEXT, pos INTEGER);").stepThis().dispose(); database.executeFast("CREATE TABLE star_gifts2(id INTEGER PRIMARY KEY, data BLOB, hash INTEGER, time INTEGER, pos INTEGER);").stepThis().dispose(); @@ -2436,7 +2438,7 @@ private void loadDialogFilters() { usersToLoad.add(getUserConfig().getClientUserId()); - filtersCursor = database.queryFinalized("SELECT id, ord, unread_count, flags, title, color FROM dialog_filter WHERE 1"); + filtersCursor = database.queryFinalized("SELECT id, ord, unread_count, flags, title, color, entities, noanimate FROM dialog_filter WHERE 1"); boolean updateCounters = false; boolean hasDefaultFilter = false; @@ -2448,6 +2450,13 @@ private void loadDialogFilters() { filter.flags = filtersCursor.intValue(3); filter.name = filtersCursor.stringValue(4); filter.color = filtersCursor.intValue(5); + filter.entities = new ArrayList<>(); + NativeByteBuffer buff = filtersCursor.byteBufferValue(6); + if (buff != null) { + filter.entities = Vector.deserialize(buff, TLRPC.MessageEntity::TLdeserialize, false); + buff.reuse(); + } + filter.title_noanimate = filtersCursor.intValue(7) == 1; dialogFilters.add(filter); dialogFiltersMap.put(filter.id, filter); filtersById.put(filter.id, filter); @@ -2517,15 +2526,21 @@ private void loadDialogFilters() { dialogFiltersMap.put(filter.id, filter); filtersById.put(filter.id, filter); - state = database.executeFast("REPLACE INTO dialog_filter VALUES(?, ?, ?, ?, ?, ?)"); + state = database.executeFast("REPLACE INTO dialog_filter VALUES(?, ?, ?, ?, ?, ?, ?, ?)"); state.bindInteger(1, filter.id); state.bindInteger(2, filter.order); state.bindInteger(3, filter.unreadCount); state.bindInteger(4, filter.flags); state.bindString(5, filter.name); state.bindInteger(6, filter.color); + final Vector entitiesVector = new Vector<>(TLRPC.MessageEntity::TLdeserialize); + final NativeByteBuffer entitiesBuffer = new NativeByteBuffer(entitiesVector.getObjectSize()); + entitiesVector.serializeToStream(entitiesBuffer); + state.bindByteBuffer(7, entitiesBuffer); + state.bindInteger(8, filter.title_noanimate ? 1 : 0); state.stepThis().dispose(); state = null; + entitiesBuffer.reuse(); } Collections.sort(dialogFilters, (o1, o2) -> { @@ -2996,15 +3011,22 @@ private void saveDialogFilterInternal(MessagesController.DialogFilter filter, bo dialogFiltersMap.put(filter.id, filter); } - state = database.executeFast("REPLACE INTO dialog_filter VALUES(?, ?, ?, ?, ?, ?)"); + state = database.executeFast("REPLACE INTO dialog_filter VALUES(?, ?, ?, ?, ?, ?, ?, ?)"); state.bindInteger(1, filter.id); state.bindInteger(2, filter.order); state.bindInteger(3, filter.unreadCount); state.bindInteger(4, filter.flags); state.bindString(5, filter.id == 0 ? "ALL_CHATS" : filter.name); state.bindInteger(6, filter.color); + final Vector entitiesVector = new Vector<>(TLRPC.MessageEntity::TLdeserialize); + entitiesVector.objects.addAll(filter.entities); + final NativeByteBuffer entitiesBuffer = new NativeByteBuffer(entitiesVector.getObjectSize()); + entitiesVector.serializeToStream(entitiesBuffer); + state.bindByteBuffer(7, entitiesBuffer); + state.bindInteger(8, filter.title_noanimate ? 1 : 0); state.step(); state.dispose(); + entitiesBuffer.reuse(); state = null; if (peers) { database.executeFast("DELETE FROM dialog_filter_ep WHERE id = " + filter.id).stepThis().dispose(); @@ -3138,9 +3160,14 @@ public void checkLoadedRemoteFilters(ArrayList vector, Runna filtersToDelete.remove(newFilter.id); boolean changed = false; boolean unreadChanged = false; - if (!TextUtils.equals(filter.name, newFilter.title)) { + if (!TextUtils.equals(filter.name, newFilter.title.text) || !MediaDataController.entitiesEqual(filter.entities, newFilter.title.entities)) { + changed = true; + filter.name = newFilter.title.text; + filter.entities = newFilter.title.entities; + } + if (filter.title_noanimate != newFilter.title_noanimate) { changed = true; - filter.name = newFilter.title; + filter.title_noanimate= newFilter.title_noanimate; } final int color = (newFilter.flags & 134217728) != 0 ? newFilter.color : -1; if (filter.color != color) { @@ -3280,7 +3307,9 @@ public void checkLoadedRemoteFilters(ArrayList vector, Runna filter = new MessagesController.DialogFilter(); filter.id = newFilter.id; filter.flags = newFlags; - filter.name = newFilter.title; + filter.name = newFilter.title.text; + filter.entities = newFilter.title.entities; + filter.title_noanimate = newFilter.title_noanimate; filter.color = (newFilter.flags & 134217728) != 0 ? newFilter.color : -1; filter.pendingUnreadCount = -1; for (int c = 0; c < 2; c++) { @@ -11097,6 +11126,7 @@ private void putMessagesInternal(ArrayList messages, boolean with SQLitePreparedStatement state_topics_update = null; SQLitePreparedStatement state_media_topics = null; SQLiteCursor cursor = null; + ArrayList> reportMessagesDelivery = null; try { if (messages != null && !messages.isEmpty() && MessageObject.isQuickReply(messages.get(0))) { mode = ChatActivity.MODE_QUICK_REPLIES; @@ -11104,6 +11134,27 @@ private void putMessagesInternal(ArrayList messages, boolean with threadMessageId = MessageObject.getQuickReplyId(currentAccount, messages.get(0)); } } + if (messages != null && mode == ChatActivity.MODE_DEFAULT) { + int currentTime = -1; + for (int i = 0; i < messages.size(); ++i) { + TLRPC.Message msg = messages.get(i); + if (msg != null && msg.report_delivery_until_date != 0) { + if (currentTime < 0) { + currentTime = getConnectionsManager().getCurrentTime(); + } + if (currentTime <= msg.report_delivery_until_date) { + final long did = MessageObject.getDialogId(msg); + final int mid = msg.id; + if (reportMessagesDelivery == null) { + reportMessagesDelivery = new ArrayList<>(); + } + reportMessagesDelivery.add(new Pair<>(did, mid)); + } + msg.flags2 &=~ 32; + msg.report_delivery_until_date = 0; + } + } + } final boolean scheduled = mode == ChatActivity.MODE_SCHEDULED; final boolean saved = mode == ChatActivity.MODE_SAVED; final boolean quickReplies = mode == ChatActivity.MODE_QUICK_REPLIES; @@ -12404,6 +12455,14 @@ private void putMessagesInternal(ArrayList messages, boolean with if (cursor != null) { cursor = null; } + if (reportMessagesDelivery != null) { + final ArrayList> finalReportMessagesDelivery = reportMessagesDelivery; + AndroidUtilities.runOnUIThread(() -> { + for (Pair p : finalReportMessagesDelivery) { + getMessagesController().reportMessageDelivery(p.first, p.second, false); + } + }); + } } } @@ -16485,6 +16544,37 @@ public void getDialogMaxMessageId(long dialog_id, IntCallback callback) { }); } + public int getDialogReadMaxSync(boolean outbox, long dialog_id) { + int max = 0; + SQLiteCursor cursor = null; + try { + if (outbox) { + cursor = database.queryFinalized("SELECT outbox_max FROM dialogs WHERE did = " + dialog_id); + if (cursor.next()) { + max = cursor.intValue(0); + } + } else { + cursor = database.queryFinalized("SELECT last_mid, inbox_max FROM dialogs WHERE did = " + dialog_id); + if (cursor.next()) { + int lastMid = cursor.intValue(0); + int inboxMax = cursor.intValue(1); + if (inboxMax > lastMid) { + max = 0; + } else { + max = inboxMax; + } + } + } + } catch (Exception e) { + checkSQLException(e); + } finally { + if (cursor != null) { + cursor.dispose(); + } + } + return max; + } + public int getDialogReadMax(boolean outbox, long dialog_id) { CountDownLatch countDownLatch = new CountDownLatch(1); Integer[] max = new Integer[]{0}; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java index f3a7cd8b30..15ce1f0faa 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java @@ -67,13 +67,13 @@ import org.telegram.messenger.support.LongSparseIntArray; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.BubbleActivity; import org.telegram.ui.Components.AvatarDrawable; import org.telegram.ui.Components.spoilers.SpoilerEffect; import org.telegram.ui.LaunchActivity; import org.telegram.ui.PopupNotificationActivity; -import org.telegram.ui.Stars.StarsIntroActivity; import org.telegram.ui.Stories.recorder.StoryEntry; import java.io.File; @@ -4086,8 +4086,10 @@ private void showOrUpdateNotification(boolean notifyAboutLast) { mBuilder.setContentText(message); if (!allowSummary) { detailText = message; + mBuilder.setStyle(new NotificationCompat.BigTextStyle().setBigContentTitle(name).setSummaryText(message)); + } else { + mBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(message)); } - mBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(message)); } else { mBuilder.setContentText(detailText); NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle(); @@ -5762,7 +5764,7 @@ public void updateServerNotificationsSettings(long dialogId, long topicId, boole return; } SharedPreferences preferences = getAccountInstance().getNotificationsSettings(); - TLRPC.TL_account_updateNotifySettings req = new TLRPC.TL_account_updateNotifySettings(); + TL_account.updateNotifySettings req = new TL_account.updateNotifySettings(); req.settings = new TLRPC.TL_inputPeerNotifySettings(); final String key = NotificationsController.getSharedPrefKey(dialogId, topicId); @@ -5832,22 +5834,22 @@ public void updateServerNotificationsSettings(long dialogId, long topicId, boole public void updateServerNotificationsSettings(int type) { SharedPreferences preferences = getAccountInstance().getNotificationsSettings(); if (type == TYPE_REACTIONS_MESSAGES || type == TYPE_REACTIONS_STORIES) { - TLRPC.TL_account_setReactionsNotifySettings req = new TLRPC.TL_account_setReactionsNotifySettings(); - req.settings = new TLRPC.TL_reactionsNotifySettings(); + TL_account.setReactionsNotifySettings req = new TL_account.setReactionsNotifySettings(); + req.settings = new TL_account.TL_reactionsNotifySettings(); if (preferences.getBoolean("EnableReactionsMessages", true)) { req.settings.flags |= 1; if (preferences.getBoolean("EnableReactionsMessagesContacts", false)) { - req.settings.messages_notify_from = new TLRPC.TL_reactionNotificationsFromContacts(); + req.settings.messages_notify_from = new TL_account.TL_reactionNotificationsFromContacts(); } else { - req.settings.messages_notify_from = new TLRPC.TL_reactionNotificationsFromAll(); + req.settings.messages_notify_from = new TL_account.TL_reactionNotificationsFromAll(); } } if (preferences.getBoolean("EnableReactionsStories", true)) { req.settings.flags |= 2; if (preferences.getBoolean("EnableReactionsStoriesContacts", false)) { - req.settings.stories_notify_from = new TLRPC.TL_reactionNotificationsFromContacts(); + req.settings.stories_notify_from = new TL_account.TL_reactionNotificationsFromContacts(); } else { - req.settings.stories_notify_from = new TLRPC.TL_reactionNotificationsFromAll(); + req.settings.stories_notify_from = new TL_account.TL_reactionNotificationsFromAll(); } } req.settings.show_previews = preferences.getBoolean("EnableReactionsPreview", true); @@ -5856,7 +5858,7 @@ public void updateServerNotificationsSettings(int type) { return; } - TLRPC.TL_account_updateNotifySettings req = new TLRPC.TL_account_updateNotifySettings(); + TL_account.updateNotifySettings req = new TL_account.updateNotifySettings(); req.settings = new TLRPC.TL_inputPeerNotifySettings(); req.settings.flags = 5; if (type == TYPE_GROUP) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/PushListenerController.java b/TMessagesProj/src/main/java/org/telegram/messenger/PushListenerController.java index f7682a6bfc..e8e49ad3c7 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/PushListenerController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/PushListenerController.java @@ -1,5 +1,7 @@ package org.telegram.messenger; +import static org.telegram.messenger.LocaleController.getString; + import android.os.SystemClock; import android.text.TextUtils; import android.util.Base64; @@ -469,7 +471,7 @@ public static void processRemoteMessage(@PushType int pushType, String data, lon } else { switch (loc_key) { case "STORY_NOTEXT": { - messageText = LocaleController.getString("StoryNotificationSingle"); + messageText = getString(R.string.StoryNotificationSingle); message1 = null; msg_id = story_id; break; @@ -482,17 +484,17 @@ public static void processRemoteMessage(@PushType int pushType, String data, lon } case "MESSAGE_SAME_WALLPAPER": { messageText = LocaleController.formatString("ActionSetSameWallpaperForThisChat", R.string.ActionSetSameWallpaperForThisChat, args[0]); - message1 = LocaleController.getString(R.string.WallpaperSameNotification); + message1 = getString(R.string.WallpaperSameNotification); break; } case "MESSAGE_WALLPAPER": { messageText = LocaleController.formatString("ActionSetWallpaperForThisChat", R.string.ActionSetWallpaperForThisChat, args[0]); - message1 = LocaleController.getString(R.string.WallpaperNotification); + message1 = getString(R.string.WallpaperNotification); break; } case "MESSAGE_RECURRING_PAY": { messageText = LocaleController.formatString("NotificationMessageRecurringPay", R.string.NotificationMessageRecurringPay, args[0], args[1]); - message1 = LocaleController.getString(R.string.PaymentInvoice); + message1 = getString(R.string.PaymentInvoice); break; } case "MESSAGE_TEXT": @@ -507,6 +509,18 @@ public static void processRemoteMessage(@PushType int pushType, String data, lon message1 = LocaleController.formatPluralStringComma("Gift2Notification", Integer.parseInt(args[1])); break; } + case "MESSAGE_UNIQUE_STARGIFT": { + userName = args[0]; + messageText = LocaleController.formatString(R.string.NotificationMessageUniqueStarGift, args[0]); + message1 = getString(R.string.Gift2UniqueNotification); + break; + } + case "MESSAGE_STARGIFT_UPGRADE": { + userName = args[0]; + messageText = LocaleController.formatString(R.string.NotificationMessageUniqueStarGiftUpgrade, args[0]); + message1 = getString(R.string.Gift2UniqueUpgradeNotification); + break; + } case "MESSAGE_PAID_MEDIA": { int stars = Integer.parseInt(args[1]); messageText = LocaleController.formatPluralString("NotificationMessagePaidMedia", stars, args[0]); @@ -539,101 +553,101 @@ public static void processRemoteMessage(@PushType int pushType, String data, lon } case "MESSAGE_NOTEXT": { messageText = LocaleController.formatString("NotificationMessageNoText", R.string.NotificationMessageNoText, args[0]); - message1 = LocaleController.getString(R.string.Message); + message1 = getString(R.string.Message); break; } case "MESSAGE_STORY": { messageText = LocaleController.formatString("NotificationStory", R.string.NotificationStory, args[0]); - message1 = LocaleController.getString(R.string.Story); + message1 = getString(R.string.Story); break; } case "MESSAGE_STORY_MENTION": { - messageText = LocaleController.getString(R.string.StoryNotificationMention); + messageText = getString(R.string.StoryNotificationMention); message1 = null; break; } case "MESSAGE_PHOTO": { messageText = LocaleController.formatString("NotificationMessagePhoto", R.string.NotificationMessagePhoto, args[0]); - message1 = LocaleController.getString(R.string.AttachPhoto); + message1 = getString(R.string.AttachPhoto); break; } case "MESSAGE_PHOTO_SECRET": { messageText = LocaleController.formatString("NotificationMessageSDPhoto", R.string.NotificationMessageSDPhoto, args[0]); - message1 = LocaleController.getString(R.string.AttachDestructingPhoto); + message1 = getString(R.string.AttachDestructingPhoto); break; } case "MESSAGE_VIDEO": { messageText = LocaleController.formatString("NotificationMessageVideo", R.string.NotificationMessageVideo, args[0]); - message1 = LocaleController.getString(R.string.AttachVideo); + message1 = getString(R.string.AttachVideo); break; } case "MESSAGE_VIDEO_SECRET": { messageText = LocaleController.formatString("NotificationMessageSDVideo", R.string.NotificationMessageSDVideo, args[0]); - message1 = LocaleController.getString(R.string.AttachDestructingVideo); + message1 = getString(R.string.AttachDestructingVideo); break; } case "MESSAGE_SCREENSHOT": { - messageText = LocaleController.getString(R.string.ActionTakeScreenshoot).replace("un1", args[0]); + messageText = getString(R.string.ActionTakeScreenshoot).replace("un1", args[0]); break; } case "MESSAGE_ROUND": { messageText = LocaleController.formatString("NotificationMessageRound", R.string.NotificationMessageRound, args[0]); - message1 = LocaleController.getString(R.string.AttachRound); + message1 = getString(R.string.AttachRound); break; } case "MESSAGE_DOC": { messageText = LocaleController.formatString("NotificationMessageDocument", R.string.NotificationMessageDocument, args[0]); - message1 = LocaleController.getString(R.string.AttachDocument); + message1 = getString(R.string.AttachDocument); break; } case "MESSAGE_STICKER": { if (args.length > 1 && !TextUtils.isEmpty(args[1])) { messageText = LocaleController.formatString("NotificationMessageStickerEmoji", R.string.NotificationMessageStickerEmoji, args[0], args[1]); - message1 = args[1] + " " + LocaleController.getString(R.string.AttachSticker); + message1 = args[1] + " " + getString(R.string.AttachSticker); } else { messageText = LocaleController.formatString("NotificationMessageSticker", R.string.NotificationMessageSticker, args[0]); - message1 = LocaleController.getString(R.string.AttachSticker); + message1 = getString(R.string.AttachSticker); } break; } case "MESSAGE_AUDIO": { - messageText = LocaleController.formatString("NotificationMessageAudio", R.string.NotificationMessageAudio, args[0]); - message1 = LocaleController.getString(R.string.AttachAudio); + messageText = LocaleController.formatString(R.string.NotificationMessageAudio, args[0]); + message1 = getString(R.string.AttachAudio); break; } case "MESSAGE_CONTACT": { - messageText = LocaleController.formatString("NotificationMessageContact2", R.string.NotificationMessageContact2, args[0], args[1]); - message1 = LocaleController.getString(R.string.AttachContact); + messageText = LocaleController.formatString(R.string.NotificationMessageContact2, args[0], args[1]); + message1 = getString(R.string.AttachContact); break; } case "MESSAGE_QUIZ": { - messageText = LocaleController.formatString("NotificationMessageQuiz2", R.string.NotificationMessageQuiz2, args[0], args[1]); - message1 = LocaleController.getString(R.string.QuizPoll); + messageText = LocaleController.formatString(R.string.NotificationMessageQuiz2, args[0], args[1]); + message1 = getString(R.string.QuizPoll); break; } case "MESSAGE_POLL": { - messageText = LocaleController.formatString("NotificationMessagePoll2", R.string.NotificationMessagePoll2, args[0], args[1]); - message1 = LocaleController.getString(R.string.Poll); + messageText = LocaleController.formatString(R.string.NotificationMessagePoll2, args[0], args[1]); + message1 = getString(R.string.Poll); break; } case "MESSAGE_GEO": { messageText = LocaleController.formatString("NotificationMessageMap", R.string.NotificationMessageMap, args[0]); - message1 = LocaleController.getString(R.string.AttachLocation); + message1 = getString(R.string.AttachLocation); break; } case "MESSAGE_GEOLIVE": { messageText = LocaleController.formatString("NotificationMessageLiveLocation", R.string.NotificationMessageLiveLocation, args[0]); - message1 = LocaleController.getString(R.string.AttachLiveLocation); + message1 = getString(R.string.AttachLiveLocation); break; } case "MESSAGE_GIF": { messageText = LocaleController.formatString("NotificationMessageGif", R.string.NotificationMessageGif, args[0]); - message1 = LocaleController.getString(R.string.AttachGif); + message1 = getString(R.string.AttachGif); break; } case "MESSAGE_GAME": { messageText = LocaleController.formatString("NotificationMessageGame", R.string.NotificationMessageGame, args[0], args[1]); - message1 = LocaleController.getString(R.string.AttachGame); + message1 = getString(R.string.AttachGame); break; } case "MESSAGE_GAME_SCORE": @@ -643,7 +657,7 @@ public static void processRemoteMessage(@PushType int pushType, String data, lon } case "MESSAGE_INVOICE": { messageText = LocaleController.formatString("NotificationMessageInvoice", R.string.NotificationMessageInvoice, args[0], args[1]); - message1 = LocaleController.getString(R.string.PaymentInvoice); + message1 = getString(R.string.PaymentInvoice); break; } case "MESSAGE_FWDS": { @@ -697,7 +711,7 @@ public static void processRemoteMessage(@PushType int pushType, String data, lon } case "CHANNEL_MESSAGE_GIVEAWAY": { messageText = LocaleController.formatString("NotificationMessageChannelGiveaway", R.string.NotificationMessageChannelGiveaway, args[0], args[1], args[2]); - message1 = LocaleController.getString(R.string.BoostingGiveaway); + message1 = getString(R.string.BoostingGiveaway); break; } case "CHANNEL_MESSAGE_GIVEAWAY_STARS": { @@ -706,87 +720,87 @@ public static void processRemoteMessage(@PushType int pushType, String data, lon winners = Integer.parseInt(args[1]); } catch (Exception ignore) {} messageText = LocaleController.formatString(R.string.NotificationMessageChannelStarsGiveaway2, args[0], LocaleController.formatPluralString("AmongWinners", winners), args[2]); - message1 = LocaleController.getString(R.string.BoostingGiveaway); + message1 = getString(R.string.BoostingGiveaway); break; } case "CHANNEL_MESSAGE_NOTEXT": { messageText = LocaleController.formatString("ChannelMessageNoText", R.string.ChannelMessageNoText, args[0]); - message1 = LocaleController.getString(R.string.Message); + message1 = getString(R.string.Message); break; } case "CHANNEL_MESSAGE_STORY": { messageText = LocaleController.formatString("NotificationChannelStory", R.string.NotificationChannelStory, args[0]); - message1 = LocaleController.getString(R.string.Story); + message1 = getString(R.string.Story); break; } case "CHANNEL_MESSAGE_PHOTO": { messageText = LocaleController.formatString("ChannelMessagePhoto", R.string.ChannelMessagePhoto, args[0]); - message1 = LocaleController.getString(R.string.AttachPhoto); + message1 = getString(R.string.AttachPhoto); break; } case "CHANNEL_MESSAGE_VIDEO": { messageText = LocaleController.formatString("ChannelMessageVideo", R.string.ChannelMessageVideo, args[0]); - message1 = LocaleController.getString(R.string.AttachVideo); + message1 = getString(R.string.AttachVideo); break; } case "CHANNEL_MESSAGE_ROUND": { messageText = LocaleController.formatString("ChannelMessageRound", R.string.ChannelMessageRound, args[0]); - message1 = LocaleController.getString(R.string.AttachRound); + message1 = getString(R.string.AttachRound); break; } case "CHANNEL_MESSAGE_DOC": { messageText = LocaleController.formatString("ChannelMessageDocument", R.string.ChannelMessageDocument, args[0]); - message1 = LocaleController.getString(R.string.AttachDocument); + message1 = getString(R.string.AttachDocument); break; } case "CHANNEL_MESSAGE_STICKER": { if (args.length > 1 && !TextUtils.isEmpty(args[1])) { messageText = LocaleController.formatString("ChannelMessageStickerEmoji", R.string.ChannelMessageStickerEmoji, args[0], args[1]); - message1 = args[1] + " " + LocaleController.getString(R.string.AttachSticker); + message1 = args[1] + " " + getString(R.string.AttachSticker); } else { messageText = LocaleController.formatString("ChannelMessageSticker", R.string.ChannelMessageSticker, args[0]); - message1 = LocaleController.getString(R.string.AttachSticker); + message1 = getString(R.string.AttachSticker); } break; } case "CHANNEL_MESSAGE_AUDIO": { messageText = LocaleController.formatString("ChannelMessageAudio", R.string.ChannelMessageAudio, args[0]); - message1 = LocaleController.getString(R.string.AttachAudio); + message1 = getString(R.string.AttachAudio); break; } case "CHANNEL_MESSAGE_CONTACT": { messageText = LocaleController.formatString("ChannelMessageContact2", R.string.ChannelMessageContact2, args[0], args[1]); - message1 = LocaleController.getString(R.string.AttachContact); + message1 = getString(R.string.AttachContact); break; } case "CHANNEL_MESSAGE_QUIZ": { messageText = LocaleController.formatString("ChannelMessageQuiz2", R.string.ChannelMessageQuiz2, args[0], args[1]); - message1 = LocaleController.getString(R.string.QuizPoll); + message1 = getString(R.string.QuizPoll); break; } case "CHANNEL_MESSAGE_POLL": { messageText = LocaleController.formatString("ChannelMessagePoll2", R.string.ChannelMessagePoll2, args[0], args[1]); - message1 = LocaleController.getString(R.string.Poll); + message1 = getString(R.string.Poll); break; } case "CHANNEL_MESSAGE_GEO": { messageText = LocaleController.formatString("ChannelMessageMap", R.string.ChannelMessageMap, args[0]); - message1 = LocaleController.getString(R.string.AttachLocation); + message1 = getString(R.string.AttachLocation); break; } case "CHANNEL_MESSAGE_GEOLIVE": { messageText = LocaleController.formatString("ChannelMessageLiveLocation", R.string.ChannelMessageLiveLocation, args[0]); - message1 = LocaleController.getString(R.string.AttachLiveLocation); + message1 = getString(R.string.AttachLiveLocation); break; } case "CHANNEL_MESSAGE_GIF": { messageText = LocaleController.formatString("ChannelMessageGIF", R.string.ChannelMessageGIF, args[0]); - message1 = LocaleController.getString(R.string.AttachGif); + message1 = getString(R.string.AttachGif); break; } case "CHANNEL_MESSAGE_GAME": { messageText = LocaleController.formatString("NotificationMessageGame", R.string.NotificationMessageGame, args[0]); - message1 = LocaleController.getString(R.string.AttachGame); + message1 = getString(R.string.AttachGame); break; } case "CHANNEL_MESSAGE_FWDS": { @@ -821,7 +835,7 @@ public static void processRemoteMessage(@PushType int pushType, String data, lon } case "CHAT_MESSAGE_GIVEAWAY": { messageText = LocaleController.formatString("NotificationMessageChatGiveaway", R.string.NotificationMessageChatGiveaway, args[0], args[1], args[2], args[3]); - message1 = LocaleController.getString(R.string.BoostingGiveaway); + message1 = getString(R.string.BoostingGiveaway); break; } case "CHAT_MESSAGE_GIVEAWAY_STARS": { @@ -830,7 +844,7 @@ public static void processRemoteMessage(@PushType int pushType, String data, lon winners = Integer.parseInt(args[2]); } catch (Exception ignore) {} messageText = LocaleController.formatString(R.string.NotificationMessageChatStarsGiveaway2, args[0], args[1], LocaleController.formatPluralString("AmongWinners", winners), args[3]); - message1 = LocaleController.getString(R.string.BoostingGiveaway); + message1 = getString(R.string.BoostingGiveaway); break; } case "CHAT_MESSAGE_TEXT": { @@ -840,82 +854,82 @@ public static void processRemoteMessage(@PushType int pushType, String data, lon } case "CHAT_MESSAGE_NOTEXT": { messageText = LocaleController.formatString("NotificationMessageGroupNoText", R.string.NotificationMessageGroupNoText, args[0], args[1]); - message1 = LocaleController.getString(R.string.Message); + message1 = getString(R.string.Message); break; } case "CHAT_MESSAGE_STORY": { messageText = LocaleController.formatString("NotificationChatStory", R.string.NotificationChatStory, args[0]); - message1 = LocaleController.getString(R.string.Story); + message1 = getString(R.string.Story); break; } case "CHAT_MESSAGE_PHOTO": { messageText = LocaleController.formatString("NotificationMessageGroupPhoto", R.string.NotificationMessageGroupPhoto, args[0], args[1]); - message1 = LocaleController.getString(R.string.AttachPhoto); + message1 = getString(R.string.AttachPhoto); break; } case "CHAT_MESSAGE_VIDEO": { messageText = LocaleController.formatString("NotificationMessageGroupVideo", R.string.NotificationMessageGroupVideo, args[0], args[1]); - message1 = LocaleController.getString(R.string.AttachVideo); + message1 = getString(R.string.AttachVideo); break; } case "CHAT_MESSAGE_ROUND": { messageText = LocaleController.formatString("NotificationMessageGroupRound", R.string.NotificationMessageGroupRound, args[0], args[1]); - message1 = LocaleController.getString(R.string.AttachRound); + message1 = getString(R.string.AttachRound); break; } case "CHAT_MESSAGE_DOC": { messageText = LocaleController.formatString("NotificationMessageGroupDocument", R.string.NotificationMessageGroupDocument, args[0], args[1]); - message1 = LocaleController.getString(R.string.AttachDocument); + message1 = getString(R.string.AttachDocument); break; } case "CHAT_MESSAGE_STICKER": { if (args.length > 2 && !TextUtils.isEmpty(args[2])) { messageText = LocaleController.formatString("NotificationMessageGroupStickerEmoji", R.string.NotificationMessageGroupStickerEmoji, args[0], args[1], args[2]); - message1 = args[2] + " " + LocaleController.getString(R.string.AttachSticker); + message1 = args[2] + " " + getString(R.string.AttachSticker); } else { messageText = LocaleController.formatString("NotificationMessageGroupSticker", R.string.NotificationMessageGroupSticker, args[0], args[1]); - message1 = args[1] + " " + LocaleController.getString(R.string.AttachSticker); + message1 = args[1] + " " + getString(R.string.AttachSticker); } break; } case "CHAT_MESSAGE_AUDIO": { messageText = LocaleController.formatString("NotificationMessageGroupAudio", R.string.NotificationMessageGroupAudio, args[0], args[1]); - message1 = LocaleController.getString(R.string.AttachAudio); + message1 = getString(R.string.AttachAudio); break; } case "CHAT_MESSAGE_CONTACT": { messageText = LocaleController.formatString("NotificationMessageGroupContact2", R.string.NotificationMessageGroupContact2, args[0], args[1], args[2]); - message1 = LocaleController.getString(R.string.AttachContact); + message1 = getString(R.string.AttachContact); break; } case "CHAT_MESSAGE_QUIZ": { messageText = LocaleController.formatString("NotificationMessageGroupQuiz2", R.string.NotificationMessageGroupQuiz2, args[0], args[1], args[2]); - message1 = LocaleController.getString(R.string.PollQuiz); + message1 = getString(R.string.PollQuiz); break; } case "CHAT_MESSAGE_POLL": { messageText = LocaleController.formatString("NotificationMessageGroupPoll2", R.string.NotificationMessageGroupPoll2, args[0], args[1], args[2]); - message1 = LocaleController.getString(R.string.Poll); + message1 = getString(R.string.Poll); break; } case "CHAT_MESSAGE_GEO": { messageText = LocaleController.formatString("NotificationMessageGroupMap", R.string.NotificationMessageGroupMap, args[0], args[1]); - message1 = LocaleController.getString(R.string.AttachLocation); + message1 = getString(R.string.AttachLocation); break; } case "CHAT_MESSAGE_GEOLIVE": { messageText = LocaleController.formatString("NotificationMessageGroupLiveLocation", R.string.NotificationMessageGroupLiveLocation, args[0], args[1]); - message1 = LocaleController.getString(R.string.AttachLiveLocation); + message1 = getString(R.string.AttachLiveLocation); break; } case "CHAT_MESSAGE_GIF": { messageText = LocaleController.formatString("NotificationMessageGroupGif", R.string.NotificationMessageGroupGif, args[0], args[1]); - message1 = LocaleController.getString(R.string.AttachGif); + message1 = getString(R.string.AttachGif); break; } case "CHAT_MESSAGE_GAME": { messageText = LocaleController.formatString("NotificationMessageGroupGame", R.string.NotificationMessageGroupGame, args[0], args[1], args[2]); - message1 = LocaleController.getString(R.string.AttachGame); + message1 = getString(R.string.AttachGame); break; } case "CHAT_MESSAGE_GAME_SCORE": { @@ -924,7 +938,7 @@ public static void processRemoteMessage(@PushType int pushType, String data, lon } case "CHAT_MESSAGE_INVOICE": { messageText = LocaleController.formatString("NotificationMessageGroupInvoice", R.string.NotificationMessageGroupInvoice, args[0], args[1], args[2]); - message1 = LocaleController.getString(R.string.PaymentInvoice); + message1 = getString(R.string.PaymentInvoice); break; } case "CHAT_CREATED": @@ -1235,8 +1249,8 @@ public static void processRemoteMessage(@PushType int pushType, String data, lon break; } case "ENCRYPTED_MESSAGE": { - messageText = LocaleController.getString(R.string.YouHaveNewMessage); - name = LocaleController.getString(R.string.SecretChatName); + messageText = getString(R.string.YouHaveNewMessage); + name = getString(R.string.SecretChatName); localMessage = true; break; } @@ -1326,6 +1340,11 @@ public static void processRemoteMessage(@PushType int pushType, String data, lon arrayList.add(messageObject); canRelease = false; FileLog.d("PushListenerController push notification to NotificationsController of " + messageOwner.dialog_id); + if (!messageObject.isStoryReactionPush && !messageObject.isReactionPush && !messageObject.isStoryMentionPush && !messageObject.isStoryPush && !messageObject.isStoryPushHidden && !mention && !pinned && msg_id > 0) { + final long did = dialogId; + final int mid = msg_id; + AndroidUtilities.runOnUIThread(() -> MessagesController.getInstance(accountFinal).reportMessageDelivery(did, mid, true)); + } NotificationsController.getInstance(currentAccount).processNewMessages(arrayList, true, true, countDownLatch); } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/SecretChatHelper.java b/TMessagesProj/src/main/java/org/telegram/messenger/SecretChatHelper.java index cf0dec7d10..d2ffd4a9ff 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/SecretChatHelper.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/SecretChatHelper.java @@ -19,7 +19,9 @@ import org.telegram.messenger.support.LongSparseIntArray; import org.telegram.tgnet.AbstractSerializedData; import org.telegram.tgnet.ConnectionsManager; +import org.telegram.tgnet.InputSerializedData; import org.telegram.tgnet.NativeByteBuffer; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.TLClassStore; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; @@ -43,7 +45,7 @@ public static class TL_decryptedMessageHolder extends TLObject { public boolean new_key_used; public int decryptedWithVersion; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { stream.readInt64(exception); date = stream.readInt32(exception); layer = TLRPC.TL_decryptedMessageLayer.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -53,7 +55,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { new_key_used = stream.readBool(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(0); stream.writeInt32(date); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java index 5d7a559529..5c0a98ed7f 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java @@ -56,6 +56,7 @@ import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.tgnet.tl.TL_stories; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; @@ -87,8 +88,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.RandomAccessFile; -import java.nio.ByteBuffer; -import java.nio.channels.FileChannel; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -589,6 +588,7 @@ public static class SendingMediaInfo { public String path; public String caption; public String thumbPath; + public String coverPath; public String paintPath; public int ttl; public ArrayList entities; @@ -1861,10 +1861,10 @@ public void sendSticker(TLRPC.Document document, String query, long peer, Messag } public int sendMessage(ArrayList messages, final long peer, boolean forwardFromMyName, boolean hideCaption, boolean notify, int scheduleDate) { - return sendMessage(messages, peer, forwardFromMyName, hideCaption, notify, scheduleDate, null); + return sendMessage(messages, peer, forwardFromMyName, hideCaption, notify, scheduleDate, null, -1); } - public int sendMessage(ArrayList messages, final long peer, boolean forwardFromMyName, boolean hideCaption, boolean notify, int scheduleDate, MessageObject replyToTopMsg) { + public int sendMessage(ArrayList messages, final long peer, boolean forwardFromMyName, boolean hideCaption, boolean notify, int scheduleDate, MessageObject replyToTopMsg, int video_timestamp) { if (messages == null || messages.isEmpty()) { return 0; } @@ -2291,6 +2291,10 @@ public int sendMessage(ArrayList messages, final long peer, boole req.drop_author = forwardFromMyName; req.drop_media_captions = hideCaption; req.with_my_score = messages.size() == 1 && messages.get(0).messageOwner.with_my_score; + if (video_timestamp >= 0) { + req.flags |= 1048576; + req.video_timestamp = video_timestamp; + } final ArrayList newMsgObjArr = arr; final ArrayList newMsgArr = new ArrayList<>(objArr); @@ -3409,10 +3413,10 @@ public void sendCallback(final boolean cache, final MessageObject messageObject, } parentFragment.showDialog(builder.create()); } else if ("SRP_ID_INVALID".equals(error.text)) { - TLRPC.TL_account_getPassword getPasswordReq = new TLRPC.TL_account_getPassword(); + TL_account.getPassword getPasswordReq = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(getPasswordReq, (response2, error2) -> AndroidUtilities.runOnUIThread(() -> { if (error2 == null) { - TLRPC.account_Password currentPassword = (TLRPC.account_Password) response2; + TL_account.Password currentPassword = (TL_account.Password) response2; passwordFragment.setCurrentPasswordInfo(null, currentPassword); TwoStepVerificationActivity.initPasswordNewAlgo(currentPassword); sendCallback(cache, messageObject, button, passwordFragment.getNewSrpPassword(), passwordFragment, parentFragment); @@ -8151,6 +8155,7 @@ public static void prepareSendingBotContextResult(BaseFragment fragment, Account SendMessagesHelper.SendMessageParams params2 = SendMessagesHelper.SendMessageParams.of(result.send_message.message, dialogId, replyToMsg, replyToTopMsg, webPage, !result.send_message.no_webpage, result.send_message.entities, result.send_message.reply_markup, params, notify, scheduleDate, null, false); params2.quick_reply_shortcut = quick_reply_shortcut; params2.quick_reply_shortcut_id = quick_reply_shortcut_id; + params2.replyQuote = quote; accountInstance.getSendMessagesHelper().sendMessage(params2); } else if (result.send_message instanceof TLRPC.TL_botInlineMessageMediaVenue) { TLRPC.TL_messageMediaVenue venue = new TLRPC.TL_messageMediaVenue(); @@ -8166,6 +8171,7 @@ public static void prepareSendingBotContextResult(BaseFragment fragment, Account SendMessagesHelper.SendMessageParams params2 = SendMessagesHelper.SendMessageParams.of(venue, dialogId, replyToMsg, replyToTopMsg, result.send_message.reply_markup, params, notify, scheduleDate); params2.quick_reply_shortcut = quick_reply_shortcut; params2.quick_reply_shortcut_id = quick_reply_shortcut_id; + params2.replyQuote = quote; accountInstance.getSendMessagesHelper().sendMessage(params2); } else if (result.send_message instanceof TLRPC.TL_botInlineMessageMediaGeo) { SendMessagesHelper.SendMessageParams params2; @@ -8184,6 +8190,7 @@ public static void prepareSendingBotContextResult(BaseFragment fragment, Account } params2.quick_reply_shortcut = quick_reply_shortcut; params2.quick_reply_shortcut_id = quick_reply_shortcut_id; + params2.replyQuote = quote; accountInstance.getSendMessagesHelper().sendMessage(params2); } else if (result.send_message instanceof TLRPC.TL_botInlineMessageMediaContact) { TLRPC.User user = new TLRPC.TL_user(); @@ -8198,6 +8205,7 @@ public static void prepareSendingBotContextResult(BaseFragment fragment, Account SendMessagesHelper.SendMessageParams params2 = SendMessagesHelper.SendMessageParams.of(user, dialogId, replyToMsg, replyToTopMsg, result.send_message.reply_markup, params, notify, scheduleDate); params2.quick_reply_shortcut = quick_reply_shortcut; params2.quick_reply_shortcut_id = quick_reply_shortcut_id; + params2.replyQuote = quote; accountInstance.getSendMessagesHelper().sendMessage(params2); } else if (result.send_message instanceof TLRPC.TL_botInlineMessageMediaInvoice) { if (DialogObject.isEncryptedDialog(dialogId)) { @@ -8219,6 +8227,7 @@ public static void prepareSendingBotContextResult(BaseFragment fragment, Account SendMessagesHelper.SendMessageParams params2 = SendMessagesHelper.SendMessageParams.of(messageMediaInvoice, dialogId, replyToMsg, replyToTopMsg, result.send_message.reply_markup, params, notify, scheduleDate); params2.quick_reply_shortcut = quick_reply_shortcut; params2.quick_reply_shortcut_id = quick_reply_shortcut_id; + params2.replyQuote = quote; accountInstance.getSendMessagesHelper().sendMessage(params2); } else if (result.send_message instanceof TLRPC.TL_botInlineMessageMediaWebPage) { TLRPC.TL_botInlineMessageMediaWebPage request = (TLRPC.TL_botInlineMessageMediaWebPage) result.send_message; @@ -8227,6 +8236,7 @@ public static void prepareSendingBotContextResult(BaseFragment fragment, Account SendMessagesHelper.SendMessageParams params2 = SendMessagesHelper.SendMessageParams.of(result.send_message.message, dialogId, replyToMsg, replyToTopMsg, webPage, !result.send_message.no_webpage, result.send_message.entities, result.send_message.reply_markup, params, notify, scheduleDate, null, false); params2.quick_reply_shortcut = quick_reply_shortcut; params2.quick_reply_shortcut_id = quick_reply_shortcut_id; + params2.replyQuote = quote; accountInstance.getSendMessagesHelper().sendMessage(params2); } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/SharedConfig.java b/TMessagesProj/src/main/java/org/telegram/messenger/SharedConfig.java index 78a64b7dfb..5dfbf45a04 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/SharedConfig.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/SharedConfig.java @@ -670,14 +670,6 @@ public static void loadConfig() { showNotificationsForAllAccounts = preferences.getBoolean("AllAccounts", true); configLoaded = true; - - try { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && debugWebView) { - WebView.setWebContentsDebuggingEnabled(true); - } - } catch (Exception e) { - FileLog.e(e); - } } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/UnconfirmedAuthController.java b/TMessagesProj/src/main/java/org/telegram/messenger/UnconfirmedAuthController.java index 408aa60ed4..1d6e7be28a 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/UnconfirmedAuthController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/UnconfirmedAuthController.java @@ -1,16 +1,15 @@ package org.telegram.messenger; -import android.content.Context; - import org.telegram.SQLite.SQLiteCursor; import org.telegram.SQLite.SQLiteDatabase; import org.telegram.SQLite.SQLitePreparedStatement; import org.telegram.tgnet.AbstractSerializedData; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.NativeByteBuffer; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; -import org.telegram.ui.ActionBar.BottomSheet; +import org.telegram.tgnet.tl.TL_account; import java.util.ArrayList; import java.util.HashSet; @@ -287,7 +286,7 @@ public UnconfirmedAuth(TLRPC.TL_updateNewAuthorization update) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(0x7ab6618c); stream.writeInt64(hash); stream.writeInt32(date); @@ -304,7 +303,7 @@ public boolean expired() { } public void confirm(Utilities.Callback whenDone) { - TLRPC.TL_account_changeAuthorizationSettings req = new TLRPC.TL_account_changeAuthorizationSettings(); + TL_account.changeAuthorizationSettings req = new TL_account.changeAuthorizationSettings(); req.hash = hash; req.confirmed = true; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> { @@ -318,7 +317,7 @@ public void confirm(Utilities.Callback whenDone) { } public void deny(Utilities.Callback whenDone) { - TLRPC.TL_account_resetAuthorization req = new TLRPC.TL_account_resetAuthorization(); + TL_account.resetAuthorization req = new TL_account.resetAuthorization(); req.hash = hash; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> { AndroidUtilities.runOnUIThread(() -> { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/UserConfig.java b/TMessagesProj/src/main/java/org/telegram/messenger/UserConfig.java index 2e01e6cf34..32e45340dc 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/UserConfig.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/UserConfig.java @@ -14,16 +14,11 @@ import android.util.Base64; import android.util.LongSparseArray; -import com.google.android.exoplayer2.util.Log; - import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; -import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; public class UserConfig extends BaseController { @@ -43,7 +38,7 @@ public class UserConfig extends BaseController { public int lastHintsSyncTime; public boolean draftsLoaded; public boolean unreadDialogsLoaded = true; - public TLRPC.TL_account_tmpPassword tmpPassword; + public TL_account.tmpPassword tmpPassword; public int ratingLoadTime; public int botRatingLoadTime; public int webappRatingLoadTime; @@ -353,7 +348,7 @@ private void checkPremiumSelf(TLRPC.User oldUser, TLRPC.User newUser) { byte[] bytes = Base64.decode(string, Base64.DEFAULT); if (bytes != null) { SerializedData data = new SerializedData(bytes); - tmpPassword = TLRPC.TL_account_tmpPassword.TLdeserialize(data, data.readInt32(false), false); + tmpPassword = TL_account.tmpPassword.TLdeserialize(data, data.readInt32(false), false); data.cleanup(); } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/UserNameResolver.java b/TMessagesProj/src/main/java/org/telegram/messenger/UserNameResolver.java index 2af61ee4e3..9b1d316c91 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/UserNameResolver.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/UserNameResolver.java @@ -27,18 +27,18 @@ public class UserNameResolver { LruCache resolvedCache = new LruCache<>(100); HashMap>> resolvingConsumers = new HashMap<>(); - public int resolve(String username, Consumer resolveConsumer) { + public Runnable resolve(String username, Consumer resolveConsumer) { return resolve(username, null, resolveConsumer); } - public int resolve(String username, String referrer, Consumer resolveConsumer) { + public Runnable resolve(String username, String referrer, Consumer resolveConsumer) { if (TextUtils.isEmpty(referrer)) { CachedPeer cachedPeer = resolvedCache.get(username); if (cachedPeer != null) { if (System.currentTimeMillis() - cachedPeer.time < CACHE_TIME) { resolveConsumer.accept(cachedPeer.peerId); FileLog.d("resolve username from cache " + username + " " + cachedPeer.peerId); - return -1; + return null; } else { resolvedCache.remove(username); } @@ -48,7 +48,7 @@ public int resolve(String username, String referrer, Consumer resolveConsu ArrayList> consumers = resolvingConsumers.get(username); if (consumers != null) { consumers.add(resolveConsumer); - return -1; + return null; } consumers = new ArrayList<>(); consumers.add(resolveConsumer); @@ -69,7 +69,7 @@ public int resolve(String username, String referrer, Consumer resolveConsu } req = resolveUsername; } - return ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { + final int reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { ArrayList> finalConsumers = resolvingConsumers.remove(username); if (finalConsumers == null) { return; @@ -105,6 +105,10 @@ public int resolve(String username, String referrer, Consumer resolveConsu finalConsumers.get(i).accept(peerId); } }, ConnectionsManager.RequestFlagFailOnServerErrors)); + return () -> { + resolvingConsumers.remove(username); + ConnectionsManager.getInstance(currentAccount).cancelRequest(reqId, true); + }; }; public void update(TLRPC.User oldUser, TLRPC.User user) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/UserObject.java b/TMessagesProj/src/main/java/org/telegram/messenger/UserObject.java index 33fe7f1cd0..3174292f53 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/UserObject.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/UserObject.java @@ -159,13 +159,19 @@ public static Long getEmojiStatusDocumentId(TLRPC.EmojiStatus emojiStatus) { if (MessagesController.getInstance(UserConfig.selectedAccount).premiumFeaturesBlocked()) { return null; } - if (emojiStatus instanceof TLRPC.TL_emojiStatus) - return ((TLRPC.TL_emojiStatus) emojiStatus).document_id; - if (emojiStatus instanceof TLRPC.TL_emojiStatusUntil) { - TLRPC.TL_emojiStatusUntil untilStatus = (TLRPC.TL_emojiStatusUntil) emojiStatus; - if (untilStatus.until > (int) (System.currentTimeMillis() / 1000)) { - return untilStatus.document_id; + if (emojiStatus instanceof TLRPC.TL_emojiStatus) { + final TLRPC.TL_emojiStatus status = (TLRPC.TL_emojiStatus) emojiStatus; + if ((status.flags & 1) != 0 && status.until <= (int) (System.currentTimeMillis() / 1000)) { + return null; } + return status.document_id; + } + if (emojiStatus instanceof TLRPC.TL_emojiStatusCollectible) { + final TLRPC.TL_emojiStatusCollectible status = (TLRPC.TL_emojiStatusCollectible) emojiStatus; + if ((status.flags & 1) != 0 && status.until <= (int) (System.currentTimeMillis() / 1000)) { + return null; + } + return status.document_id; } return null; } @@ -199,7 +205,17 @@ public static int getProfileColorId(TLRPC.User user) { } public static long getProfileEmojiId(TLRPC.User user) { + if (user != null && user.emoji_status instanceof TLRPC.TL_emojiStatusCollectible) { + return ((TLRPC.TL_emojiStatusCollectible) user.emoji_status).pattern_document_id; + } if (user != null && user.profile_color != null && (user.profile_color.flags & 2) != 0) return user.profile_color.background_emoji_id; return 0; } + + public static long getProfileCollectibleId(TLRPC.User user) { + if (user != null && user.emoji_status instanceof TLRPC.TL_emojiStatusCollectible) { + return ((TLRPC.TL_emojiStatusCollectible) user.emoji_status).collectible_id; + } + return 0; + } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/VideoEditedInfo.java b/TMessagesProj/src/main/java/org/telegram/messenger/VideoEditedInfo.java index 1fad084b2e..438cd9bea6 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/VideoEditedInfo.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/VideoEditedInfo.java @@ -19,6 +19,8 @@ import org.telegram.messenger.video.MediaCodecVideoConvertor; import org.telegram.messenger.video.VideoPlayerHolderBase; import org.telegram.tgnet.AbstractSerializedData; +import org.telegram.tgnet.InputSerializedData; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; @@ -107,7 +109,7 @@ public static class EmojiEntity extends TLRPC.TL_messageEntityCustomEmoji { public byte subType; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { super.readParams(stream, exception); subType = stream.readByte(exception); boolean hasPath = stream.readBool(exception); @@ -120,7 +122,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { super.serializeToStream(stream); stream.writeByte(subType); stream.writeBool(!TextUtils.isEmpty(documentAbsolutePath)); @@ -141,6 +143,7 @@ public static class MediaEntity { public static final byte TYPE_MESSAGE = 6; public static final byte TYPE_LINK = 7; public static final byte TYPE_WEATHER = 8; + public static final byte TYPE_VIDEO = 9; public byte type; public byte subType; @@ -162,6 +165,7 @@ public static class MediaEntity { public float roundRadius; public String segmentedPath = ""; + public MediaController.CropState crop; public float scale = 1.0f; public float textViewWidth; @@ -270,6 +274,11 @@ public MediaEntity(AbstractSerializedData data, boolean full, boolean exception) roundDuration = data.readInt64(exception); } else if (type == TYPE_PHOTO) { segmentedPath = data.readString(exception); + int magic = data.readInt32(exception); + if (magic == MediaController.CropState.constructor) { + crop = new MediaController.CropState(); + crop.readParams(data, exception); + } } else if (type == TYPE_WEATHER) { int magic = data.readInt32(exception); if (magic == 0x7EA7539) { @@ -341,6 +350,11 @@ public void serializeTo(AbstractSerializedData data, boolean full) { data.writeInt64(roundDuration); } else if (type == TYPE_PHOTO) { data.writeString(segmentedPath); + if (crop != null) { + crop.serializeToStream(data); + } else { + data.writeInt32(TLRPC.TL_null.constructor); + } } else if (type == TYPE_WEATHER) { if (weather == null) { data.writeInt32(0xdeadbeef); @@ -776,7 +790,7 @@ public static ArrayList toStoryEntries(ArrayList parts) { } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); isVideo = (flags & 1) != 0; loop = (flags & 2) != 0; @@ -792,7 +806,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { flags = isVideo ? flags | 1 : flags &~ 1; flags = loop ? flags | 2 : flags &~ 2; flags = muted ? flags | 4 : flags &~ 4; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/browser/Browser.java b/TMessagesProj/src/main/java/org/telegram/messenger/browser/Browser.java index 55e5516c2f..7f7fa005c9 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/browser/Browser.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/browser/Browser.java @@ -34,6 +34,7 @@ import org.telegram.messenger.ShareBroadcastReceiver; import org.telegram.messenger.SharedConfig; import org.telegram.messenger.UserConfig; +import org.telegram.messenger.Utilities; import org.telegram.messenger.support.customtabs.CustomTabsCallback; import org.telegram.messenger.support.customtabs.CustomTabsClient; import org.telegram.messenger.support.customtabs.CustomTabsIntent; @@ -44,11 +45,13 @@ import org.telegram.messenger.support.customtabsclient.shared.ServiceConnectionCallback; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBarLayout; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.BottomSheetTabs; import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.BubbleActivity; import org.telegram.ui.LaunchActivity; import org.telegram.ui.web.RestrictedDomainsList; @@ -161,6 +164,13 @@ public static void openUrl(Context context, String url) { openUrl(context, Uri.parse(url), true); } + public static void openUrlInSystemBrowser(Context context, String url) { + if (url == null) { + return; + } + openUrl(context, Uri.parse(url), false, true, false, null, null, false, false, false); + } + public static void openUrl(Context context, Uri uri) { openUrl(context, uri, true); } @@ -223,7 +233,26 @@ public static boolean urlMustNotHaveConfirmation(String url) { } public static class Progress { - public void init() {} + + private Runnable onInitListener; + private Runnable onCancelListener; + private Runnable onEndListener; + + public Progress() { + + } + + public Progress(Runnable init, Runnable end) { + this.onInitListener = init; + this.onEndListener = end; + } + + public void init() { + if (onInitListener != null) { + onInitListener.run(); + onInitListener = null; + } + } public void end() { end(false); } @@ -243,14 +272,14 @@ public void cancel(boolean replaced) { end(replaced); } - private Runnable onCancelListener; - public void onCancel(Runnable onCancelListener) { + public Progress onCancel(Runnable onCancelListener) { this.onCancelListener = onCancelListener; + return this; } - private Runnable onEndListener; - public void onEnd(Runnable onEndListener) { + public Progress onEnd(Runnable onEndListener) { this.onEndListener = onEndListener; + return this; } } @@ -284,7 +313,7 @@ public static void openUrl(final Context context, Uri uri, boolean _allowCustom, }; Uri finalUri = uri; - TLRPC.TL_messages_getWebPagePreview req = new TLRPC.TL_messages_getWebPagePreview(); + TL_account.getWebPagePreview req = new TL_account.getWebPagePreview(); req.message = uri.toString(); final int reqId = ConnectionsManager.getInstance(UserConfig.selectedAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (inCaseLoading != null) { @@ -297,11 +326,15 @@ public static void openUrl(final Context context, Uri uri, boolean _allowCustom, } boolean ok = false; - if (response instanceof TLRPC.TL_messageMediaWebPage) { - TLRPC.TL_messageMediaWebPage webPage = (TLRPC.TL_messageMediaWebPage) response; - if (webPage.webpage instanceof TLRPC.TL_webPage && webPage.webpage.cached_page != null) { - NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.openArticle, webPage.webpage, finalUri.toString()); - ok = true; + if (response instanceof TL_account.webPagePreview) { + final TL_account.webPagePreview preview = (TL_account.webPagePreview) response; + MessagesController.getInstance(currentAccount).putUsers(preview.users, false); + if (preview.media instanceof TLRPC.TL_messageMediaWebPage) { + TLRPC.TL_messageMediaWebPage webPage = (TLRPC.TL_messageMediaWebPage) preview.media; + if (webPage.webpage instanceof TLRPC.TL_webPage && webPage.webpage.cached_page != null) { + NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.openArticle, webPage.webpage, finalUri.toString()); + ok = true; + } } } if (!ok) { @@ -387,7 +420,7 @@ public static void openUrl(final Context context, Uri uri, boolean _allowCustom, } try { final boolean inappBrowser = ( - allowInAppBrowser && + allowInAppBrowser && BubbleActivity.instance == null && SharedConfig.inappBrowser && TextUtils.isEmpty(browserPackage) && !RestrictedDomainsList.getInstance().isRestricted(AndroidUtilities.getHostAuthority(uri, true)) && @@ -819,7 +852,7 @@ public static String replace(Uri originalUri, String newScheme, String newUserIn } if (newPath != null) { modifiedUriBuilder.append(newPath); - } else { + } else if (originalUri.getPath() != null) { modifiedUriBuilder.append(originalUri.getPath()); } if (originalUri.getQuery() != null) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/camera/CameraSession.java b/TMessagesProj/src/main/java/org/telegram/messenger/camera/CameraSession.java index ce82a9b919..0fce940062 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/camera/CameraSession.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/camera/CameraSession.java @@ -16,6 +16,7 @@ import android.media.CamcorderProfile; import android.media.MediaRecorder; import android.os.Build; +import android.text.TextUtils; import android.util.Log; import android.view.OrientationEventListener; import android.view.Surface; @@ -160,11 +161,14 @@ public void setCurrentFlashMode(String mode) { public void setTorchEnabled(boolean enabled) { try { + String beforeFlashMode = currentFlashMode; currentFlashMode = enabled ? Camera.Parameters.FLASH_MODE_TORCH : Camera.Parameters.FLASH_MODE_OFF; - if (isRound) { - configureRoundCamera(false); - } else { - configurePhotoCamera(); + if (!TextUtils.equals(beforeFlashMode, currentFlashMode)) { + if (isRound) { + configureRoundCamera(false); + } else { + configurePhotoCamera(); + } } } catch (Exception e) { FileLog.e(e); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/camera/CameraView.java b/TMessagesProj/src/main/java/org/telegram/messenger/camera/CameraView.java index 76f0a0f098..d81f3c4f00 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/camera/CameraView.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/camera/CameraView.java @@ -476,6 +476,7 @@ protected void onAttachedToWindow() { } private int lastWidth = -1, lastHeight = -1; + public boolean fit; @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int width = MeasureSpec.getSize(widthMeasureSpec), @@ -493,7 +494,12 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { frameWidth = previewSize[0].getHeight(); frameHeight = previewSize[0].getWidth(); } - float s = Math.max(MeasureSpec.getSize(widthMeasureSpec) / (float) frameWidth , MeasureSpec.getSize(heightMeasureSpec) / (float) frameHeight); + float s; + if (fit) { + s = Math.min(width / (float) frameWidth, height / (float) frameHeight); + } else { + s = Math.max(width / (float) frameWidth, height / (float) frameHeight); + } blurredStubView.getLayoutParams().width = textureView.getLayoutParams().width = (int) (s * frameWidth); blurredStubView.getLayoutParams().height = textureView.getLayoutParams().height = (int) (s * frameHeight); } @@ -504,10 +510,14 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { pixelW = getMeasuredWidth(); pixelH = getMeasuredHeight(); - if (pixelDualW <= 0) { +// if (previewSize[1] != null) { +// pixelDualW = previewSize[1].getWidth(); +// pixelDualH = previewSize[1].getHeight(); +// } +// if (pixelDualW <= 0) { pixelDualW = getMeasuredWidth(); pixelDualH = getMeasuredHeight(); - } +// } } public float getTextureHeight(float width, float height) { @@ -720,6 +730,10 @@ private void updateCameraInfoSize(int i) { aspectRatio = new Size(1, 1); photoMaxWidth = wantedWidth = 720; photoMaxHeight = wantedHeight = 720; +// } else if (!isStory) { +// photoMaxWidth = wantedWidth = AndroidUtilities.displaySize.x; +// photoMaxHeight = wantedHeight = AndroidUtilities.displaySize.y; +// aspectRatio = new Size(wantedWidth, wantedHeight); } else if (initialFrontface) { aspectRatio = new Size(16, 9); photoMaxWidth = wantedWidth = 1280; @@ -785,6 +799,17 @@ public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) { @Override public void onSurfaceTextureUpdated(SurfaceTexture surface) { + if (!(!inited && cameraSession[0] != null && cameraSession[0].isInitiated()) && !(renderNode != null && !((RenderNode) renderNode).hasDisplayList())) { + return; + } + if (Looper.myLooper() != Looper.getMainLooper()) { + AndroidUtilities.runOnUIThread(this::onSurfaceTextureUpdatedInternal); + } else { + onSurfaceTextureUpdatedInternal(); + } + } + + private void onSurfaceTextureUpdatedInternal() { if (!inited && cameraSession[0] != null && cameraSession[0].isInitiated()) { if (delegate != null) { delegate.onCameraInit(); @@ -795,6 +820,10 @@ public void onSurfaceTextureUpdated(SurfaceTexture surface) { showTexture(true, true); } } + + if (renderNode != null && !((RenderNode) renderNode).hasDisplayList()) { + invalidate(); + } } private ValueAnimator textureViewAnimator; @@ -1045,7 +1074,9 @@ public void runHaptic() { vibrator.cancel(); vibrator.vibrate(vibrationEffect); } else { - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} } } @@ -1716,11 +1747,28 @@ private void onDraw(int cameraId1, int cameraId2, boolean updateTexImage1, boole GLES20.glUniformMatrix4fv(textureMatrixHandle, 1, false, mSTMatrix[i], 0); GLES20.glUniformMatrix4fv(vertexMatrixHandle, 1, false, mMVPMatrix[i], 0); + Size size = previewSize[i]; + if (size != null && currentSession[i] != null) { + int angle = currentSession[i].getWorldAngle(); + int w, h; + if (angle == 90 || angle == 270) { + w = size.getWidth(); + h = size.getHeight(); + } else { + w = size.getHeight(); + h = size.getWidth(); + } + GLES20.glUniform2f(pixelHandle, w, h); + } else { + if (i == 0) { + GLES20.glUniform2f(pixelHandle, pixelW, pixelH); + } else { + GLES20.glUniform2f(pixelHandle, pixelDualW, pixelDualH); + } + } if (i == 0) { - GLES20.glUniform2f(pixelHandle, pixelW, pixelH); GLES20.glUniform1f(dualHandle, dual ? 1 : 0); } else { - GLES20.glUniform2f(pixelHandle, pixelDualW, pixelDualH); GLES20.glUniform1f(dualHandle, 1f); } GLES20.glUniform1f(blurHandle, i == 0 ? camera1Blur : 0f); @@ -2738,11 +2786,28 @@ private void handleVideoFrameAvailable(long timestampNanos, Integer cameraId) { GLES20.glUniformMatrix4fv(textureMatrixHandle, 1, false, mSTMatrix[i], 0); GLES20.glUniform1f(blurHandle, 0); + Size size = previewSize[i]; + if (size != null && cameraSession[i] != null) { + int angle = cameraSession[i].getWorldAngle(); + int w, h; + if (angle == 90 || angle == 270) { + w = size.getWidth(); + h = size.getHeight(); + } else { + w = size.getHeight(); + h = size.getWidth(); + } + GLES20.glUniform2f(pixelHandle, w, h); + } else { + if (i == 0) { + GLES20.glUniform2f(pixelHandle, pixelW, pixelH); + } else { + GLES20.glUniform2f(pixelHandle, pixelDualW, pixelDualH); + } + } if (i == 0) { - GLES20.glUniform2f(pixelHandle, pixelW, pixelH); GLES20.glUniform1f(dualHandle, isDual ? 1f : 0f); } else { - GLES20.glUniform2f(pixelHandle, pixelDualW, pixelDualH); GLES20.glUniform1f(dualHandle, 1f); } if (i == 1) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ringtone/RingtoneDataStore.java b/TMessagesProj/src/main/java/org/telegram/messenger/ringtone/RingtoneDataStore.java index ce8fb81e5b..3542a0cc92 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ringtone/RingtoneDataStore.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ringtone/RingtoneDataStore.java @@ -15,6 +15,7 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import java.io.File; import java.util.ArrayList; @@ -56,15 +57,15 @@ public RingtoneDataStore(int currentAccount) { public void loadUserRingtones(boolean force) { boolean needReload = force || System.currentTimeMillis() - lastReloadTimeMs > reloadTimeoutMs; - TLRPC.TL_account_getSavedRingtones req = new TLRPC.TL_account_getSavedRingtones(); + TL_account.getSavedRingtones req = new TL_account.getSavedRingtones(); req.hash = queryHash; if (needReload) { ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (response != null) { - if (response instanceof TLRPC.TL_account_savedRingtonesNotModified) { + if (response instanceof TL_account.TL_savedRingtonesNotModified) { loadFromPrefs(true); - } else if (response instanceof TLRPC.TL_account_savedRingtones) { - TLRPC.TL_account_savedRingtones res = (TLRPC.TL_account_savedRingtones) response; + } else if (response instanceof TL_account.TL_savedRingtones) { + TL_account.TL_savedRingtones res = (TL_account.TL_savedRingtones) response; saveTones(res.ringtones); getSharedPreferences().edit() .putLong("hash", queryHash = res.hash) diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ringtone/RingtoneUploader.java b/TMessagesProj/src/main/java/org/telegram/messenger/ringtone/RingtoneUploader.java index 69b1fb34ca..4c47d3cdbe 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ringtone/RingtoneUploader.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ringtone/RingtoneUploader.java @@ -9,6 +9,7 @@ import org.telegram.messenger.R; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.Components.Bulletin; import java.io.File; @@ -35,7 +36,7 @@ public void didReceivedNotification(int id, int account, Object... args) { } if (location.equals(filePath)) { final TLRPC.InputFile file = (TLRPC.InputFile) args[1]; - TLRPC.TL_account_uploadRingtone req = new TLRPC.TL_account_uploadRingtone(); + TL_account.uploadRingtone req = new TL_account.uploadRingtone(); req.file = file; req.file_name = file.name; req.mime_type = FileLoader.getFileExtension(new File(file.name)); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/utils/BillingUtilities.java b/TMessagesProj/src/main/java/org/telegram/messenger/utils/BillingUtilities.java index 41bdd821d1..95da494c95 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/utils/BillingUtilities.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/utils/BillingUtilities.java @@ -19,6 +19,8 @@ import org.telegram.messenger.UserConfig; import org.telegram.messenger.Utilities; import org.telegram.tgnet.AbstractSerializedData; +import org.telegram.tgnet.InputSerializedData; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; @@ -164,7 +166,7 @@ public static class TL_savedPurpose extends TLObject { public long id; public TLRPC.InputStorePaymentPurpose purpose; - public static TL_savedPurpose TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_savedPurpose TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { TL_savedPurpose result = null; switch (constructor) { case TL_savedPurpose.constructor: @@ -181,7 +183,7 @@ public static TL_savedPurpose TLdeserialize(AbstractSerializedData stream, int c } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); id = stream.readInt64(exception); if ((flags & 1) != 0) { @@ -190,7 +192,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(id); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/video/InputSurface.java b/TMessagesProj/src/main/java/org/telegram/messenger/video/InputSurface.java index 4013a48df6..159db80c6d 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/video/InputSurface.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/video/InputSurface.java @@ -111,10 +111,6 @@ public void makeCurrent() { } } - public EGLContext getContext() { - return mEGLContext; - } - public boolean swapBuffers() { return EGL14.eglSwapBuffers(mEGLDisplay, mEGLSurface); } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/video/MediaCodecVideoConvertor.java b/TMessagesProj/src/main/java/org/telegram/messenger/video/MediaCodecVideoConvertor.java index 5e2beeb104..562b82dda0 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/video/MediaCodecVideoConvertor.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/video/MediaCodecVideoConvertor.java @@ -7,8 +7,6 @@ import android.media.MediaFormat; import android.media.MediaMuxer; import android.os.Build; -import android.os.Handler; -import android.os.Looper; import android.util.Log; import androidx.annotation.NonNull; @@ -52,12 +50,12 @@ public class MediaCodecVideoConvertor { private static final int MEDIACODEC_TIMEOUT_INCREASED = 22000; private String outputMimeType; - public boolean convertVideo(ConvertVideoParams convertVideoParams, Handler handler) { + public boolean convertVideo(ConvertVideoParams convertVideoParams) { if (convertVideoParams.isSticker) { return WebmEncoder.convert(convertVideoParams, 0); } this.callback = convertVideoParams.callback; - return convertVideoInternal(convertVideoParams, false, 0, handler); + return convertVideoInternal(convertVideoParams, false, 0); } public long getLastFrameTimestamp() { @@ -68,8 +66,7 @@ public long getLastFrameTimestamp() { private boolean convertVideoInternal( ConvertVideoParams convertVideoParams, boolean increaseTimeout, - int triesCount, - Handler handler + int triesCount ) { String videoPath = convertVideoParams.videoPath; File cacheFile = convertVideoParams.cacheFile; @@ -185,7 +182,7 @@ private boolean convertVideoInternal( inputSurface.makeCurrent(); encoder.start(); - outputSurface = new OutputSurface(inputSurface.getContext(), savedFilterState, videoPath, paintPath, blurPath, mediaEntities, cropState != null && cropState.useMatrix != null ? cropState : null, resultWidth, resultHeight, originalWidth, originalHeight, rotationValue, framerate, true, gradientTopColor, gradientBottomColor, null, convertVideoParams, handler); + outputSurface = new OutputSurface(savedFilterState, videoPath, paintPath, blurPath, mediaEntities, cropState != null && cropState.useMatrix != null ? cropState : null, resultWidth, resultHeight, originalWidth, originalHeight, rotationValue, framerate, true, gradientTopColor, gradientBottomColor, null, convertVideoParams); ByteBuffer[] encoderOutputBuffers = null; ByteBuffer[] encoderInputBuffers = null; @@ -518,7 +515,7 @@ private boolean convertVideoInternal( } } - outputSurface = new OutputSurface(inputSurface.getContext(), savedFilterState, null, paintPath, blurPath, mediaEntities, cropState, resultWidth, resultHeight, originalWidth, originalHeight, rotationValue, framerate, false, gradientTopColor, gradientBottomColor, hdrInfo, convertVideoParams, handler); + outputSurface = new OutputSurface(savedFilterState, null, paintPath, blurPath, mediaEntities, cropState, resultWidth, resultHeight, originalWidth, originalHeight, rotationValue, framerate, false, gradientTopColor, gradientBottomColor, hdrInfo, convertVideoParams); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && hdrInfo != null && hdrInfo.getHDRType() != 0) { outputSurface.changeFragmentShader( hdrFragmentShader(originalWidth, originalHeight, resultWidth, resultHeight, true, hdrInfo), @@ -963,11 +960,11 @@ private boolean convertVideoInternal( } if (repeatWithIncreasedTimeout) { - return convertVideoInternal(convertVideoParams, true, triesCount + 1, handler); + return convertVideoInternal(convertVideoParams, true, triesCount + 1); } if (error && canBeBrokenEncoder && triesCount < 3) { - return convertVideoInternal(convertVideoParams, increaseTimeout, triesCount + 1, handler); + return convertVideoInternal(convertVideoParams, increaseTimeout, triesCount + 1); } long timeLeft = System.currentTimeMillis() - time; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/video/OutputSurface.java b/TMessagesProj/src/main/java/org/telegram/messenger/video/OutputSurface.java index 0f6f4efccf..208f21a707 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/video/OutputSurface.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/video/OutputSurface.java @@ -42,70 +42,14 @@ public class OutputSurface implements SurfaceTexture.OnFrameAvailableListener { private boolean mFrameAvailable; private TextureRenderer mTextureRender; - private android.opengl.EGLContext parentContext; - private Handler handler; - - public OutputSurface(android.opengl.EGLContext context, MediaController.SavedFilterState savedFilterState, String imagePath, String paintPath, String blurPath, ArrayList mediaEntities, MediaController.CropState cropState, int w, int h, int originalW, int originalH, int rotation, float fps, boolean photo, Integer gradientTopColor, Integer gradientBottomColor, StoryEntry.HDRInfo hdrInfo, MediaCodecVideoConvertor.ConvertVideoParams params, Handler handler) { - this.parentContext = context; - this.handler = handler; - final CountDownLatch latch = new CountDownLatch(1); - handler.post(() -> { - setupBackground(context); - latch.countDown(); - }); - try { - latch.await(); - } catch (Exception e) { - FileLog.e(e); - } - mTextureRender = new TextureRenderer(savedFilterState, imagePath, paintPath, blurPath, mediaEntities, cropState, w, h, originalW, originalH, rotation, fps, photo, gradientTopColor, gradientBottomColor, hdrInfo, params, handler, bgEGLContext); + public OutputSurface(MediaController.SavedFilterState savedFilterState, String imagePath, String paintPath, String blurPath, ArrayList mediaEntities, MediaController.CropState cropState, int w, int h, int originalW, int originalH, int rotation, float fps, boolean photo, Integer gradientTopColor, Integer gradientBottomColor, StoryEntry.HDRInfo hdrInfo, MediaCodecVideoConvertor.ConvertVideoParams params) { + mTextureRender = new TextureRenderer(savedFilterState, imagePath, paintPath, blurPath, mediaEntities, cropState, w, h, originalW, originalH, rotation, fps, photo, gradientTopColor, gradientBottomColor, hdrInfo, params); mTextureRender.surfaceCreated(); mSurfaceTexture = new SurfaceTexture(mTextureRender.getTextureId()); mSurfaceTexture.setOnFrameAvailableListener(this); mSurface = new Surface(mSurfaceTexture); } - private EGLDisplay bgEGLDisplay; - private EGLContext bgEGLContext; - private void setupBackground(EGLContext ctx) { - bgEGLDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY); - if (bgEGLDisplay == EGL14.EGL_NO_DISPLAY) { - throw new RuntimeException("unable to get EGL14 display"); - } - int[] version = new int[2]; - if (!EGL14.eglInitialize(bgEGLDisplay, version, 0, version, 1)) { - bgEGLDisplay = null; - throw new RuntimeException("unable to initialize EGL14"); - } - - int[] attribList = { - EGL14.EGL_RED_SIZE, 8, - EGL14.EGL_GREEN_SIZE, 8, - EGL14.EGL_BLUE_SIZE, 8, - EGL14.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, - EGL14.EGL_NONE - }; - EGLConfig[] configs = new EGLConfig[1]; - int[] numConfigs = new int[1]; - if (!EGL14.eglChooseConfig(bgEGLDisplay, attribList, 0, configs, 0, configs.length, - numConfigs, 0)) { - throw new RuntimeException("unable to find RGB888+recordable ES2 EGL config"); - } - int[] attrib_list = { - EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, - EGL14.EGL_NONE - }; - bgEGLContext = EGL14.eglCreateContext(bgEGLDisplay, configs[0], ctx, attrib_list, 0); - checkEglError("eglCreateContext"); - if (bgEGLContext == null) { - throw new RuntimeException("null context"); - } - checkEglError("before makeCurrent"); - if (!EGL14.eglMakeCurrent(bgEGLDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, bgEGLContext)) { - throw new RuntimeException("eglMakeCurrent failed"); - } - } - // private void eglSetup(int width, int height) { // mEGL = (EGL10) EGLContext.getEGL(); // mEGLDisplay = mEGL.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/video/TextureRenderer.java b/TMessagesProj/src/main/java/org/telegram/messenger/video/TextureRenderer.java index a8d93959d6..edb1e754d8 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/video/TextureRenderer.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/video/TextureRenderer.java @@ -21,20 +21,16 @@ import android.graphics.SurfaceTexture; import android.graphics.Typeface; import android.graphics.drawable.Drawable; -import android.net.Uri; -import android.opengl.EGLContext; import android.opengl.GLES11Ext; import android.opengl.GLES20; import android.opengl.GLES30; import android.opengl.GLUtils; import android.opengl.Matrix; import android.os.Build; -import android.os.Handler; import android.text.Layout; import android.text.SpannableString; import android.text.Spanned; import android.text.TextUtils; -import android.util.Log; import android.util.Pair; import android.util.TypedValue; import android.view.Gravity; @@ -68,7 +64,6 @@ import org.telegram.ui.Components.Paint.Views.LocationMarker; import org.telegram.ui.Components.Paint.Views.PaintTextOptionsView; import org.telegram.ui.Components.RLottieDrawable; -import org.telegram.ui.Components.VideoPlayer; import org.telegram.ui.Stories.recorder.PreviewView; import org.telegram.ui.Stories.recorder.StoryEntry; @@ -77,8 +72,6 @@ import java.nio.ByteOrder; import java.nio.FloatBuffer; import java.util.ArrayList; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import javax.microedition.khronos.opengles.GL10; @@ -86,6 +79,7 @@ public class TextureRenderer { private FloatBuffer verticesBuffer; + private FloatBuffer croppedTextureBuffer; private FloatBuffer gradientVerticesBuffer; private FloatBuffer gradientTextureBuffer; private FloatBuffer textureBuffer; @@ -277,8 +271,6 @@ public class TextureRenderer { private final RectF roundDst = new RectF(); private Path roundClipPath; - private int imageOrientation; - private boolean blendEnabled; private boolean isPhoto; @@ -297,8 +289,6 @@ private boolean isCollage() { private int[] blurTexture; private int gradientTopColor, gradientBottomColor; - private final Handler handler; - private final EGLContext parentContext; public TextureRenderer( MediaController.SavedFilterState savedFilterState, @@ -315,14 +305,10 @@ public TextureRenderer( Integer gradientTopColor, Integer gradientBottomColor, StoryEntry.HDRInfo hdrInfo, - MediaCodecVideoConvertor.ConvertVideoParams params, - Handler handler, - EGLContext parentContext + MediaCodecVideoConvertor.ConvertVideoParams params ) { isPhoto = photo; collageParts = params.collageParts; - this.handler = handler; - this.parentContext = parentContext; float[] texData = { 0.f, 0.f, @@ -409,11 +395,17 @@ public TextureRenderer( if (cropState != null) { if (cropState.useMatrix != null) { useMatrixForImagePath = true; + float pw = cropState.cropPw, ph = cropState.cropPh; + if ((cropState.orientation / 90) % 2 == 1) { + pw = cropState.cropPh; + ph = cropState.cropPw; + } + float _pw = (1.0f - pw) / 2.0f, _ph = (1.0f - ph) / 2.0f; float[] verticesData = { - 0, 0, - originalWidth, 0, - 0, originalHeight, - originalWidth, originalHeight + originalWidth * _pw, originalHeight * _ph, + originalWidth * (_pw + pw), originalHeight * _ph, + originalWidth * _pw, originalHeight * (_ph + ph), + originalWidth * (_pw + pw), originalHeight * (_ph + ph) }; cropState.useMatrix.mapPoints(verticesData); for (int a = 0; a < 4; a++) { @@ -422,6 +414,36 @@ public TextureRenderer( } verticesBuffer = ByteBuffer.allocateDirect(verticesData.length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer(); verticesBuffer.put(verticesData).position(0); + + float uvOw = originalWidth, uvOh = originalHeight; + float[] uv = { + uvOw*pw*-0.5f, uvOh*ph*-0.5f, + uvOw*pw*+0.5f, uvOh*ph*-0.5f, + uvOw*pw*-0.5f, uvOh*ph*+0.5f, + uvOw*pw*+0.5f, uvOh*ph*+0.5f + }; + float angle = (float) (-cropState.cropRotate * (Math.PI / 180.0f)); + for (int a = 0; a < 4; ++a) { + float x = uv[a * 2 + 0], y = uv[a * 2 + 1]; + x -= cropState.cropPx * uvOw; + y -= cropState.cropPy * uvOh; + float x2 = (float) (x * Math.cos(angle) - y * Math.sin(angle)) / uvOw; + float y2 = (float) (x * Math.sin(angle) + y * Math.cos(angle)) / uvOh; + x2 /= cropState.cropScale; + y2 /= cropState.cropScale; + x2 += 0.5f; + y2 += 0.5f; + uv[a * 2 + 0] = x2; + uv[a * 2 + 1] = y2; + } + if (filterShaders == null && !isPhoto && messageVideoMaskPath == null) { + uv[1] = 1f - uv[1]; + uv[3] = 1f - uv[3]; + uv[5] = 1f - uv[5]; + uv[7] = 1f - uv[7]; + } + croppedTextureBuffer = ByteBuffer.allocateDirect(uv.length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer(); + croppedTextureBuffer.put(uv).position(0); } else { float[] verticesData = { 0, 0, @@ -518,12 +540,6 @@ public TextureRenderer( }; } } - if (!isPhoto && useMatrixForImagePath) { - textureData[1] = 1f - textureData[1]; - textureData[3] = 1f - textureData[3]; - textureData[5] = 1f - textureData[5]; - textureData[7] = 1f - textureData[7]; - } if (cropState != null && cropState.mirrored) { for (int a = 0; a < 4; a++) { if (textureData[a * 2] > 0.5f) { @@ -647,7 +663,7 @@ public void drawFrame(SurfaceTexture st, long time) { GLES20.glVertexAttribPointer(maPositionHandle[index], 2, GLES20.GL_FLOAT, false, 8, verticesBuffer); GLES20.glEnableVertexAttribArray(maPositionHandle[index]); - GLES20.glVertexAttribPointer(maTextureHandle[index], 2, GLES20.GL_FLOAT, false, 8, renderTextureBuffer); + GLES20.glVertexAttribPointer(maTextureHandle[index], 2, GLES20.GL_FLOAT, false, 8, useMatrixForImagePath ? croppedTextureBuffer : renderTextureBuffer); GLES20.glEnableVertexAttribArray(maTextureHandle[index]); if (messageVideoMaskPath != null && videoMaskTexture != -1) { GLES20.glVertexAttribPointer(mmTextureHandle[index], 2, GLES20.GL_FLOAT, false, 8, maskTextureBuffer); @@ -972,7 +988,7 @@ private void drawTexture(boolean bind, int texture, float x, float y, float w, f bitmapVerticesBuffer.put(bitmapData).position(0); GLES20.glVertexAttribPointer(simplePositionHandle, 2, GLES20.GL_FLOAT, false, 8, useCropMatrix ? verticesBuffer : bitmapVerticesBuffer); GLES20.glEnableVertexAttribArray(simpleInputTexCoordHandle); - GLES20.glVertexAttribPointer(simpleInputTexCoordHandle, 2, GLES20.GL_FLOAT, false, 8, useCropMatrix ? renderTextureBuffer : textureBuffer); + GLES20.glVertexAttribPointer(simpleInputTexCoordHandle, 2, GLES20.GL_FLOAT, false, 8, useCropMatrix ? croppedTextureBuffer : textureBuffer); if (bind) { GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texture); } @@ -1329,7 +1345,7 @@ public void draw(@NonNull Canvas canvas, CharSequence charSequence, int start, i }; text.setSpan(span, e.offset, e.offset + e.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } - editText.setText(Emoji.replaceEmoji(text, editText.getPaint().getFontMetricsInt(), (int) (editText.getTextSize() * .8f), false)); + editText.setText(Emoji.replaceEmoji(text, editText.getPaint().getFontMetricsInt(), false)); editText.setTextColor(entity.color); CharSequence text2 = editText.getText(); if (text2 instanceof Spanned) { @@ -1519,6 +1535,35 @@ private void initStickerEntity(VideoEditedInfo.MediaEntity entity) { opts.inMutable = true; } entity.bitmap = BitmapFactory.decodeFile(path, opts); + if (entity.bitmap != null && entity.crop != null) { + Bitmap newBitmap = Bitmap.createBitmap((int) Math.max(1, entity.crop.cropPw * entity.bitmap.getWidth()), (int) Math.max(1, entity.crop.cropPh * entity.bitmap.getHeight()), Bitmap.Config.ARGB_8888); + Canvas canvas = new Canvas(newBitmap); + canvas.translate(newBitmap.getWidth() / 2.0f, newBitmap.getHeight() / 2.0f); + + canvas.rotate(-entity.crop.orientation); + int w = entity.bitmap.getWidth(), h = entity.bitmap.getHeight(); + if (((entity.crop.orientation + entity.crop.transformRotation) / 90) % 2 == 1) { + w = entity.bitmap.getHeight(); + h = entity.bitmap.getWidth(); + } + canvas.clipRect( + -w * entity.crop.cropPw / 2.0f, -h * entity.crop.cropPh / 2.0f, + +w * entity.crop.cropPw / 2.0f, +h * entity.crop.cropPh / 2.0f + ); + canvas.scale(entity.crop.cropScale, entity.crop.cropScale); + canvas.translate(entity.crop.cropPx * w, entity.crop.cropPy * h); + canvas.rotate(entity.crop.cropRotate + entity.crop.transformRotation); + if (entity.crop.mirrored) { + canvas.scale(-1, 1); + } + canvas.rotate(entity.crop.orientation); + + canvas.translate(-entity.bitmap.getWidth() / 2.0f, -entity.bitmap.getHeight() / 2.0f); + canvas.drawBitmap(entity.bitmap, 0, 0, null); + + entity.bitmap.recycle(); + entity.bitmap = newBitmap; + } if (entity.type == VideoEditedInfo.MediaEntity.TYPE_PHOTO && entity.bitmap != null) { entity.roundRadius = AndroidUtilities.dp(12) / (float) Math.min(entity.viewWidth, entity.viewHeight); Pair orientation = AndroidUtilities.getImageOrientation(entity.text); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/video/WebmEncoder.java b/TMessagesProj/src/main/java/org/telegram/messenger/video/WebmEncoder.java index 1602fc0cd3..487a1d7888 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/video/WebmEncoder.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/video/WebmEncoder.java @@ -11,15 +11,12 @@ import android.graphics.PorterDuffXfermode; import android.graphics.RectF; import android.graphics.Typeface; -import android.opengl.GLES20; -import android.opengl.GLUtils; import android.os.Build; import android.text.Layout; import android.text.Spannable; import android.text.SpannableString; import android.text.Spanned; import android.text.TextUtils; -import android.util.Log; import android.util.Pair; import android.util.TypedValue; import android.view.Gravity; @@ -29,33 +26,23 @@ import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; -import com.google.common.collect.BiMap; - import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ApplicationLoader; -import org.telegram.messenger.Bitmaps; import org.telegram.messenger.Emoji; import org.telegram.messenger.FileLog; import org.telegram.messenger.LocaleController; import org.telegram.messenger.UserConfig; -import org.telegram.messenger.Utilities; import org.telegram.messenger.VideoEditedInfo; -import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Components.AnimatedEmojiSpan; import org.telegram.ui.Components.AnimatedFileDrawable; -import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.Paint.Views.EditTextOutline; import org.telegram.ui.Components.Paint.Views.PaintTextOptionsView; import org.telegram.ui.Components.RLottieDrawable; import java.io.File; -import java.io.RandomAccessFile; import java.nio.ByteBuffer; -import java.nio.channels.FileChannel; import java.util.ArrayList; -import javax.microedition.khronos.opengles.GL10; - public class WebmEncoder { private static native long createEncoder( @@ -290,7 +277,7 @@ public void draw(@NonNull Canvas canvas, CharSequence charSequence, int start, i }; ((Spannable) text).setSpan(span, e.offset, e.offset + e.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } - text = Emoji.replaceEmoji(text, editText.getPaint().getFontMetricsInt(), (int) (editText.getTextSize() * .8f), false); + text = Emoji.replaceEmoji(text, editText.getPaint().getFontMetricsInt(), false); if (text instanceof Spanned) { Emoji.EmojiSpan[] spans = ((Spanned) text).getSpans(0, text.length(), Emoji.EmojiSpan.class); if (spans != null) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPPreNotificationService.java b/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPPreNotificationService.java index e92e5af4ac..0b094cadfb 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPPreNotificationService.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPPreNotificationService.java @@ -36,6 +36,7 @@ import org.telegram.messenger.XiaomiUtilities; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_phone; import org.telegram.ui.Components.PermissionRequest; import org.telegram.ui.LaunchActivity; import org.telegram.ui.VoIPFragment; @@ -47,10 +48,10 @@ public static final class State implements VoIPServiceState { private final int currentAccount; private final long userId; - private final TLRPC.PhoneCall call; + private final TL_phone.PhoneCall call; private boolean destroyed; - public State(int currentAccount, long userId, TLRPC.PhoneCall phoneCall) { + public State(int currentAccount, long userId, TL_phone.PhoneCall phoneCall) { this.currentAccount = currentAccount; this.userId = userId; this.call = phoneCall; @@ -72,7 +73,7 @@ public int getCallState() { } @Override - public TLRPC.PhoneCall getPrivateCall() { + public TL_phone.PhoneCall getPrivateCall() { return call; } @@ -385,12 +386,12 @@ private static void stopRinging() { // } // } - public static TLRPC.PhoneCall pendingCall; + public static TL_phone.PhoneCall pendingCall; public static Intent pendingVoIP; public static State currentState; // public static Intent pendingNotificationService; - public static void show(Context context, Intent intent, TLRPC.PhoneCall call) { + public static void show(Context context, Intent intent, TL_phone.PhoneCall call) { FileLog.d("VoIPPreNotification.show()"); if (call == null || intent == null) { @@ -424,8 +425,8 @@ public static void show(Context context, Intent intent, TLRPC.PhoneCall call) { }); } - private static void acknowledge(Context context, int currentAccount, TLRPC.PhoneCall call, Runnable whenAcknowledged) { - if (call instanceof TLRPC.TL_phoneCallDiscarded) { + private static void acknowledge(Context context, int currentAccount, TL_phone.PhoneCall call, Runnable whenAcknowledged) { + if (call instanceof TL_phone.TL_phoneCallDiscarded) { if (BuildVars.LOGS_ENABLED) { FileLog.w("Call " + call.id + " was discarded before the voip pre notification started, stopping"); } @@ -449,7 +450,7 @@ private static void acknowledge(Context context, int currentAccount, TLRPC.Phone return; } } - TLRPC.TL_phone_receivedCall req = new TLRPC.TL_phone_receivedCall(); + TL_phone.receivedCall req = new TL_phone.receivedCall(); req.peer = new TLRPC.TL_inputPhoneCall(); req.peer.id = call.id; req.peer.access_hash = call.access_hash; @@ -537,7 +538,7 @@ public static void decline(Context context, int reason) { return; } final int account = pendingVoIP.getIntExtra("account", UserConfig.selectedAccount); - final TLRPC.TL_phone_discardCall req = new TLRPC.TL_phone_discardCall(); + final TL_phone.discardCall req = new TL_phone.discardCall(); req.peer = new TLRPC.TL_inputPhoneCall(); req.peer.access_hash = pendingCall.access_hash; req.peer.id = pendingCall.id; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPService.java b/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPService.java index 5ca7d06e62..02fc9085e9 100755 --- a/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPService.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPService.java @@ -79,7 +79,6 @@ import android.text.SpannableString; import android.text.TextUtils; import android.text.style.ForegroundColorSpan; -import android.util.Log; import android.util.LruCache; import android.view.HapticFeedbackConstants; import android.view.KeyEvent; @@ -117,6 +116,8 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; +import org.telegram.tgnet.tl.TL_phone; import org.telegram.ui.ActionBar.BottomSheet; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Components.AvatarDrawable; @@ -254,10 +255,10 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa private boolean switchingStream; private boolean switchingAccount; - public TLRPC.PhoneCall privateCall; + public TL_phone.PhoneCall privateCall; public ChatObject.Call groupCall; - public TLRPC.PhoneCall getPrivateCall() { + public TL_phone.PhoneCall getPrivateCall() { return privateCall; } @@ -314,7 +315,7 @@ public TLRPC.PhoneCall getPrivateCall() { private long keyFingerprint; private boolean forceRating; - public static TLRPC.PhoneCall callIShouldHavePutIntoIntent; + public static TL_phone.PhoneCall callIShouldHavePutIntoIntent; public static NativeInstance.AudioLevelsCallback audioLevelsCallback; @@ -323,7 +324,7 @@ public TLRPC.PhoneCall getPrivateCall() { private long lastTypingTimeSend; private boolean endCallAfterRequest; - private ArrayList pendingUpdates = new ArrayList<>(); + private ArrayList pendingUpdates = new ArrayList<>(); private Runnable delayedStartOutgoingCall; private boolean startedRinging; @@ -933,7 +934,7 @@ public void hangUp(int discard, Runnable onDone) { chatFull.call = null; NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.groupCallUpdated, chat.id, groupCall.call.id, false); } - TLRPC.TL_phone_discardGroupCall req = new TLRPC.TL_phone_discardGroupCall(); + TL_phone.discardGroupCall req = new TL_phone.discardGroupCall(); req.call = groupCall.getInputGroupCall(); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { if (response instanceof TLRPC.TL_updates) { @@ -942,7 +943,7 @@ public void hangUp(int discard, Runnable onDone) { } }); } else { - TLRPC.TL_phone_leaveGroupCall req = new TLRPC.TL_phone_leaveGroupCall(); + TL_phone.leaveGroupCall req = new TL_phone.leaveGroupCall(); req.call = groupCall.getInputGroupCall(); req.source = mySource[CAPTURE_DEVICE_CAMERA]; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { @@ -1003,9 +1004,9 @@ private void startOutgoingCall() { g_a = correctedAuth; } - TLRPC.TL_phone_requestCall reqCall = new TLRPC.TL_phone_requestCall(); + TL_phone.requestCall reqCall = new TL_phone.requestCall(); reqCall.user_id = MessagesController.getInstance(currentAccount).getInputUser(user); - reqCall.protocol = new TLRPC.TL_phoneCallProtocol(); + reqCall.protocol = new TL_phone.TL_phoneCallProtocol(); reqCall.video = videoCall; reqCall.protocol.udp_p2p = true; reqCall.protocol.udp_reflector = true; @@ -1018,7 +1019,7 @@ private void startOutgoingCall() { ConnectionsManager.getInstance(currentAccount).sendRequest(reqCall, (response12, error12) -> AndroidUtilities.runOnUIThread(() -> { if (error12 == null) { - privateCall = ((TLRPC.TL_phone_phoneCall) response12).phone_call; + privateCall = ((TL_phone.TL_phone_phoneCall) response12).phone_call; a_or_b = salt1; dispatchStateChanged(STATE_WAITING); if (endCallAfterRequest) { @@ -1026,14 +1027,14 @@ private void startOutgoingCall() { return; } if (pendingUpdates.size() > 0 && privateCall != null) { - for (TLRPC.PhoneCall call : pendingUpdates) { + for (TL_phone.PhoneCall call : pendingUpdates) { onCallUpdated(call); } pendingUpdates.clear(); } timeoutRunnable = () -> { timeoutRunnable = null; - TLRPC.TL_phone_discardCall req1 = new TLRPC.TL_phone_discardCall(); + TL_phone.discardCall req1 = new TL_phone.discardCall(); req1.peer = new TLRPC.TL_inputPhoneCall(); req1.peer.access_hash = privateCall.access_hash; req1.peer.id = privateCall.id; @@ -1083,7 +1084,7 @@ private void acknowledgeCall(final boolean startRinging) { stopSelf(); return; } - if (privateCall instanceof TLRPC.TL_phoneCallDiscarded) { + if (privateCall instanceof TL_phone.TL_phoneCallDiscarded) { if (BuildVars.LOGS_ENABLED) { FileLog.w("Call " + privateCall.id + " was discarded before the service started, stopping"); } @@ -1099,7 +1100,7 @@ private void acknowledgeCall(final boolean startRinging) { return; } } - TLRPC.TL_phone_receivedCall req = new TLRPC.TL_phone_receivedCall(); + TL_phone.receivedCall req = new TL_phone.receivedCall(); req.peer = new TLRPC.TL_inputPhoneCall(); req.peer.id = privateCall.id; req.peer.access_hash = privateCall.access_hash; @@ -1272,7 +1273,7 @@ public void stopScreenCapture() { if (groupCall == null || videoState[CAPTURE_DEVICE_SCREEN] != Instance.VIDEO_STATE_ACTIVE) { return; } - TLRPC.TL_phone_leaveGroupCallPresentation req = new TLRPC.TL_phone_leaveGroupCallPresentation(); + TL_phone.leaveGroupCallPresentation req = new TL_phone.leaveGroupCallPresentation(); req.call = groupCall.getInputGroupCall(); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { if (response != null) { @@ -1512,7 +1513,7 @@ public void onGroupCallUpdated(TLRPC.GroupCall call) { } } - public void onCallUpdated(TLRPC.PhoneCall phoneCall) { + public void onCallUpdated(TL_phone.PhoneCall phoneCall) { if (user == null) { return; } @@ -1536,7 +1537,7 @@ public void onCallUpdated(TLRPC.PhoneCall phoneCall) { FileLog.d("Call updated: " + phoneCall); } privateCall = phoneCall; - if (phoneCall instanceof TLRPC.TL_phoneCallDiscarded) { + if (phoneCall instanceof TL_phone.TL_phoneCallDiscarded) { needSendDebugLog = phoneCall.need_debug; needRateCall = phoneCall.need_rating; if (BuildVars.LOGS_ENABLED) { @@ -1552,7 +1553,7 @@ public void onCallUpdated(TLRPC.PhoneCall phoneCall) { } else { callEnded(); } - } else if (phoneCall instanceof TLRPC.TL_phoneCall && authKey == null) { + } else if (phoneCall instanceof TL_phone.TL_phoneCall && authKey == null) { if (phoneCall.g_a_or_b == null) { if (BuildVars.LOGS_ENABLED) { FileLog.w("stopping VoIP service, Ga == null"); @@ -1608,7 +1609,7 @@ public void onCallUpdated(TLRPC.PhoneCall phoneCall) { } initiateActualEncryptedCall(); - } else if (phoneCall instanceof TLRPC.TL_phoneCallAccepted && authKey == null) { + } else if (phoneCall instanceof TL_phone.TL_phoneCallAccepted && authKey == null) { processAcceptedCall(); } else { if (currentState == STATE_WAITING && phoneCall.receive_date != 0) { @@ -1696,13 +1697,13 @@ private void processAcceptedCall() { long fingerprint = Utilities.bytesToLong(authKeyId); this.authKey = authKey; keyFingerprint = fingerprint; - TLRPC.TL_phone_confirmCall req = new TLRPC.TL_phone_confirmCall(); + TL_phone.confirmCall req = new TL_phone.confirmCall(); req.g_a = g_a; req.key_fingerprint = fingerprint; req.peer = new TLRPC.TL_inputPhoneCall(); req.peer.id = privateCall.id; req.peer.access_hash = privateCall.access_hash; - req.protocol = new TLRPC.TL_phoneCallProtocol(); + req.protocol = new TL_phone.TL_phoneCallProtocol(); req.protocol.max_layer = Instance.getConnectionMaxLayer(); req.protocol.min_layer = CALL_MIN_LAYER; req.protocol.udp_p2p = req.protocol.udp_reflector = true; @@ -1711,7 +1712,7 @@ private void processAcceptedCall() { if (error != null) { callFailed(); } else { - privateCall = ((TLRPC.TL_phone_phoneCall) response).phone_call; + privateCall = ((TL_phone.TL_phone_phoneCall) response).phone_call; initiateActualEncryptedCall(); } })); @@ -1775,7 +1776,7 @@ private void startGroupCall(int ssrc, String json, boolean create) { groupCall.createNoVideoParticipant(); dispatchStateChanged(STATE_CREATING); - TLRPC.TL_phone_createGroupCall req = new TLRPC.TL_phone_createGroupCall(); + TL_phone.createGroupCall req = new TL_phone.createGroupCall(); req.peer = MessagesController.getInputPeer(chat); req.random_id = Utilities.random.nextInt(); if (scheduleDate != 0) { @@ -1841,7 +1842,7 @@ private void startGroupCall(int ssrc, String json, boolean create) { if (BuildVars.LOGS_ENABLED) { FileLog.d("initital source = " + ssrc); } - TLRPC.TL_phone_joinGroupCall req = new TLRPC.TL_phone_joinGroupCall(); + TL_phone.joinGroupCall req = new TL_phone.joinGroupCall(); req.muted = true; req.video_stopped = videoState[CAPTURE_DEVICE_CAMERA] != Instance.VIDEO_STATE_ACTIVE; req.call = groupCall.getInputGroupCall(); @@ -1920,7 +1921,7 @@ private void startScreenCapture(int ssrc, String json) { return; } mySource[CAPTURE_DEVICE_SCREEN] = 0; - TLRPC.TL_phone_joinGroupCallPresentation req = new TLRPC.TL_phone_joinGroupCallPresentation(); + TL_phone.joinGroupCallPresentation req = new TL_phone.joinGroupCallPresentation(); req.call = groupCall.getInputGroupCall(); req.params = new TLRPC.TL_dataJSON(); req.params.data = json; @@ -2003,7 +2004,7 @@ private void startGroupCheckShortpoll() { if (shortPollRunnable == null || sharedInstance == null || groupCall == null || (mySource[CAPTURE_DEVICE_CAMERA] == 0 && mySource[CAPTURE_DEVICE_SCREEN] == 0 && !(groupCall.call != null && groupCall.call.rtmp_stream))) { return; } - TLRPC.TL_phone_checkGroupCall req = new TLRPC.TL_phone_checkGroupCall(); + TL_phone.checkGroupCall req = new TL_phone.checkGroupCall(); req.call = groupCall.getInputGroupCall(); for (int a = 0; a < mySource.length; a++) { if (mySource[a] != 0) { @@ -2018,15 +2019,16 @@ private void startGroupCheckShortpoll() { checkRequestId = 0; boolean recreateCamera = false; boolean recreateScreenCapture = false; - if (response instanceof TLRPC.Vector) { - TLRPC.Vector vector = (TLRPC.Vector) response; + if (response instanceof Vector) { + Vector vector = (Vector) response; + ArrayList res = vector.toIntArray(); if (mySource[CAPTURE_DEVICE_CAMERA] != 0 && req.sources.contains(mySource[CAPTURE_DEVICE_CAMERA])) { - if (!vector.objects.contains(mySource[CAPTURE_DEVICE_CAMERA])) { + if (!res.contains(mySource[CAPTURE_DEVICE_CAMERA])) { recreateCamera = true; } } if (mySource[CAPTURE_DEVICE_SCREEN] != 0 && req.sources.contains(mySource[CAPTURE_DEVICE_SCREEN])) { - if (!vector.objects.contains(mySource[CAPTURE_DEVICE_SCREEN])) { + if (!res.contains(mySource[CAPTURE_DEVICE_SCREEN])) { recreateScreenCapture = true; } } @@ -2234,7 +2236,7 @@ private void createGroupInstance(int type, boolean switchAccount) { }); }, taskPtr -> { if (groupCall != null && groupCall.call != null && groupCall.call.rtmp_stream) { - TLRPC.TL_phone_getGroupCallStreamChannels req = new TLRPC.TL_phone_getGroupCallStreamChannels(); + TL_phone.getGroupCallStreamChannels req = new TL_phone.getGroupCallStreamChannels(); req.call = groupCall.getInputGroupCall(); if (groupCall == null || groupCall.call == null || tgVoip[type] == null) { if (tgVoip[type] != null) { @@ -2245,7 +2247,7 @@ private void createGroupInstance(int type, boolean switchAccount) { ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error, responseTime) -> { long currentTime = 0; if (error == null) { - TLRPC.TL_phone_groupCallStreamChannels res = (TLRPC.TL_phone_groupCallStreamChannels) response; + TL_phone.groupCallStreamChannels res = (TL_phone.groupCallStreamChannels) response; if (!res.channels.isEmpty()) { currentTime = res.channels.get(0).last_timestamp_ms; } @@ -2583,14 +2585,12 @@ public void onSignalingData(byte[] data) { if (privateCall == null) { return; } - TLRPC.TL_phone_sendSignalingData req = new TLRPC.TL_phone_sendSignalingData(); + TL_phone.sendSignalingData req = new TL_phone.sendSignalingData(); req.peer = new TLRPC.TL_inputPhoneCall(); req.peer.access_hash = privateCall.access_hash; req.peer.id = privateCall.id; req.data = data; - ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { - - }); + ConnectionsManager.getInstance(currentAccount).sendRequest(req, null); } public boolean isVideoAvailable() { @@ -2717,7 +2717,7 @@ public void editCallMember(TLObject object, Boolean mute, Boolean muteVideo, Int if (object == null || groupCall == null) { return; } - TLRPC.TL_phone_editGroupCallParticipant req = new TLRPC.TL_phone_editGroupCallParticipant(); + TL_phone.editGroupCallParticipant req = new TL_phone.editGroupCallParticipant(); req.call = groupCall.getInputGroupCall(); if (object instanceof TLRPC.User) { TLRPC.User user = (TLRPC.User) object; @@ -3367,12 +3367,12 @@ public void acceptIncomingCall() { g_b_bytes = correctedAuth; } - TLRPC.TL_phone_acceptCall req1 = new TLRPC.TL_phone_acceptCall(); + TL_phone.acceptCall req1 = new TL_phone.acceptCall(); req1.g_b = g_b_bytes; req1.peer = new TLRPC.TL_inputPhoneCall(); req1.peer.id = privateCall.id; req1.peer.access_hash = privateCall.access_hash; - req1.protocol = new TLRPC.TL_phoneCallProtocol(); + req1.protocol = new TL_phone.TL_phoneCallProtocol(); req1.protocol.udp_p2p = req1.protocol.udp_reflector = true; req1.protocol.min_layer = CALL_MIN_LAYER; req1.protocol.max_layer = Instance.getConnectionMaxLayer(); @@ -3382,8 +3382,8 @@ public void acceptIncomingCall() { if (BuildVars.LOGS_ENABLED) { FileLog.w("accept call ok! " + response1); } - privateCall = ((TLRPC.TL_phone_phoneCall) response1).phone_call; - if (privateCall instanceof TLRPC.TL_phoneCallDiscarded) { + privateCall = ((TL_phone.TL_phone_phoneCall) response1).phone_call; + if (privateCall instanceof TL_phone.TL_phoneCallDiscarded) { onCallUpdated(privateCall); } } else { @@ -3433,7 +3433,7 @@ public void declineIncomingCall(int reason, final Runnable onDone) { } return; } - TLRPC.TL_phone_discardCall req = new TLRPC.TL_phone_discardCall(); + TL_phone.discardCall req = new TL_phone.discardCall(); req.peer = new TLRPC.TL_inputPhoneCall(); req.peer.access_hash = privateCall.access_hash; req.peer.id = privateCall.id; @@ -3544,7 +3544,7 @@ public void startRingtoneAndVibration() { private void updateServerConfig() { final SharedPreferences preferences = MessagesController.getMainSettings(currentAccount); Instance.setGlobalServerConfig(preferences.getString("voip_server_config", "{}")); - ConnectionsManager.getInstance(currentAccount).sendRequest(new TLRPC.TL_phone_getCallConfig(), (response, error) -> { + ConnectionsManager.getInstance(currentAccount).sendRequest(new TL_phone.getCallConfig(), (response, error) -> { if (error == null) { String data = ((TLRPC.TL_dataJSON) response).data; Instance.setGlobalServerConfig(data); @@ -3616,7 +3616,7 @@ private void onTgVoipStop(Instance.FinalState finalState) { } } if (needSendDebugLog && finalState.debugLog != null) { - TLRPC.TL_phone_saveCallDebug req = new TLRPC.TL_phone_saveCallDebug(); + TL_phone.saveCallDebug req = new TL_phone.saveCallDebug(); req.debug = new TLRPC.TL_dataJSON(); req.debug.data = finalState.debugLog; req.peer = new TLRPC.TL_inputPhoneCall(); @@ -4374,7 +4374,7 @@ private void callFailed(String error) { if (BuildVars.LOGS_ENABLED) { FileLog.d("Discarding failed call"); } - TLRPC.TL_phone_discardCall req = new TLRPC.TL_phone_discardCall(); + TL_phone.discardCall req = new TL_phone.discardCall(); req.peer = new TLRPC.TL_inputPhoneCall(); req.peer.access_hash = privateCall.access_hash; req.peer.id = privateCall.id; @@ -4451,8 +4451,7 @@ public void onConnectionStateChanged(int newState, boolean inTransition) { if (!isProximityNear && !privateCall.video) { try { LaunchActivity.getLastFragment().getFragmentView().performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - } catch (Exception ignore) { - } + } catch (Exception ignore) {} } AndroidUtilities.runOnUIThread(new Runnable() { @Override diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPServiceState.java b/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPServiceState.java index 1a8f5ab409..17ce623c07 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPServiceState.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPServiceState.java @@ -1,13 +1,14 @@ package org.telegram.messenger.voip; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_phone; public interface VoIPServiceState { public TLRPC.User getUser(); public boolean isOutgoing(); public int getCallState(); - public TLRPC.PhoneCall getPrivateCall(); + public TL_phone.PhoneCall getPrivateCall(); public default long getCallDuration() { return 0; diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/AbstractSerializedData.java b/TMessagesProj/src/main/java/org/telegram/tgnet/AbstractSerializedData.java index ff252fda7f..9b306a85cd 100644 --- a/TMessagesProj/src/main/java/org/telegram/tgnet/AbstractSerializedData.java +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/AbstractSerializedData.java @@ -1,6 +1,6 @@ package org.telegram.tgnet; -public abstract class AbstractSerializedData { +public abstract class AbstractSerializedData implements InputSerializedData, OutputSerializedData { public abstract void writeInt32(int x); diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java b/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java index 953b553c34..dc97e54764 100644 --- a/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java @@ -12,6 +12,8 @@ import android.text.TextUtils; import android.util.Base64; +import androidx.annotation.Keep; + import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; import com.google.android.gms.tasks.Task; import com.google.android.play.core.integrity.IntegrityManager; @@ -943,7 +945,6 @@ public static void setProxySettings(boolean enabled, String address, int port, S public static native void native_setLangCode(int currentAccount, String langCode); public static native void native_setRegId(int currentAccount, String regId); public static native void native_setSystemLangCode(int currentAccount, String langCode); - public static native void native_seSystemLangCode(int currentAccount, String langCode); public static native void native_setJava(boolean useJavaByteBuffers); public static native void native_setPushConnectionEnabled(int currentAccount, boolean value); public static native void native_applyDnsConfig(int currentAccount, long address, String phone, int date); @@ -952,7 +953,6 @@ public static void setProxySettings(boolean enabled, String address, int port, S public static native void native_discardConnection(int currentAccount, int datacenterId, int connectionType); public static native void native_failNotRunningRequest(int currentAccount, int token); public static native void native_receivedIntegrityCheckClassic(int currentAccount, int requestToken, String nonce, String token); - public static native boolean native_isGoodPrime(byte[] prime, int g); public static int generateClassGuid() { @@ -1481,6 +1481,7 @@ protected void onPostExecute(NativeByteBuffer result) { } public static long lastPremiumFloodWaitShown = 0; + @Keep public static void onPremiumFloodWait(final int currentAccount, final int requestToken, boolean isUpload) { AndroidUtilities.runOnUIThread(() -> { if (UserConfig.selectedAccount != currentAccount) { @@ -1509,6 +1510,7 @@ public static void onPremiumFloodWait(final int currentAccount, final int reques }); } + @Keep public static void onIntegrityCheckClassic(final int currentAccount, final int requestToken, final String project, final String nonce) { AndroidUtilities.runOnUIThread(() -> { long start = System.currentTimeMillis(); diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/InputSerializedData.java b/TMessagesProj/src/main/java/org/telegram/tgnet/InputSerializedData.java new file mode 100644 index 0000000000..7ac7d9b707 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/InputSerializedData.java @@ -0,0 +1,22 @@ +package org.telegram.tgnet; + +public interface InputSerializedData { + + boolean readBool(boolean exception); + int readInt32(boolean exception); + long readInt64(boolean exception); + byte readByte(boolean exception); + void readBytes(byte[] b, boolean exception); + byte[] readData(int count, boolean exception); + String readString(boolean exception); + byte[] readByteArray(boolean exception); + float readFloat(boolean exception); + double readDouble(boolean exception); + NativeByteBuffer readByteBuffer(boolean exception); + + int length(); + void skip(int count); + int getPosition(); + int remaining(); + +} diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/OutputSerializedData.java b/TMessagesProj/src/main/java/org/telegram/tgnet/OutputSerializedData.java new file mode 100644 index 0000000000..50ac1e7ea9 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/OutputSerializedData.java @@ -0,0 +1,22 @@ +package org.telegram.tgnet; + +public interface OutputSerializedData { + + void writeInt32(int x); + void writeInt64(long x); + void writeBool(boolean value); + void writeBytes(byte[] b); + void writeBytes(byte[] b, int offset, int count); + void writeByte(int i); + void writeByte(byte b); + void writeString(String s); + void writeByteArray(byte[] b, int offset, int count); + void writeByteArray(byte[] b); + void writeFloat(float f); + void writeDouble(double d); + void writeByteBuffer(NativeByteBuffer buffer); + + void skip(int count); + int getPosition(); + +} diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/TLObject.java b/TMessagesProj/src/main/java/org/telegram/tgnet/TLObject.java index 16c441f17e..bdd98de3b2 100644 --- a/TMessagesProj/src/main/java/org/telegram/tgnet/TLObject.java +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/TLObject.java @@ -20,19 +20,17 @@ protected NativeByteBuffer initialValue() { } }; - public TLObject() { + public TLObject() {} - } - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { } - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return null; } diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java b/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java index 029bd47c90..e67fc482ac 100644 --- a/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java @@ -27,8 +27,10 @@ import org.telegram.messenger.MessagesController; import org.telegram.messenger.SvgHelper; import org.telegram.messenger.Utilities; +import org.telegram.tgnet.tl.TL_account; import org.telegram.tgnet.tl.TL_bots; import org.telegram.tgnet.tl.TL_payments; +import org.telegram.tgnet.tl.TL_phone; import org.telegram.tgnet.tl.TL_stars; import org.telegram.tgnet.tl.TL_stats; import org.telegram.tgnet.tl.TL_stories; @@ -40,34 +42,6 @@ public class TLRPC { - public static final int USER_FLAG_ACCESS_HASH = 0x00000001; - public static final int USER_FLAG_FIRST_NAME = 0x00000002; - public static final int USER_FLAG_LAST_NAME = 0x00000004; - public static final int USER_FLAG_USERNAME = 0x00000008; - public static final int USER_FLAG_PHONE = 0x00000010; - public static final int USER_FLAG_PHOTO = 0x00000020; - public static final int USER_FLAG_STATUS = 0x00000040; - public static final int USER_FLAG_UNUSED = 0x00000080; - public static final int USER_FLAG_UNUSED2 = 0x00000100; - public static final int USER_FLAG_UNUSED3 = 0x00000200; - //public static final int USER_FLAG_SELF = 0x00000400; - //public static final int USER_FLAG_CONTACT = 0x00000800; - //public static final int USER_FLAG_MUTUAL_CONTACT = 0x00001000; - //public static final int USER_FLAG_DELETED = 0x00002000; - //public static final int USER_FLAG_BOT = 0x00004000; - //public static final int USER_FLAG_BOT_READING_HISTORY = 0x00008000; - //public static final int USER_FLAG_BOT_CANT_JOIN_GROUP = 0x00010000; - //public static final int USER_FLAG_VERIFIED = 0x00020000; - - //public static final int CHAT_FLAG_CREATOR = 0x00000001; - //public static final int CHAT_FLAG_USER_KICKED = 0x00000002; - //public static final int CHAT_FLAG_USER_LEFT = 0x00000004; - //public static final int CHAT_FLAG_USER_IS_EDITOR = 0x00000008; - //public static final int CHAT_FLAG_USER_IS_MODERATOR = 0x00000010; - //public static final int CHAT_FLAG_IS_BROADCAST = 0x00000020; - public static final int CHAT_FLAG_IS_PUBLIC = 0x00000040; - //public static final int CHAT_FLAG_IS_VERIFIED = 0x00000080; - //public static final int MESSAGE_FLAG_UNREAD = 0x00000001; //public static final int MESSAGE_FLAG_OUT = 0x00000002; public static final int MESSAGE_FLAG_FWD = 0x00000004; @@ -82,20 +56,20 @@ public class TLRPC { public static final int MESSAGE_FLAG_HAS_BOT_ID = 0x00000800; public static final int MESSAGE_FLAG_EDITED = 0x00008000; - public static final int LAYER = 195; + public static final int LAYER = 198; public static abstract class EmailVerifyPurpose extends TLObject { - public static EmailVerifyPurpose TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static EmailVerifyPurpose TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { EmailVerifyPurpose result = null; switch (constructor) { - case 0x4345be73: + case TL_emailVerifyPurposeLoginSetup.constructor: result = new TL_emailVerifyPurposeLoginSetup(); break; - case 0x527d22eb: + case TL_emailVerifyPurposeLoginChange.constructor: result = new TL_emailVerifyPurposeLoginChange(); break; - case 0xbbf51685: + case TL_emailVerifyPurposePassport.constructor: result = new TL_emailVerifyPurposePassport(); break; } @@ -115,12 +89,12 @@ public static class TL_emailVerifyPurposeLoginSetup extends EmailVerifyPurpose { public String phone_number; public String phone_code_hash; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { phone_number = stream.readString(exception); phone_code_hash = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(phone_number); stream.writeString(phone_code_hash); @@ -130,8 +104,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_emailVerifyPurposeLoginChange extends EmailVerifyPurpose { public static final int constructor = 0x527d22eb; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -139,33 +112,32 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_emailVerifyPurposePassport extends EmailVerifyPurpose { public static final int constructor = 0xbbf51685; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } public static abstract class EmailVerification extends TLObject { - public static EmailVerification TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - EmailVerification result = null; + public static EmailVerification TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + EmailVerification result; switch (constructor) { - case 0x922e55a9: + case TL_emailVerificationCode.constructor: result = new TL_emailVerificationCode(); break; - case 0xdb909ec2: + case TL_emailVerificationGoogle.constructor: result = new TL_emailVerificationGoogle(); break; - case 0x96d074fd: + case TL_emailVerificationApple.constructor: result = new TL_emailVerificationApple(); break; + default: + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in EmailVerification", constructor)); + } + return null; } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in EmailVerification", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } + result.readParams(stream, exception); return result; } } @@ -175,11 +147,11 @@ public static class TL_emailVerificationCode extends EmailVerification { public String code; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { code = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(code); } @@ -190,11 +162,11 @@ public static class TL_emailVerificationGoogle extends EmailVerification { public String token; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { token = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(token); } @@ -205,71 +177,16 @@ public static class TL_emailVerificationApple extends EmailVerification { public String token; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { token = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(token); } } - public static abstract class account_EmailVerified extends TLObject { - - public static account_EmailVerified TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - account_EmailVerified result = null; - switch (constructor) { - case 0x2b96cd1b: - result = new TL_account_emailVerified(); - break; - case 0xe1bb0d61: - result = new TL_account_emailVerifiedLogin(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in account_EmailVerified", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } - - public static class TL_account_emailVerified extends account_EmailVerified { - public static final int constructor = 0x2b96cd1b; - - public String email; - - public void readParams(AbstractSerializedData stream, boolean exception) { - email = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(email); - } - } - - public static class TL_account_emailVerifiedLogin extends account_EmailVerified { - public static final int constructor = 0xe1bb0d61; - - public String email; - public auth_SentCode sent_code; - - public void readParams(AbstractSerializedData stream, boolean exception) { - email = stream.readString(exception); - sent_code = auth_SentCode.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(email); - sent_code.serializeToStream(stream); - } - } - public static class TL_chatBannedRights extends TLObject { public static final int constructor = 0x9f120418; @@ -296,7 +213,7 @@ public static class TL_chatBannedRights extends TLObject { public boolean send_plain; public int until_date; - public static TL_chatBannedRights TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_chatBannedRights TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_chatBannedRights.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_chatBannedRights", constructor)); @@ -309,7 +226,20 @@ public static TL_chatBannedRights TLdeserialize(AbstractSerializedData stream, i return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public static TL_chatBannedRights clone(TL_chatBannedRights rights) { + if (rights == null) return null; + SerializedData data = new SerializedData(rights.getObjectSize()); + rights.serializeToStream(data); + return TLdeserialize(data, data.readInt32(false), false); + } + + @Override + public boolean equals(@Nullable Object obj) { + if (!(obj instanceof TL_chatBannedRights)) return false; + return this.flags == ((TL_chatBannedRights) obj).flags; + } + + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); view_messages = (flags & 1) != 0; send_messages = (flags & 2) != 0; @@ -342,7 +272,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { until_date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); if (send_photos && send_videos && send_roundvideos && send_audios && send_voices && send_docs) { send_media = true; @@ -384,7 +314,7 @@ public static class TL_stickers_suggestedShortName extends TLObject { public String short_name; - public static TL_stickers_suggestedShortName TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_stickers_suggestedShortName TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_stickers_suggestedShortName.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_stickers_suggestedShortName", constructor)); @@ -397,11 +327,11 @@ public static TL_stickers_suggestedShortName TLdeserialize(AbstractSerializedDat return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { short_name = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(short_name); } @@ -419,7 +349,7 @@ public static abstract class DraftMessage extends TLObject { public int date; public long effect; - public static DraftMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static DraftMessage TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { DraftMessage result = null; switch (constructor) { case TL_draftMessageEmpty.constructor: @@ -451,15 +381,14 @@ public static DraftMessage TLdeserialize(AbstractSerializedData stream, int cons public static class TL_draftMessageEmpty extends DraftMessage { public static final int constructor = 0x1b0c841a; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { date = stream.readInt32(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -471,8 +400,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_draftMessageEmpty_layer81 extends TL_draftMessageEmpty { public static final int constructor = 0xba4baec5; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -480,7 +408,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_draftMessage extends DraftMessage { public static final int constructor = 0x2d65321f; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); no_webpage = (flags & 2) != 0; invert_media = (flags & 64) != 0; @@ -489,21 +417,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } message = stream.readString(exception); if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } if ((flags & 32) != 0) { media = InputMedia.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -514,7 +428,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = no_webpage ? (flags | 2) : (flags &~ 2); flags = invert_media ? (flags | 64) : (flags &~ 64); @@ -524,12 +438,7 @@ public void serializeToStream(AbstractSerializedData stream) { } stream.writeString(message); if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } if ((flags & 32) != 0) { media.serializeToStream(stream); @@ -544,7 +453,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_draftMessage_layer181 extends TL_draftMessage { public static final int constructor = 0x3fccf7ef; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); no_webpage = (flags & 2) != 0; invert_media = (flags & 64) != 0; @@ -553,21 +462,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } message = stream.readString(exception); if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } if ((flags & 32) != 0) { media = InputMedia.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -575,7 +470,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = no_webpage ? (flags | 2) : (flags &~ 2); flags = invert_media ? (flags | 64) : (flags &~ 64); @@ -585,12 +480,7 @@ public void serializeToStream(AbstractSerializedData stream) { } stream.writeString(message); if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } if ((flags & 32) != 0) { media.serializeToStream(stream); @@ -602,7 +492,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_draftMessage_layer165 extends TL_draftMessage { public static final int constructor = 0xfd8e711f; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); no_webpage = (flags & 2) != 0; if ((flags & 1) != 0) { @@ -613,26 +503,12 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } message = stream.readString(exception); if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = no_webpage ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); @@ -641,12 +517,7 @@ public void serializeToStream(AbstractSerializedData stream) { } stream.writeString(message); if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } stream.writeInt32(date); } @@ -663,11 +534,11 @@ public static abstract class ChatPhoto extends TLObject { public long photo_id; public BitmapDrawable strippedBitmap; - public static ChatPhoto TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static ChatPhoto TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { return TLdeserialize(stream, constructor, exception, true); } - public static ChatPhoto TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception, boolean allowStripedThumb) { + public static ChatPhoto TLdeserialize(InputSerializedData stream, int constructor, boolean exception, boolean allowStripedThumb) { ChatPhoto result = null; switch (constructor) { case 0x1c6e1c11: @@ -702,11 +573,11 @@ public static ChatPhoto TLdeserialize(AbstractSerializedData stream, int constru public static class TL_chatPhoto extends ChatPhoto { public static final int constructor = 0x1c6e1c11; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { readParams(stream, exception, true); } - public void readParams(AbstractSerializedData stream, boolean exception, boolean allowStripedThumbs) { + public void readParams(InputSerializedData stream, boolean exception, boolean allowStripedThumbs) { flags = stream.readInt32(exception); has_video = (flags & 1) != 0; photo_id = stream.readInt64(exception); @@ -730,7 +601,7 @@ public void readParams(AbstractSerializedData stream, boolean exception, boolean } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = has_video ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -745,14 +616,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatPhoto_layer115 extends TL_chatPhoto { public static final int constructor = 0x475cdbd5; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { photo_small = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); photo_big = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); dc_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); photo_small.serializeToStream(stream); photo_big.serializeToStream(stream); @@ -763,8 +633,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatPhotoEmpty extends ChatPhoto { public static final int constructor = 0x37c1011c; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -772,13 +641,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatPhoto_layer97 extends TL_chatPhoto { public static final int constructor = 0x6153276a; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { photo_small = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); photo_big = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); photo_small.serializeToStream(stream); photo_big.serializeToStream(stream); @@ -788,8 +656,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatPhoto_layer126 extends TL_chatPhoto { public static final int constructor = 0xd20b9f3c; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); has_video = (flags & 1) != 0; photo_small = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -797,7 +664,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { dc_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = has_video ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -810,8 +677,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatPhoto_layer127 extends TL_chatPhoto { public static final int constructor = 0x4790ee05; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); has_video = (flags & 1) != 0; photo_small = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -829,7 +695,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { dc_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = has_video ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -852,7 +718,7 @@ public static class TL_help_termsOfService extends TLObject { public ArrayList entities = new ArrayList<>(); public int min_age_confirm; - public static TL_help_termsOfService TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_help_termsOfService TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_help_termsOfService.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_help_termsOfService", constructor)); @@ -865,43 +731,24 @@ public static TL_help_termsOfService TLdeserialize(AbstractSerializedData stream return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); popup = (flags & 1) != 0; id = TL_dataJSON.TLdeserialize(stream, stream.readInt32(exception), exception); text = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); if ((flags & 2) != 0) { min_age_confirm = stream.readInt32(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = popup ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); id.serializeToStream(stream); stream.writeString(text); - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); if ((flags & 2) != 0) { stream.writeInt32(min_age_confirm); } @@ -928,7 +775,7 @@ public static class PaymentReceipt extends TLObject { public ArrayList users = new ArrayList<>(); public String transaction_id; - public static PaymentReceipt TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static PaymentReceipt TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { PaymentReceipt result = null; switch (constructor) { case TL_payments_paymentReceipt.constructor: @@ -951,7 +798,7 @@ public static PaymentReceipt TLdeserialize(AbstractSerializedData stream, int co public static class TL_payments_paymentReceipt extends PaymentReceipt { public static final int constructor = 0x70c4fe03; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); date = stream.readInt32(exception); bot_id = stream.readInt64(exception); @@ -974,24 +821,10 @@ public void readParams(AbstractSerializedData stream, boolean exception) { currency = stream.readString(exception); total_amount = stream.readInt64(exception); credentials_title = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32(date); @@ -1015,19 +848,14 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeString(currency); stream.writeInt64(total_amount); stream.writeString(credentials_title); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, users); } } public static class TL_payments_paymentReceiptStars extends PaymentReceipt { public static final int constructor = 0xdabbf83a; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); date = stream.readInt32(exception); bot_id = stream.readInt64(exception); @@ -1040,24 +868,10 @@ public void readParams(AbstractSerializedData stream, boolean exception) { currency = stream.readString(exception); total_amount = stream.readInt64(exception); transaction_id = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32(date); @@ -1071,18 +885,13 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeString(currency); stream.writeInt64(total_amount); stream.writeString(transaction_id); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, users); } } public static abstract class NotifyPeer extends TLObject { - public static NotifyPeer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static NotifyPeer TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { NotifyPeer result = null; switch (constructor) { case 0x226e6308: @@ -1117,12 +926,12 @@ public static class TL_notifyForumTopic extends NotifyPeer { public Peer peer; public int top_msg_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); top_msg_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(top_msg_id); @@ -1132,8 +941,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_notifyBroadcasts extends NotifyPeer { public static final int constructor = 0xd612e8ef; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -1141,8 +949,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_notifyChats extends NotifyPeer { public static final int constructor = 0xc007cec3; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -1150,8 +957,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_notifyUsers extends NotifyPeer { public static final int constructor = 0xb4c83b4c; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -1161,107 +967,16 @@ public static class TL_notifyPeer extends NotifyPeer { public Peer peer; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); } } - public static class TL_phone_joinAsPeers extends TLObject { - public static final int constructor = 0xafe5623f; - - public ArrayList peers = new ArrayList<>(); - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); - - public static TL_phone_joinAsPeers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_phone_joinAsPeers.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_phone_joinAsPeers", constructor)); - } else { - return null; - } - } - TL_phone_joinAsPeers result = new TL_phone_joinAsPeers(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Peer object = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - peers.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - peers.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } - public static class TL_emojiKeywordsDifference extends TLObject { public static final int constructor = 0x5cc761bd; @@ -1270,7 +985,7 @@ public static class TL_emojiKeywordsDifference extends TLObject { public int version; public ArrayList keywords = new ArrayList<>(); - public static TL_emojiKeywordsDifference TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_emojiKeywordsDifference TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_emojiKeywordsDifference.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_emojiKeywordsDifference", constructor)); @@ -1283,38 +998,19 @@ public static TL_emojiKeywordsDifference TLdeserialize(AbstractSerializedData st return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { lang_code = stream.readString(exception); from_version = stream.readInt32(exception); version = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - EmojiKeyword object = EmojiKeyword.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - keywords.add(object); - } + keywords = Vector.deserialize(stream, EmojiKeyword::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(lang_code); stream.writeInt32(from_version); stream.writeInt32(version); - stream.writeInt32(0x1cb5c415); - int count = keywords.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - keywords.get(a).serializeToStream(stream); - } + Vector.serialize(stream, keywords); } } @@ -1322,7 +1018,7 @@ public static abstract class messages_SentEncryptedMessage extends TLObject { public int date; public EncryptedFile file; - public static messages_SentEncryptedMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static messages_SentEncryptedMessage TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { messages_SentEncryptedMessage result = null; switch (constructor) { case 0x560f8935: @@ -1345,12 +1041,11 @@ public static messages_SentEncryptedMessage TLdeserialize(AbstractSerializedData public static class TL_messages_sentEncryptedMessage extends messages_SentEncryptedMessage { public static final int constructor = 0x560f8935; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(date); } @@ -1359,13 +1054,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messages_sentEncryptedFile extends messages_SentEncryptedMessage { public static final int constructor = 0x9493ff32; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { date = stream.readInt32(exception); file = EncryptedFile.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(date); file.serializeToStream(stream); @@ -1385,7 +1079,7 @@ public static class TL_premiumSubscriptionOption extends TLObject { public String bot_url; public String store_product; - public static TL_premiumSubscriptionOption TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_premiumSubscriptionOption TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { TL_premiumSubscriptionOption result = null; switch (constructor) { case 0x5f2d1df2: @@ -1404,7 +1098,7 @@ public static TL_premiumSubscriptionOption TLdeserialize(AbstractSerializedData return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); current = (flags & 2) != 0; if ((flags & 8) != 0) { @@ -1420,7 +1114,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = current ? (flags | 2) : (flags &~ 2); flags = can_purchase_upgrade ? (flags | 4) : (flags &~ 4); @@ -1441,8 +1135,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_premiumSubscriptionOption_layer151 extends TL_premiumSubscriptionOption { public static final int constructor = 0xb6f11ebe; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); months = stream.readInt32(exception); currency = stream.readString(exception); @@ -1453,7 +1146,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32(months); @@ -1476,7 +1169,7 @@ public static class TL_premiumGiftOption extends TLObject { public String bot_url; public String store_product; - public static TL_premiumGiftOption TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_premiumGiftOption TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_premiumGiftOption.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_premiumGiftOption", constructor)); @@ -1489,7 +1182,7 @@ public static TL_premiumGiftOption TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); months = stream.readInt32(exception); currency = stream.readString(exception); @@ -1500,7 +1193,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32(months); @@ -1519,7 +1212,7 @@ public static class TL_error extends TLObject { public int code; public String text; - public static TL_error TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_error TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_error.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_error", constructor)); @@ -1532,12 +1225,12 @@ public static TL_error TLdeserialize(AbstractSerializedData stream, int construc return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { code = stream.readInt32(exception); text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(code); stream.writeString(text); @@ -1546,7 +1239,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class UrlAuthResult extends TLObject { - public static UrlAuthResult TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static UrlAuthResult TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { UrlAuthResult result = null; switch (constructor) { case 0xa9d6db1f: @@ -1572,8 +1265,7 @@ public static UrlAuthResult TLdeserialize(AbstractSerializedData stream, int con public static class TL_urlAuthResultDefault extends UrlAuthResult { public static final int constructor = 0xa9d6db1f; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -1586,14 +1278,14 @@ public static class TL_urlAuthResultRequest extends UrlAuthResult { public User bot; public String domain; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); request_write_access = (flags & 1) != 0; bot = User.TLdeserialize(stream, stream.readInt32(exception), exception); domain = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = request_write_access ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -1607,11 +1299,11 @@ public static class TL_urlAuthResultAccepted extends UrlAuthResult { public String url; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); } @@ -1624,7 +1316,7 @@ public static class TL_messages_chatFull extends TLObject { public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_messages_chatFull TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_chatFull TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_chatFull.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_chatFull", constructor)); @@ -1637,97 +1329,17 @@ public static TL_messages_chatFull TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { full_chat = ChatFull.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); full_chat.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } - - public static class TL_account_passwordSettings extends TLObject { - public static final int constructor = 0x9a5c33e5; - - public int flags; - public String email; - public TL_secureSecretSettings secure_settings; - - public static TL_account_passwordSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_account_passwordSettings.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_account_passwordSettings", constructor)); - } else { - return null; - } - } - TL_account_passwordSettings result = new TL_account_passwordSettings(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - if ((flags & 1) != 0) { - email = stream.readString(exception); - } - if ((flags & 2) != 0) { - secure_settings = TL_secureSecretSettings.TLdeserialize(stream, stream.readInt32(exception), exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - stream.writeString(email); - } - if ((flags & 2) != 0) { - secure_settings.serializeToStream(stream); - } + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } @@ -1752,7 +1364,7 @@ public static abstract class DocumentAttribute extends TLObject { public boolean nosound; public String video_codec; - public static DocumentAttribute TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static DocumentAttribute TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { DocumentAttribute result = null; switch (constructor) { case 0x3a556302: @@ -1820,13 +1432,12 @@ public static DocumentAttribute TLdeserialize(AbstractSerializedData stream, int public static class TL_documentAttributeSticker_layer55 extends TL_documentAttributeSticker { public static final int constructor = 0x3a556302; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { alt = stream.readString(exception); stickerset = InputStickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(alt); stickerset.serializeToStream(stream); @@ -1836,12 +1447,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_documentAttributeAudio_old extends TL_documentAttributeAudio { public static final int constructor = 0x51448e5; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { duration = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) duration); } @@ -1850,8 +1460,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_documentAttributeSticker extends DocumentAttribute { public static final int constructor = 0x6319d612; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); mask = (flags & 2) != 0; alt = stream.readString(exception); @@ -1861,7 +1470,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = mask ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); @@ -1876,8 +1485,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_documentAttributeAnimated extends DocumentAttribute { public static final int constructor = 0x11b58939; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -1885,12 +1493,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_documentAttributeFilename extends DocumentAttribute { public static final int constructor = 0x15590068; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { file_name = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(file_name); } @@ -1899,7 +1506,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_documentAttributeVideo extends DocumentAttribute { public static final int constructor = 0x43c57c48; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); round_message = (flags & 1) != 0; supports_streaming = (flags & 2) != 0; @@ -1918,7 +1525,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = round_message ? (flags | 1) : (flags &~ 1); flags = supports_streaming ? (flags | 2) : (flags &~ 2); @@ -1942,7 +1549,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_documentAttributeVideo_layer187 extends TL_documentAttributeVideo { public static final int constructor = 0x17399fad; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); round_message = (flags & 1) != 0; supports_streaming = (flags & 2) != 0; @@ -1958,7 +1565,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = round_message ? (flags | 1) : (flags &~ 1); flags = supports_streaming ? (flags | 2) : (flags &~ 2); @@ -1979,7 +1586,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_documentAttributeVideo_layer184 extends TL_documentAttributeVideo { public static final int constructor = 0xd38ff1c2; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); round_message = (flags & 1) != 0; supports_streaming = (flags & 2) != 0; @@ -1992,7 +1599,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = round_message ? (flags | 1) : (flags &~ 1); flags = supports_streaming ? (flags | 2) : (flags &~ 2); @@ -2010,7 +1617,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_documentAttributeVideo_layer159 extends TL_documentAttributeVideo { public static final int constructor = 0xef02ce6; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); round_message = (flags & 1) != 0; supports_streaming = (flags & 2) != 0; @@ -2019,7 +1626,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { h = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = round_message ? (flags | 1) : (flags &~ 1); flags = supports_streaming ? (flags | 2) : (flags &~ 2); @@ -2033,14 +1640,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_documentAttributeVideo_layer65 extends TL_documentAttributeVideo { public static final int constructor = 0x5910cccb; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { duration = stream.readInt32(exception); w = stream.readInt32(exception); h = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) duration); stream.writeInt32(w); @@ -2051,14 +1657,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_documentAttributeAudio_layer45 extends TL_documentAttributeAudio { public static final int constructor = 0xded218e0; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { duration = stream.readInt32(exception); title = stream.readString(exception); performer = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) duration); stream.writeString(title); @@ -2069,11 +1674,10 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_documentAttributeSticker_old extends TL_documentAttributeSticker { public static final int constructor = 0xfb0a5727; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -2081,8 +1685,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_documentAttributeHasStickers extends DocumentAttribute { public static final int constructor = 0x9801d2f7; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -2090,12 +1693,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_documentAttributeSticker_old2 extends TL_documentAttributeSticker { public static final int constructor = 0x994c9882; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { alt = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(alt); } @@ -2104,13 +1706,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_documentAttributeImageSize extends DocumentAttribute { public static final int constructor = 0x6c37c15c; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { w = stream.readInt32(exception); h = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(w); stream.writeInt32(h); @@ -2120,8 +1721,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_documentAttributeAudio extends DocumentAttribute { public static final int constructor = 0x9852f9c6; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); voice = (flags & 1024) != 0; duration = stream.readInt32(exception); @@ -2136,7 +1736,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = voice ? (flags | 1024) : (flags &~ 1024); stream.writeInt32(flags); @@ -2159,7 +1759,7 @@ public static class TL_documentAttributeCustomEmoji extends DocumentAttribute { public boolean free; public boolean text_color; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); free = (flags & 1) != 0; text_color = (flags & 2) != 0; @@ -2167,7 +1767,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { stickerset = InputStickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = free ? (flags | 1) : (flags &~ 1); flags = text_color ? (flags | 2) : (flags &~ 2); @@ -2182,12 +1782,12 @@ public static class TL_textPhone extends RichText { public String phone; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); phone = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); stream.writeString(phone); @@ -2197,11 +1797,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_textSuperscript extends RichText { public static final int constructor = 0xc7fb5e01; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); } @@ -2215,13 +1815,13 @@ public static class TL_textImage extends RichText { public int w; public int h; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { document_id = stream.readInt64(exception); w = stream.readInt32(exception); h = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(document_id); stream.writeInt32(w); @@ -2232,8 +1832,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_textEmpty extends RichText { public static final int constructor = 0xdc3d824f; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -2241,13 +1840,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_textUrl extends RichText { public static final int constructor = 0x3c2884c1; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); url = stream.readString(exception); webpage_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); stream.writeString(url); @@ -2259,12 +1858,12 @@ public static class TL_textAnchor extends RichText { public static final int constructor = 0x35553762; public String name; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); name = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); stream.writeString(name); @@ -2274,11 +1873,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_textStrike extends RichText { public static final int constructor = 0x9bf8bb95; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); } @@ -2287,11 +1886,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_textMarked extends RichText { public static final int constructor = 0x34b8621; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); } @@ -2300,11 +1899,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_textFixed extends RichText { public static final int constructor = 0x6c3f19b9; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); } @@ -2313,12 +1912,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_textEmail extends RichText { public static final int constructor = 0xde5a0dd6; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); email = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); stream.writeString(email); @@ -2330,11 +1929,11 @@ public static class TL_textPlain extends RichText { public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(text); } @@ -2343,44 +1942,24 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_textConcat extends RichText { public static final int constructor = 0x7e6260d7; - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RichText object = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - texts.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + texts = Vector.deserialize(stream, RichText::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = texts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - texts.get(a).serializeToStream(stream); - } + Vector.serialize(stream, texts); } } public static class TL_textBold extends RichText { public static final int constructor = 0x6724abc4; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); } @@ -2389,11 +1968,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_textItalic extends RichText { public static final int constructor = 0xd912a59c; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); } @@ -2402,11 +1981,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_textUnderline extends RichText { public static final int constructor = 0xc12622c4; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); } @@ -2415,11 +1994,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_textSubscript extends RichText { public static final int constructor = 0xed6a8504; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); } @@ -2430,7 +2009,7 @@ public static class TL_statsURL extends TLObject { public String url; - public static TL_statsURL TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_statsURL TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_statsURL.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_statsURL", constructor)); @@ -2443,11 +2022,11 @@ public static TL_statsURL TLdeserialize(AbstractSerializedData stream, int const return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); } @@ -2459,7 +2038,7 @@ public static class TL_popularContact extends TLObject { public long client_id; public int importers; - public static TL_popularContact TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_popularContact TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_popularContact.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_popularContact", constructor)); @@ -2472,12 +2051,12 @@ public static TL_popularContact TLdeserialize(AbstractSerializedData stream, int return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { client_id = stream.readInt64(exception); importers = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(client_id); stream.writeInt32(importers); @@ -2495,7 +2074,7 @@ public static class TL_messages_botCallbackAnswer extends TLObject { public String url; public int cache_time; - public static TL_messages_botCallbackAnswer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_botCallbackAnswer TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_botCallbackAnswer.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_botCallbackAnswer", constructor)); @@ -2508,7 +2087,7 @@ public static TL_messages_botCallbackAnswer TLdeserialize(AbstractSerializedData return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); alert = (flags & 2) != 0; has_url = (flags & 8) != 0; @@ -2522,7 +2101,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { cache_time = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = alert ? (flags | 2) : (flags &~ 2); flags = has_url ? (flags | 8) : (flags &~ 8); @@ -2544,7 +2123,7 @@ public static class TL_contactStatus extends TLObject { public long user_id; public UserStatus status; - public static TL_contactStatus TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_contactStatus TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_contactStatus.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_contactStatus", constructor)); @@ -2557,12 +2136,12 @@ public static TL_contactStatus TLdeserialize(AbstractSerializedData stream, int return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); status.serializeToStream(stream); @@ -2591,16 +2170,20 @@ public static abstract class GroupCall extends TLObject { public int duration; public boolean rtmp_stream; public boolean listeners_hidden; + public long conference_from_call; - public static GroupCall TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static GroupCall TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { GroupCall result = null; switch (constructor) { - case 0x7780bcb4: + case TL_groupCallDiscarded.constructor: result = new TL_groupCallDiscarded(); break; - case 0xd597650c: + case TL_groupCall.constructor: result = new TL_groupCall(); break; + case TL_groupCall_layer195.constructor: + result = new TL_groupCall_layer195(); + break; } if (result == null && exception) { throw new RuntimeException(String.format("can't parse magic %x in GroupCall", constructor)); @@ -2615,14 +2198,13 @@ public static GroupCall TLdeserialize(AbstractSerializedData stream, int constru public static class TL_groupCallDiscarded extends GroupCall { public static final int constructor = 0x7780bcb4; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); duration = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -2631,10 +2213,84 @@ public void serializeToStream(AbstractSerializedData stream) { } public static class TL_groupCall extends GroupCall { - public static final int constructor = 0xd597650c; + public static final int constructor = 0xcdf8d3e3; + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + join_muted = (flags & 2) != 0; + can_change_join_muted = (flags & 4) != 0; + join_date_asc = (flags & 64) != 0; + schedule_start_subscribed = (flags & 256) != 0; + can_start_video = (flags & 512) != 0; + record_video_active = (flags & 2048) != 0; + rtmp_stream = (flags & 4096) != 0; + listeners_hidden = (flags & 8192) != 0; + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + participants_count = stream.readInt32(exception); + if ((flags & 8) != 0) { + title = stream.readString(exception); + } + if ((flags & 16) != 0) { + stream_dc_id = stream.readInt32(exception); + } + if ((flags & 32) != 0) { + record_start_date = stream.readInt32(exception); + } + if ((flags & 128) != 0) { + schedule_date = stream.readInt32(exception); + } + if ((flags & 1024) != 0) { + unmuted_video_count = stream.readInt32(exception); + } + unmuted_video_limit = stream.readInt32(exception); + version = stream.readInt32(exception); + if ((flags & 16384) != 0) { + conference_from_call = stream.readInt64(exception); + } + } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = join_muted ? (flags | 2) : (flags &~ 2); + flags = can_change_join_muted ? (flags | 4) : (flags &~ 4); + flags = join_date_asc ? (flags | 64) : (flags &~ 64); + flags = schedule_start_subscribed ? (flags | 256) : (flags &~ 256); + flags = can_start_video ? (flags | 512) : (flags &~ 512); + flags = record_video_active ? (flags | 2048) : (flags &~ 2048); + flags = rtmp_stream ? (flags | 4096) : (flags &~ 4096); + flags = listeners_hidden ? (flags | 8192) : (flags &~ 8192); + stream.writeInt32(flags); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32(participants_count); + if ((flags & 8) != 0) { + stream.writeString(title); + } + if ((flags & 16) != 0) { + stream.writeInt32(stream_dc_id); + } + if ((flags & 32) != 0) { + stream.writeInt32(record_start_date); + } + if ((flags & 128) != 0) { + stream.writeInt32(schedule_date); + } + if ((flags & 1024) != 0) { + stream.writeInt32(unmuted_video_count); + } + stream.writeInt32(unmuted_video_limit); + stream.writeInt32(version); + if ((flags & 16384) != 0) { + stream.writeInt64(conference_from_call); + } + } + } + + public static class TL_groupCall_layer195 extends TL_groupCall { + public static final int constructor = 0xd597650c; + + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); join_muted = (flags & 2) != 0; can_change_join_muted = (flags & 4) != 0; @@ -2666,7 +2322,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { version = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = join_muted ? (flags | 2) : (flags &~ 2); flags = can_change_join_muted ? (flags | 4) : (flags &~ 4); @@ -2714,7 +2370,7 @@ public static class TL_channelBannedRights_layer92 extends TLObject { public boolean embed_links; public int until_date; - public static TL_channelBannedRights_layer92 TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_channelBannedRights_layer92 TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_channelBannedRights_layer92.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_channelBannedRights_layer92", constructor)); @@ -2727,7 +2383,7 @@ public static TL_channelBannedRights_layer92 TLdeserialize(AbstractSerializedDat return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); view_messages = (flags & 1) != 0; send_messages = (flags & 2) != 0; @@ -2740,7 +2396,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { until_date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = view_messages ? (flags | 1) : (flags &~ 1); flags = send_messages ? (flags | 2) : (flags &~ 2); @@ -2757,7 +2413,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class DialogPeer extends TLObject { - public static DialogPeer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static DialogPeer TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { DialogPeer result = null; switch (constructor) { case 0xe56dbf05: @@ -2782,11 +2438,11 @@ public static class TL_dialogPeer extends DialogPeer { public Peer peer; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); } @@ -2797,11 +2453,11 @@ public static class TL_dialogPeerFolder extends DialogPeer { public int folder_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { folder_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(folder_id); } @@ -2817,7 +2473,7 @@ public static abstract class MessagePeerReaction extends TLObject { public int date; public boolean dateIsSeen; //custom - public static MessagePeerReaction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static MessagePeerReaction TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { MessagePeerReaction result = null; switch (constructor) { case 0x8c79b63c: @@ -2846,7 +2502,7 @@ public static MessagePeerReaction TLdeserialize(AbstractSerializedData stream, i public static class TL_messagePeerReaction extends MessagePeerReaction { public static final int constructor = 0x8c79b63c; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); big = (flags & 1) != 0; unread = (flags & 2) != 0; @@ -2855,7 +2511,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { reaction = Reaction.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = big ? (flags | 1) : (flags &~ 1); flags = unread ? (flags | 2) : (flags &~ 2); @@ -2869,7 +2525,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messagePeerReaction_layer154 extends MessagePeerReaction { public static final int constructor = 0xb156fe9c; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); big = (flags & 1) != 0; unread = (flags & 2) != 0; @@ -2877,7 +2533,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { reaction = Reaction.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = big ? (flags | 1) : (flags &~ 1); flags = unread ? (flags | 2) : (flags &~ 2); @@ -2890,7 +2546,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messagePeerReaction_layer144 extends MessagePeerReaction { public static final int constructor = 0x51b67eff; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); big = (flags & 1) != 0; unread = (flags & 2) != 0; @@ -2899,7 +2555,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { ((TL_reactionEmoji) reaction).emoticon = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = big ? (flags | 1) : (flags &~ 1); flags = unread ? (flags | 2) : (flags &~ 2); @@ -2917,7 +2573,7 @@ public static class TL_messagePeerReaction_layer137 extends MessagePeerReaction public long user_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); reaction = new TL_reactionEmoji(); ((TL_reactionEmoji) reaction).emoticon = stream.readString(exception); @@ -2925,7 +2581,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { peer_id.user_id = user_id; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); if (reaction instanceof TL_reactionEmoji) @@ -2937,7 +2593,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class auth_Authorization extends TLObject { - public static auth_Authorization TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static auth_Authorization TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { auth_Authorization result = null; switch (constructor) { case 0x44747e9a: @@ -2966,14 +2622,14 @@ public static class TL_auth_authorizationSignUpRequired extends auth_Authorizati public int flags; public TL_help_termsOfService terms_of_service; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { terms_of_service = TL_help_termsOfService.TLdeserialize(stream, stream.readInt32(exception), exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -2992,7 +2648,7 @@ public static class TL_auth_authorization extends auth_Authorization { public byte[] future_auth_token; public User user; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); setup_password_required = (flags & 2) != 0; if ((flags & 2) != 0) { @@ -3007,7 +2663,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { user = User.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = setup_password_required ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); @@ -3030,7 +2686,7 @@ public static class PollAnswer extends TLObject { public TL_textWithEntities text = new TL_textWithEntities(); public byte[] option; - public static PollAnswer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static PollAnswer TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { PollAnswer result = null; switch (constructor) { case TL_pollAnswer.constructor: @@ -3053,12 +2709,12 @@ public static PollAnswer TLdeserialize(AbstractSerializedData stream, int constr public static class TL_pollAnswer extends PollAnswer { public static final int constructor = 0xff16e2ca; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = TL_textWithEntities.TLdeserialize(stream, stream.readInt32(exception), exception); option = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); stream.writeByteArray(option); @@ -3068,13 +2724,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_pollAnswer_layer178 extends TL_pollAnswer { public static final int constructor = 0x6ca9c2e9; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = new TL_textWithEntities(); text.text = stream.readString(exception); option = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(text == null ? "" : text.text); stream.writeByteArray(option); @@ -3083,7 +2739,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class JSONValue extends TLObject { - public static JSONValue TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static JSONValue TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { JSONValue result = null; switch (constructor) { case 0xc7345e6a: @@ -3120,11 +2776,11 @@ public static class TL_jsonBool extends JSONValue { public boolean value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { value = stream.readBool(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeBool(value); } @@ -3133,8 +2789,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_jsonNull extends JSONValue { public static final int constructor = 0x3f6d7b68; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -3144,11 +2799,11 @@ public static class TL_jsonString extends JSONValue { public String value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { value = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(value); } @@ -3159,32 +2814,13 @@ public static class TL_jsonArray extends JSONValue { public ArrayList value = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - JSONValue object = JSONValue.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - value.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + value = Vector.deserialize(stream, JSONValue::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = value.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - value.get(a).serializeToStream(stream); - } + Vector.serialize(stream, value); } } @@ -3193,32 +2829,13 @@ public static class TL_jsonObject extends JSONValue { public ArrayList value = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_jsonObjectValue object = TL_jsonObjectValue.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - value.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + value = Vector.deserialize(stream, TL_jsonObjectValue::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = value.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - value.get(a).serializeToStream(stream); - } + Vector.serialize(stream, value); } } @@ -3227,11 +2844,11 @@ public static class TL_jsonNumber extends JSONValue { public double value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { value = stream.readDouble(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeDouble(value); } @@ -3239,7 +2856,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class InputWallPaper extends TLObject { - public static InputWallPaper TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputWallPaper TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputWallPaper result = null; switch (constructor) { case 0xe630b979: @@ -3268,12 +2885,12 @@ public static class TL_inputWallPaper extends InputWallPaper { public long id; public long access_hash; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -3285,11 +2902,11 @@ public static class TL_inputWallPaperNoFile extends InputWallPaper { public long id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); } @@ -3300,11 +2917,11 @@ public static class TL_inputWallPaperSlug extends InputWallPaper { public String slug; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { slug = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(slug); } @@ -3318,7 +2935,7 @@ public static class TL_messages_historyImportParsed extends TLObject { public boolean group; public String title; - public static TL_messages_historyImportParsed TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_historyImportParsed TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_historyImportParsed.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_historyImportParsed", constructor)); @@ -3331,7 +2948,7 @@ public static TL_messages_historyImportParsed TLdeserialize(AbstractSerializedDa return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); pm = (flags & 1) != 0; group = (flags & 2) != 0; @@ -3340,7 +2957,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = pm ? (flags | 1) : (flags &~ 1); flags = group ? (flags | 2) : (flags &~ 2); @@ -3362,7 +2979,7 @@ public static class TL_folder extends TLObject { public String title; public ChatPhoto photo; - public static TL_folder TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_folder TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_folder.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_folder", constructor)); @@ -3375,7 +2992,7 @@ public static TL_folder TLdeserialize(AbstractSerializedData stream, int constru return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); autofill_new_broadcasts = (flags & 1) != 0; autofill_public_groups = (flags & 2) != 0; @@ -3387,7 +3004,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = autofill_new_broadcasts ? (flags | 1) : (flags &~ 1); flags = autofill_public_groups ? (flags | 2) : (flags &~ 2); @@ -3414,7 +3031,7 @@ public static abstract class messages_Messages extends TLObject { public int offset_id_offset; public ArrayList animatedEmoji; - public static messages_Messages TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static messages_Messages TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { messages_Messages result = null; switch (constructor) { case 0x3a54685e: @@ -3443,8 +3060,7 @@ public static messages_Messages TLdeserialize(AbstractSerializedData stream, int public static class TL_messages_messagesSlice extends messages_Messages { public static final int constructor = 0x3a54685e; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); inexact = (flags & 2) != 0; count = stream.readInt32(exception); @@ -3454,54 +3070,12 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 4) != 0) { offset_id_offset = stream.readInt32(exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + messages = Vector.deserialize(stream, Message::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = inexact ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); @@ -3512,106 +3086,33 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 4) != 0) { stream.writeInt32(offset_id_offset); } - stream.writeInt32(0x1cb5c415); - int count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, messages); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } public static class TL_messages_messages extends messages_Messages { public static final int constructor = 0x8c718e87; - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + messages = Vector.deserialize(stream, Message::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, messages); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } public static class TL_messages_channelMessages extends messages_Messages { public static final int constructor = 0xc776ba4e; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); inexact = (flags & 2) != 0; pts = stream.readInt32(exception); @@ -3619,69 +3120,13 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 4) != 0) { offset_id_offset = stream.readInt32(exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_forumTopic object = TL_forumTopic.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - topics.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + messages = Vector.deserialize(stream, Message::TLdeserialize, exception); + topics = Vector.deserialize(stream, TL_forumTopic::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = inexact ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); @@ -3690,49 +3135,26 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 4) != 0) { stream.writeInt32(offset_id_offset); } - stream.writeInt32(0x1cb5c415); - int count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = topics.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - topics.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, messages); + Vector.serialize(stream, topics); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } public static class TL_messages_messagesNotModified extends messages_Messages { public static final int constructor = 0x74535f21; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(count); } } - - public static class PaymentForm extends TLObject { public static final int constructor = 0xa0058751; @@ -3754,7 +3176,7 @@ public static class PaymentForm extends TLObject { public ArrayList saved_credentials = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static PaymentForm TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static PaymentForm TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { PaymentForm result = null; switch (constructor) { case TL_payments_paymentForm.constructor: @@ -3780,7 +3202,7 @@ public static PaymentForm TLdeserialize(AbstractSerializedData stream, int const public static class TL_payments_paymentForm extends PaymentForm { public static final int constructor = 0xa0058751; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_save_credentials = (flags & 4) != 0; password_missing = (flags & 8) != 0; @@ -3801,60 +3223,18 @@ public void readParams(AbstractSerializedData stream, boolean exception) { native_params = TL_dataJSON.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 64) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_paymentFormMethod object = TL_paymentFormMethod.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - additional_methods.add(object); - } + additional_methods = Vector.deserialize(stream, TL_paymentFormMethod::TLdeserialize, exception); } if ((flags & 1) != 0) { saved_info = TL_paymentRequestedInfo.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_paymentSavedCredentialsCard object = TL_paymentSavedCredentialsCard.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - saved_credentials.add(object); - } - } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); + saved_credentials = Vector.deserialize(stream, TL_paymentSavedCredentialsCard::TLdeserialize, exception); } + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_save_credentials ? (flags | 4) : (flags &~ 4); flags = password_missing ? (flags | 8) : (flags &~ 8); @@ -3876,39 +3256,22 @@ public void serializeToStream(AbstractSerializedData stream) { native_params.serializeToStream(stream); } if ((flags & 64) != 0) { - stream.writeInt32(0x1cb5c415); - int count = additional_methods.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - additional_methods.get(a).serializeToStream(stream); - } + Vector.serialize(stream, additional_methods); } if ((flags & 1) != 0) { saved_info.serializeToStream(stream); } if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = saved_credentials.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - saved_credentials.get(a).serializeToStream(stream); - } - } - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); + Vector.serialize(stream, saved_credentials); } + Vector.serialize(stream, users); } } - - public static class TL_payments_paymentFormStars extends PaymentForm { public static final int constructor = 0x7bf6b15c; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); form_id = stream.readInt64(exception); bot_id = stream.readInt64(exception); @@ -3918,24 +3281,10 @@ public void readParams(AbstractSerializedData stream, boolean exception) { photo = WebDocument.TLdeserialize(stream, stream.readInt32(exception), exception); } invoice = TL_invoice.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_save_credentials ? (flags | 4) : (flags &~ 4); flags = password_missing ? (flags | 8) : (flags &~ 8); @@ -3948,24 +3297,19 @@ public void serializeToStream(AbstractSerializedData stream) { photo.serializeToStream(stream); } invoice.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, users); } } public static class TL_payments_paymentFormStarGift extends PaymentForm { public static final int constructor = 0xb425cfe1; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { form_id = stream.readInt64(exception); invoice = TL_invoice.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(form_id); invoice.serializeToStream(stream); @@ -3978,7 +3322,7 @@ public static class TL_paymentFormMethod extends TLObject { public String url; public String title; - public static TL_paymentFormMethod TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_paymentFormMethod TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_paymentFormMethod.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_PaymentFormMethod", constructor)); @@ -3991,12 +3335,12 @@ public static TL_paymentFormMethod TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); title = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); stream.writeString(title); @@ -4005,7 +3349,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class ContactLink_layer101 extends TLObject { - public static ContactLink_layer101 TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static ContactLink_layer101 TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { ContactLink_layer101 result = null; switch (constructor) { case 0xfeedd3ad: @@ -4031,8 +3375,7 @@ public static ContactLink_layer101 TLdeserialize(AbstractSerializedData stream, public static class TL_contactLinkNone extends ContactLink_layer101 { public static final int constructor = 0xfeedd3ad; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -4040,8 +3383,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_contactLinkContact extends ContactLink_layer101 { public static final int constructor = 0xd502c2d0; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -4049,13 +3391,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_contactLinkUnknown extends ContactLink_layer101 { public static final int constructor = 0x5f4f9247; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } - public static class TL_contacts_link_layer101 extends TLObject { public static final int constructor = 0x3ace484c; @@ -4063,7 +3403,7 @@ public static class TL_contacts_link_layer101 extends TLObject { public ContactLink_layer101 foreign_link; public User user; - public static TL_contacts_link_layer101 TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_contacts_link_layer101 TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_contacts_link_layer101.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_contacts_link", constructor)); @@ -4076,13 +3416,13 @@ public static TL_contacts_link_layer101 TLdeserialize(AbstractSerializedData str return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { my_link = ContactLink_layer101.TLdeserialize(stream, stream.readInt32(exception), exception); foreign_link = ContactLink_layer101.TLdeserialize(stream, stream.readInt32(exception), exception); user = User.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); my_link.serializeToStream(stream); foreign_link.serializeToStream(stream); @@ -4097,7 +3437,7 @@ public static abstract class EncryptedFile extends TLObject { public int dc_id; public int key_fingerprint; - public static EncryptedFile TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static EncryptedFile TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { EncryptedFile result = null; switch (constructor) { case 0xa8008cd8: @@ -4123,7 +3463,7 @@ public static EncryptedFile TLdeserialize(AbstractSerializedData stream, int con public static class TL_encryptedFile extends EncryptedFile { public static final int constructor = 0xa8008cd8; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); size = stream.readInt64(exception); @@ -4131,7 +3471,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { key_fingerprint = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -4144,8 +3484,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_encryptedFile_layer142 extends EncryptedFile { public static final int constructor = 0x4a70994c; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); size = stream.readInt32(exception); @@ -4153,7 +3492,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { key_fingerprint = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -4166,8 +3505,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_encryptedFileEmpty extends EncryptedFile { public static final int constructor = 0xc21f497e; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -4178,7 +3516,7 @@ public static abstract class Peer extends TLObject { public long chat_id; public long channel_id; - public static Peer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static Peer TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { Peer result = null; switch (constructor) { case 0xa2a5371e: @@ -4213,12 +3551,11 @@ public static Peer TLdeserialize(AbstractSerializedData stream, int constructor, public static class TL_peerChannel_layer131 extends TL_peerChannel { public static final int constructor = 0xbddde532; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { channel_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) channel_id); } @@ -4227,12 +3564,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_peerUser extends Peer { public static final int constructor = 0x59511722; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); } @@ -4241,12 +3577,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_peerChannel extends Peer { public static final int constructor = 0xa2a5371e; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { channel_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(channel_id); } @@ -4255,12 +3590,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_peerChat extends Peer { public static final int constructor = 0x36c6019a; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { chat_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(chat_id); } @@ -4269,12 +3603,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_peerUser_layer131 extends TL_peerUser { public static final int constructor = 0x9db1bc6d; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) user_id); } @@ -4283,12 +3616,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_peerChat_layer131 extends TL_peerChat { public static final int constructor = 0xbad0e5bb; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { chat_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) chat_id); } @@ -4300,7 +3632,7 @@ public static class TL_labeledPrice extends TLObject { public String label; public long amount; - public static TL_labeledPrice TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_labeledPrice TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_labeledPrice.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_labeledPrice", constructor)); @@ -4313,12 +3645,12 @@ public static TL_labeledPrice TLdeserialize(AbstractSerializedData stream, int c return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { label = stream.readString(exception); amount = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(label); stream.writeInt64(amount); @@ -4332,7 +3664,7 @@ public static class TL_messages_exportedChatInvites extends TLObject { public ArrayList invites = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_messages_exportedChatInvites TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_exportedChatInvites TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_exportedChatInvites.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_exportedChatInvites", constructor)); @@ -4345,55 +3677,17 @@ public static TL_messages_exportedChatInvites TLdeserialize(AbstractSerializedDa return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - ExportedChatInvite object = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - invites.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + invites = Vector.deserialize(stream, ExportedChatInvite::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = invites.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - invites.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, invites); + Vector.serialize(stream, users); } } @@ -4405,7 +3699,7 @@ public static class TL_inputStickerSetItem extends TLObject { public String emoji; public TL_maskCoords mask_coords; - public static TL_inputStickerSetItem TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_inputStickerSetItem TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_inputStickerSetItem.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_inputStickerSetItem", constructor)); @@ -4418,7 +3712,7 @@ public static TL_inputStickerSetItem TLdeserialize(AbstractSerializedData stream return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); document = InputDocument.TLdeserialize(stream, stream.readInt32(exception), exception); emoji = stream.readString(exception); @@ -4427,7 +3721,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); document.serializeToStream(stream); @@ -4446,7 +3740,7 @@ public static class TL_langPackDifference extends TLObject { public int version; public ArrayList strings = new ArrayList<>(); - public static TL_langPackDifference TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_langPackDifference TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_langPackDifference.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_langPackDifference", constructor)); @@ -4459,44 +3753,25 @@ public static TL_langPackDifference TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { lang_code = stream.readString(exception); from_version = stream.readInt32(exception); version = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - LangPackString object = LangPackString.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - strings.add(object); - } + strings = Vector.deserialize(stream, LangPackString::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(lang_code); stream.writeInt32(from_version); stream.writeInt32(version); - stream.writeInt32(0x1cb5c415); - int count = strings.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - strings.get(a).serializeToStream(stream); - } + Vector.serialize(stream, strings); } } public static abstract class help_DeepLinkInfo extends TLObject { - public static help_DeepLinkInfo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static help_DeepLinkInfo TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { help_DeepLinkInfo result = null; switch (constructor) { case 0x66afa166: @@ -4519,8 +3794,7 @@ public static help_DeepLinkInfo TLdeserialize(AbstractSerializedData stream, int public static class TL_help_deepLinkInfoEmpty extends help_DeepLinkInfo { public static final int constructor = 0x66afa166; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -4533,41 +3807,22 @@ public static class TL_help_deepLinkInfo extends help_DeepLinkInfo { public String message; public ArrayList entities = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); update_app = (flags & 1) != 0; message = stream.readString(exception); if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = update_app ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); stream.writeString(message); if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } } } @@ -4592,7 +3847,7 @@ public static class TL_chatAdminRights extends TLObject { public boolean edit_stories; public boolean delete_stories; - public static TL_chatAdminRights TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_chatAdminRights TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_chatAdminRights.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_chatAdminRights", constructor)); @@ -4605,7 +3860,20 @@ public static TL_chatAdminRights TLdeserialize(AbstractSerializedData stream, in return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public static TL_chatAdminRights clone(TL_chatAdminRights rights) { + if (rights == null) return null; + SerializedData data = new SerializedData(rights.getObjectSize()); + rights.serializeToStream(data); + return TLdeserialize(data, data.readInt32(false), false); + } + + @Override + public boolean equals(@Nullable Object obj) { + if (!(obj instanceof TL_chatAdminRights)) return false; + return this.flags == ((TL_chatAdminRights) obj).flags; + } + + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); change_info = (flags & 1) != 0; post_messages = (flags & 2) != 0; @@ -4624,7 +3892,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { delete_stories = (flags & 65536) != 0; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = change_info ? (flags | 1) : (flags &~ 1); flags = post_messages ? (flags | 2) : (flags &~ 2); @@ -4655,7 +3923,7 @@ public static abstract class PollResults extends TLObject { public String solution; public ArrayList solution_entities = new ArrayList<>(); - public static PollResults TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static PollResults TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { PollResults result = null; switch (constructor) { case 0x5755785a: @@ -4687,43 +3955,23 @@ public static PollResults TLdeserialize(AbstractSerializedData stream, int const public static class TL_pollResults_layer108 extends TL_pollResults { public static final int constructor = 0x5755785a; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); min = (flags & 1) != 0; if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_pollAnswerVoters object = TL_pollAnswerVoters.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - results.add(object); - } + results = Vector.deserialize(stream, TL_pollAnswerVoters::TLdeserialize, exception); } if ((flags & 4) != 0) { total_voters = stream.readInt32(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = min ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = results.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - results.get(a).serializeToStream(stream); - } + Vector.serialize(stream, results); } if ((flags & 4) != 0) { stream.writeInt32(total_voters); @@ -4734,26 +3982,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_pollResults_layer111 extends PollResults { public static final int constructor = 0xc87024a2; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); min = (flags & 1) != 0; if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_pollAnswerVoters object = TL_pollAnswerVoters.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - results.add(object); - } + results = Vector.deserialize(stream, TL_pollAnswerVoters::TLdeserialize, exception); } if ((flags & 4) != 0) { total_voters = stream.readInt32(exception); @@ -4775,17 +4008,12 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = min ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = results.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - results.get(a).serializeToStream(stream); - } + Vector.serialize(stream, results); } if ((flags & 4) != 0) { stream.writeInt32(total_voters); @@ -4804,26 +4032,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_pollResults_layer131 extends TL_pollResults { public static final int constructor = 0xbadcc1a3; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); min = (flags & 1) != 0; if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_pollAnswerVoters object = TL_pollAnswerVoters.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - results.add(object); - } + results = Vector.deserialize(stream, TL_pollAnswerVoters::TLdeserialize, exception); } if ((flags & 4) != 0) { total_voters = stream.readInt32(exception); @@ -4847,35 +4060,16 @@ public void readParams(AbstractSerializedData stream, boolean exception) { solution = stream.readString(exception); } if ((flags & 16) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - solution_entities.add(object); - } + solution_entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = min ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = results.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - results.get(a).serializeToStream(stream); - } + Vector.serialize(stream, results); } if ((flags & 4) != 0) { stream.writeInt32(total_voters); @@ -4892,12 +4086,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeString(solution); } if ((flags & 16) != 0) { - stream.writeInt32(0x1cb5c415); - int count = solution_entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - solution_entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, solution_entities); } } } @@ -4905,101 +4094,44 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_pollResults extends PollResults { public static final int constructor = 0x7adf2420; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); min = (flags & 1) != 0; if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_pollAnswerVoters object = TL_pollAnswerVoters.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - results.add(object); - } + results = Vector.deserialize(stream, TL_pollAnswerVoters::TLdeserialize, exception); } if ((flags & 4) != 0) { total_voters = stream.readInt32(exception); } if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Peer object = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - recent_voters.add(object); - } + recent_voters = Vector.deserialize(stream, Peer::TLdeserialize, exception); } if ((flags & 16) != 0) { solution = stream.readString(exception); } if ((flags & 16) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - solution_entities.add(object); - } + solution_entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = min ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = results.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - results.get(a).serializeToStream(stream); - } + Vector.serialize(stream, results); } if ((flags & 4) != 0) { stream.writeInt32(total_voters); } if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = recent_voters.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - recent_voters.get(a).serializeToStream(stream); - } + Vector.serialize(stream, recent_voters); } if ((flags & 16) != 0) { stream.writeString(solution); } if ((flags & 16) != 0) { - stream.writeInt32(0x1cb5c415); - int count = solution_entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - solution_entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, solution_entities); } } } @@ -5007,26 +4139,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_pollResults_layer158 extends PollResults { public static final int constructor = 0xdcb82ea3; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); min = (flags & 1) != 0; if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_pollAnswerVoters object = TL_pollAnswerVoters.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - results.add(object); - } + results = Vector.deserialize(stream, TL_pollAnswerVoters::TLdeserialize, exception); } if ((flags & 4) != 0) { total_voters = stream.readInt32(exception); @@ -5050,35 +4167,16 @@ public void readParams(AbstractSerializedData stream, boolean exception) { solution = stream.readString(exception); } if ((flags & 16) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - solution_entities.add(object); - } + solution_entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = min ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = results.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - results.get(a).serializeToStream(stream); - } + Vector.serialize(stream, results); } if ((flags & 4) != 0) { stream.writeInt32(total_voters); @@ -5095,19 +4193,14 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeString(solution); } if ((flags & 16) != 0) { - stream.writeInt32(0x1cb5c415); - int count = solution_entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - solution_entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, solution_entities); } } } public static abstract class SecureFile extends TLObject { - public static SecureFile TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static SecureFile TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { SecureFile result = null; switch (constructor) { case 0x64199744: @@ -5130,8 +4223,7 @@ public static SecureFile TLdeserialize(AbstractSerializedData stream, int constr public static class TL_secureFileEmpty extends SecureFile { public static final int constructor = 0x64199744; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -5147,7 +4239,7 @@ public static class TL_secureFile extends SecureFile { public byte[] file_hash; public byte[] secret; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); size = stream.readInt64(exception); @@ -5157,7 +4249,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { secret = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -5172,7 +4264,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_secureFile_layer142 extends TL_secureFile { public static final int constructor = 0xe0277a62; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); size = stream.readInt32(exception); @@ -5182,7 +4274,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { secret = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -5200,7 +4292,7 @@ public static class TL_messages_affectedMessages extends TLObject { public int pts; public int pts_count; - public static TL_messages_affectedMessages TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_affectedMessages TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_affectedMessages.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_affectedMessages", constructor)); @@ -5213,12 +4305,12 @@ public static TL_messages_affectedMessages TLdeserialize(AbstractSerializedData return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { pts = stream.readInt32(exception); pts_count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(pts); stream.writeInt32(pts_count); @@ -5232,7 +4324,7 @@ public static class TL_messages_chatInviteImporters extends TLObject { public ArrayList importers = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_messages_chatInviteImporters TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_chatInviteImporters TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_chatInviteImporters.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_chatInviteImporters", constructor)); @@ -5245,55 +4337,17 @@ public static TL_messages_chatInviteImporters TLdeserialize(AbstractSerializedDa return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_chatInviteImporter object = TL_chatInviteImporter.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - importers.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + importers = Vector.deserialize(stream, TL_chatInviteImporter::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = importers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - importers.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, importers); + Vector.serialize(stream, users); } } @@ -5306,7 +4360,7 @@ public static class TL_pollAnswerVoters extends TLObject { public byte[] option; public int voters; - public static TL_pollAnswerVoters TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_pollAnswerVoters TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_pollAnswerVoters.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_pollAnswerVoters", constructor)); @@ -5319,7 +4373,7 @@ public static TL_pollAnswerVoters TLdeserialize(AbstractSerializedData stream, i return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); chosen = (flags & 1) != 0; correct = (flags & 2) != 0; @@ -5327,7 +4381,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { voters = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = chosen ? (flags | 1) : (flags &~ 1); flags = correct ? (flags | 2) : (flags &~ 2); @@ -5344,7 +4398,7 @@ public static class TL_channels_channelParticipant extends TLObject { public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_channels_channelParticipant TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_channels_channelParticipant TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_channels_channelParticipant.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_channels_channelParticipant", constructor)); @@ -5357,55 +4411,17 @@ public static TL_channels_channelParticipant TLdeserialize(AbstractSerializedDat return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { participant = ChannelParticipant.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); participant.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } @@ -5432,7 +4448,7 @@ public static class TL_authorization extends TLObject { public String country; public String region; - public static TL_authorization TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_authorization TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_authorization.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_authorization", constructor)); @@ -5445,7 +4461,7 @@ public static TL_authorization TLdeserialize(AbstractSerializedData stream, int return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); current = (flags & 1) != 0; official_app = (flags & 2) != 0; @@ -5467,7 +4483,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { region = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = current ? (flags | 1) : (flags &~ 1); flags = official_app ? (flags | 2) : (flags &~ 2); @@ -5503,7 +4519,7 @@ public static abstract class updates_Difference extends TLObject { public int date; public int seq; - public static updates_Difference TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static updates_Difference TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { updates_Difference result = null; switch (constructor) { case 0xf49ca0: @@ -5532,118 +4548,22 @@ public static updates_Difference TLdeserialize(AbstractSerializedData stream, in public static class TL_updates_difference extends updates_Difference { public static final int constructor = 0xf49ca0; - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - new_messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - EncryptedMessage object = EncryptedMessage.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - new_encrypted_messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Update object = Update.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - other_updates.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + new_messages = Vector.deserialize(stream, Message::TLdeserialize, exception); + new_encrypted_messages = Vector.deserialize(stream, EncryptedMessage::TLdeserialize, exception); + other_updates = Vector.deserialize(stream, Update::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); state = TL_updates_state.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = new_messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - new_messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = new_encrypted_messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - new_encrypted_messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = other_updates.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - other_updates.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, new_messages); + Vector.serialize(stream, new_encrypted_messages); + Vector.serialize(stream, other_updates); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); state.serializeToStream(stream); } } @@ -5651,118 +4571,22 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_updates_differenceSlice extends updates_Difference { public static final int constructor = 0xa8fb1981; - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - new_messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - EncryptedMessage object = EncryptedMessage.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - new_encrypted_messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Update object = Update.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - other_updates.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + new_messages = Vector.deserialize(stream, Message::TLdeserialize, exception); + new_encrypted_messages = Vector.deserialize(stream, EncryptedMessage::TLdeserialize, exception); + other_updates = Vector.deserialize(stream, Update::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); intermediate_state = TL_updates_state.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = new_messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - new_messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = new_encrypted_messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - new_encrypted_messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = other_updates.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - other_updates.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, new_messages); + Vector.serialize(stream, new_encrypted_messages); + Vector.serialize(stream, other_updates); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); intermediate_state.serializeToStream(stream); } } @@ -5770,12 +4594,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_updates_differenceTooLong extends updates_Difference { public static final int constructor = 0x4afe8f6d; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { pts = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(pts); } @@ -5784,13 +4607,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_updates_differenceEmpty extends updates_Difference { public static final int constructor = 0x5d75a138; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { date = stream.readInt32(exception); seq = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(date); stream.writeInt32(seq); @@ -5799,7 +4621,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class PrivacyKey extends TLObject { - public static PrivacyKey TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static PrivacyKey TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { PrivacyKey result = null; switch (constructor) { case TL_privacyKeyStatusTimestamp.constructor: @@ -5852,8 +4674,7 @@ public static PrivacyKey TLdeserialize(AbstractSerializedData stream, int constr public static class TL_privacyKeyStatusTimestamp extends PrivacyKey { public static final int constructor = 0xbc2eab30; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -5861,8 +4682,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_privacyKeyPhoneP2P extends PrivacyKey { public static final int constructor = 0x39491cc8; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -5870,8 +4690,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_privacyKeyChatInvite extends PrivacyKey { public static final int constructor = 0x500e6dfa; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -5879,8 +4698,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_privacyKeyPhoneCall extends PrivacyKey { public static final int constructor = 0x3d662b7b; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -5888,8 +4706,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_privacyKeyAddedByPhone extends PrivacyKey { public static final int constructor = 0x42ffd42b; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -5897,8 +4714,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_privacyKeyAbout extends PrivacyKey { public static final int constructor = 0xa486b761; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -5906,8 +4722,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_privacyKeyVoiceMessages extends PrivacyKey { public static final int constructor = 0x697f414; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -5915,8 +4730,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_privacyKeyForwards extends PrivacyKey { public static final int constructor = 0x69ec56a3; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -5924,8 +4738,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_privacyKeyPhoneNumber extends PrivacyKey { public static final int constructor = 0xd19ae46d; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -5933,8 +4746,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_privacyKeyProfilePhoto extends PrivacyKey { public static final int constructor = 0x96151fed; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -5942,8 +4754,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_privacyKeyBirthday extends PrivacyKey { public static final int constructor = 0x2000a518; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -5951,8 +4762,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_privacyKeyStarGiftsAutoSave extends PrivacyKey { public static final int constructor = 0x2ca4fdf8; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -5964,7 +4774,7 @@ public static abstract class GeoPoint extends TLObject { public int accuracy_radius; public long access_hash; - public static GeoPoint TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static GeoPoint TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { GeoPoint result = null; switch (constructor) { case 0x296f104: @@ -5993,14 +4803,13 @@ public static GeoPoint TLdeserialize(AbstractSerializedData stream, int construc public static class TL_geoPoint_layer119 extends TL_geoPoint { public static final int constructor = 0x296f104; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { _long = stream.readDouble(exception); lat = stream.readDouble(exception); access_hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeDouble(_long); stream.writeDouble(lat); @@ -6011,13 +4820,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_geoPoint_layer81 extends TL_geoPoint { public static final int constructor = 0x2049d70c; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { _long = stream.readDouble(exception); lat = stream.readDouble(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeDouble(_long); stream.writeDouble(lat); @@ -6027,8 +4835,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_geoPointEmpty extends GeoPoint { public static final int constructor = 0x1117dd5f; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -6036,8 +4843,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_geoPoint extends GeoPoint { public static final int constructor = 0xb2a2f663; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); _long = stream.readDouble(exception); lat = stream.readDouble(exception); @@ -6047,7 +4853,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeDouble(_long); @@ -6059,97 +4865,6 @@ public void serializeToStream(AbstractSerializedData stream) { } } - public static class TL_account_privacyRules extends TLObject { - public static final int constructor = 0x50a04e45; - - public ArrayList rules = new ArrayList<>(); - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); - - public static TL_account_privacyRules TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_account_privacyRules.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_account_privacyRules", constructor)); - } else { - return null; - } - } - TL_account_privacyRules result = new TL_account_privacyRules(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PrivacyRule object = PrivacyRule.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - rules.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = rules.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - rules.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } - public static abstract class ChatInvite extends TLObject { public int flags; @@ -6172,13 +4887,17 @@ public static abstract class ChatInvite extends TLObject { public int color; public TL_stars.TL_starsSubscriptionPricing subscription_pricing; public long subscription_form_id; + public TL_bots.botVerification bot_verification; - public static ChatInvite TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static ChatInvite TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { ChatInvite result = null; switch (constructor) { case TL_chatInvite.constructor: result = new TL_chatInvite(); break; + case TL_chatInvite_layer195.constructor: + result = new TL_chatInvite_layer195(); + break; case TL_chatInvite_layer185.constructor: result = new TL_chatInvite_layer185(); break; @@ -6203,9 +4922,80 @@ public static ChatInvite TLdeserialize(AbstractSerializedData stream, int constr } public static class TL_chatInvite extends ChatInvite { + public static final int constructor = 0x5c9d3702; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + channel = (flags & 1) != 0; + broadcast = (flags & 2) != 0; + isPublic = (flags & 4) != 0; + megagroup = (flags & 8) != 0; + request_needed = (flags & 64) != 0; + verified = (flags & 128) != 0; + scam = (flags & 256) != 0; + fake = (flags & 512) != 0; + can_refulfill_subscription = (flags & 2048) != 0; + title = stream.readString(exception); + boolean hasAbout = (flags & 32) != 0; + if (hasAbout) { + about = stream.readString(exception); + } + photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + participants_count = stream.readInt32(exception); + if ((flags & 16) != 0) { + participants = Vector.deserialize(stream, User::TLdeserialize, exception); + } + color = stream.readInt32(exception); + if ((flags & 1024) != 0) { + subscription_pricing = TL_stars.TL_starsSubscriptionPricing.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4096) != 0) { + subscription_form_id = stream.readInt64(exception); + } + if ((flags & 8192) != 0) { + bot_verification = TL_bots.botVerification.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = channel ? (flags | 1) : (flags &~ 1); + flags = broadcast ? (flags | 2) : (flags &~ 2); + flags = isPublic ? (flags | 4) : (flags &~ 4); + flags = megagroup ? (flags | 8) : (flags &~ 8); + flags = about != null ? (flags | 32) : (flags &~ 32); + flags = request_needed ? (flags | 64) : (flags &~ 64); + flags = verified ? (flags | 128) : (flags &~ 128); + flags = scam ? (flags | 256) : (flags &~ 256); + flags = fake ? (flags | 512) : (flags &~ 512); + flags = can_refulfill_subscription ? (flags | 2048) : (flags &~ 2048); + stream.writeInt32(flags); + stream.writeString(title); + if (about != null) { + stream.writeString(about); + } + photo.serializeToStream(stream); + stream.writeInt32(participants_count); + if ((flags & 16) != 0) { + Vector.serialize(stream, participants); + } + stream.writeInt32(color); + if ((flags & 1024) != 0) { + subscription_pricing.serializeToStream(stream); + } + if ((flags & 4096) != 0) { + stream.writeInt64(subscription_form_id); + } + if ((flags & 8192) != 0) { + bot_verification.serializeToStream(stream); + } + } + } + + public static class TL_chatInvite_layer195 extends TL_chatInvite { public static final int constructor = 0xfe65389d; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); channel = (flags & 1) != 0; broadcast = (flags & 2) != 0; @@ -6224,21 +5014,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); participants_count = stream.readInt32(exception); if ((flags & 16) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - participants.add(object); - } + participants = Vector.deserialize(stream, User::TLdeserialize, exception); } color = stream.readInt32(exception); if ((flags & 1024) != 0) { @@ -6249,7 +5025,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = channel ? (flags | 1) : (flags &~ 1); flags = broadcast ? (flags | 2) : (flags &~ 2); @@ -6269,12 +5045,7 @@ public void serializeToStream(AbstractSerializedData stream) { photo.serializeToStream(stream); stream.writeInt32(participants_count); if ((flags & 16) != 0) { - stream.writeInt32(0x1cb5c415); - int count = participants.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - participants.get(a).serializeToStream(stream); - } + Vector.serialize(stream, participants); } stream.writeInt32(color); if ((flags & 1024) != 0) { @@ -6289,7 +5060,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatInvite_layer185 extends TL_chatInvite { public static final int constructor = 0xcde0ec40; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); channel = (flags & 1) != 0; broadcast = (flags & 2) != 0; @@ -6307,26 +5078,12 @@ public void readParams(AbstractSerializedData stream, boolean exception) { photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); participants_count = stream.readInt32(exception); if ((flags & 16) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - participants.add(object); - } + participants = Vector.deserialize(stream, User::TLdeserialize, exception); } color = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = channel ? (flags | 1) : (flags &~ 1); flags = broadcast ? (flags | 2) : (flags &~ 2); @@ -6345,12 +5102,7 @@ public void serializeToStream(AbstractSerializedData stream) { photo.serializeToStream(stream); stream.writeInt32(participants_count); if ((flags & 16) != 0) { - stream.writeInt32(0x1cb5c415); - int count = participants.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - participants.get(a).serializeToStream(stream); - } + Vector.serialize(stream, participants); } stream.writeInt32(color); } @@ -6359,7 +5111,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatInvite_layer165 extends ChatInvite { public static final int constructor = 0x300c44c1; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); channel = (flags & 1) != 0; broadcast = (flags & 2) != 0; @@ -6377,28 +5129,14 @@ public void readParams(AbstractSerializedData stream, boolean exception) { photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); participants_count = stream.readInt32(exception); if ((flags & 16) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - participants.add(object); - } + participants = Vector.deserialize(stream, User::TLdeserialize, exception); } if ((flags & 1024) != 0) { color = stream.readInt32(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = channel ? (flags | 1) : (flags &~ 1); flags = broadcast ? (flags | 2) : (flags &~ 2); @@ -6417,12 +5155,7 @@ public void serializeToStream(AbstractSerializedData stream) { photo.serializeToStream(stream); stream.writeInt32(participants_count); if ((flags & 16) != 0) { - stream.writeInt32(0x1cb5c415); - int count = participants.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - participants.get(a).serializeToStream(stream); - } + Vector.serialize(stream, participants); } if ((flags & 1024) != 0) { stream.writeInt32(color); @@ -6433,13 +5166,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatInvitePeek extends ChatInvite { public static final int constructor = 0x61695cb0; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { chat = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); expires = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); chat.serializeToStream(stream); stream.writeInt32(expires); @@ -6449,12 +5181,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatInviteAlready extends ChatInvite { public static final int constructor = 0x5a686d7c; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { chat = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); chat.serializeToStream(stream); } @@ -6466,7 +5197,7 @@ public static class TL_inputGroupCall extends TLObject { public long id; public long access_hash; - public static TL_inputGroupCall TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_inputGroupCall TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_inputGroupCall.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_inputGroupCall", constructor)); @@ -6479,12 +5210,12 @@ public static TL_inputGroupCall TLdeserialize(AbstractSerializedData stream, int return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -6493,7 +5224,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class help_AppUpdate extends TLObject { - public static help_AppUpdate TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static help_AppUpdate TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { help_AppUpdate result = null; switch (constructor) { case 0xccbbce30: @@ -6527,27 +5258,13 @@ public static class TL_help_appUpdate extends help_AppUpdate { public String url; public Document sticker; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_not_skip = (flags & 1) != 0; id = stream.readInt32(exception); version = stream.readString(exception); text = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); if ((flags & 2) != 0) { document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); } @@ -6559,19 +5276,14 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_not_skip ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); stream.writeInt32(id); stream.writeString(version); stream.writeString(text); - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); if ((flags & 2) != 0) { document.serializeToStream(stream); } @@ -6587,8 +5299,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_help_noAppUpdate extends help_AppUpdate { public static final int constructor = 0xc45a6536; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -6601,7 +5312,7 @@ public static class TL_messages_affectedFoundMessages extends TLObject { public int offset; public ArrayList messages = new ArrayList<>(); - public static TL_messages_affectedFoundMessages TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_affectedFoundMessages TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_affectedFoundMessages.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_affectedFoundMessages", constructor)); @@ -6614,34 +5325,19 @@ public static TL_messages_affectedFoundMessages TLdeserialize(AbstractSerialized return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { pts = stream.readInt32(exception); pts_count = stream.readInt32(exception); offset = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - messages.add(stream.readInt32(exception)); - } + messages = Vector.deserializeInt(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(pts); stream.writeInt32(pts_count); stream.writeInt32(offset); - stream.writeInt32(0x1cb5c415); - int count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(messages.get(a)); - } + Vector.serializeInt(stream, messages); } } @@ -6653,7 +5349,7 @@ public static class TL_channelAdminLogEvent extends TLObject { public long user_id; public ChannelAdminLogEventAction action; - public static TL_channelAdminLogEvent TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_channelAdminLogEvent TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_channelAdminLogEvent.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_channelAdminLogEvent", constructor)); @@ -6666,14 +5362,14 @@ public static TL_channelAdminLogEvent TLdeserialize(AbstractSerializedData strea return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); date = stream.readInt32(exception); user_id = stream.readInt64(exception); action = ChannelAdminLogEventAction.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt32(date); @@ -6687,7 +5383,7 @@ public static abstract class messages_FavedStickers extends TLObject { public ArrayList packs = new ArrayList<>(); public ArrayList stickers = new ArrayList<>(); - public static messages_FavedStickers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static messages_FavedStickers TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { messages_FavedStickers result = null; switch (constructor) { case 0x9e8fa6d3: @@ -6710,8 +5406,7 @@ public static messages_FavedStickers TLdeserialize(AbstractSerializedData stream public static class TL_messages_favedStickersNotModified extends messages_FavedStickers { public static final int constructor = 0x9e8fa6d3; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -6719,56 +5414,17 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messages_favedStickers extends messages_FavedStickers { public static final int constructor = 0x2cb51097; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { hash = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_stickerPack object = TL_stickerPack.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - packs.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - stickers.add(object); - } + packs = Vector.deserialize(stream, TL_stickerPack::TLdeserialize, exception); + stickers = Vector.deserialize(stream, Document::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(hash); - stream.writeInt32(0x1cb5c415); - int count = packs.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - packs.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = stickers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stickers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, packs); + Vector.serialize(stream, stickers); } } @@ -6787,7 +5443,7 @@ public static class TL_langPackLanguage extends TLObject { public int translated_count; public String translations_url; - public static TL_langPackLanguage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_langPackLanguage TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_langPackLanguage.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_langPackLanguage", constructor)); @@ -6800,7 +5456,7 @@ public static TL_langPackLanguage TLdeserialize(AbstractSerializedData stream, i return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); official = (flags & 1) != 0; rtl = (flags & 4) != 0; @@ -6816,7 +5472,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { translations_url = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = official ? (flags | 1) : (flags &~ 1); flags = rtl ? (flags | 4) : (flags &~ 4); @@ -6845,7 +5501,7 @@ public static class TL_chatInviteImporter extends TLObject { public long approved_by; public boolean via_chatlist; - public static TL_chatInviteImporter TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_chatInviteImporter TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_chatInviteImporter.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_chatInviteImporter", constructor)); @@ -6858,7 +5514,7 @@ public static TL_chatInviteImporter TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); requested = (flags & 1) != 0; via_chatlist = (flags & 8) != 0; @@ -6872,7 +5528,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = requested ? (flags | 1) : (flags &~ 1); flags = via_chatlist ? (flags | 8) : (flags &~ 8); @@ -6891,13 +5547,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class SendMessageAction extends TLObject { public int progress; - public static SendMessageAction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static SendMessageAction TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { SendMessageAction result = null; switch (constructor) { - case 0xdd6a8f48: + case TL_sendMessageGamePlayAction.constructor: result = new TL_sendMessageGamePlayAction(); break; - case 0xd52f73f7: + case TL_sendMessageRecordAudioAction.constructor: result = new TL_sendMessageRecordAudioAction(); break; case 0x92042ff7: @@ -6974,8 +5630,7 @@ public static SendMessageAction TLdeserialize(AbstractSerializedData stream, int public static class TL_sendMessageGamePlayAction extends SendMessageAction { public static final int constructor = 0xdd6a8f48; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -6983,8 +5638,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_sendMessageRecordAudioAction extends SendMessageAction { public static final int constructor = 0xd52f73f7; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -6992,11 +5646,10 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_sendMessageUploadVideoAction_old extends TL_sendMessageUploadVideoAction { public static final int constructor = 0x92042ff7; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -7008,13 +5661,13 @@ public static class TL_sendMessageEmojiInteraction extends SendMessageAction { public int msg_id; public TL_dataJSON interaction; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { emoticon = stream.readString(exception); msg_id = stream.readInt32(exception); interaction = TL_dataJSON.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(emoticon); stream.writeInt32(msg_id); @@ -7025,11 +5678,10 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_sendMessageUploadAudioAction_old extends TL_sendMessageUploadAudioAction { public static final int constructor = 0xe6ac8a6f; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -7037,12 +5689,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_sendMessageUploadAudioAction extends SendMessageAction { public static final int constructor = 0xf351d7ab; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { progress = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(progress); } @@ -7051,12 +5702,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_sendMessageUploadPhotoAction extends SendMessageAction { public static final int constructor = 0xd1d34a26; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { progress = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(progress); } @@ -7065,11 +5715,10 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_sendMessageUploadDocumentAction_old extends TL_sendMessageUploadDocumentAction { public static final int constructor = 0x8faee98e; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -7077,12 +5726,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_sendMessageUploadVideoAction extends SendMessageAction { public static final int constructor = 0xe9763aec; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { progress = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(progress); } @@ -7091,8 +5739,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_sendMessageCancelAction extends SendMessageAction { public static final int constructor = 0xfd5ec8f5; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -7100,8 +5747,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_sendMessageGeoLocationAction extends SendMessageAction { public static final int constructor = 0x176f8ba1; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -7109,8 +5755,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_sendMessageChooseContactAction extends SendMessageAction { public static final int constructor = 0x628cbc6f; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -7118,8 +5763,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_sendMessageChooseStickerAction extends SendMessageAction { public static final int constructor = 0xb05ac6b1; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -7127,8 +5771,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_sendMessageRecordRoundAction extends SendMessageAction { public static final int constructor = 0x88f27fbc; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -7136,12 +5779,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_sendMessageUploadRoundAction extends SendMessageAction { public static final int constructor = 0x243e1c66; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { progress = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(progress); } @@ -7152,11 +5794,11 @@ public static class TL_sendMessageEmojiInteractionSeen extends SendMessageAction public String emoticon; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { emoticon = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(emoticon); } @@ -7165,8 +5807,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_sendMessageTypingAction extends SendMessageAction { public static final int constructor = 0x16bf744e; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -7176,11 +5817,11 @@ public static class TL_sendMessageHistoryImportAction extends SendMessageAction public int progress; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { progress = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(progress); } @@ -7189,11 +5830,10 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_sendMessageUploadPhotoAction_old extends TL_sendMessageUploadPhotoAction { public static final int constructor = 0x990a3c1a; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -7201,12 +5841,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_sendMessageUploadDocumentAction extends SendMessageAction { public static final int constructor = 0xaa0cd9e4; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { progress = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(progress); } @@ -7215,8 +5854,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_speakingInGroupCallAction extends SendMessageAction { public static final int constructor = 0xd92c2285; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -7224,8 +5862,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_sendMessageRecordVideoAction extends SendMessageAction { public static final int constructor = 0xa187d66f; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -7250,7 +5887,7 @@ public static abstract class auth_SentCodeType extends TLObject { public String beginning; public boolean verifiedFirebase; //custom - public static auth_SentCodeType TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static auth_SentCodeType TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { auth_SentCodeType result = null; switch (constructor) { case 0x3dbb5986: @@ -7300,12 +5937,11 @@ public static auth_SentCodeType TLdeserialize(AbstractSerializedData stream, int public static class TL_auth_sentCodeTypeApp extends auth_SentCodeType { public static final int constructor = 0x3dbb5986; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(length); } @@ -7314,12 +5950,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_auth_sentCodeTypeCall extends auth_SentCodeType { public static final int constructor = 0x5353e5a7; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(length); } @@ -7328,8 +5963,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_auth_sentCodeTypeEmailCode extends auth_SentCodeType { public static final int constructor = 0xf450f59b; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); apple_signin_allowed = (flags & 1) != 0; google_signin_allowed = (flags & 2) != 0; @@ -7343,7 +5977,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = apple_signin_allowed ? (flags | 1) : (flags &~ 1); flags = google_signin_allowed ? (flags | 2) : (flags &~ 2); @@ -7362,13 +5996,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_auth_sentCodeTypeSetUpEmailRequired extends auth_SentCodeType { public static final int constructor = 0xa5491dea; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); apple_signin_allowed = (flags & 1) != 0; google_signin_allowed = (flags & 2) != 0; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = apple_signin_allowed ? (flags | 1) : (flags &~ 1); flags = google_signin_allowed ? (flags | 2) : (flags &~ 2); @@ -7379,12 +6013,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_auth_sentCodeTypeFlashCall extends auth_SentCodeType { public static final int constructor = 0xab03c6d9; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { pattern = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(pattern); } @@ -7393,12 +6026,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_auth_sentCodeTypeMissedCall extends auth_SentCodeType { public static final int constructor = 0x82006484; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prefix = stream.readString(exception); length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(prefix); stream.writeInt32(length); @@ -7408,12 +6041,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_auth_sentCodeTypeSms extends auth_SentCodeType { public static final int constructor = 0xc000bba2; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(length); } @@ -7422,13 +6054,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_auth_sentCodeTypeFragmentSms extends auth_SentCodeType { public static final int constructor = 0xd9565c39; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); stream.writeInt32(length); @@ -7438,8 +6069,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_auth_sentCodeTypeFirebaseSms extends auth_SentCodeType { public static final int constructor = 0x9fd736; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { nonce = stream.readByteArray(exception); @@ -7457,7 +6087,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -7479,14 +6109,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_auth_sentCodeTypeSmsWord extends auth_SentCodeType { public static final int constructor = 0xa416ac81; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { beginning = stream.readString(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -7498,14 +6128,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_auth_sentCodeTypeSmsPhrase extends auth_SentCodeType { public static final int constructor = 0xb37794af; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { beginning = stream.readString(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -7517,7 +6147,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class messages_StickerSetInstallResult extends TLObject { public ArrayList sets = new ArrayList<>(); - public static messages_StickerSetInstallResult TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static messages_StickerSetInstallResult TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { messages_StickerSetInstallResult result = null; switch (constructor) { case 0x38641628: @@ -7540,8 +6170,7 @@ public static messages_StickerSetInstallResult TLdeserialize(AbstractSerializedD public static class TL_messages_stickerSetInstallResultSuccess extends messages_StickerSetInstallResult { public static final int constructor = 0x38641628; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -7549,37 +6178,16 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messages_stickerSetInstallResultArchive extends messages_StickerSetInstallResult { public static final int constructor = 0x35e410a8; - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - StickerSetCovered object = StickerSetCovered.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - sets.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + sets = Vector.deserialize(stream, StickerSetCovered::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = sets.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - sets.get(a).serializeToStream(stream); - } + Vector.serialize(stream, sets); } } - public static class PeerSettings extends TLObject { public int flags; @@ -7600,7 +6208,7 @@ public static class PeerSettings extends TLObject { public long business_bot_id; public String business_bot_manage_url; - public static PeerSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static PeerSettings TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { PeerSettings result = null; switch (constructor) { case TL_peerSettings.constructor: @@ -7623,7 +6231,7 @@ public static PeerSettings TLdeserialize(AbstractSerializedData stream, int cons public static class TL_peerSettings extends PeerSettings { public static final int constructor = 0xacd66c5e; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); report_spam = (flags & 1) != 0; add_contact = (flags & 2) != 0; @@ -7653,7 +6261,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = report_spam ? (flags | 1) : (flags &~ 1); flags = add_contact ? (flags | 2) : (flags &~ 2); @@ -7688,7 +6296,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_peerSettings_layer176 extends TL_peerSettings { public static final int constructor = 0xa518110d; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); report_spam = (flags & 1) != 0; add_contact = (flags & 2) != 0; @@ -7710,7 +6318,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = report_spam ? (flags | 1) : (flags &~ 1); flags = add_contact ? (flags | 2) : (flags &~ 2); @@ -7740,7 +6348,7 @@ public static class TL_readParticipantDate extends TLObject { public long user_id; public int date; - public static TL_readParticipantDate TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_readParticipantDate TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_readParticipantDate.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_readParticipantDate", constructor)); @@ -7753,12 +6361,12 @@ public static TL_readParticipantDate TLdeserialize(AbstractSerializedData stream return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); stream.writeInt32(date); @@ -7767,7 +6375,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class InputDialogPeer extends TLObject { - public static InputDialogPeer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputDialogPeer TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputDialogPeer result = null; switch (constructor) { case 0xfcaafeb7: @@ -7792,11 +6400,11 @@ public static class TL_inputDialogPeer extends InputDialogPeer { public InputPeer peer; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); } @@ -7807,11 +6415,11 @@ public static class TL_inputDialogPeerFolder extends InputDialogPeer { public int folder_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { folder_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(folder_id); } @@ -7819,7 +6427,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class payments_PaymentResult extends TLObject { - public static payments_PaymentResult TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static payments_PaymentResult TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { payments_PaymentResult result = null; switch (constructor) { case 0xd8411139: @@ -7844,11 +6452,11 @@ public static class TL_payments_paymentVerificationNeeded extends payments_Payme public String url; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); } @@ -7859,11 +6467,11 @@ public static class TL_payments_paymentResult extends payments_PaymentResult { public Updates updates; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { updates = Updates.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); updates.serializeToStream(stream); } @@ -7876,7 +6484,7 @@ public static class TL_channels_adminLogResults extends TLObject { public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_channels_adminLogResults TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_channels_adminLogResults TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_channels_adminLogResults.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_channels_adminLogResults", constructor)); @@ -7889,74 +6497,17 @@ public static TL_channels_adminLogResults TLdeserialize(AbstractSerializedData s return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_channelAdminLogEvent object = TL_channelAdminLogEvent.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - events.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + events = Vector.deserialize(stream, TL_channelAdminLogEvent::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = events.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - events.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, events); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } @@ -7968,7 +6519,7 @@ public static class TL_inputPhoneContact extends TLObject { public String first_name; public String last_name; - public static TL_inputPhoneContact TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_inputPhoneContact TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_inputPhoneContact.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_inputPhoneContact", constructor)); @@ -7981,14 +6532,14 @@ public static TL_inputPhoneContact TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { client_id = stream.readInt64(exception); phone = stream.readString(exception); first_name = stream.readString(exception); last_name = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(client_id); stream.writeString(phone); @@ -8007,7 +6558,7 @@ public static abstract class ThemeSettings extends TLObject { public ArrayList message_colors = new ArrayList<>(); public WallPaper wallpaper; - public static ThemeSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static ThemeSettings TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { ThemeSettings result = null; switch (constructor) { case 0xfa58b6d4: @@ -8033,7 +6584,7 @@ public static ThemeSettings TLdeserialize(AbstractSerializedData stream, int con public static class TL_themeSettings extends ThemeSettings { public static final int constructor = 0xfa58b6d4; - public static TL_themeSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_themeSettings TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_themeSettings.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_themeSettings", constructor)); @@ -8046,7 +6597,7 @@ public static TL_themeSettings TLdeserialize(AbstractSerializedData stream, int return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); message_colors_animated = (flags & 4) != 0; base_theme = BaseTheme.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -8055,24 +6606,14 @@ public void readParams(AbstractSerializedData stream, boolean exception) { outbox_accent_color = stream.readInt32(exception); } if ((flags & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - message_colors.add(stream.readInt32(exception)); - } + message_colors = Vector.deserializeInt(stream, exception); } if ((flags & 2) != 0) { wallpaper = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = message_colors_animated ? (flags | 4) : (flags &~ 4); stream.writeInt32(flags); @@ -8082,12 +6623,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(outbox_accent_color); } if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = message_colors.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(message_colors.get(a)); - } + Vector.serializeInt(stream, message_colors); } if ((flags & 2) != 0) { wallpaper.serializeToStream(stream); @@ -8098,43 +6634,27 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_themeSettings_layer132 extends ThemeSettings { public static final int constructor = 0x8db4e76c; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); message_colors_animated = (flags & 4) != 0; base_theme = BaseTheme.TLdeserialize(stream, stream.readInt32(exception), exception); accent_color = stream.readInt32(exception); if ((flags & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - message_colors.add(stream.readInt32(exception)); - } + message_colors = Vector.deserializeInt(stream, exception); } if ((flags & 2) != 0) { wallpaper = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = message_colors_animated ? (flags | 4) : (flags &~ 4); stream.writeInt32(flags); base_theme.serializeToStream(stream); stream.writeInt32(accent_color); if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = message_colors.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(message_colors.get(a)); - } + Vector.serializeInt(stream, message_colors); } if ((flags & 2) != 0) { wallpaper.serializeToStream(stream); @@ -8145,8 +6665,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_themeSettings_layer131 extends ThemeSettings { public static final int constructor = 0x9c14984a; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); base_theme = BaseTheme.TLdeserialize(stream, stream.readInt32(exception), exception); accent_color = stream.readInt32(exception); @@ -8167,7 +6686,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); base_theme.serializeToStream(stream); @@ -8190,7 +6709,7 @@ public static class TL_pageCaption extends TLObject { public RichText text; public RichText credit; - public static TL_pageCaption TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_pageCaption TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_pageCaption.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_pageCaption", constructor)); @@ -8203,12 +6722,12 @@ public static TL_pageCaption TLdeserialize(AbstractSerializedData stream, int co return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); credit = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); credit.serializeToStream(stream); @@ -8217,7 +6736,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class PrivacyRule extends TLObject { - public static PrivacyRule TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static PrivacyRule TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { PrivacyRule result = null; switch (constructor) { case 0xf888fa1a: @@ -8270,8 +6789,7 @@ public static PrivacyRule TLdeserialize(AbstractSerializedData stream, int const public static class TL_privacyValueDisallowContacts extends PrivacyRule { public static final int constructor = 0xf888fa1a; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -8281,28 +6799,13 @@ public static class TL_privacyValueDisallowUsers extends PrivacyRule { public ArrayList users = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - users.add(stream.readInt64(exception)); - } + public void readParams(InputSerializedData stream, boolean exception) { + users = Vector.deserializeLong(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(users.get(a)); - } + Vector.serializeLong(stream, users); } } @@ -8311,28 +6814,13 @@ public static class TL_privacyValueAllowChatParticipants extends PrivacyRule { public ArrayList chats = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - chats.add(stream.readInt64(exception)); - } + public void readParams(InputSerializedData stream, boolean exception) { + chats = Vector.deserializeLong(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(chats.get(a)); - } + Vector.serializeLong(stream, chats); } } @@ -8341,36 +6829,20 @@ public static class TL_privacyValueDisallowChatParticipants extends PrivacyRule public ArrayList chats = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - chats.add(stream.readInt64(exception)); - } + public void readParams(InputSerializedData stream, boolean exception) { + chats = Vector.deserializeLong(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(chats.get(a)); - } + Vector.serializeLong(stream, chats); } } public static class TL_privacyValueAllowAll extends PrivacyRule { public static final int constructor = 0x65427b82; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -8378,8 +6850,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_privacyValueDisallowAll extends PrivacyRule { public static final int constructor = 0x8b73e763; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -8389,36 +6860,20 @@ public static class TL_privacyValueAllowUsers extends PrivacyRule { public ArrayList users = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - users.add(stream.readInt64(exception)); - } + public void readParams(InputSerializedData stream, boolean exception) { + users = Vector.deserializeLong(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(users.get(a)); - } + Vector.serializeLong(stream, users); } } public static class TL_privacyValueAllowContacts extends PrivacyRule { public static final int constructor = 0xfffe1bac; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -8426,8 +6881,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_privacyValueAllowCloseFriends extends PrivacyRule { public static final int constructor = 0xf7e8d89b; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -8435,8 +6889,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_privacyValueAllowPremium extends PrivacyRule { public static final int constructor = 0xece9814b; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -8444,8 +6897,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_privacyValueAllowBots extends PrivacyRule { public static final int constructor = 0x21461b5d; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -8453,8 +6905,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_privacyValueDisallowBots extends PrivacyRule { public static final int constructor = 0xf6a5f82f; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -8472,7 +6923,7 @@ public static class TL_pageTableCell extends TLObject { public int colspan; public int rowspan; - public static TL_pageTableCell TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_pageTableCell TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_pageTableCell.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_pageTableCell", constructor)); @@ -8485,7 +6936,7 @@ public static TL_pageTableCell TLdeserialize(AbstractSerializedData stream, int return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); header = (flags & 1) != 0; align_center = (flags & 8) != 0; @@ -8503,7 +6954,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = header ? (flags | 1) : (flags &~ 1); flags = align_center ? (flags | 8) : (flags &~ 8); @@ -8526,12 +6977,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaUnsupported_old extends TL_messageMediaUnsupported { public static final int constructor = 0x29632a36; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { bytes = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeByteArray(bytes); } @@ -8540,12 +6990,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaAudio_layer45 extends MessageMedia { public static final int constructor = 0xc6b68300; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { audio_unused = Audio.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); audio_unused.serializeToStream(stream); } @@ -8554,23 +7003,22 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaPhoto_old extends TL_messageMediaPhoto { public static final int constructor = 0xc8c45a2a; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); photo.serializeToStream(stream); } } public static class MessageExtendedMedia extends TLObject { - + public String attachPath; // custom public float downloadProgress, uploadProgress; // custom - public static MessageExtendedMedia TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static MessageExtendedMedia TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { MessageExtendedMedia result = null; switch (constructor) { case 0xad628cc8: @@ -8600,7 +7048,7 @@ public static class TL_messageExtendedMediaPreview extends MessageExtendedMedia public PhotoSize thumb; public int video_duration; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { w = stream.readInt32(exception); @@ -8616,7 +7064,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -8639,11 +7087,11 @@ public static class TL_messageExtendedMedia extends MessageExtendedMedia { public MessageMedia media; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); media.serializeToStream(stream); } @@ -8654,7 +7102,7 @@ public static class TL_messageMediaInvoice extends MessageMedia { public WebDocument webPhoto; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); shipping_address_requested = (flags & 2) != 0; test = (flags & 8) != 0; @@ -8675,7 +7123,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = shipping_address_requested ? (flags | 2) : (flags &~ 2); flags = test ? (flags | 8) : (flags &~ 8); @@ -8702,7 +7150,7 @@ public static class TL_messageMediaInvoice_layer145 extends TL_messageMediaInvoi public WebDocument photo; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); shipping_address_requested = (flags & 2) != 0; test = (flags & 8) != 0; @@ -8719,7 +7167,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { start_param = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = shipping_address_requested ? (flags | 2) : (flags &~ 2); flags = test ? (flags | 8) : (flags &~ 8); @@ -8741,8 +7189,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaUnsupported extends MessageMedia { public static final int constructor = 0x9f84f49e; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -8750,8 +7197,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaEmpty extends MessageMedia { public static final int constructor = 0x3ded6320; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -8765,7 +7211,7 @@ public static class TL_messageMediaVenue extends MessageMedia { public String result_id; //custom public TL_stories.TL_geoPointAddress geoAddress; //custom - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); title = stream.readString(exception); address = stream.readString(exception); @@ -8774,7 +7220,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { venue_type = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); geo.serializeToStream(stream); stream.writeString(title); @@ -8788,8 +7234,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaVenue_layer71 extends MessageMedia { public static final int constructor = 0x7912b71f; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); title = stream.readString(exception); address = stream.readString(exception); @@ -8797,7 +7242,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { venue_id = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); geo.serializeToStream(stream); stream.writeString(title); @@ -8810,21 +7255,120 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaVideo_old extends TL_messageMediaVideo_layer45 { public static final int constructor = 0xa2d24290; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { video_unused = Video.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); video_unused.serializeToStream(stream); } } public static class TL_messageMediaDocument extends MessageMedia { + public static final int constructor = 0x52d8ccd9; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + nopremium = (flags & 8) != 0; + spoiler = (flags & 16) != 0; + video = (flags & 64) != 0; + round = (flags & 128) != 0; + voice = (flags & 256) != 0; + if ((flags & 1) != 0) { + document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 32) != 0) { + alt_documents = Vector.deserialize(stream, Document::TLdeserialize, exception); + } + if ((flags & 512) != 0) { + video_cover = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 1024) != 0) { + video_timestamp = stream.readInt32(exception); + } + if ((flags & 4) != 0) { + ttl_seconds = stream.readInt32(exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = nopremium ? (flags | 8) : (flags &~ 8); + flags = spoiler ? (flags | 16) : (flags &~ 16); + flags = video ? (flags | 64) : (flags &~ 64); + flags = round ? (flags | 128) : (flags &~ 128); + flags = voice ? (flags | 256) : (flags &~ 256); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + document.serializeToStream(stream); + } + if ((flags & 32) != 0) { + Vector.serialize(stream, alt_documents); + } + if ((flags & 512) != 0) { + video_cover.serializeToStream(stream); + } + if ((flags & 1024) != 0) { + stream.writeInt32(video_timestamp); + } + if ((flags & 4) != 0) { + stream.writeInt32(ttl_seconds); + } + } + } + + public static class TL_messageMediaDocument_layer197_2 extends TL_messageMediaDocument { + public static final int constructor = 0xdbbdf614; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + nopremium = (flags & 8) != 0; + spoiler = (flags & 16) != 0; + video = (flags & 64) != 0; + round = (flags & 128) != 0; + voice = (flags & 256) != 0; + if ((flags & 1) != 0) { + document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 32) != 0) { + alt_documents = Vector.deserialize(stream, Document::TLdeserialize, exception); + } + if ((flags & 512) != 0) { + video_cover = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4) != 0) { + ttl_seconds = stream.readInt32(exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = nopremium ? (flags | 8) : (flags &~ 8); + flags = spoiler ? (flags | 16) : (flags &~ 16); + flags = video ? (flags | 64) : (flags &~ 64); + flags = round ? (flags | 128) : (flags &~ 128); + flags = voice ? (flags | 256) : (flags &~ 256); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + document.serializeToStream(stream); + } + if ((flags & 32) != 0) { + Vector.serialize(stream, alt_documents); + } + if ((flags & 512) != 0) { + video_cover.serializeToStream(stream); + } + if ((flags & 4) != 0) { + stream.writeInt32(ttl_seconds); + } + } + } + + public static class TL_messageMediaDocument_layer197 extends TL_messageMediaDocument { public static final int constructor = 0xdd570bd5; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); nopremium = (flags & 8) != 0; spoiler = (flags & 16) != 0; @@ -8835,28 +7379,14 @@ public void readParams(AbstractSerializedData stream, boolean exception) { document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 32) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - alt_documents.add(object); - } + alt_documents = Vector.deserialize(stream, Document::TLdeserialize, exception); } if ((flags & 4) != 0) { ttl_seconds = stream.readInt32(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = nopremium ? (flags | 8) : (flags &~ 8); flags = spoiler ? (flags | 16) : (flags &~ 16); @@ -8868,11 +7398,7 @@ public void serializeToStream(AbstractSerializedData stream) { document.serializeToStream(stream); } if ((flags & 32) != 0) { - stream.writeInt32(0x1cb5c415); - stream.writeInt32(alt_documents.size()); - for (int i = 0; i < alt_documents.size(); ++i) { - alt_documents.get(i).serializeToStream(stream); - } + Vector.serialize(stream, alt_documents); } if ((flags & 4) != 0) { stream.writeInt32(ttl_seconds); @@ -8883,8 +7409,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaDocument_layer187 extends TL_messageMediaDocument { public static final int constructor = 0x4cf4d72d; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); nopremium = (flags & 8) != 0; spoiler = (flags & 16) != 0; @@ -8902,7 +7427,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = nopremium ? (flags | 8) : (flags &~ 8); flags = spoiler ? (flags | 16) : (flags &~ 16); @@ -8925,8 +7450,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaDocument_layer159 extends TL_messageMediaDocument { public static final int constructor = 0x9cb070d7; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); nopremium = (flags & 8) != 0; spoiler = (flags & 16) != 0; @@ -8940,7 +7464,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = nopremium ? (flags | 8) : (flags &~ 8); flags = spoiler ? (flags | 16) : (flags &~ 16); @@ -8958,8 +7482,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaDocument_layer74 extends TL_messageMediaDocument { public static final int constructor = 0x7c4414d3; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -8974,7 +7497,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -8992,12 +7515,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaDocument_old extends TL_messageMediaDocument { public static final int constructor = 0x2fda2204; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); document.serializeToStream(stream); } @@ -9006,13 +7528,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaDocument_layer68 extends TL_messageMediaDocument { public static final int constructor = 0xf3e02ea8; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); captionLegacy = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); document.serializeToStream(stream); stream.writeString(captionLegacy); @@ -9022,7 +7543,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaPhoto extends MessageMedia { public static final int constructor = 0x695150d7; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); spoiler = (flags & 8) != 0; if ((flags & 1) != 0) { @@ -9035,7 +7556,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = spoiler ? (flags | 8) : (flags &~ 8); stream.writeInt32(flags); @@ -9054,12 +7575,12 @@ public static class TL_messageMediaPoll extends MessageMedia { public Poll poll; public PollResults results; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { poll = Poll.TLdeserialize(stream, stream.readInt32(exception), exception); results = PollResults.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); poll.serializeToStream(stream); results.serializeToStream(stream); @@ -9069,7 +7590,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaPhoto_layer74 extends TL_messageMediaPhoto { public static final int constructor = 0xb5223b0f; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -9084,7 +7605,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -9113,7 +7634,7 @@ public static class TL_inputMediaInvoice extends InputMedia { public String start_param; public InputMedia extend_media; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); title = stream.readString(exception); description = stream.readString(exception); @@ -9134,7 +7655,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(title); @@ -9158,8 +7679,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaGeoLive extends MessageMedia { public static final int constructor = 0xb940c666; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 1) != 0) { @@ -9171,7 +7691,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); geo.serializeToStream(stream); @@ -9188,13 +7708,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaGeoLive_layer119 extends TL_messageMediaGeoLive { public static final int constructor = 0x7c3c2609; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); period = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); geo.serializeToStream(stream); stream.writeInt32(period); @@ -9204,12 +7723,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaGame extends MessageMedia { public static final int constructor = 0xfdb19008; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { game = TL_game.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); game.serializeToStream(stream); } @@ -9218,15 +7736,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaContact_layer81 extends TL_messageMediaContact { public static final int constructor = 0x5e7d2f39; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { phone_number = stream.readString(exception); first_name = stream.readString(exception); last_name = stream.readString(exception); user_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(phone_number); stream.writeString(first_name); @@ -9238,13 +7755,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaPhoto_layer68 extends TL_messageMediaPhoto { public static final int constructor = 0x3d8ce53d; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); captionLegacy = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); photo.serializeToStream(stream); stream.writeString(captionLegacy); @@ -9254,13 +7770,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaVideo_layer45 extends MessageMedia { public static final int constructor = 0x5bcf1675; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { video_unused = Video.TLdeserialize(stream, stream.readInt32(exception), exception); captionLegacy = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); video_unused.serializeToStream(stream); stream.writeString(captionLegacy); @@ -9270,7 +7785,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaContact_layer131 extends TL_messageMediaContact { public static final int constructor = 0xcbf24940; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { phone_number = stream.readString(exception); first_name = stream.readString(exception); last_name = stream.readString(exception); @@ -9278,7 +7793,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { user_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(phone_number); stream.writeString(first_name); @@ -9291,8 +7806,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaContact extends MessageMedia { public static final int constructor = 0x70322949; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { phone_number = stream.readString(exception); first_name = stream.readString(exception); last_name = stream.readString(exception); @@ -9300,7 +7814,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(phone_number); stream.writeString(first_name); @@ -9316,12 +7830,12 @@ public static class TL_messageMediaDice extends MessageMedia { public int value; public String emoticon; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { value = stream.readInt32(exception); emoticon = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(value); stream.writeString(emoticon); @@ -9331,11 +7845,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaDice_layer111 extends TL_messageMediaDice { public static final int constructor = 0x638fe46b; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { value = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(value); } @@ -9344,11 +7858,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaGeo extends MessageMedia { public static final int constructor = 0x56e0d474; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); geo.serializeToStream(stream); } @@ -9357,7 +7871,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaWebPage extends MessageMedia { public static final int constructor = 0xddf10c3b; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); force_large_media = (flags & 1) != 0; force_small_media = (flags & 2) != 0; @@ -9366,7 +7880,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { webpage = WebPage.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = force_large_media ? (flags | 1) : (flags &~ 1); flags = force_small_media ? (flags | 2) : (flags &~ 2); @@ -9380,12 +7894,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageMediaWebPage_layer165 extends TL_messageMediaWebPage { public static final int constructor = 0xa32dd600; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { webpage = WebPage.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); webpage.serializeToStream(stream); } @@ -9402,7 +7915,7 @@ public static abstract class LangPackString extends TLObject { public String other_value; public String value; - public static LangPackString TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static LangPackString TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { LangPackString result = null; switch (constructor) { case 0x6c47ac9f: @@ -9428,8 +7941,7 @@ public static LangPackString TLdeserialize(AbstractSerializedData stream, int co public static class TL_langPackStringPluralized extends LangPackString { public static final int constructor = 0x6c47ac9f; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); key = stream.readString(exception); if ((flags & 1) != 0) { @@ -9450,7 +7962,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { other_value = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(key); @@ -9476,13 +7988,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_langPackString extends LangPackString { public static final int constructor = 0xcad181f6; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { key = stream.readString(exception); value = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(key); stream.writeString(value); @@ -9492,12 +8003,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_langPackStringDeleted extends LangPackString { public static final int constructor = 0x2979eeb2; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { key = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(key); } @@ -9512,7 +8022,7 @@ public static abstract class auth_SentCode extends TLObject { public int timeout; public auth_Authorization authorization; - public static auth_SentCode TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static auth_SentCode TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { auth_SentCode result = null; switch (constructor) { case 0x2390fe44: @@ -9535,11 +8045,11 @@ public static auth_SentCode TLdeserialize(AbstractSerializedData stream, int con public static class TL_auth_sentCodeSuccess extends auth_SentCode { public static final int constructor = 0x2390fe44; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { authorization = auth_Authorization.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); authorization.serializeToStream(stream); } @@ -9548,7 +8058,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_auth_sentCode extends auth_SentCode { public static final int constructor = 0x5e002502; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); type = auth_SentCodeType.TLdeserialize(stream, stream.readInt32(exception), exception); phone_code_hash = stream.readString(exception); @@ -9560,7 +8070,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); type.serializeToStream(stream); @@ -9589,7 +8099,7 @@ public static abstract class BotInlineResult extends TLObject { public BotInlineMessage send_message; public long query_id; - public static BotInlineResult TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static BotInlineResult TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { BotInlineResult result = null; switch (constructor) { case 0x11965f3a: @@ -9612,7 +8122,7 @@ public static BotInlineResult TLdeserialize(AbstractSerializedData stream, int c public static class TL_botInlineResult extends BotInlineResult { public static final int constructor = 0x11965f3a; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); id = stream.readString(exception); type = stream.readString(exception); @@ -9634,7 +8144,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { send_message = BotInlineMessage.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(id); @@ -9661,7 +8171,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_botInlineMediaResult extends BotInlineResult { public static final int constructor = 0x17db940b; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); id = stream.readString(exception); type = stream.readString(exception); @@ -9680,7 +8190,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { send_message = BotInlineMessage.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(id); @@ -9704,8 +8214,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_notificationSoundDefault extends NotificationSound { public static final int constructor = 0x97e8bebe; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -9713,8 +8222,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_notificationSoundNone extends NotificationSound { public static final int constructor = 0x6f0c34df; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -9724,11 +8232,11 @@ public static class TL_notificationSoundRingtone extends NotificationSound { public long id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); } @@ -9740,12 +8248,12 @@ public static class TL_notificationSoundLocal extends NotificationSound { public String title; public String data; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { title = stream.readString(exception); data = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(title); stream.writeString(data); @@ -9754,7 +8262,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class NotificationSound extends TLObject { - public static NotificationSound TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static NotificationSound TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { NotificationSound result = null; switch (constructor) { case 0x97e8bebe: @@ -9796,7 +8304,7 @@ public static abstract class PeerNotifySettings extends TLObject { public NotificationSound stories_android_sound; public NotificationSound stories_other_sound; - public static PeerNotifySettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static PeerNotifySettings TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { PeerNotifySettings result = null; switch (constructor) { case 0x99622c0c: @@ -9831,7 +8339,7 @@ public static PeerNotifySettings TLdeserialize(AbstractSerializedData stream, in public static class TL_peerNotifySettings_layer77 extends TL_peerNotifySettings { public static final int constructor = 0x9acda4c0; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); show_previews = (flags & 1) != 0; silent = (flags & 2) != 0; @@ -9839,7 +8347,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { sound = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = show_previews ? (flags | 1) : (flags &~ 1); flags = silent ? (flags | 2) : (flags &~ 2); @@ -9852,7 +8360,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_peerNotifySettings extends PeerNotifySettings { public static final int constructor = 0x99622c0c; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { show_previews = stream.readBool(exception); @@ -9889,7 +8397,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -9931,7 +8439,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_peerNotifySettings_layer156 extends TL_peerNotifySettings { public static final int constructor = 0xa83b0426; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { show_previews = stream.readBool(exception); @@ -9953,7 +8461,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -9980,7 +8488,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_peerNotifySettings_layer139 extends TL_peerNotifySettings { public static final int constructor = 0xaf509d20; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { show_previews = stream.readBool(exception); @@ -9996,7 +8504,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -10017,14 +8525,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_peerNotifySettings_layer47 extends TL_peerNotifySettings { public static final int constructor = 0x8d5e11ee; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { mute_until = stream.readInt32(exception); sound = stream.readString(exception); show_previews = stream.readBool(exception); events_mask = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(mute_until); stream.writeString(sound); @@ -10036,8 +8544,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_peerNotifySettingsEmpty_layer77 extends PeerNotifySettings { public static final int constructor = 0x70a68512; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -10049,7 +8556,7 @@ public static abstract class contacts_Blocked extends TLObject { public ArrayList users = new ArrayList<>(); public int count; - public static contacts_Blocked TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static contacts_Blocked TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { contacts_Blocked result = null; switch (constructor) { case 0xade1591: @@ -10072,152 +8579,36 @@ public static contacts_Blocked TLdeserialize(AbstractSerializedData stream, int public static class TL_contacts_blocked extends contacts_Blocked { public static final int constructor = 0xade1591; - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_peerBlocked object = TL_peerBlocked.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - blocked.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + blocked = Vector.deserialize(stream, TL_peerBlocked::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = blocked.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - blocked.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, blocked); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } public static class TL_contacts_blockedSlice extends contacts_Blocked { public static final int constructor = 0xe1664194; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_peerBlocked object = TL_peerBlocked.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - blocked.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + blocked = Vector.deserialize(stream, TL_peerBlocked::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = blocked.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - blocked.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, blocked); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } @@ -10234,7 +8625,7 @@ public static class TL_inputSecureValue extends TLObject { public ArrayList files = new ArrayList<>(); public SecurePlainData plain_data; - public static TL_inputSecureValue TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_inputSecureValue TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_inputSecureValue.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_inputSecureValue", constructor)); @@ -10247,7 +8638,7 @@ public static TL_inputSecureValue TLdeserialize(AbstractSerializedData stream, i return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 1) != 0) { @@ -10263,45 +8654,17 @@ public void readParams(AbstractSerializedData stream, boolean exception) { selfie = InputSecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 64) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputSecureFile object = InputSecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - translation.add(object); - } + translation = Vector.deserialize(stream, InputSecureFile::TLdeserialize, exception); } if ((flags & 16) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputSecureFile object = InputSecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - files.add(object); - } + files = Vector.deserialize(stream, InputSecureFile::TLdeserialize, exception); } if ((flags & 32) != 0) { plain_data = SecurePlainData.TLdeserialize(stream, stream.readInt32(exception), exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); type.serializeToStream(stream); @@ -10318,20 +8681,10 @@ public void serializeToStream(AbstractSerializedData stream) { selfie.serializeToStream(stream); } if ((flags & 64) != 0) { - stream.writeInt32(0x1cb5c415); - int count = translation.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - translation.get(a).serializeToStream(stream); - } + Vector.serialize(stream, translation); } if ((flags & 16) != 0) { - stream.writeInt32(0x1cb5c415); - int count = files.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - files.get(a).serializeToStream(stream); - } + Vector.serialize(stream, files); } if ((flags & 32) != 0) { plain_data.serializeToStream(stream); @@ -10341,7 +8694,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class help_AppConfig extends TLObject { - public static help_AppConfig TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static help_AppConfig TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { help_AppConfig result = null; switch (constructor) { case 0xdd18782e: @@ -10367,12 +8720,12 @@ public static class TL_help_appConfig extends help_AppConfig { public int hash; public JSONValue config; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { hash = stream.readInt32(exception); config = JSONValue.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(hash); config.serializeToStream(stream); @@ -10382,7 +8735,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_help_appConfigNotModified extends help_AppConfig { public static final int constructor = 0x7cde641d; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -10393,7 +8746,7 @@ public static abstract class messages_DhConfig extends TLObject { public byte[] p; public int version; - public static messages_DhConfig TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static messages_DhConfig TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { messages_DhConfig result = null; switch (constructor) { case 0xc0e24635: @@ -10416,12 +8769,11 @@ public static messages_DhConfig TLdeserialize(AbstractSerializedData stream, int public static class TL_messages_dhConfigNotModified extends messages_DhConfig { public static final int constructor = 0xc0e24635; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { random = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeByteArray(random); } @@ -10430,15 +8782,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messages_dhConfig extends messages_DhConfig { public static final int constructor = 0x2c221edd; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { g = stream.readInt32(exception); p = stream.readByteArray(exception); version = stream.readInt32(exception); random = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(g); stream.writeByteArray(p); @@ -10457,7 +8808,7 @@ public static class TL_globalPrivacySettings extends TLObject { public boolean hide_read_marks; public boolean new_noncontact_peers_require_premium; - public static TL_globalPrivacySettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_globalPrivacySettings TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_globalPrivacySettings.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_globalPrivacySettings", constructor)); @@ -10470,7 +8821,7 @@ public static TL_globalPrivacySettings TLdeserialize(AbstractSerializedData stre return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); archive_and_mute_new_noncontact_peers = (flags & 1) != 0; keep_archived_unmuted = (flags & 2) != 0; @@ -10479,7 +8830,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { new_noncontact_peers_require_premium = (flags & 16) != 0; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = archive_and_mute_new_noncontact_peers ? (flags | 1) : (flags &~ 1); flags = keep_archived_unmuted ? (flags | 2) : (flags &~ 2); @@ -10493,171 +8844,46 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_help_premiumPromo_layer144 extends TL_help_premiumPromo { public static final int constructor = 0x8a4f3c29; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { status_text = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - status_entities.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - video_sections.add(stream.readString(exception)); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - videos.add(object); - } + status_entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); + video_sections = Vector.deserializeString(stream, exception); + videos = Vector.deserialize(stream, Document::TLdeserialize, exception); currency = stream.readString(exception); monthly_amount = stream.readInt64(exception); - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(status_text); - stream.writeInt32(0x1cb5c415); - int count = status_entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - status_entities.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = video_sections.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(video_sections.get(a)); - } - stream.writeInt32(0x1cb5c415); - count = videos.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - videos.get(a).serializeToStream(stream); - } + Vector.serialize(stream, status_entities); + Vector.serializeString(stream, video_sections); + Vector.serialize(stream, videos); stream.writeString(currency); stream.writeInt64(monthly_amount); - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, users); } } public static class TL_help_premiumPromo_layer140 extends TL_help_premiumPromo { public static final int constructor = 0xe0360f1b; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { status_text = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - status_entities.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - video_sections.add(stream.readString(exception)); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - videos.add(object); - } + status_entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); + video_sections = Vector.deserializeString(stream, exception); + videos = Vector.deserialize(stream, Document::TLdeserialize, exception); currency = stream.readString(exception); monthly_amount = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(status_text); - stream.writeInt32(0x1cb5c415); - int count = status_entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - status_entities.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = video_sections.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(video_sections.get(a)); - } - stream.writeInt32(0x1cb5c415); - count = videos.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - videos.get(a).serializeToStream(stream); - } + Vector.serialize(stream, status_entities); + Vector.serializeString(stream, video_sections); + Vector.serialize(stream, videos); stream.writeString(currency); stream.writeInt64(monthly_amount); } @@ -10675,7 +8901,7 @@ public static class TL_help_premiumPromo extends TLObject { public String currency; public long monthly_amount; - public static TL_help_premiumPromo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_help_premiumPromo TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { TL_help_premiumPromo result = null; switch (constructor) { case 0x5334759c: @@ -10707,120 +8933,29 @@ public static TL_help_premiumPromo TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { status_text = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - status_entities.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - video_sections.add(stream.readString(exception)); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - videos.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_premiumSubscriptionOption object = TL_premiumSubscriptionOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - period_options.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + status_entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); + video_sections = Vector.deserializeString(stream, exception); + videos = Vector.deserialize(stream, Document::TLdeserialize, exception); + period_options = Vector.deserialize(stream, TL_premiumSubscriptionOption::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(status_text); - stream.writeInt32(0x1cb5c415); - int count = status_entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - status_entities.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = video_sections.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(video_sections.get(a)); - } - stream.writeInt32(0x1cb5c415); - count = videos.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - videos.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = period_options.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - period_options.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, status_entities); + Vector.serializeString(stream, video_sections); + Vector.serialize(stream, videos); + Vector.serialize(stream, period_options); + Vector.serialize(stream, users); } } public static abstract class help_UserInfo extends TLObject { - public static help_UserInfo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static help_UserInfo TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { help_UserInfo result = null; switch (constructor) { case 0xf3ae2eed: @@ -10843,8 +8978,7 @@ public static help_UserInfo TLdeserialize(AbstractSerializedData stream, int con public static class TL_help_userInfoEmpty extends help_UserInfo { public static final int constructor = 0xf3ae2eed; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -10857,36 +8991,17 @@ public static class TL_help_userInfo extends help_UserInfo { public String author; public int date; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { message = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); author = stream.readString(exception); date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(message); - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); stream.writeString(author); stream.writeInt32(date); } @@ -10898,7 +9013,7 @@ public static class TL_secureValueHash extends TLObject { public SecureValueType type; public byte[] hash; - public static TL_secureValueHash TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_secureValueHash TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_secureValueHash.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_secureValueHash", constructor)); @@ -10911,12 +9026,12 @@ public static TL_secureValueHash TLdeserialize(AbstractSerializedData stream, in return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); hash = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); type.serializeToStream(stream); stream.writeByteArray(hash); @@ -10930,7 +9045,7 @@ public static abstract class messages_StickerSet extends TLObject { public ArrayList keywords = new ArrayList<>(); public ArrayList documents = new ArrayList<>(); - public static TL_messages_stickerSet TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_stickerSet TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { TL_messages_stickerSet result = null; switch (constructor) { case 0x6e153f16: @@ -10956,138 +9071,43 @@ public static TL_messages_stickerSet TLdeserialize(AbstractSerializedData stream public static class TL_messages_stickerSet_layer146 extends TL_messages_stickerSet { public static final int constructor = 0xb60a24a6; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { set = StickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_stickerPack object = TL_stickerPack.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - packs.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - documents.add(object); - } + packs = Vector.deserialize(stream, TL_stickerPack::TLdeserialize, exception); + documents = Vector.deserialize(stream, Document::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); set.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = packs.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - packs.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = documents.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - documents.get(a).serializeToStream(stream); - } + Vector.serialize(stream, packs); + Vector.serialize(stream, documents); } } public static class TL_messages_stickerSet extends messages_StickerSet { public static final int constructor = 0x6e153f16; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { set = StickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_stickerPack object = TL_stickerPack.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - packs.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_stickerKeyword object = TL_stickerKeyword.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - keywords.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - documents.add(object); - } + packs = Vector.deserialize(stream, TL_stickerPack::TLdeserialize, exception); + keywords = Vector.deserialize(stream, TL_stickerKeyword::TLdeserialize, exception); + documents = Vector.deserialize(stream, Document::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); set.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = packs.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - packs.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = keywords.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - keywords.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = documents.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - documents.get(a).serializeToStream(stream); - } + Vector.serialize(stream, packs); + Vector.serialize(stream, keywords); + Vector.serialize(stream, documents); } } public static class TL_messages_stickerSetNotModified extends TL_messages_stickerSet { public static final int constructor = 0xd3f924eb; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -11099,7 +9119,7 @@ public static abstract class InputGeoPoint extends TLObject { public double _long; public int accuracy_radius; - public static InputGeoPoint TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputGeoPoint TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputGeoPoint result = null; switch (constructor) { case 0x48222faf: @@ -11122,8 +9142,7 @@ public static InputGeoPoint TLdeserialize(AbstractSerializedData stream, int con public static class TL_inputGeoPoint extends InputGeoPoint { public static final int constructor = 0x48222faf; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); lat = stream.readDouble(exception); _long = stream.readDouble(exception); @@ -11132,7 +9151,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeDouble(lat); @@ -11146,8 +9165,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputGeoPointEmpty extends InputGeoPoint { public static final int constructor = 0xe4c123d6; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -11157,7 +9175,7 @@ public static class TL_help_inviteText extends TLObject { public String message; - public static TL_help_inviteText TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_help_inviteText TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_help_inviteText.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_help_inviteText", constructor)); @@ -11170,11 +9188,11 @@ public static TL_help_inviteText TLdeserialize(AbstractSerializedData stream, in return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { message = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(message); } @@ -11192,7 +9210,7 @@ public static abstract class Audio extends TLObject { public byte[] key; public byte[] iv; - public static Audio TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static Audio TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { Audio result = null; switch (constructor) { case 0x586988d8: @@ -11224,12 +9242,11 @@ public static Audio TLdeserialize(AbstractSerializedData stream, int constructor public static class TL_audioEmpty_layer45 extends Audio { public static final int constructor = 0x586988d8; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); } @@ -11238,8 +9255,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_audio_layer45 extends Audio { public static final int constructor = 0xf9e35055; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); date = stream.readInt32(exception); @@ -11249,7 +9265,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { dc_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -11264,8 +9280,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_audio_old extends TL_audio_layer45 { public static final int constructor = 0x427425e7; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); user_id = stream.readInt32(exception); @@ -11275,7 +9290,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { dc_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -11290,8 +9305,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_audioEncrypted extends TL_audio_layer45 { public static final int constructor = 0x555555F6; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); user_id = stream.readInt32(exception); @@ -11303,7 +9317,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { iv = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -11320,8 +9334,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_audio_old2 extends TL_audio_layer45 { public static final int constructor = 0xc7ac6496; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); user_id = stream.readInt32(exception); @@ -11332,7 +9345,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { dc_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -11355,7 +9368,7 @@ public static class TL_help_country extends TLObject { public String name; public ArrayList country_codes = new ArrayList<>(); - public static TL_help_country TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_help_country TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_help_country.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_help_country", constructor)); @@ -11368,7 +9381,7 @@ public static TL_help_country TLdeserialize(AbstractSerializedData stream, int c return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); hidden = (flags & 1) != 0; iso2 = stream.readString(exception); @@ -11376,24 +9389,10 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 2) != 0) { name = stream.readString(exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_help_countryCode object = TL_help_countryCode.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - country_codes.add(object); - } + country_codes = Vector.deserialize(stream, TL_help_countryCode::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = hidden ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -11402,18 +9401,13 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 2) != 0) { stream.writeString(name); } - stream.writeInt32(0x1cb5c415); - int count = country_codes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - country_codes.get(a).serializeToStream(stream); - } + Vector.serialize(stream, country_codes); } } public static abstract class SecurePasswordKdfAlgo extends TLObject { - public static SecurePasswordKdfAlgo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static SecurePasswordKdfAlgo TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { SecurePasswordKdfAlgo result = null; switch (constructor) { case 0xbbf2dda0: @@ -11441,11 +9435,11 @@ public static class TL_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000 extends S public byte[] salt; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { salt = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeByteArray(salt); } @@ -11456,11 +9450,11 @@ public static class TL_securePasswordKdfAlgoSHA512 extends SecurePasswordKdfAlgo public byte[] salt; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { salt = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeByteArray(salt); } @@ -11469,8 +9463,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_securePasswordKdfAlgoUnknown extends SecurePasswordKdfAlgo { public static final int constructor = 0x4a8537; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -11480,7 +9473,7 @@ public static class TL_messages_historyImport extends TLObject { public long id; - public static TL_messages_historyImport TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_historyImport TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_historyImport.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_historyImport", constructor)); @@ -11493,11 +9486,11 @@ public static TL_messages_historyImport TLdeserialize(AbstractSerializedData str return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); } @@ -11509,7 +9502,7 @@ public static abstract class InputGame extends TLObject { public long id; public long access_hash; - public static InputGame TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputGame TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputGame result = null; switch (constructor) { case 0xc331e80a: @@ -11532,13 +9525,12 @@ public static InputGame TLdeserialize(AbstractSerializedData stream, int constru public static class TL_inputGameShortName extends InputGame { public static final int constructor = 0xc331e80a; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { bot_id = InputUser.TLdeserialize(stream, stream.readInt32(exception), exception); short_name = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); bot_id.serializeToStream(stream); stream.writeString(short_name); @@ -11548,13 +9540,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputGameID extends InputGame { public static final int constructor = 0x32c3e77; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -11572,7 +9563,7 @@ public static abstract class MessageReplies extends TLObject { public int max_id; public int read_max_id; - public static MessageReplies TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static MessageReplies TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { MessageReplies result = null; switch (constructor) { case 0x4128faac: @@ -11595,28 +9586,13 @@ public static MessageReplies TLdeserialize(AbstractSerializedData stream, int co public static class TL_messageReplies_layer131 extends TL_messageReplies { public static final int constructor = 0x4128faac; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); comments = (flags & 1) != 0; replies = stream.readInt32(exception); replies_pts = stream.readInt32(exception); if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Peer object = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - recent_repliers.add(object); - } + recent_repliers = Vector.deserialize(stream, Peer::TLdeserialize, exception); } if ((flags & 1) != 0) { channel_id = stream.readInt32(exception); @@ -11629,19 +9605,14 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = comments ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); stream.writeInt32(replies); stream.writeInt32(replies_pts); if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = recent_repliers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - recent_repliers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, recent_repliers); } if ((flags & 1) != 0) { stream.writeInt32((int) channel_id); @@ -11658,28 +9629,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageReplies extends MessageReplies { public static final int constructor = 0x83d60fc2; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); comments = (flags & 1) != 0; replies = stream.readInt32(exception); replies_pts = stream.readInt32(exception); if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Peer object = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - recent_repliers.add(object); - } + recent_repliers = Vector.deserialize(stream, Peer::TLdeserialize, exception); } if ((flags & 1) != 0) { channel_id = stream.readInt64(exception); @@ -11692,19 +9648,14 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = comments ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); stream.writeInt32(replies); stream.writeInt32(replies_pts); if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = recent_repliers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - recent_repliers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, recent_repliers); } if ((flags & 1) != 0) { stream.writeInt64(channel_id); @@ -11725,7 +9676,7 @@ public static abstract class messages_SponsoredMessages extends TLObject { public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static messages_SponsoredMessages TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static messages_SponsoredMessages TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { messages_SponsoredMessages result = null; switch (constructor) { case 0x1839490f: @@ -11748,8 +9699,7 @@ public static messages_SponsoredMessages TLdeserialize(AbstractSerializedData st public static class TL_messages_sponsoredMessagesEmpty extends messages_SponsoredMessages { public static final int constructor = 0x1839490f; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -11757,82 +9707,25 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messages_sponsoredMessages extends messages_SponsoredMessages { public static final int constructor = 0xc9ee1d87; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { posts_between = stream.readInt32(exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_sponsoredMessage object = TL_sponsoredMessage.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + messages = Vector.deserialize(stream, TL_sponsoredMessage::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { stream.writeInt32(posts_between); } - stream.writeInt32(0x1cb5c415); - int count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, messages); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } @@ -11844,7 +9737,7 @@ public static class TL_messageViews extends TLObject { public int forwards; public MessageReplies replies; - public static TL_messageViews TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messageViews TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messageViews.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messageViews", constructor)); @@ -11857,7 +9750,7 @@ public static TL_messageViews TLdeserialize(AbstractSerializedData stream, int c return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { views = stream.readInt32(exception); @@ -11870,7 +9763,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -11894,8 +9787,7 @@ public static abstract class ReplyMarkup extends TLObject { public String placeholder; public ArrayList rows = new ArrayList<>(); - - public static ReplyMarkup TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static ReplyMarkup TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { ReplyMarkup result = null; switch (constructor) { case 0x85dd99d1: @@ -11930,46 +9822,26 @@ public static ReplyMarkup TLdeserialize(AbstractSerializedData stream, int const public static class TL_replyKeyboardMarkup extends ReplyMarkup { public static final int constructor = 0x85dd99d1; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); resize = (flags & 1) != 0; single_use = (flags & 2) != 0; selective = (flags & 4) != 0; is_persistent = (flags & 16) != 0; - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_keyboardButtonRow object = TL_keyboardButtonRow.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - rows.add(object); - } + rows = Vector.deserialize(stream, TL_keyboardButtonRow::TLdeserialize, exception); if ((flags & 8) != 0) { placeholder = stream.readString(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = resize ? (flags | 1) : (flags &~ 1); flags = single_use ? (flags | 2) : (flags &~ 2); flags = selective ? (flags | 4) : (flags &~ 4); flags = is_persistent ? (flags | 16) : (flags &~ 16); stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = rows.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - rows.get(a).serializeToStream(stream); - } + Vector.serialize(stream, rows); if ((flags & 8) != 0) { stream.writeString(placeholder); } @@ -11979,13 +9851,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_replyKeyboardHide extends ReplyMarkup { public static final int constructor = 0xa03e5b85; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); selective = (flags & 4) != 0; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = selective ? (flags | 4) : (flags &~ 4); stream.writeInt32(flags); @@ -11995,8 +9866,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_replyKeyboardForceReply extends ReplyMarkup { public static final int constructor = 0x86b40b08; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); single_use = (flags & 2) != 0; selective = (flags & 4) != 0; @@ -12005,7 +9875,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = single_use ? (flags | 2) : (flags &~ 2); flags = selective ? (flags | 4) : (flags &~ 4); @@ -12019,55 +9889,34 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_replyKeyboardMarkup_layer129 extends TL_replyKeyboardMarkup { public static final int constructor = 0x3502758c; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); resize = (flags & 1) != 0; single_use = (flags & 2) != 0; selective = (flags & 4) != 0; - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_keyboardButtonRow object = TL_keyboardButtonRow.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - rows.add(object); - } + rows = Vector.deserialize(stream, TL_keyboardButtonRow::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = resize ? (flags | 1) : (flags &~ 1); flags = single_use ? (flags | 2) : (flags &~ 2); flags = selective ? (flags | 4) : (flags &~ 4); stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = rows.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - rows.get(a).serializeToStream(stream); - } + Vector.serialize(stream, rows); } } public static class TL_replyKeyboardForceReply_layer129 extends TL_replyKeyboardForceReply { public static final int constructor = 0xf4108aa0; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); single_use = (flags & 2) != 0; selective = (flags & 4) != 0; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = single_use ? (flags | 2) : (flags &~ 2); flags = selective ? (flags | 4) : (flags &~ 4); @@ -12078,40 +9927,20 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_replyInlineMarkup extends ReplyMarkup { public static final int constructor = 0x48a30254; - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_keyboardButtonRow object = TL_keyboardButtonRow.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - rows.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + rows = Vector.deserialize(stream, TL_keyboardButtonRow::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = rows.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - rows.get(a).serializeToStream(stream); - } + Vector.serialize(stream, rows); } } public static class WebPageAttribute extends TLObject { public int flags; - public static WebPageAttribute TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static WebPageAttribute TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { WebPageAttribute result = null; switch (constructor) { case TL_webPageAttributeTheme.constructor: @@ -12126,6 +9955,9 @@ public static WebPageAttribute TLdeserialize(AbstractSerializedData stream, int case TL_webPageAttributeStickerSet.constructor: result = new TL_webPageAttributeStickerSet(); break; + case TL_webPageAttributeUniqueStarGift.constructor: + result = new TL_webPageAttributeUniqueStarGift(); + break; } if (result == null && exception) { throw new RuntimeException(String.format("can't parse magic %x in contacts_Contacts", constructor)); @@ -12144,7 +9976,7 @@ public static class TL_webPageAttributeStory extends WebPageAttribute { public int id; public TL_stories.StoryItem storyItem; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); id = stream.readInt32(exception); @@ -12153,7 +9985,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); peer.serializeToStream(stream); @@ -12172,45 +10004,41 @@ public static class TL_webPageAttributeStickerSet extends WebPageAttribute { public boolean text_color; public ArrayList stickers = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); emojis = (flags & 1) != 0; text_color = (flags & 2) != 0; - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - stickers.add(object); - } + stickers = Vector.deserialize(stream, Document::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = emojis ? (flags | 1) : (flags &~ 1); flags = text_color ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = stickers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stickers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, stickers); + } + } + + public static class TL_webPageAttributeUniqueStarGift extends WebPageAttribute { + public final static int constructor = 0xcf6f6db8; + + public TL_stars.StarGift gift; + + public void readParams(InputSerializedData stream, boolean exception) { + gift = TL_stars.StarGift.TLdeserialize(stream, stream.readInt32(exception), exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + gift.serializeToStream(stream); } } public static class TL_webPageAttributeStory_layer162 extends TL_webPageAttributeStory { public static final int constructor = 0x939a4671; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); long user_id = stream.readInt64(exception); peer = new TL_peerUser(); @@ -12221,7 +10049,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { if (storyItem != null) { flags |= 1; } else { @@ -12243,40 +10071,21 @@ public static class TL_webPageAttributeTheme extends WebPageAttribute { public ArrayList documents = new ArrayList<>(); public ThemeSettings settings; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - documents.add(object); - } + documents = Vector.deserialize(stream, Document::TLdeserialize, exception); } if ((flags & 2) != 0) { settings = ThemeSettings.TLdeserialize(stream, stream.readInt32(exception), exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = documents.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - documents.get(a).serializeToStream(stream); - } + Vector.serialize(stream, documents); } if ((flags & 2) != 0) { settings.serializeToStream(stream); @@ -12289,7 +10098,7 @@ public static abstract class contacts_Contacts extends TLObject { public int saved_count; public ArrayList users = new ArrayList<>(); - public static contacts_Contacts TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static contacts_Contacts TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { contacts_Contacts result = null; switch (constructor) { case 0xb74ba9d2: @@ -12312,8 +10121,7 @@ public static contacts_Contacts TLdeserialize(AbstractSerializedData stream, int public static class TL_contacts_contactsNotModified extends contacts_Contacts { public static final int constructor = 0xb74ba9d2; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -12321,62 +10129,23 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_contacts_contacts extends contacts_Contacts { public static final int constructor = 0xeae87e42; - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_contact object = TL_contact.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - contacts.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + contacts = Vector.deserialize(stream, TL_contact::TLdeserialize, exception); saved_count = stream.readInt32(exception); - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = contacts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - contacts.get(a).serializeToStream(stream); - } + Vector.serialize(stream, contacts); stream.writeInt32(saved_count); - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, users); } } public static abstract class SecureRequiredType extends TLObject { - public static SecureRequiredType TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static SecureRequiredType TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { SecureRequiredType result = null; switch (constructor) { case 0x829d99da: @@ -12405,7 +10174,7 @@ public static class TL_secureRequiredType extends SecureRequiredType { public boolean translation_required; public SecureValueType type; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); native_names = (flags & 1) != 0; selfie_required = (flags & 2) != 0; @@ -12413,7 +10182,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = native_names ? (flags | 1) : (flags &~ 1); flags = selfie_required ? (flags | 2) : (flags &~ 2); @@ -12428,38 +10197,19 @@ public static class TL_secureRequiredTypeOneOf extends SecureRequiredType { public ArrayList types = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - SecureRequiredType object = SecureRequiredType.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - types.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + types = Vector.deserialize(stream, SecureRequiredType::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = types.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - types.get(a).serializeToStream(stream); - } + Vector.serialize(stream, types); } } public static abstract class InputPrivacyKey extends TLObject { - public static InputPrivacyKey TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputPrivacyKey TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputPrivacyKey result = null; switch (constructor) { case TL_inputPrivacyKeyStatusTimestamp.constructor: @@ -12512,8 +10262,7 @@ public static InputPrivacyKey TLdeserialize(AbstractSerializedData stream, int c public static class TL_inputPrivacyKeyStatusTimestamp extends InputPrivacyKey { public static final int constructor = 0x4f96cb18; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -12521,8 +10270,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPrivacyKeyChatInvite extends InputPrivacyKey { public static final int constructor = 0xbdfb0426; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -12530,8 +10278,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPrivacyKeyPhoneCall extends InputPrivacyKey { public static final int constructor = 0xfabadc5f; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -12539,8 +10286,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPrivacyKeyForwards extends InputPrivacyKey { public static final int constructor = 0xa4dd4c08; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -12548,8 +10294,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPrivacyKeyPhoneNumber extends InputPrivacyKey { public static final int constructor = 0x352dafa; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -12557,8 +10302,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPrivacyKeyAddedByPhone extends InputPrivacyKey { public static final int constructor = 0xd1219bdd; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -12566,8 +10310,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPrivacyKeyVoiceMessages extends InputPrivacyKey { public static final int constructor = 0xaee69d68; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -12575,8 +10318,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPrivacyKeyAbout extends InputPrivacyKey { public static final int constructor = 0x3823cc40; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -12584,8 +10326,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPrivacyKeyBirthday extends InputPrivacyKey { public static final int constructor = 0xd65a11cc; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -12593,8 +10334,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPrivacyKeyStarGiftsAutoSave extends InputPrivacyKey { public static final int constructor = 0xe1732341; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -12602,8 +10342,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPrivacyKeyProfilePhoto extends InputPrivacyKey { public static final int constructor = 0x5719bacc; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -12611,8 +10350,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPrivacyKeyPhoneP2P extends InputPrivacyKey { public static final int constructor = 0xdb9e70d2; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -12622,7 +10360,7 @@ public static abstract class messages_ExportedChatInvite extends TLObject { public ExportedChatInvite invite; public ArrayList users = new ArrayList<>(); - public static messages_ExportedChatInvite TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static messages_ExportedChatInvite TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { messages_ExportedChatInvite result = null; switch (constructor) { case 0x222600ef: @@ -12647,77 +10385,38 @@ public static class TL_messages_exportedChatInviteReplaced extends messages_Expo public ExportedChatInvite new_invite; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); new_invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); invite.serializeToStream(stream); new_invite.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, users); } } public static class TL_messages_exportedChatInvite extends messages_ExportedChatInvite { public static final int constructor = 0x1871be50; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); invite.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, users); } } public static abstract class InputTheme extends TLObject { - public static InputTheme TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputTheme TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputTheme result = null; switch (constructor) { case 0xf5890df1: @@ -12742,11 +10441,11 @@ public static class TL_inputThemeSlug extends InputTheme { public String slug; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { slug = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(slug); } @@ -12758,12 +10457,12 @@ public static class TL_inputTheme extends InputTheme { public long id; public long access_hash; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -12775,7 +10474,7 @@ public static abstract class photos_Photos extends TLObject { public ArrayList users = new ArrayList<>(); public int count; - public static photos_Photos TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static photos_Photos TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { photos_Photos result = null; switch (constructor) { case 0x8dca6aa5: @@ -12798,110 +10497,32 @@ public static photos_Photos TLdeserialize(AbstractSerializedData stream, int con public static class TL_photos_photos extends photos_Photos { public static final int constructor = 0x8dca6aa5; - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Photo object = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - photos.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + photos = Vector.deserialize(stream, Photo::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = photos.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - photos.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, photos); + Vector.serialize(stream, users); } } public static class TL_photos_photosSlice extends photos_Photos { public static final int constructor = 0x15051f54; - - public void readParams(AbstractSerializedData stream, boolean exception) { - count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Photo object = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - photos.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } + public void readParams(InputSerializedData stream, boolean exception) { count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + photos = Vector.deserialize(stream, Photo::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = photos.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - photos.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, photos); + Vector.serialize(stream, users); } } @@ -12972,10 +10593,13 @@ public static abstract class ChatFull extends TLObject { public boolean can_view_stars_revenue; public boolean paid_media_allowed; public boolean paid_reactions_available; + public boolean stargifts_available; + public TL_bots.botVerification bot_verification; + public int stargifts_count; public long inviterId; //custom public int invitesCount; //custom - public static ChatFull TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static ChatFull TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { ChatFull result = null; switch (constructor) { case TL_chatFull.constructor: @@ -12987,6 +10611,12 @@ public static ChatFull TLdeserialize(AbstractSerializedData stream, int construc case TL_channelFull.constructor: result = new TL_channelFull(); break; + case TL_channelFull_layer197.constructor: + result = new TL_channelFull_layer197(); + break; + case TL_channelFull_layer195.constructor: + result = new TL_channelFull_layer195(); + break; case TL_channelFull_layer177.constructor: result = new TL_channelFull_layer177(); break; @@ -13137,8 +10767,7 @@ public static ChatFull TLdeserialize(AbstractSerializedData stream, int construc public static class TL_channelFull_layer110 extends ChatFull { public static final int constructor = 0x2d895c74; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -13173,21 +10802,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if (invite instanceof TL_chatInviteExported) { exported_invite = (TL_chatInviteExported) invite; } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt32(exception); } @@ -13221,7 +10836,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { pts = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -13254,12 +10869,7 @@ public void serializeToStream(AbstractSerializedData stream) { chat_photo.serializeToStream(stream); notify_settings.serializeToStream(stream); exported_invite.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt32((int) migrated_from_chat_id); } @@ -13297,8 +10907,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatFull_layer124 extends TL_chatFull { public static final int constructor = 0xf06c4018; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_set_username = (flags & 128) != 0; has_scheduled = (flags & 256) != 0; @@ -13313,21 +10922,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { exported_invite = (TL_chatInviteExported) ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); } if ((flags & 64) != 0) { pinned_msg_id = stream.readInt32(exception); @@ -13343,7 +10938,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_set_username ? (flags | 128) : (flags &~ 128); flags = has_scheduled ? (flags | 256) : (flags &~ 256); @@ -13359,12 +10954,7 @@ public void serializeToStream(AbstractSerializedData stream) { exported_invite.serializeToStream(stream); } if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); } if ((flags & 64) != 0) { stream.writeInt32(pinned_msg_id); @@ -13384,8 +10974,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelFull_layer124 extends TL_channelFull { public static final int constructor = 0x2548c037; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -13420,21 +11009,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 8388608) != 0) { exported_invite = (TL_chatInviteExported) ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt32(exception); } @@ -13476,21 +11051,11 @@ public void readParams(AbstractSerializedData stream, boolean exception) { ttl_period = stream.readInt32(exception); } if ((flags & 33554432) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - pending_suggestions.add(stream.readString(exception)); - } + pending_suggestions = Vector.deserializeString(stream, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -13526,12 +11091,7 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 8388608) != 0) { exported_invite.serializeToStream(stream); } - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt32((int) migrated_from_chat_id); } @@ -13573,12 +11133,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(ttl_period); } if ((flags & 33554432) != 0) { - stream.writeInt32(0x1cb5c415); - count = pending_suggestions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(pending_suggestions.get(a)); - } + Vector.serializeString(stream, pending_suggestions); } } } @@ -13586,8 +11141,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatFull_layer123 extends TL_chatFull { public static final int constructor = 0xf3474af6; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_set_username = (flags & 128) != 0; has_scheduled = (flags & 256) != 0; @@ -13602,21 +11156,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { exported_invite = (TL_chatInviteExported) ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); } if ((flags & 64) != 0) { pinned_msg_id = stream.readInt32(exception); @@ -13629,7 +11169,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_set_username ? (flags | 128) : (flags &~ 128); flags = has_scheduled ? (flags | 256) : (flags &~ 256); @@ -13645,12 +11185,7 @@ public void serializeToStream(AbstractSerializedData stream) { exported_invite.serializeToStream(stream); } if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); } if ((flags & 64) != 0) { stream.writeInt32(pinned_msg_id); @@ -13667,8 +11202,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelFull_layer123 extends TL_channelFull { public static final int constructor = 0x7a7de4f7; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -13703,21 +11237,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 8388608) != 0) { exported_invite = (TL_chatInviteExported) ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt32(exception); } @@ -13757,7 +11277,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -13793,12 +11313,7 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 8388608) != 0) { exported_invite.serializeToStream(stream); } - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt32((int) migrated_from_chat_id); } @@ -13842,8 +11357,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatFull_layer131 extends TL_chatFull { public static final int constructor = 0x8a1e2983; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_set_username = (flags & 128) != 0; has_scheduled = (flags & 256) != 0; @@ -13858,21 +11372,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { exported_invite = (TLRPC.TL_chatInviteExported) ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); } if ((flags & 64) != 0) { pinned_msg_id = stream.readInt32(exception); @@ -13891,7 +11391,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_set_username ? (flags | 128) : (flags &~ 128); flags = has_scheduled ? (flags | 256) : (flags &~ 256); @@ -13907,12 +11407,7 @@ public void serializeToStream(AbstractSerializedData stream) { exported_invite.serializeToStream(stream); } if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); } if ((flags & 64) != 0) { stream.writeInt32(pinned_msg_id); @@ -13935,8 +11430,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatFull_layer132 extends TL_chatFull { public static final int constructor = 0x49a0a5d9; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_set_username = (flags & 128) != 0; has_scheduled = (flags & 256) != 0; @@ -13951,21 +11445,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { exported_invite = (TLRPC.TL_chatInviteExported) ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); } if ((flags & 64) != 0) { pinned_msg_id = stream.readInt32(exception); @@ -13987,7 +11467,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_set_username ? (flags | 128) : (flags &~ 128); flags = has_scheduled ? (flags | 256) : (flags &~ 256); @@ -14003,12 +11483,7 @@ public void serializeToStream(AbstractSerializedData stream) { exported_invite.serializeToStream(stream); } if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); } if ((flags & 64) != 0) { stream.writeInt32(pinned_msg_id); @@ -14034,8 +11509,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelFull_layer132 extends TL_channelFull { public static final int constructor = 0x2f532f3c; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -14070,21 +11544,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 8388608) != 0) { exported_invite = (TLRPC.TL_chatInviteExported) ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt32(exception); } @@ -14126,17 +11586,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { ttl_period = stream.readInt32(exception); } if ((flags & 33554432) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - pending_suggestions.add(stream.readString(exception)); - } + pending_suggestions = Vector.deserializeString(stream, exception); } if ((flags & 67108864) != 0) { groupcall_default_join_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -14146,7 +11596,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -14182,12 +11632,7 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 8388608) != 0) { exported_invite.serializeToStream(stream); } - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt32((int) migrated_from_chat_id); } @@ -14229,12 +11674,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(ttl_period); } if ((flags & 33554432) != 0) { - stream.writeInt32(0x1cb5c415); - count = pending_suggestions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(pending_suggestions.get(a)); - } + Vector.serializeString(stream, pending_suggestions); } if ((flags & 67108864) != 0) { groupcall_default_join_as.serializeToStream(stream); @@ -14248,8 +11688,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatFull_layer133 extends ChatFull { public static final int constructor = 0x4dbdc099; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_set_username = (flags & 128) != 0; has_scheduled = (flags & 256) != 0; @@ -14264,21 +11703,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { exported_invite = (TLRPC.TL_chatInviteExported) ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); } if ((flags & 64) != 0) { pinned_msg_id = stream.readInt32(exception); @@ -14300,7 +11725,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_set_username ? (flags | 128) : (flags &~ 128); flags = has_scheduled ? (flags | 256) : (flags &~ 256); @@ -14316,12 +11741,7 @@ public void serializeToStream(AbstractSerializedData stream) { exported_invite.serializeToStream(stream); } if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); } if ((flags & 64) != 0) { stream.writeInt32(pinned_msg_id); @@ -14347,7 +11767,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatFull_layer135 extends ChatFull { public static final int constructor = 0x46a6ffb4; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_set_username = (flags & 128) != 0; has_scheduled = (flags & 256) != 0; @@ -14362,21 +11782,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { exported_invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); } if ((flags & 64) != 0) { pinned_msg_id = stream.readInt32(exception); @@ -14400,21 +11806,11 @@ public void readParams(AbstractSerializedData stream, boolean exception) { requests_pending = stream.readInt32(exception); } if ((flags & 131072) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - recent_requesters.add(stream.readInt64(exception)); - } + recent_requesters = Vector.deserializeLong(stream, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_set_username ? (flags | 128) : (flags &~ 128); flags = has_scheduled ? (flags | 256) : (flags &~ 256); @@ -14430,12 +11826,7 @@ public void serializeToStream(AbstractSerializedData stream) { exported_invite.serializeToStream(stream); } if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); } if ((flags & 64) != 0) { stream.writeInt32(pinned_msg_id); @@ -14459,12 +11850,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(requests_pending); } if ((flags & 131072) != 0) { - stream.writeInt32(0x1cb5c415); - int count = recent_requesters.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(recent_requesters.get(a)); - } + Vector.serializeLong(stream, recent_requesters); } } } @@ -14472,7 +11858,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelFull_layer135 extends ChatFull { public static final int constructor = 0x56662e2e; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -14507,21 +11893,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 8388608) != 0) { exported_invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt64(exception); } @@ -14563,17 +11935,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { ttl_period = stream.readInt32(exception); } if ((flags & 33554432) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - pending_suggestions.add(stream.readString(exception)); - } + pending_suggestions = Vector.deserializeString(stream, exception); } if ((flags & 67108864) != 0) { groupcall_default_join_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -14585,24 +11947,14 @@ public void readParams(AbstractSerializedData stream, boolean exception) { requests_pending = stream.readInt32(exception); } if ((flags & 268435456) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - recent_requesters.add(stream.readInt64(exception)); - } + recent_requesters = Vector.deserializeLong(stream, exception); } if ((flags & 536870912) != 0) { default_send_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -14638,12 +11990,7 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 8388608) != 0) { exported_invite.serializeToStream(stream); } - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt64(migrated_from_chat_id); } @@ -14685,12 +12032,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(ttl_period); } if ((flags & 33554432) != 0) { - stream.writeInt32(0x1cb5c415); - count = pending_suggestions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(pending_suggestions.get(a)); - } + Vector.serializeString(stream, pending_suggestions); } if ((flags & 67108864) != 0) { groupcall_default_join_as.serializeToStream(stream); @@ -14702,12 +12044,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(requests_pending); } if ((flags & 268435456) != 0) { - stream.writeInt32(0x1cb5c415); - count = recent_requesters.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(recent_requesters.get(a)); - } + Vector.serializeLong(stream, recent_requesters); } if ((flags & 536870912) != 0) { default_send_as.serializeToStream(stream); @@ -14718,7 +12055,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelFull_layer134 extends ChatFull { public static final int constructor = 0x59cff963; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -14753,21 +12090,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 8388608) != 0) { exported_invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt64(exception); } @@ -14809,17 +12132,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { ttl_period = stream.readInt32(exception); } if ((flags & 33554432) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - pending_suggestions.add(stream.readString(exception)); - } + pending_suggestions = Vector.deserializeString(stream, exception); } if ((flags & 67108864) != 0) { groupcall_default_join_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -14831,21 +12144,11 @@ public void readParams(AbstractSerializedData stream, boolean exception) { requests_pending = stream.readInt32(exception); } if ((flags & 268435456) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - recent_requesters.add(stream.readInt64(exception)); - } + recent_requesters = Vector.deserializeLong(stream, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -14881,12 +12184,7 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 8388608) != 0) { exported_invite.serializeToStream(stream); } - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt64(migrated_from_chat_id); } @@ -14928,12 +12226,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(ttl_period); } if ((flags & 33554432) != 0) { - stream.writeInt32(0x1cb5c415); - count = pending_suggestions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(pending_suggestions.get(a)); - } + Vector.serializeString(stream, pending_suggestions); } if ((flags & 67108864) != 0) { groupcall_default_join_as.serializeToStream(stream); @@ -14945,12 +12238,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(requests_pending); } if ((flags & 268435456) != 0) { - stream.writeInt32(0x1cb5c415); - count = recent_requesters.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(recent_requesters.get(a)); - } + Vector.serializeLong(stream, recent_requesters); } } } @@ -14958,8 +12246,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelFull_layer133 extends ChatFull { public static final int constructor = 0xe9b27a17; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -14994,21 +12281,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 8388608) != 0) { exported_invite = (TLRPC.TL_chatInviteExported) ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt64(exception); } @@ -15050,17 +12323,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { ttl_period = stream.readInt32(exception); } if ((flags & 33554432) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - pending_suggestions.add(stream.readString(exception)); - } + pending_suggestions = Vector.deserializeString(stream, exception); } if ((flags & 67108864) != 0) { groupcall_default_join_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -15070,7 +12333,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -15106,12 +12369,7 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 8388608) != 0) { exported_invite.serializeToStream(stream); } - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt64(migrated_from_chat_id); } @@ -15153,12 +12411,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(ttl_period); } if ((flags & 33554432) != 0) { - stream.writeInt32(0x1cb5c415); - count = pending_suggestions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(pending_suggestions.get(a)); - } + Vector.serializeString(stream, pending_suggestions); } if ((flags & 67108864) != 0) { groupcall_default_join_as.serializeToStream(stream); @@ -15172,7 +12425,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatFull extends ChatFull { public static final int constructor = 0x2633421b; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_set_username = (flags & 128) != 0; has_scheduled = (flags & 256) != 0; @@ -15187,21 +12440,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { exported_invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); } if ((flags & 64) != 0) { pinned_msg_id = stream.readInt32(exception); @@ -15225,17 +12464,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { requests_pending = stream.readInt32(exception); } if ((flags & 131072) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - recent_requesters.add(stream.readInt64(exception)); - } + recent_requesters = Vector.deserializeLong(stream, exception); } if ((flags & 262144) != 0) { available_reactions = ChatReactions.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -15245,7 +12474,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_set_username ? (flags | 128) : (flags &~ 128); flags = has_scheduled ? (flags | 256) : (flags &~ 256); @@ -15261,12 +12490,7 @@ public void serializeToStream(AbstractSerializedData stream) { exported_invite.serializeToStream(stream); } if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); } if ((flags & 64) != 0) { stream.writeInt32(pinned_msg_id); @@ -15290,12 +12514,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(requests_pending); } if ((flags & 131072) != 0) { - stream.writeInt32(0x1cb5c415); - int count = recent_requesters.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(recent_requesters.get(a)); - } + Vector.serializeLong(stream, recent_requesters); } if ((flags & 262144) != 0) { available_reactions.serializeToStream(stream); @@ -15309,7 +12528,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatFull_layer177 extends TL_chatFull { public static final int constructor = 0xc9d31138; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_set_username = (flags & 128) != 0; has_scheduled = (flags & 256) != 0; @@ -15324,21 +12543,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { exported_invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); } if ((flags & 64) != 0) { pinned_msg_id = stream.readInt32(exception); @@ -15362,24 +12567,14 @@ public void readParams(AbstractSerializedData stream, boolean exception) { requests_pending = stream.readInt32(exception); } if ((flags & 131072) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - recent_requesters.add(stream.readInt64(exception)); - } + recent_requesters = Vector.deserializeLong(stream, exception); } if ((flags & 262144) != 0) { available_reactions = ChatReactions.TLdeserialize(stream, stream.readInt32(exception), exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_set_username ? (flags | 128) : (flags &~ 128); flags = has_scheduled ? (flags | 256) : (flags &~ 256); @@ -15395,12 +12590,7 @@ public void serializeToStream(AbstractSerializedData stream) { exported_invite.serializeToStream(stream); } if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); } if ((flags & 64) != 0) { stream.writeInt32(pinned_msg_id); @@ -15424,12 +12614,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(requests_pending); } if ((flags & 131072) != 0) { - stream.writeInt32(0x1cb5c415); - int count = recent_requesters.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(recent_requesters.get(a)); - } + Vector.serializeLong(stream, recent_requesters); } if ((flags & 262144) != 0) { available_reactions.serializeToStream(stream); @@ -15440,7 +12625,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatFull_layer144 extends ChatFull { public static final int constructor = 0xd18ee226; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_set_username = (flags & 128) != 0; has_scheduled = (flags & 256) != 0; @@ -15455,21 +12640,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { exported_invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); } if ((flags & 64) != 0) { pinned_msg_id = stream.readInt32(exception); @@ -15493,34 +12664,14 @@ public void readParams(AbstractSerializedData stream, boolean exception) { requests_pending = stream.readInt32(exception); } if ((flags & 131072) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - recent_requesters.add(stream.readInt64(exception)); - } + recent_requesters = Vector.deserializeLong(stream, exception); } if ((flags & 262144) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - available_reactions_legacy.add(stream.readString(exception)); - } + available_reactions_legacy = Vector.deserializeString(stream, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_set_username ? (flags | 128) : (flags &~ 128); flags = has_scheduled ? (flags | 256) : (flags &~ 256); @@ -15536,12 +12687,7 @@ public void serializeToStream(AbstractSerializedData stream) { exported_invite.serializeToStream(stream); } if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); } if ((flags & 64) != 0) { stream.writeInt32(pinned_msg_id); @@ -15565,28 +12711,18 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(requests_pending); } if ((flags & 131072) != 0) { - stream.writeInt32(0x1cb5c415); - int count = recent_requesters.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(recent_requesters.get(a)); - } + Vector.serializeLong(stream, recent_requesters); } if ((flags & 262144) != 0) { - stream.writeInt32(0x1cb5c415); - int count = available_reactions_legacy.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(available_reactions_legacy.get(a)); - } + Vector.serializeString(stream, available_reactions_legacy); } } } public static class TL_channelFull extends ChatFull { - public static final int constructor = 0xbbab348d; + public static final int constructor = 0x52d6806b; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -15608,6 +12744,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { can_view_stars_revenue = (flags2 & 32768) != 0; paid_media_allowed = (flags2 & 16384) != 0; paid_reactions_available = (flags2 & 65536) != 0; + stargifts_available = (flags2 & 524288) != 0; id = stream.readInt64(exception); about = stream.readString(exception); if ((flags & 1) != 0) { @@ -15633,21 +12770,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 8388608) != 0) { exported_invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt64(exception); } @@ -15689,17 +12812,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { ttl_period = stream.readInt32(exception); } if ((flags & 33554432) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - pending_suggestions.add(stream.readString(exception)); - } + pending_suggestions = Vector.deserializeString(stream, exception); } if ((flags & 67108864) != 0) { groupcall_default_join_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -15711,17 +12824,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { requests_pending = stream.readInt32(exception); } if ((flags & 268435456) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - recent_requesters.add(stream.readInt64(exception)); - } + recent_requesters = Vector.deserializeLong(stream, exception); } if ((flags & 536870912) != 0) { default_send_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -15747,9 +12850,15 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags2 & 1024) != 0) { emojiset = StickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); } + if ((flags2 & 131072) != 0) { + bot_verification = TL_bots.botVerification.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags2 & 262144) != 0) { + stargifts_count = stream.readInt32(exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -15771,6 +12880,7 @@ public void serializeToStream(AbstractSerializedData stream) { flags2 = paid_media_allowed ? (flags2 | 16384) : (flags2 &~ 16384); flags2 = can_view_stars_revenue ? (flags2 | 32768) : (flags2 &~ 32768); flags2 = paid_reactions_available ? (flags2 | 65536) : (flags2 &~ 65536); + flags2 = stargifts_available ? (flags2 | 524288) : (flags2 &~ 524288); stream.writeInt32(flags2); stream.writeInt64(id); stream.writeString(about); @@ -15797,12 +12907,7 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 8388608) != 0) { exported_invite.serializeToStream(stream); } - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt64(migrated_from_chat_id); } @@ -15844,12 +12949,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(ttl_period); } if ((flags & 33554432) != 0) { - stream.writeInt32(0x1cb5c415); - count = pending_suggestions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(pending_suggestions.get(a)); - } + Vector.serializeString(stream, pending_suggestions); } if ((flags & 67108864) != 0) { groupcall_default_join_as.serializeToStream(stream); @@ -15861,12 +12961,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(requests_pending); } if ((flags & 268435456) != 0) { - stream.writeInt32(0x1cb5c415); - count = recent_requesters.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(recent_requesters.get(a)); - } + Vector.serializeLong(stream, recent_requesters); } if ((flags & 536870912) != 0) { default_send_as.serializeToStream(stream); @@ -15892,14 +12987,19 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags2 & 1024) != 0) { emojiset.serializeToStream(stream); } + if ((flags2 & 131072) != 0) { + bot_verification.serializeToStream(stream); + } + if ((flags2 & 262144) != 0) { + stream.writeInt32(stargifts_count); + } } } + public static class TL_channelFull_layer197 extends TL_channelFull { + public static final int constructor = 0x9ff3b858; - public static class TL_channelFull_layer177 extends TL_channelFull { - public static final int constructor = 0x44c054a7; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -15919,6 +13019,8 @@ public void readParams(AbstractSerializedData stream, boolean exception) { restricted_sponsored = (flags2 & 2048) != 0; can_view_revenue = (flags2 & 4096) != 0; can_view_stars_revenue = (flags2 & 32768) != 0; + paid_media_allowed = (flags2 & 16384) != 0; + paid_reactions_available = (flags2 & 65536) != 0; id = stream.readInt64(exception); about = stream.readString(exception); if ((flags & 1) != 0) { @@ -15944,21 +13046,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 8388608) != 0) { exported_invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt64(exception); } @@ -16000,17 +13088,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { ttl_period = stream.readInt32(exception); } if ((flags & 33554432) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - pending_suggestions.add(stream.readString(exception)); - } + pending_suggestions = Vector.deserializeString(stream, exception); } if ((flags & 67108864) != 0) { groupcall_default_join_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -16022,17 +13100,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { requests_pending = stream.readInt32(exception); } if ((flags & 268435456) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - recent_requesters.add(stream.readInt64(exception)); - } + recent_requesters = Vector.deserializeLong(stream, exception); } if ((flags & 536870912) != 0) { default_send_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -16040,6 +13108,9 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 1073741824) != 0) { available_reactions = ChatReactions.TLdeserialize(stream, stream.readInt32(exception), exception); } + if ((flags2 & 8192) != 0) { + reactions_limit = stream.readInt32(exception); + } if ((flags2 & 16) != 0) { stories = TL_stories.PeerStories.TLdeserialize(stream, stream.readInt32(exception), exception); } @@ -16055,9 +13126,12 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags2 & 1024) != 0) { emojiset = StickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); } + if ((flags2 & 131072) != 0) { + bot_verification = TL_bots.botVerification.TLdeserialize(stream, stream.readInt32(exception), exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -16076,7 +13150,9 @@ public void serializeToStream(AbstractSerializedData stream) { flags2 = view_forum_as_messages ? (flags2 | 64) : (flags2 &~ 64); flags2 = restricted_sponsored ? (flags2 | 2048) : (flags2 &~ 2048); flags2 = can_view_revenue ? (flags2 | 4096) : (flags2 &~ 4096); + flags2 = paid_media_allowed ? (flags2 | 16384) : (flags2 &~ 16384); flags2 = can_view_stars_revenue ? (flags2 | 32768) : (flags2 &~ 32768); + flags2 = paid_reactions_available ? (flags2 | 65536) : (flags2 &~ 65536); stream.writeInt32(flags2); stream.writeInt64(id); stream.writeString(about); @@ -16103,12 +13179,7 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 8388608) != 0) { exported_invite.serializeToStream(stream); } - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt64(migrated_from_chat_id); } @@ -16150,12 +13221,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(ttl_period); } if ((flags & 33554432) != 0) { - stream.writeInt32(0x1cb5c415); - count = pending_suggestions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(pending_suggestions.get(a)); - } + Vector.serializeString(stream, pending_suggestions); } if ((flags & 67108864) != 0) { groupcall_default_join_as.serializeToStream(stream); @@ -16167,12 +13233,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(requests_pending); } if ((flags & 268435456) != 0) { - stream.writeInt32(0x1cb5c415); - count = recent_requesters.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(recent_requesters.get(a)); - } + Vector.serializeLong(stream, recent_requesters); } if ((flags & 536870912) != 0) { default_send_as.serializeToStream(stream); @@ -16180,6 +13241,9 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 1073741824) != 0) { available_reactions.serializeToStream(stream); } + if ((flags2 & 8192) != 0) { + stream.writeInt32(reactions_limit); + } if ((flags2 & 16) != 0) { stories.serializeToStream(stream); } @@ -16195,14 +13259,16 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags2 & 1024) != 0) { emojiset.serializeToStream(stream); } + if ((flags2 & 131072) != 0) { + bot_verification.serializeToStream(stream); + } } } + public static class TL_channelFull_layer195 extends TL_channelFull { + public static final int constructor = 0xbbab348d; - public static class TL_channelFull_layer176 extends TL_channelFull { - public static final int constructor = 0x680b773c; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -16219,6 +13285,11 @@ public void readParams(AbstractSerializedData stream, boolean exception) { translations_disabled = (flags2 & 8) != 0; stories_pinned_available = (flags2 & 32) != 0; view_forum_as_messages = (flags2 & 64) != 0; + restricted_sponsored = (flags2 & 2048) != 0; + can_view_revenue = (flags2 & 4096) != 0; + can_view_stars_revenue = (flags2 & 32768) != 0; + paid_media_allowed = (flags2 & 16384) != 0; + paid_reactions_available = (flags2 & 65536) != 0; id = stream.readInt64(exception); about = stream.readString(exception); if ((flags & 1) != 0) { @@ -16244,21 +13315,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 8388608) != 0) { exported_invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt64(exception); } @@ -16300,17 +13357,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { ttl_period = stream.readInt32(exception); } if ((flags & 33554432) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - pending_suggestions.add(stream.readString(exception)); - } + pending_suggestions = Vector.deserializeString(stream, exception); } if ((flags & 67108864) != 0) { groupcall_default_join_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -16322,17 +13369,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { requests_pending = stream.readInt32(exception); } if ((flags & 268435456) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - recent_requesters.add(stream.readInt64(exception)); - } + recent_requesters = Vector.deserializeLong(stream, exception); } if ((flags & 536870912) != 0) { default_send_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -16340,6 +13377,9 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 1073741824) != 0) { available_reactions = ChatReactions.TLdeserialize(stream, stream.readInt32(exception), exception); } + if ((flags2 & 8192) != 0) { + reactions_limit = stream.readInt32(exception); + } if ((flags2 & 16) != 0) { stories = TL_stories.PeerStories.TLdeserialize(stream, stream.readInt32(exception), exception); } @@ -16357,7 +13397,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -16374,6 +13414,11 @@ public void serializeToStream(AbstractSerializedData stream) { flags2 = translations_disabled ? (flags2 | 8) : (flags2 &~ 8); flags2 = stories_pinned_available ? (flags2 | 32) : (flags2 &~ 32); flags2 = view_forum_as_messages ? (flags2 | 64) : (flags2 &~ 64); + flags2 = restricted_sponsored ? (flags2 | 2048) : (flags2 &~ 2048); + flags2 = can_view_revenue ? (flags2 | 4096) : (flags2 &~ 4096); + flags2 = paid_media_allowed ? (flags2 | 16384) : (flags2 &~ 16384); + flags2 = can_view_stars_revenue ? (flags2 | 32768) : (flags2 &~ 32768); + flags2 = paid_reactions_available ? (flags2 | 65536) : (flags2 &~ 65536); stream.writeInt32(flags2); stream.writeInt64(id); stream.writeString(about); @@ -16400,12 +13445,7 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 8388608) != 0) { exported_invite.serializeToStream(stream); } - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt64(migrated_from_chat_id); } @@ -16447,12 +13487,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(ttl_period); } if ((flags & 33554432) != 0) { - stream.writeInt32(0x1cb5c415); - count = pending_suggestions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(pending_suggestions.get(a)); - } + Vector.serializeString(stream, pending_suggestions); } if ((flags & 67108864) != 0) { groupcall_default_join_as.serializeToStream(stream); @@ -16464,12 +13499,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(requests_pending); } if ((flags & 268435456) != 0) { - stream.writeInt32(0x1cb5c415); - count = recent_requesters.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(recent_requesters.get(a)); - } + Vector.serializeLong(stream, recent_requesters); } if ((flags & 536870912) != 0) { default_send_as.serializeToStream(stream); @@ -16477,6 +13507,9 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 1073741824) != 0) { available_reactions.serializeToStream(stream); } + if ((flags2 & 8192) != 0) { + stream.writeInt32(reactions_limit); + } if ((flags2 & 16) != 0) { stories.serializeToStream(stream); } @@ -16495,10 +13528,10 @@ public void serializeToStream(AbstractSerializedData stream) { } } - public static class TL_channelFull_layer173 extends ChatFull { - public static final int constructor = 0xf2bcb6f; + public static class TL_channelFull_layer177 extends TL_channelFull { + public static final int constructor = 0x44c054a7; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -16515,6 +13548,9 @@ public void readParams(AbstractSerializedData stream, boolean exception) { translations_disabled = (flags2 & 8) != 0; stories_pinned_available = (flags2 & 32) != 0; view_forum_as_messages = (flags2 & 64) != 0; + restricted_sponsored = (flags2 & 2048) != 0; + can_view_revenue = (flags2 & 4096) != 0; + can_view_stars_revenue = (flags2 & 32768) != 0; id = stream.readInt64(exception); about = stream.readString(exception); if ((flags & 1) != 0) { @@ -16540,21 +13576,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 8388608) != 0) { exported_invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt64(exception); } @@ -16596,17 +13618,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { ttl_period = stream.readInt32(exception); } if ((flags & 33554432) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - pending_suggestions.add(stream.readString(exception)); - } + pending_suggestions = Vector.deserializeString(stream, exception); } if ((flags & 67108864) != 0) { groupcall_default_join_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -16618,17 +13630,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { requests_pending = stream.readInt32(exception); } if ((flags & 268435456) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - recent_requesters.add(stream.readInt64(exception)); - } + recent_requesters = Vector.deserializeLong(stream, exception); } if ((flags & 536870912) != 0) { default_send_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -16642,9 +13644,18 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags2 & 128) != 0) { wallpaper = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); } + if ((flags2 & 256) != 0) { + boosts_applied = stream.readInt32(exception); + } + if ((flags2 & 512) != 0) { + boosts_unrestrict = stream.readInt32(exception); + } + if ((flags2 & 1024) != 0) { + emojiset = StickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -16661,6 +13672,9 @@ public void serializeToStream(AbstractSerializedData stream) { flags2 = translations_disabled ? (flags2 | 8) : (flags2 &~ 8); flags2 = stories_pinned_available ? (flags2 | 32) : (flags2 &~ 32); flags2 = view_forum_as_messages ? (flags2 | 64) : (flags2 &~ 64); + flags2 = restricted_sponsored ? (flags2 | 2048) : (flags2 &~ 2048); + flags2 = can_view_revenue ? (flags2 | 4096) : (flags2 &~ 4096); + flags2 = can_view_stars_revenue ? (flags2 | 32768) : (flags2 &~ 32768); stream.writeInt32(flags2); stream.writeInt64(id); stream.writeString(about); @@ -16687,12 +13701,7 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 8388608) != 0) { exported_invite.serializeToStream(stream); } - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt64(migrated_from_chat_id); } @@ -16734,12 +13743,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(ttl_period); } if ((flags & 33554432) != 0) { - stream.writeInt32(0x1cb5c415); - count = pending_suggestions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(pending_suggestions.get(a)); - } + Vector.serializeString(stream, pending_suggestions); } if ((flags & 67108864) != 0) { groupcall_default_join_as.serializeToStream(stream); @@ -16751,12 +13755,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(requests_pending); } if ((flags & 268435456) != 0) { - stream.writeInt32(0x1cb5c415); - count = recent_requesters.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(recent_requesters.get(a)); - } + Vector.serializeLong(stream, recent_requesters); } if ((flags & 536870912) != 0) { default_send_as.serializeToStream(stream); @@ -16770,13 +13769,22 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags2 & 128) != 0) { wallpaper.serializeToStream(stream); } + if ((flags2 & 256) != 0) { + stream.writeInt32(boosts_applied); + } + if ((flags2 & 512) != 0) { + stream.writeInt32(boosts_unrestrict); + } + if ((flags2 & 1024) != 0) { + emojiset.serializeToStream(stream); + } } } - public static class TL_channelFull_layer167 extends TL_channelFull { - public static final int constructor = 0x723027bd; + public static class TL_channelFull_layer176 extends TL_channelFull { + public static final int constructor = 0x680b773c; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -16818,21 +13826,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 8388608) != 0) { exported_invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt64(exception); } @@ -16874,17 +13868,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { ttl_period = stream.readInt32(exception); } if ((flags & 33554432) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - pending_suggestions.add(stream.readString(exception)); - } + pending_suggestions = Vector.deserializeString(stream, exception); } if ((flags & 67108864) != 0) { groupcall_default_join_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -16896,17 +13880,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { requests_pending = stream.readInt32(exception); } if ((flags & 268435456) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - recent_requesters.add(stream.readInt64(exception)); - } + recent_requesters = Vector.deserializeLong(stream, exception); } if ((flags & 536870912) != 0) { default_send_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -16917,9 +13891,21 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags2 & 16) != 0) { stories = TL_stories.PeerStories.TLdeserialize(stream, stream.readInt32(exception), exception); } + if ((flags2 & 128) != 0) { + wallpaper = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags2 & 256) != 0) { + boosts_applied = stream.readInt32(exception); + } + if ((flags2 & 512) != 0) { + boosts_unrestrict = stream.readInt32(exception); + } + if ((flags2 & 1024) != 0) { + emojiset = StickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -16962,12 +13948,7 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 8388608) != 0) { exported_invite.serializeToStream(stream); } - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt64(migrated_from_chat_id); } @@ -17009,12 +13990,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(ttl_period); } if ((flags & 33554432) != 0) { - stream.writeInt32(0x1cb5c415); - count = pending_suggestions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(pending_suggestions.get(a)); - } + Vector.serializeString(stream, pending_suggestions); } if ((flags & 67108864) != 0) { groupcall_default_join_as.serializeToStream(stream); @@ -17026,12 +14002,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(requests_pending); } if ((flags & 268435456) != 0) { - stream.writeInt32(0x1cb5c415); - count = recent_requesters.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(recent_requesters.get(a)); - } + Vector.serializeLong(stream, recent_requesters); } if ((flags & 536870912) != 0) { default_send_as.serializeToStream(stream); @@ -17042,13 +14013,25 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags2 & 16) != 0) { stories.serializeToStream(stream); } + if ((flags2 & 128) != 0) { + wallpaper.serializeToStream(stream); + } + if ((flags2 & 256) != 0) { + stream.writeInt32(boosts_applied); + } + if ((flags2 & 512) != 0) { + stream.writeInt32(boosts_unrestrict); + } + if ((flags2 & 1024) != 0) { + emojiset.serializeToStream(stream); + } } } - public static class TL_channelFull_layer162 extends TL_channelFull { - public static final int constructor = 0xf2355507; + public static class TL_channelFull_layer173 extends ChatFull { + public static final int constructor = 0xf2bcb6f; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -17063,6 +14046,8 @@ public void readParams(AbstractSerializedData stream, boolean exception) { antispam = (flags2 & 2) != 0; participants_hidden = (flags2 & 4) != 0; translations_disabled = (flags2 & 8) != 0; + stories_pinned_available = (flags2 & 32) != 0; + view_forum_as_messages = (flags2 & 64) != 0; id = stream.readInt64(exception); about = stream.readString(exception); if ((flags & 1) != 0) { @@ -17088,21 +14073,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 8388608) != 0) { exported_invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt64(exception); } @@ -17144,17 +14115,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { ttl_period = stream.readInt32(exception); } if ((flags & 33554432) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - pending_suggestions.add(stream.readString(exception)); - } + pending_suggestions = Vector.deserializeString(stream, exception); } if ((flags & 67108864) != 0) { groupcall_default_join_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -17166,17 +14127,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { requests_pending = stream.readInt32(exception); } if ((flags & 268435456) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - recent_requesters.add(stream.readInt64(exception)); - } + recent_requesters = Vector.deserializeLong(stream, exception); } if ((flags & 536870912) != 0) { default_send_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -17184,9 +14135,15 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 1073741824) != 0) { available_reactions = ChatReactions.TLdeserialize(stream, stream.readInt32(exception), exception); } + if ((flags2 & 16) != 0) { + stories = TL_stories.PeerStories.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags2 & 128) != 0) { + wallpaper = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -17201,6 +14158,8 @@ public void serializeToStream(AbstractSerializedData stream) { flags2 = antispam ? (flags2 | 2) : (flags2 &~ 2); flags2 = participants_hidden ? (flags2 | 4) : (flags2 &~ 4); flags2 = translations_disabled ? (flags2 | 8) : (flags2 &~ 8); + flags2 = stories_pinned_available ? (flags2 | 32) : (flags2 &~ 32); + flags2 = view_forum_as_messages ? (flags2 | 64) : (flags2 &~ 64); stream.writeInt32(flags2); stream.writeInt64(id); stream.writeString(about); @@ -17227,12 +14186,7 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 8388608) != 0) { exported_invite.serializeToStream(stream); } - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt64(migrated_from_chat_id); } @@ -17274,12 +14228,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(ttl_period); } if ((flags & 33554432) != 0) { - stream.writeInt32(0x1cb5c415); - count = pending_suggestions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(pending_suggestions.get(a)); - } + Vector.serializeString(stream, pending_suggestions); } if ((flags & 67108864) != 0) { groupcall_default_join_as.serializeToStream(stream); @@ -17291,12 +14240,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(requests_pending); } if ((flags & 268435456) != 0) { - stream.writeInt32(0x1cb5c415); - count = recent_requesters.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(recent_requesters.get(a)); - } + Vector.serializeLong(stream, recent_requesters); } if ((flags & 536870912) != 0) { default_send_as.serializeToStream(stream); @@ -17304,13 +14248,19 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 1073741824) != 0) { available_reactions.serializeToStream(stream); } + if ((flags2 & 16) != 0) { + stories.serializeToStream(stream); + } + if ((flags2 & 128) != 0) { + wallpaper.serializeToStream(stream); + } } } - public static class TL_channelFull_layer144 extends ChatFull { - public static final int constructor = 0xea68a619; + public static class TL_channelFull_layer167 extends TL_channelFull { + public static final int constructor = 0x723027bd; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -17322,6 +14272,11 @@ public void readParams(AbstractSerializedData stream, boolean exception) { blocked = (flags & 4194304) != 0; flags2 = stream.readInt32(exception); can_delete_channel = (flags2 & 1) != 0; + antispam = (flags2 & 2) != 0; + participants_hidden = (flags2 & 4) != 0; + translations_disabled = (flags2 & 8) != 0; + stories_pinned_available = (flags2 & 32) != 0; + view_forum_as_messages = (flags2 & 64) != 0; id = stream.readInt64(exception); about = stream.readString(exception); if ((flags & 1) != 0) { @@ -17347,21 +14302,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 8388608) != 0) { exported_invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt64(exception); } @@ -17403,17 +14344,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { ttl_period = stream.readInt32(exception); } if ((flags & 33554432) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - pending_suggestions.add(stream.readString(exception)); - } + pending_suggestions = Vector.deserializeString(stream, exception); } if ((flags & 67108864) != 0) { groupcall_default_join_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -17425,37 +14356,20 @@ public void readParams(AbstractSerializedData stream, boolean exception) { requests_pending = stream.readInt32(exception); } if ((flags & 268435456) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - recent_requesters.add(stream.readInt64(exception)); - } + recent_requesters = Vector.deserializeLong(stream, exception); } if ((flags & 536870912) != 0) { default_send_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 1073741824) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - available_reactions_legacy.add(stream.readString(exception)); - } + available_reactions = ChatReactions.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags2 & 16) != 0) { + stories = TL_stories.PeerStories.TLdeserialize(stream, stream.readInt32(exception), exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -17467,6 +14381,11 @@ public void serializeToStream(AbstractSerializedData stream) { flags = blocked ? (flags | 4194304) : (flags &~ 4194304); stream.writeInt32(flags); flags2 = can_delete_channel ? (flags2 | 1) : (flags2 &~ 1); + flags2 = antispam ? (flags2 | 2) : (flags2 &~ 2); + flags2 = participants_hidden ? (flags2 | 4) : (flags2 &~ 4); + flags2 = translations_disabled ? (flags2 | 8) : (flags2 &~ 8); + flags2 = stories_pinned_available ? (flags2 | 32) : (flags2 &~ 32); + flags2 = view_forum_as_messages ? (flags2 | 64) : (flags2 &~ 64); stream.writeInt32(flags2); stream.writeInt64(id); stream.writeString(about); @@ -17493,12 +14412,7 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 8388608) != 0) { exported_invite.serializeToStream(stream); } - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt64(migrated_from_chat_id); } @@ -17540,12 +14454,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(ttl_period); } if ((flags & 33554432) != 0) { - stream.writeInt32(0x1cb5c415); - count = pending_suggestions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(pending_suggestions.get(a)); - } + Vector.serializeString(stream, pending_suggestions); } if ((flags & 67108864) != 0) { groupcall_default_join_as.serializeToStream(stream); @@ -17557,31 +14466,24 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(requests_pending); } if ((flags & 268435456) != 0) { - stream.writeInt32(0x1cb5c415); - count = recent_requesters.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(recent_requesters.get(a)); - } + Vector.serializeLong(stream, recent_requesters); } if ((flags & 536870912) != 0) { default_send_as.serializeToStream(stream); } if ((flags & 1073741824) != 0) { - stream.writeInt32(0x1cb5c415); - count = available_reactions_legacy.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(available_reactions_legacy.get(a)); - } + available_reactions.serializeToStream(stream); + } + if ((flags2 & 16) != 0) { + stories.serializeToStream(stream); } } } - public static class TL_channelFull_layer139 extends ChatFull { - public static final int constructor = 0xe13c3d20; + public static class TL_channelFull_layer162 extends TL_channelFull { + public static final int constructor = 0xf2355507; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -17591,6 +14493,11 @@ public void readParams(AbstractSerializedData stream, boolean exception) { has_scheduled = (flags & 524288) != 0; can_view_stats = (flags & 1048576) != 0; blocked = (flags & 4194304) != 0; + flags2 = stream.readInt32(exception); + can_delete_channel = (flags2 & 1) != 0; + antispam = (flags2 & 2) != 0; + participants_hidden = (flags2 & 4) != 0; + translations_disabled = (flags2 & 8) != 0; id = stream.readInt64(exception); about = stream.readString(exception); if ((flags & 1) != 0) { @@ -17616,21 +14523,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 8388608) != 0) { exported_invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt64(exception); } @@ -17672,17 +14565,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { ttl_period = stream.readInt32(exception); } if ((flags & 33554432) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - pending_suggestions.add(stream.readString(exception)); - } + pending_suggestions = Vector.deserializeString(stream, exception); } if ((flags & 67108864) != 0) { groupcall_default_join_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -17694,37 +14577,17 @@ public void readParams(AbstractSerializedData stream, boolean exception) { requests_pending = stream.readInt32(exception); } if ((flags & 268435456) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - recent_requesters.add(stream.readInt64(exception)); - } + recent_requesters = Vector.deserializeLong(stream, exception); } if ((flags & 536870912) != 0) { default_send_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 1073741824) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - available_reactions_legacy.add(stream.readString(exception)); - } + available_reactions = ChatReactions.TLdeserialize(stream, stream.readInt32(exception), exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -17735,6 +14598,11 @@ public void serializeToStream(AbstractSerializedData stream) { flags = can_view_stats ? (flags | 1048576) : (flags &~ 1048576); flags = blocked ? (flags | 4194304) : (flags &~ 4194304); stream.writeInt32(flags); + flags2 = can_delete_channel ? (flags2 | 1) : (flags2 &~ 1); + flags2 = antispam ? (flags2 | 2) : (flags2 &~ 2); + flags2 = participants_hidden ? (flags2 | 4) : (flags2 &~ 4); + flags2 = translations_disabled ? (flags2 | 8) : (flags2 &~ 8); + stream.writeInt32(flags2); stream.writeInt64(id); stream.writeString(about); if ((flags & 1) != 0) { @@ -17760,12 +14628,7 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 8388608) != 0) { exported_invite.serializeToStream(stream); } - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt64(migrated_from_chat_id); } @@ -17807,12 +14670,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(ttl_period); } if ((flags & 33554432) != 0) { - stream.writeInt32(0x1cb5c415); - count = pending_suggestions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(pending_suggestions.get(a)); - } + Vector.serializeString(stream, pending_suggestions); } if ((flags & 67108864) != 0) { groupcall_default_join_as.serializeToStream(stream); @@ -17824,32 +14682,21 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(requests_pending); } if ((flags & 268435456) != 0) { - stream.writeInt32(0x1cb5c415); - count = recent_requesters.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(recent_requesters.get(a)); - } + Vector.serializeLong(stream, recent_requesters); } if ((flags & 536870912) != 0) { default_send_as.serializeToStream(stream); } if ((flags & 1073741824) != 0) { - stream.writeInt32(0x1cb5c415); - count = available_reactions_legacy.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(available_reactions_legacy.get(a)); - } + available_reactions.serializeToStream(stream); } } } - public static class TL_channelFull_layer131 extends TL_channelFull { - public static final int constructor = 0x548c3f93; - + public static class TL_channelFull_layer144 extends ChatFull { + public static final int constructor = 0xea68a619; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -17859,6 +14706,8 @@ public void readParams(AbstractSerializedData stream, boolean exception) { has_scheduled = (flags & 524288) != 0; can_view_stats = (flags & 1048576) != 0; blocked = (flags & 4194304) != 0; + flags2 = stream.readInt32(exception); + can_delete_channel = (flags2 & 1) != 0; id = stream.readInt64(exception); about = stream.readString(exception); if ((flags & 1) != 0) { @@ -17882,23 +14731,9 @@ public void readParams(AbstractSerializedData stream, boolean exception) { chat_photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 8388608) != 0) { - exported_invite = (TL_chatInviteExported) ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); - } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); + exported_invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt64(exception); } @@ -17940,24 +14775,29 @@ public void readParams(AbstractSerializedData stream, boolean exception) { ttl_period = stream.readInt32(exception); } if ((flags & 33554432) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - pending_suggestions.add(stream.readString(exception)); - } + pending_suggestions = Vector.deserializeString(stream, exception); } if ((flags & 67108864) != 0) { groupcall_default_join_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); } + if ((flags & 134217728) != 0) { + theme_emoticon = stream.readString(exception); + } + if ((flags & 268435456) != 0) { + requests_pending = stream.readInt32(exception); + } + if ((flags & 268435456) != 0) { + recent_requesters = Vector.deserializeLong(stream, exception); + } + if ((flags & 536870912) != 0) { + default_send_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 1073741824) != 0) { + available_reactions_legacy = Vector.deserializeString(stream, exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -17968,6 +14808,8 @@ public void serializeToStream(AbstractSerializedData stream) { flags = can_view_stats ? (flags | 1048576) : (flags &~ 1048576); flags = blocked ? (flags | 4194304) : (flags &~ 4194304); stream.writeInt32(flags); + flags2 = can_delete_channel ? (flags2 | 1) : (flags2 &~ 1); + stream.writeInt32(flags2); stream.writeInt64(id); stream.writeString(about); if ((flags & 1) != 0) { @@ -17993,12 +14835,7 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 8388608) != 0) { exported_invite.serializeToStream(stream); } - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt64(migrated_from_chat_id); } @@ -18040,24 +14877,33 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(ttl_period); } if ((flags & 33554432) != 0) { - stream.writeInt32(0x1cb5c415); - count = pending_suggestions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(pending_suggestions.get(a)); - } + Vector.serializeString(stream, pending_suggestions); } if ((flags & 67108864) != 0) { groupcall_default_join_as.serializeToStream(stream); } + if ((flags & 134217728) != 0) { + stream.writeString(theme_emoticon); + } + if ((flags & 268435456) != 0) { + stream.writeInt32(requests_pending); + } + if ((flags & 268435456) != 0) { + Vector.serializeLong(stream, recent_requesters); + } + if ((flags & 536870912) != 0) { + default_send_as.serializeToStream(stream); + } + if ((flags & 1073741824) != 0) { + Vector.serializeString(stream, available_reactions_legacy); + } } } - public static class TL_channelFull_layer122 extends TL_channelFull { - public static final int constructor = 0xef3a6acd; - + public static class TL_channelFull_layer139 extends ChatFull { + public static final int constructor = 0xe13c3d20; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -18067,7 +14913,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { has_scheduled = (flags & 524288) != 0; can_view_stats = (flags & 1048576) != 0; blocked = (flags & 4194304) != 0; - id = stream.readInt32(exception); + id = stream.readInt64(exception); about = stream.readString(exception); if ((flags & 1) != 0) { participants_count = stream.readInt32(exception); @@ -18089,27 +14935,12 @@ public void readParams(AbstractSerializedData stream, boolean exception) { unread_count = stream.readInt32(exception); chat_photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); - ExportedChatInvite invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); - if (invite instanceof TL_chatInviteExported) { - exported_invite = (TL_chatInviteExported) invite; - } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); + if ((flags & 8388608) != 0) { + exported_invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { - migrated_from_chat_id = stream.readInt32(exception); + migrated_from_chat_id = stream.readInt64(exception); } if ((flags & 16) != 0) { migrated_from_max_id = stream.readInt32(exception); @@ -18127,7 +14958,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { folder_id = stream.readInt32(exception); } if ((flags & 16384) != 0) { - linked_chat_id = stream.readInt32(exception); + linked_chat_id = stream.readInt64(exception); } if ((flags & 32768) != 0) { location = ChannelLocation.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -18145,9 +14976,33 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 2097152) != 0) { call = TL_inputGroupCall.TLdeserialize(stream, stream.readInt32(exception), exception); } + if ((flags & 16777216) != 0) { + ttl_period = stream.readInt32(exception); + } + if ((flags & 33554432) != 0) { + pending_suggestions = Vector.deserializeString(stream, exception); + } + if ((flags & 67108864) != 0) { + groupcall_default_join_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 134217728) != 0) { + theme_emoticon = stream.readString(exception); + } + if ((flags & 268435456) != 0) { + requests_pending = stream.readInt32(exception); + } + if ((flags & 268435456) != 0) { + recent_requesters = Vector.deserializeLong(stream, exception); + } + if ((flags & 536870912) != 0) { + default_send_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 1073741824) != 0) { + available_reactions_legacy = Vector.deserializeString(stream, exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -18158,7 +15013,7 @@ public void serializeToStream(AbstractSerializedData stream) { flags = can_view_stats ? (flags | 1048576) : (flags &~ 1048576); flags = blocked ? (flags | 4194304) : (flags &~ 4194304); stream.writeInt32(flags); - stream.writeInt32((int) id); + stream.writeInt64(id); stream.writeString(about); if ((flags & 1) != 0) { stream.writeInt32(participants_count); @@ -18180,19 +15035,12 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(unread_count); chat_photo.serializeToStream(stream); notify_settings.serializeToStream(stream); - if (exported_invite != null) { + if ((flags & 8388608) != 0) { exported_invite.serializeToStream(stream); - } else { - new TLRPC.TL_chatInviteEmpty_layer122().serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { - stream.writeInt32((int) migrated_from_chat_id); + stream.writeInt64(migrated_from_chat_id); } if ((flags & 16) != 0) { stream.writeInt32(migrated_from_max_id); @@ -18210,7 +15058,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(folder_id); } if ((flags & 16384) != 0) { - stream.writeInt32((int) linked_chat_id); + stream.writeInt64(linked_chat_id); } if ((flags & 32768) != 0) { location.serializeToStream(stream); @@ -18228,14 +15076,37 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 2097152) != 0) { call.serializeToStream(stream); } + if ((flags & 16777216) != 0) { + stream.writeInt32(ttl_period); + } + if ((flags & 33554432) != 0) { + Vector.serializeString(stream, pending_suggestions); + } + if ((flags & 67108864) != 0) { + groupcall_default_join_as.serializeToStream(stream); + } + if ((flags & 134217728) != 0) { + stream.writeString(theme_emoticon); + } + if ((flags & 268435456) != 0) { + stream.writeInt32(requests_pending); + } + if ((flags & 268435456) != 0) { + Vector.serializeLong(stream, recent_requesters); + } + if ((flags & 536870912) != 0) { + default_send_as.serializeToStream(stream); + } + if ((flags & 1073741824) != 0) { + Vector.serializeString(stream, available_reactions_legacy); + } } } - public static class TL_channelFull_layer121 extends TL_channelFull { - public static final int constructor = 0xf0e6672a; - + public static class TL_channelFull_layer131 extends TL_channelFull { + public static final int constructor = 0x548c3f93; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -18245,7 +15116,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { has_scheduled = (flags & 524288) != 0; can_view_stats = (flags & 1048576) != 0; blocked = (flags & 4194304) != 0; - id = stream.readInt32(exception); + id = stream.readInt64(exception); about = stream.readString(exception); if ((flags & 1) != 0) { participants_count = stream.readInt32(exception); @@ -18267,27 +15138,12 @@ public void readParams(AbstractSerializedData stream, boolean exception) { unread_count = stream.readInt32(exception); chat_photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); - ExportedChatInvite invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); - if (invite instanceof TL_chatInviteExported) { - exported_invite = (TL_chatInviteExported) invite; - } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); + if ((flags & 8388608) != 0) { + exported_invite = (TL_chatInviteExported) ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { - migrated_from_chat_id = stream.readInt32(exception); + migrated_from_chat_id = stream.readInt64(exception); } if ((flags & 16) != 0) { migrated_from_max_id = stream.readInt32(exception); @@ -18305,7 +15161,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { folder_id = stream.readInt32(exception); } if ((flags & 16384) != 0) { - linked_chat_id = stream.readInt32(exception); + linked_chat_id = stream.readInt64(exception); } if ((flags & 32768) != 0) { location = ChannelLocation.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -18320,9 +15176,21 @@ public void readParams(AbstractSerializedData stream, boolean exception) { stats_dc = stream.readInt32(exception); } pts = stream.readInt32(exception); + if ((flags & 2097152) != 0) { + call = TL_inputGroupCall.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 16777216) != 0) { + ttl_period = stream.readInt32(exception); + } + if ((flags & 33554432) != 0) { + pending_suggestions = Vector.deserializeString(stream, exception); + } + if ((flags & 67108864) != 0) { + groupcall_default_join_as = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -18333,7 +15201,7 @@ public void serializeToStream(AbstractSerializedData stream) { flags = can_view_stats ? (flags | 1048576) : (flags &~ 1048576); flags = blocked ? (flags | 4194304) : (flags &~ 4194304); stream.writeInt32(flags); - stream.writeInt32((int) id); + stream.writeInt64(id); stream.writeString(about); if ((flags & 1) != 0) { stream.writeInt32(participants_count); @@ -18355,15 +15223,12 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(unread_count); chat_photo.serializeToStream(stream); notify_settings.serializeToStream(stream); - exported_invite.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); + if ((flags & 8388608) != 0) { + exported_invite.serializeToStream(stream); } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { - stream.writeInt32((int) migrated_from_chat_id); + stream.writeInt64(migrated_from_chat_id); } if ((flags & 16) != 0) { stream.writeInt32(migrated_from_max_id); @@ -18381,7 +15246,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(folder_id); } if ((flags & 16384) != 0) { - stream.writeInt32((int) linked_chat_id); + stream.writeInt64(linked_chat_id); } if ((flags & 32768) != 0) { location.serializeToStream(stream); @@ -18396,21 +15261,34 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(stats_dc); } stream.writeInt32(pts); + if ((flags & 2097152) != 0) { + call.serializeToStream(stream); + } + if ((flags & 16777216) != 0) { + stream.writeInt32(ttl_period); + } + if ((flags & 33554432) != 0) { + Vector.serializeString(stream, pending_suggestions); + } + if ((flags & 67108864) != 0) { + groupcall_default_join_as.serializeToStream(stream); + } } } - public static class TL_channelFull_layer103 extends TL_channelFull { - public static final int constructor = 0x10916653; - + public static class TL_channelFull_layer122 extends TL_channelFull { + public static final int constructor = 0xef3a6acd; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; can_set_stickers = (flags & 128) != 0; hidden_prehistory = (flags & 1024) != 0; - can_view_stats = (flags & 4096) != 0; can_set_location = (flags & 65536) != 0; + has_scheduled = (flags & 524288) != 0; + can_view_stats = (flags & 1048576) != 0; + blocked = (flags & 4194304) != 0; id = stream.readInt32(exception); about = stream.readString(exception); if ((flags & 1) != 0) { @@ -18437,21 +15315,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if (invite instanceof TL_chatInviteExported) { exported_invite = (TL_chatInviteExported) invite; } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt32(exception); } @@ -18476,17 +15340,31 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 32768) != 0) { location = ChannelLocation.TLdeserialize(stream, stream.readInt32(exception), exception); } + if ((flags & 131072) != 0) { + slowmode_seconds = stream.readInt32(exception); + } + if ((flags & 262144) != 0) { + slowmode_next_send_date = stream.readInt32(exception); + } + if ((flags & 4096) != 0) { + stats_dc = stream.readInt32(exception); + } pts = stream.readInt32(exception); + if ((flags & 2097152) != 0) { + call = TL_inputGroupCall.TLdeserialize(stream, stream.readInt32(exception), exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); flags = can_set_stickers ? (flags | 128) : (flags &~ 128); flags = hidden_prehistory ? (flags | 1024) : (flags &~ 1024); - flags = can_view_stats ? (flags | 4096) : (flags &~ 4096); flags = can_set_location ? (flags | 65536) : (flags &~ 65536); + flags = has_scheduled ? (flags | 524288) : (flags &~ 524288); + flags = can_view_stats ? (flags | 1048576) : (flags &~ 1048576); + flags = blocked ? (flags | 4194304) : (flags &~ 4194304); stream.writeInt32(flags); stream.writeInt32((int) id); stream.writeString(about); @@ -18510,13 +15388,12 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(unread_count); chat_photo.serializeToStream(stream); notify_settings.serializeToStream(stream); - exported_invite.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); + if (exported_invite != null) { + exported_invite.serializeToStream(stream); + } else { + new TLRPC.TL_chatInviteEmpty_layer122().serializeToStream(stream); } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt32((int) migrated_from_chat_id); } @@ -18541,21 +15418,35 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 32768) != 0) { location.serializeToStream(stream); } + if ((flags & 131072) != 0) { + stream.writeInt32(slowmode_seconds); + } + if ((flags & 262144) != 0) { + stream.writeInt32(slowmode_next_send_date); + } + if ((flags & 4096) != 0) { + stream.writeInt32(stats_dc); + } stream.writeInt32(pts); + if ((flags & 2097152) != 0) { + call.serializeToStream(stream); + } } } - public static class TL_channelFull_layer101 extends TL_channelFull { - public static final int constructor = 0x9882e516; - + public static class TL_channelFull_layer121 extends TL_channelFull { + public static final int constructor = 0xf0e6672a; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; can_set_stickers = (flags & 128) != 0; hidden_prehistory = (flags & 1024) != 0; - can_view_stats = (flags & 4096) != 0; + can_set_location = (flags & 65536) != 0; + has_scheduled = (flags & 524288) != 0; + can_view_stats = (flags & 1048576) != 0; + blocked = (flags & 4194304) != 0; id = stream.readInt32(exception); about = stream.readString(exception); if ((flags & 1) != 0) { @@ -18582,21 +15473,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if (invite instanceof TL_chatInviteExported) { exported_invite = (TL_chatInviteExported) invite; } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt32(exception); } @@ -18615,19 +15492,34 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 2048) != 0) { folder_id = stream.readInt32(exception); } - if ((flags & 8192) != 0) { + if ((flags & 16384) != 0) { linked_chat_id = stream.readInt32(exception); } + if ((flags & 32768) != 0) { + location = ChannelLocation.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 131072) != 0) { + slowmode_seconds = stream.readInt32(exception); + } + if ((flags & 262144) != 0) { + slowmode_next_send_date = stream.readInt32(exception); + } + if ((flags & 4096) != 0) { + stats_dc = stream.readInt32(exception); + } pts = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); flags = can_set_stickers ? (flags | 128) : (flags &~ 128); flags = hidden_prehistory ? (flags | 1024) : (flags &~ 1024); - flags = can_view_stats ? (flags | 4096) : (flags &~ 4096); + flags = can_set_location ? (flags | 65536) : (flags &~ 65536); + flags = has_scheduled ? (flags | 524288) : (flags &~ 524288); + flags = can_view_stats ? (flags | 1048576) : (flags &~ 1048576); + flags = blocked ? (flags | 4194304) : (flags &~ 4194304); stream.writeInt32(flags); stream.writeInt32((int) id); stream.writeString(about); @@ -18652,12 +15544,7 @@ public void serializeToStream(AbstractSerializedData stream) { chat_photo.serializeToStream(stream); notify_settings.serializeToStream(stream); exported_invite.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt32((int) migrated_from_chat_id); } @@ -18676,24 +15563,36 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 2048) != 0) { stream.writeInt32(folder_id); } - if ((flags & 8192) != 0) { + if ((flags & 16384) != 0) { stream.writeInt32((int) linked_chat_id); } + if ((flags & 32768) != 0) { + location.serializeToStream(stream); + } + if ((flags & 131072) != 0) { + stream.writeInt32(slowmode_seconds); + } + if ((flags & 262144) != 0) { + stream.writeInt32(slowmode_next_send_date); + } + if ((flags & 4096) != 0) { + stream.writeInt32(stats_dc); + } stream.writeInt32(pts); } } - public static class TL_channelFull_layer99 extends TL_channelFull { - public static final int constructor = 0x3648977; - + public static class TL_channelFull_layer103 extends TL_channelFull { + public static final int constructor = 0x10916653; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; can_set_stickers = (flags & 128) != 0; hidden_prehistory = (flags & 1024) != 0; can_view_stats = (flags & 4096) != 0; + can_set_location = (flags & 65536) != 0; id = stream.readInt32(exception); about = stream.readString(exception); if ((flags & 1) != 0) { @@ -18720,21 +15619,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if (invite instanceof TL_chatInviteExported) { exported_invite = (TL_chatInviteExported) invite; } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt32(exception); } @@ -18753,16 +15638,23 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 2048) != 0) { folder_id = stream.readInt32(exception); } + if ((flags & 16384) != 0) { + linked_chat_id = stream.readInt32(exception); + } + if ((flags & 32768) != 0) { + location = ChannelLocation.TLdeserialize(stream, stream.readInt32(exception), exception); + } pts = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); flags = can_set_stickers ? (flags | 128) : (flags &~ 128); flags = hidden_prehistory ? (flags | 1024) : (flags &~ 1024); flags = can_view_stats ? (flags | 4096) : (flags &~ 4096); + flags = can_set_location ? (flags | 65536) : (flags &~ 65536); stream.writeInt32(flags); stream.writeInt32((int) id); stream.writeString(about); @@ -18787,12 +15679,7 @@ public void serializeToStream(AbstractSerializedData stream) { chat_photo.serializeToStream(stream); notify_settings.serializeToStream(stream); exported_invite.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt32((int) migrated_from_chat_id); } @@ -18811,15 +15698,20 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 2048) != 0) { stream.writeInt32(folder_id); } + if ((flags & 16384) != 0) { + stream.writeInt32((int) linked_chat_id); + } + if ((flags & 32768) != 0) { + location.serializeToStream(stream); + } stream.writeInt32(pts); } } - public static class TL_channelFull_layer98 extends TL_channelFull { - public static final int constructor = 0x1c87a71a; - + public static class TL_channelFull_layer101 extends TL_channelFull { + public static final int constructor = 0x9882e516; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -18852,21 +15744,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if (invite instanceof TL_chatInviteExported) { exported_invite = (TL_chatInviteExported) invite; } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt32(exception); } @@ -18882,9 +15760,16 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 512) != 0) { available_min_id = stream.readInt32(exception); } + if ((flags & 2048) != 0) { + folder_id = stream.readInt32(exception); + } + if ((flags & 8192) != 0) { + linked_chat_id = stream.readInt32(exception); + } + pts = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -18915,12 +15800,7 @@ public void serializeToStream(AbstractSerializedData stream) { chat_photo.serializeToStream(stream); notify_settings.serializeToStream(stream); exported_invite.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt32((int) migrated_from_chat_id); } @@ -18936,65 +15816,138 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 512) != 0) { stream.writeInt32(available_min_id); } + if ((flags & 2048) != 0) { + stream.writeInt32(folder_id); + } + if ((flags & 8192) != 0) { + stream.writeInt32((int) linked_chat_id); + } + stream.writeInt32(pts); } } - public static class TL_chatFull_layer87 extends TL_chatFull { - public static final int constructor = 0x2e02a614; - + public static class TL_channelFull_layer99 extends TL_channelFull { + public static final int constructor = 0x3648977; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + can_view_participants = (flags & 8) != 0; + can_set_username = (flags & 64) != 0; + can_set_stickers = (flags & 128) != 0; + hidden_prehistory = (flags & 1024) != 0; + can_view_stats = (flags & 4096) != 0; id = stream.readInt32(exception); - participants = ChatParticipants.TLdeserialize(stream, stream.readInt32(exception), exception); + about = stream.readString(exception); + if ((flags & 1) != 0) { + participants_count = stream.readInt32(exception); + } + if ((flags & 2) != 0) { + admins_count = stream.readInt32(exception); + } + if ((flags & 4) != 0) { + kicked_count = stream.readInt32(exception); + } + if ((flags & 4) != 0) { + banned_count = stream.readInt32(exception); + } + if ((flags & 8192) != 0) { + online_count = stream.readInt32(exception); + } + read_inbox_max_id = stream.readInt32(exception); + read_outbox_max_id = stream.readInt32(exception); + unread_count = stream.readInt32(exception); chat_photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); ExportedChatInvite invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); if (invite instanceof TL_chatInviteExported) { exported_invite = (TL_chatInviteExported) invite; } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); + if ((flags & 16) != 0) { + migrated_from_chat_id = stream.readInt32(exception); } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); + if ((flags & 16) != 0) { + migrated_from_max_id = stream.readInt32(exception); + } + if ((flags & 32) != 0) { + pinned_msg_id = stream.readInt32(exception); } + if ((flags & 256) != 0) { + stickerset = StickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 512) != 0) { + available_min_id = stream.readInt32(exception); + } + if ((flags & 2048) != 0) { + folder_id = stream.readInt32(exception); + } + pts = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = can_view_participants ? (flags | 8) : (flags &~ 8); + flags = can_set_username ? (flags | 64) : (flags &~ 64); + flags = can_set_stickers ? (flags | 128) : (flags &~ 128); + flags = hidden_prehistory ? (flags | 1024) : (flags &~ 1024); + flags = can_view_stats ? (flags | 4096) : (flags &~ 4096); + stream.writeInt32(flags); stream.writeInt32((int) id); - participants.serializeToStream(stream); + stream.writeString(about); + if ((flags & 1) != 0) { + stream.writeInt32(participants_count); + } + if ((flags & 2) != 0) { + stream.writeInt32(admins_count); + } + if ((flags & 4) != 0) { + stream.writeInt32(kicked_count); + } + if ((flags & 4) != 0) { + stream.writeInt32(banned_count); + } + if ((flags & 8192) != 0) { + stream.writeInt32(online_count); + } + stream.writeInt32(read_inbox_max_id); + stream.writeInt32(read_outbox_max_id); + stream.writeInt32(unread_count); chat_photo.serializeToStream(stream); notify_settings.serializeToStream(stream); exported_invite.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); + Vector.serialize(stream, bot_info); + if ((flags & 16) != 0) { + stream.writeInt32((int) migrated_from_chat_id); + } + if ((flags & 16) != 0) { + stream.writeInt32(migrated_from_max_id); + } + if ((flags & 32) != 0) { + stream.writeInt32(pinned_msg_id); + } + if ((flags & 256) != 0) { + stickerset.serializeToStream(stream); + } + if ((flags & 512) != 0) { + stream.writeInt32(available_min_id); + } + if ((flags & 2048) != 0) { + stream.writeInt32(folder_id); } + stream.writeInt32(pts); } } - public static class TL_channelFull_layer89 extends TL_channelFull { - public static final int constructor = 0xcbb62890; - + public static class TL_channelFull_layer98 extends TL_channelFull { + public static final int constructor = 0x1c87a71a; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; can_set_stickers = (flags & 128) != 0; hidden_prehistory = (flags & 1024) != 0; + can_view_stats = (flags & 4096) != 0; id = stream.readInt32(exception); about = stream.readString(exception); if ((flags & 1) != 0) { @@ -19009,6 +15962,9 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 4) != 0) { banned_count = stream.readInt32(exception); } + if ((flags & 8192) != 0) { + online_count = stream.readInt32(exception); + } read_inbox_max_id = stream.readInt32(exception); read_outbox_max_id = stream.readInt32(exception); unread_count = stream.readInt32(exception); @@ -19018,21 +15974,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if (invite instanceof TL_chatInviteExported) { exported_invite = (TL_chatInviteExported) invite; } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt32(exception); } @@ -19048,17 +15990,15 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 512) != 0) { available_min_id = stream.readInt32(exception); } - if ((flags & 2048) != 0) { - call_msg_id = stream.readInt32(exception); - } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); flags = can_set_stickers ? (flags | 128) : (flags &~ 128); flags = hidden_prehistory ? (flags | 1024) : (flags &~ 1024); + flags = can_view_stats ? (flags | 4096) : (flags &~ 4096); stream.writeInt32(flags); stream.writeInt32((int) id); stream.writeString(about); @@ -19074,18 +16014,16 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 4) != 0) { stream.writeInt32(banned_count); } + if ((flags & 8192) != 0) { + stream.writeInt32(online_count); + } stream.writeInt32(read_inbox_max_id); stream.writeInt32(read_outbox_max_id); stream.writeInt32(unread_count); chat_photo.serializeToStream(stream); notify_settings.serializeToStream(stream); exported_invite.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt32((int) migrated_from_chat_id); } @@ -19101,17 +16039,39 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 512) != 0) { stream.writeInt32(available_min_id); } - if ((flags & 2048) != 0) { - stream.writeInt32(call_msg_id); - } } } - public static class TL_channelFull_layer72 extends TL_channelFull { - public static final int constructor = 0x76af5481; + public static class TL_chatFull_layer87 extends TL_chatFull { + public static final int constructor = 0x2e02a614; + + public void readParams(InputSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + participants = ChatParticipants.TLdeserialize(stream, stream.readInt32(exception), exception); + chat_photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); + ExportedChatInvite invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); + if (invite instanceof TL_chatInviteExported) { + exported_invite = (TL_chatInviteExported) invite; + } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32((int) id); + participants.serializeToStream(stream); + chat_photo.serializeToStream(stream); + notify_settings.serializeToStream(stream); + exported_invite.serializeToStream(stream); + Vector.serialize(stream, bot_info); + } + } + public static class TL_channelFull_layer89 extends TL_channelFull { + public static final int constructor = 0xcbb62890; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -19140,21 +16100,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if (invite instanceof TL_chatInviteExported) { exported_invite = (TL_chatInviteExported) invite; } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt32(exception); } @@ -19170,9 +16116,12 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 512) != 0) { available_min_id = stream.readInt32(exception); } + if ((flags & 2048) != 0) { + call_msg_id = stream.readInt32(exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -19199,12 +16148,7 @@ public void serializeToStream(AbstractSerializedData stream) { chat_photo.serializeToStream(stream); notify_settings.serializeToStream(stream); exported_invite.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt32((int) migrated_from_chat_id); } @@ -19220,18 +16164,21 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 512) != 0) { stream.writeInt32(available_min_id); } + if ((flags & 2048) != 0) { + stream.writeInt32(call_msg_id); + } } } - public static class TL_channelFull_layer71 extends TL_channelFull { - public static final int constructor = 0x17f45fcf; - + public static class TL_channelFull_layer72 extends TL_channelFull { + public static final int constructor = 0x76af5481; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; can_set_stickers = (flags & 128) != 0; + hidden_prehistory = (flags & 1024) != 0; id = stream.readInt32(exception); about = stream.readString(exception); if ((flags & 1) != 0) { @@ -19255,21 +16202,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if (invite instanceof TL_chatInviteExported) { exported_invite = (TL_chatInviteExported) invite; } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt32(exception); } @@ -19282,13 +16215,17 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 256) != 0) { stickerset = StickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); } + if ((flags & 512) != 0) { + available_min_id = stream.readInt32(exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); flags = can_set_stickers ? (flags | 128) : (flags &~ 128); + flags = hidden_prehistory ? (flags | 1024) : (flags &~ 1024); stream.writeInt32(flags); stream.writeInt32((int) id); stream.writeString(about); @@ -19310,12 +16247,98 @@ public void serializeToStream(AbstractSerializedData stream) { chat_photo.serializeToStream(stream); notify_settings.serializeToStream(stream); exported_invite.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); + Vector.serialize(stream, bot_info); + if ((flags & 16) != 0) { + stream.writeInt32((int) migrated_from_chat_id); + } + if ((flags & 16) != 0) { + stream.writeInt32(migrated_from_max_id); + } + if ((flags & 32) != 0) { + stream.writeInt32(pinned_msg_id); + } + if ((flags & 256) != 0) { + stickerset.serializeToStream(stream); + } + if ((flags & 512) != 0) { + stream.writeInt32(available_min_id); + } + } + } + + public static class TL_channelFull_layer71 extends TL_channelFull { + public static final int constructor = 0x17f45fcf; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + can_view_participants = (flags & 8) != 0; + can_set_username = (flags & 64) != 0; + can_set_stickers = (flags & 128) != 0; + id = stream.readInt32(exception); + about = stream.readString(exception); + if ((flags & 1) != 0) { + participants_count = stream.readInt32(exception); + } + if ((flags & 2) != 0) { + admins_count = stream.readInt32(exception); + } + if ((flags & 4) != 0) { + kicked_count = stream.readInt32(exception); + } + if ((flags & 4) != 0) { + banned_count = stream.readInt32(exception); + } + read_inbox_max_id = stream.readInt32(exception); + read_outbox_max_id = stream.readInt32(exception); + unread_count = stream.readInt32(exception); + chat_photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); + ExportedChatInvite invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); + if (invite instanceof TL_chatInviteExported) { + exported_invite = (TL_chatInviteExported) invite; + } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); + if ((flags & 16) != 0) { + migrated_from_chat_id = stream.readInt32(exception); + } + if ((flags & 16) != 0) { + migrated_from_max_id = stream.readInt32(exception); + } + if ((flags & 32) != 0) { + pinned_msg_id = stream.readInt32(exception); + } + if ((flags & 256) != 0) { + stickerset = StickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = can_view_participants ? (flags | 8) : (flags &~ 8); + flags = can_set_username ? (flags | 64) : (flags &~ 64); + flags = can_set_stickers ? (flags | 128) : (flags &~ 128); + stream.writeInt32(flags); + stream.writeInt32((int) id); + stream.writeString(about); + if ((flags & 1) != 0) { + stream.writeInt32(participants_count); + } + if ((flags & 2) != 0) { + stream.writeInt32(admins_count); + } + if ((flags & 4) != 0) { + stream.writeInt32(kicked_count); + } + if ((flags & 4) != 0) { + stream.writeInt32(banned_count); } + stream.writeInt32(read_inbox_max_id); + stream.writeInt32(read_outbox_max_id); + stream.writeInt32(unread_count); + chat_photo.serializeToStream(stream); + notify_settings.serializeToStream(stream); + exported_invite.serializeToStream(stream); + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt32((int) migrated_from_chat_id); } @@ -19334,8 +16357,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatFull_layer122 extends TL_chatFull { public static final int constructor = 0xdc8c181; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_set_username = (flags & 128) != 0; has_scheduled = (flags & 256) != 0; @@ -19351,21 +16373,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { exported_invite = (TL_chatInviteExported) invite; } if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); } if ((flags & 64) != 0) { pinned_msg_id = stream.readInt32(exception); @@ -19378,7 +16386,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_set_username ? (flags | 128) : (flags &~ 128); flags = has_scheduled ? (flags | 256) : (flags &~ 256); @@ -19392,12 +16400,7 @@ public void serializeToStream(AbstractSerializedData stream) { notify_settings.serializeToStream(stream); exported_invite.serializeToStream(stream); if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); } if ((flags & 64) != 0) { stream.writeInt32(pinned_msg_id); @@ -19414,8 +16417,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatFull_layer121 extends TL_chatFull { public static final int constructor = 0x1b7c9db3; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_set_username = (flags & 128) != 0; has_scheduled = (flags & 256) != 0; @@ -19431,21 +16433,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { exported_invite = (TL_chatInviteExported) invite; } if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); } if ((flags & 64) != 0) { pinned_msg_id = stream.readInt32(exception); @@ -19455,7 +16443,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_set_username ? (flags | 128) : (flags &~ 128); flags = has_scheduled ? (flags | 256) : (flags &~ 256); @@ -19469,12 +16457,7 @@ public void serializeToStream(AbstractSerializedData stream) { notify_settings.serializeToStream(stream); exported_invite.serializeToStream(stream); if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); } if ((flags & 64) != 0) { stream.writeInt32(pinned_msg_id); @@ -19488,8 +16471,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatFull_layer98 extends TL_chatFull { public static final int constructor = 0x22a235da; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_set_username = (flags & 128) != 0; id = stream.readInt32(exception); @@ -19504,28 +16486,14 @@ public void readParams(AbstractSerializedData stream, boolean exception) { exported_invite = (TL_chatInviteExported) invite; } if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); } if ((flags & 64) != 0) { pinned_msg_id = stream.readInt32(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_set_username ? (flags | 128) : (flags &~ 128); stream.writeInt32(flags); @@ -19538,12 +16506,7 @@ public void serializeToStream(AbstractSerializedData stream) { notify_settings.serializeToStream(stream); exported_invite.serializeToStream(stream); if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); } if ((flags & 64) != 0) { stream.writeInt32(pinned_msg_id); @@ -19554,8 +16517,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatFull_layer92 extends TL_chatFull { public static final int constructor = 0xedd2a791; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); id = stream.readInt32(exception); participants = ChatParticipants.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -19568,28 +16530,14 @@ public void readParams(AbstractSerializedData stream, boolean exception) { exported_invite = (TL_chatInviteExported) invite; } if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); } if ((flags & 64) != 0) { pinned_msg_id = stream.readInt32(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32((int) id); @@ -19600,12 +16548,7 @@ public void serializeToStream(AbstractSerializedData stream) { notify_settings.serializeToStream(stream); exported_invite.serializeToStream(stream); if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); } if ((flags & 64) != 0) { stream.writeInt32(pinned_msg_id); @@ -19616,8 +16559,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelFull_layer70 extends TL_channelFull { public static final int constructor = 0x95cb5f57; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -19644,21 +16586,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if (invite instanceof TL_chatInviteExported) { exported_invite = (TL_chatInviteExported) invite; } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt32(exception); } @@ -19670,7 +16598,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -19695,12 +16623,7 @@ public void serializeToStream(AbstractSerializedData stream) { chat_photo.serializeToStream(stream); notify_settings.serializeToStream(stream); exported_invite.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt32((int) migrated_from_chat_id); } @@ -19716,8 +16639,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelFull_layer52 extends TL_channelFull { public static final int constructor = 0x97bee562; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -19741,21 +16663,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if (invite instanceof TL_chatInviteExported) { exported_invite = (TL_chatInviteExported) invite; } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt32(exception); } @@ -19767,7 +16675,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -19789,12 +16697,7 @@ public void serializeToStream(AbstractSerializedData stream) { chat_photo.serializeToStream(stream); notify_settings.serializeToStream(stream); exported_invite.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt32((int) migrated_from_chat_id); } @@ -19810,8 +16713,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelFull_layer67 extends TL_channelFull { public static final int constructor = 0xc3d5512f; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; can_set_username = (flags & 64) != 0; @@ -19835,21 +16737,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if (invite instanceof TL_chatInviteExported) { exported_invite = (TL_chatInviteExported) invite; } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); if ((flags & 16) != 0) { migrated_from_chat_id = stream.readInt32(exception); } @@ -19861,7 +16749,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); flags = can_set_username ? (flags | 64) : (flags &~ 64); @@ -19883,12 +16771,7 @@ public void serializeToStream(AbstractSerializedData stream) { chat_photo.serializeToStream(stream); notify_settings.serializeToStream(stream); exported_invite.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } + Vector.serialize(stream, bot_info); if ((flags & 16) != 0) { stream.writeInt32((int) migrated_from_chat_id); } @@ -19904,94 +16787,73 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelFull_layer48 extends TL_channelFull { public static final int constructor = 0x9e341ddf; + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + can_view_participants = (flags & 8) != 0; + id = stream.readInt32(exception); + about = stream.readString(exception); + if ((flags & 1) != 0) { + participants_count = stream.readInt32(exception); + } + if ((flags & 2) != 0) { + admins_count = stream.readInt32(exception); + } + if ((flags & 4) != 0) { + kicked_count = stream.readInt32(exception); + } + read_inbox_max_id = stream.readInt32(exception); + unread_count = stream.readInt32(exception); + unread_important_count = stream.readInt32(exception); + chat_photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); + ExportedChatInvite invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); + if (invite instanceof TL_chatInviteExported) { + exported_invite = (TL_chatInviteExported) invite; + } + bot_info = Vector.deserialize(stream, TL_bots.BotInfo::TLdeserialize, exception); + if ((flags & 16) != 0) { + migrated_from_chat_id = stream.readInt32(exception); + } + if ((flags & 16) != 0) { + migrated_from_max_id = stream.readInt32(exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = can_view_participants ? (flags | 8) : (flags &~ 8); + stream.writeInt32(flags); + stream.writeInt32((int) id); + stream.writeString(about); + if ((flags & 1) != 0) { + stream.writeInt32(participants_count); + } + if ((flags & 2) != 0) { + stream.writeInt32(admins_count); + } + if ((flags & 4) != 0) { + stream.writeInt32(kicked_count); + } + stream.writeInt32(read_inbox_max_id); + stream.writeInt32(unread_count); + stream.writeInt32(unread_important_count); + chat_photo.serializeToStream(stream); + notify_settings.serializeToStream(stream); + exported_invite.serializeToStream(stream); + Vector.serialize(stream, bot_info); + if ((flags & 16) != 0) { + stream.writeInt32((int) migrated_from_chat_id); + } + if ((flags & 16) != 0) { + stream.writeInt32(migrated_from_max_id); + } + } + } + + public static class TL_channelFull_old extends TL_channelFull { + public static final int constructor = 0xfab31aa3; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - can_view_participants = (flags & 8) != 0; - id = stream.readInt32(exception); - about = stream.readString(exception); - if ((flags & 1) != 0) { - participants_count = stream.readInt32(exception); - } - if ((flags & 2) != 0) { - admins_count = stream.readInt32(exception); - } - if ((flags & 4) != 0) { - kicked_count = stream.readInt32(exception); - } - read_inbox_max_id = stream.readInt32(exception); - unread_count = stream.readInt32(exception); - unread_important_count = stream.readInt32(exception); - chat_photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); - ExportedChatInvite invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); - if (invite instanceof TL_chatInviteExported) { - exported_invite = (TL_chatInviteExported) invite; - } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bot_info.add(object); - } - if ((flags & 16) != 0) { - migrated_from_chat_id = stream.readInt32(exception); - } - if ((flags & 16) != 0) { - migrated_from_max_id = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = can_view_participants ? (flags | 8) : (flags &~ 8); - stream.writeInt32(flags); - stream.writeInt32((int) id); - stream.writeString(about); - if ((flags & 1) != 0) { - stream.writeInt32(participants_count); - } - if ((flags & 2) != 0) { - stream.writeInt32(admins_count); - } - if ((flags & 4) != 0) { - stream.writeInt32(kicked_count); - } - stream.writeInt32(read_inbox_max_id); - stream.writeInt32(unread_count); - stream.writeInt32(unread_important_count); - chat_photo.serializeToStream(stream); - notify_settings.serializeToStream(stream); - exported_invite.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = bot_info.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bot_info.get(a).serializeToStream(stream); - } - if ((flags & 16) != 0) { - stream.writeInt32((int) migrated_from_chat_id); - } - if ((flags & 16) != 0) { - stream.writeInt32(migrated_from_max_id); - } - } - } - - public static class TL_channelFull_old extends TL_channelFull { - public static final int constructor = 0xfab31aa3; - - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_view_participants = (flags & 8) != 0; id = stream.readInt32(exception); @@ -20016,7 +16878,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_view_participants ? (flags | 8) : (flags &~ 8); stream.writeInt32(flags); @@ -20052,7 +16914,7 @@ public static class TL_inputPeerNotifySettings extends TLObject { public boolean stories_hide_sender; public NotificationSound stories_sound; - public static TL_inputPeerNotifySettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_inputPeerNotifySettings TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_inputPeerNotifySettings.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_inputPeerNotifySettings", constructor)); @@ -20065,7 +16927,7 @@ public static TL_inputPeerNotifySettings TLdeserialize(AbstractSerializedData st return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { show_previews = stream.readBool(exception); @@ -20090,7 +16952,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -20119,7 +16981,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class auth_LoginToken extends TLObject { - public static auth_LoginToken TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static auth_LoginToken TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { auth_LoginToken result = null; switch (constructor) { case 0x629f1980: @@ -20148,12 +17010,12 @@ public static class TL_auth_loginToken extends auth_LoginToken { public int expires; public byte[] token; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { expires = stream.readInt32(exception); token = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(expires); stream.writeByteArray(token); @@ -20166,12 +17028,12 @@ public static class TL_auth_loginTokenMigrateTo extends auth_LoginToken { public int dc_id; public byte[] token; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { dc_id = stream.readInt32(exception); token = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(dc_id); stream.writeByteArray(token); @@ -20183,11 +17045,11 @@ public static class TL_auth_loginTokenSuccess extends auth_LoginToken { public auth_Authorization authorization; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { authorization = auth_Authorization.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); authorization.serializeToStream(stream); } @@ -20207,7 +17069,7 @@ public static class TL_codeSettings extends TLObject { public String token; public boolean app_sandbox; - public static TL_codeSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_codeSettings TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_codeSettings.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_codeSettings", constructor)); @@ -20220,7 +17082,7 @@ public static TL_codeSettings TLdeserialize(AbstractSerializedData stream, int c return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); allow_flashcall = (flags & 1) != 0; current_number = (flags & 2) != 0; @@ -20251,7 +17113,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { app_sandbox = (flags & 256) != 0; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = allow_flashcall ? (flags | 1) : (flags &~ 1); flags = current_number ? (flags | 2) : (flags &~ 2); @@ -20275,77 +17137,9 @@ public void serializeToStream(AbstractSerializedData stream) { } } - public static abstract class account_EmojiStatuses extends TLObject { - - public long hash; - public ArrayList statuses = new ArrayList<>(); - - public static account_EmojiStatuses TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - account_EmojiStatuses result = null; - switch (constructor) { - case 0xd08ce645: - result = new TL_account_emojiStatusesNotModified(); - break; - case 0x90c467d1: - result = new TL_account_emojiStatuses(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in account_EmojiStatuses", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } - - public static class TL_account_emojiStatusesNotModified extends account_EmojiStatuses { - public static final int constructor = 0xd08ce645; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_account_emojiStatuses extends account_EmojiStatuses { - public static final int constructor = 0x90c467d1; - - public void readParams(AbstractSerializedData stream, boolean exception) { - hash = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - EmojiStatus object = EmojiStatus.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - statuses.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(hash); - stream.writeInt32(0x1cb5c415); - int count = statuses.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - statuses.get(a).serializeToStream(stream); - } - } - } - public static abstract class BaseTheme extends TLObject { - public static BaseTheme TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static BaseTheme TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { BaseTheme result = null; switch (constructor) { case 0x5b11125a: @@ -20377,8 +17171,7 @@ public static BaseTheme TLdeserialize(AbstractSerializedData stream, int constru public static class TL_baseThemeArctic extends BaseTheme { public static final int constructor = 0x5b11125a; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -20386,8 +17179,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_baseThemeNight extends BaseTheme { public static final int constructor = 0xb7b31ea8; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -20395,8 +17187,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_baseThemeClassic extends BaseTheme { public static final int constructor = 0xc3a12462; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -20404,8 +17195,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_baseThemeTinted extends BaseTheme { public static final int constructor = 0x6d5f77ee; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -20413,8 +17203,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_baseThemeDay extends BaseTheme { public static final int constructor = 0xfbd81688; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -20422,8 +17211,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_null extends TLObject { public static final int constructor = 0x56730bcc; - - public static TL_null TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_null TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_null.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_null", constructor)); @@ -20436,7 +17224,7 @@ public static TL_null TLdeserialize(AbstractSerializedData stream, int construct return result; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -20454,7 +17242,7 @@ public static abstract class Page extends TLObject { public int views; public boolean web; //custom - public static Page TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static Page TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { Page result = null; switch (constructor) { case 0x8dee6c44: @@ -20489,471 +17277,123 @@ public static Page TLdeserialize(AbstractSerializedData stream, int constructor, public static class TL_pagePart_layer67 extends TL_pagePart_layer82 { public static final int constructor = 0x8dee6c44; - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - blocks.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Photo object = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - photos.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - documents.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + blocks = Vector.deserialize(stream, PageBlock::TLdeserialize, exception); + photos = Vector.deserialize(stream, Photo::TLdeserialize, exception); + documents = Vector.deserialize(stream, Document::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = blocks.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - blocks.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = photos.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - photos.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = documents.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - documents.get(a).serializeToStream(stream); - } + Vector.serialize(stream, blocks); + Vector.serialize(stream, photos); + Vector.serialize(stream, documents); } } public static class TL_pagePart_layer82 extends Page { public static final int constructor = 0x8e3f9ebe; - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - blocks.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Photo object = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - photos.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - documents.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + blocks = Vector.deserialize(stream, PageBlock::TLdeserialize, exception); + photos = Vector.deserialize(stream, Photo::TLdeserialize, exception); + documents = Vector.deserialize(stream, Document::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = blocks.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - blocks.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = photos.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - photos.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = documents.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - documents.get(a).serializeToStream(stream); - } + Vector.serialize(stream, blocks); + Vector.serialize(stream, photos); + Vector.serialize(stream, documents); } } public static class TL_pageFull_layer67 extends TL_page { public static final int constructor = 0xd7a19d69; - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - blocks.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Photo object = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - photos.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - documents.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + blocks = Vector.deserialize(stream, PageBlock::TLdeserialize, exception); + photos = Vector.deserialize(stream, Photo::TLdeserialize, exception); + documents = Vector.deserialize(stream, Document::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = blocks.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - blocks.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = photos.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - photos.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = documents.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - documents.get(a).serializeToStream(stream); - } + Vector.serialize(stream, blocks); + Vector.serialize(stream, photos); + Vector.serialize(stream, documents); } } public static class TL_pageFull_layer82 extends TL_page { public static final int constructor = 0x556ec7aa; - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - blocks.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Photo object = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - photos.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - documents.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + blocks = Vector.deserialize(stream, PageBlock::TLdeserialize, exception); + photos = Vector.deserialize(stream, Photo::TLdeserialize, exception); + documents = Vector.deserialize(stream, Document::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = blocks.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - blocks.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = photos.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - photos.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = documents.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - documents.get(a).serializeToStream(stream); - } + Vector.serialize(stream, blocks); + Vector.serialize(stream, photos); + Vector.serialize(stream, documents); } } public static class TL_page_layer110 extends TL_page { public static final int constructor = 0xae891bec; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); part = (flags & 1) != 0; rtl = (flags & 2) != 0; url = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - blocks.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Photo object = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - photos.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - documents.add(object); - } + blocks = Vector.deserialize(stream, PageBlock::TLdeserialize, exception); + photos = Vector.deserialize(stream, Photo::TLdeserialize, exception); + documents = Vector.deserialize(stream, Document::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = part ? (flags | 1) : (flags &~ 1); flags = rtl ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); stream.writeString(url); - stream.writeInt32(0x1cb5c415); - int count = blocks.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - blocks.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = photos.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - photos.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = documents.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - documents.get(a).serializeToStream(stream); - } + Vector.serialize(stream, blocks); + Vector.serialize(stream, photos); + Vector.serialize(stream, documents); } } public static class TL_page extends Page { public static final int constructor = 0x98657f0d; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); part = (flags & 1) != 0; rtl = (flags & 2) != 0; v2 = (flags & 4) != 0; url = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - blocks.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Photo object = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - photos.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - documents.add(object); - } + blocks = Vector.deserialize(stream, PageBlock::TLdeserialize, exception); + photos = Vector.deserialize(stream, Photo::TLdeserialize, exception); + documents = Vector.deserialize(stream, Document::TLdeserialize, exception); if ((flags & 8) != 0) { views = stream.readInt32(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = part ? (flags | 1) : (flags &~ 1); flags = rtl ? (flags | 2) : (flags &~ 2); flags = v2 ? (flags | 4) : (flags &~ 4); stream.writeInt32(flags); stream.writeString(url); - stream.writeInt32(0x1cb5c415); - int count = blocks.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - blocks.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = photos.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - photos.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = documents.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - documents.get(a).serializeToStream(stream); - } + Vector.serialize(stream, blocks); + Vector.serialize(stream, photos); + Vector.serialize(stream, documents); if ((flags & 8) != 0) { stream.writeInt32(views); } @@ -20967,7 +17407,7 @@ public static class TL_topPeerCategoryPeers extends TLObject { public int count; public ArrayList peers = new ArrayList<>(); - public static TL_topPeerCategoryPeers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_topPeerCategoryPeers TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_topPeerCategoryPeers.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_topPeerCategoryPeers", constructor)); @@ -20980,36 +17420,17 @@ public static TL_topPeerCategoryPeers TLdeserialize(AbstractSerializedData strea return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { category = TopPeerCategory.TLdeserialize(stream, stream.readInt32(exception), exception); count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_topPeer object = TL_topPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - peers.add(object); - } + peers = Vector.deserialize(stream, TL_topPeer::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); category.serializeToStream(stream); stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - peers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, peers); } } @@ -21018,7 +17439,7 @@ public static abstract class InputUser extends TLObject { public long user_id; public long access_hash; - public static InputUser TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputUser TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputUser result = null; switch (constructor) { case 0xf7c1b13f: @@ -21047,8 +17468,7 @@ public static InputUser TLdeserialize(AbstractSerializedData stream, int constru public static class TL_inputUserSelf extends InputUser { public static final int constructor = 0xf7c1b13f; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -21056,13 +17476,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputUser extends InputUser { public static final int constructor = 0xf21158c6; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); access_hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); stream.writeInt64(access_hash); @@ -21072,8 +17491,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputUserEmpty extends InputUser { public static final int constructor = 0xb98886cf; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -21084,13 +17502,13 @@ public static class TL_inputUserFromMessage extends InputUser { public InputPeer peer; public int msg_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); msg_id = stream.readInt32(exception); user_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(msg_id); @@ -21115,7 +17533,7 @@ public static abstract class KeyboardButton extends TLObject { public InputUser inputUser; public ArrayList peer_types = new ArrayList<>(); - public static KeyboardButton TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static KeyboardButton TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { KeyboardButton result = null; switch (constructor) { case 0xa0c0505c: @@ -21192,12 +17610,11 @@ public static KeyboardButton TLdeserialize(AbstractSerializedData stream, int co public static class TL_keyboardButtonRequestPhone extends KeyboardButton { public static final int constructor = 0xb16a6c29; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(text); } @@ -21206,12 +17623,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_keyboardButtonGame extends KeyboardButton { public static final int constructor = 0x50f41ccf; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(text); } @@ -21220,13 +17636,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_keyboardButtonUrl extends KeyboardButton { public static final int constructor = 0x258aff05; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = stream.readString(exception); url = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(text); stream.writeString(url); @@ -21236,14 +17651,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_keyboardButtonSwitchInline_layer157 extends KeyboardButton { public static final int constructor = 0x568a748; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); same_peer = (flags & 1) != 0; text = stream.readString(exception); query = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = same_peer ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -21255,43 +17670,24 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_keyboardButtonSwitchInline extends KeyboardButton { public static final int constructor = 0x93b9fbb5; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); same_peer = (flags & 1) != 0; text = stream.readString(exception); query = stream.readString(exception); if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InlineQueryPeerType object = InlineQueryPeerType.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - peer_types.add(object); - } + peer_types = Vector.deserialize(stream, InlineQueryPeerType::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = same_peer ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); stream.writeString(text); stream.writeString(query); if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = peer_types.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - peer_types.get(a).serializeToStream(stream); - } + Vector.serialize(stream, peer_types); } } } @@ -21299,12 +17695,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_keyboardButtonRequestGeoLocation extends KeyboardButton { public static final int constructor = 0xfc796b3f; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(text); } @@ -21313,8 +17708,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_keyboardButtonUrlAuth extends KeyboardButton { public static final int constructor = 0x10b78d29; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); text = stream.readString(exception); if ((flags & 1) != 0) { @@ -21324,7 +17718,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { button_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(text); @@ -21339,8 +17733,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputKeyboardButtonUrlAuth extends KeyboardButton { public static final int constructor = 0xd02e7fd4; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); request_write_access = (flags & 1) != 0; text = stream.readString(exception); @@ -21351,7 +17744,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot = InputUser.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = request_write_access ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -21367,8 +17760,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_keyboardButtonRequestPoll extends KeyboardButton { public static final int constructor = 0xbbc7515d; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { quiz = stream.readBool(exception); @@ -21376,7 +17768,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -21389,12 +17781,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_keyboardButtonBuy extends KeyboardButton { public static final int constructor = 0xafd93fbb; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(text); } @@ -21403,12 +17794,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputKeyboardButtonUserProfile extends KeyboardButton { public static final int constructor = 0xe988037b; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = stream.readString(exception); inputUser = InputUser.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(text); inputUser.serializeToStream(stream); @@ -21418,12 +17809,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_keyboardButtonUserProfile extends KeyboardButton { public static final int constructor = 0x308660c1; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = stream.readString(exception); user_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(text); stream.writeInt64(user_id); @@ -21433,15 +17824,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_keyboardButtonCallback extends KeyboardButton { public static final int constructor = 0x35bbdb6b; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); requires_password = (flags & 1) != 0; text = stream.readString(exception); data = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = requires_password ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -21453,13 +17843,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_keyboardButtonCallback_layer117 extends TL_keyboardButtonCallback { public static final int constructor = 0x683a5e46; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = stream.readString(exception); data = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(text); stream.writeByteArray(data); @@ -21469,12 +17858,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_keyboardButton extends KeyboardButton { public static final int constructor = 0xa2fa4880; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(text); } @@ -21485,30 +17873,15 @@ public static class TL_videoSizeEmojiMarkup extends VideoSize { public long emoji_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { emoji_id = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - background_colors.add(stream.readInt32(exception)); - } + background_colors = Vector.deserializeInt(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(emoji_id); - stream.writeInt32(0x1cb5c415); - int count = background_colors.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(background_colors.get(a)); - } + Vector.serializeInt(stream, background_colors); } } @@ -21518,32 +17891,17 @@ public static class TL_videoSizeStickerMarkup extends VideoSize { public InputStickerSet stickerset; public long sticker_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { stickerset = InputStickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); sticker_id = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - background_colors.add(stream.readInt32(exception)); - } + background_colors = Vector.deserializeInt(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stickerset.serializeToStream(stream); stream.writeInt64(sticker_id); - stream.writeInt32(0x1cb5c415); - int count = background_colors.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(background_colors.get(a)); - } + Vector.serializeInt(stream, background_colors); } } @@ -21558,7 +17916,7 @@ public static abstract class VideoSize extends TLObject { public double video_start_ts; public ArrayList background_colors = new ArrayList<>(); - public static VideoSize TLdeserialize(long photo_id, long document_id, AbstractSerializedData stream, int constructor, boolean exception) { + public static VideoSize TLdeserialize(long photo_id, long document_id, InputSerializedData stream, int constructor, boolean exception) { VideoSize result = null; switch (constructor) { case 0x435bb987: @@ -21604,8 +17962,7 @@ public static VideoSize TLdeserialize(long photo_id, long document_id, AbstractS public static class TL_videoSize_layer115 extends TL_videoSize { public static final int constructor = 0x435bb987; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { type = stream.readString(exception); location = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); w = stream.readInt32(exception); @@ -21613,7 +17970,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { size = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(type); location.serializeToStream(stream); @@ -21626,8 +17983,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_videoSize_layer127 extends TL_videoSize { public static final int constructor = 0xe831c556; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); type = stream.readString(exception); location = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -21639,7 +17995,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(type); @@ -21656,8 +18012,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_videoSize extends VideoSize { public static final int constructor = 0xde33b094; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); type = stream.readString(exception); w = stream.readInt32(exception); @@ -21668,7 +18023,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(type); @@ -21707,7 +18062,7 @@ public static abstract class BotInlineMessage extends TLObject { public int proximity_notification_radius; public String url; - public static BotInlineMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static BotInlineMessage TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { BotInlineMessage result = null; switch (constructor) { case 0x4366232e: @@ -21760,8 +18115,7 @@ public static BotInlineMessage TLdeserialize(AbstractSerializedData stream, int public static class TL_botInlineMessageMediaVenue_layer77 extends TL_botInlineMessageMediaVenue { public static final int constructor = 0x4366232e; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); title = stream.readString(exception); @@ -21773,7 +18127,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); geo.serializeToStream(stream); @@ -21790,7 +18144,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_botInlineMessageMediaVenue extends BotInlineMessage { public static final int constructor = 0x8a86659c; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); title = stream.readString(exception); @@ -21803,7 +18157,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); geo.serializeToStream(stream); @@ -21821,8 +18175,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_botInlineMessageMediaGeo_layer71 extends TL_botInlineMessageMediaGeo { public static final int constructor = 0x3a8fd8b8; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 4) != 0) { @@ -21830,7 +18183,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); geo.serializeToStream(stream); @@ -21843,43 +18196,23 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_botInlineMessageMediaAuto extends BotInlineMessage { public static final int constructor = 0x764cf810; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); message = stream.readString(exception); if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } if ((flags & 4) != 0) { reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(message); if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } if ((flags & 4) != 0) { reply_markup.serializeToStream(stream); @@ -21890,8 +18223,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_botInlineMessageMediaAuto_layer74 extends TL_botInlineMessageMediaAuto { public static final int constructor = 0xa74b15b; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); message = stream.readString(exception); if ((flags & 4) != 0) { @@ -21899,7 +18231,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(message); @@ -21912,8 +18244,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_botInlineMessageMediaContact_layer81 extends TL_botInlineMessageMediaContact { public static final int constructor = 0x35edb4d4; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); phone_number = stream.readString(exception); first_name = stream.readString(exception); @@ -21923,7 +18254,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(phone_number); @@ -21938,7 +18269,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_botInlineMessageMediaContact extends BotInlineMessage { public static final int constructor = 0x18d1cdc2; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); phone_number = stream.readString(exception); first_name = stream.readString(exception); @@ -21949,7 +18280,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(phone_number); @@ -21965,45 +18296,25 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_botInlineMessageText extends BotInlineMessage { public static final int constructor = 0x8c7f65e2; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); no_webpage = (flags & 1) != 0; message = stream.readString(exception); if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } if ((flags & 4) != 0) { reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = no_webpage ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); stream.writeString(message); if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } if ((flags & 4) != 0) { reply_markup.serializeToStream(stream); @@ -22014,8 +18325,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_botInlineMessageMediaGeo extends BotInlineMessage { public static final int constructor = 0x51846fd; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 1) != 0) { @@ -22032,7 +18342,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); geo.serializeToStream(stream); @@ -22054,8 +18364,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_botInlineMessageMediaGeo_layer119 extends TL_botInlineMessageMediaGeo { public static final int constructor = 0xb722de65; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); period = stream.readInt32(exception); @@ -22064,7 +18373,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); geo.serializeToStream(stream); @@ -22078,7 +18387,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_botInlineMessageMediaWebPage extends BotInlineMessage { public static final int constructor = 0x809ad9a6; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); invert_media = (flags & 8) != 0; force_large_media = (flags & 16) != 0; @@ -22087,17 +18396,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { safe = (flags & 256) != 0; message = stream.readString(exception); if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - entities.add(MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception)); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } url = stream.readString(exception); if ((flags & 4) != 0) { @@ -22106,7 +18405,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = invert_media ? (flags | 8) : (flags &~ 8); flags = force_large_media ? (flags | 8) : (flags &~ 16); @@ -22116,12 +18415,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(flags); stream.writeString(message); if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - final int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; ++a) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } stream.writeString(url); if ((flags & 4) != 0) { @@ -22140,7 +18434,7 @@ public static class TL_botInlineMessageMediaInvoice extends BotInlineMessage { public String currency; public long total_amount; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); shipping_address_requested = (flags & 2) != 0; test = (flags & 8) != 0; @@ -22156,7 +18450,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = shipping_address_requested ? (flags | 2) : (flags &~ 2); flags = test ? (flags | 8) : (flags &~ 8); @@ -22179,7 +18473,7 @@ public static class TL_keyboardButtonRow extends TLObject { public ArrayList buttons = new ArrayList<>(); - public static TL_keyboardButtonRow TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_keyboardButtonRow TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_keyboardButtonRow.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_keyboardButtonRow", constructor)); @@ -22192,38 +18486,19 @@ public static TL_keyboardButtonRow TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - KeyboardButton object = KeyboardButton.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - buttons.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + buttons = Vector.deserialize(stream, KeyboardButton::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = buttons.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - buttons.get(a).serializeToStream(stream); - } + Vector.serialize(stream, buttons); } } public static abstract class Bool extends TLObject { - public static Bool TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static Bool TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { Bool result = null; switch (constructor) { case 0x997275b5: @@ -22246,8 +18521,7 @@ public static Bool TLdeserialize(AbstractSerializedData stream, int constructor, public static class TL_boolTrue extends Bool { public static final int constructor = 0x997275b5; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -22255,8 +18529,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_boolFalse extends Bool { public static final int constructor = 0xbc799737; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -22273,7 +18546,7 @@ public static class TL_messages_discussionMessage extends TLObject { public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_messages_discussionMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_discussionMessage TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_discussionMessage.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_discussionMessage", constructor)); @@ -22286,23 +18559,9 @@ public static TL_messages_discussionMessage TLdeserialize(AbstractSerializedData return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - messages.add(object); - } + messages = Vector.deserialize(stream, Message::TLdeserialize, exception); if ((flags & 1) != 0) { max_id = stream.readInt32(exception); } @@ -22313,47 +18572,14 @@ public void readParams(AbstractSerializedData stream, boolean exception) { read_outbox_max_id = stream.readInt32(exception); } unread_count = stream.readInt32(exception); - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - messages.get(a).serializeToStream(stream); - } + Vector.serialize(stream, messages); if ((flags & 1) != 0) { stream.writeInt32(max_id); } @@ -22364,18 +18590,8 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(read_outbox_max_id); } stream.writeInt32(unread_count); - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } @@ -22387,7 +18603,7 @@ public static class TL_messages_searchCounter extends TLObject { public MessagesFilter filter; public int count; - public static TL_messages_searchCounter TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_searchCounter TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_searchCounter.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_searchCounter", constructor)); @@ -22400,14 +18616,14 @@ public static TL_messages_searchCounter TLdeserialize(AbstractSerializedData str return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); inexact = (flags & 2) != 0; filter = MessagesFilter.TLdeserialize(stream, stream.readInt32(exception), exception); count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = inexact ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); @@ -22424,7 +18640,7 @@ public static class TL_inputAppEvent extends TLObject { public long peer; public JSONValue data; - public static TL_inputAppEvent TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_inputAppEvent TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_inputAppEvent.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_inputAppEvent", constructor)); @@ -22437,14 +18653,14 @@ public static TL_inputAppEvent TLdeserialize(AbstractSerializedData stream, int return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { time = stream.readDouble(exception); type = stream.readString(exception); peer = stream.readInt64(exception); data = JSONValue.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeDouble(time); stream.writeString(type); @@ -22459,7 +18675,7 @@ public static class TL_auth_exportedAuthorization extends TLObject { public long id; public byte[] bytes; - public static TL_auth_exportedAuthorization TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_auth_exportedAuthorization TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_auth_exportedAuthorization.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_auth_exportedAuthorization", constructor)); @@ -22472,12 +18688,12 @@ public static TL_auth_exportedAuthorization TLdeserialize(AbstractSerializedData return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); bytes = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeByteArray(bytes); @@ -22509,7 +18725,7 @@ public static abstract class WebPage extends TLObject { public String displayedText;//custom public String archivePath;//custom - public static WebPage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static WebPage TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { WebPage result = null; switch (constructor) { case 0xe89c45b2: @@ -22562,8 +18778,7 @@ public static WebPage TLdeserialize(AbstractSerializedData stream, int construct public static class TL_webPage extends WebPage { public static final int constructor = 0xe89c45b2; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); has_large_media = (flags & 8192) != 0; id = stream.readInt64(exception); @@ -22610,25 +18825,11 @@ public void readParams(AbstractSerializedData stream, boolean exception) { cached_page = Page.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 4096) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - WebPageAttribute object = WebPageAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } + attributes = Vector.deserialize(stream, WebPageAttribute::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(id); @@ -22675,12 +18876,7 @@ public void serializeToStream(AbstractSerializedData stream) { cached_page.serializeToStream(stream); } if ((flags & 4096) != 0) { - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } + Vector.serialize(stream, attributes); } } } @@ -22688,8 +18884,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_webPage_layer107 extends TL_webPage { public static final int constructor = 0xfa64e172; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); id = stream.readInt64(exception); url = stream.readString(exception); @@ -22755,7 +18950,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(id); @@ -22811,8 +19006,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_webPage_layer104 extends TL_webPage { public static final int constructor = 0x5f07b4bc; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); id = stream.readInt64(exception); url = stream.readString(exception); @@ -22859,7 +19053,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(id); @@ -22911,213 +19105,206 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_webPage_old extends TL_webPage { public static final int constructor = 0xa31ea0b5; + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + id = stream.readInt64(exception); + url = stream.readString(exception); + display_url = stream.readString(exception); + if ((flags & 1) != 0) { + type = stream.readString(exception); + } + if ((flags & 2) != 0) { + site_name = stream.readString(exception); + } + if ((flags & 4) != 0) { + title = stream.readString(exception); + } + if ((flags & 8) != 0) { + description = stream.readString(exception); + } + if ((flags & 16) != 0) { + photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 32) != 0) { + embed_url = stream.readString(exception); + } + if ((flags & 32) != 0) { + embed_type = stream.readString(exception); + } + if ((flags & 64) != 0) { + embed_width = stream.readInt32(exception); + } + if ((flags & 64) != 0) { + embed_height = stream.readInt32(exception); + } + if ((flags & 128) != 0) { + duration = stream.readInt32(exception); + } + if ((flags & 256) != 0) { + author = stream.readString(exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeInt64(id); + stream.writeString(url); + stream.writeString(display_url); + if ((flags & 1) != 0) { + stream.writeString(type); + } + if ((flags & 2) != 0) { + stream.writeString(site_name); + } + if ((flags & 4) != 0) { + stream.writeString(title); + } + if ((flags & 8) != 0) { + stream.writeString(description); + } + if ((flags & 16) != 0) { + photo.serializeToStream(stream); + } + if ((flags & 32) != 0) { + stream.writeString(embed_url); + } + if ((flags & 32) != 0) { + stream.writeString(embed_type); + } + if ((flags & 64) != 0) { + stream.writeInt32(embed_width); + } + if ((flags & 64) != 0) { + stream.writeInt32(embed_height); + } + if ((flags & 128) != 0) { + stream.writeInt32(duration); + } + if ((flags & 256) != 0) { + stream.writeString(author); + } + } + } + + public static class TL_webPageEmpty extends WebPage { + public static final int constructor = 0x211a1788; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + id = stream.readInt64(exception); + if ((flags & 1) != 0) { + url = stream.readString(exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeInt64(id); + if ((flags & 1) != 0) { + stream.writeString(url); + } + } + } + + public static class TL_webPageEmpty_layer165 extends TL_webPageEmpty { + public static final int constructor = 0xeb1477e8; + + public void readParams(InputSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + } + } + + public static class TL_webPageUrlPending extends WebPage { + public static final int constructor = 0xd41a5167; + + public void readParams(InputSerializedData stream, boolean exception) { + url = stream.readString(exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(url); + } + } + + public static class TL_webPagePending_layer165 extends TL_webPagePending { + public static final int constructor = 0xc586da1c; + + public void readParams(InputSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + date = stream.readInt32(exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt32(date); + } + } + + public static class TL_webPagePending extends WebPage { + public static final int constructor = 0xb0d13e47; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + id = stream.readInt64(exception); + if ((flags & 1) != 0) { + url = stream.readString(exception); + } + date = stream.readInt32(exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeInt64(id); + if ((flags & 1) != 0) { + stream.writeString(url); + } + stream.writeInt32(date); + } + } + + public static class TL_webPageNotModified_layer110 extends TL_webPageNotModified { + public static final int constructor = 0x85849473; + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_webPageNotModified extends WebPage { + public static final int constructor = 0x7311ca11; + + public int cached_page_views; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + if ((flags & 1) != 0) { + cached_page_views = stream.readInt32(exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + stream.writeInt32(cached_page_views); + } + } + } + + public static class TL_webPage_layer58 extends TL_webPage { + public static final int constructor = 0xca820ed7; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - id = stream.readInt64(exception); - url = stream.readString(exception); - display_url = stream.readString(exception); - if ((flags & 1) != 0) { - type = stream.readString(exception); - } - if ((flags & 2) != 0) { - site_name = stream.readString(exception); - } - if ((flags & 4) != 0) { - title = stream.readString(exception); - } - if ((flags & 8) != 0) { - description = stream.readString(exception); - } - if ((flags & 16) != 0) { - photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 32) != 0) { - embed_url = stream.readString(exception); - } - if ((flags & 32) != 0) { - embed_type = stream.readString(exception); - } - if ((flags & 64) != 0) { - embed_width = stream.readInt32(exception); - } - if ((flags & 64) != 0) { - embed_height = stream.readInt32(exception); - } - if ((flags & 128) != 0) { - duration = stream.readInt32(exception); - } - if ((flags & 256) != 0) { - author = stream.readString(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeInt64(id); - stream.writeString(url); - stream.writeString(display_url); - if ((flags & 1) != 0) { - stream.writeString(type); - } - if ((flags & 2) != 0) { - stream.writeString(site_name); - } - if ((flags & 4) != 0) { - stream.writeString(title); - } - if ((flags & 8) != 0) { - stream.writeString(description); - } - if ((flags & 16) != 0) { - photo.serializeToStream(stream); - } - if ((flags & 32) != 0) { - stream.writeString(embed_url); - } - if ((flags & 32) != 0) { - stream.writeString(embed_type); - } - if ((flags & 64) != 0) { - stream.writeInt32(embed_width); - } - if ((flags & 64) != 0) { - stream.writeInt32(embed_height); - } - if ((flags & 128) != 0) { - stream.writeInt32(duration); - } - if ((flags & 256) != 0) { - stream.writeString(author); - } - } - } - - public static class TL_webPageEmpty extends WebPage { - public static final int constructor = 0x211a1788; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - id = stream.readInt64(exception); - if ((flags & 1) != 0) { - url = stream.readString(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeInt64(id); - if ((flags & 1) != 0) { - stream.writeString(url); - } - } - } - - public static class TL_webPageEmpty_layer165 extends TL_webPageEmpty { - public static final int constructor = 0xeb1477e8; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - } - } - - public static class TL_webPageUrlPending extends WebPage { - public static final int constructor = 0xd41a5167; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - url = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(url); - } - } - - public static class TL_webPagePending_layer165 extends TL_webPagePending { - public static final int constructor = 0xc586da1c; - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - date = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt32(date); - } - } - - public static class TL_webPagePending extends WebPage { - public static final int constructor = 0xb0d13e47; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - id = stream.readInt64(exception); - if ((flags & 1) != 0) { - url = stream.readString(exception); - } - date = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeInt64(id); - if ((flags & 1) != 0) { - stream.writeString(url); - } - stream.writeInt32(date); - } - } - - public static class TL_webPageNotModified_layer110 extends TL_webPageNotModified { - public static final int constructor = 0x85849473; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_webPageNotModified extends WebPage { - public static final int constructor = 0x7311ca11; - - public int cached_page_views; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - if ((flags & 1) != 0) { - cached_page_views = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - stream.writeInt32(cached_page_views); - } - } - } - - public static class TL_webPage_layer58 extends TL_webPage { - public static final int constructor = 0xca820ed7; - - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); id = stream.readInt64(exception); url = stream.readString(exception); @@ -23160,7 +19347,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(id); @@ -23207,7 +19394,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class messages_FeaturedStickers extends TLObject { - public static messages_FeaturedStickers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static messages_FeaturedStickers TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { messages_FeaturedStickers result = null; switch (constructor) { case 0xbe382906: @@ -23237,57 +19424,23 @@ public static class TL_messages_featuredStickers extends messages_FeaturedSticke public ArrayList sets = new ArrayList<>(); public ArrayList unread = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); premium = (flags & 1) != 0; hash = stream.readInt64(exception); count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - StickerSetCovered object = StickerSetCovered.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - sets.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - unread.add(stream.readInt64(exception)); - } + sets = Vector.deserialize(stream, StickerSetCovered::TLdeserialize, exception); + unread = Vector.deserializeLong(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = premium ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); stream.writeInt64(hash); stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = sets.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - sets.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = unread.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(unread.get(a)); - } + Vector.serialize(stream, sets); + Vector.serializeLong(stream, unread); } } @@ -23296,11 +19449,11 @@ public static class TL_messages_featuredStickersNotModified extends messages_Fea public int count; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(count); } @@ -23308,7 +19461,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class SecureValueError extends TLObject { - public static SecureValueError TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static SecureValueError TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { SecureValueError result = null; switch (constructor) { case 0x7a700873: @@ -23356,13 +19509,13 @@ public static class TL_secureValueErrorFile extends SecureValueError { public byte[] file_hash; public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); file_hash = stream.readByteArray(exception); text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); type.serializeToStream(stream); stream.writeByteArray(file_hash); @@ -23377,13 +19530,13 @@ public static class TL_secureValueErrorFrontSide extends SecureValueError { public byte[] file_hash; public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); file_hash = stream.readByteArray(exception); text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); type.serializeToStream(stream); stream.writeByteArray(file_hash); @@ -23398,7 +19551,7 @@ public static class TL_secureValueErrorFiles extends SecureValueError { public ArrayList file_hash = new ArrayList<>(); public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); int magic = stream.readInt32(exception); if (magic != 0x1cb5c415) { @@ -23414,7 +19567,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); type.serializeToStream(stream); stream.writeInt32(0x1cb5c415); @@ -23434,13 +19587,13 @@ public static class TL_secureValueErrorReverseSide extends SecureValueError { public byte[] file_hash; public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); file_hash = stream.readByteArray(exception); text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); type.serializeToStream(stream); stream.writeByteArray(file_hash); @@ -23455,13 +19608,13 @@ public static class TL_secureValueErrorTranslationFile extends SecureValueError public byte[] file_hash; public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); file_hash = stream.readByteArray(exception); text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); type.serializeToStream(stream); stream.writeByteArray(file_hash); @@ -23476,13 +19629,13 @@ public static class TL_secureValueError extends SecureValueError { public byte[] hash; public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); hash = stream.readByteArray(exception); text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); type.serializeToStream(stream); stream.writeByteArray(hash); @@ -23498,14 +19651,14 @@ public static class TL_secureValueErrorData extends SecureValueError { public String field; public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); data_hash = stream.readByteArray(exception); field = stream.readString(exception); text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); type.serializeToStream(stream); stream.writeByteArray(data_hash); @@ -23521,7 +19674,7 @@ public static class TL_secureValueErrorTranslationFiles extends SecureValueError public ArrayList file_hash = new ArrayList<>(); public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); int magic = stream.readInt32(exception); if (magic != 0x1cb5c415) { @@ -23537,7 +19690,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); type.serializeToStream(stream); stream.writeInt32(0x1cb5c415); @@ -23557,13 +19710,13 @@ public static class TL_secureValueErrorSelfie extends SecureValueError { public byte[] file_hash; public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); file_hash = stream.readByteArray(exception); text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); type.serializeToStream(stream); stream.writeByteArray(file_hash); @@ -23585,7 +19738,7 @@ public static class TL_secureValue extends TLObject { public SecurePlainData plain_data; public byte[] hash; - public static TL_secureValue TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_secureValue TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_secureValue.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_secureValue", constructor)); @@ -23598,7 +19751,7 @@ public static TL_secureValue TLdeserialize(AbstractSerializedData stream, int co return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); type = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 1) != 0) { @@ -23614,38 +19767,10 @@ public void readParams(AbstractSerializedData stream, boolean exception) { selfie = SecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 64) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - SecureFile object = SecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - translation.add(object); - } + translation = Vector.deserialize(stream, SecureFile::TLdeserialize, exception); } if ((flags & 16) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - SecureFile object = SecureFile.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - files.add(object); - } + files = Vector.deserialize(stream, SecureFile::TLdeserialize, exception); } if ((flags & 32) != 0) { plain_data = SecurePlainData.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -23653,7 +19778,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { hash = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); type.serializeToStream(stream); @@ -23670,20 +19795,10 @@ public void serializeToStream(AbstractSerializedData stream) { selfie.serializeToStream(stream); } if ((flags & 64) != 0) { - stream.writeInt32(0x1cb5c415); - int count = translation.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - translation.get(a).serializeToStream(stream); - } + Vector.serialize(stream, translation); } if ((flags & 16) != 0) { - stream.writeInt32(0x1cb5c415); - int count = files.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - files.get(a).serializeToStream(stream); - } + Vector.serialize(stream, files); } if ((flags & 32) != 0) { plain_data.serializeToStream(stream); @@ -23695,21 +19810,24 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class PhoneCallDiscardReason extends TLObject { public byte[] encrypted_key; - public static PhoneCallDiscardReason TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static PhoneCallDiscardReason TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { PhoneCallDiscardReason result = null; switch (constructor) { - case 0x57adc690: + case TL_phoneCallDiscardReasonHangup.constructor: result = new TL_phoneCallDiscardReasonHangup(); break; - case 0xfaf7e8c9: + case TL_phoneCallDiscardReasonBusy.constructor: result = new TL_phoneCallDiscardReasonBusy(); break; - case 0x85e42301: + case TL_phoneCallDiscardReasonMissed.constructor: result = new TL_phoneCallDiscardReasonMissed(); break; - case 0xe095c1a0: + case TL_phoneCallDiscardReasonDisconnect.constructor: result = new TL_phoneCallDiscardReasonDisconnect(); break; + case TL_phoneCallDiscardReasonAllowGroupCall.constructor: + result = new TL_phoneCallDiscardReasonAllowGroupCall(); + break; } if (result == null && exception) { throw new RuntimeException(String.format("can't parse magic %x in PhoneCallDiscardReason", constructor)); @@ -23724,8 +19842,7 @@ public static PhoneCallDiscardReason TLdeserialize(AbstractSerializedData stream public static class TL_phoneCallDiscardReasonHangup extends PhoneCallDiscardReason { public static final int constructor = 0x57adc690; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -23733,8 +19850,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_phoneCallDiscardReasonBusy extends PhoneCallDiscardReason { public static final int constructor = 0xfaf7e8c9; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -23742,8 +19858,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_phoneCallDiscardReasonMissed extends PhoneCallDiscardReason { public static final int constructor = 0x85e42301; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -23751,9 +19866,23 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_phoneCallDiscardReasonDisconnect extends PhoneCallDiscardReason { public static final int constructor = 0xe095c1a0; + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_phoneCallDiscardReasonAllowGroupCall extends PhoneCallDiscardReason { + public static final int constructor = 0xafe2b839; + + public byte[] encrypted_key; + + public void readParams(InputSerializedData stream, boolean exception) { + encrypted_key = stream.readByteArray(exception); + } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + stream.writeByteArray(encrypted_key); } } @@ -23768,8 +19897,9 @@ public static abstract class DialogFilter extends TLObject { public boolean exclude_muted; public boolean exclude_read; public boolean exclude_archived; + public boolean title_noanimate; public int id; - public String title; + public TL_textWithEntities title = new TL_textWithEntities(); public String emoticon; public ArrayList pinned_peers = new ArrayList<>(); public ArrayList include_peers = new ArrayList<>(); @@ -23777,21 +19907,27 @@ public static abstract class DialogFilter extends TLObject { public boolean has_my_invites; public int color; - public static DialogFilter TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static DialogFilter TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { DialogFilter result = null; switch (constructor) { - case 0x363293ae: + case TL_dialogFilterDefault.constructor: result = new TL_dialogFilterDefault(); break; case TL_dialogFilter.constructor: result = new TL_dialogFilter(); break; + case TL_dialogFilter_layer195.constructor: + result = new TL_dialogFilter_layer195(); + break; case TL_dialogFilter_layer175.constructor: result = new TL_dialogFilter_layer175(); break; case TL_dialogFilterChatlist.constructor: result = new TL_dialogFilterChatlist(); break; + case TL_dialogFilterChatlist_layer195.constructor: + result = new TL_dialogFilterChatlist_layer195(); + break; case TL_dialogFilterChatlist_layer175.constructor: result = new TL_dialogFilterChatlist_layer175(); break; @@ -23807,158 +19943,118 @@ public static DialogFilter TLdeserialize(AbstractSerializedData stream, int cons } public static class TL_dialogFilterChatlist extends DialogFilter { - public static final int constructor = 0x9fe28ea4; + public static final int constructor = 0x96537bd7; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); has_my_invites = (flags & 67108864) != 0; id = stream.readInt32(exception); - title = stream.readString(exception); + title = TL_textWithEntities.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 33554432) != 0) { emoticon = stream.readString(exception); } if ((flags & 134217728) != 0) { color = stream.readInt32(exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + pinned_peers = Vector.deserialize(stream, InputPeer::TLdeserialize, exception); + include_peers = Vector.deserialize(stream, InputPeer::TLdeserialize, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = has_my_invites ? (flags | 67108864) : (flags &~ 67108864); + stream.writeInt32(flags); + stream.writeInt32(id); + title.serializeToStream(stream); + if ((flags & 33554432) != 0) { + stream.writeString(emoticon); } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputPeer object = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - pinned_peers.add(object); + if ((flags & 134217728) != 0) { + stream.writeInt32(color); } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + Vector.serialize(stream, pinned_peers); + Vector.serialize(stream, include_peers); + } + } + + public static class TL_dialogFilterChatlist_layer195 extends TL_dialogFilterChatlist { + public static final int constructor = 0x9fe28ea4; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + has_my_invites = (flags & 67108864) != 0; + id = stream.readInt32(exception); + title = new TL_textWithEntities(); + title.text = stream.readString(exception); + if ((flags & 33554432) != 0) { + emoticon = stream.readString(exception); } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputPeer object = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - include_peers.add(object); + if ((flags & 134217728) != 0) { + color = stream.readInt32(exception); } + pinned_peers = Vector.deserialize(stream, InputPeer::TLdeserialize, exception); + include_peers = Vector.deserialize(stream, InputPeer::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = has_my_invites ? (flags | 67108864) : (flags &~ 67108864); stream.writeInt32(flags); stream.writeInt32(id); - stream.writeString(title); + stream.writeString(title == null ? "" : title.text); if ((flags & 33554432) != 0) { stream.writeString(emoticon); } if ((flags & 134217728) != 0) { stream.writeInt32(color); } - stream.writeInt32(0x1cb5c415); - int count = pinned_peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - pinned_peers.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = include_peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - include_peers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, pinned_peers); + Vector.serialize(stream, include_peers); } } public static class TL_dialogFilterChatlist_layer175 extends TL_dialogFilterChatlist { public static final int constructor = 0xd64a04a8; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); has_my_invites = (flags & 67108864) != 0; id = stream.readInt32(exception); - title = stream.readString(exception); + title = new TL_textWithEntities(); + title.text = stream.readString(exception); if ((flags & 33554432) != 0) { emoticon = stream.readString(exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputPeer object = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - pinned_peers.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputPeer object = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - include_peers.add(object); - } + pinned_peers = Vector.deserialize(stream, InputPeer::TLdeserialize, exception); + include_peers = Vector.deserialize(stream, InputPeer::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = has_my_invites ? (flags | 67108864) : (flags &~ 67108864); stream.writeInt32(flags); stream.writeInt32(id); - stream.writeString(title); + stream.writeString(title == null ? "" : title.text); if ((flags & 33554432) != 0) { stream.writeString(emoticon); } - stream.writeInt32(0x1cb5c415); - int count = pinned_peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - pinned_peers.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = include_peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - include_peers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, pinned_peers); + Vector.serialize(stream, include_peers); } } public static class TL_dialogFilterDefault extends DialogFilter { public static final int constructor = 0x363293ae; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } public static class TL_dialogFilter extends DialogFilter { - public static final int constructor = 0x5fb5523b; + public static final int constructor = 0xaa472651; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); contacts = (flags & 1) != 0; non_contacts = (flags & 2) != 0; @@ -23968,62 +20064,74 @@ public void readParams(AbstractSerializedData stream, boolean exception) { exclude_muted = (flags & 2048) != 0; exclude_read = (flags & 4096) != 0; exclude_archived = (flags & 8192) != 0; + title_noanimate = (flags & 268435456) != 0; id = stream.readInt32(exception); - title = stream.readString(exception); + title = TL_textWithEntities.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 33554432) != 0) { emoticon = stream.readString(exception); } if ((flags & 134217728) != 0) { color = stream.readInt32(exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputPeer object = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - pinned_peers.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + pinned_peers = Vector.deserialize(stream, InputPeer::TLdeserialize, exception); + include_peers = Vector.deserialize(stream, InputPeer::TLdeserialize, exception); + exclude_peers = Vector.deserialize(stream, InputPeer::TLdeserialize, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = contacts ? (flags | 1) : (flags &~ 1); + flags = non_contacts ? (flags | 2) : (flags &~ 2); + flags = groups ? (flags | 4) : (flags &~ 4); + flags = broadcasts ? (flags | 8) : (flags &~ 8); + flags = bots ? (flags | 16) : (flags &~ 16); + flags = exclude_muted ? (flags | 2048) : (flags &~ 2048); + flags = exclude_read ? (flags | 4096) : (flags &~ 4096); + flags = exclude_archived ? (flags | 8192) : (flags &~ 8192); + flags = title_noanimate ? (flags | 268435456) : (flags &~ 268435456); + stream.writeInt32(flags); + stream.writeInt32(id); + title.serializeToStream(stream); + if ((flags & 33554432) != 0) { + stream.writeString(emoticon); } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputPeer object = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - include_peers.add(object); + if ((flags & 134217728) != 0) { + stream.writeInt32(color); } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + Vector.serialize(stream, pinned_peers); + Vector.serialize(stream, include_peers); + Vector.serialize(stream, exclude_peers); + } + } + + public static class TL_dialogFilter_layer195 extends TL_dialogFilter { + public static final int constructor = 0x5fb5523b; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + contacts = (flags & 1) != 0; + non_contacts = (flags & 2) != 0; + groups = (flags & 4) != 0; + broadcasts = (flags & 8) != 0; + bots = (flags & 16) != 0; + exclude_muted = (flags & 2048) != 0; + exclude_read = (flags & 4096) != 0; + exclude_archived = (flags & 8192) != 0; + id = stream.readInt32(exception); + title = new TL_textWithEntities(); + title.text = stream.readString(exception); + if ((flags & 33554432) != 0) { + emoticon = stream.readString(exception); } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputPeer object = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - exclude_peers.add(object); + if ((flags & 134217728) != 0) { + color = stream.readInt32(exception); } + pinned_peers = Vector.deserialize(stream, InputPeer::TLdeserialize, exception); + include_peers = Vector.deserialize(stream, InputPeer::TLdeserialize, exception); + exclude_peers = Vector.deserialize(stream, InputPeer::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = contacts ? (flags | 1) : (flags &~ 1); flags = non_contacts ? (flags | 2) : (flags &~ 2); @@ -24035,38 +20143,23 @@ public void serializeToStream(AbstractSerializedData stream) { flags = exclude_archived ? (flags | 8192) : (flags &~ 8192); stream.writeInt32(flags); stream.writeInt32(id); - stream.writeString(title); + stream.writeString(title == null ? "" : title.text); if ((flags & 33554432) != 0) { stream.writeString(emoticon); } if ((flags & 134217728) != 0) { stream.writeInt32(color); } - stream.writeInt32(0x1cb5c415); - int count = pinned_peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - pinned_peers.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = include_peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - include_peers.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = exclude_peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - exclude_peers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, pinned_peers); + Vector.serialize(stream, include_peers); + Vector.serialize(stream, exclude_peers); } } public static class TL_dialogFilter_layer175 extends TL_dialogFilter { public static final int constructor = 0x7438f7e8; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); contacts = (flags & 1) != 0; non_contacts = (flags & 2) != 0; @@ -24077,58 +20170,17 @@ public void readParams(AbstractSerializedData stream, boolean exception) { exclude_read = (flags & 4096) != 0; exclude_archived = (flags & 8192) != 0; id = stream.readInt32(exception); - title = stream.readString(exception); + title = new TL_textWithEntities(); + title.text = stream.readString(exception); if ((flags & 33554432) != 0) { emoticon = stream.readString(exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputPeer object = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - pinned_peers.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputPeer object = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - include_peers.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputPeer object = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - exclude_peers.add(object); - } + pinned_peers = Vector.deserialize(stream, InputPeer::TLdeserialize, exception); + include_peers = Vector.deserialize(stream, InputPeer::TLdeserialize, exception); + exclude_peers = Vector.deserialize(stream, InputPeer::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = contacts ? (flags | 1) : (flags &~ 1); flags = non_contacts ? (flags | 2) : (flags &~ 2); @@ -24140,28 +20192,13 @@ public void serializeToStream(AbstractSerializedData stream) { flags = exclude_archived ? (flags | 8192) : (flags &~ 8192); stream.writeInt32(flags); stream.writeInt32(id); - stream.writeString(title); + stream.writeString(title == null ? "" : title.text); if ((flags & 33554432) != 0) { stream.writeString(emoticon); } - stream.writeInt32(0x1cb5c415); - int count = pinned_peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - pinned_peers.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = include_peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - include_peers.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = exclude_peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - exclude_peers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, pinned_peers); + Vector.serialize(stream, include_peers); + Vector.serialize(stream, exclude_peers); } } @@ -24170,7 +20207,7 @@ public static class TL_auth_passwordRecovery extends TLObject { public String email_pattern; - public static TL_auth_passwordRecovery TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_auth_passwordRecovery TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_auth_passwordRecovery.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_auth_passwordRecovery", constructor)); @@ -24183,11 +20220,11 @@ public static TL_auth_passwordRecovery TLdeserialize(AbstractSerializedData stre return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { email_pattern = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(email_pattern); } @@ -24199,7 +20236,7 @@ public static class TL_exportedContactToken extends TLObject { public String url; public int expires; - public static TL_exportedContactToken TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_exportedContactToken TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_exportedContactToken.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_exportedContactToken", constructor)); @@ -24212,12 +20249,12 @@ public static TL_exportedContactToken TLdeserialize(AbstractSerializedData strea return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); expires = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); stream.writeInt32(expires); @@ -24230,7 +20267,7 @@ public static class TL_botCommand extends TLObject { public String command; public String description; - public static TL_botCommand TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_botCommand TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_botCommand.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_botCommand", constructor)); @@ -24243,12 +20280,12 @@ public static TL_botCommand TLdeserialize(AbstractSerializedData stream, int con return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { command = stream.readString(exception); description = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(command); stream.writeString(description); @@ -24257,7 +20294,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class InputNotifyPeer extends TLObject { - public static InputNotifyPeer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputNotifyPeer TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputNotifyPeer result = null; switch (constructor) { case 0x4a95e84e: @@ -24289,8 +20326,7 @@ public static InputNotifyPeer TLdeserialize(AbstractSerializedData stream, int c public static class TL_inputNotifyChats extends InputNotifyPeer { public static final int constructor = 0x4a95e84e; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -24300,11 +20336,11 @@ public static class TL_inputNotifyPeer extends InputNotifyPeer { public InputPeer peer; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); } @@ -24313,8 +20349,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputNotifyUsers extends InputNotifyPeer { public static final int constructor = 0x193b4417; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -24322,8 +20357,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputNotifyBroadcasts extends InputNotifyPeer { public static final int constructor = 0xb1db7c7e; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -24334,12 +20368,12 @@ public static class TL_inputNotifyForumTopic extends InputNotifyPeer { public InputPeer peer; public int top_msg_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); top_msg_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(top_msg_id); @@ -24357,7 +20391,7 @@ public static abstract class InputFileLocation extends TLObject { public int local_id; public long secret; - public static InputFileLocation TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputFileLocation TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputFileLocation result = null; switch (constructor) { case 0x40181ffe: @@ -24398,15 +20432,14 @@ public static InputFileLocation TLdeserialize(AbstractSerializedData stream, int public static class TL_inputPhotoFileLocation extends InputFileLocation { public static final int constructor = 0x40181ffe; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); file_reference = stream.readByteArray(exception); thumb_size = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -24418,15 +20451,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputDocumentFileLocation extends InputFileLocation { public static final int constructor = 0xbad07584; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); file_reference = stream.readByteArray(exception); thumb_size = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -24442,14 +20474,14 @@ public static class TL_inputPeerPhotoFileLocation extends InputFileLocation { public InputPeer peer; public long photo_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); big = (flags & 1) != 0; peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); photo_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = big ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -24461,13 +20493,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputEncryptedFileLocation extends InputFileLocation { public static final int constructor = 0xf5235d55; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -24480,12 +20511,12 @@ public static class TL_inputStickerSetThumb extends InputFileLocation { public InputStickerSet stickerset; public int thumb_version; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { stickerset = InputStickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); thumb_version = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stickerset.serializeToStream(stream); stream.writeInt32(thumb_version); @@ -24501,7 +20532,7 @@ public static class TL_inputGroupCallStream extends InputFileLocation { public int video_channel; public int video_quality; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); call = TL_inputGroupCall.TLdeserialize(stream, stream.readInt32(exception), exception); time_ms = stream.readInt64(exception); @@ -24514,7 +20545,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); call.serializeToStream(stream); @@ -24532,15 +20563,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputFileLocation extends InputFileLocation { public static final int constructor = 0xdfdaabe1; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { volume_id = stream.readInt64(exception); local_id = stream.readInt32(exception); secret = stream.readInt64(exception); file_reference = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(volume_id); stream.writeInt32(local_id); @@ -24552,13 +20582,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputSecureFileLocation extends InputFileLocation { public static final int constructor = 0xcbc7ee28; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -24571,7 +20600,7 @@ public static class TL_photos_photo extends TLObject { public Photo photo; public ArrayList users = new ArrayList<>(); - public static TL_photos_photo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_photos_photo TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_photos_photo.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_photos_photo", constructor)); @@ -24584,40 +20613,21 @@ public static TL_photos_photo TLdeserialize(AbstractSerializedData stream, int c return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); photo.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, users); } } public static abstract class help_TermsOfServiceUpdate extends TLObject { - public static help_TermsOfServiceUpdate TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static help_TermsOfServiceUpdate TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { help_TermsOfServiceUpdate result = null; switch (constructor) { case 0x28ecf961: @@ -24643,12 +20653,12 @@ public static class TL_help_termsOfServiceUpdate extends help_TermsOfServiceUpda public int expires; public TL_help_termsOfService terms_of_service; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { expires = stream.readInt32(exception); terms_of_service = TL_help_termsOfService.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(expires); terms_of_service.serializeToStream(stream); @@ -24660,11 +20670,11 @@ public static class TL_help_termsOfServiceUpdateEmpty extends help_TermsOfServic public int expires; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { expires = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(expires); } @@ -24676,7 +20686,7 @@ public static class TL_messages_chatAdminsWithInvites extends TLObject { public ArrayList admins = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_messages_chatAdminsWithInvites TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_chatAdminsWithInvites TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_chatAdminsWithInvites.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_chatAdminsWithInvites", constructor)); @@ -24689,477 +20699,21 @@ public static TL_messages_chatAdminsWithInvites TLdeserialize(AbstractSerialized return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_chatAdminWithInvites object = TL_chatAdminWithInvites.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - admins.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = admins.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - admins.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } - - public static class TL_phone_groupCall extends TLObject { - public static final int constructor = 0x9e727aad; - - public GroupCall call; - public ArrayList participants = new ArrayList<>(); - public String participants_next_offset; - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); - - public static TL_phone_groupCall TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_phone_groupCall.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_phone_groupCall", constructor)); - } else { - return null; - } - } - TL_phone_groupCall result = new TL_phone_groupCall(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - call = GroupCall.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_groupCallParticipant object = TL_groupCallParticipant.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - participants.add(object); - } - participants_next_offset = stream.readString(exception); - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - call.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = participants.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - participants.get(a).serializeToStream(stream); - } - stream.writeString(participants_next_offset); - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } - - public static abstract class PhoneCall extends TLObject { - - public int flags; - public boolean p2p_allowed; - public long id; - public long access_hash; - public int date; - public long admin_id; - public long participant_id; - public byte[] g_a_or_b; - public long key_fingerprint; - public PhoneCallProtocol protocol; - public ArrayList connections = new ArrayList<>(); - public int start_date; - public boolean need_rating; - public boolean need_debug; - public boolean video; - public PhoneCallDiscardReason reason; - public int duration; - public byte[] g_a_hash; - public byte[] g_b; - public int receive_date; - public TL_dataJSON custom_parameters; - - public static PhoneCall TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - PhoneCall result = null; - switch (constructor) { - case 0x14b0ed0c: - result = new TL_phoneCallRequested(); - break; - case 0x30535af5: - result = new TL_phoneCall(); - break; - case 0x967f7c67: - result = new TL_phoneCall_layer176(); - break; - case 0x5366c915: - result = new TL_phoneCallEmpty(); - break; - case 0x3660c311: - result = new TL_phoneCallAccepted(); - break; - case 0xc5226f17: - result = new TL_phoneCallWaiting(); - break; - case 0x50ca4de1: - result = new TL_phoneCallDiscarded(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in PhoneCall", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } - - public static class TL_phoneCallRequested extends PhoneCall { - public static final int constructor = 0x14b0ed0c; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - video = (flags & 64) != 0; - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - admin_id = stream.readInt64(exception); - participant_id = stream.readInt64(exception); - g_a_hash = stream.readByteArray(exception); - protocol = PhoneCallProtocol.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = video ? (flags | 64) : (flags &~ 64); - stream.writeInt32(flags); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeInt64(admin_id); - stream.writeInt64(participant_id); - stream.writeByteArray(g_a_hash); - protocol.serializeToStream(stream); - } - } - - public static class TL_phoneCall extends PhoneCall { - public static final int constructor = 0x30535af5; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - p2p_allowed = (flags & 32) != 0; - video = (flags & 64) != 0; - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - admin_id = stream.readInt64(exception); - participant_id = stream.readInt64(exception); - g_a_or_b = stream.readByteArray(exception); - key_fingerprint = stream.readInt64(exception); - protocol = PhoneCallProtocol.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PhoneConnection object = PhoneConnection.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - connections.add(object); - } - start_date = stream.readInt32(exception); - if ((flags & 128) != 0) { - custom_parameters = TL_dataJSON.TLdeserialize(stream, stream.readInt32(exception), exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = p2p_allowed ? (flags | 32) : (flags &~ 32); - flags = video ? (flags | 64) : (flags &~ 64); - stream.writeInt32(flags); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeInt64(admin_id); - stream.writeInt64(participant_id); - stream.writeByteArray(g_a_or_b); - stream.writeInt64(key_fingerprint); - protocol.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = connections.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - connections.get(a).serializeToStream(stream); - } - stream.writeInt32(start_date); - if ((flags & 128) != 0) { - custom_parameters.serializeToStream(stream); - } - } - } - - public static class TL_phoneCall_layer176 extends TL_phoneCall { - public static final int constructor = 0x967f7c67; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - p2p_allowed = (flags & 32) != 0; - video = (flags & 64) != 0; - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - admin_id = stream.readInt64(exception); - participant_id = stream.readInt64(exception); - g_a_or_b = stream.readByteArray(exception); - key_fingerprint = stream.readInt64(exception); - protocol = PhoneCallProtocol.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PhoneConnection object = PhoneConnection.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - connections.add(object); - } - start_date = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = p2p_allowed ? (flags | 32) : (flags &~ 32); - flags = video ? (flags | 64) : (flags &~ 64); - stream.writeInt32(flags); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeInt64(admin_id); - stream.writeInt64(participant_id); - stream.writeByteArray(g_a_or_b); - stream.writeInt64(key_fingerprint); - protocol.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = connections.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - connections.get(a).serializeToStream(stream); - } - stream.writeInt32(start_date); - } - } - - public static class TL_phoneCallEmpty extends PhoneCall { - public static final int constructor = 0x5366c915; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - } - } - - public static class TL_phoneCallAccepted extends PhoneCall { - public static final int constructor = 0x3660c311; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - video = (flags & 64) != 0; - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - admin_id = stream.readInt64(exception); - participant_id = stream.readInt64(exception); - g_b = stream.readByteArray(exception); - protocol = PhoneCallProtocol.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = video ? (flags | 64) : (flags &~ 64); - stream.writeInt32(flags); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeInt64(admin_id); - stream.writeInt64(participant_id); - stream.writeByteArray(g_b); - protocol.serializeToStream(stream); - } - } - - public static class TL_phoneCallWaiting extends PhoneCall { - public static final int constructor = 0xc5226f17; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - video = (flags & 64) != 0; - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - admin_id = stream.readInt64(exception); - participant_id = stream.readInt64(exception); - protocol = PhoneCallProtocol.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 1) != 0) { - receive_date = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = video ? (flags | 64) : (flags &~ 64); - stream.writeInt32(flags); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeInt64(admin_id); - stream.writeInt64(participant_id); - protocol.serializeToStream(stream); - if ((flags & 1) != 0) { - stream.writeInt32(receive_date); - } - } - } - - public static class TL_phoneCallDiscarded extends PhoneCall { - public static final int constructor = 0x50ca4de1; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - need_rating = (flags & 4) != 0; - need_debug = (flags & 8) != 0; - video = (flags & 64) != 0; - id = stream.readInt64(exception); - if ((flags & 1) != 0) { - reason = PhoneCallDiscardReason.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 2) != 0) { - duration = stream.readInt32(exception); - } + public void readParams(InputSerializedData stream, boolean exception) { + admins = Vector.deserialize(stream, TL_chatAdminWithInvites::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = need_rating ? (flags | 4) : (flags &~ 4); - flags = need_debug ? (flags | 8) : (flags &~ 8); - flags = video ? (flags | 64) : (flags &~ 64); - stream.writeInt32(flags); - stream.writeInt64(id); - if ((flags & 1) != 0) { - reason.serializeToStream(stream); - } - if ((flags & 2) != 0) { - stream.writeInt32(duration); - } + Vector.serialize(stream, admins); + Vector.serialize(stream, users); } } public static abstract class help_CountriesList extends TLObject { - public static help_CountriesList TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static help_CountriesList TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { help_CountriesList result = null; switch (constructor) { case 0x93cc1f32: @@ -25182,8 +20736,7 @@ public static help_CountriesList TLdeserialize(AbstractSerializedData stream, in public static class TL_help_countriesListNotModified extends help_CountriesList { public static final int constructor = 0x93cc1f32; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -25194,33 +20747,14 @@ public static class TL_help_countriesList extends help_CountriesList { public ArrayList countries = new ArrayList<>(); public int hash; - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_help_country object = TL_help_country.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - countries.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + countries = Vector.deserialize(stream, TL_help_country::TLdeserialize, exception); hash = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = countries.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - countries.get(a).serializeToStream(stream); - } + Vector.serialize(stream, countries); stream.writeInt32(hash); } } @@ -25274,13 +20808,23 @@ public static abstract class User extends TLObject { public TL_peerColor color; public TL_peerColor profile_color; public int bot_active_users; + public long bot_verification_icon; - public static User TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static User TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { User result = null; switch (constructor) { case TL_user.constructor: result = new TL_user(); break; + case TL_user_layer196_2.constructor: + result = new TL_user_layer196_2(); + break; + case TL_user_layer196_1.constructor: + result = new TL_user_layer196_1(); + break; + case TL_user_layer195.constructor: + result = new TL_user_layer195(); + break; case TL_user_layer185.constructor: result = new TL_user_layer185(); break; @@ -25290,67 +20834,67 @@ public static User TLdeserialize(AbstractSerializedData stream, int constructor, case TL_user_layer166.constructor: result = new TL_user_layer166(); break; - case 0xcab35e18: + case TL_userContact_old2.constructor: result = new TL_userContact_old2(); break; - case 0xf2fb8319: + case TL_userContact_old.constructor: result = new TL_userContact_old(); break; - case 0xd3bc4b7a: + case TL_userEmpty.constructor: result = new TL_userEmpty(); break; case TL_user_layer165.constructor: result = new TL_user_layer165(); break; - case 0x8f97c628: + case TL_user_layer159.constructor: result = new TL_user_layer159(); break; - case 0x5d99adee: + case TL_user_layer147.constructor: result = new TL_user_layer147(); break; - case 0x3ff6ecb0: + case TL_user_layer144.constructor: result = new TL_user_layer144(); break; - case 0x938458c1: + case TL_user_layer131.constructor: result = new TL_user_layer131(); break; - case 0x2e13f4c3: + case TL_user_layer104.constructor: result = new TL_user_layer104(); break; - case 0x720535ec: + case TL_userSelf_old.constructor: result = new TL_userSelf_old(); break; - case 0x1c60e608: + case TL_userSelf_old3.constructor: result = new TL_userSelf_old3(); break; - case 0xd6016d7a: + case TL_userDeleted_old2.constructor: result = new TL_userDeleted_old2(); break; - case 0x200250ba: + case TL_userEmpty_layer131.constructor: result = new TL_userEmpty_layer131(); break; - case 0x22e8ceb0: + case TL_userRequest_old.constructor: result = new TL_userRequest_old(); break; - case 0x5214c89d: + case TL_userForeign_old.constructor: result = new TL_userForeign_old(); break; - case 0x75cf7a8: + case TL_userForeign_old2.constructor: result = new TL_userForeign_old2(); break; - case 0xd9ccc4ef: + case TL_userRequest_old2.constructor: result = new TL_userRequest_old2(); break; - case 0xb29ad7cc: + case TL_userDeleted_old.constructor: result = new TL_userDeleted_old(); break; - case 0xd10d979a: + case TL_user_layer65.constructor: result = new TL_user_layer65(); break; - case 0x22e49072: + case TL_user_old.constructor: result = new TL_user_old(); break; - case 0x7007b451: + case TL_userSelf_old2.constructor: result = new TL_userSelf_old2(); break; } @@ -25367,8 +20911,7 @@ public static User TLdeserialize(AbstractSerializedData stream, int constructor, public static class TL_userContact_old2 extends User { public static final int constructor = 0xcab35e18; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); first_name = stream.readString(exception); last_name = stream.readString(exception); @@ -25379,7 +20922,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) id); stream.writeString(first_name); @@ -25395,8 +20938,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userContact_old extends TL_userContact_old2 { public static final int constructor = 0xf2fb8319; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); first_name = stream.readString(exception); last_name = stream.readString(exception); @@ -25406,7 +20948,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) id); stream.writeString(first_name); @@ -25421,21 +20963,20 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userEmpty extends User { public static final int constructor = 0xd3bc4b7a; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); } } public static class TL_user extends User { - public static final int constructor = 0x83314fca; + public static final int constructor = 0x4b46c37e; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); self = (flags & 1024) != 0; contact = (flags & 2048) != 0; @@ -25489,21 +21030,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot_info_version = stream.readInt32(exception); } if ((flags & 262144) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } if ((flags & 524288) != 0) { bot_inline_placeholder = stream.readString(exception); @@ -25515,21 +21042,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { emoji_status = EmojiStatus.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_username object = TL_username.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - usernames.add(object); - } + usernames = Vector.deserialize(stream, TL_username::TLdeserialize, exception); } try { if ((flags2 & 32) != 0) { @@ -25547,9 +21060,12 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags2 & 4096) != 0) { bot_active_users = stream.readInt32(exception); } + if ((flags2 & 16384) != 0) { + bot_verification_icon = stream.readInt64(exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { if (username == null) { flags = flags & ~8; } @@ -25607,12 +21123,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(bot_info_version); } if ((flags & 262144) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } + Vector.serialize(stream, restriction_reason); } if ((flags & 524288) != 0) { stream.writeString(bot_inline_placeholder); @@ -25624,12 +21135,7 @@ public void serializeToStream(AbstractSerializedData stream) { emoji_status.serializeToStream(stream); } if ((flags2 & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = usernames.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - usernames.get(a).serializeToStream(stream); - } + Vector.serialize(stream, usernames); } if ((flags2 & 32) != 0) { stream.writeInt32(stories_max_id); @@ -25649,13 +21155,16 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags2 & 4096) != 0) { stream.writeInt32(bot_active_users); } + if ((flags2 & 16384) != 0) { + stream.writeInt64(bot_verification_icon); + } } } - public static class TL_user_layer185 extends TL_user { - public static final int constructor = 0x4fe9cce0; + public static class TL_user_layer196_2 extends TL_user { + public static final int constructor = 0x59476956; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); self = (flags & 1024) != 0; contact = (flags & 2048) != 0; @@ -25682,6 +21191,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { stories_unavailable = (flags2 & 16) != 0; contact_require_premium = (flags2 & 1024) != 0; bot_business = (flags2 & 2048) != 0; + bot_has_main_app = (flags2 & 8192) != 0; id = stream.readInt64(exception); if ((flags & 1) != 0) { access_hash = stream.readInt64(exception); @@ -25708,21 +21218,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot_info_version = stream.readInt32(exception); } if ((flags & 262144) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } if ((flags & 524288) != 0) { bot_inline_placeholder = stream.readString(exception); @@ -25734,21 +21230,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { emoji_status = EmojiStatus.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_username object = TL_username.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - usernames.add(object); - } + usernames = Vector.deserialize(stream, TL_username::TLdeserialize, exception); } try { if ((flags2 & 32) != 0) { @@ -25766,9 +21248,12 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags2 & 4096) != 0) { bot_active_users = stream.readInt32(exception); } + if ((flags2 & 16384) != 0) { + bot_verification_icon = stream.readInt64(exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { if (username == null) { flags = flags & ~8; } @@ -25798,6 +21283,7 @@ public void serializeToStream(AbstractSerializedData stream) { flags2 = stories_unavailable ? (flags2 | 16) : (flags2 &~ 16); flags2 = contact_require_premium ? (flags2 | 1024) : (flags2 &~ 1024); flags2 = bot_business ? (flags2 | 2048) : (flags2 &~ 2048); + flags2 = bot_has_main_app ? (flags2 | 8192) : (flags2 &~ 8192); stream.writeInt32(flags2); stream.writeInt64(id); if ((flags & 1) != 0) { @@ -25825,12 +21311,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(bot_info_version); } if ((flags & 262144) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } + Vector.serialize(stream, restriction_reason); } if ((flags & 524288) != 0) { stream.writeString(bot_inline_placeholder); @@ -25842,12 +21323,7 @@ public void serializeToStream(AbstractSerializedData stream) { emoji_status.serializeToStream(stream); } if ((flags2 & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = usernames.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - usernames.get(a).serializeToStream(stream); - } + Vector.serialize(stream, usernames); } if ((flags2 & 32) != 0) { stream.writeInt32(stories_max_id); @@ -25867,13 +21343,16 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags2 & 4096) != 0) { stream.writeInt32(bot_active_users); } + if ((flags2 & 16384) != 0) { + stream.writeInt64(bot_verification_icon); + } } } - public static class TL_user_layer184 extends TL_user { - public static final int constructor = 0x215c4438; + public static class TL_user_layer196_1 extends TL_user { + public static final int constructor = 0x685f5e21; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); self = (flags & 1024) != 0; contact = (flags & 2048) != 0; @@ -25900,6 +21379,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { stories_unavailable = (flags2 & 16) != 0; contact_require_premium = (flags2 & 1024) != 0; bot_business = (flags2 & 2048) != 0; + bot_has_main_app = (flags2 & 8192) != 0; id = stream.readInt64(exception); if ((flags & 1) != 0) { access_hash = stream.readInt64(exception); @@ -25926,21 +21406,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot_info_version = stream.readInt32(exception); } if ((flags & 262144) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } if ((flags & 524288) != 0) { bot_inline_placeholder = stream.readString(exception); @@ -25952,21 +21418,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { emoji_status = EmojiStatus.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_username object = TL_username.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - usernames.add(object); - } + usernames = Vector.deserialize(stream, TL_username::TLdeserialize, exception); } try { if ((flags2 & 32) != 0) { @@ -25981,9 +21433,15 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags2 & 512) != 0) { profile_color = TL_peerColor.TLdeserialize(stream, stream.readInt32(exception), exception); } + if ((flags2 & 4096) != 0) { + bot_active_users = stream.readInt32(exception); + } + if ((flags2 & 16384) != 0) { + bot_verification_icon = stream.readInt64(exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { if (username == null) { flags = flags & ~8; } @@ -26013,6 +21471,7 @@ public void serializeToStream(AbstractSerializedData stream) { flags2 = stories_unavailable ? (flags2 | 16) : (flags2 &~ 16); flags2 = contact_require_premium ? (flags2 | 1024) : (flags2 &~ 1024); flags2 = bot_business ? (flags2 | 2048) : (flags2 &~ 2048); + flags2 = bot_has_main_app ? (flags2 | 8192) : (flags2 &~ 8192); stream.writeInt32(flags2); stream.writeInt64(id); if ((flags & 1) != 0) { @@ -26040,12 +21499,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(bot_info_version); } if ((flags & 262144) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } + Vector.serialize(stream, restriction_reason); } if ((flags & 524288) != 0) { stream.writeString(bot_inline_placeholder); @@ -26057,12 +21511,7 @@ public void serializeToStream(AbstractSerializedData stream) { emoji_status.serializeToStream(stream); } if ((flags2 & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = usernames.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - usernames.get(a).serializeToStream(stream); - } + Vector.serialize(stream, usernames); } if ((flags2 & 32) != 0) { stream.writeInt32(stories_max_id); @@ -26079,13 +21528,19 @@ public void serializeToStream(AbstractSerializedData stream) { } profile_color.serializeToStream(stream); } + if ((flags2 & 4096) != 0) { + stream.writeInt32(bot_active_users); + } + if ((flags2 & 16384) != 0) { + stream.writeInt64(bot_verification_icon); + } } } - public static class TL_user_layer166 extends TL_user { - public static final int constructor = 0xeb602f25; + public static class TL_user_layer195 extends TL_user { + public static final int constructor = 0x83314fca; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); self = (flags & 1024) != 0; contact = (flags & 2048) != 0; @@ -26110,7 +21565,10 @@ public void readParams(AbstractSerializedData stream, boolean exception) { close_friend = (flags2 & 4) != 0; stories_hidden = (flags2 & 8) != 0; stories_unavailable = (flags2 & 16) != 0; - id = stream.readInt64(exception); + contact_require_premium = (flags2 & 1024) != 0; + bot_business = (flags2 & 2048) != 0; + bot_has_main_app = (flags2 & 8192) != 0; + id = stream.readInt64(exception); if ((flags & 1) != 0) { access_hash = stream.readInt64(exception); } @@ -26136,21 +21594,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot_info_version = stream.readInt32(exception); } if ((flags & 262144) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } if ((flags & 524288) != 0) { bot_inline_placeholder = stream.readString(exception); @@ -26162,21 +21606,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { emoji_status = EmojiStatus.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_username object = TL_username.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - usernames.add(object); - } + usernames = Vector.deserialize(stream, TL_username::TLdeserialize, exception); } try { if ((flags2 & 32) != 0) { @@ -26185,19 +21615,18 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } catch (Throwable e) { FileLog.e(e); } - if ((flags2 & 128) != 0) { - color = new TL_peerColor(); - color.color = stream.readInt32(exception); + if ((flags2 & 256) != 0) { + color = TL_peerColor.TLdeserialize(stream, stream.readInt32(exception), exception); } - if ((flags2 & 64) != 0) { - if (color == null) { - color = new TL_peerColor(); - } - color.background_emoji_id = stream.readInt64(exception); + if ((flags2 & 512) != 0) { + profile_color = TL_peerColor.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags2 & 4096) != 0) { + bot_active_users = stream.readInt32(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { if (username == null) { flags = flags & ~8; } @@ -26225,6 +21654,9 @@ public void serializeToStream(AbstractSerializedData stream) { flags2 = close_friend ? (flags2 | 4) : (flags2 &~ 4); flags2 = stories_hidden ? (flags2 | 8) : (flags2 &~ 8); flags2 = stories_unavailable ? (flags2 | 16) : (flags2 &~ 16); + flags2 = contact_require_premium ? (flags2 | 1024) : (flags2 &~ 1024); + flags2 = bot_business ? (flags2 | 2048) : (flags2 &~ 2048); + flags2 = bot_has_main_app ? (flags2 | 8192) : (flags2 &~ 8192); stream.writeInt32(flags2); stream.writeInt64(id); if ((flags & 1) != 0) { @@ -26252,12 +21684,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(bot_info_version); } if ((flags & 262144) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } + Vector.serialize(stream, restriction_reason); } if ((flags & 524288) != 0) { stream.writeString(bot_inline_placeholder); @@ -26269,29 +21696,33 @@ public void serializeToStream(AbstractSerializedData stream) { emoji_status.serializeToStream(stream); } if ((flags2 & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = usernames.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - usernames.get(a).serializeToStream(stream); - } + Vector.serialize(stream, usernames); } if ((flags2 & 32) != 0) { stream.writeInt32(stories_max_id); } - if ((flags2 & 128) != 0) { - stream.writeInt32(color.color); + if ((flags2 & 256) != 0) { + if (color == null) { + color = new TL_peerColor(); + } + color.serializeToStream(stream); } - if ((flags2 & 64) != 0) { - stream.writeInt64(color.background_emoji_id); + if ((flags2 & 512) != 0) { + if (profile_color == null) { + profile_color = new TL_peerColor(); + } + profile_color.serializeToStream(stream); + } + if ((flags2 & 4096) != 0) { + stream.writeInt32(bot_active_users); } } } - public static class TL_user_layer165 extends User { - public static final int constructor = 0xabb5f120; + public static class TL_user_layer185 extends TL_user { + public static final int constructor = 0x4fe9cce0; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); self = (flags & 1024) != 0; contact = (flags & 2048) != 0; @@ -26316,6 +21747,8 @@ public void readParams(AbstractSerializedData stream, boolean exception) { close_friend = (flags2 & 4) != 0; stories_hidden = (flags2 & 8) != 0; stories_unavailable = (flags2 & 16) != 0; + contact_require_premium = (flags2 & 1024) != 0; + bot_business = (flags2 & 2048) != 0; id = stream.readInt64(exception); if ((flags & 1) != 0) { access_hash = stream.readInt64(exception); @@ -26342,21 +21775,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot_info_version = stream.readInt32(exception); } if ((flags & 262144) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } if ((flags & 524288) != 0) { bot_inline_placeholder = stream.readString(exception); @@ -26368,21 +21787,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { emoji_status = EmojiStatus.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_username object = TL_username.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - usernames.add(object); - } + usernames = Vector.deserialize(stream, TL_username::TLdeserialize, exception); } try { if ((flags2 & 32) != 0) { @@ -26391,9 +21796,18 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } catch (Throwable e) { FileLog.e(e); } + if ((flags2 & 256) != 0) { + color = TL_peerColor.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags2 & 512) != 0) { + profile_color = TL_peerColor.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags2 & 4096) != 0) { + bot_active_users = stream.readInt32(exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { if (username == null) { flags = flags & ~8; } @@ -26421,6 +21835,8 @@ public void serializeToStream(AbstractSerializedData stream) { flags2 = close_friend ? (flags2 | 4) : (flags2 &~ 4); flags2 = stories_hidden ? (flags2 | 8) : (flags2 &~ 8); flags2 = stories_unavailable ? (flags2 | 16) : (flags2 &~ 16); + flags2 = contact_require_premium ? (flags2 | 1024) : (flags2 &~ 1024); + flags2 = bot_business ? (flags2 | 2048) : (flags2 &~ 2048); stream.writeInt32(flags2); stream.writeInt64(id); if ((flags & 1) != 0) { @@ -26448,12 +21864,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(bot_info_version); } if ((flags & 262144) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } + Vector.serialize(stream, restriction_reason); } if ((flags & 524288) != 0) { stream.writeString(bot_inline_placeholder); @@ -26465,23 +21876,33 @@ public void serializeToStream(AbstractSerializedData stream) { emoji_status.serializeToStream(stream); } if ((flags2 & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = usernames.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - usernames.get(a).serializeToStream(stream); - } + Vector.serialize(stream, usernames); } if ((flags2 & 32) != 0) { stream.writeInt32(stories_max_id); } + if ((flags2 & 256) != 0) { + if (color == null) { + color = new TL_peerColor(); + } + color.serializeToStream(stream); + } + if ((flags2 & 512) != 0) { + if (profile_color == null) { + profile_color = new TL_peerColor(); + } + profile_color.serializeToStream(stream); + } + if ((flags2 & 4096) != 0) { + stream.writeInt32(bot_active_users); + } } } - public static class TL_user_layer159 extends User { - public static final int constructor = 0x8f97c628; + public static class TL_user_layer184 extends TL_user { + public static final int constructor = 0x215c4438; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); self = (flags & 1024) != 0; contact = (flags & 2048) != 0; @@ -26504,7 +21925,10 @@ public void readParams(AbstractSerializedData stream, boolean exception) { flags2 = stream.readInt32(exception); bot_can_edit = (flags2 & 2) != 0; close_friend = (flags2 & 4) != 0; - stories_hidden = (flags2 & 32) != 0; + stories_hidden = (flags2 & 8) != 0; + stories_unavailable = (flags2 & 16) != 0; + contact_require_premium = (flags2 & 1024) != 0; + bot_business = (flags2 & 2048) != 0; id = stream.readInt64(exception); if ((flags & 1) != 0) { access_hash = stream.readInt64(exception); @@ -26531,21 +21955,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot_info_version = stream.readInt32(exception); } if ((flags & 262144) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } if ((flags & 524288) != 0) { bot_inline_placeholder = stream.readString(exception); @@ -26557,25 +21967,24 @@ public void readParams(AbstractSerializedData stream, boolean exception) { emoji_status = EmojiStatus.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_username object = TL_username.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - usernames.add(object); + usernames = Vector.deserialize(stream, TL_username::TLdeserialize, exception); + } + try { + if ((flags2 & 32) != 0) { + stories_max_id = stream.readInt32(exception); } + } catch (Throwable e) { + FileLog.e(e); + } + if ((flags2 & 256) != 0) { + color = TL_peerColor.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags2 & 512) != 0) { + profile_color = TL_peerColor.TLdeserialize(stream, stream.readInt32(exception), exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { if (username == null) { flags = flags & ~8; } @@ -26598,10 +22007,13 @@ public void serializeToStream(AbstractSerializedData stream) { flags = bot_attach_menu ? (flags | 134217728) : (flags &~ 134217728); flags = premium ? (flags | 268435456) : (flags &~ 268435456); flags = attach_menu_enabled ? (flags | 536870912) : (flags &~ 536870912); + stream.writeInt32(flags); flags2 = bot_can_edit ? (flags2 | 2) : (flags2 &~ 2); flags2 = close_friend ? (flags2 | 4) : (flags2 &~ 4); - flags2 = stories_hidden ? (flags2 | 32) : (flags2 &~ 32); - stream.writeInt32(flags); + flags2 = stories_hidden ? (flags2 | 8) : (flags2 &~ 8); + flags2 = stories_unavailable ? (flags2 | 16) : (flags2 &~ 16); + flags2 = contact_require_premium ? (flags2 | 1024) : (flags2 &~ 1024); + flags2 = bot_business ? (flags2 | 2048) : (flags2 &~ 2048); stream.writeInt32(flags2); stream.writeInt64(id); if ((flags & 1) != 0) { @@ -26629,12 +22041,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(bot_info_version); } if ((flags & 262144) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } + Vector.serialize(stream, restriction_reason); } if ((flags & 524288) != 0) { stream.writeString(bot_inline_placeholder); @@ -26646,20 +22053,30 @@ public void serializeToStream(AbstractSerializedData stream) { emoji_status.serializeToStream(stream); } if ((flags2 & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = usernames.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - usernames.get(a).serializeToStream(stream); + Vector.serialize(stream, usernames); + } + if ((flags2 & 32) != 0) { + stream.writeInt32(stories_max_id); + } + if ((flags2 & 256) != 0) { + if (color == null) { + color = new TL_peerColor(); } + color.serializeToStream(stream); + } + if ((flags2 & 512) != 0) { + if (profile_color == null) { + profile_color = new TL_peerColor(); + } + profile_color.serializeToStream(stream); } } } - public static class TL_user_layer147 extends User { - public static final int constructor = 0x5d99adee; + public static class TL_user_layer166 extends TL_user { + public static final int constructor = 0xeb602f25; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); self = (flags & 1024) != 0; contact = (flags & 2048) != 0; @@ -26679,6 +22096,11 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot_attach_menu = (flags & 134217728) != 0; premium = (flags & 268435456) != 0; attach_menu_enabled = (flags & 536870912) != 0; + flags2 = stream.readInt32(exception); + bot_can_edit = (flags2 & 2) != 0; + close_friend = (flags2 & 4) != 0; + stories_hidden = (flags2 & 8) != 0; + stories_unavailable = (flags2 & 16) != 0; id = stream.readInt64(exception); if ((flags & 1) != 0) { access_hash = stream.readInt64(exception); @@ -26705,21 +22127,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot_info_version = stream.readInt32(exception); } if ((flags & 262144) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } if ((flags & 524288) != 0) { bot_inline_placeholder = stream.readString(exception); @@ -26730,9 +22138,32 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 1073741824) != 0) { emoji_status = EmojiStatus.TLdeserialize(stream, stream.readInt32(exception), exception); } + if ((flags2 & 1) != 0) { + usernames = Vector.deserialize(stream, TL_username::TLdeserialize, exception); + } + try { + if ((flags2 & 32) != 0) { + stories_max_id = stream.readInt32(exception); + } + } catch (Throwable e) { + FileLog.e(e); + } + if ((flags2 & 128) != 0) { + color = new TL_peerColor(); + color.color = stream.readInt32(exception); + } + if ((flags2 & 64) != 0) { + if (color == null) { + color = new TL_peerColor(); + } + color.background_emoji_id = stream.readInt64(exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { + if (username == null) { + flags = flags & ~8; + } stream.writeInt32(constructor); flags = self ? (flags | 1024) : (flags &~ 1024); flags = contact ? (flags | 2048) : (flags &~ 2048); @@ -26753,6 +22184,11 @@ public void serializeToStream(AbstractSerializedData stream) { flags = premium ? (flags | 268435456) : (flags &~ 268435456); flags = attach_menu_enabled ? (flags | 536870912) : (flags &~ 536870912); stream.writeInt32(flags); + flags2 = bot_can_edit ? (flags2 | 2) : (flags2 &~ 2); + flags2 = close_friend ? (flags2 | 4) : (flags2 &~ 4); + flags2 = stories_hidden ? (flags2 | 8) : (flags2 &~ 8); + flags2 = stories_unavailable ? (flags2 | 16) : (flags2 &~ 16); + stream.writeInt32(flags2); stream.writeInt64(id); if ((flags & 1) != 0) { stream.writeInt64(access_hash); @@ -26779,12 +22215,434 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(bot_info_version); } if ((flags & 262144) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); + Vector.serialize(stream, restriction_reason); + } + if ((flags & 524288) != 0) { + stream.writeString(bot_inline_placeholder); + } + if ((flags & 4194304) != 0) { + stream.writeString(lang_code); + } + if ((flags & 1073741824) != 0) { + emoji_status.serializeToStream(stream); + } + if ((flags2 & 1) != 0) { + Vector.serialize(stream, usernames); + } + if ((flags2 & 32) != 0) { + stream.writeInt32(stories_max_id); + } + if ((flags2 & 128) != 0) { + stream.writeInt32(color.color); + } + if ((flags2 & 64) != 0) { + stream.writeInt64(color.background_emoji_id); + } + } + } + + public static class TL_user_layer165 extends User { + public static final int constructor = 0xabb5f120; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + self = (flags & 1024) != 0; + contact = (flags & 2048) != 0; + mutual_contact = (flags & 4096) != 0; + deleted = (flags & 8192) != 0; + bot = (flags & 16384) != 0; + bot_chat_history = (flags & 32768) != 0; + bot_nochats = (flags & 65536) != 0; + verified = (flags & 131072) != 0; + restricted = (flags & 262144) != 0; + min = (flags & 1048576) != 0; + bot_inline_geo = (flags & 2097152) != 0; + support = (flags & 8388608) != 0; + scam = (flags & 16777216) != 0; + apply_min_photo = (flags & 33554432) != 0; + fake = (flags & 67108864) != 0; + bot_attach_menu = (flags & 134217728) != 0; + premium = (flags & 268435456) != 0; + attach_menu_enabled = (flags & 536870912) != 0; + flags2 = stream.readInt32(exception); + bot_can_edit = (flags2 & 2) != 0; + close_friend = (flags2 & 4) != 0; + stories_hidden = (flags2 & 8) != 0; + stories_unavailable = (flags2 & 16) != 0; + id = stream.readInt64(exception); + if ((flags & 1) != 0) { + access_hash = stream.readInt64(exception); + } + if ((flags & 2) != 0) { + first_name = stream.readString(exception); + } + if ((flags & 4) != 0) { + last_name = stream.readString(exception); + } + if ((flags & 8) != 0) { + username = stream.readString(exception); + } + if ((flags & 16) != 0) { + phone = stream.readString(exception); + } + if ((flags & 32) != 0) { + photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 64) != 0) { + status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 16384) != 0) { + bot_info_version = stream.readInt32(exception); + } + if ((flags & 262144) != 0) { + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); + } + if ((flags & 524288) != 0) { + bot_inline_placeholder = stream.readString(exception); + } + if ((flags & 4194304) != 0) { + lang_code = stream.readString(exception); + } + if ((flags & 1073741824) != 0) { + emoji_status = EmojiStatus.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags2 & 1) != 0) { + usernames = Vector.deserialize(stream, TL_username::TLdeserialize, exception); + } + try { + if ((flags2 & 32) != 0) { + stories_max_id = stream.readInt32(exception); } + } catch (Throwable e) { + FileLog.e(e); + } + } + + public void serializeToStream(OutputSerializedData stream) { + if (username == null) { + flags = flags & ~8; + } + stream.writeInt32(constructor); + flags = self ? (flags | 1024) : (flags &~ 1024); + flags = contact ? (flags | 2048) : (flags &~ 2048); + flags = mutual_contact ? (flags | 4096) : (flags &~ 4096); + flags = deleted ? (flags | 8192) : (flags &~ 8192); + flags = bot ? (flags | 16384) : (flags &~ 16384); + flags = bot_chat_history ? (flags | 32768) : (flags &~ 32768); + flags = bot_nochats ? (flags | 65536) : (flags &~ 65536); + flags = verified ? (flags | 131072) : (flags &~ 131072); + flags = restricted ? (flags | 262144) : (flags &~ 262144); + flags = min ? (flags | 1048576) : (flags &~ 1048576); + flags = bot_inline_geo ? (flags | 2097152) : (flags &~ 2097152); + flags = support ? (flags | 8388608) : (flags &~ 8388608); + flags = scam ? (flags | 16777216) : (flags &~ 16777216); + flags = apply_min_photo ? (flags | 33554432) : (flags &~ 33554432); + flags = fake ? (flags | 67108864) : (flags &~ 67108864); + flags = bot_attach_menu ? (flags | 134217728) : (flags &~ 134217728); + flags = premium ? (flags | 268435456) : (flags &~ 268435456); + flags = attach_menu_enabled ? (flags | 536870912) : (flags &~ 536870912); + stream.writeInt32(flags); + flags2 = bot_can_edit ? (flags2 | 2) : (flags2 &~ 2); + flags2 = close_friend ? (flags2 | 4) : (flags2 &~ 4); + flags2 = stories_hidden ? (flags2 | 8) : (flags2 &~ 8); + flags2 = stories_unavailable ? (flags2 | 16) : (flags2 &~ 16); + stream.writeInt32(flags2); + stream.writeInt64(id); + if ((flags & 1) != 0) { + stream.writeInt64(access_hash); + } + if ((flags & 2) != 0) { + stream.writeString(first_name); + } + if ((flags & 4) != 0) { + stream.writeString(last_name); + } + if ((flags & 8) != 0) { + stream.writeString(username); + } + if ((flags & 16) != 0) { + stream.writeString(phone); + } + if ((flags & 32) != 0) { + photo.serializeToStream(stream); + } + if ((flags & 64) != 0) { + status.serializeToStream(stream); + } + if ((flags & 16384) != 0) { + stream.writeInt32(bot_info_version); + } + if ((flags & 262144) != 0) { + Vector.serialize(stream, restriction_reason); + } + if ((flags & 524288) != 0) { + stream.writeString(bot_inline_placeholder); + } + if ((flags & 4194304) != 0) { + stream.writeString(lang_code); + } + if ((flags & 1073741824) != 0) { + emoji_status.serializeToStream(stream); + } + if ((flags2 & 1) != 0) { + Vector.serialize(stream, usernames); + } + if ((flags2 & 32) != 0) { + stream.writeInt32(stories_max_id); + } + } + } + + public static class TL_user_layer159 extends User { + public static final int constructor = 0x8f97c628; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + self = (flags & 1024) != 0; + contact = (flags & 2048) != 0; + mutual_contact = (flags & 4096) != 0; + deleted = (flags & 8192) != 0; + bot = (flags & 16384) != 0; + bot_chat_history = (flags & 32768) != 0; + bot_nochats = (flags & 65536) != 0; + verified = (flags & 131072) != 0; + restricted = (flags & 262144) != 0; + min = (flags & 1048576) != 0; + bot_inline_geo = (flags & 2097152) != 0; + support = (flags & 8388608) != 0; + scam = (flags & 16777216) != 0; + apply_min_photo = (flags & 33554432) != 0; + fake = (flags & 67108864) != 0; + bot_attach_menu = (flags & 134217728) != 0; + premium = (flags & 268435456) != 0; + attach_menu_enabled = (flags & 536870912) != 0; + flags2 = stream.readInt32(exception); + bot_can_edit = (flags2 & 2) != 0; + close_friend = (flags2 & 4) != 0; + stories_hidden = (flags2 & 32) != 0; + id = stream.readInt64(exception); + if ((flags & 1) != 0) { + access_hash = stream.readInt64(exception); + } + if ((flags & 2) != 0) { + first_name = stream.readString(exception); + } + if ((flags & 4) != 0) { + last_name = stream.readString(exception); + } + if ((flags & 8) != 0) { + username = stream.readString(exception); + } + if ((flags & 16) != 0) { + phone = stream.readString(exception); + } + if ((flags & 32) != 0) { + photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 64) != 0) { + status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 16384) != 0) { + bot_info_version = stream.readInt32(exception); + } + if ((flags & 262144) != 0) { + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); + } + if ((flags & 524288) != 0) { + bot_inline_placeholder = stream.readString(exception); + } + if ((flags & 4194304) != 0) { + lang_code = stream.readString(exception); + } + if ((flags & 1073741824) != 0) { + emoji_status = EmojiStatus.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags2 & 1) != 0) { + usernames = Vector.deserialize(stream, TL_username::TLdeserialize, exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + if (username == null) { + flags = flags & ~8; + } + stream.writeInt32(constructor); + flags = self ? (flags | 1024) : (flags &~ 1024); + flags = contact ? (flags | 2048) : (flags &~ 2048); + flags = mutual_contact ? (flags | 4096) : (flags &~ 4096); + flags = deleted ? (flags | 8192) : (flags &~ 8192); + flags = bot ? (flags | 16384) : (flags &~ 16384); + flags = bot_chat_history ? (flags | 32768) : (flags &~ 32768); + flags = bot_nochats ? (flags | 65536) : (flags &~ 65536); + flags = verified ? (flags | 131072) : (flags &~ 131072); + flags = restricted ? (flags | 262144) : (flags &~ 262144); + flags = min ? (flags | 1048576) : (flags &~ 1048576); + flags = bot_inline_geo ? (flags | 2097152) : (flags &~ 2097152); + flags = support ? (flags | 8388608) : (flags &~ 8388608); + flags = scam ? (flags | 16777216) : (flags &~ 16777216); + flags = apply_min_photo ? (flags | 33554432) : (flags &~ 33554432); + flags = fake ? (flags | 67108864) : (flags &~ 67108864); + flags = bot_attach_menu ? (flags | 134217728) : (flags &~ 134217728); + flags = premium ? (flags | 268435456) : (flags &~ 268435456); + flags = attach_menu_enabled ? (flags | 536870912) : (flags &~ 536870912); + flags2 = bot_can_edit ? (flags2 | 2) : (flags2 &~ 2); + flags2 = close_friend ? (flags2 | 4) : (flags2 &~ 4); + flags2 = stories_hidden ? (flags2 | 32) : (flags2 &~ 32); + stream.writeInt32(flags); + stream.writeInt32(flags2); + stream.writeInt64(id); + if ((flags & 1) != 0) { + stream.writeInt64(access_hash); + } + if ((flags & 2) != 0) { + stream.writeString(first_name); + } + if ((flags & 4) != 0) { + stream.writeString(last_name); + } + if ((flags & 8) != 0) { + stream.writeString(username); + } + if ((flags & 16) != 0) { + stream.writeString(phone); + } + if ((flags & 32) != 0) { + photo.serializeToStream(stream); + } + if ((flags & 64) != 0) { + status.serializeToStream(stream); + } + if ((flags & 16384) != 0) { + stream.writeInt32(bot_info_version); + } + if ((flags & 262144) != 0) { + Vector.serialize(stream, restriction_reason); + } + if ((flags & 524288) != 0) { + stream.writeString(bot_inline_placeholder); + } + if ((flags & 4194304) != 0) { + stream.writeString(lang_code); + } + if ((flags & 1073741824) != 0) { + emoji_status.serializeToStream(stream); + } + if ((flags2 & 1) != 0) { + Vector.serialize(stream, usernames); + } + } + } + + public static class TL_user_layer147 extends User { + public static final int constructor = 0x5d99adee; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + self = (flags & 1024) != 0; + contact = (flags & 2048) != 0; + mutual_contact = (flags & 4096) != 0; + deleted = (flags & 8192) != 0; + bot = (flags & 16384) != 0; + bot_chat_history = (flags & 32768) != 0; + bot_nochats = (flags & 65536) != 0; + verified = (flags & 131072) != 0; + restricted = (flags & 262144) != 0; + min = (flags & 1048576) != 0; + bot_inline_geo = (flags & 2097152) != 0; + support = (flags & 8388608) != 0; + scam = (flags & 16777216) != 0; + apply_min_photo = (flags & 33554432) != 0; + fake = (flags & 67108864) != 0; + bot_attach_menu = (flags & 134217728) != 0; + premium = (flags & 268435456) != 0; + attach_menu_enabled = (flags & 536870912) != 0; + id = stream.readInt64(exception); + if ((flags & 1) != 0) { + access_hash = stream.readInt64(exception); + } + if ((flags & 2) != 0) { + first_name = stream.readString(exception); + } + if ((flags & 4) != 0) { + last_name = stream.readString(exception); + } + if ((flags & 8) != 0) { + username = stream.readString(exception); + } + if ((flags & 16) != 0) { + phone = stream.readString(exception); + } + if ((flags & 32) != 0) { + photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 64) != 0) { + status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 16384) != 0) { + bot_info_version = stream.readInt32(exception); + } + if ((flags & 262144) != 0) { + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); + } + if ((flags & 524288) != 0) { + bot_inline_placeholder = stream.readString(exception); + } + if ((flags & 4194304) != 0) { + lang_code = stream.readString(exception); + } + if ((flags & 1073741824) != 0) { + emoji_status = EmojiStatus.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = self ? (flags | 1024) : (flags &~ 1024); + flags = contact ? (flags | 2048) : (flags &~ 2048); + flags = mutual_contact ? (flags | 4096) : (flags &~ 4096); + flags = deleted ? (flags | 8192) : (flags &~ 8192); + flags = bot ? (flags | 16384) : (flags &~ 16384); + flags = bot_chat_history ? (flags | 32768) : (flags &~ 32768); + flags = bot_nochats ? (flags | 65536) : (flags &~ 65536); + flags = verified ? (flags | 131072) : (flags &~ 131072); + flags = restricted ? (flags | 262144) : (flags &~ 262144); + flags = min ? (flags | 1048576) : (flags &~ 1048576); + flags = bot_inline_geo ? (flags | 2097152) : (flags &~ 2097152); + flags = support ? (flags | 8388608) : (flags &~ 8388608); + flags = scam ? (flags | 16777216) : (flags &~ 16777216); + flags = apply_min_photo ? (flags | 33554432) : (flags &~ 33554432); + flags = fake ? (flags | 67108864) : (flags &~ 67108864); + flags = bot_attach_menu ? (flags | 134217728) : (flags &~ 134217728); + flags = premium ? (flags | 268435456) : (flags &~ 268435456); + flags = attach_menu_enabled ? (flags | 536870912) : (flags &~ 536870912); + stream.writeInt32(flags); + stream.writeInt64(id); + if ((flags & 1) != 0) { + stream.writeInt64(access_hash); + } + if ((flags & 2) != 0) { + stream.writeString(first_name); + } + if ((flags & 4) != 0) { + stream.writeString(last_name); + } + if ((flags & 8) != 0) { + stream.writeString(username); + } + if ((flags & 16) != 0) { + stream.writeString(phone); + } + if ((flags & 32) != 0) { + photo.serializeToStream(stream); + } + if ((flags & 64) != 0) { + status.serializeToStream(stream); + } + if ((flags & 16384) != 0) { + stream.writeInt32(bot_info_version); + } + if ((flags & 262144) != 0) { + Vector.serialize(stream, restriction_reason); } if ((flags & 524288) != 0) { stream.writeString(bot_inline_placeholder); @@ -26801,7 +22659,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_user_layer144 extends User { public static final int constructor = 0x3ff6ecb0; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); self = (flags & 1024) != 0; contact = (flags & 2048) != 0; @@ -26846,21 +22704,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot_info_version = stream.readInt32(exception); } if ((flags & 262144) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } if ((flags & 524288) != 0) { bot_inline_placeholder = stream.readString(exception); @@ -26870,7 +22714,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = self ? (flags | 1024) : (flags &~ 1024); flags = contact ? (flags | 2048) : (flags &~ 2048); @@ -26916,12 +22760,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(bot_info_version); } if ((flags & 262144) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } + Vector.serialize(stream, restriction_reason); } if ((flags & 524288) != 0) { stream.writeString(bot_inline_placeholder); @@ -26935,8 +22774,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_user_layer131 extends TL_user { public static final int constructor = 0x938458c1; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); self = (flags & 1024) != 0; contact = (flags & 2048) != 0; @@ -26979,21 +22817,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot_info_version = stream.readInt32(exception); } if ((flags & 262144) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } if ((flags & 524288) != 0) { bot_inline_placeholder = stream.readString(exception); @@ -27003,7 +22827,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = self ? (flags | 1024) : (flags &~ 1024); flags = contact ? (flags | 2048) : (flags &~ 2048); @@ -27047,12 +22871,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(bot_info_version); } if ((flags & 262144) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } + Vector.serialize(stream, restriction_reason); } if ((flags & 524288) != 0) { stream.writeString(bot_inline_placeholder); @@ -27066,8 +22885,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_user_layer104 extends TL_user { public static final int constructor = 0x2e13f4c3; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); self = (flags & 1024) != 0; contact = (flags & 2048) != 0; @@ -27118,7 +22936,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = self ? (flags | 1024) : (flags &~ 1024); flags = contact ? (flags | 2048) : (flags &~ 2048); @@ -27174,8 +22992,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userSelf_old extends TL_userSelf_old3 { public static final int constructor = 0x720535ec; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); first_name = stream.readString(exception); last_name = stream.readString(exception); @@ -27185,7 +23002,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { inactive = stream.readBool(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) id); stream.writeString(first_name); @@ -27200,8 +23017,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userSelf_old3 extends User { public static final int constructor = 0x1c60e608; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); first_name = stream.readString(exception); last_name = stream.readString(exception); @@ -27211,7 +23027,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) id); stream.writeString(first_name); @@ -27226,15 +23042,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userDeleted_old2 extends User { public static final int constructor = 0xd6016d7a; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); first_name = stream.readString(exception); last_name = stream.readString(exception); username = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) id); stream.writeString(first_name); @@ -27246,12 +23061,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userEmpty_layer131 extends TL_userEmpty { public static final int constructor = 0x200250ba; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) id); } @@ -27260,8 +23074,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userRequest_old extends TL_userRequest_old2 { public static final int constructor = 0x22e8ceb0; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); first_name = stream.readString(exception); last_name = stream.readString(exception); @@ -27271,7 +23084,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) id); stream.writeString(first_name); @@ -27286,8 +23099,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userForeign_old extends TL_userForeign_old2 { public static final int constructor = 0x5214c89d; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); first_name = stream.readString(exception); last_name = stream.readString(exception); @@ -27296,7 +23108,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) id); stream.writeString(first_name); @@ -27310,8 +23122,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userForeign_old2 extends User { public static final int constructor = 0x75cf7a8; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); first_name = stream.readString(exception); last_name = stream.readString(exception); @@ -27321,7 +23132,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) id); stream.writeString(first_name); @@ -27336,8 +23147,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userRequest_old2 extends User { public static final int constructor = 0xd9ccc4ef; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); first_name = stream.readString(exception); last_name = stream.readString(exception); @@ -27348,7 +23158,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) id); stream.writeString(first_name); @@ -27364,14 +23174,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userDeleted_old extends TL_userDeleted_old2 { public static final int constructor = 0xb29ad7cc; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); first_name = stream.readString(exception); last_name = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) id); stream.writeString(first_name); @@ -27382,8 +23191,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_user_layer65 extends TL_user { public static final int constructor = 0xd10d979a; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); self = (flags & 1024) != 0; contact = (flags & 2048) != 0; @@ -27429,7 +23237,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = self ? (flags | 1024) : (flags &~ 1024); flags = contact ? (flags | 2048) : (flags &~ 2048); @@ -27480,8 +23288,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_user_old extends TL_user { public static final int constructor = 0x22e49072; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); self = (flags & 1024) != 0; contact = (flags & 2048) != 0; @@ -27519,7 +23326,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = self ? (flags | 1024) : (flags &~ 1024); flags = contact ? (flags | 2048) : (flags &~ 2048); @@ -27562,8 +23369,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userSelf_old2 extends TL_userSelf_old3 { public static final int constructor = 0x7007b451; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); first_name = stream.readString(exception); last_name = stream.readString(exception); @@ -27574,7 +23380,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { inactive = stream.readBool(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) id); stream.writeString(first_name); @@ -27587,37 +23393,6 @@ public void serializeToStream(AbstractSerializedData stream) { } } - public static class TL_phone_groupCallStreamRtmpUrl extends TLObject { - public static final int constructor = 0x2dbf3432; - - public String url; - public String key; - - public static TL_phone_groupCallStreamRtmpUrl TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_phone_groupCallStreamRtmpUrl.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_phone_groupCallStreamRtmpUrl", constructor)); - } else { - return null; - } - } - TL_phone_groupCallStreamRtmpUrl result = new TL_phone_groupCallStreamRtmpUrl(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - url = stream.readString(exception); - key = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(url); - stream.writeString(key); - } - } - public static abstract class RecentMeUrl extends TLObject { public long chat_id; @@ -27626,7 +23401,7 @@ public static abstract class RecentMeUrl extends TLObject { public long user_id; public StickerSetCovered set; - public static RecentMeUrl TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static RecentMeUrl TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { RecentMeUrl result = null; switch (constructor) { case 0xb2da71d2: @@ -27658,13 +23433,12 @@ public static RecentMeUrl TLdeserialize(AbstractSerializedData stream, int const public static class TL_recentMeUrlChat extends RecentMeUrl { public static final int constructor = 0xb2da71d2; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); chat_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); stream.writeInt64(chat_id); @@ -27674,13 +23448,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_recentMeUrlStickerSet extends RecentMeUrl { public static final int constructor = 0xbc0a57dc; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); set = StickerSetCovered.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); set.serializeToStream(stream); @@ -27690,12 +23463,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_recentMeUrlUnknown extends RecentMeUrl { public static final int constructor = 0x46e1d13d; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); } @@ -27704,13 +23476,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_recentMeUrlChatInvite extends RecentMeUrl { public static final int constructor = 0xeb49081d; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); chat_invite = ChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); chat_invite.serializeToStream(stream); @@ -27720,13 +23491,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_recentMeUrlUser extends RecentMeUrl { public static final int constructor = 0xb92c09e2; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); user_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); stream.writeInt64(user_id); @@ -27739,7 +23509,7 @@ public static class TL_payments_bankCardData extends TLObject { public String title; public ArrayList open_urls = new ArrayList<>(); - public static TL_payments_bankCardData TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_payments_bankCardData TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_payments_bankCardData.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_payments_bankCardData", constructor)); @@ -27752,34 +23522,15 @@ public static TL_payments_bankCardData TLdeserialize(AbstractSerializedData stre return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { title = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_bankCardOpenUrl object = TL_bankCardOpenUrl.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - open_urls.add(object); - } + open_urls = Vector.deserialize(stream, TL_bankCardOpenUrl::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(title); - stream.writeInt32(0x1cb5c415); - int count = open_urls.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - open_urls.get(a).serializeToStream(stream); - } + Vector.serialize(stream, open_urls); } } @@ -27789,7 +23540,7 @@ public static class TL_messages_highScores extends TLObject { public ArrayList scores = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_messages_highScores TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_highScores TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_highScores.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_highScores", constructor)); @@ -27802,103 +23553,15 @@ public static TL_messages_highScores TLdeserialize(AbstractSerializedData stream return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_highScore object = TL_highScore.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - scores.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = scores.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - scores.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } - - public static class TL_phone_phoneCall extends TLObject { - public static final int constructor = 0xec82e140; - - public PhoneCall phone_call; - public ArrayList users = new ArrayList<>(); - - public static TL_phone_phoneCall TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_phone_phoneCall.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_phone_phoneCall", constructor)); - } else { - return null; - } - } - TL_phone_phoneCall result = new TL_phone_phoneCall(); - result.readParams(stream, exception); - return result; + public void readParams(InputSerializedData stream, boolean exception) { + scores = Vector.deserialize(stream, TL_highScore::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void readParams(AbstractSerializedData stream, boolean exception) { - phone_call = PhoneCall.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - phone_call.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, scores); + Vector.serialize(stream, users); } } @@ -27906,7 +23569,7 @@ public static abstract class ChannelParticipantsFilter extends TLObject { public String q; - public static ChannelParticipantsFilter TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static ChannelParticipantsFilter TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { ChannelParticipantsFilter result = null; switch (constructor) { case 0xe04b5ceb: @@ -27950,7 +23613,7 @@ public static class TL_channelParticipantsMentions extends ChannelParticipantsFi public int flags; public int top_msg_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { q = stream.readString(exception); @@ -27960,7 +23623,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -27975,12 +23638,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantsContacts extends ChannelParticipantsFilter { public static final int constructor = 0xbb6ae88d; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { q = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(q); } @@ -27989,8 +23651,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantsAdmins extends ChannelParticipantsFilter { public static final int constructor = 0xb4608969; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -27998,12 +23659,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantsKicked extends ChannelParticipantsFilter { public static final int constructor = 0xa3b54985; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { q = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(q); } @@ -28012,12 +23672,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantsSearch extends ChannelParticipantsFilter { public static final int constructor = 0x656ac4b; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { q = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(q); } @@ -28026,8 +23685,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantsBots extends ChannelParticipantsFilter { public static final int constructor = 0xb0d1865b; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -28035,12 +23693,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantsBanned extends ChannelParticipantsFilter { public static final int constructor = 0x1427a5e1; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { q = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(q); } @@ -28049,8 +23706,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantsRecent extends ChannelParticipantsFilter { public static final int constructor = 0xde3f3c79; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -28090,7 +23746,7 @@ public static abstract class MessageAction extends TLObject { public byte[] payload; public int subscription_until_date; - public static MessageAction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static MessageAction TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { MessageAction result = null; switch (constructor) { case 0x555555F5: @@ -28318,9 +23974,21 @@ public static MessageAction TLdeserialize(AbstractSerializedData stream, int con case TL_messageActionStarGift.constructor: result = new TL_messageActionStarGift(); break; + case TL_messageActionStarGift_layer197.constructor: + result = new TL_messageActionStarGift_layer197(); + break; + case TL_messageActionStarGift_layer195.constructor: + result = new TL_messageActionStarGift_layer195(); + break; case TL_messageActionStarGift_layer192.constructor: result = new TL_messageActionStarGift_layer192(); break; + case TL_messageActionStarGiftUnique_layer197.constructor: + result = new TL_messageActionStarGiftUnique(); + break; + case TL_messageActionStarGiftUnique.constructor: + result = new TL_messageActionStarGiftUnique(); + break; } if (result == null && exception) { throw new RuntimeException(String.format("can't parse magic %x in MessageAction", constructor)); @@ -28335,13 +24003,12 @@ public static MessageAction TLdeserialize(AbstractSerializedData stream, int con public static class TL_messageActionLoginUnknownLocation extends MessageAction { public static final int constructor = 0x555555F5; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { title = stream.readString(exception); address = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(title); stream.writeString(address); @@ -28353,7 +24020,7 @@ public static class TL_messageActionPaymentRefunded extends MessageAction { public TL_paymentCharge charge; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); currency = stream.readString(exception); @@ -28364,7 +24031,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { charge = TL_paymentCharge.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); peer.serializeToStream(stream); @@ -28384,7 +24051,7 @@ public static class TL_messageActionGiftStars extends MessageAction { public TL_paymentCharge charge; public String transaction_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); currency = stream.readString(exception); amount = stream.readInt64(exception); @@ -28398,7 +24065,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(currency); @@ -28417,12 +24084,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageEncryptedAction extends MessageAction { public static final int constructor = 0x555555F7; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { encryptedAction = DecryptedMessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); encryptedAction.serializeToStream(stream); } @@ -28431,12 +24097,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionCustomAction extends MessageAction { public static final int constructor = 0xfae69f56; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { message = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(message); } @@ -28445,39 +24110,22 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionChatCreate extends MessageAction { public static final int constructor = 0xbd47cbad; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { title = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - users.add(stream.readInt64(exception)); - } + users = Vector.deserializeLong(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(title); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(users.get(a)); - } + Vector.serializeLong(stream, users); } } public static class TL_messageActionChatCreate_layer131 extends TL_messageActionChatCreate { public static final int constructor = 0xa6638b9a; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { title = stream.readString(exception); int magic = stream.readInt32(exception); if (magic != 0x1cb5c415) { @@ -28492,7 +24140,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(title); stream.writeInt32(0x1cb5c415); @@ -28507,44 +24155,27 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionInviteToGroupCall extends MessageAction { public static final int constructor = 0x502f92f7; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { call = TL_inputGroupCall.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - users.add(stream.readInt64(exception)); - } + users = Vector.deserializeLong(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); call.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(users.get(a)); - } + Vector.serializeLong(stream, users); } } public static class TL_messageActionChannelMigrateFrom extends MessageAction { public static final int constructor = 0xea3948e9; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { title = stream.readString(exception); chat_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(title); stream.writeInt64(chat_id); @@ -28554,8 +24185,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionGroupCall extends MessageAction { public static final int constructor = 0x7a0d7f42; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); call = TL_inputGroupCall.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 1) != 0) { @@ -28563,7 +24193,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); call.serializeToStream(stream); @@ -28578,11 +24208,11 @@ public static class TL_messageActionSetChatTheme extends MessageAction { public String emoticon; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { emoticon = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(emoticon); } @@ -28594,19 +24224,14 @@ public static class TL_messages_getExtendedMedia extends TLObject { public InputPeer peer; public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } + Vector.serializeInt(stream, id); } } @@ -28616,20 +24241,11 @@ public static class TL_messages_getMessageReadParticipants extends TLObject { public InputPeer peer; public int msg_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_readParticipantDate object = TL_readParticipantDate.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, TL_readParticipantDate::TLdeserialize); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(msg_id); @@ -28639,12 +24255,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionChatDeleteUser extends MessageAction { public static final int constructor = 0xa43f30cc; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); } @@ -28653,41 +24268,24 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionChatAddUser extends MessageAction { public static final int constructor = 0x15cefd00; - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - users.add(stream.readInt64(exception)); - } + public void readParams(InputSerializedData stream, boolean exception) { + users = Vector.deserializeLong(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(users.get(a)); - } + Vector.serializeLong(stream, users); } } public static class TL_messageActionChatMigrateTo_layer131 extends TL_messageActionChatMigrateTo { public static final int constructor = 0x51bdb021; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { channel_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) channel_id); } @@ -28696,8 +24294,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionHistoryClear extends MessageAction { public static final int constructor = 0x9fbab604; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -28705,12 +24302,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionChatEditPhoto extends MessageAction { public static final int constructor = 0x7fcb13a8; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); photo.serializeToStream(stream); } @@ -28719,8 +24315,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionScreenshotTaken extends MessageAction { public static final int constructor = 0x4792929b; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -28728,8 +24323,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionPhoneNumberRequest extends MessageAction { public static final int constructor = 0x1baa035; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -28737,11 +24331,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionSetSameChatWallPaper extends MessageAction { public static final int constructor = 0xc0787d6d; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { wallpaper = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); wallpaper.serializeToStream(stream); } @@ -28754,7 +24348,7 @@ public static class TL_messageActionTopicEdit extends MessageAction { public boolean closed; public boolean hidden; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { title = stream.readString(exception); @@ -28770,7 +24364,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -28791,7 +24385,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionTopicEdit_layer149 extends TL_messageActionTopicEdit { public static final int constructor = 0xb18a431c; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { title = stream.readString(exception); @@ -28804,7 +24398,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -28822,8 +24416,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionChatJoinedByRequest extends MessageAction { public static final int constructor = 0xebbca3cb; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -28831,12 +24424,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionChatMigrateTo extends MessageAction { public static final int constructor = 0xe1037f92; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { channel_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(channel_id); } @@ -28845,12 +24437,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionChatJoinedByLink extends MessageAction { public static final int constructor = 0x31224c3; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { inviter_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(inviter_id); } @@ -28859,13 +24450,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionChannelMigrateFrom_layer131 extends TL_messageActionChannelMigrateFrom { public static final int constructor = 0xb055eaee; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { title = stream.readString(exception); chat_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(title); stream.writeInt32((int) chat_id); @@ -28875,8 +24465,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionChatAddUser_layer131 extends TL_messageActionChatAddUser { public static final int constructor = 0x488a7337; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { int magic = stream.readInt32(exception); if (magic != 0x1cb5c415) { if (exception) { @@ -28890,7 +24479,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(0x1cb5c415); int count = users.size(); @@ -28904,12 +24493,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionChatDeleteUser_layer131 extends TL_messageActionChatDeleteUser { public static final int constructor = 0xb2ae9b0c; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) user_id); } @@ -28918,8 +24506,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionCreatedBroadcastList extends MessageAction { public static final int constructor = 0x55555557; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -28927,8 +24514,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionInviteToGroupCall_layer131 extends TL_messageActionInviteToGroupCall { public static final int constructor = 0x76b9f11a; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { call = TL_inputGroupCall.TLdeserialize(stream, stream.readInt32(exception), exception); int magic = stream.readInt32(exception); if (magic != 0x1cb5c415) { @@ -28943,7 +24529,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); call.serializeToStream(stream); stream.writeInt32(0x1cb5c415); @@ -28961,12 +24547,12 @@ public static class TL_messageActionWebViewDataSentMe extends MessageAction { public String text; public String data; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = stream.readString(exception); data = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(text); stream.writeString(data); @@ -28978,11 +24564,11 @@ public static class TL_messageActionWebViewDataSent extends MessageAction { public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(text); } @@ -28991,11 +24577,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionSetChatWallPaper_layer166 extends TL_messageActionSetChatWallPaper { public static final int constructor = 0xbc44a927; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { wallpaper = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); wallpaper.serializeToStream(stream); } @@ -29007,14 +24593,14 @@ public static class TL_messageActionSetChatWallPaper extends MessageAction { public boolean same; public boolean for_both; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); same = (flags & 1) != 0; for_both = (flags & 2) != 0; wallpaper = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = same ? (flags | 1) : (flags &~ 1); flags = for_both ? (flags | 2) : (flags &~ 2); @@ -29026,8 +24612,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionUserJoined extends MessageAction { public static final int constructor = 0x55555550; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -29035,12 +24620,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionUserUpdatedPhoto extends MessageAction { public static final int constructor = 0x55555551; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { newUserPhoto = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); newUserPhoto.serializeToStream(stream); } @@ -29049,8 +24633,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionContactSignUp extends MessageAction { public static final int constructor = 0xf3f25f76; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -29058,12 +24641,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionChatAddUser_old extends TL_messageActionChatAddUser { public static final int constructor = 0x5e3cfc4b; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) user_id); } @@ -29072,12 +24654,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionTTLChange extends MessageAction { public static final int constructor = 0x55555552; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { ttl = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(ttl); } @@ -29089,7 +24670,7 @@ public static class TL_messageActionSetMessagesTTL extends MessageAction { public int period; public long auto_setting_from; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); period = stream.readInt32(exception); if ((flags & 1) != 0) { @@ -29097,7 +24678,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32(period); @@ -29110,11 +24691,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionSetMessagesTTL_layer149 extends TL_messageActionSetMessagesTTL { public static final int constructor = 0xaa1afbfd; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { period = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(period); } @@ -29123,12 +24704,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionChatJoinedByLink_layer131 extends TL_messageActionChatJoinedByLink { public static final int constructor = 0xf89cf5e8; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { inviter_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) inviter_id); } @@ -29137,12 +24717,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionChannelCreate extends MessageAction { public static final int constructor = 0x95d2ac92; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { title = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(title); } @@ -29153,40 +24732,20 @@ public static class TL_messageActionSecureValuesSent extends MessageAction { public ArrayList types = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - SecureValueType object = SecureValueType.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - types.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + types = Vector.deserialize(stream, SecureValueType::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = types.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - types.get(a).serializeToStream(stream); - } + Vector.serialize(stream, types); } } public static class TL_messageActionPinMessage extends MessageAction { public static final int constructor = 0x94bd38ed; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -29198,13 +24757,13 @@ public static class TL_messageActionGeoProximityReached extends MessageAction { public Peer to_id; public int distance; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); to_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); distance = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); from_id.serializeToStream(stream); to_id.serializeToStream(stream); @@ -29215,8 +24774,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionChatDeletePhoto extends MessageAction { public static final int constructor = 0x95e3fbef; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -29224,8 +24782,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionPhoneCall extends MessageAction { public static final int constructor = 0x80e11a7f; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); video = (flags & 4) != 0; call_id = stream.readInt64(exception); @@ -29237,7 +24794,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = video ? (flags | 4) : (flags &~ 4); stream.writeInt32(flags); @@ -29257,7 +24814,7 @@ public static class TL_messageActionTopicCreate extends MessageAction { public int icon_color; public long icon_emoji_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); title = stream.readString(exception); icon_color = stream.readInt32(exception); @@ -29266,7 +24823,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(title); @@ -29280,12 +24837,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionChatEditTitle extends MessageAction { public static final int constructor = 0xb5a1ce5a; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { title = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(title); } @@ -29294,7 +24850,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionPaymentSent extends MessageAction { public static final int constructor = 0xc624b16e; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); recurring_init = (flags & 4) != 0; recurring_used = (flags & 8) != 0; @@ -29308,7 +24864,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = recurring_init ? (flags | 4) : (flags &~ 4); flags = recurring_used ? (flags | 8) : (flags &~ 8); @@ -29327,7 +24883,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionPaymentSent_layer193 extends TL_messageActionPaymentSent { public static final int constructor = 0x96163f56; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); recurring_init = (flags & 4) != 0; recurring_used = (flags & 8) != 0; @@ -29338,7 +24894,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = recurring_init ? (flags | 4) : (flags &~ 4); flags = recurring_used ? (flags | 8) : (flags &~ 8); @@ -29354,12 +24910,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionPaymentSent_layer140 extends TL_messageActionPaymentSent { public static final int constructor = 0x40699cd0; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { currency = stream.readString(exception); total_amount = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(currency); stream.writeInt64(total_amount); @@ -29374,7 +24930,7 @@ public static class TL_messageActionBotAllowed extends MessageAction { public String domain; public BotApp app; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); attach_menu = (flags & 2) != 0; from_request = (flags & 8) != 0; @@ -29386,7 +24942,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = attach_menu ? (flags | 2) : (flags &~ 2); flags = from_request ? (flags | 8) : (flags &~ 8); @@ -29405,11 +24961,11 @@ public static class TL_messageActionBotAllowed_layer153 extends MessageAction { public String domain; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { domain = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(domain); } @@ -29418,8 +24974,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionEmpty extends MessageAction { public static final int constructor = 0xb6aef7b0; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -29427,13 +24982,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionGameScore extends MessageAction { public static final int constructor = 0x92a72876; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { game_id = stream.readInt64(exception); score = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(game_id); stream.writeInt32(score); @@ -29445,7 +24999,7 @@ public static class TL_messageActionGiftPremium extends MessageAction { public TL_textWithEntities message; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); currency = stream.readString(exception); amount = stream.readInt64(exception); @@ -29459,7 +25013,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(currency); @@ -29478,7 +25032,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionGiftPremium_layer189 extends TL_messageActionGiftPremium { public static final int constructor = 0xc83d6aec; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); currency = stream.readString(exception); amount = stream.readInt64(exception); @@ -29489,7 +25043,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(currency); @@ -29507,11 +25061,11 @@ public static class TL_messageActionBoostApply extends MessageAction { public int boosts; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { boosts = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(boosts); } @@ -29526,7 +25080,7 @@ public static class TL_messageActionPaymentSentMe extends MessageAction { public String shipping_option_id; public TL_paymentCharge charge; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); recurring_init = (flags & 4) != 0; recurring_used = (flags & 8) != 0; @@ -29545,7 +25099,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = recurring_init ? (flags | 4) : (flags &~ 4); flags = recurring_used ? (flags | 8) : (flags &~ 8); @@ -29569,7 +25123,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageActionPaymentSentMe_layer193 extends TL_messageActionPaymentSentMe { public static final int constructor = 0x8f31b327; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); recurring_init = (flags & 4) != 0; recurring_used = (flags & 8) != 0; @@ -29585,7 +25139,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { charge = TL_paymentCharge.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = recurring_init ? (flags | 4) : (flags &~ 4); flags = recurring_used ? (flags | 8) : (flags &~ 8); @@ -29608,12 +25162,12 @@ public static class TL_messageActionGroupCallScheduled extends MessageAction { public int schedule_date; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { call = TL_inputGroupCall.TLdeserialize(stream, stream.readInt32(exception), exception); schedule_date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); call.serializeToStream(stream); stream.writeInt32(schedule_date); @@ -29622,7 +25176,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class ReportReason extends TLObject { - public static ReportReason TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static ReportReason TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { ReportReason result = null; switch (constructor) { case 0xdbd4feed: @@ -29663,8 +25217,7 @@ public static ReportReason TLdeserialize(AbstractSerializedData stream, int cons public static class TL_inputReportReasonGeoIrrelevant extends ReportReason { public static final int constructor = 0xdbd4feed; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -29672,8 +25225,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputReportReasonOther extends ReportReason { public static final int constructor = 0xc1e4a2b1; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -29681,8 +25233,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputReportReasonFake extends ReportReason { public static final int constructor = 0xf5ddd6e7; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -29690,8 +25241,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputReportReasonCopyright extends ReportReason { public static final int constructor = 0x9b89f93a; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -29699,8 +25249,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputReportReasonSpam extends ReportReason { public static final int constructor = 0x58dbcab8; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -29708,8 +25257,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputReportReasonViolence extends ReportReason { public static final int constructor = 0x1e22c78d; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -29717,8 +25265,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputReportReasonChildAbuse extends ReportReason { public static final int constructor = 0xadf44ee3; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -29726,8 +25273,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputReportReasonPornography extends ReportReason { public static final int constructor = 0x2e59d922; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -29735,8 +25281,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputReportReasonIllegalDrugs extends ReportReason { public static final int constructor = 0xa8eb2be; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -29744,8 +25289,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputReportReasonPersonalDetails extends ReportReason { public static final int constructor = 0x9ec7863d; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -29756,7 +25300,7 @@ public static class TL_messages_archivedStickers extends TLObject { public int count; public ArrayList sets = new ArrayList<>(); - public static TL_messages_archivedStickers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_archivedStickers TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_archivedStickers.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_archivedStickers", constructor)); @@ -29769,34 +25313,15 @@ public static TL_messages_archivedStickers TLdeserialize(AbstractSerializedData return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - StickerSetCovered object = StickerSetCovered.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - sets.add(object); - } + sets = Vector.deserialize(stream, StickerSetCovered::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = sets.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - sets.get(a).serializeToStream(stream); - } + Vector.serialize(stream, sets); } } @@ -29814,7 +25339,7 @@ public static abstract class DecryptedMessage extends TLObject { public long grouped_id; public boolean silent; - public static DecryptedMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static DecryptedMessage TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { DecryptedMessage result = null; switch (constructor) { case 0x204d3878: @@ -29849,15 +25374,14 @@ public static DecryptedMessage TLdeserialize(AbstractSerializedData stream, int public static class TL_decryptedMessage_layer17 extends TL_decryptedMessage { public static final int constructor = 0x204d3878; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { random_id = stream.readInt64(exception); ttl = stream.readInt32(exception); message = stream.readString(exception); media = DecryptedMessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(random_id); stream.writeInt32(ttl); @@ -29869,13 +25393,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_decryptedMessageService extends DecryptedMessage { public static final int constructor = 0x73164160; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { random_id = stream.readInt64(exception); action = DecryptedMessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(random_id); action.serializeToStream(stream); @@ -29885,14 +25408,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_decryptedMessageService_layer8 extends TL_decryptedMessageService { public static final int constructor = 0xaa48327d; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { random_id = stream.readInt64(exception); random_bytes = stream.readByteArray(exception); action = DecryptedMessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(random_id); stream.writeByteArray(random_bytes); @@ -29903,15 +25425,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_decryptedMessage_layer8 extends TL_decryptedMessage { public static final int constructor = 0x1f814f1f; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { random_id = stream.readInt64(exception); random_bytes = stream.readByteArray(exception); message = stream.readString(exception); media = DecryptedMessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(random_id); stream.writeByteArray(random_bytes); @@ -29923,8 +25444,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_decryptedMessage extends DecryptedMessage { public static final int constructor = 0x91cc4674; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); silent = (flags & 32) != 0; random_id = stream.readInt64(exception); @@ -29934,21 +25454,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { media = DecryptedMessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception || BuildVars.DEBUG_PRIVATE_VERSION); } if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception || BuildVars.DEBUG_PRIVATE_VERSION); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } if ((flags & 2048) != 0) { via_bot_name = stream.readString(exception); @@ -29961,7 +25467,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = silent ? (flags | 32) : (flags &~ 32); stream.writeInt32(flags); @@ -29972,12 +25478,7 @@ public void serializeToStream(AbstractSerializedData stream) { media.serializeToStream(stream); } if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } if ((flags & 2048) != 0) { stream.writeString(via_bot_name); @@ -29994,8 +25495,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_decryptedMessage_layer45 extends TL_decryptedMessage { public static final int constructor = 0x36b091de; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); random_id = stream.readInt64(exception); ttl = stream.readInt32(exception); @@ -30004,21 +25504,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { media = DecryptedMessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } if ((flags & 2048) != 0) { via_bot_name = stream.readString(exception); @@ -30028,7 +25514,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(random_id); @@ -30038,12 +25524,7 @@ public void serializeToStream(AbstractSerializedData stream) { media.serializeToStream(stream); } if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } if ((flags & 2048) != 0) { stream.writeString(via_bot_name); @@ -30054,74 +25535,6 @@ public void serializeToStream(AbstractSerializedData stream) { } } - public static abstract class account_Themes extends TLObject { - - public static account_Themes TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - account_Themes result = null; - switch (constructor) { - case 0x9a3d8c6d: - result = new TL_account_themes(); - break; - case 0xf41eb622: - result = new TL_account_themesNotModified(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in account_Themes", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } - - public static class TL_account_themes extends account_Themes { - public static final int constructor = 0x9a3d8c6d; - - public long hash; - public ArrayList themes = new ArrayList<>(); - - public void readParams(AbstractSerializedData stream, boolean exception) { - hash = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_theme object = Theme.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - themes.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(hash); - stream.writeInt32(0x1cb5c415); - int count = themes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - themes.get(a).serializeToStream(stream); - } - } - } - - public static class TL_account_themesNotModified extends account_Themes { - public static final int constructor = 0xf41eb622; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class TL_invoice extends TLObject { public static final int constructor = 0x49ee584; @@ -30142,7 +25555,7 @@ public static class TL_invoice extends TLObject { public String terms_url; public int subscription_period; - public static TL_invoice TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_invoice TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { TL_invoice result = null; switch (constructor) { case 0x49ee584: @@ -30164,7 +25577,7 @@ public static TL_invoice TLdeserialize(AbstractSerializedData stream, int constr return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); test = (flags & 1) != 0; name_requested = (flags & 2) != 0; @@ -30176,36 +25589,12 @@ public void readParams(AbstractSerializedData stream, boolean exception) { email_to_provider = (flags & 128) != 0; recurring = (flags & 512) != 0; currency = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_labeledPrice object = TL_labeledPrice.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - prices.add(object); - } + prices = Vector.deserialize(stream, TL_labeledPrice::TLdeserialize, exception); if ((flags & 256) != 0) { max_tip_amount = stream.readInt64(exception); } if ((flags & 256) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - suggested_tip_amounts.add(stream.readInt64(exception)); - } + suggested_tip_amounts = Vector.deserializeLong(stream, exception); } if ((flags & 1024) != 0) { terms_url = stream.readString(exception); @@ -30215,7 +25604,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = test ? (flags | 1) : (flags &~ 1); flags = name_requested ? (flags | 2) : (flags &~ 2); @@ -30228,22 +25617,12 @@ public void serializeToStream(AbstractSerializedData stream) { flags = recurring ? (flags | 512) : (flags &~ 512); stream.writeInt32(flags); stream.writeString(currency); - stream.writeInt32(0x1cb5c415); - int count = prices.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - prices.get(a).serializeToStream(stream); - } + Vector.serialize(stream, prices); if ((flags & 256) != 0) { stream.writeInt64(max_tip_amount); } if ((flags & 256) != 0) { - stream.writeInt32(0x1cb5c415); - count = suggested_tip_amounts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(suggested_tip_amounts.get(a)); - } + Vector.serializeLong(stream, suggested_tip_amounts); } if ((flags & 1024) != 0) { stream.writeString(terms_url); @@ -30257,7 +25636,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_invoice_layer193 extends TL_invoice { public static final int constructor = 0x5db95a15; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); test = (flags & 1) != 0; name_requested = (flags & 2) != 0; @@ -30269,43 +25648,19 @@ public void readParams(AbstractSerializedData stream, boolean exception) { email_to_provider = (flags & 128) != 0; recurring = (flags & 512) != 0; currency = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_labeledPrice object = TL_labeledPrice.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - prices.add(object); - } + prices = Vector.deserialize(stream, TL_labeledPrice::TLdeserialize, exception); if ((flags & 256) != 0) { max_tip_amount = stream.readInt64(exception); } if ((flags & 256) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - suggested_tip_amounts.add(stream.readInt64(exception)); - } + suggested_tip_amounts = Vector.deserializeLong(stream, exception); } if ((flags & 1024) != 0) { terms_url = stream.readString(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = test ? (flags | 1) : (flags &~ 1); flags = name_requested ? (flags | 2) : (flags &~ 2); @@ -30318,22 +25673,12 @@ public void serializeToStream(AbstractSerializedData stream) { flags = recurring ? (flags | 512) : (flags &~ 512); stream.writeInt32(flags); stream.writeString(currency); - stream.writeInt32(0x1cb5c415); - int count = prices.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - prices.get(a).serializeToStream(stream); - } + Vector.serialize(stream, prices); if ((flags & 256) != 0) { stream.writeInt64(max_tip_amount); } if ((flags & 256) != 0) { - stream.writeInt32(0x1cb5c415); - count = suggested_tip_amounts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(suggested_tip_amounts.get(a)); - } + Vector.serializeLong(stream, suggested_tip_amounts); } if ((flags & 1024) != 0) { stream.writeString(terms_url); @@ -30344,7 +25689,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_invoice_layer163 extends TL_invoice { public static final int constructor = 0x3e85a91b; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); test = (flags & 1) != 0; name_requested = (flags & 2) != 0; @@ -30356,43 +25701,19 @@ public void readParams(AbstractSerializedData stream, boolean exception) { email_to_provider = (flags & 128) != 0; recurring = (flags & 512) != 0; currency = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_labeledPrice object = TL_labeledPrice.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - prices.add(object); - } + prices = Vector.deserialize(stream, TL_labeledPrice::TLdeserialize, exception); if ((flags & 256) != 0) { max_tip_amount = stream.readInt64(exception); } if ((flags & 256) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - suggested_tip_amounts.add(stream.readInt64(exception)); - } + suggested_tip_amounts = Vector.deserializeLong(stream, exception); } if ((flags & 1024) != 0) { terms_url = stream.readString(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = test ? (flags | 1) : (flags &~ 1); flags = name_requested ? (flags | 2) : (flags &~ 2); @@ -30405,22 +25726,12 @@ public void serializeToStream(AbstractSerializedData stream) { flags = recurring ? (flags | 512) : (flags &~ 512); stream.writeInt32(flags); stream.writeString(currency); - stream.writeInt32(0x1cb5c415); - int count = prices.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - prices.get(a).serializeToStream(stream); - } + Vector.serialize(stream, prices); if ((flags & 256) != 0) { stream.writeInt64(max_tip_amount); } if ((flags & 256) != 0) { - stream.writeInt32(0x1cb5c415); - count = suggested_tip_amounts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(suggested_tip_amounts.get(a)); - } + Vector.serializeLong(stream, suggested_tip_amounts); } if ((flags & 512) != 0) { stream.writeString(terms_url); @@ -30428,77 +25739,9 @@ public void serializeToStream(AbstractSerializedData stream) { } } - public static abstract class account_WallPapers extends TLObject { - - public static account_WallPapers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - account_WallPapers result = null; - switch (constructor) { - case 0x1c199183: - result = new TL_account_wallPapersNotModified(); - break; - case 0xcdc3858c: - result = new TL_account_wallPapers(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in account_WallPapers", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } - - public static class TL_account_wallPapersNotModified extends account_WallPapers { - public static final int constructor = 0x1c199183; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_account_wallPapers extends account_WallPapers { - public static final int constructor = 0xcdc3858c; - - public long hash; - public ArrayList wallpapers = new ArrayList<>(); - - public void readParams(AbstractSerializedData stream, boolean exception) { - hash = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - WallPaper object = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - wallpapers.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(hash); - stream.writeInt32(0x1cb5c415); - int count = wallpapers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - wallpapers.get(a).serializeToStream(stream); - } - } - } - public static abstract class InlineQueryPeerType extends TLObject { - public static InlineQueryPeerType TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InlineQueryPeerType TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InlineQueryPeerType result = null; switch (constructor) { case 0x6334ee9a: @@ -30533,7 +25776,7 @@ public static InlineQueryPeerType TLdeserialize(AbstractSerializedData stream, i public static class TL_inlineQueryPeerTypeBroadcast extends InlineQueryPeerType { public static final int constructor = 0x6334ee9a; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -30541,7 +25784,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inlineQueryPeerTypeChat extends InlineQueryPeerType { public static final int constructor = 0xd766c50a; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -30549,7 +25792,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inlineQueryPeerTypePM extends InlineQueryPeerType { public static final int constructor = 0x833c0fac; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -30557,7 +25800,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inlineQueryPeerTypeBotPM extends InlineQueryPeerType { public static final int constructor = 0xe3b2d0c; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -30565,7 +25808,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inlineQueryPeerTypeMegagroup extends InlineQueryPeerType { public static final int constructor = 0x5ec4be43; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -30573,12 +25816,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inlineQueryPeerTypeSameBotPM extends InlineQueryPeerType { public static final int constructor = 0x3081ed9d; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } - public static class TL_inputWebDocument extends TLObject { public static final int constructor = 0x9bed434d; @@ -30587,7 +25829,7 @@ public static class TL_inputWebDocument extends TLObject { public String mime_type; public ArrayList attributes = new ArrayList<>(); - public static TL_inputWebDocument TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_inputWebDocument TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_inputWebDocument.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_inputWebDocument", constructor)); @@ -30600,43 +25842,24 @@ public static TL_inputWebDocument TLdeserialize(AbstractSerializedData stream, i return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); size = stream.readInt32(exception); mime_type = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } + attributes = Vector.deserialize(stream, DocumentAttribute::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); stream.writeInt32(size); stream.writeString(mime_type); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } + Vector.serialize(stream, attributes); } } public static class MessageReactor extends TLObject { - + public int flags; public boolean top; public boolean my; @@ -30644,7 +25867,7 @@ public static class MessageReactor extends TLObject { public Peer peer_id; public int count; - public static MessageReactor TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static MessageReactor TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { MessageReactor result = null; switch (constructor) { case TL_messageReactor.constructor: @@ -30667,7 +25890,7 @@ public static MessageReactor TLdeserialize(AbstractSerializedData stream, int co public static class TL_messageReactor extends MessageReactor { public static final int constructor = 0x4ba3a95a; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); top = (flags & 1) != 0; my = (flags & 2) != 0; @@ -30678,7 +25901,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = top ? (flags | 1) : (flags &~ 1); flags = my ? (flags | 2) : (flags &~ 2); @@ -30694,7 +25917,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageReactor_old extends TL_messageReactor { public static final int constructor = 0xef00d448; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); top = (flags & 1) != 0; my = (flags & 2) != 0; @@ -30702,7 +25925,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = top ? (flags | 1) : (flags &~ 1); flags = my ? (flags | 2) : (flags &~ 2); @@ -30722,7 +25945,7 @@ public static abstract class MessageReactions extends TLObject { public ArrayList recent_reactions = new ArrayList<>(); public ArrayList top_reactors = new ArrayList<>(); - public static TL_messageReactions TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messageReactions TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { TL_messageReactions result = null; switch (constructor) { case 0x87b6e36: @@ -30751,89 +25974,32 @@ public static TL_messageReactions TLdeserialize(AbstractSerializedData stream, i public static class TL_messageReactions extends MessageReactions { public static final int constructor = 0xa339f0b; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); min = (flags & 1) != 0; can_see_list = (flags & 4) != 0; reactions_as_tags = (flags & 8) != 0; - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - ReactionCount object = ReactionCount.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - results.add(object); - } + results = Vector.deserialize(stream, ReactionCount::TLdeserialize, exception); if ((flags & 2) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessagePeerReaction object = MessagePeerReaction.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - recent_reactions.add(object); - } + recent_reactions = Vector.deserialize(stream, MessagePeerReaction::TLdeserialize, exception); } if ((flags & 16) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageReactor object = MessageReactor.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - top_reactors.add(object); - } + top_reactors = Vector.deserialize(stream, MessageReactor::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = min ? (flags | 1) : (flags &~ 1); flags = can_see_list ? (flags | 4) : (flags &~ 4); flags = reactions_as_tags ? (flags | 8) : (flags &~ 8); stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = results.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - results.get(a).serializeToStream(stream); - } + Vector.serialize(stream, results); if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - count = recent_reactions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - recent_reactions.get(a).serializeToStream(stream); - } + Vector.serialize(stream, recent_reactions); } if ((flags & 16) != 0) { - stream.writeInt32(0x1cb5c415); - count = top_reactors.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - top_reactors.get(a).serializeToStream(stream); - } + Vector.serialize(stream, top_reactors); } } } @@ -30841,64 +26007,26 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageReactions_layer185 extends TL_messageReactions { public static final int constructor = 0x4f2b9479; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); min = (flags & 1) != 0; can_see_list = (flags & 4) != 0; reactions_as_tags = (flags & 8) != 0; - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - ReactionCount object = ReactionCount.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - results.add(object); - } + results = Vector.deserialize(stream, ReactionCount::TLdeserialize, exception); if ((flags & 2) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessagePeerReaction object = MessagePeerReaction.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - recent_reactions.add(object); - } + recent_reactions = Vector.deserialize(stream, MessagePeerReaction::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = min ? (flags | 1) : (flags &~ 1); flags = can_see_list ? (flags | 4) : (flags &~ 4); flags = reactions_as_tags ? (flags | 8) : (flags &~ 8); stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = results.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - results.get(a).serializeToStream(stream); - } + Vector.serialize(stream, results); if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - count = recent_reactions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - recent_reactions.get(a).serializeToStream(stream); - } + Vector.serialize(stream, recent_reactions); } } } @@ -30913,7 +26041,7 @@ public static class TL_savedReactionTag extends TLObject { public long hash; // custom - public static TL_savedReactionTag TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_savedReactionTag TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_savedReactionTag.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_savedReactionTag", constructor)); @@ -30926,7 +26054,7 @@ public static TL_savedReactionTag TLdeserialize(AbstractSerializedData stream, i return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); reaction = Reaction.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 1) != 0) { @@ -30935,7 +26063,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); reaction.serializeToStream(stream); @@ -30950,7 +26078,7 @@ public static class messages_SavedReactionTags extends TLObject { public ArrayList tags = new ArrayList<>(); public long hash; - public static messages_SavedReactionTags TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static messages_SavedReactionTags TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { messages_SavedReactionTags result = null; switch (constructor) { case TL_messages_savedReactionsTagsNotModified.constructor: @@ -30973,11 +26101,11 @@ public static messages_SavedReactionTags TLdeserialize(AbstractSerializedData st public static class TL_messages_savedReactionsTagsNotModified extends messages_SavedReactionTags { public static final int constructor = 0x889b59ef; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -30985,33 +26113,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messages_savedReactionsTags extends messages_SavedReactionTags { public static final int constructor = 0x3259950a; - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_savedReactionTag object = TL_savedReactionTag.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - tags.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + tags = Vector.deserialize(stream, TL_savedReactionTag::TLdeserialize, exception); hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = tags.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - tags.get(a).serializeToStream(stream); - } + Vector.serialize(stream, tags); stream.writeInt64(hash); } } @@ -31021,7 +26130,7 @@ public static class TL_outboxReadDate extends TLObject { public int date; - public static TL_outboxReadDate TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_outboxReadDate TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_outboxReadDate.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_outboxReadDate", constructor)); @@ -31034,11 +26143,11 @@ public static TL_outboxReadDate TLdeserialize(AbstractSerializedData stream, int return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(date); } } @@ -31046,8 +26155,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageReactionsOld extends TL_messageReactions { public static final int constructor = 0x87b6e36; - - public static TL_messageReactions TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messageReactions TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messageReactions.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messageReactions", constructor)); @@ -31060,62 +26168,24 @@ public static TL_messageReactions TLdeserialize(AbstractSerializedData stream, i return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); min = (flags & 1) != 0; can_see_list = (flags & 4) != 0; - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - ReactionCount object = ReactionCount.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - results.add(object); - } + results = Vector.deserialize(stream, ReactionCount::TLdeserialize, exception); if ((flags & 2) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessagePeerReaction object = MessagePeerReaction.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - recent_reactions.add(object); - } + recent_reactions = Vector.deserialize(stream, MessagePeerReaction::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = min ? (flags | 1) : (flags &~ 1); flags = can_see_list ? (flags | 4) : (flags &~ 4); stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = results.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - results.get(a).serializeToStream(stream); - } + Vector.serialize(stream, results); if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - count = recent_reactions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - recent_reactions.get(a).serializeToStream(stream); - } + Vector.serialize(stream, recent_reactions); } } } @@ -31123,36 +26193,17 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageReactions_layer137 extends TL_messageReactions { public static final int constructor = 0xb87a24d1; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); min = (flags & 1) != 0; - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - ReactionCount object = ReactionCount.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - results.add(object); - } + results = Vector.deserialize(stream, ReactionCount::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = min ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = results.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - results.get(a).serializeToStream(stream); - } + Vector.serialize(stream, results); } } @@ -31172,7 +26223,7 @@ public static abstract class Video extends TLObject { public byte[] key; public byte[] iv; - public static Video TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static Video TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { Video result = null; switch (constructor) { case 0xee9f4a4d: @@ -31207,8 +26258,7 @@ public static Video TLdeserialize(AbstractSerializedData stream, int constructor public static class TL_video_old3 extends TL_video_layer45 { public static final int constructor = 0xee9f4a4d; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); user_id = stream.readInt32(exception); @@ -31221,7 +26271,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { h = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -31239,8 +26289,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_video_layer45 extends Video { public static final int constructor = 0xf72887d3; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); date = stream.readInt32(exception); @@ -31253,7 +26302,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { h = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -31271,8 +26320,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_videoEncrypted extends TL_video_layer45 { public static final int constructor = 0x55555553; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); user_id = stream.readInt32(exception); @@ -31288,7 +26336,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { iv = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -31309,8 +26357,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_video_old extends TL_video_layer45 { public static final int constructor = 0x5a04a49f; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); user_id = stream.readInt32(exception); @@ -31324,7 +26371,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { h = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -31343,8 +26390,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_video_old2 extends TL_video_layer45 { public static final int constructor = 0x388fa391; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); user_id = stream.readInt32(exception); @@ -31359,7 +26405,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { h = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -31379,12 +26425,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_videoEmpty_layer45 extends Video { public static final int constructor = 0xc10658a8; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); } @@ -31399,7 +26444,7 @@ public static abstract class InputPaymentCredentials extends TLObject { public byte[] tmp_password; public TL_dataJSON payment_token; - public static InputPaymentCredentials TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputPaymentCredentials TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputPaymentCredentials result = null; switch (constructor) { case 0x3417d728: @@ -31425,14 +26470,13 @@ public static InputPaymentCredentials TLdeserialize(AbstractSerializedData strea public static class TL_inputPaymentCredentials extends InputPaymentCredentials { public static final int constructor = 0x3417d728; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); save = (flags & 1) != 0; data = TL_dataJSON.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = save ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -31443,12 +26487,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPaymentCredentialsGooglePay extends InputPaymentCredentials { public static final int constructor = 0x8ac32801; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { payment_token = TL_dataJSON.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); payment_token.serializeToStream(stream); } @@ -31457,13 +26500,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPaymentCredentialsSaved extends InputPaymentCredentials { public static final int constructor = 0xc10eb2cf; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readString(exception); tmp_password = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(id); stream.writeByteArray(tmp_password); @@ -31476,7 +26518,7 @@ public static class TL_exportedMessageLink extends TLObject { public String link; public String html; - public static TL_exportedMessageLink TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_exportedMessageLink TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_exportedMessageLink.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_exportedMessageLink", constructor)); @@ -31489,12 +26531,12 @@ public static TL_exportedMessageLink TLdeserialize(AbstractSerializedData stream return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { link = stream.readString(exception); html = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(link); stream.writeString(html); @@ -31510,7 +26552,7 @@ public static class TL_groupCallParticipantVideo extends TLObject { public ArrayList source_groups = new ArrayList<>(); public int audio_source; - public static TL_groupCallParticipantVideo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_groupCallParticipantVideo TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_groupCallParticipantVideo.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_groupCallParticipantVideo", constructor)); @@ -31523,41 +26565,22 @@ public static TL_groupCallParticipantVideo TLdeserialize(AbstractSerializedData return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); paused = (flags & 1) != 0; endpoint = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_groupCallParticipantVideoSourceGroup object = TL_groupCallParticipantVideoSourceGroup.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - source_groups.add(object); - } + source_groups = Vector.deserialize(stream, TL_groupCallParticipantVideoSourceGroup::TLdeserialize, exception); if ((flags & 2) != 0) { audio_source = stream.readInt32(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = paused ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); stream.writeString(endpoint); - stream.writeInt32(0x1cb5c415); - int count = source_groups.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - source_groups.get(a).serializeToStream(stream); - } + Vector.serialize(stream, source_groups); if ((flags & 2) != 0) { stream.writeInt32(audio_source); } @@ -31566,7 +26589,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class TopPeerCategory extends TLObject { - public static TopPeerCategory TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TopPeerCategory TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { TopPeerCategory result = null; switch (constructor) { case 0x161d9628: @@ -31610,8 +26633,7 @@ public static TopPeerCategory TLdeserialize(AbstractSerializedData stream, int c public static class TL_topPeerCategoryChannels extends TopPeerCategory { public static final int constructor = 0x161d9628; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -31619,8 +26641,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_topPeerCategoryPhoneCalls extends TopPeerCategory { public static final int constructor = 0x1e76a78c; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -31628,8 +26649,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_topPeerCategoryGroups extends TopPeerCategory { public static final int constructor = 0xbd17a14a; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -31637,8 +26657,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_topPeerCategoryBotsInline extends TopPeerCategory { public static final int constructor = 0x148677e2; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -31646,8 +26665,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_topPeerCategoryForwardUsers extends TopPeerCategory { public static final int constructor = 0xa8406ca9; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -31655,8 +26673,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_topPeerCategoryForwardChats extends TopPeerCategory { public static final int constructor = 0xfbeec0f0; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -31664,8 +26681,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_topPeerCategoryBotsPM extends TopPeerCategory { public static final int constructor = 0xab661b5b; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -31673,8 +26689,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_topPeerCategoryCorrespondents extends TopPeerCategory { public static final int constructor = 0x637b7ed; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -31682,8 +26697,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_topPeerCategoryBotsApp extends TopPeerCategory { public static final int constructor = 0xfd9e7bec; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -31707,7 +26721,7 @@ public static abstract class MessageReplyHeader extends TLObject { public Peer peer; public int story_id; - public static MessageReplyHeader TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static MessageReplyHeader TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { MessageReplyHeader result = null; switch (constructor) { case TL_messageReplyStoryHeader.constructor: @@ -31742,13 +26756,13 @@ public static MessageReplyHeader TLdeserialize(AbstractSerializedData stream, in public static class TL_messageReplyStoryHeader_layer174 extends TL_messageReplyStoryHeader { public static final int constructor = 0x9c98bfc1; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = new TLRPC.TL_peerUser(); peer.user_id = stream.readInt64(exception); story_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(peer == null ? 0 : peer.user_id); stream.writeInt32(story_id); @@ -31758,12 +26772,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageReplyStoryHeader extends MessageReplyHeader { public static final int constructor = 0xe5af939; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); story_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(story_id); @@ -31773,7 +26787,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageReplyHeader extends MessageReplyHeader { public static final int constructor = 0xafbc09db; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); reply_to_scheduled = (flags & 4) != 0; forum_topic = (flags & 8) != 0; @@ -31797,28 +26811,14 @@ public void readParams(AbstractSerializedData stream, boolean exception) { quote_text = stream.readString(exception); } if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - quote_entities.add(object); - } + quote_entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } if ((flags & 1024) != 0) { quote_offset = stream.readInt32(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = reply_to_scheduled ? (flags | 4) : (flags &~ 4); flags = forum_topic ? (flags | 8) : (flags &~ 8); @@ -31843,12 +26843,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeString(quote_text); } if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = quote_entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; ++a) { - quote_entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, quote_entities); } if ((flags & 1024) != 0) { stream.writeInt32(quote_offset); @@ -31859,7 +26854,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageReplyHeader_layer166 extends TL_messageReplyHeader { public static final int constructor = 0x6eebcabd; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); reply_to_scheduled = (flags & 4) != 0; forum_topic = (flags & 8) != 0; @@ -31883,25 +26878,11 @@ public void readParams(AbstractSerializedData stream, boolean exception) { quote_text = stream.readString(exception); } if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - quote_entities.add(object); - } + quote_entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = reply_to_scheduled ? (flags | 4) : (flags &~ 4); flags = forum_topic ? (flags | 8) : (flags &~ 8); @@ -31926,12 +26907,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeString(quote_text); } if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = quote_entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; ++a) { - quote_entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, quote_entities); } } } @@ -31939,7 +26915,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageReplyHeader_layer165_2 extends TL_messageReplyHeader { public static final int constructor = 0x3d5c1693; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); reply_to_scheduled = (flags & 4) != 0; forum_topic = (flags & 8) != 0; @@ -31959,25 +26935,11 @@ public void readParams(AbstractSerializedData stream, boolean exception) { quote_text = stream.readString(exception); } if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - quote_entities.add(object); - } + quote_entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = reply_to_scheduled ? (flags | 4) : (flags &~ 4); flags = forum_topic ? (flags | 8) : (flags &~ 8); @@ -31998,12 +26960,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeString(quote_text); } if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = quote_entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; ++a) { - quote_entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, quote_entities); } } } @@ -32011,7 +26968,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageReplyHeader_layer165 extends TL_messageReplyHeader { public static final int constructor = 0xa6d57763; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); reply_to_scheduled = (flags & 4) != 0; forum_topic = (flags & 8) != 0; @@ -32024,7 +26981,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = reply_to_scheduled ? (flags | 4) : (flags &~ 4); flags = forum_topic ? (flags | 8) : (flags &~ 8); @@ -32046,7 +27003,7 @@ public static class TL_payments_validatedRequestedInfo extends TLObject { public String id; public ArrayList shipping_options = new ArrayList<>(); - public static TL_payments_validatedRequestedInfo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_payments_validatedRequestedInfo TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_payments_validatedRequestedInfo.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_payments_validatedRequestedInfo", constructor)); @@ -32059,43 +27016,24 @@ public static TL_payments_validatedRequestedInfo TLdeserialize(AbstractSerialize return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { id = stream.readString(exception); } if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_shippingOption object = TL_shippingOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - shipping_options.add(object); - } + shipping_options = Vector.deserialize(stream, TL_shippingOption::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { stream.writeString(id); } if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = shipping_options.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - shipping_options.get(a).serializeToStream(stream); - } + Vector.serialize(stream, shipping_options); } } } @@ -32106,7 +27044,7 @@ public static class TL_jsonObjectValue extends TLObject { public String key; public JSONValue value; - public static TL_jsonObjectValue TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_jsonObjectValue TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_jsonObjectValue.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_jsonObjectValue", constructor)); @@ -32119,12 +27057,12 @@ public static TL_jsonObjectValue TLdeserialize(AbstractSerializedData stream, in return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { key = stream.readString(exception); value = JSONValue.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(key); value.serializeToStream(stream); @@ -32138,7 +27076,7 @@ public static class TL_users_userFull extends TLObject { public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_users_userFull TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_users_userFull TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_users_userFull.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_users_userFull", constructor)); @@ -32151,55 +27089,17 @@ public static TL_users_userFull TLdeserialize(AbstractSerializedData stream, int return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { full_user = UserFull.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); full_user.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } @@ -32210,7 +27110,7 @@ public static class TL_shippingOption extends TLObject { public String title; public ArrayList prices = new ArrayList<>(); - public static TL_shippingOption TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_shippingOption TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_shippingOption.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_shippingOption", constructor)); @@ -32223,36 +27123,17 @@ public static TL_shippingOption TLdeserialize(AbstractSerializedData stream, int return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readString(exception); title = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_labeledPrice object = TL_labeledPrice.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - prices.add(object); - } + prices = Vector.deserialize(stream, TL_labeledPrice::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(id); stream.writeString(title); - stream.writeInt32(0x1cb5c415); - int count = prices.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - prices.get(a).serializeToStream(stream); - } + Vector.serialize(stream, prices); } } @@ -32261,8 +27142,7 @@ public static abstract class InputDocument extends TLObject { public long access_hash; public byte[] file_reference; - - public static InputDocument TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputDocument TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputDocument result = null; switch (constructor) { case 0x72f0eaae: @@ -32285,8 +27165,7 @@ public static InputDocument TLdeserialize(AbstractSerializedData stream, int con public static class TL_inputDocumentEmpty extends InputDocument { public static final int constructor = 0x72f0eaae; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -32294,14 +27173,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputDocument extends InputDocument { public static final int constructor = 0x1abfb575; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); file_reference = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -32315,7 +27193,7 @@ public static class TL_folderPeer extends TLObject { public Peer peer; public int folder_id; - public static TL_folderPeer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_folderPeer TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_folderPeer.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_folderPeer", constructor)); @@ -32328,12 +27206,12 @@ public static TL_folderPeer TLdeserialize(AbstractSerializedData stream, int con return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); folder_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(folder_id); @@ -32342,7 +27220,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class SecureValueType extends TLObject { - public static SecureValueType TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static SecureValueType TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { SecureValueType result = null; switch (constructor) { case 0xcbe31e26: @@ -32398,8 +27276,7 @@ public static SecureValueType TLdeserialize(AbstractSerializedData stream, int c public static class TL_secureValueTypeAddress extends SecureValueType { public static final int constructor = 0xcbe31e26; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -32407,8 +27284,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_secureValueTypePassportRegistration extends SecureValueType { public static final int constructor = 0x99e3806a; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -32416,8 +27292,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_secureValueTypeIdentityCard extends SecureValueType { public static final int constructor = 0xa0d0744b; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -32425,8 +27300,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_secureValueTypeUtilityBill extends SecureValueType { public static final int constructor = 0xfc36954e; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -32434,8 +27308,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_secureValueTypeBankStatement extends SecureValueType { public static final int constructor = 0x89137c0d; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -32443,8 +27316,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_secureValueTypeEmail extends SecureValueType { public static final int constructor = 0x8e3ca7ee; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -32452,8 +27324,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_secureValueTypePersonalDetails extends SecureValueType { public static final int constructor = 0x9d2a81e3; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -32461,8 +27332,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_secureValueTypeTemporaryRegistration extends SecureValueType { public static final int constructor = 0xea02ec33; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -32470,8 +27340,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_secureValueTypePassport extends SecureValueType { public static final int constructor = 0x3dac6a00; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -32479,8 +27348,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_secureValueTypeRentalAgreement extends SecureValueType { public static final int constructor = 0x8b883488; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -32488,8 +27356,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_secureValueTypeDriverLicense extends SecureValueType { public static final int constructor = 0x6e425c4; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -32497,8 +27364,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_secureValueTypePhone extends SecureValueType { public static final int constructor = 0xb320aadb; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -32506,8 +27372,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_secureValueTypeInternalPassport extends SecureValueType { public static final int constructor = 0x99a48f23; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -32518,7 +27383,7 @@ public static class TL_peerBlocked extends TLObject { public Peer peer_id; public int date; - public static TL_peerBlocked TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_peerBlocked TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_peerBlocked.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_peerBlocked", constructor)); @@ -32531,12 +27396,12 @@ public static TL_peerBlocked TLdeserialize(AbstractSerializedData stream, int co return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer_id.serializeToStream(stream); stream.writeInt32(date); @@ -32550,7 +27415,7 @@ public static class TL_messages_affectedHistory extends TLObject { public int pts_count; public int offset; - public static TL_messages_affectedHistory TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_affectedHistory TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_affectedHistory.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_affectedHistory", constructor)); @@ -32563,13 +27428,13 @@ public static TL_messages_affectedHistory TLdeserialize(AbstractSerializedData s return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { pts = stream.readInt32(exception); pts_count = stream.readInt32(exception); offset = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(pts); stream.writeInt32(pts_count); @@ -32598,7 +27463,7 @@ public static abstract class Document extends TLObject { public String localPath; //custom public String localThumbPath; - public static Document TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static Document TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { Document result = null; switch (constructor) { case 0x9ba29cc1: @@ -32646,8 +27511,7 @@ public static Document TLdeserialize(AbstractSerializedData stream, int construc public static class TL_document_layer92 extends TL_document { public static final int constructor = 0x59534e4c; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); file_reference = stream.readByteArray(exception); @@ -32656,24 +27520,10 @@ public void readParams(AbstractSerializedData stream, boolean exception) { size = stream.readInt32(exception); thumbs.add(PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception)); dc_id = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } + attributes = Vector.deserialize(stream, DocumentAttribute::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -32683,20 +27533,14 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32((int) size); thumbs.get(0).serializeToStream(stream); stream.writeInt32(dc_id); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } + Vector.serialize(stream, attributes); } } public static class TL_document_layer82 extends TL_document { public static final int constructor = 0x87232bc7; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); date = stream.readInt32(exception); @@ -32705,24 +27549,10 @@ public void readParams(AbstractSerializedData stream, boolean exception) { thumbs.add(PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception)); dc_id = stream.readInt32(exception); stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } + attributes = Vector.deserialize(stream, DocumentAttribute::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -32732,20 +27562,14 @@ public void serializeToStream(AbstractSerializedData stream) { thumbs.get(0).serializeToStream(stream); stream.writeInt32(dc_id); stream.writeInt32(0); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } + Vector.serialize(stream, attributes); } } public static class TL_documentEncrypted_old extends TL_document { public static final int constructor = 0x55555556; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); user_id = stream.readInt32(exception); @@ -32759,7 +27583,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { iv = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -32778,7 +27602,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_document extends Document { public static final int constructor = 0x8fd4c4d8; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); id = stream.readInt64(exception); access_hash = stream.readInt64(exception); @@ -32821,24 +27645,10 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } dc_id = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } + attributes = Vector.deserialize(stream, DocumentAttribute::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(id); @@ -32848,36 +27658,20 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeString(mime_type); stream.writeInt64(size); if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = thumbs.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - thumbs.get(a).serializeToStream(stream); - } + Vector.serialize(stream, thumbs); } if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = video_thumbs.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - video_thumbs.get(a).serializeToStream(stream); - } + Vector.serialize(stream, video_thumbs); } stream.writeInt32(dc_id); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } + Vector.serialize(stream, attributes); } } public static class TL_document_layer142 extends TL_document { public static final int constructor = 0x1e87342b; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); id = stream.readInt64(exception); access_hash = stream.readInt64(exception); @@ -32920,24 +27714,10 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } dc_id = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } + attributes = Vector.deserialize(stream, DocumentAttribute::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(id); @@ -32947,36 +27727,20 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeString(mime_type); stream.writeInt32((int) size); if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = thumbs.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - thumbs.get(a).serializeToStream(stream); - } + Vector.serialize(stream, thumbs); } if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = video_thumbs.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - video_thumbs.get(a).serializeToStream(stream); - } + Vector.serialize(stream, video_thumbs); } stream.writeInt32(dc_id); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } + Vector.serialize(stream, attributes); } } public static class TL_document_layer113 extends TL_document { public static final int constructor = 0x9ba29cc1; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); id = stream.readInt64(exception); access_hash = stream.readInt64(exception); @@ -33002,24 +27766,10 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } dc_id = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } + attributes = Vector.deserialize(stream, DocumentAttribute::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(id); @@ -33029,28 +27779,17 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeString(mime_type); stream.writeInt32((int) size); if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = thumbs.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - thumbs.get(a).serializeToStream(stream); - } + Vector.serialize(stream, thumbs); } stream.writeInt32(dc_id); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } + Vector.serialize(stream, attributes); } } public static class TL_document_old extends TL_document { public static final int constructor = 0x9efc6326; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); user_id = stream.readInt32(exception); @@ -33062,7 +27801,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { dc_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -33079,12 +27818,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_documentEmpty extends Document { public static final int constructor = 0x36f8c871; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); } @@ -33093,8 +27831,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_documentEncrypted extends Document { public static final int constructor = 0x55555558; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); date = stream.readInt32(exception); @@ -33102,26 +27839,12 @@ public void readParams(AbstractSerializedData stream, boolean exception) { size = stream.readInt32(exception); thumbs.add(PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception)); dc_id = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } + attributes = Vector.deserialize(stream, DocumentAttribute::TLdeserialize, exception); key = stream.readByteArray(exception); iv = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -33130,12 +27853,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32((int) size); thumbs.get(0).serializeToStream(stream); stream.writeInt32(dc_id); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } + Vector.serialize(stream, attributes); stream.writeByteArray(key); stream.writeByteArray(iv); } @@ -33144,8 +27862,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_document_layer53 extends TL_document { public static final int constructor = 0xf9a39f4f; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); date = stream.readInt32(exception); @@ -33153,24 +27870,10 @@ public void readParams(AbstractSerializedData stream, boolean exception) { size = stream.readInt32(exception); thumbs.add(PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception)); dc_id = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } + attributes = Vector.deserialize(stream, DocumentAttribute::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -33179,18 +27882,13 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32((int) size); thumbs.get(0).serializeToStream(stream); stream.writeInt32(dc_id); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } + Vector.serialize(stream, attributes); } } public static abstract class PasswordKdfAlgo extends TLObject { - public static PasswordKdfAlgo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static PasswordKdfAlgo TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { PasswordKdfAlgo result = null; switch (constructor) { case 0xd45ab096: @@ -33213,8 +27911,7 @@ public static PasswordKdfAlgo TLdeserialize(AbstractSerializedData stream, int c public static class TL_passwordKdfAlgoUnknown extends PasswordKdfAlgo { public static final int constructor = 0xd45ab096; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -33227,14 +27924,14 @@ public static class TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA2 public int g; public byte[] p; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { salt1 = stream.readByteArray(exception); salt2 = stream.readByteArray(exception); g = stream.readInt32(exception); p = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeByteArray(salt1); stream.writeByteArray(salt2); @@ -33254,7 +27951,7 @@ public static abstract class PageBlock extends TLObject { public int cachedWidth; //custom public int cachedHeight; //custom - public static PageBlock TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static PageBlock TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { PageBlock result = null; switch (constructor) { case 0x9a8ae1e1: @@ -33390,32 +28087,13 @@ public static class TL_pageBlockOrderedList extends PageBlock { public ArrayList items = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageListOrderedItem object = PageListOrderedItem.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - items.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + items = Vector.deserialize(stream, PageListOrderedItem::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = items.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - items.get(a).serializeToStream(stream); - } + Vector.serialize(stream, items); } } @@ -33430,43 +28108,24 @@ public static class TL_pageBlockEmbedPost extends PageBlock { public ArrayList blocks = new ArrayList<>(); public TL_pageCaption caption; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); webpage_id = stream.readInt64(exception); author_photo_id = stream.readInt64(exception); author = stream.readString(exception); date = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - blocks.add(object); - } + blocks = Vector.deserialize(stream, PageBlock::TLdeserialize, exception); caption = TL_pageCaption.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); stream.writeInt64(webpage_id); stream.writeInt64(author_photo_id); stream.writeString(author); stream.writeInt32(date); - stream.writeInt32(0x1cb5c415); - int count = blocks.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - blocks.get(a).serializeToStream(stream); - } + Vector.serialize(stream, blocks); caption.serializeToStream(stream); } } @@ -33476,11 +28135,11 @@ public static class TL_pageBlockParagraph extends PageBlock { public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); } @@ -33491,11 +28150,11 @@ public static class TL_pageBlockKicker extends PageBlock { public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); } @@ -33506,11 +28165,11 @@ public static class TL_pageBlockFooter extends PageBlock { public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); } @@ -33521,11 +28180,11 @@ public static class TL_pageBlockHeader extends PageBlock { public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); } @@ -33537,12 +28196,12 @@ public static class TL_pageBlockPreformatted extends PageBlock { public RichText text; public String language; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); language = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); stream.writeString(language); @@ -33555,34 +28214,15 @@ public static class TL_pageBlockRelatedArticles extends PageBlock { public RichText title; public ArrayList articles = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { title = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_pageRelatedArticle object = TL_pageRelatedArticle.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - articles.add(object); - } + articles = Vector.deserialize(stream, TL_pageRelatedArticle::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); title.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = articles.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - articles.get(a).serializeToStream(stream); - } + Vector.serialize(stream, articles); } } @@ -33591,11 +28231,11 @@ public static class TL_pageBlockSubheader extends PageBlock { public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); } @@ -33607,33 +28247,14 @@ public static class TL_pageBlockSlideshow extends PageBlock { public ArrayList items = new ArrayList<>(); public TL_pageCaption caption; - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - items.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + items = Vector.deserialize(stream, PageBlock::TLdeserialize, exception); caption = TL_pageCaption.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = items.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - items.get(a).serializeToStream(stream); - } + Vector.serialize(stream, items); caption.serializeToStream(stream); } } @@ -33643,11 +28264,11 @@ public static class TL_pageBlockAnchor extends PageBlock { public String name; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { name = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(name); } @@ -33662,7 +28283,7 @@ public static class TL_pageBlockMap extends PageBlock { public int h; public TL_pageCaption caption; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); zoom = stream.readInt32(exception); w = stream.readInt32(exception); @@ -33670,7 +28291,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { caption = TL_pageCaption.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); geo.serializeToStream(stream); stream.writeInt32(zoom); @@ -33683,8 +28304,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_pageBlockDivider extends PageBlock { public static final int constructor = 0xdb20b188; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -33698,7 +28318,7 @@ public static class TL_pageBlockPhoto extends PageBlock { public String url; public long webpage_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); photo_id = stream.readInt64(exception); caption = TL_pageCaption.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -33710,7 +28330,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(photo_id); @@ -33730,40 +28350,20 @@ public static class TL_pageBlockList extends PageBlock { public boolean ordered; public ArrayList items = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageListItem object = PageListItem.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - items.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + items = Vector.deserialize(stream, PageListItem::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = items.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - items.get(a).serializeToStream(stream); - } + Vector.serialize(stream, items); } } public static class TL_pageBlockUnsupported extends PageBlock { public static final int constructor = 0x13567e8a; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -33774,33 +28374,14 @@ public static class TL_pageBlockCollage extends PageBlock { public ArrayList items = new ArrayList<>(); public TL_pageCaption caption; - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - items.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + items = Vector.deserialize(stream, PageBlock::TLdeserialize, exception); caption = TL_pageCaption.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = items.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - items.get(a).serializeToStream(stream); - } + Vector.serialize(stream, items); caption.serializeToStream(stream); } } @@ -33818,7 +28399,7 @@ public static class TL_pageBlockEmbed extends PageBlock { public int h; public TL_pageCaption caption; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); full_width = (flags & 1) != 0; allow_scrolling = (flags & 8) != 0; @@ -33840,7 +28421,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { caption = TL_pageCaption.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = full_width ? (flags | 1) : (flags &~ 1); flags = allow_scrolling ? (flags | 8) : (flags &~ 8); @@ -33869,11 +28450,11 @@ public static class TL_pageBlockSubtitle extends PageBlock { public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); } @@ -33885,12 +28466,12 @@ public static class TL_pageBlockBlockquote extends PageBlock { public RichText text; public RichText caption; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); caption = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); caption.serializeToStream(stream); @@ -33905,37 +28486,18 @@ public static class TL_pageBlockDetails extends PageBlock { public ArrayList blocks = new ArrayList<>(); public RichText title; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); open = (flags & 1) != 0; - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - blocks.add(object); - } + blocks = Vector.deserialize(stream, PageBlock::TLdeserialize, exception); title = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = open ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = blocks.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - blocks.get(a).serializeToStream(stream); - } + Vector.serialize(stream, blocks); title.serializeToStream(stream); } } @@ -33945,11 +28507,11 @@ public static class TL_pageBlockChannel extends PageBlock { public Chat channel; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { channel = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); channel.serializeToStream(stream); } @@ -33964,7 +28526,7 @@ public static class TL_pageBlockVideo extends PageBlock { public long video_id; public TL_pageCaption caption; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); autoplay = (flags & 1) != 0; loop = (flags & 2) != 0; @@ -33972,7 +28534,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { caption = TL_pageCaption.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = autoplay ? (flags | 1) : (flags &~ 1); flags = loop ? (flags | 2) : (flags &~ 2); @@ -33994,7 +28556,7 @@ public static class TL_pageBlockEmbed_layer60 extends TL_pageBlockEmbed { public int h; public RichText caption; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); full_width = (flags & 1) != 0; allow_scrolling = (flags & 8) != 0; @@ -34009,7 +28571,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { caption = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = full_width ? (flags | 1) : (flags &~ 1); flags = allow_scrolling ? (flags | 8) : (flags &~ 8); @@ -34032,12 +28594,12 @@ public static class TL_pageBlockPullquote extends PageBlock { public RichText text; public RichText caption; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); caption = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); caption.serializeToStream(stream); @@ -34050,12 +28612,12 @@ public static class TL_pageBlockAudio extends PageBlock { public long audio_id; public TL_pageCaption caption; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { audio_id = stream.readInt64(exception); caption = TL_pageCaption.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(audio_id); caption.serializeToStream(stream); @@ -34071,40 +28633,21 @@ public static class TL_pageBlockTable extends PageBlock { public RichText title; public ArrayList rows = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); bordered = (flags & 1) != 0; striped = (flags & 2) != 0; title = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_pageTableRow object = TL_pageTableRow.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - rows.add(object); - } + rows = Vector.deserialize(stream, TL_pageTableRow::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = bordered ? (flags | 1) : (flags &~ 1); flags = striped ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); title.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = rows.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - rows.get(a).serializeToStream(stream); - } + Vector.serialize(stream, rows); } } @@ -34113,11 +28656,11 @@ public static class TL_pageBlockTitle extends PageBlock { public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); } @@ -34128,11 +28671,11 @@ public static class TL_pageBlockCover extends PageBlock { public PageBlock cover; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { cover = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); cover.serializeToStream(stream); } @@ -34144,12 +28687,12 @@ public static class TL_pageBlockAuthorDate extends PageBlock { public RichText author; public int published_date; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { author = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); published_date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); author.serializeToStream(stream); stream.writeInt32(published_date); @@ -34158,7 +28701,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class InputPrivacyRule extends TLObject { - public static InputPrivacyRule TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputPrivacyRule TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputPrivacyRule result = null; switch (constructor) { case TL_inputPrivacyValueDisallowAll.constructor: @@ -34211,8 +28754,7 @@ public static InputPrivacyRule TLdeserialize(AbstractSerializedData stream, int public static class TL_inputPrivacyValueDisallowAll extends InputPrivacyRule { public static final int constructor = 0xd66b66c9; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -34222,40 +28764,20 @@ public static class TL_inputPrivacyValueDisallowUsers extends InputPrivacyRule { public ArrayList users = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputUser object = InputUser.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + users = Vector.deserialize(stream, InputUser::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, users); } } public static class TL_inputPrivacyValueAllowContacts extends InputPrivacyRule { public static final int constructor = 0xd09e07b; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -34265,36 +28787,20 @@ public static class TL_inputPrivacyValueAllowChatParticipants extends InputPriva public ArrayList chats = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - chats.add(stream.readInt64(exception)); - } + public void readParams(InputSerializedData stream, boolean exception) { + chats = Vector.deserializeLong(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(chats.get(a)); - } + Vector.serializeLong(stream, chats); } } public static class TL_inputPrivacyValueDisallowContacts extends InputPrivacyRule { public static final int constructor = 0xba52007; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -34302,8 +28808,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPrivacyValueAllowAll extends InputPrivacyRule { public static final int constructor = 0x184b35ce; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -34313,32 +28818,13 @@ public static class TL_inputPrivacyValueAllowUsers extends InputPrivacyRule { public ArrayList users = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputUser object = InputUser.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + users = Vector.deserialize(stream, InputUser::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, users); } } @@ -34347,35 +28833,20 @@ public static class TL_inputPrivacyValueDisallowChatParticipants extends InputPr public ArrayList chats = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - chats.add(stream.readInt64(exception)); - } + public void readParams(InputSerializedData stream, boolean exception) { + chats = Vector.deserializeLong(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(chats.get(a)); - } + Vector.serializeLong(stream, chats); } } public static class TL_inputPrivacyValueAllowCloseFriends extends InputPrivacyRule { public static final int constructor = 0x2f453e49; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -34383,7 +28854,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPrivacyValueAllowPremium extends InputPrivacyRule { public static final int constructor = 0x77cdc9f1; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -34391,7 +28862,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPrivacyValueAllowBots extends InputPrivacyRule { public static final int constructor = 0x5a4fcce5; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -34399,7 +28870,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPrivacyValueDisallowBots extends InputPrivacyRule { public static final int constructor = 0xc4e57915; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -34412,7 +28883,7 @@ public static class TL_maskCoords extends TLObject { public double y; public double zoom; - public static TL_maskCoords TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_maskCoords TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_maskCoords.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_maskCoords", constructor)); @@ -34425,14 +28896,14 @@ public static TL_maskCoords TLdeserialize(AbstractSerializedData stream, int con return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { n = stream.readInt32(exception); x = stream.readDouble(exception); y = stream.readDouble(exception); zoom = stream.readDouble(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(n); stream.writeDouble(x); @@ -34451,7 +28922,7 @@ public static class TL_messages_votesList extends TLObject { public ArrayList users = new ArrayList<>(); public String next_offset; - public static TL_messages_votesList TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_votesList TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_votesList.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_votesList", constructor)); @@ -34464,81 +28935,24 @@ public static TL_messages_votesList TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessagePeerVote object = MessagePeerVote.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - votes.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + votes = Vector.deserialize(stream, MessagePeerVote::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); if ((flags & 1) != 0) { next_offset = stream.readString(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = votes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - votes.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, votes); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); if ((flags & 1) != 0) { stream.writeString(next_offset); } @@ -34552,7 +28966,7 @@ public static class TL_highScore extends TLObject { public long user_id; public int score; - public static TL_highScore TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_highScore TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_highScore.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_highScore", constructor)); @@ -34565,13 +28979,13 @@ public static TL_highScore TLdeserialize(AbstractSerializedData stream, int cons return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { pos = stream.readInt32(exception); user_id = stream.readInt64(exception); score = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(pos); stream.writeInt64(user_id); @@ -34604,53 +29018,55 @@ public static abstract class InputMedia extends TLObject { public ArrayList attributes = new ArrayList<>(); public int proximity_notification_radius; public boolean spoiler; + public InputPhoto video_cover; + public int video_timestamp; - public static InputMedia TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputMedia TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputMedia result = null; switch (constructor) { - case 0xf8ab7dfb: + case TL_inputMediaContact.constructor: result = new TL_inputMediaContact(); break; - case 0x33473058: + case TL_inputMediaDocument.constructor: result = new TL_inputMediaDocument(); break; - case 0xd33f43f3: + case TL_inputMediaGame.constructor: result = new TL_inputMediaGame(); break; - case 0xe66fbf7b: + case TL_inputMediaDice.constructor: result = new TL_inputMediaDice(); break; - case 0xf9c44144: + case TL_inputMediaGeoPoint.constructor: result = new TL_inputMediaGeoPoint(); break; - case 0xfb52dc99: + case TL_inputMediaDocumentExternal.constructor: result = new TL_inputMediaDocumentExternal(); break; - case 0x9664f57f: + case TL_inputMediaEmpty.constructor: result = new TL_inputMediaEmpty(); break; - case 0xf94e5f1: + case TL_inputMediaPoll.constructor: result = new TL_inputMediaPoll(); break; - case 0x1e287d04: + case TL_inputMediaUploadedPhoto.constructor: result = new TL_inputMediaUploadedPhoto(); break; - case 0xc13d1c11: + case TL_inputMediaVenue.constructor: result = new TL_inputMediaVenue(); break; - case 0x971fa843: + case TL_inputMediaGeoLive.constructor: result = new TL_inputMediaGeoLive(); break; - case 0x5b38c6c1: + case TL_inputMediaUploadedDocument.constructor: result = new TL_inputMediaUploadedDocument(); break; - case 0xe5bbfe1a: + case TL_inputMediaPhotoExternal.constructor: result = new TL_inputMediaPhotoExternal(); break; - case 0xb3ba0635: + case TL_inputMediaPhoto.constructor: result = new TL_inputMediaPhoto(); break; - case 0xc21b8849: + case TL_inputMediaWebPage.constructor: result = new TL_inputMediaWebPage(); break; case TL_inputMediaPaidMedia_layer186.constructor: @@ -34673,14 +29089,14 @@ public static InputMedia TLdeserialize(AbstractSerializedData stream, int constr public static class TL_inputMediaContact extends InputMedia { public static final int constructor = 0xf8ab7dfb; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { phone_number = stream.readString(exception); first_name = stream.readString(exception); last_name = stream.readString(exception); vcard = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(phone_number); stream.writeString(first_name); @@ -34690,15 +29106,21 @@ public void serializeToStream(AbstractSerializedData stream) { } public static class TL_inputMediaDocument extends InputMedia { - public static final int constructor = 0x33473058; + public static final int constructor = 0xa8763ab5; public InputDocument id; public String query; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); spoiler = (flags & 4) != 0; id = InputDocument.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 8) != 0) { + video_cover = InputPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 16) != 0) { + video_timestamp = stream.readInt32(exception); + } if ((flags & 1) != 0) { ttl_seconds = stream.readInt32(exception); } @@ -34707,11 +29129,17 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = spoiler ? (flags | 4) : (flags &~ 4); stream.writeInt32(flags); id.serializeToStream(stream); + if ((flags & 8) != 0) { + video_cover.serializeToStream(stream); + } + if ((flags & 16) != 0) { + stream.writeInt32(video_timestamp); + } if ((flags & 1) != 0) { stream.writeInt32(ttl_seconds); } @@ -34726,11 +29154,11 @@ public static class TL_inputMediaGame extends InputMedia { public InputGame id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = InputGame.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); id.serializeToStream(stream); } @@ -34741,11 +29169,11 @@ public static class TL_inputMediaDice extends InputMedia { public String emoticon; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { emoticon = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(emoticon); } @@ -34754,32 +29182,37 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputMediaGeoPoint extends InputMedia { public static final int constructor = 0xf9c44144; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { geo_point = InputGeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); geo_point.serializeToStream(stream); } } public static class TL_inputMediaDocumentExternal extends InputMedia { - public static final int constructor = 0xfb52dc99; + public static final int constructor = 0x779600f9; public String url; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); spoiler = (flags & 2) != 0; url = stream.readString(exception); if ((flags & 1) != 0) { ttl_seconds = stream.readInt32(exception); } + if ((flags & 4) != 0) { + video_cover = InputPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 8) != 0) { + video_timestamp = stream.readInt32(exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = spoiler ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); @@ -34787,14 +29220,19 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 1) != 0) { stream.writeInt32(ttl_seconds); } + if ((flags & 4) != 0) { + video_cover.serializeToStream(stream); + } + if ((flags & 8) != 0) { + stream.writeInt32(video_timestamp); + } } } public static class TL_inputMediaEmpty extends InputMedia { public static final int constructor = 0x9664f57f; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -34807,7 +29245,7 @@ public static class TL_inputMediaPoll extends InputMedia { public String solution; public ArrayList solution_entities = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); poll = Poll.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 1) != 0) { @@ -34827,25 +29265,11 @@ public void readParams(AbstractSerializedData stream, boolean exception) { solution = stream.readString(exception); } if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - solution_entities.add(object); - } + solution_entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); poll.serializeToStream(stream); @@ -34861,12 +29285,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeString(solution); } if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = solution_entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - solution_entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, solution_entities); } } } @@ -34874,45 +29293,25 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputMediaUploadedPhoto extends InputMedia { public static final int constructor = 0x1e287d04; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); spoiler = (flags & 4) != 0; file = InputFile.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputDocument object = InputDocument.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - stickers.add(object); - } + stickers = Vector.deserialize(stream, InputDocument::TLdeserialize, exception); } if ((flags & 2) != 0) { ttl_seconds = stream.readInt32(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = spoiler ? (flags | 4) : (flags &~ 4); stream.writeInt32(flags); file.serializeToStream(stream); if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = stickers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stickers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, stickers); } if ((flags & 2) != 0) { stream.writeInt32(ttl_seconds); @@ -34923,8 +29322,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputMediaVenue extends InputMedia { public static final int constructor = 0xc13d1c11; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { geo_point = InputGeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); title = stream.readString(exception); address = stream.readString(exception); @@ -34933,7 +29331,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { venue_type = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); geo_point.serializeToStream(stream); stream.writeString(title); @@ -34947,8 +29345,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputMediaGeoLive extends InputMedia { public static final int constructor = 0x971fa843; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); stopped = (flags & 1) != 0; geo_point = InputGeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -34963,7 +29360,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = stopped ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -34981,10 +29378,9 @@ public void serializeToStream(AbstractSerializedData stream) { } public static class TL_inputMediaUploadedDocument extends InputMedia { - public static final int constructor = 0x5b38c6c1; + public static final int constructor = 0x37c9330; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); nosound_video = (flags & 8) != 0; force_file = (flags & 16) != 0; @@ -34994,44 +29390,22 @@ public void readParams(AbstractSerializedData stream, boolean exception) { thumb = InputFile.TLdeserialize(stream, stream.readInt32(exception), exception); } mime_type = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + attributes = Vector.deserialize(stream, DocumentAttribute::TLdeserialize, exception); + if ((flags & 1) != 0) { + stickers = Vector.deserialize(stream, InputDocument::TLdeserialize, exception); } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); + if ((flags & 64) != 0) { + video_cover = InputPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); } - if ((flags & 1) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputDocument object = InputDocument.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - stickers.add(object); - } + if ((flags & 128) != 0) { + video_timestamp = stream.readInt32(exception); } if ((flags & 2) != 0) { ttl_seconds = stream.readInt32(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = nosound_video ? (flags | 8) : (flags &~ 8); flags = force_file ? (flags | 16) : (flags &~ 16); @@ -35042,19 +29416,15 @@ public void serializeToStream(AbstractSerializedData stream) { thumb.serializeToStream(stream); } stream.writeString(mime_type); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } + Vector.serialize(stream, attributes); if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - count = stickers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stickers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, stickers); + } + if ((flags & 64) != 0) { + video_cover.serializeToStream(stream); + } + if ((flags & 128) != 0) { + stream.writeInt32(video_timestamp); } if ((flags & 2) != 0) { stream.writeInt32(ttl_seconds); @@ -35067,7 +29437,7 @@ public static class TL_inputMediaPhotoExternal extends InputMedia { public String url; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); spoiler = (flags & 2) != 0; url = stream.readString(exception); @@ -35076,7 +29446,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = spoiler ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); @@ -35095,7 +29465,7 @@ public static class TL_inputMediaWebPage extends InputMedia { public boolean force_small_media; public boolean optional; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); force_large_media = (flags & 1) != 0; force_small_media = (flags & 2) != 0; @@ -35103,7 +29473,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { url = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = force_large_media ? (flags | 1) : (flags &~ 1); flags = force_small_media ? (flags | 2) : (flags &~ 2); @@ -35121,39 +29491,20 @@ public static class TL_inputMediaPaidMedia extends InputMedia { public ArrayList extended_media = new ArrayList<>(); public String payload; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); stars_amount = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputMedia object = InputMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - extended_media.add(object); - } + extended_media = Vector.deserialize(stream, InputMedia::TLdeserialize, exception); if ((flags & 1) != 0) { payload = stream.readString(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(stars_amount); - stream.writeInt32(0x1cb5c415); - int count = extended_media.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - extended_media.get(a).serializeToStream(stream); - } + Vector.serialize(stream, extended_media); if ((flags & 1) != 0) { stream.writeString(payload); } @@ -35166,34 +29517,15 @@ public static class TL_inputMediaPaidMedia_layer186 extends TL_inputMediaPaidMed public long stars_amount; public ArrayList extended_media = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { stars_amount = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputMedia object = InputMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - extended_media.add(object); - } + extended_media = Vector.deserialize(stream, InputMedia::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(stars_amount); - stream.writeInt32(0x1cb5c415); - int count = extended_media.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - extended_media.get(a).serializeToStream(stream); - } + Vector.serialize(stream, extended_media); } } @@ -35202,7 +29534,7 @@ public static class TL_inputMediaPhoto extends InputMedia { public InputPhoto id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); spoiler = (flags & 2) != 0; id = InputPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -35211,7 +29543,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = spoiler ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); @@ -35227,7 +29559,7 @@ public static abstract class StickerSetCovered extends TLObject { public ArrayList covers = new ArrayList<>(); public Document cover; - public static StickerSetCovered TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static StickerSetCovered TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { StickerSetCovered result = null; switch (constructor) { case 0x3407e51b: @@ -35259,35 +29591,15 @@ public static StickerSetCovered TLdeserialize(AbstractSerializedData stream, int public static class TL_stickerSetMultiCovered extends StickerSetCovered { public static final int constructor = 0x3407e51b; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { set = StickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - covers.add(object); - } + covers = Vector.deserialize(stream, Document::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); set.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = covers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - covers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, covers); } } @@ -35297,7 +29609,7 @@ public static class TL_stickerKeyword extends TLObject { public long document_id; public ArrayList keyword = new ArrayList<>(); - public static TL_stickerKeyword TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_stickerKeyword TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_stickerKeyword.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_stickerKeyword", constructor)); @@ -35310,96 +29622,43 @@ public static TL_stickerKeyword TLdeserialize(AbstractSerializedData stream, int return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { document_id = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - keyword.add(stream.readString(exception)); - } + keyword = Vector.deserializeString(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(document_id); - stream.writeInt32(0x1cb5c415); - int count = keyword.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(keyword.get(a)); - } + Vector.serializeString(stream, keyword); } } public static class TL_stickerSetFullCovered_layer146 extends TL_stickerSetFullCovered { public static final int constructor = 0x1aed5ee5; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { set = StickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_stickerPack object = TL_stickerPack.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - packs.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - documents.add(object); - } + packs = Vector.deserialize(stream, TL_stickerPack::TLdeserialize, exception); + documents = Vector.deserialize(stream, Document::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); set.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = packs.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - packs.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = documents.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - documents.get(a).serializeToStream(stream); - } + Vector.serialize(stream, packs); + Vector.serialize(stream, documents); } } public static class TL_stickerSetNoCovered extends StickerSetCovered { public static final int constructor = 0x77b15d1c; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { set = StickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); set.serializeToStream(stream); } @@ -35412,89 +29671,31 @@ public static class TL_stickerSetFullCovered extends StickerSetCovered { public ArrayList keywords = new ArrayList<>(); public ArrayList documents = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { set = StickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_stickerPack object = TL_stickerPack.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - packs.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_stickerKeyword object = TL_stickerKeyword.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - keywords.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - documents.add(object); - } + packs = Vector.deserialize(stream, TL_stickerPack::TLdeserialize, exception); + keywords = Vector.deserialize(stream, TL_stickerKeyword::TLdeserialize, exception); + documents = Vector.deserialize(stream, Document::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); set.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = packs.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - packs.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = keywords.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - keywords.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = documents.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - documents.get(a).serializeToStream(stream); - } + Vector.serialize(stream, packs); + Vector.serialize(stream, keywords); + Vector.serialize(stream, documents); } } public static class TL_stickerSetCovered extends StickerSetCovered { public static final int constructor = 0x6410a5d2; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { set = StickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); cover = Document.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); set.serializeToStream(stream); cover.serializeToStream(stream); @@ -35508,7 +29709,7 @@ public static abstract class EncryptedMessage extends TLObject { public byte[] bytes; public EncryptedFile file; - public static EncryptedMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static EncryptedMessage TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { EncryptedMessage result = null; switch (constructor) { case 0x23734b06: @@ -35531,15 +29732,14 @@ public static EncryptedMessage TLdeserialize(AbstractSerializedData stream, int public static class TL_encryptedMessageService extends EncryptedMessage { public static final int constructor = 0x23734b06; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { random_id = stream.readInt64(exception); chat_id = stream.readInt32(exception); date = stream.readInt32(exception); bytes = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(random_id); stream.writeInt32(chat_id); @@ -35551,8 +29751,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_encryptedMessage extends EncryptedMessage { public static final int constructor = 0xed18c118; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { random_id = stream.readInt64(exception); chat_id = stream.readInt32(exception); date = stream.readInt32(exception); @@ -35560,7 +29759,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { file = EncryptedFile.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(random_id); stream.writeInt32(chat_id); @@ -35576,7 +29775,7 @@ public static abstract class InputStickerSet extends TLObject { public long access_hash; public String short_name; - public static InputStickerSet TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputStickerSet TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputStickerSet result = null; switch (constructor) { case 0xffb62b95: @@ -35623,8 +29822,7 @@ public static InputStickerSet TLdeserialize(AbstractSerializedData stream, int c public static class TL_inputStickerSetPremiumGifts extends InputStickerSet { public static final int constructor = 0xc88b3b02; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -35632,8 +29830,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputStickerSetEmojiChannelDefaultStatuses extends InputStickerSet { public static final int constructor = 0x49748553; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -35641,8 +29838,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputStickerSetEmojiDefaultStatuses extends InputStickerSet { public static final int constructor = 0x29d0f5ee; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -35652,11 +29848,11 @@ public static class TL_inputStickerSetDice extends InputStickerSet { public String emoticon; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { emoticon = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(emoticon); } @@ -35665,8 +29861,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputStickerSetEmpty extends InputStickerSet { public static final int constructor = 0xffb62b95; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -35674,13 +29869,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputStickerSetID extends InputStickerSet { public static final int constructor = 0x9de7a269; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -35690,12 +29884,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputStickerSetShortName extends InputStickerSet { public static final int constructor = 0x861cc8a0; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { short_name = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(short_name); } @@ -35704,8 +29897,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputStickerSetAnimatedEmoji extends InputStickerSet { public static final int constructor = 0x28703c8; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -35713,8 +29905,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputStickerSetEmojiGenericAnimations extends InputStickerSet { public static final int constructor = 0x4c4d4ce; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -35722,8 +29913,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputStickerSetEmojiDefaultTopicIcons extends InputStickerSet { public static final int constructor = 0x44c1f8e9; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -35752,7 +29942,7 @@ public static class TL_channelAdminLogEventsFilter extends TLObject { public boolean forums; public boolean sub_extend; - public static TL_channelAdminLogEventsFilter TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_channelAdminLogEventsFilter TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_channelAdminLogEventsFilter.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_channelAdminLogEventsFilter", constructor)); @@ -35765,7 +29955,7 @@ public static TL_channelAdminLogEventsFilter TLdeserialize(AbstractSerializedDat return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); join = (flags & 1) != 0; leave = (flags & 2) != 0; @@ -35788,7 +29978,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { sub_extend = (flags & 262144) != 0; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = join ? (flags | 1) : (flags &~ 1); flags = leave ? (flags | 2) : (flags &~ 2); @@ -35818,7 +30008,7 @@ public static abstract class UserStatus extends TLObject { public int expires; public boolean by_me; - public static UserStatus TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static UserStatus TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { UserStatus result = null; switch (constructor) { case 0x8c703f: @@ -35865,12 +30055,11 @@ public static UserStatus TLdeserialize(AbstractSerializedData stream, int constr public static class TL_userStatusHidden extends UserStatus { public static final int constructor = 0xcf7d64b1; + public void readParams(InputSerializedData stream, boolean exception) { - public void readParams(AbstractSerializedData stream, boolean exception) { - } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -35878,12 +30067,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userStatusOffline extends UserStatus { public static final int constructor = 0x8c703f; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { expires = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(expires); } @@ -35893,28 +30081,27 @@ public static class TL_userStatusLastWeek extends UserStatus { public static final int constructor = 0x541a1d1a; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); by_me = (flags & 1) != 0; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = by_me ? flags | 1 : flags &~ 1; stream.writeInt32(flags); } } - public static class TL_userStatusLastWeek_layer171 extends TL_userStatusLastWeek { public static final int constructor = 0x7bf09fc; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -35922,8 +30109,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userStatusEmpty extends UserStatus { public static final int constructor = 0x9d05049; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -35932,12 +30118,12 @@ public static class TL_userStatusLastMonth extends UserStatus { public static final int constructor = 0x65899777; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); by_me = (flags & 1) != 0; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = by_me ? flags | 1 : flags &~ 1; stream.writeInt32(flags); @@ -35948,11 +30134,11 @@ public static class TL_userStatusLastMonth_layer171 extends TL_userStatusLastMon public static final int constructor = 0x77ebc742; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -35960,12 +30146,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userStatusOnline extends UserStatus { public static final int constructor = 0xedb93949; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { expires = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(expires); } @@ -35975,12 +30160,12 @@ public static class TL_userStatusRecently extends UserStatus { public static final int constructor = 0x7b197dc8; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); by_me = (flags & 1) != 0; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = by_me ? flags | 1 : flags &~ 1; stream.writeInt32(flags); @@ -35991,11 +30176,11 @@ public static class TL_userStatusRecently_layer171 extends TL_userStatusRecently public static final int constructor = 0xe26f42f1; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -36007,7 +30192,7 @@ public static class TL_messages_peerSettings extends TLObject { public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_messages_peerSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_peerSettings TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_peerSettings.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_peerSettings", constructor)); @@ -36020,55 +30205,17 @@ public static TL_messages_peerSettings TLdeserialize(AbstractSerializedData stre return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { settings = PeerSettings.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); settings.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } @@ -36077,7 +30224,7 @@ public static class TL_messages_checkedHistoryImportPeer extends TLObject { public String confirm_text; - public static TL_messages_checkedHistoryImportPeer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_checkedHistoryImportPeer TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_checkedHistoryImportPeer.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_checkedHistoryImportPeer", constructor)); @@ -36090,11 +30237,11 @@ public static TL_messages_checkedHistoryImportPeer TLdeserialize(AbstractSeriali return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { confirm_text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(confirm_text); } @@ -36106,7 +30253,7 @@ public static class TL_messages_messageEditData extends TLObject { public int flags; public boolean caption; - public static TL_messages_messageEditData TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_messageEditData TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_messageEditData.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_messageEditData", constructor)); @@ -36119,12 +30266,12 @@ public static TL_messages_messageEditData TLdeserialize(AbstractSerializedData s return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); caption = (flags & 1) != 0; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = caption ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -36136,7 +30283,7 @@ public static abstract class MessagePeerVote extends TLObject { public Peer peer; int date; - public static MessagePeerVote TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static MessagePeerVote TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { MessagePeerVote result = null; switch (constructor) { case 0x4628f6e6: @@ -36164,7 +30311,7 @@ public static class TL_messagePeerVoteMultiple extends MessagePeerVote { public ArrayList options = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); int magic = stream.readInt32(exception); if (magic != 0x1cb5c415) { @@ -36180,7 +30327,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(0x1cb5c415); @@ -36198,13 +30345,13 @@ public static class TL_messagePeerVote extends MessagePeerVote { public byte[] option; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); option = stream.readByteArray(exception); date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeByteArray(option); @@ -36215,13 +30362,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messagePeerVoteInputOption extends MessagePeerVote { public static final int constructor = 0x74cda504; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(date); @@ -36236,7 +30382,7 @@ public static class TL_contacts_importedContacts extends TLObject { public ArrayList retry_contacts = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_contacts_importedContacts TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_contacts_importedContacts TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_contacts_importedContacts.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_contacts_importedContacts", constructor)); @@ -36249,91 +30395,19 @@ public static TL_contacts_importedContacts TLdeserialize(AbstractSerializedData return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_importedContact object = TL_importedContact.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - imported.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_popularContact object = TL_popularContact.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - popular_invites.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - retry_contacts.add(stream.readInt64(exception)); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + imported = Vector.deserialize(stream, TL_importedContact::TLdeserialize, exception); + popular_invites = Vector.deserialize(stream, TL_popularContact::TLdeserialize, exception); + retry_contacts = Vector.deserializeLong(stream, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = imported.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - imported.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = popular_invites.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - popular_invites.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = retry_contacts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(retry_contacts.get(a)); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, imported); + Vector.serialize(stream, popular_invites); + Vector.serializeLong(stream, retry_contacts); + Vector.serialize(stream, users); } } @@ -36343,7 +30417,7 @@ public static class TL_dialogFilterSuggested extends TLObject { public DialogFilter filter; public String description; - public static TL_dialogFilterSuggested TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_dialogFilterSuggested TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_dialogFilterSuggested.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_dialogFilterSuggested", constructor)); @@ -36356,12 +30430,12 @@ public static TL_dialogFilterSuggested TLdeserialize(AbstractSerializedData stre return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { filter = DialogFilter.TLdeserialize(stream, stream.readInt32(exception), exception); description = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); filter.serializeToStream(stream); stream.writeString(description); @@ -36374,7 +30448,7 @@ public static class TL_inlineBotSwitchPM extends TLObject { public String text; public String start_param; - public static TL_inlineBotSwitchPM TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_inlineBotSwitchPM TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_inlineBotSwitchPM.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_inlineBotSwitchPM", constructor)); @@ -36387,12 +30461,12 @@ public static TL_inlineBotSwitchPM TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = stream.readString(exception); start_param = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(text); stream.writeString(start_param); @@ -36402,7 +30476,7 @@ public void serializeToStream(AbstractSerializedData stream) { @Keep public static abstract class Update extends TLObject { - public static Update TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static Update TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { Update result = null; switch (constructor) { case TL_updateMessagePollVote.constructor: @@ -36793,7 +30867,7 @@ public static class TL_updateMessagePollVote extends Update { public ArrayList options = new ArrayList<>(); public int qts; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { poll_id = stream.readInt64(exception); peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); int magic = stream.readInt32(exception); @@ -36810,7 +30884,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { qts = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(poll_id); peer.serializeToStream(stream); @@ -36832,14 +30906,14 @@ public static class TL_updateMoveStickerSetToTop extends Update { public boolean emojis; public long stickerset; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); masks = (flags & 1) != 0; emojis = (flags & 2) != 0; stickerset = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = masks ? (flags | 1) : (flags &~ 1); flags = emojis ? (flags | 2) : (flags &~ 2); @@ -36855,36 +30929,17 @@ public static class TL_updateMessageExtendedMedia extends Update { public int msg_id; public ArrayList extended_media = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); msg_id = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageExtendedMedia object = MessageExtendedMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - extended_media.add(object); - } + extended_media = Vector.deserialize(stream, MessageExtendedMedia::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(msg_id); - stream.writeInt32(0x1cb5c415); - int count = extended_media.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - extended_media.get(a).serializeToStream(stream); - } + Vector.serialize(stream, extended_media); } } @@ -36896,7 +30951,7 @@ public static class TL_updateMessagePoll extends Update { public Poll poll; public PollResults results; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); poll_id = stream.readInt64(exception); if ((flags & 1) != 0) { @@ -36905,7 +30960,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { results = PollResults.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(poll_id); @@ -36923,7 +30978,7 @@ public static class TL_updatePeerHistoryTTL extends Update { public Peer peer; public int ttl_period; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 1) != 0) { @@ -36931,7 +30986,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); peer.serializeToStream(stream); @@ -36946,11 +31001,11 @@ public static class TL_updateChat extends Update { public long chat_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { chat_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(chat_id); } @@ -36963,30 +31018,15 @@ public static class TL_updateDeleteMessages extends Update { public int pts; public int pts_count; - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - messages.add(stream.readInt32(exception)); - } + public void readParams(InputSerializedData stream, boolean exception) { + messages = Vector.deserializeInt(stream, exception); pts = stream.readInt32(exception); pts_count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(messages.get(a)); - } + Vector.serializeInt(stream, messages); stream.writeInt32(pts); stream.writeInt32(pts_count); } @@ -37002,36 +31042,21 @@ public static class TL_updatePinnedChannelMessages extends Update { public int pts; public int pts_count; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); pinned = (flags & 1) != 0; channel_id = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - messages.add(stream.readInt32(exception)); - } + messages = Vector.deserializeInt(stream, exception); pts = stream.readInt32(exception); pts_count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = pinned ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); stream.writeInt64(channel_id); - stream.writeInt32(0x1cb5c415); - int count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(messages.get(a)); - } + Vector.serializeInt(stream, messages); stream.writeInt32(pts); stream.writeInt32(pts_count); } @@ -37044,35 +31069,16 @@ public static class TL_updateGroupCallParticipants extends Update { public ArrayList participants = new ArrayList<>(); public int version; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { call = TL_inputGroupCall.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_groupCallParticipant object = TL_groupCallParticipant.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - participants.add(object); - } + participants = Vector.deserialize(stream, TL_groupCallParticipant::TLdeserialize, exception); version = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); call.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = participants.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - participants.get(a).serializeToStream(stream); - } + Vector.serialize(stream, participants); stream.writeInt32(version); } } @@ -37080,8 +31086,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_updateReadFeaturedStickers extends Update { public static final int constructor = 0x571d2742; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -37091,11 +31096,11 @@ public static class TL_updateEncryptedChatTyping extends Update { public int chat_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { chat_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(chat_id); } @@ -37111,7 +31116,7 @@ public static class TL_updateReadChannelDiscussionInbox extends Update { public long broadcast_id; public int broadcast_post; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); channel_id = stream.readInt64(exception); top_msg_id = stream.readInt32(exception); @@ -37124,7 +31129,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(channel_id); @@ -37147,14 +31152,14 @@ public static class TL_updateReadHistoryOutbox extends Update { public int pts; public int pts_count; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); max_id = stream.readInt32(exception); pts = stream.readInt32(exception); pts_count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(max_id); @@ -37170,13 +31175,13 @@ public static class TL_updateNewChannelMessage extends Update { public int pts; public int pts_count; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { message = Message.TLdeserialize(stream, stream.readInt32(exception), exception); pts = stream.readInt32(exception); pts_count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); message.serializeToStream(stream); stream.writeInt32(pts); @@ -37192,7 +31197,7 @@ public static class TL_updateDialogPinned extends Update { public int folder_id; public DialogPeer peer; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); pinned = (flags & 1) != 0; if ((flags & 2) != 0) { @@ -37201,7 +31206,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { peer = DialogPeer.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = pinned ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -37218,12 +31223,12 @@ public static class TL_updatePeerSettings extends Update { public Peer peer; public PeerSettings settings; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); settings = PeerSettings.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); settings.serializeToStream(stream); @@ -37236,12 +31241,12 @@ public static class TL_updateUserPhone extends Update { public long user_id; public String phone; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); phone = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); stream.writeString(phone); @@ -37254,12 +31259,12 @@ public static class TL_updateMessageID extends Update { public int id; public long random_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); random_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(id); stream.writeInt64(random_id); @@ -37272,12 +31277,12 @@ public static class TL_updateReadChannelOutbox extends Update { public long channel_id; public int max_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { channel_id = stream.readInt64(exception); max_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(channel_id); stream.writeInt32(max_id); @@ -37293,7 +31298,7 @@ public static class TL_updateChannelUserTyping extends Update { public Peer from_id; public SendMessageAction action; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); channel_id = stream.readInt64(exception); if ((flags & 1) != 0) { @@ -37303,7 +31308,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { action = SendMessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(channel_id); @@ -37321,12 +31326,12 @@ public static class TL_updateStoryID extends Update { public int id; public long random_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); random_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(id); stream.writeInt64(random_id); @@ -37340,13 +31345,13 @@ public static class TL_updateStickerSets extends Update { public boolean masks; public boolean emojis; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); masks = (flags & 1) != 0; emojis = (flags & 2) != 0; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = masks ? (flags | 1) : (flags &~ 1); flags = emojis ? (flags | 2) : (flags &~ 2); @@ -37361,34 +31366,15 @@ public static class TL_updateFolderPeers extends Update { public int pts; public int pts_count; - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_folderPeer object = TL_folderPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - folder_peers.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + folder_peers = Vector.deserialize(stream, TL_folderPeer::TLdeserialize, exception); pts = stream.readInt32(exception); pts_count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = folder_peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - folder_peers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, folder_peers); stream.writeInt32(pts); stream.writeInt32(pts_count); } @@ -37401,13 +31387,13 @@ public static class TL_updateNewMessage extends Update { public int pts; public int pts_count; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { message = Message.TLdeserialize(stream, stream.readInt32(exception), exception); pts = stream.readInt32(exception); pts_count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); message.serializeToStream(stream); stream.writeInt32(pts); @@ -37420,11 +31406,11 @@ public static class TL_updateNewScheduledMessage extends Update { public Message message; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { message = Message.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); message.serializeToStream(stream); } @@ -37436,12 +31422,12 @@ public static class TL_updateNewEncryptedMessage extends Update { public EncryptedMessage message; public int qts; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { message = EncryptedMessage.TLdeserialize(stream, stream.readInt32(exception), exception); qts = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); message.serializeToStream(stream); stream.writeInt32(qts); @@ -37454,12 +31440,12 @@ public static class TL_updateUserStatus extends Update { public long user_id; public UserStatus status; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); status = UserStatus.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); status.serializeToStream(stream); @@ -37473,13 +31459,13 @@ public static class TL_updateChannelMessageViews extends Update { public int id; public int views; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { channel_id = stream.readInt64(exception); id = stream.readInt32(exception); views = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(channel_id); stream.writeInt32(id); @@ -37494,13 +31480,13 @@ public static class TL_updateGroupCallConnection extends Update { public boolean presentation; public TL_dataJSON params; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); presentation = (flags & 1) != 0; params = TL_dataJSON.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = presentation ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -37515,36 +31501,17 @@ public static class TL_updateBotCommands extends Update { public long bot_id; public ArrayList commands = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); bot_id = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_botCommand object = TL_botCommand.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - commands.add(object); - } + commands = Vector.deserialize(stream, TL_botCommand::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt64(bot_id); - stream.writeInt32(0x1cb5c415); - int count = commands.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - commands.get(a).serializeToStream(stream); - } + Vector.serialize(stream, commands); } } @@ -37554,12 +31521,12 @@ public static class TL_updateGeoLiveViewed extends Update { public Peer peer; public int msg_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); msg_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(msg_id); @@ -37572,12 +31539,12 @@ public static class TL_updateNotifySettings extends Update { public NotifyPeer peer; public PeerNotifySettings notify_settings; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = NotifyPeer.TLdeserialize(stream, stream.readInt32(exception), exception); notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); notify_settings.serializeToStream(stream); @@ -37598,7 +31565,7 @@ public static class TL_updateChannelParticipant extends Update { public int qts; public boolean via_chatlist; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); channel_id = stream.readInt64(exception); date = stream.readInt32(exception); @@ -37617,7 +31584,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { qts = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = via_chatlist ? (flags | 8) : (flags & 8); stream.writeInt32(flags); @@ -37645,13 +31612,13 @@ public static class TL_updateReadChannelDiscussionOutbox extends Update { public int top_msg_id; public int read_max_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { channel_id = stream.readInt64(exception); top_msg_id = stream.readInt32(exception); read_max_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(channel_id); stream.writeInt32(top_msg_id); @@ -37666,13 +31633,13 @@ public static class TL_updateChatParticipantDelete extends Update { public long user_id; public int version; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { chat_id = stream.readInt64(exception); user_id = stream.readInt64(exception); version = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(chat_id); stream.writeInt64(user_id); @@ -37687,13 +31654,13 @@ public static class TL_updateEditMessage extends Update { public int pts; public int pts_count; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { message = Message.TLdeserialize(stream, stream.readInt32(exception), exception); pts = stream.readInt32(exception); pts_count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); message.serializeToStream(stream); stream.writeInt32(pts); @@ -37704,7 +31671,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_updateRecentReactions extends Update { public static final int constructor = 0x6f7863f4; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -37712,7 +31679,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_updateSavedReactionTags extends Update { public static final int constructor = 0x39c67432; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -37724,13 +31691,13 @@ public static class TL_updateWebPage extends Update { public int pts; public int pts_count; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { webpage = WebPage.TLdeserialize(stream, stream.readInt32(exception), exception); pts = stream.readInt32(exception); pts_count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); webpage.serializeToStream(stream); stream.writeInt32(pts); @@ -37741,8 +31708,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_updateFavedStickers extends Update { public static final int constructor = 0xe511996d; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -37756,7 +31722,7 @@ public static class TL_updateChatParticipantAdd extends Update { public int date; public int version; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { chat_id = stream.readInt64(exception); user_id = stream.readInt64(exception); inviter_id = stream.readInt64(exception); @@ -37764,7 +31730,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { version = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(chat_id); stream.writeInt64(user_id); @@ -37781,13 +31747,13 @@ public static class TL_updateChatUserTyping extends Update { public Peer from_id; public SendMessageAction action; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { chat_id = stream.readInt64(exception); from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); action = SendMessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(chat_id); from_id.serializeToStream(stream); @@ -37798,8 +31764,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_updateLoginToken extends Update { public static final int constructor = 0x564fe691; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -37810,12 +31775,12 @@ public static class TL_updateEncryption extends Update { public EncryptedChat chat; public int date; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { chat = EncryptedChat.TLdeserialize(stream, stream.readInt32(exception), exception); date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); chat.serializeToStream(stream); stream.writeInt32(date); @@ -37823,19 +31788,26 @@ public void serializeToStream(AbstractSerializedData stream) { } public static class TL_updateGroupCall extends Update { - public static final int constructor = 0x14b24500; + public static final int constructor = 0x97d64341; + public int flags; public long chat_id; public GroupCall call; - public void readParams(AbstractSerializedData stream, boolean exception) { - chat_id = stream.readInt64(exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + if ((flags & 1) != 0) { + chat_id = stream.readInt64(exception); + } call = GroupCall.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(chat_id); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + stream.writeInt64(chat_id); + } call.serializeToStream(stream); } } @@ -37847,7 +31819,7 @@ public static class TL_updateChannelTooLong extends Update { public long channel_id; public int pts; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); channel_id = stream.readInt64(exception); if ((flags & 1) != 0) { @@ -37855,7 +31827,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(channel_id); @@ -37871,12 +31843,12 @@ public static class TL_updateUserTyping extends Update { public long user_id; public SendMessageAction action; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); action = SendMessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); action.serializeToStream(stream); @@ -37895,7 +31867,7 @@ public static class TL_updateServiceNotification extends Update { public ArrayList entities = new ArrayList<>(); public boolean invert_media; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); popup = (flags & 1) != 0; if ((flags & 2) != 0) { @@ -37905,24 +31877,10 @@ public void readParams(AbstractSerializedData stream, boolean exception) { type = stream.readString(exception); message = stream.readString(exception); media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = popup ? (flags | 1) : (flags &~ 1); flags = invert_media ? (flags | 4) : (flags &~ 4); @@ -37933,19 +31891,14 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeString(type); stream.writeString(message); media.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } } public static class TL_updateSavedRingtones extends Update { public static final int constructor = 0x74d8be99; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -37960,7 +31913,7 @@ public static class TL_updateTranscribedAudio extends Update { public long transcription_id; public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); pending = (flags & 1) != 0; peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -37969,7 +31922,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = pending ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -37986,12 +31939,12 @@ public static class TL_updateUserEmojiStatus extends Update { public long user_id; public EmojiStatus emoji_status; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); emoji_status = EmojiStatus.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); emoji_status.serializeToStream(stream); @@ -38003,11 +31956,11 @@ public static class TL_updateLangPack extends Update { public TL_langPackDifference difference; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { difference = TL_langPackDifference.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); difference.serializeToStream(stream); } @@ -38019,12 +31972,12 @@ public static class TL_updateChannelAvailableMessages extends Update { public long channel_id; public int available_min_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { channel_id = stream.readInt64(exception); available_min_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(channel_id); stream.writeInt32(available_min_id); @@ -38039,14 +31992,14 @@ public static class TL_updateChatParticipantAdmin extends Update { public boolean is_admin; public int version; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { chat_id = stream.readInt64(exception); user_id = stream.readInt64(exception); is_admin = stream.readBool(exception); version = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(chat_id); stream.writeInt64(user_id); @@ -38063,38 +32016,23 @@ public static class TL_updateChannelReadMessagesContents extends Update { public int top_msg_id; public ArrayList messages = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); channel_id = stream.readInt64(exception); if ((flags & 1) != 0) { top_msg_id = stream.readInt32(exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - messages.add(stream.readInt32(exception)); - } + messages = Vector.deserializeInt(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(channel_id); if ((flags & 1) != 0) { stream.writeInt32(top_msg_id); } - stream.writeInt32(0x1cb5c415); - int count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(messages.get(a)); - } + Vector.serializeInt(stream, messages); } } @@ -38104,42 +32042,22 @@ public static class TL_updatePrivacy extends Update { public PrivacyKey key; public ArrayList rules = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { key = PrivacyKey.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PrivacyRule object = PrivacyRule.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - rules.add(object); - } + rules = Vector.deserialize(stream, PrivacyRule::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); key.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = rules.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - rules.get(a).serializeToStream(stream); - } + Vector.serialize(stream, rules); } } public static class TL_updateConfig extends Update { public static final int constructor = 0xa229dd06; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -38151,13 +32069,13 @@ public static class TL_updateDialogUnreadMark extends Update { public boolean unread; public DialogPeer peer; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); unread = (flags & 1) != 0; peer = DialogPeer.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = unread ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -38173,7 +32091,7 @@ public static class TL_updateDraftMessage extends Update { public int top_msg_id; public DraftMessage draft; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 1) != 0) { @@ -38182,7 +32100,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { draft = DraftMessage.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); peer.serializeToStream(stream); @@ -38203,7 +32121,7 @@ public static class TL_updateNewAuthorization extends Update { public String device; public String location; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); unconfirmed = (flags & 1) != 0; hash = stream.readInt64(exception); @@ -38223,38 +32141,19 @@ public static class TL_updateUserName extends Update { public String last_name; public ArrayList usernames = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); first_name = stream.readString(exception); last_name = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_username object = TL_username.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - usernames.add(object); - } + usernames = Vector.deserialize(stream, TL_username::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); stream.writeString(first_name); stream.writeString(last_name); - stream.writeInt32(0x1cb5c415); - int count = usernames.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - usernames.get(a).serializeToStream(stream); - } + Vector.serialize(stream, usernames); } } @@ -38268,7 +32167,7 @@ public static class TL_updateMessageReactions extends Update { public TL_messageReactions reactions; public boolean updateUnreadState = true; //custom - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); msg_id = stream.readInt32(exception); @@ -38278,7 +32177,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { reactions = MessageReactions.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); peer.serializeToStream(stream); @@ -38293,13 +32192,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_updatePhoneCall extends Update { public static final int constructor = 0xab0f6b1e; - public PhoneCall phone_call; + public TL_phone.PhoneCall phone_call; - public void readParams(AbstractSerializedData stream, boolean exception) { - phone_call = PhoneCall.TLdeserialize(stream, stream.readInt32(exception), exception); + public void readParams(InputSerializedData stream, boolean exception) { + phone_call = TL_phone.PhoneCall.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); phone_call.serializeToStream(stream); } @@ -38312,7 +32211,7 @@ public static class TL_updateDialogFilter extends Update { public int id; public DialogFilter filter; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); id = stream.readInt32(exception); if ((flags & 1) != 0) { @@ -38320,7 +32219,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32(id); @@ -38338,14 +32237,14 @@ public static class TL_updatePeerBlocked extends Update { public boolean blocked_my_stories_from; public Peer peer_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blocked = (flags & 1) != 0; blocked_my_stories_from = (flags & 2) != 0; peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blocked ? (flags | 1) : (flags &~ 1); flags = blocked_my_stories_from ? (flags | 2) : (flags &~ 2); @@ -38364,36 +32263,21 @@ public static class TL_updatePinnedMessages extends Update { public int pts; public int pts_count; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); pinned = (flags & 1) != 0; peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - messages.add(stream.readInt32(exception)); - } + messages = Vector.deserializeInt(stream, exception); pts = stream.readInt32(exception); pts_count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = pinned ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); peer.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(messages.get(a)); - } + Vector.serializeInt(stream, messages); stream.writeInt32(pts); stream.writeInt32(pts_count); } @@ -38405,12 +32289,12 @@ public static class TL_updatePhoneCallSignalingData extends Update { public long phone_call_id; public byte[] data; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { phone_call_id = stream.readInt64(exception); data = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(phone_call_id); stream.writeByteArray(data); @@ -38425,14 +32309,14 @@ public static class TL_updateTranscribeAudio extends Update { public long transcription_id; public String text; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); isFinal = (flags & 1) != 0; transcription_id = stream.readInt64(exception); text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = isFinal ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -38448,43 +32332,24 @@ public static class TL_updatePinnedDialogs extends Update { public int folder_id; public ArrayList order = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 2) != 0) { folder_id = stream.readInt32(exception); } if ((flags & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DialogPeer object = DialogPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - order.add(object); - } + order = Vector.deserialize(stream, DialogPeer::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 2) != 0) { stream.writeInt32(folder_id); } if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = order.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - order.get(a).serializeToStream(stream); - } + Vector.serialize(stream, order); } } } @@ -38494,40 +32359,20 @@ public static class TL_updatePeerLocated extends Update { public ArrayList peers = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PeerLocated object = PeerLocated.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - peers.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + peers = Vector.deserialize(stream, PeerLocated::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - peers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, peers); } } public static class TL_updateRecentStickers extends Update { public static final int constructor = 0x9a422c20; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -38543,7 +32388,7 @@ public static class TL_updateReadHistoryInbox extends Update { public int pts; public int pts_count; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { folder_id = stream.readInt32(exception); @@ -38555,7 +32400,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { pts_count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -38574,36 +32419,20 @@ public static class TL_updateDialogFilterOrder extends Update { public ArrayList order = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - order.add(stream.readInt32(exception)); - } + public void readParams(InputSerializedData stream, boolean exception) { + order = Vector.deserializeInt(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = order.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(order.get(a)); - } + Vector.serializeInt(stream, order); } } public static class TL_updateSavedGifs extends Update { public static final int constructor = 0x9375341e; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -38611,8 +32440,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_updateContactsReset extends Update { public static final int constructor = 0x7084a7be; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -38622,11 +32450,11 @@ public static class TL_updateChannel extends Update { public long channel_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { channel_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(channel_id); } @@ -38640,14 +32468,14 @@ public static class TL_updateChannelWebPage extends Update { public int pts; public int pts_count; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { channel_id = stream.readInt64(exception); webpage = WebPage.TLdeserialize(stream, stream.readInt32(exception), exception); pts = stream.readInt32(exception); pts_count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(channel_id); webpage.serializeToStream(stream); @@ -38664,52 +32492,22 @@ public static class TL_updateDeleteScheduledMessages extends Update { public ArrayList messages = new ArrayList<>(); public ArrayList sent_messages = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - messages.add(stream.readInt32(exception)); - } + messages = Vector.deserializeInt(stream, exception); if ((flags & 1) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - sent_messages.add(stream.readInt32(exception)); - } + sent_messages = Vector.deserializeInt(stream, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); peer.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(messages.get(a)); - } + Vector.serializeInt(stream, messages); if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - count = sent_messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(sent_messages.get(a)); - } + Vector.serializeInt(stream, sent_messages); } } } @@ -38721,13 +32519,13 @@ public static class TL_updateSentStoryReaction extends Update { public int story_id; public Reaction reaction; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); story_id = stream.readInt32(exception); reaction = Reaction.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(story_id); @@ -38742,13 +32540,13 @@ public static class TL_updateChannelMessageForwards extends Update { public int id; public int forwards; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { channel_id = stream.readInt64(exception); id = stream.readInt32(exception); forwards = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(channel_id); stream.writeInt32(id); @@ -38764,32 +32562,17 @@ public static class TL_updateDeleteChannelMessages extends Update { public int pts; public int pts_count; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { channel_id = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - messages.add(stream.readInt32(exception)); - } + messages = Vector.deserializeInt(stream, exception); pts = stream.readInt32(exception); pts_count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(channel_id); - stream.writeInt32(0x1cb5c415); - int count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(messages.get(a)); - } + Vector.serializeInt(stream, messages); stream.writeInt32(pts); stream.writeInt32(pts_count); } @@ -38803,14 +32586,14 @@ public static class TL_updateUserPhoto extends Update { public UserProfilePhoto photo; public boolean previous; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); date = stream.readInt32(exception); photo = UserProfilePhoto.TLdeserialize(stream, stream.readInt32(exception), exception); previous = stream.readBool(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); stream.writeInt32(date); @@ -38824,11 +32607,11 @@ public static class TL_updateUser extends Update { public long user_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); } @@ -38837,8 +32620,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_updateDialogFilters extends Update { public static final int constructor = 0x3504914f; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -38846,8 +32628,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_updateRecentEmojiStatuses extends Update { public static final int constructor = 0x30f443db; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -38859,32 +32640,17 @@ public static class TL_updatePendingJoinRequests extends Update { public int requests_pending; public ArrayList recent_requesters = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); requests_pending = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - recent_requesters.add(stream.readInt64(exception)); - } + recent_requesters = Vector.deserializeLong(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(requests_pending); - stream.writeInt32(0x1cb5c415); - int count = recent_requesters.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(recent_requesters.get(a)); - } + Vector.serializeLong(stream, recent_requesters); } } @@ -38893,32 +32659,13 @@ public static class TL_updateDcOptions extends Update { public ArrayList dc_options = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_dcOption object = TL_dcOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - dc_options.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + dc_options = Vector.deserialize(stream, TL_dcOption::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = dc_options.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - dc_options.get(a).serializeToStream(stream); - } + Vector.serialize(stream, dc_options); } } @@ -38929,13 +32676,13 @@ public static class TL_updateEditChannelMessage extends Update { public int pts; public int pts_count; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { message = Message.TLdeserialize(stream, stream.readInt32(exception), exception); pts = stream.readInt32(exception); pts_count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); message.serializeToStream(stream); stream.writeInt32(pts); @@ -38948,11 +32695,11 @@ public static class TL_updateNewStickerSet extends Update { public TL_messages_stickerSet stickerset; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { stickerset = messages_StickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stickerset.serializeToStream(stream); } @@ -38963,11 +32710,11 @@ public static class TL_updateTheme extends Update { public Theme theme; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { theme = Theme.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); theme.serializeToStream(stream); } @@ -38978,11 +32725,11 @@ public static class TL_updateLangPackTooLong extends Update { public String lang_code; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { lang_code = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(lang_code); } @@ -38995,13 +32742,13 @@ public static class TL_updateEncryptedMessagesRead extends Update { public int max_date; public int date; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { chat_id = stream.readInt32(exception); max_date = stream.readInt32(exception); date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(chat_id); stream.writeInt32(max_date); @@ -39017,42 +32764,26 @@ public static class TL_updateStickerSetsOrder extends Update { public boolean emojis; public ArrayList order = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); masks = (flags & 1) != 0; emojis = (flags & 2) != 0; - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - order.add(stream.readInt64(exception)); - } + order = Vector.deserializeLong(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = masks ? (flags | 1) : (flags &~ 1); flags = emojis ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = order.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(order.get(a)); - } + Vector.serializeLong(stream, order); } } public static class TL_updateReadFeaturedEmojiStickers extends Update { public static final int constructor = 0xfb4c496c; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -39067,7 +32798,7 @@ public static class TL_updateReadChannelInbox extends Update { public int still_unread_count; public int pts; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { folder_id = stream.readInt32(exception); @@ -39078,7 +32809,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { pts = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -39100,19 +32831,9 @@ public static class TL_updateReadMessagesContents extends Update { public int pts_count; public int date; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - messages.add(stream.readInt32(exception)); - } + messages = Vector.deserializeInt(stream, exception); pts = stream.readInt32(exception); pts_count = stream.readInt32(exception); if ((flags & 1) != 0) { @@ -39120,14 +32841,9 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(messages.get(a)); - } + Vector.serializeInt(stream, messages); stream.writeInt32(pts); stream.writeInt32(pts_count); if ((flags & 1) != 0) { @@ -39141,11 +32857,11 @@ public static class TL_updateChatParticipants extends Update { public ChatParticipants participants; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { participants = ChatParticipants.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); participants.serializeToStream(stream); } @@ -39158,13 +32874,13 @@ public static class TL_updateChatDefaultBannedRights extends Update { public TL_chatBannedRights default_banned_rights; public int version; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); default_banned_rights = TL_chatBannedRights.TLdeserialize(stream, stream.readInt32(exception), exception); version = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); default_banned_rights.serializeToStream(stream); @@ -39179,35 +32895,20 @@ public static class TL_updateChannelPinnedTopics extends Update { public long channel_id; public ArrayList order = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); channel_id = stream.readInt64(exception); if ((flags & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - order.add(stream.readInt32(exception)); - } + order = Vector.deserializeInt(stream, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(channel_id); if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = order.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(order.get(a)); - } + Vector.serializeInt(stream, order); } } } @@ -39220,14 +32921,14 @@ public static class TL_updateChannelPinnedTopic extends Update { public long channel_id; public int topic_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); pinned = (flags & 1) != 0; channel_id = stream.readInt64(exception); topic_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = pinned ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -39242,7 +32943,7 @@ public static class TL_receivedNotifyMessage extends TLObject { public int id; public int flags; - public static TL_receivedNotifyMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_receivedNotifyMessage TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_receivedNotifyMessage.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_receivedNotifyMessage", constructor)); @@ -39255,12 +32956,12 @@ public static TL_receivedNotifyMessage TLdeserialize(AbstractSerializedData stre return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); flags = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(id); stream.writeInt32(flags); @@ -39274,7 +32975,7 @@ public static abstract class InputEncryptedFile extends TLObject { public int key_fingerprint; public String md5_checksum; - public static InputEncryptedFile TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputEncryptedFile TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputEncryptedFile result = null; switch (constructor) { case 0x5a17b5e5: @@ -39303,13 +33004,12 @@ public static InputEncryptedFile TLdeserialize(AbstractSerializedData stream, in public static class TL_inputEncryptedFile extends InputEncryptedFile { public static final int constructor = 0x5a17b5e5; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -39319,14 +33019,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputEncryptedFileBigUploaded extends InputEncryptedFile { public static final int constructor = 0x2dc173c8; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); parts = stream.readInt32(exception); key_fingerprint = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt32(parts); @@ -39337,8 +33036,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputEncryptedFileEmpty extends InputEncryptedFile { public static final int constructor = 0x1837c364; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -39346,15 +33044,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputEncryptedFileUploaded extends InputEncryptedFile { public static final int constructor = 0x64bd0306; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); parts = stream.readInt32(exception); md5_checksum = stream.readString(exception); key_fingerprint = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt32(parts); @@ -39369,7 +33066,7 @@ public static abstract class messages_AllStickers extends TLObject { public ArrayList packs = new ArrayList<>(); public ArrayList documents = new ArrayList<>(); - public static messages_AllStickers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static messages_AllStickers TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { messages_AllStickers result = null; switch (constructor) { case 0xcdbbcebb: @@ -39394,42 +33091,22 @@ public static class TL_messages_allStickers extends messages_AllStickers { public long hash2; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { hash2 = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - StickerSet object = StickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - sets.add(object); - } + sets = Vector.deserialize(stream, StickerSet::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(hash2); - stream.writeInt32(0x1cb5c415); - int count = sets.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - sets.get(a).serializeToStream(stream); - } + Vector.serialize(stream, sets); } } public static class TL_messages_allStickersNotModified extends messages_AllStickers { public static final int constructor = 0xe86602c3; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -39441,7 +33118,7 @@ public static class TL_messages_messageViews extends TLObject { public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_messages_messageViews TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_messageViews TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_messageViews.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_messageViews", constructor)); @@ -39454,74 +33131,17 @@ public static TL_messages_messageViews TLdeserialize(AbstractSerializedData stre return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_messageViews object = TL_messageViews.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - views.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + views = Vector.deserialize(stream, TL_messageViews::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = views.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - views.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, views); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } @@ -39537,7 +33157,7 @@ public static abstract class DecryptedMessageAction extends TLObject { public int end_seq_no; public byte[] g_a; - public static DecryptedMessageAction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static DecryptedMessageAction TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { DecryptedMessageAction result = null; switch (constructor) { case 0xa1733aec: @@ -39593,12 +33213,11 @@ public static DecryptedMessageAction TLdeserialize(AbstractSerializedData stream public static class TL_decryptedMessageActionSetMessageTTL extends DecryptedMessageAction { public static final int constructor = 0xa1733aec; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { ttl_seconds = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(ttl_seconds); } @@ -39607,12 +33226,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_decryptedMessageActionNotifyLayer extends DecryptedMessageAction { public static final int constructor = 0xf3048883; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { layer = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(layer); } @@ -39621,42 +33239,25 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_decryptedMessageActionDeleteMessages extends DecryptedMessageAction { public static final int constructor = 0x65614304; - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - random_ids.add(stream.readInt64(exception)); - } + public void readParams(InputSerializedData stream, boolean exception) { + random_ids = Vector.deserializeLong(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = random_ids.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(random_ids.get(a)); - } + Vector.serializeLong(stream, random_ids); } } public static class TL_decryptedMessageActionCommitKey extends DecryptedMessageAction { public static final int constructor = 0xec2e0b9b; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { exchange_id = stream.readInt64(exception); key_fingerprint = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(exchange_id); stream.writeInt64(key_fingerprint); @@ -39666,12 +33267,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_decryptedMessageActionAbortKey extends DecryptedMessageAction { public static final int constructor = 0xdd05ec6b; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { exchange_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(exchange_id); } @@ -39680,8 +33280,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_decryptedMessageActionFlushHistory extends DecryptedMessageAction { public static final int constructor = 0x6719e45c; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -39689,12 +33288,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_decryptedMessageActionTyping extends DecryptedMessageAction { public static final int constructor = 0xccb27641; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { action = SendMessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); action.serializeToStream(stream); } @@ -39703,14 +33301,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_decryptedMessageActionAcceptKey extends DecryptedMessageAction { public static final int constructor = 0x6fe1735b; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { exchange_id = stream.readInt64(exception); g_b = stream.readByteArray(exception); key_fingerprint = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(exchange_id); stream.writeByteArray(g_b); @@ -39721,42 +33318,25 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_decryptedMessageActionReadMessages extends DecryptedMessageAction { public static final int constructor = 0xc4f40be; - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - random_ids.add(stream.readInt64(exception)); - } + public void readParams(InputSerializedData stream, boolean exception) { + random_ids = Vector.deserializeLong(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = random_ids.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(random_ids.get(a)); - } + Vector.serializeLong(stream, random_ids); } } public static class TL_decryptedMessageActionResend extends DecryptedMessageAction { public static final int constructor = 0x511110b0; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { start_seq_no = stream.readInt32(exception); end_seq_no = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(start_seq_no); stream.writeInt32(end_seq_no); @@ -39766,13 +33346,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_decryptedMessageActionRequestKey extends DecryptedMessageAction { public static final int constructor = 0xf3c9611b; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { exchange_id = stream.readInt64(exception); g_a = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(exchange_id); stream.writeByteArray(g_a); @@ -39782,44 +33361,27 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_decryptedMessageActionScreenshotMessages extends DecryptedMessageAction { public static final int constructor = 0x8ac1f475; - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - random_ids.add(stream.readInt64(exception)); - } + public void readParams(InputSerializedData stream, boolean exception) { + random_ids = Vector.deserializeLong(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = random_ids.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(random_ids.get(a)); - } + Vector.serializeLong(stream, random_ids); } } public static class TL_decryptedMessageActionNoop extends DecryptedMessageAction { public static final int constructor = 0xa82fdd63; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } public static abstract class InputCheckPasswordSRP extends TLObject { - public static InputCheckPasswordSRP TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputCheckPasswordSRP TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputCheckPasswordSRP result = null; switch (constructor) { case 0x9880f658: @@ -39842,8 +33404,7 @@ public static InputCheckPasswordSRP TLdeserialize(AbstractSerializedData stream, public static class TL_inputCheckPasswordEmpty extends InputCheckPasswordSRP { public static final int constructor = 0x9880f658; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -39855,13 +33416,13 @@ public static class TL_inputCheckPasswordSRP extends InputCheckPasswordSRP { public byte[] A; public byte[] M1; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { srp_id = stream.readInt64(exception); A = stream.readByteArray(exception); M1 = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(srp_id); stream.writeByteArray(A); @@ -39869,171 +33430,6 @@ public void serializeToStream(AbstractSerializedData stream) { } } - public static abstract class account_Password extends TLObject { - - public int flags; - public boolean has_recovery; - public boolean has_secure_values; - public boolean has_password; - public PasswordKdfAlgo current_algo; - public byte[] srp_B; - public long srp_id; - public String hint; - public String email_unconfirmed_pattern; - public PasswordKdfAlgo new_algo; - public SecurePasswordKdfAlgo new_secure_algo; - public byte[] secure_random; - public int pending_reset_date; - public String login_email_pattern; - - public static account_Password TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - account_Password result = null; - switch (constructor) { - case 0x957b50fb: - result = new TL_account_password(); - break; - case 0x185b184f: - result = new TL_account_password_layer144(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in account_Password", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } - - public static class TL_account_password extends account_Password { - public static final int constructor = 0x957b50fb; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - has_recovery = (flags & 1) != 0; - has_secure_values = (flags & 2) != 0; - has_password = (flags & 4) != 0; - if ((flags & 4) != 0) { - current_algo = PasswordKdfAlgo.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4) != 0) { - srp_B = stream.readByteArray(exception); - } - if ((flags & 4) != 0) { - srp_id = stream.readInt64(exception); - } - if ((flags & 8) != 0) { - hint = stream.readString(exception); - } - if ((flags & 16) != 0) { - email_unconfirmed_pattern = stream.readString(exception); - } - new_algo = PasswordKdfAlgo.TLdeserialize(stream, stream.readInt32(exception), exception); - new_secure_algo = SecurePasswordKdfAlgo.TLdeserialize(stream, stream.readInt32(exception), exception); - secure_random = stream.readByteArray(exception); - if ((flags & 32) != 0) { - pending_reset_date = stream.readInt32(exception); - } - if ((flags & 64) != 0) { - login_email_pattern = stream.readString(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = has_recovery ? (flags | 1) : (flags &~ 1); - flags = has_secure_values ? (flags | 2) : (flags &~ 2); - flags = has_password ? (flags | 4) : (flags &~ 4); - stream.writeInt32(flags); - if ((flags & 4) != 0) { - current_algo.serializeToStream(stream); - } - if ((flags & 4) != 0) { - stream.writeByteArray(srp_B); - } - if ((flags & 4) != 0) { - stream.writeInt64(srp_id); - } - if ((flags & 8) != 0) { - stream.writeString(hint); - } - if ((flags & 16) != 0) { - stream.writeString(email_unconfirmed_pattern); - } - new_algo.serializeToStream(stream); - new_secure_algo.serializeToStream(stream); - stream.writeByteArray(secure_random); - if ((flags & 32) != 0) { - stream.writeInt32(pending_reset_date); - } - if ((flags & 64) != 0) { - stream.writeString(login_email_pattern); - } - } - } - - public static class TL_account_password_layer144 extends account_Password { - public static final int constructor = 0x185b184f; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - has_recovery = (flags & 1) != 0; - has_secure_values = (flags & 2) != 0; - has_password = (flags & 4) != 0; - if ((flags & 4) != 0) { - current_algo = PasswordKdfAlgo.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4) != 0) { - srp_B = stream.readByteArray(exception); - } - if ((flags & 4) != 0) { - srp_id = stream.readInt64(exception); - } - if ((flags & 8) != 0) { - hint = stream.readString(exception); - } - if ((flags & 16) != 0) { - email_unconfirmed_pattern = stream.readString(exception); - } - new_algo = PasswordKdfAlgo.TLdeserialize(stream, stream.readInt32(exception), exception); - new_secure_algo = SecurePasswordKdfAlgo.TLdeserialize(stream, stream.readInt32(exception), exception); - secure_random = stream.readByteArray(exception); - if ((flags & 32) != 0) { - pending_reset_date = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = has_recovery ? (flags | 1) : (flags &~ 1); - flags = has_secure_values ? (flags | 2) : (flags &~ 2); - flags = has_password ? (flags | 4) : (flags &~ 4); - stream.writeInt32(flags); - if ((flags & 4) != 0) { - current_algo.serializeToStream(stream); - } - if ((flags & 4) != 0) { - stream.writeByteArray(srp_B); - } - if ((flags & 4) != 0) { - stream.writeInt64(srp_id); - } - if ((flags & 8) != 0) { - stream.writeString(hint); - } - if ((flags & 16) != 0) { - stream.writeString(email_unconfirmed_pattern); - } - new_algo.serializeToStream(stream); - new_secure_algo.serializeToStream(stream); - stream.writeByteArray(secure_random); - if ((flags & 32) != 0) { - stream.writeInt32(pending_reset_date); - } - } - } - public static class TL_chatAdminWithInvites extends TLObject { public static final int constructor = 0xf2ecef23; @@ -40041,7 +33437,7 @@ public static class TL_chatAdminWithInvites extends TLObject { public int invites_count; public int revoked_invites_count; - public static TL_chatAdminWithInvites TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_chatAdminWithInvites TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_chatAdminWithInvites.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_chatAdminWithInvites", constructor)); @@ -40054,13 +33450,13 @@ public static TL_chatAdminWithInvites TLdeserialize(AbstractSerializedData strea return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { admin_id = stream.readInt64(exception); invites_count = stream.readInt32(exception); revoked_invites_count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(admin_id); stream.writeInt32(invites_count); @@ -40074,7 +33470,7 @@ public static class TL_auth_loggedOut extends TLObject { public int flags; public byte[] future_auth_token; - public static TL_auth_loggedOut TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_auth_loggedOut TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_auth_loggedOut.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_auth_loggedOut", constructor)); @@ -40087,14 +33483,14 @@ public static TL_auth_loggedOut TLdeserialize(AbstractSerializedData stream, int return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { future_auth_token = stream.readByteArray(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -40115,7 +33511,7 @@ public static abstract class UserProfilePhoto extends TLObject { public boolean personal; public BitmapDrawable strippedBitmap; - public static UserProfilePhoto TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static UserProfilePhoto TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { UserProfilePhoto result = null; switch (constructor) { case 0x69d3ab26: @@ -40153,8 +33549,7 @@ public static UserProfilePhoto TLdeserialize(AbstractSerializedData stream, int public static class TL_userProfilePhoto_layer126 extends TL_userProfilePhoto { public static final int constructor = 0x69d3ab26; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); has_video = (flags & 1) != 0; photo_id = stream.readInt64(exception); @@ -40163,7 +33558,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { dc_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = has_video ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -40177,8 +33572,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userProfilePhoto_layer127 extends TL_userProfilePhoto { public static final int constructor = 0xcc656077; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); has_video = (flags & 1) != 0; photo_id = stream.readInt64(exception); @@ -40197,7 +33591,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { dc_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = has_video ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -40214,15 +33608,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userProfilePhoto_layer115 extends TL_userProfilePhoto { public static final int constructor = 0xecd75d8c; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { photo_id = stream.readInt64(exception); photo_small = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); photo_big = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); dc_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(photo_id); photo_small.serializeToStream(stream); @@ -40234,8 +33627,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userProfilePhotoEmpty extends UserProfilePhoto { public static final int constructor = 0x4f11bae1; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -40243,14 +33635,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userProfilePhoto_layer97 extends TL_userProfilePhoto { public static final int constructor = 0xd559d8c8; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { photo_id = stream.readInt64(exception); photo_small = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); photo_big = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(photo_id); photo_small.serializeToStream(stream); @@ -40261,13 +33652,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userProfilePhoto_old extends TL_userProfilePhoto { public static final int constructor = 0x990d1493; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { photo_small = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); photo_big = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); photo_small.serializeToStream(stream); photo_big.serializeToStream(stream); @@ -40277,8 +33667,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userProfilePhoto extends UserProfilePhoto { public static final int constructor = 0x82d1f706; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); has_video = (flags & 1) != 0; personal = (flags & 4) != 0; @@ -40303,7 +33692,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = has_video ? (flags | 1) : (flags &~ 1); flags = personal ? (flags | 4) : (flags &~ 4); @@ -40324,7 +33713,7 @@ public static abstract class MessageEntity extends TLObject { public String url; public String language; - public static MessageEntity TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static MessageEntity TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { MessageEntity result = null; switch (constructor) { case 0x76a6d327: @@ -40381,19 +33770,19 @@ public static MessageEntity TLdeserialize(AbstractSerializedData stream, int con case TL_messageEntityBlockquote_layer180.constructor: result = new TL_messageEntityBlockquote_layer180(); break; - case 0x9c4e7e8b: + case TL_messageEntityUnderline.constructor: result = new TL_messageEntityUnderline(); break; - case 0x761e6af4: + case TL_messageEntityBankCard.constructor: result = new TL_messageEntityBankCard(); break; - case 0x9b69e34b: + case TL_messageEntityPhone.constructor: result = new TL_messageEntityPhone(); break; - case 0xdc7b1140: + case TL_messageEntityMentionName.constructor: result = new TL_messageEntityMentionName(); break; - case 0xc8cf05f8: + case TL_messageEntityCustomEmoji.constructor: result = new TL_messageEntityCustomEmoji(); break; } @@ -40410,14 +33799,13 @@ public static MessageEntity TLdeserialize(AbstractSerializedData stream, int con public static class TL_messageEntityTextUrl extends MessageEntity { public static final int constructor = 0x76a6d327; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { offset = stream.readInt32(exception); length = stream.readInt32(exception); url = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(offset); stream.writeInt32(length); @@ -40428,13 +33816,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageEntityBotCommand extends MessageEntity { public static final int constructor = 0x6cef8ac7; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { offset = stream.readInt32(exception); length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(offset); stream.writeInt32(length); @@ -40444,13 +33831,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageEntityEmail extends MessageEntity { public static final int constructor = 0x64e475c2; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { offset = stream.readInt32(exception); length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(offset); stream.writeInt32(length); @@ -40460,14 +33846,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageEntityPre extends MessageEntity { public static final int constructor = 0x73924be0; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { offset = stream.readInt32(exception); length = stream.readInt32(exception); language = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(offset); stream.writeInt32(length); @@ -40478,13 +33863,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageEntityUnknown extends MessageEntity { public static final int constructor = 0xbb92ba95; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { offset = stream.readInt32(exception); length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(offset); stream.writeInt32(length); @@ -40494,13 +33878,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageEntityUrl extends MessageEntity { public static final int constructor = 0x6ed02538; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { offset = stream.readInt32(exception); length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(offset); stream.writeInt32(length); @@ -40510,13 +33893,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageEntityItalic extends MessageEntity { public static final int constructor = 0x826f8b60; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { offset = stream.readInt32(exception); length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(offset); stream.writeInt32(length); @@ -40526,13 +33908,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageEntityMention extends MessageEntity { public static final int constructor = 0xfa04579d; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { offset = stream.readInt32(exception); length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(offset); stream.writeInt32(length); @@ -40542,12 +33923,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageEntitySpoiler extends MessageEntity { public static final int constructor = 0x32ca960f; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { offset = stream.readInt32(exception); length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(offset); stream.writeInt32(length); @@ -40557,14 +33938,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageEntityMentionName_layer131 extends TL_messageEntityMentionName { public static final int constructor = 0x352dca58; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { offset = stream.readInt32(exception); length = stream.readInt32(exception); user_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(offset); stream.writeInt32(length); @@ -40577,13 +33957,13 @@ public static class TL_inputMessageEntityMentionName extends MessageEntity { public InputUser user_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { offset = stream.readInt32(exception); length = stream.readInt32(exception); user_id = InputUser.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(offset); stream.writeInt32(length); @@ -40594,12 +33974,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageEntityCashtag extends MessageEntity { public static final int constructor = 0x4c4e743f; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { offset = stream.readInt32(exception); length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(offset); stream.writeInt32(length); @@ -40609,13 +33989,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageEntityBold extends MessageEntity { public static final int constructor = 0xbd610bc9; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { offset = stream.readInt32(exception); length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(offset); stream.writeInt32(length); @@ -40625,13 +34004,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageEntityHashtag extends MessageEntity { public static final int constructor = 0x6f635b0d; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { offset = stream.readInt32(exception); length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(offset); stream.writeInt32(length); @@ -40641,13 +34019,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageEntityCode extends MessageEntity { public static final int constructor = 0x28a20571; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { offset = stream.readInt32(exception); length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(offset); stream.writeInt32(length); @@ -40657,13 +34034,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageEntityStrike extends MessageEntity { public static final int constructor = 0xbf0693d4; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { offset = stream.readInt32(exception); length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(offset); stream.writeInt32(length); @@ -40673,15 +34049,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageEntityBlockquote extends MessageEntity { public static final int constructor = 0xf1ccaaac; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); collapsed = (flags & 1) != 0; offset = stream.readInt32(exception); length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = collapsed ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -40693,13 +34068,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageEntityBlockquote_layer180 extends TL_messageEntityBlockquote { public static final int constructor = 0x20df5d0; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { offset = stream.readInt32(exception); length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(offset); stream.writeInt32(length); @@ -40709,13 +34083,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageEntityUnderline extends MessageEntity { public static final int constructor = 0x9c4e7e8b; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { offset = stream.readInt32(exception); length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(offset); stream.writeInt32(length); @@ -40725,13 +34098,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageEntityBankCard extends MessageEntity { public static final int constructor = 0x761e6af4; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { offset = stream.readInt32(exception); length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(offset); stream.writeInt32(length); @@ -40741,12 +34113,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageEntityPhone extends MessageEntity { public static final int constructor = 0x9b69e34b; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { offset = stream.readInt32(exception); length = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(offset); stream.writeInt32(length); @@ -40758,13 +34130,13 @@ public static class TL_messageEntityMentionName extends MessageEntity { public long user_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { offset = stream.readInt32(exception); length = stream.readInt32(exception); user_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(offset); stream.writeInt32(length); @@ -40774,7 +34146,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class ChannelLocation extends TLObject { - public static ChannelLocation TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static ChannelLocation TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { ChannelLocation result = null; switch (constructor) { case 0xbfb5ad8b: @@ -40797,8 +34169,7 @@ public static ChannelLocation TLdeserialize(AbstractSerializedData stream, int c public static class TL_channelLocationEmpty extends ChannelLocation { public static final int constructor = 0xbfb5ad8b; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -40809,12 +34180,12 @@ public static class TL_channelLocation extends ChannelLocation { public GeoPoint geo_point; public String address; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { geo_point = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); address = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); geo_point.serializeToStream(stream); stream.writeString(address); @@ -40836,7 +34207,7 @@ public static abstract class Photo extends TLObject { public GeoPoint geo; public String caption; - public static Photo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static Photo TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { Photo result = null; switch (constructor) { case 0x9c477dd8: @@ -40877,194 +34248,168 @@ public static Photo TLdeserialize(AbstractSerializedData stream, int constructor public static class TL_photo_layer97 extends TL_photo { public static final int constructor = 0x9c477dd8; + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + has_stickers = (flags & 1) != 0; + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + file_reference = stream.readByteArray(exception); + date = stream.readInt32(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + PhotoSize object = PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + sizes.add(object); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = has_stickers ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeByteArray(file_reference); + stream.writeInt32(date); + Vector.serialize(stream, sizes); + } + } + + public static class TL_photo_layer55 extends TL_photo { + public static final int constructor = 0xcded42fe; + + public void readParams(InputSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + date = stream.readInt32(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + PhotoSize object = PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + sizes.add(object); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32(date); + Vector.serialize(stream, sizes); + } + } + + public static class TL_photo_old2 extends TL_photo { + public static final int constructor = 0xc3838076; + + public void readParams(InputSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + user_id = stream.readInt32(exception); + date = stream.readInt32(exception); + geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + PhotoSize object = PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + sizes.add(object); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32((int) user_id); + stream.writeInt32(date); + geo.serializeToStream(stream); + Vector.serialize(stream, sizes); + } + } + + public static class TL_photoEmpty extends Photo { + public static final int constructor = 0x2331b22d; + + public void readParams(InputSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + } + } + + public static class TL_photo_old extends TL_photo { + public static final int constructor = 0x22b56751; + + public void readParams(InputSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + user_id = stream.readInt32(exception); + date = stream.readInt32(exception); + caption = stream.readString(exception); + geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + PhotoSize object = PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + sizes.add(object); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32((int) user_id); + stream.writeInt32(date); + stream.writeString(caption); + geo.serializeToStream(stream); + Vector.serialize(stream, sizes); + } + } + + public static class TL_photo_layer115 extends TL_photo { + public static final int constructor = 0xd07504a5; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - has_stickers = (flags & 1) != 0; - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - file_reference = stream.readByteArray(exception); - date = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PhotoSize object = PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - sizes.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = has_stickers ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeByteArray(file_reference); - stream.writeInt32(date); - stream.writeInt32(0x1cb5c415); - int count = sizes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - sizes.get(a).serializeToStream(stream); - } - } - } - - public static class TL_photo_layer55 extends TL_photo { - public static final int constructor = 0xcded42fe; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PhotoSize object = PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - sizes.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeInt32(0x1cb5c415); - int count = sizes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - sizes.get(a).serializeToStream(stream); - } - } - } - - public static class TL_photo_old2 extends TL_photo { - public static final int constructor = 0xc3838076; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - user_id = stream.readInt32(exception); - date = stream.readInt32(exception); - geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PhotoSize object = PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - sizes.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32((int) user_id); - stream.writeInt32(date); - geo.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = sizes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - sizes.get(a).serializeToStream(stream); - } - } - } - - public static class TL_photoEmpty extends Photo { - public static final int constructor = 0x2331b22d; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - } - } - - public static class TL_photo_old extends TL_photo { - public static final int constructor = 0x22b56751; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - user_id = stream.readInt32(exception); - date = stream.readInt32(exception); - caption = stream.readString(exception); - geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PhotoSize object = PhotoSize.TLdeserialize(0, 0, 0, stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - sizes.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32((int) user_id); - stream.writeInt32(date); - stream.writeString(caption); - geo.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = sizes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - sizes.get(a).serializeToStream(stream); - } - } - } - - public static class TL_photo_layer115 extends TL_photo { - public static final int constructor = 0xd07504a5; - - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); has_stickers = (flags & 1) != 0; id = stream.readInt64(exception); @@ -41089,7 +34434,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { dc_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = has_stickers ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -41097,12 +34442,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt64(access_hash); stream.writeByteArray(file_reference); stream.writeInt32(date); - stream.writeInt32(0x1cb5c415); - int count = sizes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - sizes.get(a).serializeToStream(stream); - } + Vector.serialize(stream, sizes); stream.writeInt32(dc_id); } } @@ -41110,8 +34450,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_photo extends Photo { public static final int constructor = 0xfb197a65; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); has_stickers = (flags & 1) != 0; id = stream.readInt64(exception); @@ -41153,7 +34492,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { dc_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = has_stickers ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -41161,19 +34500,9 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt64(access_hash); stream.writeByteArray(file_reference); stream.writeInt32(date); - stream.writeInt32(0x1cb5c415); - int count = sizes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - sizes.get(a).serializeToStream(stream); - } + Vector.serialize(stream, sizes); if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - count = video_sizes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - video_sizes.get(a).serializeToStream(stream); - } + Vector.serialize(stream, video_sizes); } stream.writeInt32(dc_id); } @@ -41182,8 +34511,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_photo_layer82 extends TL_photo { public static final int constructor = 0x9288dd29; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); has_stickers = (flags & 1) != 0; id = stream.readInt64(exception); @@ -41206,27 +34534,21 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = has_stickers ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); stream.writeInt64(id); stream.writeInt64(access_hash); stream.writeInt32(date); - stream.writeInt32(0x1cb5c415); - int count = sizes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - sizes.get(a).serializeToStream(stream); - } + Vector.serialize(stream, sizes); } } public static class TL_encryptedChatRequested_layer131 extends TL_encryptedChatRequested { public static final int constructor = 0x62718a82; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { folder_id = stream.readInt32(exception); @@ -41239,7 +34561,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { g_a = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -41257,8 +34579,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_encryptedChatRequested_old extends TL_encryptedChatRequested { public static final int constructor = 0xfda9a7b7; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); access_hash = stream.readInt64(exception); date = stream.readInt32(exception); @@ -41268,7 +34589,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { nonce = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(id); stream.writeInt64(access_hash); @@ -41283,8 +34604,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_encryptedChatRequested_layer115 extends EncryptedChat { public static final int constructor = 0xc878527e; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); access_hash = stream.readInt64(exception); date = stream.readInt32(exception); @@ -41293,7 +34613,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { g_a = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(id); stream.writeInt64(access_hash); @@ -41307,8 +34627,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_encryptedChat_layer131 extends TL_encryptedChat { public static final int constructor = 0xfa56ce36; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); access_hash = stream.readInt64(exception); date = stream.readInt32(exception); @@ -41318,7 +34637,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { key_fingerprint = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(id); stream.writeInt64(access_hash); @@ -41333,8 +34652,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_encryptedChat_old extends TL_encryptedChat { public static final int constructor = 0x6601d14f; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); access_hash = stream.readInt64(exception); date = stream.readInt32(exception); @@ -41345,7 +34663,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { key_fingerprint = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(id); stream.writeInt64(access_hash); @@ -41361,12 +34679,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_encryptedChatEmpty extends EncryptedChat { public static final int constructor = 0xab7ec0a0; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(id); } @@ -41375,8 +34692,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_encryptedChatWaiting_layer131 extends TL_encryptedChatWaiting { public static final int constructor = 0x3bf703dc; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); access_hash = stream.readInt64(exception); date = stream.readInt32(exception); @@ -41384,7 +34700,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { participant_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(id); stream.writeInt64(access_hash); @@ -41397,12 +34713,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_encryptedChatDiscarded_layer122 extends TL_encryptedChatDiscarded { public static final int constructor = 0x13d6dd27; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(id); } @@ -41411,14 +34726,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_encryptedChatDiscarded extends EncryptedChat { public static final int constructor = 0x1e1c7c45; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); history_deleted = (flags & 1) != 0; id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = history_deleted ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -41429,8 +34743,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_encryptedChat extends EncryptedChat { public static final int constructor = 0x61f0d4c7; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); access_hash = stream.readInt64(exception); date = stream.readInt32(exception); @@ -41440,7 +34753,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { key_fingerprint = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(id); stream.writeInt64(access_hash); @@ -41455,8 +34768,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_encryptedChatRequested extends EncryptedChat { public static final int constructor = 0x48f1d94c; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { folder_id = stream.readInt32(exception); @@ -41469,7 +34781,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { g_a = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -41487,8 +34799,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_encryptedChatWaiting extends EncryptedChat { public static final int constructor = 0x66b25953; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); access_hash = stream.readInt64(exception); date = stream.readInt32(exception); @@ -41496,7 +34807,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { participant_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(id); stream.writeInt64(access_hash); @@ -41508,7 +34819,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class messages_FoundStickerSets extends TLObject { - public static messages_FoundStickerSets TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static messages_FoundStickerSets TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { messages_FoundStickerSets result = null; switch (constructor) { case 0xd54b65d: @@ -41531,8 +34842,7 @@ public static messages_FoundStickerSets TLdeserialize(AbstractSerializedData str public static class TL_messages_foundStickerSetsNotModified extends messages_FoundStickerSets { public static final int constructor = 0xd54b65d; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -41543,34 +34853,15 @@ public static class TL_messages_foundStickerSets extends messages_FoundStickerSe public long hash; public ArrayList sets = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { hash = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - StickerSetCovered object = StickerSetCovered.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - sets.add(object); - } + sets = Vector.deserialize(stream, StickerSetCovered::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(hash); - stream.writeInt32(0x1cb5c415); - int count = sets.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - sets.get(a).serializeToStream(stream); - } + Vector.serialize(stream, sets); } } @@ -41580,7 +34871,7 @@ public static class TL_contact extends TLObject { public long user_id; public boolean mutual; - public static TL_contact TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_contact TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_contact.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_contact", constructor)); @@ -41593,12 +34884,12 @@ public static TL_contact TLdeserialize(AbstractSerializedData stream, int constr return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); mutual = stream.readBool(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); stream.writeBool(mutual); @@ -41611,7 +34902,7 @@ public static class TL_groupCallParticipantVideoSourceGroup extends TLObject { public String semantics; public ArrayList sources = new ArrayList<>(); - public static TL_groupCallParticipantVideoSourceGroup TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_groupCallParticipantVideoSourceGroup TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_groupCallParticipantVideoSourceGroup.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_groupCallParticipantVideoSourceGroup", constructor)); @@ -41624,30 +34915,15 @@ public static TL_groupCallParticipantVideoSourceGroup TLdeserialize(AbstractSeri return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { semantics = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - sources.add(stream.readInt32(exception)); - } + sources = Vector.deserializeInt(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(semantics); - stream.writeInt32(0x1cb5c415); - int count = sources.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(sources.get(a)); - } + Vector.serializeInt(stream, sources); } } @@ -41659,7 +34935,7 @@ public static class TL_help_countryCode extends TLObject { public ArrayList prefixes = new ArrayList<>(); public ArrayList patterns = new ArrayList<>(); - public static TL_help_countryCode TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_help_countryCode TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_help_countryCode.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_help_countryCode", constructor)); @@ -41672,56 +34948,26 @@ public static TL_help_countryCode TLdeserialize(AbstractSerializedData stream, i return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); country_code = stream.readString(exception); if ((flags & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - prefixes.add(stream.readString(exception)); - } + prefixes = Vector.deserializeString(stream, exception); } if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - patterns.add(stream.readString(exception)); - } + patterns = Vector.deserializeString(stream, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(country_code); if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = prefixes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(prefixes.get(a)); - } + Vector.serializeString(stream, prefixes); } if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = patterns.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(patterns.get(a)); - } + Vector.serializeString(stream, patterns); } } } @@ -41733,7 +34979,7 @@ public static class TL_secureData extends TLObject { public byte[] data_hash; public byte[] secret; - public static TL_secureData TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_secureData TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_secureData.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_secureData", constructor)); @@ -41746,13 +34992,13 @@ public static TL_secureData TLdeserialize(AbstractSerializedData stream, int con return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { data = stream.readByteArray(exception); data_hash = stream.readByteArray(exception); secret = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeByteArray(data); stream.writeByteArray(data_hash); @@ -41760,7 +35006,6 @@ public void serializeToStream(AbstractSerializedData stream) { } } - public static class TL_config extends TLObject { public static final int constructor = 0xcc1a241e; @@ -41813,7 +35058,7 @@ public static class TL_config extends TLObject { public Reaction reactions_default; public String autologin_token; - public static TL_config TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_config TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_config.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_config", constructor)); @@ -41826,7 +35071,7 @@ public static TL_config TLdeserialize(AbstractSerializedData stream, int constru return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); default_p2p_contacts = (flags & 8) != 0; preload_featured_stickers = (flags & 16) != 0; @@ -41837,21 +35082,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { expires = stream.readInt32(exception); test_mode = stream.readBool(exception); this_dc = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_dcOption object = TL_dcOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - dc_options.add(object); - } + dc_options = Vector.deserialize(stream, TL_dcOption::TLdeserialize, exception); dc_txt_domain_name = stream.readString(exception); chat_size_max = stream.readInt32(exception); megagroup_size_max = stream.readInt32(exception); @@ -41913,7 +35144,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = default_p2p_contacts ? (flags | 8) : (flags &~ 8); flags = preload_featured_stickers ? (flags | 16) : (flags &~ 16); @@ -41925,12 +35156,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(expires); stream.writeBool(test_mode); stream.writeInt32(this_dc); - stream.writeInt32(0x1cb5c415); - int count = dc_options.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - dc_options.get(a).serializeToStream(stream); - } + Vector.serialize(stream, dc_options); stream.writeString(dc_txt_domain_name); stream.writeInt32(chat_size_max); stream.writeInt32(megagroup_size_max); @@ -41995,7 +35221,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class contacts_TopPeers extends TLObject { - public static contacts_TopPeers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static contacts_TopPeers TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { contacts_TopPeers result = null; switch (constructor) { case 0x70b772a8: @@ -42025,82 +35251,24 @@ public static class TL_contacts_topPeers extends contacts_TopPeers { public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_topPeerCategoryPeers object = TL_topPeerCategoryPeers.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - categories.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + categories = Vector.deserialize(stream, TL_topPeerCategoryPeers::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = categories.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - categories.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, categories); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } public static class TL_contacts_topPeersDisabled extends contacts_TopPeers { public static final int constructor = 0xb52c939d; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -42108,8 +35276,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_contacts_topPeersNotModified extends contacts_TopPeers { public static final int constructor = 0xde266ef5; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -42120,7 +35287,7 @@ public static class TL_help_support extends TLObject { public String phone_number; public User user; - public static TL_help_support TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_help_support TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_help_support.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_help_support", constructor)); @@ -42133,61 +35300,29 @@ public static TL_help_support TLdeserialize(AbstractSerializedData stream, int c return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { phone_number = stream.readString(exception); user = User.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(phone_number); user.serializeToStream(stream); } } - public static class TL_account_tmpPassword extends TLObject { - public static final int constructor = 0xdb64fd34; - - public byte[] tmp_password; - public int valid_until; - - public static TL_account_tmpPassword TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_account_tmpPassword.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_account_tmpPassword", constructor)); - } else { - return null; - } - } - TL_account_tmpPassword result = new TL_account_tmpPassword(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - tmp_password = stream.readByteArray(exception); - valid_until = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(tmp_password); - stream.writeInt32(valid_until); - } - } - - public static abstract class messages_Chats extends TLObject { public ArrayList chats = new ArrayList<>(); public int count; - public static messages_Chats TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static messages_Chats TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { messages_Chats result = null; switch (constructor) { - case 0x64ff9fd5: + case TL_messages_chats.constructor: result = new TL_messages_chats(); break; - case 0x9cd81144: + case TL_messages_chatsSlice.constructor: result = new TL_messages_chatsSlice(); break; } @@ -42204,68 +35339,28 @@ public static messages_Chats TLdeserialize(AbstractSerializedData stream, int co public static class TL_messages_chats extends messages_Chats { public static final int constructor = 0x64ff9fd5; - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } + Vector.serialize(stream, chats); } } public static class TL_messages_chatsSlice extends messages_Chats { public static final int constructor = 0x9cd81144; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } + Vector.serialize(stream, chats); } } @@ -42274,7 +35369,7 @@ public static abstract class InputChannel extends TLObject { public long channel_id; public long access_hash; - public static InputChannel TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputChannel TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputChannel result = null; switch (constructor) { case 0x2a286531: @@ -42306,14 +35401,13 @@ public static InputChannel TLdeserialize(AbstractSerializedData stream, int cons public static class TL_inputChannelFromMessage_layer131 extends TL_inputChannelFromMessage { public static final int constructor = 0x2a286531; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); msg_id = stream.readInt32(exception); channel_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(msg_id); @@ -42324,13 +35418,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputChannel_layer131 extends TL_inputChannel { public static final int constructor = 0xafeb712e; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { channel_id = stream.readInt32(exception); access_hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) channel_id); stream.writeInt64(access_hash); @@ -42340,13 +35433,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputChannel extends InputChannel { public static final int constructor = 0xf35aec28; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { channel_id = stream.readInt64(exception); access_hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(channel_id); stream.writeInt64(access_hash); @@ -42356,8 +35448,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputChannelEmpty extends InputChannel { public static final int constructor = 0xee8c1e86; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -42368,13 +35459,13 @@ public static class TL_inputChannelFromMessage extends InputChannel { public InputPeer peer; public int msg_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); msg_id = stream.readInt32(exception); channel_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(msg_id); @@ -42388,7 +35479,7 @@ public static class TL_messageRange extends TLObject { public int min_id; public int max_id; - public static TL_messageRange TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messageRange TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messageRange.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messageRange", constructor)); @@ -42401,12 +35492,12 @@ public static TL_messageRange TLdeserialize(AbstractSerializedData stream, int c return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { min_id = stream.readInt32(exception); max_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(min_id); stream.writeInt32(max_id); @@ -42426,7 +35517,7 @@ public static abstract class Poll extends TLObject { public int close_period; public int close_date; - public static Poll TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static Poll TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { Poll result = null; switch (constructor) { case TL_poll.constructor: @@ -42451,11 +35542,11 @@ public static Poll TLdeserialize(AbstractSerializedData stream, int constructor, return result; } } - + public static class TL_poll extends Poll { public static final int constructor = 0x58747131; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); flags = stream.readInt32(exception); closed = (flags & 1) != 0; @@ -42463,21 +35554,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { multiple_choice = (flags & 4) != 0; quiz = (flags & 8) != 0; question = TL_textWithEntities.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PollAnswer object = PollAnswer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - answers.add(object); - } + answers = Vector.deserialize(stream, PollAnswer::TLdeserialize, exception); if ((flags & 16) != 0) { close_period = stream.readInt32(exception); } @@ -42486,7 +35563,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); flags = closed ? (flags | 1) : (flags &~ 1); @@ -42495,12 +35572,7 @@ public void serializeToStream(AbstractSerializedData stream) { flags = quiz ? (flags | 8) : (flags &~ 8); stream.writeInt32(flags); question.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = answers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - answers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, answers); if ((flags & 16) != 0) { stream.writeInt32(close_period); } @@ -42513,8 +35585,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_poll_layer178 extends TL_poll { public static final int constructor = 0x86e18161; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); flags = stream.readInt32(exception); closed = (flags & 1) != 0; @@ -42523,21 +35594,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { quiz = (flags & 8) != 0; question = new TL_textWithEntities(); question.text = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PollAnswer object = PollAnswer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - answers.add(object); - } + answers = Vector.deserialize(stream, PollAnswer::TLdeserialize, exception); if ((flags & 16) != 0) { close_period = stream.readInt32(exception); } @@ -42546,7 +35603,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); flags = closed ? (flags | 1) : (flags &~ 1); @@ -42555,12 +35612,7 @@ public void serializeToStream(AbstractSerializedData stream) { flags = quiz ? (flags | 8) : (flags &~ 8); stream.writeInt32(flags); stream.writeString(question == null ? "" : question.text); - stream.writeInt32(0x1cb5c415); - int count = answers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - answers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, answers); if ((flags & 16) != 0) { stream.writeInt32(close_period); } @@ -42573,8 +35625,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_poll_toDelete extends TL_poll { public static final int constructor = 0xaf746786; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); flags = stream.readInt32(exception); closed = (flags & 1) != 0; @@ -42583,27 +35634,13 @@ public void readParams(AbstractSerializedData stream, boolean exception) { quiz = (flags & 8) != 0; question = new TL_textWithEntities(); question.text = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PollAnswer object = PollAnswer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - answers.add(object); - } + answers = Vector.deserialize(stream, PollAnswer::TLdeserialize, exception); if ((flags & 16) != 0) { close_date = stream.readInt32(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); flags = closed ? (flags | 1) : (flags &~ 1); @@ -42612,12 +35649,7 @@ public void serializeToStream(AbstractSerializedData stream) { flags = quiz ? (flags | 8) : (flags &~ 8); stream.writeInt32(flags); stream.writeString(question == null ? "" : question.text); - stream.writeInt32(0x1cb5c415); - int count = answers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - answers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, answers); if ((flags & 16) != 0) { stream.writeInt32(close_date); } @@ -42627,8 +35659,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_poll_layer111 extends TL_poll { public static final int constructor = 0xd5529d06; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); flags = stream.readInt32(exception); closed = (flags & 1) != 0; @@ -42637,24 +35668,10 @@ public void readParams(AbstractSerializedData stream, boolean exception) { quiz = (flags & 8) != 0; question = new TL_textWithEntities(); question.text = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PollAnswer object = PollAnswer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - answers.add(object); - } + answers = Vector.deserialize(stream, PollAnswer::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); flags = closed ? (flags | 1) : (flags &~ 1); @@ -42663,12 +35680,7 @@ public void serializeToStream(AbstractSerializedData stream) { flags = quiz ? (flags | 8) : (flags &~ 8); stream.writeInt32(flags); stream.writeString(question == null ? "" : question.text); - stream.writeInt32(0x1cb5c415); - int count = answers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - answers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, answers); } } @@ -42683,7 +35695,7 @@ public static abstract class messages_BotResults extends TLObject { public ArrayList users = new ArrayList<>(); public TL_inlineBotWebView switch_webview; - public static messages_BotResults TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static messages_BotResults TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { messages_BotResults result = null; switch (constructor) { case 0xccd3563d: @@ -42709,8 +35721,7 @@ public static messages_BotResults TLdeserialize(AbstractSerializedData stream, i public static class TL_messages_botResults_layer71 extends TL_messages_botResults_layer153 { public static final int constructor = 0xccd3563d; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); gallery = (flags & 1) != 0; query_id = stream.readInt64(exception); @@ -42720,25 +35731,11 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 4) != 0) { switch_pm = TL_inlineBotSwitchPM.TLdeserialize(stream, stream.readInt32(exception), exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - BotInlineResult object = BotInlineResult.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - results.add(object); - } + results = Vector.deserialize(stream, BotInlineResult::TLdeserialize, exception); cache_time = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = gallery ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -42749,12 +35746,7 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 4) != 0) { switch_pm.serializeToStream(stream); } - stream.writeInt32(0x1cb5c415); - int count = results.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - results.get(a).serializeToStream(stream); - } + Vector.serialize(stream, results); stream.writeInt32(cache_time); } } @@ -42762,8 +35754,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messages_botResults extends messages_BotResults { public static final int constructor = 0xe021f2f6; - - public static TL_messages_botResults TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_botResults TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_botResults.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_botResults", constructor)); @@ -42776,7 +35767,7 @@ public static TL_messages_botResults TLdeserialize(AbstractSerializedData stream return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); gallery = (flags & 1) != 0; query_id = stream.readInt64(exception); @@ -42789,40 +35780,12 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 8) != 0) { switch_webview = TL_inlineBotWebView.TLdeserialize(stream, stream.readInt32(exception), exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - BotInlineResult object = BotInlineResult.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - results.add(object); - } + results = Vector.deserialize(stream, BotInlineResult::TLdeserialize, exception); cache_time = stream.readInt32(exception); - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = gallery ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -42836,27 +35799,16 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 8) != 0) { switch_webview.serializeToStream(stream); } - stream.writeInt32(0x1cb5c415); - int count = results.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - results.get(a).serializeToStream(stream); - } + Vector.serialize(stream, results); stream.writeInt32(cache_time); - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, users); } } public static class TL_messages_botResults_layer153 extends messages_BotResults { public static final int constructor = 0x947ca848; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); gallery = (flags & 1) != 0; query_id = stream.readInt64(exception); @@ -42866,40 +35818,12 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 4) != 0) { switch_pm = TL_inlineBotSwitchPM.TLdeserialize(stream, stream.readInt32(exception), exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - BotInlineResult object = BotInlineResult.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - results.add(object); - } + results = Vector.deserialize(stream, BotInlineResult::TLdeserialize, exception); cache_time = stream.readInt32(exception); - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = gallery ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -42910,19 +35834,9 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 4) != 0) { switch_pm.serializeToStream(stream); } - stream.writeInt32(0x1cb5c415); - int count = results.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - results.get(a).serializeToStream(stream); - } + Vector.serialize(stream, results); stream.writeInt32(cache_time); - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, users); } } @@ -42932,7 +35846,7 @@ public static class TL_inputFolderPeer extends TLObject { public InputPeer peer; public int folder_id; - public static TL_inputFolderPeer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_inputFolderPeer TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_inputFolderPeer.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_inputFolderPeer", constructor)); @@ -42945,12 +35859,12 @@ public static TL_inputFolderPeer TLdeserialize(AbstractSerializedData stream, in return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); folder_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(folder_id); @@ -42971,7 +35885,7 @@ public static abstract class PhoneConnection extends TLObject { public byte[] peer_tag; public boolean tcp; - public static PhoneConnection TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static PhoneConnection TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { PhoneConnection result = null; switch (constructor) { case 0x9cc123c7: @@ -42994,7 +35908,7 @@ public static PhoneConnection TLdeserialize(AbstractSerializedData stream, int c public static class TL_phoneConnection extends PhoneConnection { public static final int constructor = 0x9cc123c7; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); tcp = (flags & 1) != 0; id = stream.readInt64(exception); @@ -43004,7 +35918,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { peer_tag = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = tcp ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -43019,8 +35933,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_phoneConnectionWebrtc extends PhoneConnection { public static final int constructor = 0x635fe375; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); turn = (flags & 1) != 0; stun = (flags & 2) != 0; @@ -43032,7 +35945,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { password = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = turn ? (flags | 1) : (flags &~ 1); flags = stun ? (flags | 2) : (flags &~ 2); @@ -43053,7 +35966,7 @@ public static class TL_inputBotInlineMessageID extends TLObject { public long id; public long access_hash; - public static TL_inputBotInlineMessageID TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_inputBotInlineMessageID TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_inputBotInlineMessageID.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_inputBotInlineMessageID", constructor)); @@ -43066,13 +35979,13 @@ public static TL_inputBotInlineMessageID TLdeserialize(AbstractSerializedData st return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { dc_id = stream.readInt32(exception); id = stream.readInt64(exception); access_hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(dc_id); stream.writeInt64(id); @@ -43082,7 +35995,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class SecurePlainData extends TLObject { - public static SecurePlainData TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static SecurePlainData TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { SecurePlainData result = null; switch (constructor) { case 0x21ec5a5f: @@ -43107,11 +36020,11 @@ public static class TL_securePlainEmail extends SecurePlainData { public String email; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { email = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(email); } @@ -43122,11 +36035,11 @@ public static class TL_securePlainPhone extends SecurePlainData { public String phone; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { phone = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(phone); } @@ -43139,7 +36052,7 @@ public static class TL_secureSecretSettings extends TLObject { public byte[] secure_secret; public long secure_secret_id; - public static TL_secureSecretSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_secureSecretSettings TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_secureSecretSettings.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_secureSecretSettings", constructor)); @@ -43152,13 +36065,13 @@ public static TL_secureSecretSettings TLdeserialize(AbstractSerializedData strea return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { secure_algo = SecurePasswordKdfAlgo.TLdeserialize(stream, stream.readInt32(exception), exception); secure_secret = stream.readByteArray(exception); secure_secret_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); secure_algo.serializeToStream(stream); stream.writeByteArray(secure_secret); @@ -43171,7 +36084,7 @@ public static class TL_emojiLanguage extends TLObject { public String lang_code; - public static TL_emojiLanguage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_emojiLanguage TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_emojiLanguage.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_emojiLanguage", constructor)); @@ -43184,11 +36097,11 @@ public static TL_emojiLanguage TLdeserialize(AbstractSerializedData stream, int return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { lang_code = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(lang_code); } @@ -43196,7 +36109,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class Theme extends TLObject { - public static TL_theme TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_theme TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { TL_theme result = null; switch (constructor) { case 0x28f1114: @@ -43228,7 +36141,7 @@ public static TL_theme TLdeserialize(AbstractSerializedData stream, int construc public static class TL_theme_layer133 extends TL_theme { public static final int constructor = 0xe802b8dc; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; isDefault = (flags & 2) != 0; @@ -43249,7 +36162,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = isDefault ? (flags | 2) : (flags &~ 2); @@ -43287,7 +36200,7 @@ public static class TL_theme extends Theme { public String emoticon; public int installs_count; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; isDefault = (flags & 2) != 0; @@ -43300,21 +36213,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_themeSettings object = TL_themeSettings.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - settings.add(object); - } + settings = Vector.deserialize(stream, TL_themeSettings::TLdeserialize, exception); } if ((flags & 64) != 0) { emoticon = stream.readString(exception); @@ -43324,7 +36223,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = isDefault ? (flags | 2) : (flags &~ 2); @@ -43338,12 +36237,7 @@ public void serializeToStream(AbstractSerializedData stream) { document.serializeToStream(stream); } if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = settings.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - settings.get(a).serializeToStream(stream); - } + Vector.serialize(stream, settings); } if ((flags & 64) != 0) { stream.writeString(emoticon); @@ -43357,8 +36251,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_theme_layer131 extends TL_theme { public static final int constructor = 0x28f1114; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; isDefault = (flags & 2) != 0; @@ -43375,7 +36268,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { installs_count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = isDefault ? (flags | 2) : (flags &~ 2); @@ -43397,8 +36290,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_theme_layer106 extends TL_theme { public static final int constructor = 0xf7d90ce0; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; isDefault = (flags & 2) != 0; @@ -43412,7 +36304,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { installs_count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = isDefault ? (flags | 2) : (flags &~ 2); @@ -43431,8 +36323,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_themeDocumentNotModified_layer106 extends TL_theme { public static final int constructor = 0x483d270c; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -43449,8 +36340,7 @@ public static abstract class updates_ChannelDifference extends TLObject { public Dialog dialog; public ArrayList messages = new ArrayList<>(); - - public static updates_ChannelDifference TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static updates_ChannelDifference TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { updates_ChannelDifference result = null; switch (constructor) { case 0x3e11affb: @@ -43476,8 +36366,7 @@ public static updates_ChannelDifference TLdeserialize(AbstractSerializedData str public static class TL_updates_channelDifferenceEmpty extends updates_ChannelDifference { public static final int constructor = 0x3e11affb; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); isFinal = (flags & 1) != 0; pts = stream.readInt32(exception); @@ -43486,7 +36375,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = isFinal ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -43500,77 +36389,20 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_updates_channelDifference extends updates_ChannelDifference { public static final int constructor = 0x2064674e; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); isFinal = (flags & 1) != 0; pts = stream.readInt32(exception); if ((flags & 2) != 0) { timeout = stream.readInt32(exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - new_messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Update object = Update.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - other_updates.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + new_messages = Vector.deserialize(stream, Message::TLdeserialize, exception); + other_updates = Vector.deserialize(stream, Update::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = isFinal ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -43578,92 +36410,29 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 2) != 0) { stream.writeInt32(timeout); } - stream.writeInt32(0x1cb5c415); - int count = new_messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - new_messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = other_updates.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - other_updates.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, new_messages); + Vector.serialize(stream, other_updates); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } public static class TL_updates_channelDifferenceTooLong extends updates_ChannelDifference { public static final int constructor = 0xa4bcc6fe; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); isFinal = (flags & 1) != 0; if ((flags & 2) != 0) { timeout = stream.readInt32(exception); } dialog = Dialog.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + messages = Vector.deserialize(stream, Message::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = isFinal ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -43671,24 +36440,9 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(timeout); } dialog.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, messages); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } @@ -43697,7 +36451,7 @@ public static abstract class ChannelMessagesFilter extends TLObject { public boolean exclude_new_messages; public ArrayList ranges = new ArrayList<>(); - public static ChannelMessagesFilter TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static ChannelMessagesFilter TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { ChannelMessagesFilter result = null; switch (constructor) { case 0x94d42ee7: @@ -43735,7 +36489,7 @@ public static class TL_sponsoredMessage extends TLObject { public TL_peerColor color; public MessageMedia media; - public static TL_sponsoredMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_sponsoredMessage TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_sponsoredMessage.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_sponsoredMessage", constructor)); @@ -43748,7 +36502,7 @@ public static TL_sponsoredMessage TLdeserialize(AbstractSerializedData stream, i return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); recommended = (flags & 32) != 0; can_report = (flags & 4096) != 0; @@ -43757,21 +36511,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { title = stream.readString(exception); message = stream.readString(exception); if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } if ((flags & 64) != 0) { photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -43791,7 +36531,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = recommended ? (flags | 32) : (flags &~ 32); flags = can_report ? (flags | 4096) : (flags &~ 4096); @@ -43801,12 +36541,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeString(title); stream.writeString(message); if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } if ((flags & 64) != 0) { photo.serializeToStream(stream); @@ -43833,7 +36568,7 @@ public static class TL_sponsoredMessageReportOption extends TLObject { public String text; public byte[] option; - public static TL_sponsoredMessageReportOption TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_sponsoredMessageReportOption TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_sponsoredMessageReportOption.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_sponsoredMessageReportOption", constructor)); @@ -43846,12 +36581,12 @@ public static TL_sponsoredMessageReportOption TLdeserialize(AbstractSerializedDa return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = stream.readString(exception); option = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(text); stream.writeByteArray(option); @@ -43860,7 +36595,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class channels_SponsoredMessageReportResult extends TLObject { - public static channels_SponsoredMessageReportResult TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static channels_SponsoredMessageReportResult TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { channels_SponsoredMessageReportResult result = null; switch (constructor) { case 0x846f9e42: @@ -43889,41 +36624,22 @@ public static class TL_channels_sponsoredMessageReportResultChooseOption extends public String title; public ArrayList options = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { title = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_sponsoredMessageReportOption object = TL_sponsoredMessageReportOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - options.add(object); - } + options = Vector.deserialize(stream, TL_sponsoredMessageReportOption::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(title); - stream.writeInt32(0x1cb5c415); - int count = options.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - options.get(a).serializeToStream(stream); - } + Vector.serialize(stream, options); } } public static class TL_channels_sponsoredMessageReportResultAdsHidden extends channels_SponsoredMessageReportResult { public static final int constructor = 0x3e3bcf2f; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -43931,7 +36647,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channels_sponsoredMessageReportResultReported extends channels_SponsoredMessageReportResult { public static final int constructor = 0xad798849; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -43943,11 +36659,11 @@ public static class TL_messages_reportSponsoredMessage extends TLObject { public byte[] random_id; public byte[] option; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return channels_SponsoredMessageReportResult.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeByteArray(random_id); @@ -43955,129 +36671,6 @@ public void serializeToStream(AbstractSerializedData stream) { } } - public static class TL_account_authorizationForm extends TLObject { - public static final int constructor = 0xad2e1cd8; - - public int flags; - public ArrayList required_types = new ArrayList<>(); - public ArrayList values = new ArrayList<>(); - public ArrayList errors = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); - public String privacy_policy_url; - - public static TL_account_authorizationForm TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_account_authorizationForm.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_account_authorizationForm", constructor)); - } else { - return null; - } - } - TL_account_authorizationForm result = new TL_account_authorizationForm(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - SecureRequiredType object = SecureRequiredType.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - required_types.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_secureValue object = TL_secureValue.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - values.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - SecureValueError object = SecureValueError.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - errors.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - if ((flags & 1) != 0) { - privacy_policy_url = stream.readString(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = required_types.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - required_types.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = values.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - values.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = errors.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - errors.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - if ((flags & 1) != 0) { - stream.writeString(privacy_policy_url); - } - } - } - public static class TL_help_recentMeUrls extends TLObject { public static final int constructor = 0xe0310d7; @@ -44085,7 +36678,7 @@ public static class TL_help_recentMeUrls extends TLObject { public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_help_recentMeUrls TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_help_recentMeUrls TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_help_recentMeUrls.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_help_recentMeUrls", constructor)); @@ -44098,82 +36691,24 @@ public static TL_help_recentMeUrls TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RecentMeUrl object = RecentMeUrl.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - urls.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + urls = Vector.deserialize(stream, RecentMeUrl::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = urls.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - urls.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, urls); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } public static class TL_channelMessagesFilterEmpty extends ChannelMessagesFilter { public static final int constructor = 0x94d42ee7; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -44181,37 +36716,17 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelMessagesFilter extends ChannelMessagesFilter { public static final int constructor = 0xcd77d957; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); exclude_new_messages = (flags & 2) != 0; - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_messageRange object = TL_messageRange.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - ranges.add(object); - } + ranges = Vector.deserialize(stream, TL_messageRange::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = exclude_new_messages ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = ranges.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - ranges.get(a).serializeToStream(stream); - } + Vector.serialize(stream, ranges); } } @@ -44221,7 +36736,7 @@ public static class TL_bankCardOpenUrl extends TLObject { public String url; public String name; - public static TL_bankCardOpenUrl TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_bankCardOpenUrl TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_bankCardOpenUrl.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_bankCardOpenUrl", constructor)); @@ -44234,12 +36749,12 @@ public static TL_bankCardOpenUrl TLdeserialize(AbstractSerializedData stream, in return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); name = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); stream.writeString(name); @@ -44253,7 +36768,7 @@ public static class TL_contacts_resolvedPeer extends TLObject { public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_contacts_resolvedPeer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_contacts_resolvedPeer TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_contacts_resolvedPeer.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_contacts_resolvedPeer", constructor)); @@ -44266,55 +36781,17 @@ public static TL_contacts_resolvedPeer TLdeserialize(AbstractSerializedData stre return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } @@ -44325,7 +36802,7 @@ public static class TL_searchResultPosition extends TLObject { public int date; public int offset; - public static TL_searchResultPosition TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_searchResultPosition TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_searchResultPosition.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_searchResultPosition", constructor)); @@ -44338,13 +36815,13 @@ public static TL_searchResultPosition TLdeserialize(AbstractSerializedData strea return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { msg_id = stream.readInt32(exception); date = stream.readInt32(exception); offset = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(msg_id); stream.writeInt32(date); @@ -44358,7 +36835,7 @@ public static class TL_messages_searchResultsPositions extends TLObject { public int count; public ArrayList positions = new ArrayList<>(); - public static TL_messages_searchResultsPositions TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_searchResultsPositions TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_searchResultsPositions.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_searchResultsPositions", constructor)); @@ -44371,34 +36848,15 @@ public static TL_messages_searchResultsPositions TLdeserialize(AbstractSerialize return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_searchResultPosition object = TL_searchResultPosition.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - positions.add(object); - } + positions = Vector.deserialize(stream, TL_searchResultPosition::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = positions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - positions.get(a).serializeToStream(stream); - } + Vector.serialize(stream, positions); } } @@ -44410,7 +36868,7 @@ public static class TL_searchResultsCalendarPeriod extends TLObject { public int max_msg_id; public int count; - public static TL_searchResultsCalendarPeriod TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_searchResultsCalendarPeriod TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_searchResultsCalendarPeriod.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_searchResultsCalendarPeriod", constructor)); @@ -44423,14 +36881,14 @@ public static TL_searchResultsCalendarPeriod TLdeserialize(AbstractSerializedDat return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { date = stream.readInt32(exception); min_msg_id = stream.readInt32(exception); max_msg_id = stream.readInt32(exception); count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(date); stream.writeInt32(min_msg_id); @@ -44448,7 +36906,7 @@ public static class TL_inputSingleMedia extends TLObject { public String message; public ArrayList entities = new ArrayList<>(); - public static TL_inputSingleMedia TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_inputSingleMedia TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_inputSingleMedia.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_inputSingleMedia", constructor)); @@ -44461,43 +36919,24 @@ public static TL_inputSingleMedia TLdeserialize(AbstractSerializedData stream, i return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); media = InputMedia.TLdeserialize(stream, stream.readInt32(exception), exception); random_id = stream.readInt64(exception); message = stream.readString(exception); if ((flags & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); media.serializeToStream(stream); stream.writeInt64(random_id); stream.writeString(message); if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } } } @@ -44508,7 +36947,7 @@ public static class TL_inputPhoneCall extends TLObject { public long id; public long access_hash; - public static TL_inputPhoneCall TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_inputPhoneCall TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_inputPhoneCall.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_inputPhoneCall", constructor)); @@ -44521,12 +36960,12 @@ public static TL_inputPhoneCall TLdeserialize(AbstractSerializedData stream, int return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -44540,7 +36979,7 @@ public static abstract class WebDocument extends TLObject { public String mime_type; public ArrayList attributes = new ArrayList<>(); - public static WebDocument TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static WebDocument TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { WebDocument result = null; switch (constructor) { case 0xf9c8bcc6: @@ -44566,81 +37005,41 @@ public static WebDocument TLdeserialize(AbstractSerializedData stream, int const public static class TL_webDocumentNoProxy extends WebDocument { public static final int constructor = 0xf9c8bcc6; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); size = stream.readInt32(exception); mime_type = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } + attributes = Vector.deserialize(stream, DocumentAttribute::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); stream.writeInt32(size); stream.writeString(mime_type); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } + Vector.serialize(stream, attributes); } } public static class TL_webDocument_layer81 extends TL_webDocument { public static final int constructor = 0xc61acbd8; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); access_hash = stream.readInt64(exception); size = stream.readInt32(exception); mime_type = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } + attributes = Vector.deserialize(stream, DocumentAttribute::TLdeserialize, exception); stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); stream.writeInt64(access_hash); stream.writeInt32(size); stream.writeString(mime_type); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } + Vector.serialize(stream, attributes); stream.writeInt32(0); } } @@ -44648,47 +37047,27 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_webDocument extends WebDocument { public static final int constructor = 0x1c570ed1; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); access_hash = stream.readInt64(exception); size = stream.readInt32(exception); mime_type = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } + attributes = Vector.deserialize(stream, DocumentAttribute::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); stream.writeInt64(access_hash); stream.writeInt32(size); stream.writeString(mime_type); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } + Vector.serialize(stream, attributes); } } public static abstract class help_PromoData extends TLObject { - public static help_PromoData TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static help_PromoData TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { help_PromoData result = null; switch (constructor) { case 0x8c39793f: @@ -44720,41 +37099,13 @@ public static class TL_help_promoData extends help_PromoData { public String psa_type; public String psa_message; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); proxy = (flags & 1) != 0; expires = stream.readInt32(exception); peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); if ((flags & 2) != 0) { psa_type = stream.readString(exception); } @@ -44763,24 +37114,14 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = proxy ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); stream.writeInt32(expires); peer.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, chats); + Vector.serialize(stream, users); if ((flags & 2) != 0) { stream.writeString(psa_type); } @@ -44795,11 +37136,11 @@ public static class TL_help_promoDataEmpty extends help_PromoData { public int expires; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { expires = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(expires); } @@ -44824,7 +37165,7 @@ public static abstract class ChannelParticipant extends TLObject { public long user_id; public int subscription_until_date; - public static ChannelParticipant TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static ChannelParticipant TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { ChannelParticipant result = null; switch (constructor) { case 0x222c1886: @@ -44913,8 +37254,7 @@ public static ChannelParticipant TLdeserialize(AbstractSerializedData stream, in public static class TL_channelParticipant extends ChannelParticipant { public static final int constructor = 0xcb397619; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); peer = new TLRPC.TL_peerUser(); peer.user_id = stream.readInt64(exception); @@ -44924,7 +37264,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(peer.user_id); @@ -44938,14 +37278,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipant_layer185 extends TL_channelParticipant { public static final int constructor = 0xc00c07c0; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = new TLRPC.TL_peerUser(); peer.user_id = stream.readInt64(exception); date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(peer.user_id); stream.writeInt32(date); @@ -44955,7 +37294,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantSelf extends ChannelParticipant { public static final int constructor = 0x4f607bef; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); via_invite = (flags & 1) != 0; user_id = stream.readInt64(exception); @@ -44966,7 +37305,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = via_invite ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -44982,7 +37321,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantSelf_layer185 extends TL_channelParticipantSelf { public static final int constructor = 0x35a8bfa7; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); via_invite = (flags & 1) != 0; user_id = stream.readInt64(exception); @@ -44990,7 +37329,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = via_invite ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -45003,15 +37342,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantSelf_layer133 extends ChannelParticipant { public static final int constructor = 0x28a8bc67; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = new TLRPC.TL_peerUser(); peer.user_id = stream.readInt64(exception); inviter_id = stream.readInt64(exception); date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(peer.user_id); stream.writeInt64(inviter_id); @@ -45022,8 +37360,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantCreator extends ChannelParticipant { public static final int constructor = 0x2fe601d3; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); peer = new TLRPC.TL_peerUser(); peer.user_id = stream.readInt64(exception); @@ -45033,7 +37370,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(peer.user_id); @@ -45047,8 +37384,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantAdmin extends ChannelParticipant { public static final int constructor = 0x34c3bb53; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_edit = (flags & 1) != 0; self = (flags & 2) != 0; @@ -45065,7 +37401,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_edit ? (flags | 1) : (flags &~ 1); flags = self ? (flags | 2) : (flags &~ 2); @@ -45086,8 +37422,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantBanned extends ChannelParticipant { public static final int constructor = 0x6df8014e; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); left = (flags & 1) != 0; peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -45096,7 +37431,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { banned_rights = TL_chatBannedRights.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = left ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -45110,8 +37445,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantBanned_layer125 extends TL_channelParticipantBanned { public static final int constructor = 0x1c0facaf; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); left = (flags & 1) != 0; peer = new TLRPC.TL_peerUser(); @@ -45121,7 +37455,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { banned_rights = TL_chatBannedRights.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = left ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -45135,12 +37469,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantLeft extends ChannelParticipant { public static final int constructor = 0x1b03f006; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); } @@ -45149,13 +37482,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantLeft_layer125 extends TL_channelParticipantLeft { public static final int constructor = 0xc3c6796b; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = new TLRPC.TL_peerUser(); peer.user_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) peer.user_id); } @@ -45164,8 +37496,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantBanned_layer131 extends TL_channelParticipantBanned { public static final int constructor = 0x50a1dfd6; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); left = (flags & 1) != 0; peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -45174,7 +37505,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { banned_rights = TL_chatBannedRights.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = left ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -45188,13 +37519,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantCreator_layer103 extends TL_channelParticipantCreator { public static final int constructor = 0xe3e2e1f9; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = new TLRPC.TL_peerUser(); peer.user_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) peer.user_id); } @@ -45203,14 +37533,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipant_layer131 extends TL_channelParticipant { public static final int constructor = 0x15ebac1d; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = new TLRPC.TL_peerUser(); peer.user_id = stream.readInt32(exception); date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) peer.user_id); stream.writeInt32(date); @@ -45220,15 +37549,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantKicked_layer67 extends ChannelParticipant { public static final int constructor = 0x8cc5e69a; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = new TLRPC.TL_peerUser(); peer.user_id = stream.readInt32(exception); kicked_by = stream.readInt32(exception); date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) peer.user_id); stream.writeInt32((int) kicked_by); @@ -45239,15 +37567,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantSelf_layer131 extends TL_channelParticipantSelf { public static final int constructor = 0xa3289a6d; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = new TLRPC.TL_peerUser(); peer.user_id = stream.readInt32(exception); inviter_id = stream.readInt32(exception); date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) peer.user_id); stream.writeInt32((int) inviter_id); @@ -45258,8 +37585,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantAdmin_layer131 extends TL_channelParticipantAdmin { public static final int constructor = 0xccbebbaf; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_edit = (flags & 1) != 0; self = (flags & 2) != 0; @@ -45276,7 +37602,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_edit ? (flags | 1) : (flags &~ 1); flags = self ? (flags | 2) : (flags &~ 2); @@ -45297,8 +37623,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantCreator_layer118 extends TL_channelParticipantCreator { public static final int constructor = 0x808d15a4; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); peer = new TLRPC.TL_peerUser(); peer.user_id = stream.readInt32(exception); @@ -45307,7 +37632,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32((int) peer.user_id); @@ -45320,8 +37645,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantCreator_layer131 extends TL_channelParticipantCreator { public static final int constructor = 0x447dca4b; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); peer = new TLRPC.TL_peerUser(); peer.user_id = stream.readInt32(exception); @@ -45331,7 +37655,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32((int) peer.user_id); @@ -45345,15 +37669,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantModerator_layer67 extends TL_channelParticipantAdmin { public static final int constructor = 0x91057fef; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = new TLRPC.TL_peerUser(); peer.user_id = stream.readInt32(exception); inviter_id = stream.readInt32(exception); date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) peer.user_id); stream.writeInt32((int) inviter_id); @@ -45364,15 +37687,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantEditor_layer67 extends TL_channelParticipantAdmin { public static final int constructor = 0x98192d61; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = new TLRPC.TL_peerUser(); peer.user_id = stream.readInt32(exception); inviter_id = stream.readInt32(exception); date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) peer.user_id); stream.writeInt32((int) inviter_id); @@ -45383,8 +37705,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantAdmin_layer92 extends TL_channelParticipantAdmin { public static final int constructor = 0xa82fa898; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_edit = (flags & 1) != 0; peer = new TLRPC.TL_peerUser(); @@ -45396,7 +37717,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { admin_rights = Chat.mergeAdminRights(admin_rights_layer92); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_edit ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -45411,8 +37732,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantAdmin_layer103 extends TL_channelParticipantAdmin { public static final int constructor = 0x5daa6e23; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); can_edit = (flags & 1) != 0; self = (flags & 2) != 0; @@ -45426,7 +37746,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = can_edit ? (flags | 1) : (flags &~ 1); flags = self ? (flags | 2) : (flags &~ 2); @@ -45443,7 +37763,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class InputStickeredMedia extends TLObject { - public static InputStickeredMedia TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputStickeredMedia TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputStickeredMedia result = null; switch (constructor) { case 0x438865b: @@ -45468,11 +37788,11 @@ public static class TL_inputStickeredMediaDocument extends InputStickeredMedia { public InputDocument id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = InputDocument.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); id.serializeToStream(stream); } @@ -45483,11 +37803,11 @@ public static class TL_inputStickeredMediaPhoto extends InputStickeredMedia { public InputPhoto id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = InputPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); id.serializeToStream(stream); } @@ -45499,7 +37819,7 @@ public static abstract class channels_ChannelParticipants extends TLObject { public ArrayList users = new ArrayList<>(); public ArrayList chats = new ArrayList<>(); - public static channels_ChannelParticipants TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static channels_ChannelParticipants TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { channels_ChannelParticipants result = null; switch (constructor) { case 0x9ab0feaf: @@ -45522,84 +37842,26 @@ public static channels_ChannelParticipants TLdeserialize(AbstractSerializedData public static class TL_channels_channelParticipants extends channels_ChannelParticipants { public static final int constructor = 0x9ab0feaf; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - ChannelParticipant object = ChannelParticipant.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - participants.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + participants = Vector.deserialize(stream, ChannelParticipant::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = participants.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - participants.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, participants); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } public static class TL_channels_channelParticipantsNotModified extends channels_ChannelParticipants { public static final int constructor = 0xf0173fe9; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -45617,7 +37879,7 @@ public static abstract class WallPaperSettings extends TLObject { public int rotation; public String emoticon; - public static WallPaperSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static WallPaperSettings TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { WallPaperSettings result = null; switch (constructor) { case TL_wallPaperSettings_layer106.constructor: @@ -45646,8 +37908,7 @@ public static WallPaperSettings TLdeserialize(AbstractSerializedData stream, int public static class TL_wallPaperSettings_layer106 extends TL_wallPaperSettings { public static final int constructor = 0xa12f40b8; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blur = (flags & 2) != 0; motion = (flags & 4) != 0; @@ -45659,7 +37920,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blur ? (flags | 2) : (flags &~ 2); flags = motion ? (flags | 4) : (flags &~ 4); @@ -45676,8 +37937,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_wallPaperSettings_layer128 extends TL_wallPaperSettings { public static final int constructor = 0x5086cf8; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blur = (flags & 2) != 0; motion = (flags & 4) != 0; @@ -45695,7 +37955,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blur ? (flags | 2) : (flags &~ 2); flags = motion ? (flags | 4) : (flags &~ 4); @@ -45718,68 +37978,66 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_wallPaperSettings extends WallPaperSettings { public static final int constructor = 0x372efcd0; + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + blur = (flags & 2) != 0; + motion = (flags & 4) != 0; + if ((flags & 1) != 0) { + background_color = stream.readInt32(exception); + } + if ((flags & 16) != 0) { + second_background_color = stream.readInt32(exception); + } + if ((flags & 32) != 0) { + third_background_color = stream.readInt32(exception); + } + if ((flags & 64) != 0) { + fourth_background_color = stream.readInt32(exception); + } + if ((flags & 8) != 0) { + intensity = stream.readInt32(exception); + } + if ((flags & 16) != 0) { + rotation = stream.readInt32(exception); + } + if ((flags & 128) != 0) { + emoticon = stream.readString(exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = blur ? (flags | 2) : (flags &~ 2); + flags = motion ? (flags | 4) : (flags &~ 4); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + stream.writeInt32(background_color); + } + if ((flags & 16) != 0) { + stream.writeInt32(second_background_color); + } + if ((flags & 32) != 0) { + stream.writeInt32(third_background_color); + } + if ((flags & 64) != 0) { + stream.writeInt32(fourth_background_color); + } + if ((flags & 8) != 0) { + stream.writeInt32(intensity); + } + if ((flags & 16) != 0) { + stream.writeInt32(rotation); + } + if ((flags & 128) != 0) { + stream.writeString(emoticon); + } + } + } + + public static class TL_wallPaperSettings_layer167 extends TL_wallPaperSettings { + public static final int constructor = 0x1dc1bca4; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - blur = (flags & 2) != 0; - motion = (flags & 4) != 0; - if ((flags & 1) != 0) { - background_color = stream.readInt32(exception); - } - if ((flags & 16) != 0) { - second_background_color = stream.readInt32(exception); - } - if ((flags & 32) != 0) { - third_background_color = stream.readInt32(exception); - } - if ((flags & 64) != 0) { - fourth_background_color = stream.readInt32(exception); - } - if ((flags & 8) != 0) { - intensity = stream.readInt32(exception); - } - if ((flags & 16) != 0) { - rotation = stream.readInt32(exception); - } - if ((flags & 128) != 0) { - emoticon = stream.readString(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = blur ? (flags | 2) : (flags &~ 2); - flags = motion ? (flags | 4) : (flags &~ 4); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - stream.writeInt32(background_color); - } - if ((flags & 16) != 0) { - stream.writeInt32(second_background_color); - } - if ((flags & 32) != 0) { - stream.writeInt32(third_background_color); - } - if ((flags & 64) != 0) { - stream.writeInt32(fourth_background_color); - } - if ((flags & 8) != 0) { - stream.writeInt32(intensity); - } - if ((flags & 16) != 0) { - stream.writeInt32(rotation); - } - if ((flags & 128) != 0) { - stream.writeString(emoticon); - } - } - } - - public static class TL_wallPaperSettings_layer167 extends TL_wallPaperSettings { - public static final int constructor = 0x1dc1bca4; - - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blur = (flags & 2) != 0; motion = (flags & 4) != 0; @@ -45803,7 +38061,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blur ? (flags | 2) : (flags &~ 2); flags = motion ? (flags | 4) : (flags &~ 4); @@ -45837,7 +38095,7 @@ public static class TL_contacts_found extends TLObject { public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_contacts_found TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_contacts_found TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_contacts_found.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_contacts_found", constructor)); @@ -45850,95 +38108,19 @@ public static TL_contacts_found TLdeserialize(AbstractSerializedData stream, int return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Peer object = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - my_results.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Peer object = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - results.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + my_results = Vector.deserialize(stream, Peer::TLdeserialize, exception); + results = Vector.deserialize(stream, Peer::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = my_results.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - my_results.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = results.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - results.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, my_results); + Vector.serialize(stream, results); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } @@ -45950,7 +38132,7 @@ public static abstract class ChatParticipants extends TLObject { public int version; public long admin_id; - public static ChatParticipants TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static ChatParticipants TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { ChatParticipants result = null; switch (constructor) { case 0xfc900c2b: @@ -45985,8 +38167,7 @@ public static ChatParticipants TLdeserialize(AbstractSerializedData stream, int public static class TL_chatParticipantsForbidden_layer131 extends TL_chatParticipantsForbidden { public static final int constructor = 0xfc900c2b; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); chat_id = stream.readInt32(exception); if ((flags & 1) != 0) { @@ -45994,7 +38175,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32((int) chat_id); @@ -46007,36 +38188,16 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatParticipants_layer131 extends TL_chatParticipants { public static final int constructor = 0x3f460fed; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { chat_id = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - ChatParticipant object = ChatParticipant.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - participants.add(object); - } + participants = Vector.deserialize(stream, ChatParticipant::TLdeserialize, exception); version = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) chat_id); - stream.writeInt32(0x1cb5c415); - int count = participants.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - participants.get(a).serializeToStream(stream); - } + Vector.serialize(stream, participants); stream.writeInt32(version); } } @@ -46044,8 +38205,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatParticipantsForbidden extends ChatParticipants { public static final int constructor = 0x8763d3e1; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); chat_id = stream.readInt64(exception); if ((flags & 1) != 0) { @@ -46053,7 +38213,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(chat_id); @@ -46066,36 +38226,16 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatParticipants extends ChatParticipants { public static final int constructor = 0x3cbc93f8; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { chat_id = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - ChatParticipant object = ChatParticipant.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - participants.add(object); - } + participants = Vector.deserialize(stream, ChatParticipant::TLdeserialize, exception); version = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(chat_id); - stream.writeInt32(0x1cb5c415); - int count = participants.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - participants.get(a).serializeToStream(stream); - } + Vector.serialize(stream, participants); stream.writeInt32(version); } } @@ -46103,38 +38243,18 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatParticipants_old extends TL_chatParticipants { public static final int constructor = 0x7841b415; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { chat_id = stream.readInt32(exception); admin_id = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - ChatParticipant object = ChatParticipant.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - participants.add(object); - } + participants = Vector.deserialize(stream, ChatParticipant::TLdeserialize, exception); version = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) chat_id); stream.writeInt32((int) admin_id); - stream.writeInt32(0x1cb5c415); - int count = participants.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - participants.get(a).serializeToStream(stream); - } + Vector.serialize(stream, participants); stream.writeInt32(version); } } @@ -46142,12 +38262,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatParticipantsForbidden_old extends TL_chatParticipantsForbidden { public static final int constructor = 0xfd2bb8a; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { chat_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) chat_id); } @@ -46165,7 +38284,7 @@ public static class TL_game extends TLObject { public Photo photo; public Document document; - public static TL_game TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_game TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_game.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_game", constructor)); @@ -46178,7 +38297,7 @@ public static TL_game TLdeserialize(AbstractSerializedData stream, int construct return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); id = stream.readInt64(exception); access_hash = stream.readInt64(exception); @@ -46191,7 +38310,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(id); @@ -46235,7 +38354,7 @@ public static abstract class DecryptedMessageMedia extends TLObject { public int date; public int dc_id; - public static DecryptedMessageMedia TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static DecryptedMessageMedia TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { DecryptedMessageMedia result = null; switch (constructor) { case 0x57e0a9cb: @@ -46300,8 +38419,7 @@ public static DecryptedMessageMedia TLdeserialize(AbstractSerializedData stream, public static class TL_decryptedMessageMediaAudio extends DecryptedMessageMedia { public static final int constructor = 0x57e0a9cb; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { duration = stream.readInt32(exception); mime_type = stream.readString(exception); size = stream.readInt32(exception); @@ -46309,7 +38427,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { iv = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(duration); stream.writeString(mime_type); @@ -46322,13 +38440,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_decryptedMessageMediaGeoPoint extends DecryptedMessageMedia { public static final int constructor = 0x35480a59; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { lat = stream.readDouble(exception); _long = stream.readDouble(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeDouble(lat); stream.writeDouble(_long); @@ -46338,15 +38455,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_decryptedMessageMediaContact extends DecryptedMessageMedia { public static final int constructor = 0x588a0a97; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { phone_number = stream.readString(exception); first_name = stream.readString(exception); last_name = stream.readString(exception); user_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(phone_number); stream.writeString(first_name); @@ -46358,8 +38474,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_decryptedMessageMediaEmpty extends DecryptedMessageMedia { public static final int constructor = 0x89f5c4a; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -46369,7 +38484,7 @@ public static class TL_decryptedMessageMediaDocument extends DecryptedMessageMed public byte[] thumb; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { thumb = stream.readByteArray(exception); thumb_w = stream.readInt32(exception); thumb_h = stream.readInt32(exception); @@ -46377,25 +38492,11 @@ public void readParams(AbstractSerializedData stream, boolean exception) { size = stream.readInt64(exception); key = stream.readByteArray(exception); iv = stream.readByteArray(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } + attributes = Vector.deserialize(stream, DocumentAttribute::TLdeserialize, exception); caption = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeByteArray(thumb); stream.writeInt32(thumb_w); @@ -46404,12 +38505,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt64(size); stream.writeByteArray(key); stream.writeByteArray(iv); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } + Vector.serialize(stream, attributes); stream.writeString(caption); } } @@ -46419,7 +38515,7 @@ public static class TL_decryptedMessageMediaDocument_layer101 extends TL_decrypt public byte[] thumb; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { thumb = stream.readByteArray(exception); thumb_w = stream.readInt32(exception); thumb_h = stream.readInt32(exception); @@ -46427,25 +38523,11 @@ public void readParams(AbstractSerializedData stream, boolean exception) { size = stream.readInt32(exception); key = stream.readByteArray(exception); iv = stream.readByteArray(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } + attributes = Vector.deserialize(stream, DocumentAttribute::TLdeserialize, exception); caption = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeByteArray(thumb); stream.writeInt32(thumb_w); @@ -46454,12 +38536,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32((int) size); stream.writeByteArray(key); stream.writeByteArray(iv); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } + Vector.serialize(stream, attributes); stream.writeString(caption); } } @@ -46467,12 +38544,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_decryptedMessageMediaWebPage extends DecryptedMessageMedia { public static final int constructor = 0xe50511d8; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); } @@ -46483,7 +38559,7 @@ public static class TL_decryptedMessageMediaPhoto extends DecryptedMessageMedia public byte[] thumb; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { thumb = stream.readByteArray(exception); thumb_w = stream.readInt32(exception); thumb_h = stream.readInt32(exception); @@ -46495,7 +38571,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { caption = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeByteArray(thumb); stream.writeInt32(thumb_w); @@ -46514,7 +38590,7 @@ public static class TL_decryptedMessageMediaVideo extends DecryptedMessageMedia public byte[] thumb; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { thumb = stream.readByteArray(exception); thumb_w = stream.readInt32(exception); thumb_h = stream.readInt32(exception); @@ -46528,7 +38604,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { caption = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeByteArray(thumb); stream.writeInt32(thumb_w); @@ -46549,7 +38625,7 @@ public static class TL_decryptedMessageMediaDocument_layer8 extends TL_decrypted public byte[] thumb; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { thumb = stream.readByteArray(exception); thumb_w = stream.readInt32(exception); thumb_h = stream.readInt32(exception); @@ -46560,7 +38636,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { iv = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeByteArray(thumb); stream.writeInt32(thumb_w); @@ -46578,7 +38654,7 @@ public static class TL_decryptedMessageMediaVideo_layer8 extends TL_decryptedMes public byte[] thumb; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { thumb = stream.readByteArray(exception); thumb_w = stream.readInt32(exception); thumb_h = stream.readInt32(exception); @@ -46590,7 +38666,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { iv = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeByteArray(thumb); stream.writeInt32(thumb_w); @@ -46607,8 +38683,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_decryptedMessageMediaVenue extends DecryptedMessageMedia { public static final int constructor = 0x8a0df56f; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { lat = stream.readDouble(exception); _long = stream.readDouble(exception); title = stream.readString(exception); @@ -46617,7 +38692,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { venue_id = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeDouble(lat); stream.writeDouble(_long); @@ -46633,7 +38708,7 @@ public static class TL_decryptedMessageMediaExternalDocument extends DecryptedMe public PhotoSize thumb; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); date = stream.readInt32(exception); @@ -46641,24 +38716,10 @@ public void readParams(AbstractSerializedData stream, boolean exception) { size = stream.readInt32(exception); thumb = PhotoSize.TLdeserialize(0, id, 0, stream, stream.readInt32(exception), exception); dc_id = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DocumentAttribute object = DocumentAttribute.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - attributes.add(object); - } + attributes = Vector.deserialize(stream, DocumentAttribute::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -46667,12 +38728,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32((int) size); thumb.serializeToStream(stream); stream.writeInt32(dc_id); - stream.writeInt32(0x1cb5c415); - int count = attributes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - attributes.get(a).serializeToStream(stream); - } + Vector.serialize(stream, attributes); } } @@ -46681,7 +38737,7 @@ public static class TL_decryptedMessageMediaVideo_layer17 extends TL_decryptedMe public byte[] thumb; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { thumb = stream.readByteArray(exception); thumb_w = stream.readInt32(exception); thumb_h = stream.readInt32(exception); @@ -46694,7 +38750,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { iv = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeByteArray(thumb); stream.writeInt32(thumb_w); @@ -46712,15 +38768,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_decryptedMessageMediaAudio_layer8 extends TL_decryptedMessageMediaAudio { public static final int constructor = 0x6080758f; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { duration = stream.readInt32(exception); size = stream.readInt32(exception); key = stream.readByteArray(exception); iv = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(duration); stream.writeInt32((int) size); @@ -46734,7 +38789,7 @@ public static class TL_decryptedMessageMediaPhoto_layer8 extends TL_decryptedMes public byte[] thumb; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { thumb = stream.readByteArray(exception); thumb_w = stream.readInt32(exception); thumb_h = stream.readInt32(exception); @@ -46745,7 +38800,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { iv = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeByteArray(thumb); stream.writeInt32(thumb_w); @@ -46760,7 +38815,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class EmojiKeyword extends TLObject { - public static EmojiKeyword TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static EmojiKeyword TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { EmojiKeyword result = null; switch (constructor) { case 0x236df622: @@ -46786,36 +38841,21 @@ public static class TL_emojiKeywordDeleted extends EmojiKeyword { public String keyword; public ArrayList emoticons = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { keyword = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - emoticons.add(stream.readString(exception)); - } + emoticons = Vector.deserializeString(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(keyword); - stream.writeInt32(0x1cb5c415); - int count = emoticons.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(emoticons.get(a)); - } + Vector.serializeString(stream, emoticons); } } public static abstract class messages_EmojiGroups extends TLObject { - public static messages_EmojiGroups TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static messages_EmojiGroups TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { messages_EmojiGroups result = null; switch (constructor) { case 0x6fb4ad87: @@ -46838,8 +38878,7 @@ public static messages_EmojiGroups TLdeserialize(AbstractSerializedData stream, public static class TL_messages_emojiGroupsNotModified extends messages_EmojiGroups { public static final int constructor = 0x6fb4ad87; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -46850,34 +38889,15 @@ public static class TL_messages_emojiGroups extends messages_EmojiGroups { public int hash; public ArrayList groups = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { hash = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - EmojiGroup object = EmojiGroup.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - groups.add(object); - } + groups = Vector.deserialize(stream, EmojiGroup::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(hash); - stream.writeInt32(0x1cb5c415); - int count = groups.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - groups.get(a).serializeToStream(stream); - } + Vector.serialize(stream, groups); } } @@ -46887,7 +38907,7 @@ public static class EmojiGroup extends TLObject { public long icon_emoji_id; public ArrayList emoticons = new ArrayList<>(); - public static EmojiGroup TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static EmojiGroup TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { EmojiGroup result = null; switch (constructor) { case TL_emojiGroup.constructor: @@ -46913,76 +38933,46 @@ public static EmojiGroup TLdeserialize(AbstractSerializedData stream, int constr public static class TL_emojiGroup extends EmojiGroup { public static final int constructor = 0x7a9abda9; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { title = stream.readString(exception); icon_emoji_id = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - emoticons.add(stream.readString(exception)); - } + emoticons = Vector.deserializeString(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(title); stream.writeInt64(icon_emoji_id); - stream.writeInt32(0x1cb5c415); - int count = emoticons.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(emoticons.get(a)); - } + Vector.serializeString(stream, emoticons); } } public static class TL_emojiGroupGreeting extends EmojiGroup { public static final int constructor = 0x80d26cc7; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { title = stream.readString(exception); icon_emoji_id = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - emoticons.add(stream.readString(exception)); - } + emoticons = Vector.deserializeString(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(title); stream.writeInt64(icon_emoji_id); - stream.writeInt32(0x1cb5c415); - int count = emoticons.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(emoticons.get(a)); - } + Vector.serializeString(stream, emoticons); } } public static class TL_emojiGroupPremium extends EmojiGroup { public static final int constructor = 0x93bcf34; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { title = stream.readString(exception); icon_emoji_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(title); stream.writeInt64(icon_emoji_id); @@ -46995,64 +38985,15 @@ public static class TL_emojiKeyword extends EmojiKeyword { public String keyword; public ArrayList emoticons = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { keyword = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - emoticons.add(stream.readString(exception)); - } + emoticons = Vector.deserializeString(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(keyword); - stream.writeInt32(0x1cb5c415); - int count = emoticons.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(emoticons.get(a)); - } - } - } - - public static class TL_account_autoDownloadSettings extends TLObject { - public static final int constructor = 0x63cacf26; - - public TL_autoDownloadSettings low; - public TL_autoDownloadSettings medium; - public TL_autoDownloadSettings high; - - public static TL_account_autoDownloadSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_account_autoDownloadSettings.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_account_autoDownloadSettings", constructor)); - } else { - return null; - } - } - TL_account_autoDownloadSettings result = new TL_account_autoDownloadSettings(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - low = TL_autoDownloadSettings.TLdeserialize(stream, stream.readInt32(exception), exception); - medium = TL_autoDownloadSettings.TLdeserialize(stream, stream.readInt32(exception), exception); - high = TL_autoDownloadSettings.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - low.serializeToStream(stream); - medium.serializeToStream(stream); - high.serializeToStream(stream); + Vector.serializeString(stream, emoticons); } } @@ -47062,7 +39003,7 @@ public static abstract class ChatParticipant extends TLObject { public long inviter_id; public int date; - public static ChatParticipant TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static ChatParticipant TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { ChatParticipant result = null; switch (constructor) { case 0xe2d6e436: @@ -47097,14 +39038,13 @@ public static ChatParticipant TLdeserialize(AbstractSerializedData stream, int c public static class TL_chatParticipantAdmin_layer131 extends TL_chatParticipantAdmin { public static final int constructor = 0xe2d6e436; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt32(exception); inviter_id = stream.readInt32(exception); date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) user_id); stream.writeInt32((int) inviter_id); @@ -47115,14 +39055,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatParticipantAdmin extends ChatParticipant { public static final int constructor = 0xa0933f5b; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); inviter_id = stream.readInt64(exception); date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); stream.writeInt64(inviter_id); @@ -47133,14 +39072,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatParticipant_layer131 extends TL_chatParticipant { public static final int constructor = 0xc8d7493e; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt32(exception); inviter_id = stream.readInt32(exception); date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) user_id); stream.writeInt32((int) inviter_id); @@ -47151,12 +39089,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatParticipantCreator_layer131 extends TL_chatParticipantCreator { public static final int constructor = 0xda13538a; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) user_id); } @@ -47165,14 +39102,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatParticipant extends ChatParticipant { public static final int constructor = 0xc02d4007; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); inviter_id = stream.readInt64(exception); date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); stream.writeInt64(inviter_id); @@ -47183,12 +39119,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatParticipantCreator extends ChatParticipant { public static final int constructor = 0xe46bcee4; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); } @@ -47211,7 +39146,7 @@ public static class TL_availableReaction extends TLObject { public Document center_icon; public int positionInList; //custom - public static TL_availableReaction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_availableReaction TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_availableReaction.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_availableReaction", constructor)); @@ -47224,7 +39159,7 @@ public static TL_availableReaction TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); inactive = (flags & 1) != 0; premium = (flags & 4) != 0; @@ -47243,7 +39178,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = inactive ? (flags | 1) : (flags &~ 1); flags = premium ? (flags | 4) : (flags &~ 4); @@ -47277,7 +39212,7 @@ public static class TL_webAuthorization extends TLObject { public String ip; public String region; - public static TL_webAuthorization TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_webAuthorization TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_webAuthorization.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_webAuthorization", constructor)); @@ -47290,7 +39225,7 @@ public static TL_webAuthorization TLdeserialize(AbstractSerializedData stream, i return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { hash = stream.readInt64(exception); bot_id = stream.readInt64(exception); domain = stream.readString(exception); @@ -47302,7 +39237,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { region = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(hash); stream.writeInt64(bot_id); @@ -47318,7 +39253,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class InputSecureFile extends TLObject { - public static InputSecureFile TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputSecureFile TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputSecureFile result = null; switch (constructor) { case 0x3334b0f0: @@ -47347,7 +39282,7 @@ public static class TL_inputSecureFileUploaded extends InputSecureFile { public byte[] file_hash; public byte[] secret; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); parts = stream.readInt32(exception); md5_checksum = stream.readString(exception); @@ -47355,7 +39290,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { secret = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt32(parts); @@ -47371,12 +39306,12 @@ public static class TL_inputSecureFile extends InputSecureFile { public long id; public long access_hash; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -47393,7 +39328,7 @@ public static class TL_postAddress extends TLObject { public String country_iso2; public String post_code; - public static TL_postAddress TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_postAddress TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_postAddress.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_postAddress", constructor)); @@ -47406,7 +39341,7 @@ public static TL_postAddress TLdeserialize(AbstractSerializedData stream, int co return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { street_line1 = stream.readString(exception); street_line2 = stream.readString(exception); city = stream.readString(exception); @@ -47415,7 +39350,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { post_code = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(street_line1); stream.writeString(street_line2); @@ -47428,7 +39363,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class ChannelAdminLogEventAction extends TLObject { - public static ChannelAdminLogEventAction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static ChannelAdminLogEventAction TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { ChannelAdminLogEventAction result = null; switch (constructor) { case 0xdb9f9140: @@ -47603,11 +39538,11 @@ public static class TL_channelAdminLogEventActionDiscardGroupCall extends Channe public TL_inputGroupCall call; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { call = TL_inputGroupCall.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); call.serializeToStream(stream); } @@ -47619,12 +39554,12 @@ public static class TL_channelAdminLogEventActionChangeStickerSet extends Channe public InputStickerSet prev_stickerset; public InputStickerSet new_stickerset; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_stickerset = InputStickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); new_stickerset = InputStickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); prev_stickerset.serializeToStream(stream); new_stickerset.serializeToStream(stream); @@ -47637,12 +39572,12 @@ public static class TL_channelAdminLogEventActionChangeEmojiStickerSet extends C public InputStickerSet prev_stickerset; public InputStickerSet new_stickerset; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_stickerset = InputStickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); new_stickerset = InputStickerSet.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); prev_stickerset.serializeToStream(stream); new_stickerset.serializeToStream(stream); @@ -47654,11 +39589,11 @@ public static class TL_channelAdminLogEventActionParticipantMute extends Channel public TL_groupCallParticipant participant; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { participant = TL_groupCallParticipant.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); participant.serializeToStream(stream); } @@ -47670,12 +39605,12 @@ public static class TL_channelAdminLogEventActionDefaultBannedRights extends Cha public TL_chatBannedRights prev_banned_rights; public TL_chatBannedRights new_banned_rights; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_banned_rights = TL_chatBannedRights.TLdeserialize(stream, stream.readInt32(exception), exception); new_banned_rights = TL_chatBannedRights.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); prev_banned_rights.serializeToStream(stream); new_banned_rights.serializeToStream(stream); @@ -47688,12 +39623,12 @@ public static class TL_channelAdminLogEventActionChangeTheme extends ChannelAdmi public String prev_value; public String new_value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_value = stream.readString(exception); new_value = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(prev_value); stream.writeString(new_value); @@ -47703,8 +39638,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelAdminLogEventActionParticipantLeave extends ChannelAdminLogEventAction { public static final int constructor = 0xf89777f2; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -47715,12 +39649,12 @@ public static class TL_channelAdminLogEventActionEditMessage extends ChannelAdmi public Message prev_message; public Message new_message; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_message = Message.TLdeserialize(stream, stream.readInt32(exception), exception); new_message = Message.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); prev_message.serializeToStream(stream); new_message.serializeToStream(stream); @@ -47733,12 +39667,12 @@ public static class TL_channelAdminLogEventActionExportedInviteEdit extends Chan public TL_chatInviteExported prev_invite; public TL_chatInviteExported new_invite; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_invite = (TL_chatInviteExported) ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); new_invite = (TL_chatInviteExported) ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); prev_invite.serializeToStream(stream); new_invite.serializeToStream(stream); @@ -47751,12 +39685,12 @@ public static class TL_channelAdminLogEventActionChangeUsername extends ChannelA public String prev_value; public String new_value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_value = stream.readString(exception); new_value = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(prev_value); stream.writeString(new_value); @@ -47769,12 +39703,12 @@ public static class TL_channelAdminLogEventActionChangeLocation extends ChannelA public ChannelLocation prev_value; public ChannelLocation new_value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_value = ChannelLocation.TLdeserialize(stream, stream.readInt32(exception), exception); new_value = ChannelLocation.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); prev_value.serializeToStream(stream); new_value.serializeToStream(stream); @@ -47787,12 +39721,12 @@ public static class TL_channelAdminLogEventActionChangePhoto extends ChannelAdmi public Photo prev_photo; public Photo new_photo; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); new_photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); prev_photo.serializeToStream(stream); new_photo.serializeToStream(stream); @@ -47805,12 +39739,12 @@ public static class TL_channelAdminLogEventActionParticipantToggleAdmin extends public ChannelParticipant prev_participant; public ChannelParticipant new_participant; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_participant = ChannelParticipant.TLdeserialize(stream, stream.readInt32(exception), exception); new_participant = ChannelParticipant.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); prev_participant.serializeToStream(stream); new_participant.serializeToStream(stream); @@ -47823,12 +39757,12 @@ public static class TL_channelAdminLogEventActionToggleSlowMode extends ChannelA public int prev_value; public int new_value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_value = stream.readInt32(exception); new_value = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(prev_value); stream.writeInt32(new_value); @@ -47842,13 +39776,13 @@ public static class TL_channelAdminLogEventActionParticipantJoinByInvite extends public TL_chatInviteExported invite; public boolean via_chatlist; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); via_chatlist = (flags & 1) != 0; invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = via_chatlist ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -47861,11 +39795,11 @@ public static class TL_channelAdminLogEventActionExportedInviteRevoke extends Ch public TL_chatInviteExported invite; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { invite = (TL_chatInviteExported) ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); invite.serializeToStream(stream); } @@ -47876,11 +39810,11 @@ public static class TL_channelAdminLogEventActionStopPoll extends ChannelAdminLo public Message message; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { message = Message.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); message.serializeToStream(stream); } @@ -47891,11 +39825,11 @@ public static class TL_channelAdminLogEventActionExportedInviteDelete extends Ch public TL_chatInviteExported invite; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { invite = (TL_chatInviteExported) ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); invite.serializeToStream(stream); } @@ -47906,11 +39840,11 @@ public static class TL_channelAdminLogEventActionToggleSignatures extends Channe public boolean new_value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { new_value = stream.readBool(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeBool(new_value); } @@ -47921,11 +39855,11 @@ public static class TL_channelAdminLogEventActionParticipantVolume extends Chann public TL_groupCallParticipant participant; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { participant = TL_groupCallParticipant.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); participant.serializeToStream(stream); } @@ -47936,11 +39870,11 @@ public static class TL_channelAdminLogEventActionToggleForum extends ChannelAdmi public boolean new_value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { new_value = stream.readBool(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeBool(new_value); } @@ -47952,12 +39886,12 @@ public static class TL_channelAdminLogEventActionEditTopic extends ChannelAdminL public ForumTopic prev_topic; public ForumTopic new_topic; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_topic = ForumTopic.TLdeserialize(stream, stream.readInt32(exception), exception); new_topic = ForumTopic.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); prev_topic.serializeToStream(stream); new_topic.serializeToStream(stream); @@ -47970,12 +39904,12 @@ public static class TL_channelAdminLogEventActionParticipantToggleBan extends Ch public ChannelParticipant prev_participant; public ChannelParticipant new_participant; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_participant = ChannelParticipant.TLdeserialize(stream, stream.readInt32(exception), exception); new_participant = ChannelParticipant.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); prev_participant.serializeToStream(stream); new_participant.serializeToStream(stream); @@ -47985,8 +39919,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelAdminLogEventActionParticipantJoin extends ChannelAdminLogEventAction { public static final int constructor = 0x183040d3; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -47996,11 +39929,11 @@ public static class TL_channelAdminLogEventActionTogglePreHistoryHidden extends public boolean new_value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { new_value = stream.readBool(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeBool(new_value); } @@ -48012,12 +39945,12 @@ public static class TL_channelAdminLogEventActionParticipantJoinByRequest extend public ExportedChatInvite invite; public long approved_by; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { invite = ExportedChatInvite.TLdeserialize(stream, stream.readInt32(exception), exception); approved_by = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); invite.serializeToStream(stream); stream.writeInt64(approved_by); @@ -48029,11 +39962,11 @@ public static class TL_channelAdminLogEventActionUpdatePinned extends ChannelAdm public Message message; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { message = Message.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); message.serializeToStream(stream); } @@ -48044,11 +39977,11 @@ public static class TL_channelAdminLogEventActionToggleGroupCallSetting extends public boolean join_muted; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { join_muted = stream.readBool(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeBool(join_muted); } @@ -48059,11 +39992,11 @@ public static class TL_channelAdminLogEventActionParticipantInvite extends Chann public ChannelParticipant participant; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { participant = ChannelParticipant.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); participant.serializeToStream(stream); } @@ -48075,12 +40008,12 @@ public static class TL_channelAdminLogEventActionChangeAbout extends ChannelAdmi public String prev_value; public String new_value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_value = stream.readString(exception); new_value = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(prev_value); stream.writeString(new_value); @@ -48092,11 +40025,11 @@ public static class TL_channelAdminLogEventActionStartGroupCall extends ChannelA public TL_inputGroupCall call; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { call = TL_inputGroupCall.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); call.serializeToStream(stream); } @@ -48108,12 +40041,12 @@ public static class TL_channelAdminLogEventActionChangeLinkedChat extends Channe public long prev_value; public long new_value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_value = stream.readInt64(exception); new_value = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(prev_value); stream.writeInt64(new_value); @@ -48125,11 +40058,11 @@ public static class TL_channelAdminLogEventActionSendMessage extends ChannelAdmi public Message message; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { message = Message.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); message.serializeToStream(stream); } @@ -48141,12 +40074,12 @@ public static class TL_channelAdminLogEventActionChangeAvailableReactions extend public ChatReactions prev_value; public ChatReactions new_value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_value = ChatReactions.TLdeserialize(stream, stream.readInt32(exception), exception); new_value = ChatReactions.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); prev_value.serializeToStream(stream); new_value.serializeToStream(stream); @@ -48158,11 +40091,11 @@ public static class TL_channelAdminLogEventActionToggleInvites extends ChannelAd public boolean new_value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { new_value = stream.readBool(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeBool(new_value); } @@ -48173,11 +40106,11 @@ public static class TL_channelAdminLogEventActionParticipantUnmute extends Chann public TL_groupCallParticipant participant; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { participant = TL_groupCallParticipant.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); participant.serializeToStream(stream); } @@ -48188,11 +40121,11 @@ public static class TL_channelAdminLogEventActionDeleteMessage extends ChannelAd public Message message; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { message = Message.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); message.serializeToStream(stream); } @@ -48204,12 +40137,12 @@ public static class TL_channelAdminLogEventActionChangeTitle extends ChannelAdmi public String prev_value; public String new_value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_value = stream.readString(exception); new_value = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(prev_value); stream.writeString(new_value); @@ -48222,12 +40155,12 @@ public static class TL_channelAdminLogEventActionChangeEmojiStatus extends Chann public EmojiStatus prev_value; public EmojiStatus new_value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_value = EmojiStatus.TLdeserialize(stream, stream.readInt32(exception), exception); new_value = EmojiStatus.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); prev_value.serializeToStream(stream); new_value.serializeToStream(stream); @@ -48239,11 +40172,11 @@ public static class TL_channelAdminLogEventActionToggleSignatureProfiles extends public boolean value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { value = stream.readBool(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeBool(value); } @@ -48255,12 +40188,12 @@ public static class TL_channelAdminLogEventActionParticipantSubExtend extends Ch public ChannelParticipant prev_participant; public ChannelParticipant new_participant; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_participant = ChannelParticipant.TLdeserialize(stream, stream.readInt32(exception), exception); new_participant = ChannelParticipant.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); prev_participant.serializeToStream(stream); new_participant.serializeToStream(stream); @@ -48274,7 +40207,7 @@ public static class TL_channelAdminLogEventActionPinTopic extends ChannelAdminLo public ForumTopic prev_topic; public ForumTopic new_topic; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { prev_topic = ForumTopic.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -48284,7 +40217,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -48302,12 +40235,12 @@ public static class TL_channelAdminLogEventActionChangeHistoryTTL extends Channe public int prev_value; public int new_value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_value = stream.readInt32(exception); new_value = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(prev_value); stream.writeInt32(new_value); @@ -48319,11 +40252,11 @@ public static class TL_channelAdminLogEventActionToggleNoForwards extends Channe public boolean new_value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { new_value = stream.readBool(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeBool(new_value); } @@ -48334,11 +40267,11 @@ public static class TL_channelAdminLogEventActionCreateTopic extends ChannelAdmi public ForumTopic topic; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { topic = ForumTopic.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); topic.serializeToStream(stream); } @@ -48349,11 +40282,11 @@ public static class TL_channelAdminLogEventActionDeleteTopic extends ChannelAdmi public ForumTopic topic; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { topic = ForumTopic.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); topic.serializeToStream(stream); } @@ -48365,44 +40298,15 @@ public static class TL_channelAdminLogEventActionChangeUsernames extends Channel public ArrayList prev_value = new ArrayList<>(); public ArrayList new_value = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - prev_value.add(stream.readString(exception)); - } - - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - new_value.add(stream.readString(exception)); - } + public void readParams(InputSerializedData stream, boolean exception) { + prev_value = Vector.deserializeString(stream, exception); + new_value = Vector.deserializeString(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - stream.writeInt32(prev_value.size()); - for (int i = 0; i < prev_value.size(); ++i) { - stream.writeString(prev_value.get(i)); - } - stream.writeInt32(0x1cb5c415); - stream.writeInt32(new_value.size()); - for (int i = 0; i < new_value.size(); ++i) { - stream.writeString(new_value.get(i)); - } + Vector.serializeString(stream, prev_value); + Vector.serializeString(stream, new_value); } } @@ -48412,12 +40316,12 @@ public static class TL_channelAdminLogEventActionChangeColor extends ChannelAdmi public int prev_value; public int new_value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_value = stream.readInt32(exception); new_value = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(prev_value); stream.writeInt32(new_value); @@ -48430,12 +40334,12 @@ public static class TL_channelAdminLogEventActionChangeBackgroundEmoji extends C public long prev_value; public long new_value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_value = stream.readInt64(exception); new_value = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(prev_value); stream.writeInt64(new_value); @@ -48448,12 +40352,12 @@ public static class TL_channelAdminLogEventActionChangePeerColor extends Channel public TL_peerColor prev_value; public TL_peerColor new_value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_value = TL_peerColor.TLdeserialize(stream, stream.readInt32(exception), exception); new_value = TL_peerColor.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); prev_value.serializeToStream(stream); new_value.serializeToStream(stream); @@ -48466,12 +40370,12 @@ public static class TL_channelAdminLogEventActionChangeProfilePeerColor extends public TL_peerColor prev_value; public TL_peerColor new_value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_value = TL_peerColor.TLdeserialize(stream, stream.readInt32(exception), exception); new_value = TL_peerColor.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); prev_value.serializeToStream(stream); new_value.serializeToStream(stream); @@ -48484,12 +40388,12 @@ public static class TL_channelAdminLogEventActionChangeWallpaper extends Channel public WallPaper prev_value; public WallPaper new_value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { prev_value = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); new_value = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); prev_value.serializeToStream(stream); new_value.serializeToStream(stream); @@ -48501,11 +40405,11 @@ public static class TL_channelAdminLogEventActionToggleAntiSpam extends ChannelA public boolean new_value; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { new_value = stream.readBool(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeBool(new_value); } @@ -48513,7 +40417,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class InputWebFileLocation extends TLObject { - public static InputWebFileLocation TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputWebFileLocation TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputWebFileLocation result = null; switch (constructor) { case 0x9f2221c9: @@ -48543,7 +40447,7 @@ public static class TL_inputWebFileGeoPointLocation extends InputWebFileLocation public int zoom; public int scale; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { geo_point = InputGeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); access_hash = stream.readInt64(exception); w = stream.readInt32(exception); @@ -48552,7 +40456,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { scale = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); geo_point.serializeToStream(stream); stream.writeInt64(access_hash); @@ -48569,12 +40473,12 @@ public static class TL_inputWebFileLocation extends InputWebFileLocation { public String url; public long access_hash; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); access_hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); stream.writeInt64(access_hash); @@ -48583,7 +40487,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class PeerLocated extends TLObject { - public static PeerLocated TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static PeerLocated TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { PeerLocated result = null; switch (constructor) { case 0xf8ec284b: @@ -48608,11 +40512,11 @@ public static class TL_peerSelfLocated extends PeerLocated { public int expires; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { expires = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(expires); } @@ -48625,13 +40529,13 @@ public static class TL_peerLocated extends PeerLocated { public int expires; public int distance; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); expires = stream.readInt32(exception); distance = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(expires); @@ -48654,7 +40558,7 @@ public static class TL_autoDownloadSettings extends TLObject { public int small_queue_active_operations_max; public int large_queue_active_operations_max; - public static TL_autoDownloadSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_autoDownloadSettings TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_autoDownloadSettings.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_autoDownloadSettings", constructor)); @@ -48667,7 +40571,7 @@ public static TL_autoDownloadSettings TLdeserialize(AbstractSerializedData strea return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); disabled = (flags & 1) != 0; video_preload_large = (flags & 2) != 0; @@ -48681,7 +40585,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { large_queue_active_operations_max = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = disabled ? (flags | 1) : (flags &~ 1); flags = video_preload_large ? (flags | 2) : (flags &~ 2); @@ -48697,37 +40601,6 @@ public void serializeToStream(AbstractSerializedData stream) { } } - public static class TL_account_sentEmailCode extends TLObject { - public static final int constructor = 0x811f854f; - - public String email_pattern; - public int length; - - public static TL_account_sentEmailCode TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_account_sentEmailCode.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_account_sentEmailCode", constructor)); - } else { - return null; - } - } - TL_account_sentEmailCode result = new TL_account_sentEmailCode(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - email_pattern = stream.readString(exception); - length = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(email_pattern); - stream.writeInt32(length); - } - } - public static class TL_messages_inactiveChats extends TLObject { public static final int constructor = 0xa927fec5; @@ -48735,7 +40608,7 @@ public static class TL_messages_inactiveChats extends TLObject { public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_messages_inactiveChats TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_inactiveChats TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_inactiveChats.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_inactiveChats", constructor)); @@ -48748,70 +40621,17 @@ public static TL_messages_inactiveChats TLdeserialize(AbstractSerializedData str return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - dates.add(stream.readInt32(exception)); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + dates = Vector.deserializeInt(stream, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = dates.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(dates.get(a)); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serializeInt(stream, dates); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } @@ -48829,7 +40649,7 @@ public static class TL_channelAdminRights_layer92 extends TLObject { public boolean add_admins; public boolean manage_call; - public static TL_channelAdminRights_layer92 TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_channelAdminRights_layer92 TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_channelAdminRights_layer92.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_channelAdminRights_layer92", constructor)); @@ -48842,7 +40662,7 @@ public static TL_channelAdminRights_layer92 TLdeserialize(AbstractSerializedData return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); change_info = (flags & 1) != 0; post_messages = (flags & 2) != 0; @@ -48855,7 +40675,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { manage_call = (flags & 1024) != 0; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = change_info ? (flags | 1) : (flags &~ 1); flags = post_messages ? (flags | 2) : (flags &~ 2); @@ -48923,14 +40743,15 @@ public static abstract class Chat extends TLObject { public EmojiStatus emoji_status; public int level; public int subscription_until_date; + public long bot_verification_icon; public ArrayList usernames = new ArrayList<>(); - public static Chat TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static Chat TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { return TLdeserialize(stream, constructor, exception, true); } - public static Chat TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception, boolean allowStrippedThumb) { + public static Chat TLdeserialize(InputSerializedData stream, int constructor, boolean exception, boolean allowStrippedThumb) { Chat result = null; switch (constructor) { case 0x2d85832c: @@ -48948,6 +40769,12 @@ public static Chat TLdeserialize(AbstractSerializedData stream, int constructor, case TL_channel.constructor: result = new TL_channel(); break; + case TL_channel_layer196_1.constructor: + result = new TL_channel_layer196_1(); + break; + case TL_channel_layer195.constructor: + result = new TL_channel_layer195(); + break; case TL_channel_layer185.constructor: result = new TL_channel_layer185(); break; @@ -49036,7 +40863,7 @@ public static Chat TLdeserialize(AbstractSerializedData stream, int constructor, return result; } - private void readParams(AbstractSerializedData stream, boolean exception, boolean allowStrippedThumb) { + private void readParams(InputSerializedData stream, boolean exception, boolean allowStrippedThumb) { readParams(stream, exception); } @@ -49081,14 +40908,13 @@ protected static TL_chatAdminRights mergeAdminRights(TL_channelAdminRights_layer public static class TL_chatForbidden_old extends TL_chatForbidden { public static final int constructor = 0xfb0ccc41; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); title = stream.readString(exception); date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) id); stream.writeString(title); @@ -49099,7 +40925,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chat_old2 extends TL_chat { public static final int constructor = 0x7312bc48; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; kicked = (flags & 2) != 0; @@ -49113,7 +40939,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { version = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = kicked ? (flags | 2) : (flags &~ 2); @@ -49132,11 +40958,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chat extends Chat { public static final int constructor = 0x41cbf256; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { readParams(stream, exception, true); } - public void readParams(AbstractSerializedData stream, boolean exception, boolean allowStrippedThumb) { + public void readParams(InputSerializedData stream, boolean exception, boolean allowStrippedThumb) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; kicked = (flags & 2) != 0; @@ -49162,7 +40988,7 @@ public void readParams(AbstractSerializedData stream, boolean exception, boolean } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = kicked ? (flags | 2) : (flags &~ 2); @@ -49193,8 +41019,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chat_layer131 extends TL_chat { public static final int constructor = 0x3bda1bde; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; kicked = (flags & 2) != 0; @@ -49219,7 +41044,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = kicked ? (flags | 2) : (flags &~ 2); @@ -49249,8 +41074,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelForbidden extends Chat { public static final int constructor = 0x17d493d5; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); broadcast = (flags & 32) != 0; megagroup = (flags & 256) != 0; @@ -49262,7 +41086,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = broadcast ? (flags | 32) : (flags &~ 32); flags = megagroup ? (flags | 256) : (flags &~ 256); @@ -49279,8 +41103,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelForbidden_layer131 extends TL_channelForbidden { public static final int constructor = 0x289da732; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); broadcast = (flags & 32) != 0; megagroup = (flags & 256) != 0; @@ -49292,7 +41115,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = broadcast ? (flags | 32) : (flags &~ 32); flags = megagroup ? (flags | 256) : (flags &~ 256); @@ -49309,8 +41132,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelForbidden_layer67 extends TL_channelForbidden { public static final int constructor = 0x8537784f; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); broadcast = (flags & 32) != 0; megagroup = (flags & 256) != 0; @@ -49319,7 +41141,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { title = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = broadcast ? (flags | 32) : (flags &~ 32); flags = megagroup ? (flags | 256) : (flags &~ 256); @@ -49333,7 +41155,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channel_layer48 extends TL_channel { public static final int constructor = 0x4b1b7506; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; kicked = (flags & 2) != 0; @@ -49358,7 +41180,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = kicked ? (flags | 2) : (flags &~ 2); @@ -49388,14 +41210,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelForbidden_layer52 extends TL_channelForbidden { public static final int constructor = 0x2d85832c; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); access_hash = stream.readInt64(exception); title = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) id); stream.writeInt64(access_hash); @@ -49406,7 +41227,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channel_layer167_2 extends TL_channel { public static final int constructor = 0xa636a3e2; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; left = (flags & 4) != 0; @@ -49443,21 +41264,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); date = stream.readInt32(exception); if ((flags & 512) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } if ((flags & 16384) != 0) { admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -49472,21 +41279,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { participants_count = stream.readInt32(exception); } if ((flags2 & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_username object = TL_username.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - usernames.add(object); - } + usernames = Vector.deserialize(stream, TL_username::TLdeserialize, exception); } if ((flags2 & 16) != 0) { stories_max_id = stream.readInt32(exception); @@ -49499,7 +41292,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = left ? (flags | 4) : (flags &~ 4); @@ -49537,12 +41330,7 @@ public void serializeToStream(AbstractSerializedData stream) { photo.serializeToStream(stream); stream.writeInt32(date); if ((flags & 512) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } + Vector.serialize(stream, restriction_reason); } if ((flags & 16384) != 0) { admin_rights.serializeToStream(stream); @@ -49557,12 +41345,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(participants_count); } if ((flags2 & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = usernames.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - usernames.get(a).serializeToStream(stream); - } + Vector.serialize(stream, usernames); } if ((flags2 & 16) != 0) { stream.writeInt32(stories_max_id); @@ -49579,7 +41362,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channel_layer167_3 extends TL_channel { public static final int constructor = 0xdb12acb; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; left = (flags & 4) != 0; @@ -49616,21 +41399,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); date = stream.readInt32(exception); if ((flags & 512) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } if ((flags & 16384) != 0) { admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -49645,21 +41414,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { participants_count = stream.readInt32(exception); } if ((flags2 & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_username object = TL_username.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - usernames.add(object); - } + usernames = Vector.deserialize(stream, TL_username::TLdeserialize, exception); } if ((flags2 & 16) != 0) { stories_max_id = stream.readInt32(exception); @@ -49675,7 +41430,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = left ? (flags | 4) : (flags &~ 4); @@ -49713,12 +41468,7 @@ public void serializeToStream(AbstractSerializedData stream) { photo.serializeToStream(stream); stream.writeInt32(date); if ((flags & 512) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } + Vector.serialize(stream, restriction_reason); } if ((flags & 16384) != 0) { admin_rights.serializeToStream(stream); @@ -49733,12 +41483,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(participants_count); } if ((flags2 & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = usernames.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - usernames.get(a).serializeToStream(stream); - } + Vector.serialize(stream, usernames); } if ((flags2 & 16) != 0) { stream.writeInt32(stories_max_id); @@ -49756,9 +41501,9 @@ public void serializeToStream(AbstractSerializedData stream) { } public static class TL_channel extends Chat { - public static final int constructor = 0xfe4478bd; + public static final int constructor = 0xe00998b7; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; left = (flags & 4) != 0; @@ -49796,21 +41541,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); date = stream.readInt32(exception); if ((flags & 512) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } if ((flags & 16384) != 0) { admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -49825,21 +41556,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { participants_count = stream.readInt32(exception); } if ((flags2 & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_username object = TL_username.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - usernames.add(object); - } + usernames = Vector.deserialize(stream, TL_username::TLdeserialize, exception); } if ((flags2 & 16) != 0) { stories_max_id = stream.readInt32(exception); @@ -49859,9 +41576,12 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags2 & 2048) != 0) { subscription_until_date = stream.readInt32(exception); } + if ((flags2 & 8192) != 0) { + bot_verification_icon = stream.readInt64(exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = left ? (flags | 4) : (flags &~ 4); @@ -49900,12 +41620,7 @@ public void serializeToStream(AbstractSerializedData stream) { photo.serializeToStream(stream); stream.writeInt32(date); if ((flags & 512) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } + Vector.serialize(stream, restriction_reason); } if ((flags & 16384) != 0) { admin_rights.serializeToStream(stream); @@ -49920,12 +41635,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(participants_count); } if ((flags2 & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = usernames.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - usernames.get(a).serializeToStream(stream); - } + Vector.serialize(stream, usernames); } if ((flags2 & 16) != 0) { stream.writeInt32(stories_max_id); @@ -49945,13 +41655,16 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags2 & 2048) != 0) { stream.writeInt32(subscription_until_date); } + if ((flags2 & 8192) != 0) { + stream.writeInt64(bot_verification_icon); + } } } - public static class TL_channel_layer185 extends TL_channel { - public static final int constructor = 0xaadfc8f; + public static class TL_channel_layer196_1 extends TL_channel { + public static final int constructor = 0x46aeac06; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; left = (flags & 4) != 0; @@ -49977,6 +41690,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { stories_hidden = (flags2 & 2) != 0; stories_hidden_min = (flags2 & 4) != 0; stories_unavailable = (flags2 & 8) != 0; + signature_profiles = (flags2 & 4096) != 0; id = stream.readInt64(exception); if ((flags & 8192) != 0) { access_hash = stream.readInt64(exception); @@ -49988,21 +41702,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); date = stream.readInt32(exception); if ((flags & 512) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } if ((flags & 16384) != 0) { admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -50017,21 +41717,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { participants_count = stream.readInt32(exception); } if ((flags2 & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_username object = TL_username.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - usernames.add(object); - } + usernames = Vector.deserialize(stream, TL_username::TLdeserialize, exception); } if ((flags2 & 16) != 0) { stories_max_id = stream.readInt32(exception); @@ -50048,9 +41734,15 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags2 & 1024) != 0) { level = stream.readInt32(exception); } + if ((flags2 & 2048) != 0) { + subscription_until_date = stream.readInt32(exception); + } + if ((flags2 & 8192) != 0) { + bot_verification_icon = stream.readInt64(exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = left ? (flags | 4) : (flags &~ 4); @@ -50076,6 +41768,7 @@ public void serializeToStream(AbstractSerializedData stream) { flags2 = stories_hidden ? (flags2 | 2) : (flags2 &~ 2); flags2 = stories_hidden_min ? (flags2 | 4) : (flags2 &~ 4); flags2 = stories_unavailable ? (flags2 | 8) : (flags2 &~ 8); + flags2 = signature_profiles ? (flags2 | 4096) : (flags2 &~ 4096); stream.writeInt32(flags2); stream.writeInt64(id); if ((flags & 8192) != 0) { @@ -50088,12 +41781,7 @@ public void serializeToStream(AbstractSerializedData stream) { photo.serializeToStream(stream); stream.writeInt32(date); if ((flags & 512) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } + Vector.serialize(stream, restriction_reason); } if ((flags & 16384) != 0) { admin_rights.serializeToStream(stream); @@ -50108,12 +41796,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(participants_count); } if ((flags2 & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = usernames.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - usernames.get(a).serializeToStream(stream); - } + Vector.serialize(stream, usernames); } if ((flags2 & 16) != 0) { stream.writeInt32(stories_max_id); @@ -50130,13 +41813,19 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags2 & 1024) != 0) { stream.writeInt32(level); } + if ((flags2 & 2048) != 0) { + stream.writeInt32(subscription_until_date); + } + if ((flags2 & 8192) != 0) { + stream.writeInt64(bot_verification_icon); + } } } - public static class TL_channel_layer167 extends TL_channel { - public static final int constructor = 0x8e87ccd8; + public static class TL_channel_layer195 extends TL_channel { + public static final int constructor = 0xfe4478bd; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; left = (flags & 4) != 0; @@ -50162,6 +41851,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { stories_hidden = (flags2 & 2) != 0; stories_hidden_min = (flags2 & 4) != 0; stories_unavailable = (flags2 & 8) != 0; + signature_profiles = (flags2 & 4096) != 0; id = stream.readInt64(exception); if ((flags & 8192) != 0) { access_hash = stream.readInt64(exception); @@ -50173,21 +41863,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); date = stream.readInt32(exception); if ((flags & 512) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } if ((flags & 16384) != 0) { admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -50202,21 +41878,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { participants_count = stream.readInt32(exception); } if ((flags2 & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_username object = TL_username.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - usernames.add(object); - } + usernames = Vector.deserialize(stream, TL_username::TLdeserialize, exception); } if ((flags2 & 16) != 0) { stories_max_id = stream.readInt32(exception); @@ -50224,9 +41886,21 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags2 & 128) != 0) { color = TL_peerColor.TLdeserialize(stream, stream.readInt32(exception), exception); } + if ((flags2 & 256) != 0) { + profile_color = TL_peerColor.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags2 & 512) != 0) { + emoji_status = EmojiStatus.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags2 & 1024) != 0) { + level = stream.readInt32(exception); + } + if ((flags2 & 2048) != 0) { + subscription_until_date = stream.readInt32(exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = left ? (flags | 4) : (flags &~ 4); @@ -50252,6 +41926,7 @@ public void serializeToStream(AbstractSerializedData stream) { flags2 = stories_hidden ? (flags2 | 2) : (flags2 &~ 2); flags2 = stories_hidden_min ? (flags2 | 4) : (flags2 &~ 4); flags2 = stories_unavailable ? (flags2 | 8) : (flags2 &~ 8); + flags2 = signature_profiles ? (flags2 | 4096) : (flags2 &~ 4096); stream.writeInt32(flags2); stream.writeInt64(id); if ((flags & 8192) != 0) { @@ -50264,12 +41939,7 @@ public void serializeToStream(AbstractSerializedData stream) { photo.serializeToStream(stream); stream.writeInt32(date); if ((flags & 512) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } + Vector.serialize(stream, restriction_reason); } if ((flags & 16384) != 0) { admin_rights.serializeToStream(stream); @@ -50284,12 +41954,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(participants_count); } if ((flags2 & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = usernames.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - usernames.get(a).serializeToStream(stream); - } + Vector.serialize(stream, usernames); } if ((flags2 & 16) != 0) { stream.writeInt32(stories_max_id); @@ -50297,13 +41962,25 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags2 & 128) != 0) { color.serializeToStream(stream); } + if ((flags2 & 256) != 0) { + profile_color.serializeToStream(stream); + } + if ((flags2 & 512) != 0) { + emoji_status.serializeToStream(stream); + } + if ((flags2 & 1024) != 0) { + stream.writeInt32(level); + } + if ((flags2 & 2048) != 0) { + stream.writeInt32(subscription_until_date); + } } } - public static class TL_channel_layer166 extends TL_channel { - public static final int constructor = 0x1981ea7e; + public static class TL_channel_layer185 extends TL_channel { + public static final int constructor = 0xaadfc8f; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; left = (flags & 4) != 0; @@ -50340,21 +42017,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); date = stream.readInt32(exception); if ((flags & 512) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } if ((flags & 16384) != 0) { admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -50369,38 +42032,26 @@ public void readParams(AbstractSerializedData stream, boolean exception) { participants_count = stream.readInt32(exception); } if ((flags2 & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_username object = TL_username.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - usernames.add(object); - } + usernames = Vector.deserialize(stream, TL_username::TLdeserialize, exception); } if ((flags2 & 16) != 0) { stories_max_id = stream.readInt32(exception); } - if ((flags2 & 64) != 0) { - color = new TL_peerColor(); - color.color = stream.readInt32(exception); + if ((flags2 & 128) != 0) { + color = TL_peerColor.TLdeserialize(stream, stream.readInt32(exception), exception); } - if ((flags2 & 32) != 0) { - if (color == null) { - color = new TL_peerColor(); - } - color.background_emoji_id = stream.readInt64(exception); + if ((flags2 & 256) != 0) { + profile_color = TL_peerColor.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags2 & 512) != 0) { + emoji_status = EmojiStatus.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags2 & 1024) != 0) { + level = stream.readInt32(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = left ? (flags | 4) : (flags &~ 4); @@ -50438,12 +42089,7 @@ public void serializeToStream(AbstractSerializedData stream) { photo.serializeToStream(stream); stream.writeInt32(date); if ((flags & 512) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } + Vector.serialize(stream, restriction_reason); } if ((flags & 16384) != 0) { admin_rights.serializeToStream(stream); @@ -50458,29 +42104,30 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(participants_count); } if ((flags2 & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = usernames.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - usernames.get(a).serializeToStream(stream); - } + Vector.serialize(stream, usernames); } if ((flags2 & 16) != 0) { stream.writeInt32(stories_max_id); } - if ((flags2 & 64) != 0) { - stream.writeInt32(color == null ? (int) (id % 7) : color.color); + if ((flags2 & 128) != 0) { + color.serializeToStream(stream); } - if ((flags2 & 32) != 0) { - stream.writeInt64(color == null ? 0 : color.background_emoji_id); + if ((flags2 & 256) != 0) { + profile_color.serializeToStream(stream); + } + if ((flags2 & 512) != 0) { + emoji_status.serializeToStream(stream); + } + if ((flags2 & 1024) != 0) { + stream.writeInt32(level); } } } - public static class TL_channel_layer165 extends TL_channel { - public static final int constructor = 0x94f592db; + public static class TL_channel_layer167 extends TL_channel { + public static final int constructor = 0x8e87ccd8; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; left = (flags & 4) != 0; @@ -50517,21 +42164,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); date = stream.readInt32(exception); if ((flags & 512) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } if ((flags & 16384) != 0) { admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -50546,33 +42179,17 @@ public void readParams(AbstractSerializedData stream, boolean exception) { participants_count = stream.readInt32(exception); } if ((flags2 & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_username object = TL_username.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - usernames.add(object); - } + usernames = Vector.deserialize(stream, TL_username::TLdeserialize, exception); } if ((flags2 & 16) != 0) { stories_max_id = stream.readInt32(exception); } -// color = new TL_peerColor(); -// color.color = stream.readInt32(exception); -// if ((flags2 & 32) != 0) { -// color.background_emoji_id = stream.readInt64(exception); -// } + if ((flags2 & 128) != 0) { + color = TL_peerColor.TLdeserialize(stream, stream.readInt32(exception), exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = left ? (flags | 4) : (flags &~ 4); @@ -50610,12 +42227,7 @@ public void serializeToStream(AbstractSerializedData stream) { photo.serializeToStream(stream); stream.writeInt32(date); if ((flags & 512) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } + Vector.serialize(stream, restriction_reason); } if ((flags & 16384) != 0) { admin_rights.serializeToStream(stream); @@ -50630,31 +42242,21 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(participants_count); } if ((flags2 & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = usernames.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - usernames.get(a).serializeToStream(stream); - } + Vector.serialize(stream, usernames); } if ((flags2 & 16) != 0) { stream.writeInt32(stories_max_id); } -// stream.writeInt32(color == null ? (int) (id % 7) : color.color); -// if ((flags2 & 32) != 0) { -// stream.writeInt64(color == null ? 0 : color.background_emoji_id); -// } + if ((flags2 & 128) != 0) { + color.serializeToStream(stream); + } } } - public static class TL_channel_layer161 extends TL_channel { - public static final int constructor = 0x83259464; - - public void readParams(AbstractSerializedData stream, boolean exception) { - readParams(stream, exception, true); - } + public static class TL_channel_layer166 extends TL_channel { + public static final int constructor = 0x1981ea7e; - public void readParams(AbstractSerializedData stream, boolean exception, boolean allowStrippedThumb) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; left = (flags & 4) != 0; @@ -50679,6 +42281,7 @@ public void readParams(AbstractSerializedData stream, boolean exception, boolean flags2 = stream.readInt32(exception); stories_hidden = (flags2 & 2) != 0; stories_hidden_min = (flags2 & 4) != 0; + stories_unavailable = (flags2 & 8) != 0; id = stream.readInt64(exception); if ((flags & 8192) != 0) { access_hash = stream.readInt64(exception); @@ -50687,24 +42290,10 @@ public void readParams(AbstractSerializedData stream, boolean exception, boolean if ((flags & 64) != 0) { username = stream.readString(exception); } - photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception, allowStrippedThumb); + photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); date = stream.readInt32(exception); if ((flags & 512) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } if ((flags & 16384) != 0) { admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -50719,25 +42308,24 @@ public void readParams(AbstractSerializedData stream, boolean exception, boolean participants_count = stream.readInt32(exception); } if ((flags2 & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_username object = TL_username.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - usernames.add(object); + usernames = Vector.deserialize(stream, TL_username::TLdeserialize, exception); + } + if ((flags2 & 16) != 0) { + stories_max_id = stream.readInt32(exception); + } + if ((flags2 & 64) != 0) { + color = new TL_peerColor(); + color.color = stream.readInt32(exception); + } + if ((flags2 & 32) != 0) { + if (color == null) { + color = new TL_peerColor(); } + color.background_emoji_id = stream.readInt64(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = left ? (flags | 4) : (flags &~ 4); @@ -50762,6 +42350,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(flags); flags2 = stories_hidden ? (flags2 | 2) : (flags2 &~ 2); flags2 = stories_hidden_min ? (flags2 | 4) : (flags2 &~ 4); + flags2 = stories_unavailable ? (flags2 | 8) : (flags2 &~ 8); stream.writeInt32(flags2); stream.writeInt64(id); if ((flags & 8192) != 0) { @@ -50774,12 +42363,7 @@ public void serializeToStream(AbstractSerializedData stream) { photo.serializeToStream(stream); stream.writeInt32(date); if ((flags & 512) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } + Vector.serialize(stream, restriction_reason); } if ((flags & 16384) != 0) { admin_rights.serializeToStream(stream); @@ -50794,12 +42378,267 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(participants_count); } if ((flags2 & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = usernames.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - usernames.get(a).serializeToStream(stream); - } + Vector.serialize(stream, usernames); + } + if ((flags2 & 16) != 0) { + stream.writeInt32(stories_max_id); + } + if ((flags2 & 64) != 0) { + stream.writeInt32(color == null ? (int) (id % 7) : color.color); + } + if ((flags2 & 32) != 0) { + stream.writeInt64(color == null ? 0 : color.background_emoji_id); + } + } + } + + public static class TL_channel_layer165 extends TL_channel { + public static final int constructor = 0x94f592db; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + creator = (flags & 1) != 0; + left = (flags & 4) != 0; + broadcast = (flags & 32) != 0; + verified = (flags & 128) != 0; + megagroup = (flags & 256) != 0; + restricted = (flags & 512) != 0; + signatures = (flags & 2048) != 0; + min = (flags & 4096) != 0; + scam = (flags & 524288) != 0; + has_link = (flags & 1048576) != 0; + has_geo = (flags & 2097152) != 0; + slowmode_enabled = (flags & 4194304) != 0; + call_active = (flags & 8388608) != 0; + call_not_empty = (flags & 16777216) != 0; + fake = (flags & 33554432) != 0; + gigagroup = (flags & 67108864) != 0; + noforwards = (flags & 134217728) != 0; + join_to_send = (flags & 268435456) != 0; + join_request = (flags & 536870912) != 0; + forum = (flags & 1073741824) != 0; + flags2 = stream.readInt32(exception); + stories_hidden = (flags2 & 2) != 0; + stories_hidden_min = (flags2 & 4) != 0; + stories_unavailable = (flags2 & 8) != 0; + id = stream.readInt64(exception); + if ((flags & 8192) != 0) { + access_hash = stream.readInt64(exception); + } + title = stream.readString(exception); + if ((flags & 64) != 0) { + username = stream.readString(exception); + } + photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); + date = stream.readInt32(exception); + if ((flags & 512) != 0) { + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); + } + if ((flags & 16384) != 0) { + admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 32768) != 0) { + banned_rights = TL_chatBannedRights.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 262144) != 0) { + default_banned_rights = TL_chatBannedRights.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 131072) != 0) { + participants_count = stream.readInt32(exception); + } + if ((flags2 & 1) != 0) { + usernames = Vector.deserialize(stream, TL_username::TLdeserialize, exception); + } + if ((flags2 & 16) != 0) { + stories_max_id = stream.readInt32(exception); + } +// color = new TL_peerColor(); +// color.color = stream.readInt32(exception); +// if ((flags2 & 32) != 0) { +// color.background_emoji_id = stream.readInt64(exception); +// } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = creator ? (flags | 1) : (flags &~ 1); + flags = left ? (flags | 4) : (flags &~ 4); + flags = broadcast ? (flags | 32) : (flags &~ 32); + flags = verified ? (flags | 128) : (flags &~ 128); + flags = megagroup ? (flags | 256) : (flags &~ 256); + flags = restricted ? (flags | 512) : (flags &~ 512); + flags = signatures ? (flags | 2048) : (flags &~ 2048); + flags = min ? (flags | 4096) : (flags &~ 4096); + flags = scam ? (flags | 524288) : (flags &~ 524288); + flags = has_link ? (flags | 1048576) : (flags &~ 1048576); + flags = has_geo ? (flags | 2097152) : (flags &~ 2097152); + flags = slowmode_enabled ? (flags | 4194304) : (flags &~ 4194304); + flags = call_active ? (flags | 8388608) : (flags &~ 8388608); + flags = call_not_empty ? (flags | 16777216) : (flags &~ 16777216); + flags = fake ? (flags | 33554432) : (flags &~ 33554432); + flags = gigagroup ? (flags | 67108864) : (flags &~ 67108864); + flags = noforwards ? (flags | 134217728) : (flags &~ 134217728); + flags = join_to_send ? (flags | 268435456) : (flags &~ 268435456); + flags = join_request ? (flags | 536870912) : (flags &~ 536870912); + flags = forum ? (flags | 1073741824) : (flags &~ 1073741824); + stream.writeInt32(flags); + flags2 = stories_hidden ? (flags2 | 2) : (flags2 &~ 2); + flags2 = stories_hidden_min ? (flags2 | 4) : (flags2 &~ 4); + flags2 = stories_unavailable ? (flags2 | 8) : (flags2 &~ 8); + stream.writeInt32(flags2); + stream.writeInt64(id); + if ((flags & 8192) != 0) { + stream.writeInt64(access_hash); + } + stream.writeString(title); + if ((flags & 64) != 0) { + stream.writeString(username); + } + photo.serializeToStream(stream); + stream.writeInt32(date); + if ((flags & 512) != 0) { + Vector.serialize(stream, restriction_reason); + } + if ((flags & 16384) != 0) { + admin_rights.serializeToStream(stream); + } + if ((flags & 32768) != 0) { + banned_rights.serializeToStream(stream); + } + if ((flags & 262144) != 0) { + default_banned_rights.serializeToStream(stream); + } + if ((flags & 131072) != 0) { + stream.writeInt32(participants_count); + } + if ((flags2 & 1) != 0) { + Vector.serialize(stream, usernames); + } + if ((flags2 & 16) != 0) { + stream.writeInt32(stories_max_id); + } +// stream.writeInt32(color == null ? (int) (id % 7) : color.color); +// if ((flags2 & 32) != 0) { +// stream.writeInt64(color == null ? 0 : color.background_emoji_id); +// } + } + } + + public static class TL_channel_layer161 extends TL_channel { + public static final int constructor = 0x83259464; + + public void readParams(InputSerializedData stream, boolean exception) { + readParams(stream, exception, true); + } + + public void readParams(InputSerializedData stream, boolean exception, boolean allowStrippedThumb) { + flags = stream.readInt32(exception); + creator = (flags & 1) != 0; + left = (flags & 4) != 0; + broadcast = (flags & 32) != 0; + verified = (flags & 128) != 0; + megagroup = (flags & 256) != 0; + restricted = (flags & 512) != 0; + signatures = (flags & 2048) != 0; + min = (flags & 4096) != 0; + scam = (flags & 524288) != 0; + has_link = (flags & 1048576) != 0; + has_geo = (flags & 2097152) != 0; + slowmode_enabled = (flags & 4194304) != 0; + call_active = (flags & 8388608) != 0; + call_not_empty = (flags & 16777216) != 0; + fake = (flags & 33554432) != 0; + gigagroup = (flags & 67108864) != 0; + noforwards = (flags & 134217728) != 0; + join_to_send = (flags & 268435456) != 0; + join_request = (flags & 536870912) != 0; + forum = (flags & 1073741824) != 0; + flags2 = stream.readInt32(exception); + stories_hidden = (flags2 & 2) != 0; + stories_hidden_min = (flags2 & 4) != 0; + id = stream.readInt64(exception); + if ((flags & 8192) != 0) { + access_hash = stream.readInt64(exception); + } + title = stream.readString(exception); + if ((flags & 64) != 0) { + username = stream.readString(exception); + } + photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception, allowStrippedThumb); + date = stream.readInt32(exception); + if ((flags & 512) != 0) { + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); + } + if ((flags & 16384) != 0) { + admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 32768) != 0) { + banned_rights = TL_chatBannedRights.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 262144) != 0) { + default_banned_rights = TL_chatBannedRights.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 131072) != 0) { + participants_count = stream.readInt32(exception); + } + if ((flags2 & 1) != 0) { + usernames = Vector.deserialize(stream, TL_username::TLdeserialize, exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = creator ? (flags | 1) : (flags &~ 1); + flags = left ? (flags | 4) : (flags &~ 4); + flags = broadcast ? (flags | 32) : (flags &~ 32); + flags = verified ? (flags | 128) : (flags &~ 128); + flags = megagroup ? (flags | 256) : (flags &~ 256); + flags = restricted ? (flags | 512) : (flags &~ 512); + flags = signatures ? (flags | 2048) : (flags &~ 2048); + flags = min ? (flags | 4096) : (flags &~ 4096); + flags = scam ? (flags | 524288) : (flags &~ 524288); + flags = has_link ? (flags | 1048576) : (flags &~ 1048576); + flags = has_geo ? (flags | 2097152) : (flags &~ 2097152); + flags = slowmode_enabled ? (flags | 4194304) : (flags &~ 4194304); + flags = call_active ? (flags | 8388608) : (flags &~ 8388608); + flags = call_not_empty ? (flags | 16777216) : (flags &~ 16777216); + flags = fake ? (flags | 33554432) : (flags &~ 33554432); + flags = gigagroup ? (flags | 67108864) : (flags &~ 67108864); + flags = noforwards ? (flags | 134217728) : (flags &~ 134217728); + flags = join_to_send ? (flags | 268435456) : (flags &~ 268435456); + flags = join_request ? (flags | 536870912) : (flags &~ 536870912); + flags = forum ? (flags | 1073741824) : (flags &~ 1073741824); + stream.writeInt32(flags); + flags2 = stories_hidden ? (flags2 | 2) : (flags2 &~ 2); + flags2 = stories_hidden_min ? (flags2 | 4) : (flags2 &~ 4); + stream.writeInt32(flags2); + stream.writeInt64(id); + if ((flags & 8192) != 0) { + stream.writeInt64(access_hash); + } + stream.writeString(title); + if ((flags & 64) != 0) { + stream.writeString(username); + } + photo.serializeToStream(stream); + stream.writeInt32(date); + if ((flags & 512) != 0) { + Vector.serialize(stream, restriction_reason); + } + if ((flags & 16384) != 0) { + admin_rights.serializeToStream(stream); + } + if ((flags & 32768) != 0) { + banned_rights.serializeToStream(stream); + } + if ((flags & 262144) != 0) { + default_banned_rights.serializeToStream(stream); + } + if ((flags & 131072) != 0) { + stream.writeInt32(participants_count); + } + if ((flags2 & 1) != 0) { + Vector.serialize(stream, usernames); } } } @@ -50807,8 +42646,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channel_layer147 extends TL_channel { public static final int constructor = 0x8261ac61; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; left = (flags & 4) != 0; @@ -50841,21 +42679,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); date = stream.readInt32(exception); if ((flags & 512) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } if ((flags & 16384) != 0) { admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -50871,7 +42695,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = left ? (flags | 4) : (flags &~ 4); @@ -50905,12 +42729,7 @@ public void serializeToStream(AbstractSerializedData stream) { photo.serializeToStream(stream); stream.writeInt32(date); if ((flags & 512) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } + Vector.serialize(stream, restriction_reason); } if ((flags & 16384) != 0) { admin_rights.serializeToStream(stream); @@ -50930,13 +42749,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatForbidden extends Chat { public static final int constructor = 0x6592a1a7; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); title = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeString(title); @@ -50946,13 +42764,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatForbidden_layer131 extends TL_chatForbidden { public static final int constructor = 0x7328bdb; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); title = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) id); stream.writeString(title); @@ -50962,7 +42779,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channel_layer67 extends TL_channel { public static final int constructor = 0xa14dca52; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; kicked = (flags & 2) != 0; @@ -50990,7 +42807,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = kicked ? (flags | 2) : (flags &~ 2); @@ -51023,7 +42840,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channel_old extends TL_channel { public static final int constructor = 0x678e9587; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; kicked = (flags & 2) != 0; @@ -51044,7 +42861,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { version = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = kicked ? (flags | 2) : (flags &~ 2); @@ -51070,7 +42887,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chat_old extends TL_chat { public static final int constructor = 0x6e9c9bc7; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); title = stream.readString(exception); photo = ChatPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -51080,7 +42897,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { version = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) id); stream.writeString(title); @@ -51095,8 +42912,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channel_layer131 extends TL_channel { public static final int constructor = 0xd31a961e; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; left = (flags & 4) != 0; @@ -51126,21 +42942,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { date = stream.readInt32(exception); version = stream.readInt32(exception); if ((flags & 512) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } if ((flags & 16384) != 0) { admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -51156,7 +42958,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = left ? (flags | 4) : (flags &~ 4); @@ -51187,12 +42989,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(date); stream.writeInt32(version); if ((flags & 512) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } + Vector.serialize(stream, restriction_reason); } if ((flags & 16384) != 0) { admin_rights.serializeToStream(stream); @@ -51212,8 +43009,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channel_layer104 extends TL_channel { public static final int constructor = 0x4df30834; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; left = (flags & 4) != 0; @@ -51255,7 +43051,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = left ? (flags | 4) : (flags &~ 4); @@ -51302,8 +43098,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channelParticipantBanned_layer92 extends TL_channelParticipantBanned { public static final int constructor = 0x222c1886; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); left = (flags & 1) != 0; peer = new TLRPC.TL_peerUser(); @@ -51314,7 +43109,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { banned_rights = Chat.mergeBannedRights(banned_rights_layer92); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = left ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -51328,7 +43123,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channel_layer77 extends TL_channel { public static final int constructor = 0x450b7115; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; left = (flags & 4) != 0; @@ -51365,7 +43160,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = left ? (flags | 4) : (flags &~ 4); @@ -51405,7 +43200,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channel_layer72 extends TL_channel { public static final int constructor = 0xcb44b1c; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; left = (flags & 4) != 0; @@ -51439,7 +43234,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = kicked ? (flags | 2) : (flags &~ 2); @@ -51477,7 +43272,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channel_layer92 extends TL_channel { public static final int constructor = 0xc88974ac; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; left = (flags & 4) != 0; @@ -51514,7 +43309,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = left ? (flags | 4) : (flags &~ 4); @@ -51554,7 +43349,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chat_layer92 extends TL_chat { public static final int constructor = 0xd91cdd54; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); creator = (flags & 1) != 0; kicked = (flags & 2) != 0; @@ -51571,7 +43366,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = creator ? (flags | 1) : (flags &~ 1); flags = kicked ? (flags | 2) : (flags &~ 2); @@ -51596,7 +43391,7 @@ public static class RestrictionReason extends TLObject { public String reason; public String text; - public static RestrictionReason TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static RestrictionReason TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { RestrictionReason result = null; switch (constructor) { case TL_reastrictionReason.constructor: @@ -51616,14 +43411,13 @@ public static RestrictionReason TLdeserialize(AbstractSerializedData stream, int public static class TL_reastrictionReason extends RestrictionReason { public static final int constructor = 0xd072acb4; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { platform = stream.readString(exception); reason = stream.readString(exception); text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(platform); stream.writeString(reason); @@ -51655,7 +43449,7 @@ public static abstract class StickerSet extends TLObject { public boolean gifs; public boolean creator; - public static StickerSet TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static StickerSet TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { StickerSet result = null; switch (constructor) { case 0xa7a43b17: @@ -51696,15 +43490,14 @@ public static StickerSet TLdeserialize(AbstractSerializedData stream, int constr public static class TL_stickerSet_old extends TL_stickerSet { public static final int constructor = 0xa7a43b17; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); title = stream.readString(exception); short_name = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -51716,7 +43509,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_stickerSet extends StickerSet { public static final int constructor = 0x2dd14edc; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); archived = (flags & 2) != 0; official = (flags & 4) != 0; @@ -51762,7 +43555,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { hash = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = archived ? (flags | 2) : (flags &~ 2); flags = official ? (flags | 4) : (flags &~ 4); @@ -51780,12 +43573,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeString(title); stream.writeString(short_name); if ((flags & 16) != 0) { - stream.writeInt32(0x1cb5c415); - int count = thumbs.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - thumbs.get(a).serializeToStream(stream); - } + Vector.serialize(stream, thumbs); } if ((flags & 16) != 0) { stream.writeInt32(thumb_dc_id); @@ -51804,7 +43592,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_stickerSet_layer143 extends TL_stickerSet { public static final int constructor = 0xd7df217a; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); archived = (flags & 2) != 0; official = (flags & 4) != 0; @@ -51847,7 +43635,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { hash = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = archived ? (flags | 2) : (flags &~ 2); flags = official ? (flags | 4) : (flags &~ 4); @@ -51862,12 +43650,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeString(title); stream.writeString(short_name); if ((flags & 16) != 0) { - stream.writeInt32(0x1cb5c415); - int count = thumbs.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - thumbs.get(a).serializeToStream(stream); - } + Vector.serialize(stream, thumbs); } if ((flags & 16) != 0) { stream.writeInt32(thumb_dc_id); @@ -51886,8 +43669,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_stickerSet_layer96 extends TL_stickerSet { public static final int constructor = 0x5585a139; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); archived = (flags & 2) != 0; official = (flags & 4) != 0; @@ -51903,7 +43685,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { hash = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = archived ? (flags | 2) : (flags &~ 2); flags = official ? (flags | 4) : (flags &~ 4); @@ -51924,8 +43706,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_stickerSet_layer97 extends TL_stickerSet { public static final int constructor = 0x6a90bcb7; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); archived = (flags & 2) != 0; official = (flags & 4) != 0; @@ -51947,7 +43728,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { hash = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = archived ? (flags | 2) : (flags &~ 2); flags = official ? (flags | 4) : (flags &~ 4); @@ -51971,8 +43752,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_stickerSet_layer126 extends TL_stickerSet { public static final int constructor = 0x40e237a8; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); archived = (flags & 2) != 0; official = (flags & 4) != 0; @@ -52008,7 +43788,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { hash = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = archived ? (flags | 2) : (flags &~ 2); flags = official ? (flags | 4) : (flags &~ 4); @@ -52022,12 +43802,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeString(title); stream.writeString(short_name); if ((flags & 16) != 0) { - stream.writeInt32(0x1cb5c415); - int count = thumbs.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - thumbs.get(a).serializeToStream(stream); - } + Vector.serialize(stream, thumbs); } if ((flags & 16) != 0) { stream.writeInt32(thumb_dc_id); @@ -52040,8 +43815,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_stickerSet_layer121 extends TL_stickerSet { public static final int constructor = 0xeeb46f27; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); archived = (flags & 2) != 0; official = (flags & 4) != 0; @@ -52066,7 +43840,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { hash = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = archived ? (flags | 2) : (flags &~ 2); flags = official ? (flags | 4) : (flags &~ 4); @@ -52093,8 +43867,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_stickerSet_layer75 extends TL_stickerSet { public static final int constructor = 0xcd303b41; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); installed = (flags & 1) != 0; archived = (flags & 2) != 0; @@ -52108,7 +43881,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { hash = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = installed ? (flags | 1) : (flags &~ 1); flags = archived ? (flags | 2) : (flags &~ 2); @@ -52126,7 +43899,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class storage_FileType extends TLObject { - public static storage_FileType TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static storage_FileType TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { storage_FileType result = null; switch (constructor) { case 0xaa963b05: @@ -52173,8 +43946,7 @@ public static storage_FileType TLdeserialize(AbstractSerializedData stream, int public static class TL_storage_fileUnknown extends storage_FileType { public static final int constructor = 0xaa963b05; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52182,8 +43954,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_storage_fileMp4 extends storage_FileType { public static final int constructor = 0xb3cea0e4; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52191,8 +43962,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_storage_fileWebp extends storage_FileType { public static final int constructor = 0x1081464c; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52200,8 +43970,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_storage_filePng extends storage_FileType { public static final int constructor = 0xa4f63c0; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52209,8 +43978,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_storage_fileGif extends storage_FileType { public static final int constructor = 0xcae1aadf; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52218,8 +43986,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_storage_filePdf extends storage_FileType { public static final int constructor = 0xae1e508d; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52227,8 +43994,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_storage_fileMp3 extends storage_FileType { public static final int constructor = 0x528a0677; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52236,8 +44002,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_storage_fileJpeg extends storage_FileType { public static final int constructor = 0x7efe0e; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52245,8 +44010,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_storage_fileMov extends storage_FileType { public static final int constructor = 0x4b09ebbc; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52254,15 +44018,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_storage_filePartial extends storage_FileType { public static final int constructor = 0x40bc6f52; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } public static abstract class auth_CodeType extends TLObject { - public static auth_CodeType TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static auth_CodeType TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { auth_CodeType result = null; switch (constructor) { case 0x72a3158c: @@ -52294,8 +44057,7 @@ public static auth_CodeType TLdeserialize(AbstractSerializedData stream, int con public static class TL_auth_codeTypeSms extends auth_CodeType { public static final int constructor = 0x72a3158c; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52303,8 +44065,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_auth_codeTypeCall extends auth_CodeType { public static final int constructor = 0x741cd3e3; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52312,8 +44073,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_auth_codeTypeFlashCall extends auth_CodeType { public static final int constructor = 0x226ccefb; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52321,8 +44081,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_auth_codeTypeMissedCall extends auth_CodeType { public static final int constructor = 0xd61ad6ee; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52330,8 +44089,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_auth_codeTypeFragmentSms extends auth_CodeType { public static final int constructor = 0x6ed998c; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52341,7 +44099,7 @@ public static class TL_messages_translateResult extends TLObject { public ArrayList result = new ArrayList<>(); - public static TL_messages_translateResult TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_translateResult TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_translateResult.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_translateResult", constructor)); @@ -52354,32 +44112,13 @@ public static TL_messages_translateResult TLdeserialize(AbstractSerializedData s return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_textWithEntities object = TL_textWithEntities.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - result.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + result = Vector.deserialize(stream, TL_textWithEntities::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = result.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - result.get(a).serializeToStream(stream); - } + Vector.serialize(stream, result); } } @@ -52387,7 +44126,7 @@ public static abstract class MessagesFilter extends TLObject { public int flags; public boolean missed; - public static MessagesFilter TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static MessagesFilter TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { MessagesFilter result = null; switch (constructor) { case 0xffc86587: @@ -52458,8 +44197,7 @@ public static MessagesFilter TLdeserialize(AbstractSerializedData stream, int co public static class TL_inputMessagesFilterGif extends MessagesFilter { public static final int constructor = 0xffc86587; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52467,8 +44205,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputMessagesFilterMusic extends MessagesFilter { public static final int constructor = 0x3751b49e; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52476,8 +44213,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputMessagesFilterChatPhotos extends MessagesFilter { public static final int constructor = 0x3a20ecb8; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52485,8 +44221,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputMessagesFilterPhotos extends MessagesFilter { public static final int constructor = 0x9609a51c; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52494,8 +44229,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputMessagesFilterUrl extends MessagesFilter { public static final int constructor = 0x7ef0dd87; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52503,8 +44237,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputMessagesFilterDocument extends MessagesFilter { public static final int constructor = 0x9eddf188; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52512,8 +44245,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputMessagesFilterPhotoVideo extends MessagesFilter { public static final int constructor = 0x56e9f0e4; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52521,8 +44253,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputMessagesFilterPhotoVideoDocuments extends MessagesFilter { public static final int constructor = 0xd95e73bb; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52530,8 +44261,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputMessagesFilterGeo extends MessagesFilter { public static final int constructor = 0xe7026d0d; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52539,8 +44269,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputMessagesFilterPinned extends MessagesFilter { public static final int constructor = 0x1bb00451; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52548,8 +44277,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputMessagesFilterMyMentions extends MessagesFilter { public static final int constructor = 0xc1f8e69a; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52557,8 +44285,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputMessagesFilterRoundVoice extends MessagesFilter { public static final int constructor = 0x7a7c17a4; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52566,8 +44293,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputMessagesFilterVoice extends MessagesFilter { public static final int constructor = 0x50f5c392; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52575,8 +44301,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputMessagesFilterContacts extends MessagesFilter { public static final int constructor = 0xe062db83; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52584,8 +44309,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputMessagesFilterVideo extends MessagesFilter { public static final int constructor = 0x9fc00e65; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52593,13 +44317,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputMessagesFilterPhoneCalls extends MessagesFilter { public static final int constructor = 0x80c99768; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); missed = (flags & 1) != 0; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = missed ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -52609,8 +44332,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputMessagesFilterEmpty extends MessagesFilter { public static final int constructor = 0x57e2f66c; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52618,115 +44340,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputMessagesFilterRoundVideo extends MessagesFilter { public static final int constructor = 0xb549da53; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } - public static class TL_phone_groupParticipants extends TLObject { - public static final int constructor = 0xf47751b6; - - public int count; - public ArrayList participants = new ArrayList<>(); - public String next_offset; - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); - public int version; - - public static TL_phone_groupParticipants TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_phone_groupParticipants.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_phone_groupParticipants", constructor)); - } else { - return null; - } - } - TL_phone_groupParticipants result = new TL_phone_groupParticipants(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_groupCallParticipant object = TL_groupCallParticipant.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - participants.add(object); - } - next_offset = stream.readString(exception); - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - version = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = participants.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - participants.get(a).serializeToStream(stream); - } - stream.writeString(next_offset); - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - stream.writeInt32(version); - } - } - public static abstract class PageListOrderedItem extends TLObject { - public static PageListOrderedItem TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static PageListOrderedItem TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { PageListOrderedItem result = null; switch (constructor) { case 0x5e068047: @@ -52752,12 +44373,12 @@ public static class TL_pageListOrderedItemText extends PageListOrderedItem { public String num; public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { num = stream.readString(exception); text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(num); text.serializeToStream(stream); @@ -52770,42 +44391,22 @@ public static class TL_pageListOrderedItemBlocks extends PageListOrderedItem { public String num; public ArrayList blocks = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { num = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - blocks.add(object); - } + blocks = Vector.deserialize(stream, PageBlock::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(num); - stream.writeInt32(0x1cb5c415); - int count = blocks.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - blocks.get(a).serializeToStream(stream); - } + Vector.serialize(stream, blocks); } } public static class TL_messages_messageEmpty extends TLObject { public static final int constructor = 0x3f4e0648; - - public static TL_messages_messageEmpty TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_messageEmpty TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_messageEmpty.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_messageEmpty", constructor)); @@ -52818,7 +44419,7 @@ public static TL_messages_messageEmpty TLdeserialize(AbstractSerializedData stre return result; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -52830,7 +44431,7 @@ public static class TL_secureCredentialsEncrypted extends TLObject { public byte[] hash; public byte[] secret; - public static TL_secureCredentialsEncrypted TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_secureCredentialsEncrypted TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_secureCredentialsEncrypted.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_secureCredentialsEncrypted", constructor)); @@ -52843,13 +44444,13 @@ public static TL_secureCredentialsEncrypted TLdeserialize(AbstractSerializedData return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { data = stream.readByteArray(exception); hash = stream.readByteArray(exception); secret = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeByteArray(data); stream.writeByteArray(hash); @@ -52874,7 +44475,7 @@ public static abstract class MessageFwdHeader extends TLObject { public int saved_date; public String psa_type; - public static MessageFwdHeader TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static MessageFwdHeader TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { MessageFwdHeader result = null; switch (constructor) { case 0xc786ddcb: @@ -52912,8 +44513,7 @@ public static MessageFwdHeader TLdeserialize(AbstractSerializedData stream, int public static class TL_messageFwdHeader_layer68 extends TL_messageFwdHeader { public static final int constructor = 0xc786ddcb; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { from_id = new TLRPC.TL_peerChannel(); @@ -52929,7 +44529,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -52948,7 +44548,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageFwdHeader extends MessageFwdHeader { public static final int constructor = 0x4e4df4bb; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); imported = (flags & 128) != 0; saved_out = (flags & 2048) != 0; @@ -52985,7 +44585,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = imported ? (flags | 128) : (flags &~ 128); flags = saved_out ? (flags | 2048) : (flags &~ 2048); @@ -53027,8 +44627,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageFwdHeader_layer169 extends TL_messageFwdHeader { public static final int constructor = 0x5f777dce; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); imported = (flags & 128) != 0; if ((flags & 1) != 0) { @@ -53055,7 +44654,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = imported ? (flags | 128) : (flags &~ 128); stream.writeInt32(flags); @@ -53087,8 +44686,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageFwdHeader_layer118 extends TL_messageFwdHeader { public static final int constructor = 0x353a686b; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { from_id = new TLRPC.TL_peerUser(); @@ -53119,7 +44717,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -53153,8 +44751,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageFwdHeader_layer112 extends TL_messageFwdHeader { public static final int constructor = 0xec338270; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { from_id = new TLRPC.TL_peerUser(); @@ -53182,7 +44779,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -53213,8 +44810,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageFwdHeader_layer72 extends TL_messageFwdHeader { public static final int constructor = 0xfadff4ac; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { from_id = new TLRPC.TL_peerUser(); @@ -53233,7 +44829,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -53255,8 +44851,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messageFwdHeader_layer96 extends TL_messageFwdHeader { public static final int constructor = 0x559ebe6d; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { from_id = new TLRPC.TL_peerUser(); @@ -53281,7 +44876,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -53316,7 +44911,7 @@ public static abstract class FileLocation extends TLObject { public byte[] key; public byte[] iv; - public static FileLocation TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static FileLocation TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { FileLocation result = null; switch (constructor) { case 0x7c596b46: @@ -53348,14 +44943,13 @@ public static FileLocation TLdeserialize(AbstractSerializedData stream, int cons public static class TL_fileLocationUnavailable extends FileLocation { public static final int constructor = 0x7c596b46; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { volume_id = stream.readInt64(exception); local_id = stream.readInt32(exception); secret = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(volume_id); stream.writeInt32(local_id); @@ -53366,15 +44960,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_fileLocation_layer82 extends TL_fileLocation_layer97 { public static final int constructor = 0x53d69076; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { dc_id = stream.readInt32(exception); volume_id = stream.readInt64(exception); local_id = stream.readInt32(exception); secret = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(dc_id); stream.writeInt64(volume_id); @@ -53386,8 +44979,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_fileLocation_layer97 extends FileLocation { public static final int constructor = 0x91d11eb; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { dc_id = stream.readInt32(exception); volume_id = stream.readInt64(exception); local_id = stream.readInt32(exception); @@ -53395,7 +44987,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { file_reference = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(dc_id); stream.writeInt64(volume_id); @@ -53408,13 +45000,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_fileLocationToBeDeprecated extends FileLocation { public static final int constructor = 0xbc7fc6cd; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { volume_id = stream.readInt64(exception); local_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(volume_id); stream.writeInt32(local_id); @@ -53424,8 +45015,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_fileEncryptedLocation extends FileLocation { public static final int constructor = 0x55555554; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { dc_id = stream.readInt32(exception); volume_id = stream.readInt64(exception); local_id = stream.readInt32(exception); @@ -53434,7 +45024,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { iv = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(dc_id); stream.writeInt64(volume_id); @@ -53449,7 +45039,7 @@ public static abstract class messages_SavedGifs extends TLObject { public long hash; public ArrayList gifs = new ArrayList<>(); - public static messages_SavedGifs TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static messages_SavedGifs TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { messages_SavedGifs result = null; switch (constructor) { case 0xe8025ca2: @@ -53472,8 +45062,7 @@ public static messages_SavedGifs TLdeserialize(AbstractSerializedData stream, in public static class TL_messages_savedGifsNotModified extends messages_SavedGifs { public static final int constructor = 0xe8025ca2; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -53481,35 +45070,15 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_messages_savedGifs extends messages_SavedGifs { public static final int constructor = 0x84a02a0d; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { hash = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - gifs.add(object); - } + gifs = Vector.deserialize(stream, Document::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(hash); - stream.writeInt32(0x1cb5c415); - int count = gifs.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - gifs.get(a).serializeToStream(stream); - } + Vector.serialize(stream, gifs); } } @@ -53523,7 +45092,7 @@ public static abstract class PhotoSize extends TLObject { public int gradientTopColor, gradientBottomColor; //custom - public static PhotoSize TLdeserialize(long photo_id, long document_id, long sticker_set_id, AbstractSerializedData stream, int constructor, boolean exception) { + public static PhotoSize TLdeserialize(long photo_id, long document_id, long sticker_set_id, InputSerializedData stream, int constructor, boolean exception) { PhotoSize result = null; switch (constructor) { case 0xd8214d41: @@ -53584,14 +45153,13 @@ public static PhotoSize TLdeserialize(long photo_id, long document_id, long stic public static class TL_photoStrippedSize extends PhotoSize { public static final int constructor = 0xe0b0bc2e; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { type = stream.readString(exception); bytes = stream.readByteArray(exception); w = h = 50; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(type); stream.writeByteArray(bytes); @@ -53601,48 +45169,31 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_photoSizeProgressive_layer127 extends TL_photoSizeProgressive { public static final int constructor = 0x5aa86a51; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { type = stream.readString(exception); location = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); w = stream.readInt32(exception); h = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - sizes.add(stream.readInt32(exception)); - } + sizes = Vector.deserializeInt(stream, exception); if (!sizes.isEmpty()) { size = sizes.get(sizes.size() - 1); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(type); location.serializeToStream(stream); stream.writeInt32(w); stream.writeInt32(h); - stream.writeInt32(0x1cb5c415); - int count = sizes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(sizes.get(a)); - } + Vector.serializeInt(stream, sizes); } } public static class TL_photoSize_layer127 extends TL_photoSize { public static final int constructor = 0x77bfb61b; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { type = stream.readString(exception); location = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); w = stream.readInt32(exception); @@ -53650,7 +45201,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { size = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(type); location.serializeToStream(stream); @@ -53663,12 +45214,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_photoSizeEmpty extends PhotoSize { public static final int constructor = 0xe17e23c; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { type = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(type); } @@ -53677,8 +45227,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_photoCachedSize_layer127 extends TL_photoCachedSize { public static final int constructor = 0xe9a734fa; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { type = stream.readString(exception); location = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception); w = stream.readInt32(exception); @@ -53686,7 +45235,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bytes = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(type); location.serializeToStream(stream); @@ -53699,15 +45248,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_photoSize extends PhotoSize { public static final int constructor = 0x75c78e60; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { type = stream.readString(exception); w = stream.readInt32(exception); h = stream.readInt32(exception); size = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(type); stream.writeInt32(w); @@ -53719,15 +45267,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_photoCachedSize extends PhotoSize { public static final int constructor = 0x21e1ad6; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { type = stream.readString(exception); w = stream.readInt32(exception); h = stream.readInt32(exception); bytes = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(type); stream.writeInt32(w); @@ -53741,43 +45288,28 @@ public static class TL_photoSizeProgressive extends PhotoSize { public ArrayList sizes = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { type = stream.readString(exception); w = stream.readInt32(exception); h = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - sizes.add(stream.readInt32(exception)); - } + sizes = Vector.deserializeInt(stream, exception); if (!sizes.isEmpty()) { size = sizes.get(sizes.size() - 1); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(type); stream.writeInt32(w); stream.writeInt32(h); - stream.writeInt32(0x1cb5c415); - int count = sizes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(sizes.get(a)); - } + Vector.serializeInt(stream, sizes); } } public static abstract class ExportedChatInvite extends TLObject { - public static TL_chatInviteExported TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_chatInviteExported TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { TL_chatInviteExported result = null; switch (constructor) { case TL_chatInviteExported.constructor: @@ -53833,7 +45365,7 @@ public static class TL_chatInviteExported extends ExportedChatInvite { public ArrayList importers; //custom public boolean expired; //custom - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); revoked = (flags & 1) != 0; permanent = (flags & 32) != 0; @@ -53867,7 +45399,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = revoked ? (flags | 1) : (flags &~ 1); flags = permanent ? (flags | 32) : (flags &~ 32); @@ -53906,7 +45438,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatInviteExported_layer185 extends TL_chatInviteExported { public static final int constructor = 0xab4a819; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); revoked = (flags & 1) != 0; permanent = (flags & 32) != 0; @@ -53934,7 +45466,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = revoked ? (flags | 1) : (flags &~ 1); flags = permanent ? (flags | 32) : (flags &~ 32); @@ -53967,7 +45499,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatInviteExported_layer133 extends TL_chatInviteExported { public static final int constructor = 0xb18105e8; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); revoked = (flags & 1) != 0; permanent = (flags & 32) != 0; @@ -53988,7 +45520,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = revoked ? (flags | 1) : (flags &~ 1); flags = permanent ? (flags | 32) : (flags &~ 32); @@ -54014,8 +45546,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatInviteEmpty_layer122 extends TL_chatInviteExported { public static final int constructor = 0x69df3769; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -54023,8 +45554,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatInviteExported_layer131 extends TL_chatInviteExported { public static final int constructor = 0x6e24fc9d; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); revoked = (flags & 1) != 0; permanent = (flags & 32) != 0; @@ -54045,7 +45575,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = revoked ? (flags | 1) : (flags &~ 1); flags = permanent ? (flags | 32) : (flags &~ 32); @@ -54071,12 +45601,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_chatInviteExported_layer122 extends TL_chatInviteExported { public static final int constructor = 0xfc2e05bc; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { link = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(link); } @@ -54088,7 +45617,7 @@ public static abstract class InputFile extends TLObject { public String name; public String md5_checksum; - public static InputFile TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputFile TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputFile result = null; switch (constructor) { case TL_inputFileBig.constructor: @@ -54114,14 +45643,13 @@ public static InputFile TLdeserialize(AbstractSerializedData stream, int constru public static class TL_inputFileBig extends InputFile { public static final int constructor = 0xfa4f0bb5; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); parts = stream.readInt32(exception); name = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt32(parts); @@ -54134,11 +45662,11 @@ public static class TL_inputFileStoryDocument extends InputFile { public TLRPC.InputDocument doc; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { doc = TLRPC.InputDocument.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); doc.serializeToStream(stream); } @@ -54147,15 +45675,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputFile extends InputFile { public static final int constructor = 0xf52ff27f; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); parts = stream.readInt32(exception); name = stream.readString(exception); md5_checksum = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt32(parts); @@ -54167,10 +45694,10 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_textWithEntities extends TLObject { public static final int constructor = 0x751f3146; - public String text; + public String text = ""; public ArrayList entities = new ArrayList<>(); - public static TL_textWithEntities TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_textWithEntities TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_textWithEntities.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_textWithEntities", constructor)); @@ -54183,103 +45710,15 @@ public static TL_textWithEntities TLdeserialize(AbstractSerializedData stream, i return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(text); - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - } - - public static class TL_account_webAuthorizations extends TLObject { - public static final int constructor = 0xed56c9fc; - - public ArrayList authorizations = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); - - public static TL_account_webAuthorizations TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_account_webAuthorizations.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_account_webAuthorizations", constructor)); - } else { - return null; - } - } - TL_account_webAuthorizations result = new TL_account_webAuthorizations(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_webAuthorization object = TL_webAuthorization.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - authorizations.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = authorizations.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - authorizations.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } } @@ -54292,7 +45731,7 @@ public static class TL_updates_state extends TLObject { public int seq; public int unread_count; - public static TL_updates_state TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_updates_state TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_updates_state.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_updates_state", constructor)); @@ -54305,7 +45744,7 @@ public static TL_updates_state TLdeserialize(AbstractSerializedData stream, int return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { pts = stream.readInt32(exception); qts = stream.readInt32(exception); date = stream.readInt32(exception); @@ -54313,7 +45752,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { unread_count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(pts); stream.writeInt32(qts); @@ -54332,7 +45771,7 @@ public static abstract class ReactionCount extends TLObject { public Reaction reaction; public int count; - public static ReactionCount TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static ReactionCount TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { ReactionCount result = null; switch (constructor) { case 0xa3d1cb80: @@ -54352,7 +45791,7 @@ public static ReactionCount TLdeserialize(AbstractSerializedData stream, int con public static class TL_reactionCount extends ReactionCount { public static final int constructor = 0xa3d1cb80; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if (chosen = (flags & 1) != 0) { chosen_order = stream.readInt32(exception); @@ -54361,7 +45800,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -54374,7 +45813,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class messages_AvailableReactions extends TLObject { - public static messages_AvailableReactions TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static messages_AvailableReactions TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { messages_AvailableReactions result = null; switch (constructor) { case 0x9f071957: @@ -54397,8 +45836,7 @@ public static messages_AvailableReactions TLdeserialize(AbstractSerializedData s public static class TL_messages_availableReactionsNotModified extends messages_AvailableReactions { public static final int constructor = 0x9f071957; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -54409,34 +45847,15 @@ public static class TL_messages_availableReactions extends messages_AvailableRea public int hash; public ArrayList reactions = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { hash = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_availableReaction object = TL_availableReaction.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - reactions.add(object); - } + reactions = Vector.deserialize(stream, TL_availableReaction::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(hash); - stream.writeInt32(0x1cb5c415); - int count = reactions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - reactions.get(a).serializeToStream(stream); - } + Vector.serialize(stream, reactions); } } @@ -54481,23 +45900,27 @@ public static abstract class UserFull extends TLObject { public Photo fallback_photo; public WallPaper wallpaper; public TL_stories.PeerStories stories; - public TL_businessWorkHours business_work_hours; + public TL_account.TL_businessWorkHours business_work_hours; public TL_businessLocation business_location; - public TL_businessGreetingMessage business_greeting_message; - public TL_businessAwayMessage business_away_message; - public TL_businessIntro business_intro; - public TL_birthday birthday; + public TL_account.TL_businessGreetingMessage business_greeting_message; + public TL_account.TL_businessAwayMessage business_away_message; + public TL_account.TL_businessIntro business_intro; + public TL_account.TL_birthday birthday; public long personal_channel_id; public int personal_channel_message; public int stargifts_count; public TL_payments.starRefProgram starref_program; + public TL_bots.botVerification bot_verification; - public static UserFull TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static UserFull TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { UserFull result = null; switch (constructor) { case TL_userFull.constructor: result = new TL_userFull(); break; + case TL_userFull_layer195.constructor: + result = new TL_userFull_layer195(); + break; case TL_userFull_layer194.constructor: result = new TL_userFull_layer194(); break; @@ -54564,9 +45987,9 @@ public static UserFull TLdeserialize(AbstractSerializedData stream, int construc } public static class TL_userFull extends UserFull { - public static final int constructor = 0x979d2376; + public static final int constructor = 0x4d975bbc; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blocked = (flags & 1) != 0; phone_calls_available = (flags & 16) != 0; @@ -54626,21 +46049,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot_broadcast_admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 524288) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_premiumGiftOption object = TL_premiumGiftOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - premium_gifts.add(object); - } + premium_gifts = Vector.deserialize(stream, TL_premiumGiftOption::TLdeserialize, exception); } if ((flags & 16777216) != 0) { wallpaper = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -54649,22 +46058,22 @@ public void readParams(AbstractSerializedData stream, boolean exception) { stories = TL_stories.PeerStories.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 1) != 0) { - business_work_hours = TL_businessWorkHours.TLdeserialize(stream, stream.readInt32(exception), exception); + business_work_hours = TL_account.TL_businessWorkHours.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 2) != 0) { business_location = TL_businessLocation.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 4) != 0) { - business_greeting_message = TL_businessGreetingMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + business_greeting_message = TL_account.TL_businessGreetingMessage.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 8) != 0) { - business_away_message = TL_businessAwayMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + business_away_message = TL_account.TL_businessAwayMessage.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 16) != 0) { - business_intro = TL_businessIntro.TLdeserialize(stream, stream.readInt32(exception), exception); + business_intro = TL_account.TL_businessIntro.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 32) != 0) { - birthday = TL_birthday.TLdeserialize(stream, stream.readInt32(exception), exception); + birthday = TL_account.TL_birthday.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 64) != 0) { personal_channel_id = stream.readInt64(exception); @@ -54676,9 +46085,12 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags2 & 2048) != 0) { starref_program = TL_payments.starRefProgram.TLdeserialize(stream, stream.readInt32(exception), exception); } + if ((flags2 & 4096) != 0) { + bot_verification = TL_bots.botVerification.TLdeserialize(stream, stream.readInt32(exception), exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blocked ? (flags | 1) : (flags &~ 1); flags = phone_calls_available ? (flags | 16) : (flags &~ 16); @@ -54739,12 +46151,7 @@ public void serializeToStream(AbstractSerializedData stream) { bot_broadcast_admin_rights.serializeToStream(stream); } if ((flags & 524288) != 0) { - stream.writeInt32(0x1cb5c415); - int count = premium_gifts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - premium_gifts.get(a).serializeToStream(stream); - } + Vector.serialize(stream, premium_gifts); } if ((flags & 16777216) != 0) { wallpaper.serializeToStream(stream); @@ -54780,13 +46187,16 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags2 & 2048) != 0) { starref_program.serializeToStream(stream); } + if ((flags2 & 4096) != 0) { + bot_verification.serializeToStream(stream); + } } } - public static class TL_userFull_layer194 extends TL_userFull { - public static final int constructor = 0x1f58e369; + public static class TL_userFull_layer195 extends TL_userFull { + public static final int constructor = 0x979d2376; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blocked = (flags & 1) != 0; phone_calls_available = (flags & 16) != 0; @@ -54846,21 +46256,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot_broadcast_admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 524288) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_premiumGiftOption object = TL_premiumGiftOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - premium_gifts.add(object); - } + premium_gifts = Vector.deserialize(stream, TL_premiumGiftOption::TLdeserialize, exception); } if ((flags & 16777216) != 0) { wallpaper = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -54869,22 +46265,22 @@ public void readParams(AbstractSerializedData stream, boolean exception) { stories = TL_stories.PeerStories.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 1) != 0) { - business_work_hours = TL_businessWorkHours.TLdeserialize(stream, stream.readInt32(exception), exception); + business_work_hours = TL_account.TL_businessWorkHours.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 2) != 0) { business_location = TL_businessLocation.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 4) != 0) { - business_greeting_message = TL_businessGreetingMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + business_greeting_message = TL_account.TL_businessGreetingMessage.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 8) != 0) { - business_away_message = TL_businessAwayMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + business_away_message = TL_account.TL_businessAwayMessage.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 16) != 0) { - business_intro = TL_businessIntro.TLdeserialize(stream, stream.readInt32(exception), exception); + business_intro = TL_account.TL_businessIntro.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 32) != 0) { - birthday = TL_birthday.TLdeserialize(stream, stream.readInt32(exception), exception); + birthday = TL_account.TL_birthday.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 64) != 0) { personal_channel_id = stream.readInt64(exception); @@ -54893,9 +46289,12 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags2 & 256) != 0) { stargifts_count = stream.readInt32(exception); } + if ((flags2 & 2048) != 0) { + starref_program = TL_payments.starRefProgram.TLdeserialize(stream, stream.readInt32(exception), exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blocked ? (flags | 1) : (flags &~ 1); flags = phone_calls_available ? (flags | 16) : (flags &~ 16); @@ -54956,12 +46355,7 @@ public void serializeToStream(AbstractSerializedData stream) { bot_broadcast_admin_rights.serializeToStream(stream); } if ((flags & 524288) != 0) { - stream.writeInt32(0x1cb5c415); - int count = premium_gifts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - premium_gifts.get(a).serializeToStream(stream); - } + Vector.serialize(stream, premium_gifts); } if ((flags & 16777216) != 0) { wallpaper.serializeToStream(stream); @@ -54994,13 +46388,16 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags2 & 256) != 0) { stream.writeInt32(stargifts_count); } + if ((flags2 & 2048) != 0) { + starref_program.serializeToStream(stream); + } } } - public static class TL_userFull_layer188 extends TL_userFull { - public static final int constructor = 0xcc997720; + public static class TL_userFull_layer194 extends TL_userFull { + public static final int constructor = 0x1f58e369; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blocked = (flags & 1) != 0; phone_calls_available = (flags & 16) != 0; @@ -55017,6 +46414,8 @@ public void readParams(AbstractSerializedData stream, boolean exception) { read_dates_private = (flags & 1073741824) != 0; flags2 = stream.readInt32(exception); sponsored_enabled = (flags2 & 128) != 0; + can_view_revenue = (flags2 & 512) != 0; + bot_can_manage_emoji_status = (flags2 & 1024) != 0; id = stream.readInt64(exception); if ((flags & 2) != 0) { about = stream.readString(exception); @@ -55058,21 +46457,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot_broadcast_admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 524288) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_premiumGiftOption object = TL_premiumGiftOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - premium_gifts.add(object); - } + premium_gifts = Vector.deserialize(stream, TL_premiumGiftOption::TLdeserialize, exception); } if ((flags & 16777216) != 0) { wallpaper = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -55081,30 +46466,33 @@ public void readParams(AbstractSerializedData stream, boolean exception) { stories = TL_stories.PeerStories.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 1) != 0) { - business_work_hours = TL_businessWorkHours.TLdeserialize(stream, stream.readInt32(exception), exception); + business_work_hours = TL_account.TL_businessWorkHours.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 2) != 0) { business_location = TL_businessLocation.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 4) != 0) { - business_greeting_message = TL_businessGreetingMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + business_greeting_message = TL_account.TL_businessGreetingMessage.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 8) != 0) { - business_away_message = TL_businessAwayMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + business_away_message = TL_account.TL_businessAwayMessage.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 16) != 0) { - business_intro = TL_businessIntro.TLdeserialize(stream, stream.readInt32(exception), exception); + business_intro = TL_account.TL_businessIntro.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 32) != 0) { - birthday = TL_birthday.TLdeserialize(stream, stream.readInt32(exception), exception); + birthday = TL_account.TL_birthday.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 64) != 0) { personal_channel_id = stream.readInt64(exception); personal_channel_message = stream.readInt32(exception); } + if ((flags2 & 256) != 0) { + stargifts_count = stream.readInt32(exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blocked ? (flags | 1) : (flags &~ 1); flags = phone_calls_available ? (flags | 16) : (flags &~ 16); @@ -55121,6 +46509,8 @@ public void serializeToStream(AbstractSerializedData stream) { flags = read_dates_private ? (flags | 1073741824) : (flags &~ 1073741824); stream.writeInt32(flags); flags2 = sponsored_enabled ? (flags2 | 128) : (flags2 &~ 128); + flags2 = can_view_revenue ? (flags2 | 512) : (flags2 &~ 512); + flags2 = bot_can_manage_emoji_status ? (flags2 | 1024) : (flags2 &~ 1024); stream.writeInt32(flags2); stream.writeInt64(id); if ((flags & 2) != 0) { @@ -55163,12 +46553,7 @@ public void serializeToStream(AbstractSerializedData stream) { bot_broadcast_admin_rights.serializeToStream(stream); } if ((flags & 524288) != 0) { - stream.writeInt32(0x1cb5c415); - int count = premium_gifts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - premium_gifts.get(a).serializeToStream(stream); - } + Vector.serialize(stream, premium_gifts); } if ((flags & 16777216) != 0) { wallpaper.serializeToStream(stream); @@ -55198,13 +46583,16 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt64(personal_channel_id); stream.writeInt32(personal_channel_message); } + if ((flags2 & 256) != 0) { + stream.writeInt32(stargifts_count); + } } } - public static class TL_userFull_layer176_3 extends TL_userFull { - public static final int constructor = 0xecdadceb; + public static class TL_userFull_layer188 extends TL_userFull { + public static final int constructor = 0xcc997720; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blocked = (flags & 1) != 0; phone_calls_available = (flags & 16) != 0; @@ -55220,6 +46608,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { contact_require_premium = (flags & 536870912) != 0; read_dates_private = (flags & 1073741824) != 0; flags2 = stream.readInt32(exception); + sponsored_enabled = (flags2 & 128) != 0; id = stream.readInt64(exception); if ((flags & 2) != 0) { about = stream.readString(exception); @@ -55261,21 +46650,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot_broadcast_admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 524288) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_premiumGiftOption object = TL_premiumGiftOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - premium_gifts.add(object); - } + premium_gifts = Vector.deserialize(stream, TL_premiumGiftOption::TLdeserialize, exception); } if ((flags & 16777216) != 0) { wallpaper = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -55284,26 +46659,30 @@ public void readParams(AbstractSerializedData stream, boolean exception) { stories = TL_stories.PeerStories.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 1) != 0) { - business_work_hours = TL_businessWorkHours.TLdeserialize(stream, stream.readInt32(exception), exception); + business_work_hours = TL_account.TL_businessWorkHours.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 2) != 0) { business_location = TL_businessLocation.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 4) != 0) { - business_greeting_message = TL_businessGreetingMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + business_greeting_message = TL_account.TL_businessGreetingMessage.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 8) != 0) { - business_away_message = TL_businessAwayMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + business_away_message = TL_account.TL_businessAwayMessage.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 16) != 0) { - business_intro = TL_businessIntro.TLdeserialize(stream, stream.readInt32(exception), exception); + business_intro = TL_account.TL_businessIntro.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 32) != 0) { - birthday = TL_birthday.TLdeserialize(stream, stream.readInt32(exception), exception); + birthday = TL_account.TL_birthday.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags2 & 64) != 0) { + personal_channel_id = stream.readInt64(exception); + personal_channel_message = stream.readInt32(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blocked ? (flags | 1) : (flags &~ 1); flags = phone_calls_available ? (flags | 16) : (flags &~ 16); @@ -55319,6 +46698,7 @@ public void serializeToStream(AbstractSerializedData stream) { flags = contact_require_premium ? (flags | 536870912) : (flags &~ 536870912); flags = read_dates_private ? (flags | 1073741824) : (flags &~ 1073741824); stream.writeInt32(flags); + flags2 = sponsored_enabled ? (flags2 | 128) : (flags2 &~ 128); stream.writeInt32(flags2); stream.writeInt64(id); if ((flags & 2) != 0) { @@ -55361,12 +46741,7 @@ public void serializeToStream(AbstractSerializedData stream) { bot_broadcast_admin_rights.serializeToStream(stream); } if ((flags & 524288) != 0) { - stream.writeInt32(0x1cb5c415); - int count = premium_gifts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - premium_gifts.get(a).serializeToStream(stream); - } + Vector.serialize(stream, premium_gifts); } if ((flags & 16777216) != 0) { wallpaper.serializeToStream(stream); @@ -55392,13 +46767,17 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags2 & 32) != 0) { birthday.serializeToStream(stream); } + if ((flags2 & 64) != 0) { + stream.writeInt64(personal_channel_id); + stream.writeInt32(personal_channel_message); + } } } - public static class TL_userFull_layer176_2 extends TL_userFull { - public static final int constructor = 0x670bbc9c; + public static class TL_userFull_layer176_3 extends TL_userFull { + public static final int constructor = 0xecdadceb; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blocked = (flags & 1) != 0; phone_calls_available = (flags & 16) != 0; @@ -55455,21 +46834,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot_broadcast_admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 524288) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_premiumGiftOption object = TL_premiumGiftOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - premium_gifts.add(object); - } + premium_gifts = Vector.deserialize(stream, TL_premiumGiftOption::TLdeserialize, exception); } if ((flags & 16777216) != 0) { wallpaper = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -55478,23 +46843,26 @@ public void readParams(AbstractSerializedData stream, boolean exception) { stories = TL_stories.PeerStories.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 1) != 0) { - business_work_hours = TL_businessWorkHours.TLdeserialize(stream, stream.readInt32(exception), exception); + business_work_hours = TL_account.TL_businessWorkHours.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 2) != 0) { business_location = TL_businessLocation.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 4) != 0) { - business_greeting_message = TL_businessGreetingMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + business_greeting_message = TL_account.TL_businessGreetingMessage.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 8) != 0) { - business_away_message = TL_businessAwayMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + business_away_message = TL_account.TL_businessAwayMessage.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 16) != 0) { - business_intro = TL_businessIntro.TLdeserialize(stream, stream.readInt32(exception), exception); + business_intro = TL_account.TL_businessIntro.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags2 & 32) != 0) { + birthday = TL_account.TL_birthday.TLdeserialize(stream, stream.readInt32(exception), exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blocked ? (flags | 1) : (flags &~ 1); flags = phone_calls_available ? (flags | 16) : (flags &~ 16); @@ -55552,12 +46920,7 @@ public void serializeToStream(AbstractSerializedData stream) { bot_broadcast_admin_rights.serializeToStream(stream); } if ((flags & 524288) != 0) { - stream.writeInt32(0x1cb5c415); - int count = premium_gifts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - premium_gifts.get(a).serializeToStream(stream); - } + Vector.serialize(stream, premium_gifts); } if ((flags & 16777216) != 0) { wallpaper.serializeToStream(stream); @@ -55580,13 +46943,16 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags2 & 16) != 0) { business_intro.serializeToStream(stream); } + if ((flags2 & 32) != 0) { + birthday.serializeToStream(stream); + } } } - public static class TL_userFull_layer176 extends TL_userFull { - public static final int constructor = 0x22ff3e85; + public static class TL_userFull_layer176_2 extends TL_userFull { + public static final int constructor = 0x670bbc9c; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blocked = (flags & 1) != 0; phone_calls_available = (flags & 16) != 0; @@ -55643,21 +47009,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot_broadcast_admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 524288) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_premiumGiftOption object = TL_premiumGiftOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - premium_gifts.add(object); - } + premium_gifts = Vector.deserialize(stream, TL_premiumGiftOption::TLdeserialize, exception); } if ((flags & 16777216) != 0) { wallpaper = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -55666,20 +47018,23 @@ public void readParams(AbstractSerializedData stream, boolean exception) { stories = TL_stories.PeerStories.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 1) != 0) { - business_work_hours = TL_businessWorkHours.TLdeserialize(stream, stream.readInt32(exception), exception); + business_work_hours = TL_account.TL_businessWorkHours.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 2) != 0) { business_location = TL_businessLocation.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 4) != 0) { - business_greeting_message = TL_businessGreetingMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + business_greeting_message = TL_account.TL_businessGreetingMessage.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags2 & 8) != 0) { - business_away_message = TL_businessAwayMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + business_away_message = TL_account.TL_businessAwayMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags2 & 16) != 0) { + business_intro = TL_account.TL_businessIntro.TLdeserialize(stream, stream.readInt32(exception), exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blocked ? (flags | 1) : (flags &~ 1); flags = phone_calls_available ? (flags | 16) : (flags &~ 16); @@ -55737,12 +47092,7 @@ public void serializeToStream(AbstractSerializedData stream) { bot_broadcast_admin_rights.serializeToStream(stream); } if ((flags & 524288) != 0) { - stream.writeInt32(0x1cb5c415); - int count = premium_gifts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - premium_gifts.get(a).serializeToStream(stream); - } + Vector.serialize(stream, premium_gifts); } if ((flags & 16777216) != 0) { wallpaper.serializeToStream(stream); @@ -55762,12 +47112,16 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags2 & 8) != 0) { business_away_message.serializeToStream(stream); } + if ((flags2 & 16) != 0) { + business_intro.serializeToStream(stream); + } } } - public static class TL_userFull_layer175 extends TL_userFull { - public static final int constructor = 0xb9b12c6c; - public void readParams(AbstractSerializedData stream, boolean exception) { + public static class TL_userFull_layer176 extends TL_userFull { + public static final int constructor = 0x22ff3e85; + + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blocked = (flags & 1) != 0; phone_calls_available = (flags & 16) != 0; @@ -55782,6 +47136,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { wallpaper_overridden = (flags & 268435456) != 0; contact_require_premium = (flags & 536870912) != 0; read_dates_private = (flags & 1073741824) != 0; + flags2 = stream.readInt32(exception); id = stream.readInt64(exception); if ((flags & 2) != 0) { about = stream.readString(exception); @@ -55823,21 +47178,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot_broadcast_admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 524288) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_premiumGiftOption object = TL_premiumGiftOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - premium_gifts.add(object); - } + premium_gifts = Vector.deserialize(stream, TL_premiumGiftOption::TLdeserialize, exception); } if ((flags & 16777216) != 0) { wallpaper = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -55845,9 +47186,21 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 33554432) != 0) { stories = TL_stories.PeerStories.TLdeserialize(stream, stream.readInt32(exception), exception); } + if ((flags2 & 1) != 0) { + business_work_hours = TL_account.TL_businessWorkHours.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags2 & 2) != 0) { + business_location = TL_businessLocation.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags2 & 4) != 0) { + business_greeting_message = TL_account.TL_businessGreetingMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags2 & 8) != 0) { + business_away_message = TL_account.TL_businessAwayMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blocked ? (flags | 1) : (flags &~ 1); flags = phone_calls_available ? (flags | 16) : (flags &~ 16); @@ -55863,6 +47216,7 @@ public void serializeToStream(AbstractSerializedData stream) { flags = contact_require_premium ? (flags | 536870912) : (flags &~ 536870912); flags = read_dates_private ? (flags | 1073741824) : (flags &~ 1073741824); stream.writeInt32(flags); + stream.writeInt32(flags2); stream.writeInt64(id); if ((flags & 2) != 0) { stream.writeString(about); @@ -55904,12 +47258,7 @@ public void serializeToStream(AbstractSerializedData stream) { bot_broadcast_admin_rights.serializeToStream(stream); } if ((flags & 524288) != 0) { - stream.writeInt32(0x1cb5c415); - int count = premium_gifts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - premium_gifts.get(a).serializeToStream(stream); - } + Vector.serialize(stream, premium_gifts); } if ((flags & 16777216) != 0) { wallpaper.serializeToStream(stream); @@ -55917,13 +47266,24 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 33554432) != 0) { stories.serializeToStream(stream); } + if ((flags2 & 1) != 0) { + business_work_hours.serializeToStream(stream); + } + if ((flags2 & 2) != 0) { + business_location.serializeToStream(stream); + } + if ((flags2 & 4) != 0) { + business_greeting_message.serializeToStream(stream); + } + if ((flags2 & 8) != 0) { + business_away_message.serializeToStream(stream); + } } } + public static class TL_userFull_layer175 extends TL_userFull { + public static final int constructor = 0xb9b12c6c; - public static class TL_userFull_layer162 extends UserFull { - public static final int constructor = 0x4fe1cc86; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blocked = (flags & 1) != 0; phone_calls_available = (flags & 16) != 0; @@ -55935,6 +47295,9 @@ public void readParams(AbstractSerializedData stream, boolean exception) { translations_disabled = (flags & 8388608) != 0; stories_pinned_available = (flags & 67108864) != 0; blocked_my_stories_from = (flags & 134217728) != 0; + wallpaper_overridden = (flags & 268435456) != 0; + contact_require_premium = (flags & 536870912) != 0; + read_dates_private = (flags & 1073741824) != 0; id = stream.readInt64(exception); if ((flags & 2) != 0) { about = stream.readString(exception); @@ -55976,21 +47339,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot_broadcast_admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 524288) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_premiumGiftOption object = TL_premiumGiftOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - premium_gifts.add(object); - } + premium_gifts = Vector.deserialize(stream, TL_premiumGiftOption::TLdeserialize, exception); } if ((flags & 16777216) != 0) { wallpaper = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -56000,7 +47349,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blocked ? (flags | 1) : (flags &~ 1); flags = phone_calls_available ? (flags | 16) : (flags &~ 16); @@ -56012,6 +47361,9 @@ public void serializeToStream(AbstractSerializedData stream) { flags = translations_disabled ? (flags | 8388608) : (flags &~ 8388608); flags = stories_pinned_available ? (flags | 67108864) : (flags &~ 67108864); flags = blocked_my_stories_from ? (flags | 134217728) : (flags &~ 134217728); + flags = wallpaper_overridden ? (flags | 268435456) : (flags &~ 268435456); + flags = contact_require_premium ? (flags | 536870912) : (flags &~ 536870912); + flags = read_dates_private ? (flags | 1073741824) : (flags &~ 1073741824); stream.writeInt32(flags); stream.writeInt64(id); if ((flags & 2) != 0) { @@ -56054,12 +47406,7 @@ public void serializeToStream(AbstractSerializedData stream) { bot_broadcast_admin_rights.serializeToStream(stream); } if ((flags & 524288) != 0) { - stream.writeInt32(0x1cb5c415); - int count = premium_gifts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - premium_gifts.get(a).serializeToStream(stream); - } + Vector.serialize(stream, premium_gifts); } if ((flags & 16777216) != 0) { wallpaper.serializeToStream(stream); @@ -56070,10 +47417,10 @@ public void serializeToStream(AbstractSerializedData stream) { } } - public static class TL_userFull_layer159 extends UserFull { - public static final int constructor = 0x93eadb53; + public static class TL_userFull_layer162 extends UserFull { + public static final int constructor = 0x4fe1cc86; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blocked = (flags & 1) != 0; phone_calls_available = (flags & 16) != 0; @@ -56083,6 +47430,8 @@ public void readParams(AbstractSerializedData stream, boolean exception) { video_calls_available = (flags & 8192) != 0; voice_messages_forbidden = (flags & 1048576) != 0; translations_disabled = (flags & 8388608) != 0; + stories_pinned_available = (flags & 67108864) != 0; + blocked_my_stories_from = (flags & 134217728) != 0; id = stream.readInt64(exception); if ((flags & 2) != 0) { about = stream.readString(exception); @@ -56124,28 +47473,17 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot_broadcast_admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 524288) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_premiumGiftOption object = TL_premiumGiftOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - premium_gifts.add(object); - } + premium_gifts = Vector.deserialize(stream, TL_premiumGiftOption::TLdeserialize, exception); } if ((flags & 16777216) != 0) { wallpaper = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); } + if ((flags & 33554432) != 0) { + stories = TL_stories.PeerStories.TLdeserialize(stream, stream.readInt32(exception), exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blocked ? (flags | 1) : (flags &~ 1); flags = phone_calls_available ? (flags | 16) : (flags &~ 16); @@ -56155,6 +47493,8 @@ public void serializeToStream(AbstractSerializedData stream) { flags = video_calls_available ? (flags | 8192) : (flags &~ 8192); flags = voice_messages_forbidden ? (flags | 1048576) : (flags &~ 1048576); flags = translations_disabled ? (flags | 8388608) : (flags &~ 8388608); + flags = stories_pinned_available ? (flags | 67108864) : (flags &~ 67108864); + flags = blocked_my_stories_from ? (flags | 134217728) : (flags &~ 134217728); stream.writeInt32(flags); stream.writeInt64(id); if ((flags & 2) != 0) { @@ -56197,12 +47537,131 @@ public void serializeToStream(AbstractSerializedData stream) { bot_broadcast_admin_rights.serializeToStream(stream); } if ((flags & 524288) != 0) { - stream.writeInt32(0x1cb5c415); - int count = premium_gifts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - premium_gifts.get(a).serializeToStream(stream); - } + Vector.serialize(stream, premium_gifts); + } + if ((flags & 16777216) != 0) { + wallpaper.serializeToStream(stream); + } + if ((flags & 33554432) != 0) { + stories.serializeToStream(stream); + } + } + } + + public static class TL_userFull_layer159 extends UserFull { + public static final int constructor = 0x93eadb53; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + blocked = (flags & 1) != 0; + phone_calls_available = (flags & 16) != 0; + phone_calls_private = (flags & 32) != 0; + can_pin_message = (flags & 128) != 0; + has_scheduled = (flags & 4096) != 0; + video_calls_available = (flags & 8192) != 0; + voice_messages_forbidden = (flags & 1048576) != 0; + translations_disabled = (flags & 8388608) != 0; + id = stream.readInt64(exception); + if ((flags & 2) != 0) { + about = stream.readString(exception); + } + settings = PeerSettings.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 2097152) != 0) { + personal_photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4) != 0) { + profile_photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4194304) != 0) { + fallback_photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + } + notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 8) != 0) { + bot_info = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 64) != 0) { + pinned_msg_id = stream.readInt32(exception); + } + common_chats_count = stream.readInt32(exception); + if ((flags & 2048) != 0) { + folder_id = stream.readInt32(exception); + } + if ((flags & 16384) != 0) { + ttl_period = stream.readInt32(exception); + } + if ((flags & 32768) != 0) { + theme_emoticon = stream.readString(exception); + } + if ((flags & 65536) != 0) { + private_forward_name = stream.readString(exception); + } + if ((flags & 131072) != 0) { + bot_group_admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 262144) != 0) { + bot_broadcast_admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 524288) != 0) { + premium_gifts = Vector.deserialize(stream, TL_premiumGiftOption::TLdeserialize, exception); + } + if ((flags & 16777216) != 0) { + wallpaper = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = blocked ? (flags | 1) : (flags &~ 1); + flags = phone_calls_available ? (flags | 16) : (flags &~ 16); + flags = phone_calls_private ? (flags | 32) : (flags &~ 32); + flags = can_pin_message ? (flags | 128) : (flags &~ 128); + flags = has_scheduled ? (flags | 4096) : (flags &~ 4096); + flags = video_calls_available ? (flags | 8192) : (flags &~ 8192); + flags = voice_messages_forbidden ? (flags | 1048576) : (flags &~ 1048576); + flags = translations_disabled ? (flags | 8388608) : (flags &~ 8388608); + stream.writeInt32(flags); + stream.writeInt64(id); + if ((flags & 2) != 0) { + stream.writeString(about); + } + settings.serializeToStream(stream); + if ((flags & 2097152) != 0) { + personal_photo.serializeToStream(stream); + } + if ((flags & 4) != 0) { + profile_photo.serializeToStream(stream); + } + if ((flags & 4194304) != 0) { + fallback_photo.serializeToStream(stream); + } + notify_settings.serializeToStream(stream); + if ((flags & 8) != 0) { + bot_info.serializeToStream(stream); + } + if ((flags & 64) != 0) { + stream.writeInt32(pinned_msg_id); + } + stream.writeInt32(common_chats_count); + if ((flags & 2048) != 0) { + stream.writeInt32(folder_id); + } + if ((flags & 16384) != 0) { + stream.writeInt32(ttl_period); + } + if ((flags & 32768) != 0) { + stream.writeString(theme_emoticon); + } + if ((flags & 65536) != 0) { + stream.writeString(private_forward_name); + } + if ((flags & 131072) != 0) { + bot_group_admin_rights.serializeToStream(stream); + } + if ((flags & 262144) != 0) { + bot_broadcast_admin_rights.serializeToStream(stream); + } + if ((flags & 524288) != 0) { + Vector.serialize(stream, premium_gifts); } if ((flags & 16777216) != 0) { wallpaper.serializeToStream(stream); @@ -56213,7 +47672,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userFull_layer156 extends UserFull { public static final int constructor = 0xf8d32aed; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blocked = (flags & 1) != 0; phone_calls_available = (flags & 16) != 0; @@ -56264,25 +47723,11 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot_broadcast_admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 524288) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_premiumGiftOption object = TL_premiumGiftOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - premium_gifts.add(object); - } + premium_gifts = Vector.deserialize(stream, TL_premiumGiftOption::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blocked ? (flags | 1) : (flags &~ 1); flags = phone_calls_available ? (flags | 16) : (flags &~ 16); @@ -56334,12 +47779,7 @@ public void serializeToStream(AbstractSerializedData stream) { bot_broadcast_admin_rights.serializeToStream(stream); } if ((flags & 524288) != 0) { - stream.writeInt32(0x1cb5c415); - int count = premium_gifts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - premium_gifts.get(a).serializeToStream(stream); - } + Vector.serialize(stream, premium_gifts); } } } @@ -56347,7 +47787,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userFull_layer150_rev2 extends UserFull { public static final int constructor = 0xec6d41e3; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blocked = (flags & 1) != 0; phone_calls_available = (flags & 16) != 0; @@ -56394,25 +47834,11 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot_broadcast_admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 524288) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_premiumGiftOption object = TL_premiumGiftOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - premium_gifts.add(object); - } + premium_gifts = Vector.deserialize(stream, TL_premiumGiftOption::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blocked ? (flags | 1) : (flags &~ 1); flags = phone_calls_available ? (flags | 16) : (flags &~ 16); @@ -56460,12 +47886,7 @@ public void serializeToStream(AbstractSerializedData stream) { bot_broadcast_admin_rights.serializeToStream(stream); } if ((flags & 524288) != 0) { - stream.writeInt32(0x1cb5c415); - int count = premium_gifts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - premium_gifts.get(a).serializeToStream(stream); - } + Vector.serialize(stream, premium_gifts); } } } @@ -56473,7 +47894,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userFull_layer150 extends UserFull { public static final int constructor = 0xc4b1fc3f; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blocked = (flags & 1) != 0; phone_calls_available = (flags & 16) != 0; @@ -56517,25 +47938,11 @@ public void readParams(AbstractSerializedData stream, boolean exception) { bot_broadcast_admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 524288) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_premiumGiftOption object = TL_premiumGiftOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - premium_gifts.add(object); - } + premium_gifts = Vector.deserialize(stream, TL_premiumGiftOption::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blocked ? (flags | 1) : (flags &~ 1); flags = phone_calls_available ? (flags | 16) : (flags &~ 16); @@ -56580,12 +47987,7 @@ public void serializeToStream(AbstractSerializedData stream) { bot_broadcast_admin_rights.serializeToStream(stream); } if ((flags & 524288) != 0) { - stream.writeInt32(0x1cb5c415); - int count = premium_gifts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - premium_gifts.get(a).serializeToStream(stream); - } + Vector.serialize(stream, premium_gifts); } } } @@ -56593,7 +47995,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userFull_layer143 extends TL_userFull { public static final int constructor = 0x8c72ea81; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blocked = (flags & 1) != 0; phone_calls_available = (flags & 16) != 0; @@ -56637,7 +48039,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blocked ? (flags | 1) : (flags &~ 1); flags = phone_calls_available ? (flags | 16) : (flags &~ 16); @@ -56686,7 +48088,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userFull_layer139 extends UserFull { public static final int constructor = 0xcf366521; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blocked = (flags & 1) != 0; phone_calls_available = (flags & 16) != 0; @@ -56724,7 +48126,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blocked ? (flags | 1) : (flags &~ 1); flags = phone_calls_available ? (flags | 16) : (flags &~ 16); @@ -56767,8 +48169,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userFull_layer134 extends TL_userFull { public static final int constructor = 0xd697ff05; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blocked = (flags & 1) != 0; phone_calls_available = (flags & 16) != 0; @@ -56803,7 +48204,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blocked ? (flags | 1) : (flags &~ 1); flags = phone_calls_available ? (flags | 16) : (flags &~ 16); @@ -56843,8 +48244,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userFull_layer101 extends TL_userFull { public static final int constructor = 0x745559cc; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blocked = (flags & 1) != 0; phone_calls_available = (flags & 16) != 0; @@ -56871,7 +48271,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blocked ? (flags | 1) : (flags &~ 1); flags = phone_calls_available ? (flags | 16) : (flags &~ 16); @@ -56903,8 +48303,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userFull_layer98 extends TL_userFull { public static final int constructor = 0x8ea4a881; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blocked = (flags & 1) != 0; phone_calls_available = (flags & 16) != 0; @@ -56928,7 +48327,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { common_chats_count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blocked ? (flags | 1) : (flags &~ 1); flags = phone_calls_available ? (flags | 16) : (flags &~ 16); @@ -56957,78 +48356,76 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_userFull_layer131 extends TL_userFull { public static final int constructor = 0x139a9a77; + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + blocked = (flags & 1) != 0; + phone_calls_available = (flags & 16) != 0; + phone_calls_private = (flags & 32) != 0; + can_pin_message = (flags & 128) != 0; + has_scheduled = (flags & 4096) != 0; + video_calls_available = (flags & 8192) != 0; + user = User.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 2) != 0) { + about = stream.readString(exception); + } + settings = PeerSettings.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 4) != 0) { + profile_photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + } + notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 8) != 0) { + bot_info = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 64) != 0) { + pinned_msg_id = stream.readInt32(exception); + } + common_chats_count = stream.readInt32(exception); + if ((flags & 2048) != 0) { + folder_id = stream.readInt32(exception); + } + if ((flags & 16384) != 0) { + ttl_period = stream.readInt32(exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = blocked ? (flags | 1) : (flags &~ 1); + flags = phone_calls_available ? (flags | 16) : (flags &~ 16); + flags = phone_calls_private ? (flags | 32) : (flags &~ 32); + flags = can_pin_message ? (flags | 128) : (flags &~ 128); + flags = has_scheduled ? (flags | 4096) : (flags &~ 4096); + flags = video_calls_available ? (flags | 8192) : (flags &~ 8192); + stream.writeInt32(flags); + user.serializeToStream(stream); + if ((flags & 2) != 0) { + stream.writeString(about); + } + settings.serializeToStream(stream); + if ((flags & 4) != 0) { + profile_photo.serializeToStream(stream); + } + notify_settings.serializeToStream(stream); + if ((flags & 8) != 0) { + bot_info.serializeToStream(stream); + } + if ((flags & 64) != 0) { + stream.writeInt32(pinned_msg_id); + } + stream.writeInt32(common_chats_count); + if ((flags & 2048) != 0) { + stream.writeInt32(folder_id); + } + if ((flags & 16384) != 0) { + stream.writeInt32(ttl_period); + } + } + } + + public static class TL_userFull_layer123 extends TL_userFull { + public static final int constructor = 0xedf17c12; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - blocked = (flags & 1) != 0; - phone_calls_available = (flags & 16) != 0; - phone_calls_private = (flags & 32) != 0; - can_pin_message = (flags & 128) != 0; - has_scheduled = (flags & 4096) != 0; - video_calls_available = (flags & 8192) != 0; - user = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 2) != 0) { - about = stream.readString(exception); - } - settings = PeerSettings.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 4) != 0) { - profile_photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - } - notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 8) != 0) { - bot_info = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 64) != 0) { - pinned_msg_id = stream.readInt32(exception); - } - common_chats_count = stream.readInt32(exception); - if ((flags & 2048) != 0) { - folder_id = stream.readInt32(exception); - } - if ((flags & 16384) != 0) { - ttl_period = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = blocked ? (flags | 1) : (flags &~ 1); - flags = phone_calls_available ? (flags | 16) : (flags &~ 16); - flags = phone_calls_private ? (flags | 32) : (flags &~ 32); - flags = can_pin_message ? (flags | 128) : (flags &~ 128); - flags = has_scheduled ? (flags | 4096) : (flags &~ 4096); - flags = video_calls_available ? (flags | 8192) : (flags &~ 8192); - stream.writeInt32(flags); - user.serializeToStream(stream); - if ((flags & 2) != 0) { - stream.writeString(about); - } - settings.serializeToStream(stream); - if ((flags & 4) != 0) { - profile_photo.serializeToStream(stream); - } - notify_settings.serializeToStream(stream); - if ((flags & 8) != 0) { - bot_info.serializeToStream(stream); - } - if ((flags & 64) != 0) { - stream.writeInt32(pinned_msg_id); - } - stream.writeInt32(common_chats_count); - if ((flags & 2048) != 0) { - stream.writeInt32(folder_id); - } - if ((flags & 16384) != 0) { - stream.writeInt32(ttl_period); - } - } - } - - public static class TL_userFull_layer123 extends TL_userFull { - public static final int constructor = 0xedf17c12; - - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blocked = (flags & 1) != 0; phone_calls_available = (flags & 16) != 0; @@ -57057,7 +48454,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blocked ? (flags | 1) : (flags &~ 1); flags = phone_calls_available ? (flags | 16) : (flags &~ 16); @@ -57114,7 +48511,7 @@ public static abstract class Updates extends TLObject { public int seq_start; public int ttl_period; - public static Updates TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static Updates TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { Updates result = null; switch (constructor) { case 0x74ae4240: @@ -57152,53 +48549,10 @@ public static Updates TLdeserialize(AbstractSerializedData stream, int construct public static class TL_updates extends Updates { public static final int constructor = 0x74ae4240; - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Update object = Update.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - updates.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + updates = Vector.deserialize(stream, Update::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); date = stream.readInt32(exception); seq = stream.readInt32(exception); } @@ -57207,8 +48561,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { public static class TL_updateShortMessage extends Updates { public static final int constructor = 0x313bc7f8; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); out = (flags & 2) != 0; mentioned = (flags & 16) != 0; @@ -57230,21 +48583,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } if ((flags & 33554432) != 0) { ttl_period = stream.readInt32(exception); @@ -57255,8 +48594,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { public static class TL_updateShortSentMessage extends Updates { public static final int constructor = 0x9015e101; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); out = (flags & 2) != 0; id = stream.readInt32(exception); @@ -57267,21 +48605,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } if ((flags & 33554432) != 0) { ttl_period = stream.readInt32(exception); @@ -57292,8 +48616,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { public static class TL_updateShort extends Updates { public static final int constructor = 0x78d4dec1; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { update = Update.TLdeserialize(stream, stream.readInt32(exception), exception); date = stream.readInt32(exception); } @@ -57302,8 +48625,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { public static class TL_updateShortChatMessage extends Updates { public static final int constructor = 0x4d6deea5; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); out = (flags & 2) != 0; mentioned = (flags & 16) != 0; @@ -57326,21 +48648,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } if ((flags & 33554432) != 0) { ttl_period = stream.readInt32(exception); @@ -57351,53 +48659,10 @@ public void readParams(AbstractSerializedData stream, boolean exception) { public static class TL_updatesCombined extends Updates { public static final int constructor = 0x725b04c3; - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Update object = Update.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - updates.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + updates = Vector.deserialize(stream, Update::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); date = stream.readInt32(exception); seq_start = stream.readInt32(exception); seq = stream.readInt32(exception); @@ -57424,7 +48689,7 @@ public static abstract class WallPaper extends TLObject { public Bitmap stripedThumb;//custom public Drawable thumbDrawable;//custom - public static WallPaper TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static WallPaper TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { WallPaper result = null; switch (constructor) { case 0xa437c3ed: @@ -57453,8 +48718,7 @@ public static WallPaper TLdeserialize(AbstractSerializedData stream, int constru public static class TL_wallPaper extends WallPaper { public static final int constructor = 0xa437c3ed; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); flags = stream.readInt32(exception); creator = (flags & 1) != 0; @@ -57469,7 +48733,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); flags = creator ? (flags | 1) : (flags &~ 1); @@ -57489,8 +48753,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_wallPaper_layer94 extends TL_wallPaper { public static final int constructor = 0xf04f91ec; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); flags = stream.readInt32(exception); creator = (flags & 1) != 0; @@ -57500,7 +48763,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); flags = creator ? (flags | 1) : (flags &~ 1); @@ -57515,8 +48778,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_wallPaperNoFile_layer128 extends TL_wallPaperNoFile { public static final int constructor = 0x8af40b25; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); isDefault = (flags & 2) != 0; dark = (flags & 16) != 0; @@ -57525,7 +48787,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = isDefault ? (flags | 2) : (flags &~ 2); flags = dark ? (flags | 16) : (flags &~ 16); @@ -57539,8 +48801,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_wallPaperNoFile extends WallPaper { public static final int constructor = 0xe0804116; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); flags = stream.readInt32(exception); isDefault = (flags & 2) != 0; @@ -57550,7 +48811,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); flags = isDefault ? (flags | 2) : (flags &~ 2); @@ -57568,7 +48829,7 @@ public static class TL_paymentSavedCredentialsCard extends TLObject { public String id; public String title; - public static TL_paymentSavedCredentialsCard TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_paymentSavedCredentialsCard TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_paymentSavedCredentialsCard.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_paymentSavedCredentialsCard", constructor)); @@ -57581,12 +48842,12 @@ public static TL_paymentSavedCredentialsCard TLdeserialize(AbstractSerializedDat return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readString(exception); title = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(id); stream.writeString(title); @@ -57595,7 +48856,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class PageListItem extends TLObject { - public static PageListItem TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static PageListItem TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { PageListItem result = null; switch (constructor) { case 0x25e073fc: @@ -57620,32 +48881,13 @@ public static class TL_pageListItemBlocks extends PageListItem { public ArrayList blocks = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - blocks.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + blocks = Vector.deserialize(stream, PageBlock::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = blocks.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - blocks.get(a).serializeToStream(stream); - } + Vector.serialize(stream, blocks); } } @@ -57654,11 +48896,11 @@ public static class TL_pageListItemText extends PageListItem { public RichText text; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); text.serializeToStream(stream); } @@ -57670,7 +48912,7 @@ public static class TL_stickerPack extends TLObject { public String emoticon; public ArrayList documents = new ArrayList<>(); - public static TL_stickerPack TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_stickerPack TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_stickerPack.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_stickerPack", constructor)); @@ -57683,46 +48925,42 @@ public static TL_stickerPack TLdeserialize(AbstractSerializedData stream, int co return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { emoticon = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - documents.add(stream.readInt64(exception)); - } + documents = Vector.deserializeLong(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(emoticon); - stream.writeInt32(0x1cb5c415); - int count = documents.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(documents.get(a)); - } + Vector.serializeLong(stream, documents); } } public static abstract class EmojiStatus extends TLObject { - public static EmojiStatus TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public int until; + + public static EmojiStatus TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { EmojiStatus result = null; switch (constructor) { - case 0x2de11aae: + case TL_emojiStatusEmpty.constructor: result = new TL_emojiStatusEmpty(); break; - case 0x929b619d: + case TL_emojiStatus.constructor: result = new TL_emojiStatus(); break; - case 0xfa30a8c7: - result = new TL_emojiStatusUntil(); + case TL_emojiStatusCollectible.constructor: + result = new TL_emojiStatusCollectible(); + break; + case TL_inputEmojiStatusCollectible.constructor: + result = new TL_inputEmojiStatusCollectible(); + break; + case TL_emojiStatus_layer197.constructor: + result = new TL_emojiStatus_layer197(); + break; + case TL_emojiStatusUntil_layer197.constructor: + result = new TL_emojiStatusUntil_layer197(); break; } if (result == null && exception) { @@ -57731,6 +48969,14 @@ public static EmojiStatus TLdeserialize(AbstractSerializedData stream, int const if (result != null) { result.readParams(stream, exception); } + if (result instanceof TL_emojiStatusUntil_layer197) { + final TL_emojiStatusUntil_layer197 oldUntil = (TL_emojiStatusUntil_layer197) result; + final TL_emojiStatus newUntil = new TL_emojiStatus(); + newUntil.document_id = oldUntil.document_id; + newUntil.flags |= 1; + newUntil.until = oldUntil.until; + result = newUntil; + } return result; } } @@ -57738,44 +48984,139 @@ public static EmojiStatus TLdeserialize(AbstractSerializedData stream, int const public static class TL_emojiStatusEmpty extends EmojiStatus { public static final int constructor = 0x2de11aae; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } public static class TL_emojiStatus extends EmojiStatus { - public static final int constructor = 0x929b619d; + public static final int constructor = 0xe7ff068a; + public int flags; public long document_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + document_id = stream.readInt64(exception); + if ((flags & 1) != 0) { + until = stream.readInt32(exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeInt64(document_id); + if ((flags & 1) != 0) { + stream.writeInt32(until); + } + } + } + + public static class TL_emojiStatus_layer197 extends TL_emojiStatus { + public static final int constructor = 0x929b619d; + + public void readParams(InputSerializedData stream, boolean exception) { document_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(document_id); } } - public static class TL_emojiStatusUntil extends EmojiStatus { + public static class TL_emojiStatusUntil_layer197 extends EmojiStatus { public static final int constructor = 0xfa30a8c7; public long document_id; public int until; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { document_id = stream.readInt64(exception); until = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(document_id); stream.writeInt32(until); } } + public static class TL_emojiStatusCollectible extends EmojiStatus { + public static final int constructor = 0x7184603b; + + public int flags; + public long collectible_id; + public long document_id; + public String title; + public String slug; + public long pattern_document_id; + public int center_color; + public int edge_color; + public int pattern_color; + public int text_color; + public int until; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + collectible_id = stream.readInt64(exception); + document_id = stream.readInt64(exception); + title = stream.readString(exception); + slug = stream.readString(exception); + pattern_document_id = stream.readInt64(exception); + center_color = stream.readInt32(exception); + edge_color = stream.readInt32(exception); + pattern_color = stream.readInt32(exception); + text_color = stream.readInt32(exception); + if ((flags & 1) != 0) { + until = stream.readInt32(exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeInt64(collectible_id); + stream.writeInt64(document_id); + stream.writeString(title); + stream.writeString(slug); + stream.writeInt64(pattern_document_id); + stream.writeInt32(center_color); + stream.writeInt32(edge_color); + stream.writeInt32(pattern_color); + stream.writeInt32(text_color); + if ((flags & 1) != 0) { + stream.writeInt32(until); + } + } + } + + public static class TL_inputEmojiStatusCollectible extends EmojiStatus { + public static final int constructor = 0x7141dbf; + + public int flags; + public long collectible_id; + public int until; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + collectible_id = stream.readInt64(exception); + if ((flags & 1) != 0) { + until = stream.readInt32(exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeInt64(collectible_id); + if ((flags & 1) != 0) { + stream.writeInt32(until); + } + } + } public static class TL_inputEncryptedChat extends TLObject { public static final int constructor = 0xf141b5e1; @@ -57783,7 +49124,7 @@ public static class TL_inputEncryptedChat extends TLObject { public int chat_id; public long access_hash; - public static TL_inputEncryptedChat TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_inputEncryptedChat TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_inputEncryptedChat.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_inputEncryptedChat", constructor)); @@ -57796,12 +49137,12 @@ public static TL_inputEncryptedChat TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { chat_id = stream.readInt32(exception); access_hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(chat_id); stream.writeInt64(access_hash); @@ -57810,7 +49151,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class InputChatPhoto extends TLObject { - public static InputChatPhoto TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputChatPhoto TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputChatPhoto result = null; switch (constructor) { case 0x8953ad37: @@ -57838,11 +49179,11 @@ public static class TL_inputChatPhoto extends InputChatPhoto { public InputPhoto id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = InputPhoto.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); id.serializeToStream(stream); } @@ -57851,8 +49192,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputChatPhotoEmpty extends InputChatPhoto { public static final int constructor = 0x1ca48f57; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -57866,7 +49206,7 @@ public static class TL_inputChatUploadedPhoto extends InputChatPhoto { public double video_start_ts; public VideoSize video_emoji_markup; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { file = InputFile.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -57882,7 +49222,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -57907,7 +49247,7 @@ public static class TL_nearestDc extends TLObject { public int this_dc; public int nearest_dc; - public static TL_nearestDc TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_nearestDc TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_nearestDc.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_nearestDc", constructor)); @@ -57920,13 +49260,13 @@ public static TL_nearestDc TLdeserialize(AbstractSerializedData stream, int cons return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { country = stream.readString(exception); this_dc = stream.readInt32(exception); nearest_dc = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(country); stream.writeInt32(this_dc); @@ -57941,7 +49281,7 @@ public static class TL_payments_savedInfo extends TLObject { public boolean has_saved_credentials; public TL_paymentRequestedInfo saved_info; - public static TL_payments_savedInfo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_payments_savedInfo TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_payments_savedInfo.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_payments_savedInfo", constructor)); @@ -57954,7 +49294,7 @@ public static TL_payments_savedInfo TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); has_saved_credentials = (flags & 2) != 0; if ((flags & 1) != 0) { @@ -57962,7 +49302,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = has_saved_credentials ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); @@ -57977,7 +49317,7 @@ public static abstract class InputPhoto extends TLObject { public long access_hash; public byte[] file_reference; - public static InputPhoto TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputPhoto TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputPhoto result = null; switch (constructor) { case 0x1cd7bf0d: @@ -58000,8 +49340,7 @@ public static InputPhoto TLdeserialize(AbstractSerializedData stream, int constr public static class TL_inputPhotoEmpty extends InputPhoto { public static final int constructor = 0x1cd7bf0d; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -58009,14 +49348,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPhoto extends InputPhoto { public static final int constructor = 0x3bb3b94a; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); access_hash = stream.readInt64(exception); file_reference = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(access_hash); @@ -58034,7 +49372,7 @@ public static class TL_messages_messageReactionsList extends TLObject { public ArrayList users = new ArrayList<>(); public String next_offset; - public static TL_messages_messageReactionsList TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_messageReactionsList TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_messageReactionsList.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_messageReactionsList", constructor)); @@ -58047,81 +49385,24 @@ public static TL_messages_messageReactionsList TLdeserialize(AbstractSerializedD return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessagePeerReaction object = MessagePeerReaction.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - reactions.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + reactions = Vector.deserialize(stream, MessagePeerReaction::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); if ((flags & 1) != 0) { next_offset = stream.readString(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = reactions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - reactions.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, reactions); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); if ((flags & 1) != 0) { stream.writeString(next_offset); } @@ -58134,7 +49415,7 @@ public static class TL_importedContact extends TLObject { public long user_id; public long client_id; - public static TL_importedContact TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_importedContact TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_importedContact.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_importedContact", constructor)); @@ -58147,12 +49428,12 @@ public static TL_importedContact TLdeserialize(AbstractSerializedData stream, in return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); client_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); stream.writeInt64(client_id); @@ -58164,7 +49445,7 @@ public static class TL_chatOnlines extends TLObject { public int onlines; - public static TL_chatOnlines TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_chatOnlines TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_chatOnlines.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_chatOnlines", constructor)); @@ -58177,11 +49458,11 @@ public static TL_chatOnlines TLdeserialize(AbstractSerializedData stream, int co return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { onlines = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(onlines); } @@ -58189,7 +49470,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class messages_RecentStickers extends TLObject { - public static messages_RecentStickers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static messages_RecentStickers TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { messages_RecentStickers result = null; switch (constructor) { case 0x88d37c56: @@ -58217,80 +49498,26 @@ public static class TL_messages_recentStickers extends messages_RecentStickers { public ArrayList stickers = new ArrayList<>(); public ArrayList dates = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { hash = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_stickerPack object = TL_stickerPack.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - packs.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - stickers.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - dates.add(stream.readInt32(exception)); - } + packs = Vector.deserialize(stream, TL_stickerPack::TLdeserialize, exception); + stickers = Vector.deserialize(stream, Document::TLdeserialize, exception); + dates = Vector.deserializeInt(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(hash); - stream.writeInt32(0x1cb5c415); - int count = packs.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - packs.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = stickers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stickers.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = dates.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(dates.get(a)); - } + Vector.serialize(stream, packs); + Vector.serialize(stream, stickers); + Vector.serializeInt(stream, dates); } } public static class TL_messages_recentStickersNotModified extends messages_RecentStickers { public static final int constructor = 0xb17f890; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -58307,7 +49534,7 @@ public static class TL_pageRelatedArticle extends TLObject { public String author; public int published_date; - public static TL_pageRelatedArticle TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_pageRelatedArticle TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_pageRelatedArticle.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_pageRelatedArticle", constructor)); @@ -58320,7 +49547,7 @@ public static TL_pageRelatedArticle TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); url = stream.readString(exception); webpage_id = stream.readInt64(exception); @@ -58341,7 +49568,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(url); @@ -58369,7 +49596,7 @@ public static class TL_accountDaysTTL extends TLObject { public int days; - public static TL_accountDaysTTL TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_accountDaysTTL TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_accountDaysTTL.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_accountDaysTTL", constructor)); @@ -58382,11 +49609,11 @@ public static TL_accountDaysTTL TLdeserialize(AbstractSerializedData stream, int return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { days = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(days); } @@ -58394,7 +49621,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class messages_Stickers extends TLObject { - public static messages_Stickers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static messages_Stickers TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { messages_Stickers result = null; switch (constructor) { case 0xf1749a22: @@ -58417,8 +49644,7 @@ public static messages_Stickers TLdeserialize(AbstractSerializedData stream, int public static class TL_messages_stickersNotModified extends messages_Stickers { public static final int constructor = 0xf1749a22; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -58429,34 +49655,15 @@ public static class TL_messages_stickers extends messages_Stickers { public long hash; public ArrayList stickers = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { hash = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - stickers.add(object); - } + stickers = Vector.deserialize(stream, Document::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(hash); - stream.writeInt32(0x1cb5c415); - int count = stickers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stickers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, stickers); } } @@ -58469,7 +49676,7 @@ public static abstract class InputPeer extends TLObject { public long chat_id; public long access_hash; - public static InputPeer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputPeer TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputPeer result = null; switch (constructor) { case 0x7da07ec9: @@ -58522,8 +49729,7 @@ public static InputPeer TLdeserialize(AbstractSerializedData stream, int constru public static class TL_inputPeerSelf extends InputPeer { public static final int constructor = 0x7da07ec9; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -58531,14 +49737,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPeerUserFromMessage extends InputPeer { public static final int constructor = 0xa87b0a1c; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); msg_id = stream.readInt32(exception); user_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(msg_id); @@ -58549,13 +49754,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPeerUser extends InputPeer { public static final int constructor = 0xdde8a54c; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); access_hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); stream.writeInt64(access_hash); @@ -58565,12 +49769,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPeerChat_layer131 extends TL_inputPeerChat { public static final int constructor = 0x179be863; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { chat_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) chat_id); } @@ -58579,13 +49782,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPeerChannel extends InputPeer { public static final int constructor = 0x27bcbbfc; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { channel_id = stream.readInt64(exception); access_hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(channel_id); stream.writeInt64(access_hash); @@ -58595,13 +49797,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPeerUser_layer131 extends TL_inputPeerUser { public static final int constructor = 0x7b8e7de6; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt32(exception); access_hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) user_id); stream.writeInt64(access_hash); @@ -58611,8 +49812,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPeerEmpty extends InputPeer { public static final int constructor = 0x7f3b18ea; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -58620,14 +49820,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPeerChannelFromMessage extends InputPeer { public static final int constructor = 0xbd2a0840; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); msg_id = stream.readInt32(exception); channel_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(msg_id); @@ -58638,12 +49837,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPeerChat extends InputPeer { public static final int constructor = 0x35a95cb9; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { chat_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(chat_id); } @@ -58652,13 +49850,12 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPeerChannel_layer131 extends TL_inputPeerChannel { public static final int constructor = 0x20adaef8; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { channel_id = stream.readInt32(exception); access_hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) channel_id); stream.writeInt64(access_hash); @@ -58668,14 +49865,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPeerChannelFromMessage_layer131 extends TL_inputPeerChannelFromMessage { public static final int constructor = 0x9c95f7bb; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); msg_id = stream.readInt32(exception); channel_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(msg_id); @@ -58686,14 +49882,13 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_inputPeerUserFromMessage_layer131 extends TL_inputPeerUserFromMessage { public static final int constructor = 0x17bae2e6; - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); msg_id = stream.readInt32(exception); user_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(msg_id); @@ -58703,7 +49898,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class help_PassportConfig extends TLObject { - public static help_PassportConfig TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static help_PassportConfig TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { help_PassportConfig result = null; switch (constructor) { case 0xbfb9f457: @@ -58726,8 +49921,7 @@ public static help_PassportConfig TLdeserialize(AbstractSerializedData stream, i public static class TL_help_passportConfigNotModified extends help_PassportConfig { public static final int constructor = 0xbfb9f457; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -58738,109 +49932,18 @@ public static class TL_help_passportConfig extends help_PassportConfig { public int hash; public TL_dataJSON countries_langs; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { hash = stream.readInt32(exception); countries_langs = TL_dataJSON.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(hash); countries_langs.serializeToStream(stream); } } - public static class TL_phone_exportedGroupCallInvite extends TLObject { - public static final int constructor = 0x204bd158; - - public String link; - - public static TL_phone_exportedGroupCallInvite TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_phone_exportedGroupCallInvite.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_phone_exportedGroupCallInvite", constructor)); - } else { - return null; - } - } - TL_phone_exportedGroupCallInvite result = new TL_phone_exportedGroupCallInvite(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - link = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(link); - } - } - - public static class TL_account_passwordInputSettings extends TLObject { - public static final int constructor = 0xc23727c9; - - public int flags; - public PasswordKdfAlgo new_algo; - public byte[] new_password_hash; - public String hint; - public String email; - public TL_secureSecretSettings new_secure_settings; - - public static TL_account_passwordInputSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_account_passwordInputSettings.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_account_passwordInputSettings", constructor)); - } else { - return null; - } - } - TL_account_passwordInputSettings result = new TL_account_passwordInputSettings(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - if ((flags & 1) != 0) { - new_algo = PasswordKdfAlgo.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 1) != 0) { - new_password_hash = stream.readByteArray(exception); - } - if ((flags & 1) != 0) { - hint = stream.readString(exception); - } - if ((flags & 2) != 0) { - email = stream.readString(exception); - } - if ((flags & 4) != 0) { - new_secure_settings = TL_secureSecretSettings.TLdeserialize(stream, stream.readInt32(exception), exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - new_algo.serializeToStream(stream); - } - if ((flags & 1) != 0) { - stream.writeByteArray(new_password_hash); - } - if ((flags & 1) != 0) { - stream.writeString(hint); - } - if ((flags & 2) != 0) { - stream.writeString(email); - } - if ((flags & 4) != 0) { - new_secure_settings.serializeToStream(stream); - } - } - } - public static class TL_dcOption extends TLObject { public static final int constructor = 0x18b7a10d; @@ -58855,7 +49958,7 @@ public static class TL_dcOption extends TLObject { public int port; public byte[] secret; - public static TL_dcOption TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_dcOption TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_dcOption.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_dcOption", constructor)); @@ -58868,7 +49971,7 @@ public static TL_dcOption TLdeserialize(AbstractSerializedData stream, int const return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); ipv6 = (flags & 1) != 0; media_only = (flags & 2) != 0; @@ -58883,7 +49986,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = ipv6 ? (flags | 1) : (flags &~ 1); flags = media_only ? (flags | 2) : (flags &~ 2); @@ -58905,7 +50008,7 @@ public static class TL_pageTableRow extends TLObject { public ArrayList cells = new ArrayList<>(); - public static TL_pageTableRow TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_pageTableRow TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_pageTableRow.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_pageTableRow", constructor)); @@ -58918,32 +50021,13 @@ public static TL_pageTableRow TLdeserialize(AbstractSerializedData stream, int c return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_pageTableCell object = TL_pageTableCell.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - cells.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + cells = Vector.deserialize(stream, TL_pageTableCell::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = cells.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - cells.get(a).serializeToStream(stream); - } + Vector.serialize(stream, cells); } } @@ -58952,7 +50036,7 @@ public static class TL_emojiURL extends TLObject { public String url; - public static TL_emojiURL TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_emojiURL TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_emojiURL.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_emojiURL", constructor)); @@ -58965,11 +50049,11 @@ public static TL_emojiURL TLdeserialize(AbstractSerializedData stream, int const return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); } @@ -58984,7 +50068,7 @@ public static class TL_decryptedMessageLayer extends TLObject { public int out_seq_no; public DecryptedMessage message; - public static TL_decryptedMessageLayer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_decryptedMessageLayer TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_decryptedMessageLayer.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_decryptedMessageLayer", constructor)); @@ -58997,7 +50081,7 @@ public static TL_decryptedMessageLayer TLdeserialize(AbstractSerializedData stre return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { random_bytes = stream.readByteArray(exception); layer = stream.readInt32(exception); in_seq_no = stream.readInt32(exception); @@ -59005,7 +50089,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { message = DecryptedMessage.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeByteArray(random_bytes); stream.writeInt32(layer); @@ -59053,7 +50137,7 @@ public static class TL_groupCallParticipant extends TLObject { public int hasPresentationFrame;//custom; public int hasCameraFrame;//custom; - public static TL_groupCallParticipant TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_groupCallParticipant TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_groupCallParticipant.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_groupCallParticipant", constructor)); @@ -59066,7 +50150,7 @@ public static TL_groupCallParticipant TLdeserialize(AbstractSerializedData strea return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); muted = (flags & 1) != 0; left = (flags & 2) != 0; @@ -59101,7 +50185,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = muted ? (flags | 1) : (flags &~ 1); flags = left ? (flags | 2) : (flags &~ 2); @@ -59145,7 +50229,7 @@ public static class TL_fileHash extends TLObject { public int limit; public byte[] hash; - public static TL_fileHash TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_fileHash TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_fileHash.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_fileHash", constructor)); @@ -59158,13 +50242,13 @@ public static TL_fileHash TLdeserialize(AbstractSerializedData stream, int const return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { offset = stream.readInt64(exception); limit = stream.readInt32(exception); hash = stream.readByteArray(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(offset); stream.writeInt32(limit); @@ -59181,7 +50265,7 @@ public static class TL_messages_peerDialogs extends TLObject { public ArrayList users = new ArrayList<>(); public TL_updates_state state; - public static TL_messages_peerDialogs TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_peerDialogs TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_peerDialogs.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_peerDialogs", constructor)); @@ -59194,96 +50278,20 @@ public static TL_messages_peerDialogs TLdeserialize(AbstractSerializedData strea return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Dialog object = Dialog.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - dialogs.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + dialogs = Vector.deserialize(stream, Dialog::TLdeserialize, exception); + messages = Vector.deserialize(stream, Message::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); state = TL_updates_state.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = dialogs.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - dialogs.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, dialogs); + Vector.serialize(stream, messages); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); state.serializeToStream(stream); } } @@ -59294,7 +50302,7 @@ public static class TL_topPeer extends TLObject { public Peer peer; public double rating; - public static TL_topPeer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_topPeer TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_topPeer.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_topPeer", constructor)); @@ -59307,82 +50315,18 @@ public static TL_topPeer TLdeserialize(AbstractSerializedData stream, int constr return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); rating = stream.readDouble(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeDouble(rating); } } - public static abstract class account_ResetPasswordResult extends TLObject { - - public static account_ResetPasswordResult TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - account_ResetPasswordResult result = null; - switch (constructor) { - case 0xe3779861: - result = new TL_account_resetPasswordFailedWait(); - break; - case 0xe9effc7d: - result = new TL_account_resetPasswordRequestedWait(); - break; - case 0xe926d63e: - result = new TL_account_resetPasswordOk(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in account_ResetPasswordResult", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } - - public static class TL_account_resetPasswordFailedWait extends account_ResetPasswordResult { - public static final int constructor = 0xe3779861; - - public int retry_date; - - public void readParams(AbstractSerializedData stream, boolean exception) { - retry_date = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(retry_date); - } - } - - public static class TL_account_resetPasswordRequestedWait extends account_ResetPasswordResult { - public static final int constructor = 0xe9effc7d; - - public int until_date; - - public void readParams(AbstractSerializedData stream, boolean exception) { - until_date = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(until_date); - } - } - - public static class TL_account_resetPasswordOk extends account_ResetPasswordResult { - public static final int constructor = 0xe926d63e; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static abstract class messages_Dialogs extends TLObject { public int count; @@ -59391,7 +50335,7 @@ public static abstract class messages_Dialogs extends TLObject { public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static messages_Dialogs TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static messages_Dialogs TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { messages_Dialogs result = null; switch (constructor) { case 0x15ba6c40: @@ -59417,258 +50361,56 @@ public static messages_Dialogs TLdeserialize(AbstractSerializedData stream, int public static class TL_messages_dialogs extends messages_Dialogs { public static final int constructor = 0x15ba6c40; - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Dialog object = Dialog.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - dialogs.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + dialogs = Vector.deserialize(stream, Dialog::TLdeserialize, exception); + messages = Vector.deserialize(stream, Message::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = dialogs.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - dialogs.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, dialogs); + Vector.serialize(stream, messages); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } public static class TL_messages_dialogsSlice extends messages_Dialogs { public static final int constructor = 0x71e094f3; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Dialog object = Dialog.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - dialogs.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + dialogs = Vector.deserialize(stream, Dialog::TLdeserialize, exception); + messages = Vector.deserialize(stream, Message::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = dialogs.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - dialogs.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, dialogs); + Vector.serialize(stream, messages); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } public static class TL_messages_dialogsNotModified extends messages_Dialogs { public static final int constructor = 0xf0e3e596; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(count); } } - public static class TL_account_authorizations extends TLObject { - public static final int constructor = 0x4bff8ea0; - - public int authorization_ttl_days; - public ArrayList authorizations = new ArrayList<>(); - - public static TL_account_authorizations TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_account_authorizations.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_account_authorizations", constructor)); - } else { - return null; - } - } - TL_account_authorizations result = new TL_account_authorizations(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - authorization_ttl_days = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_authorization object = TL_authorization.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - authorizations.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(authorization_ttl_days); - stream.writeInt32(0x1cb5c415); - int count = authorizations.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - authorizations.get(a).serializeToStream(stream); - } - } - } - public static class TL_paymentRequestedInfo extends TLObject { public static final int constructor = 0x909c3f94; @@ -59678,7 +50420,7 @@ public static class TL_paymentRequestedInfo extends TLObject { public String email; public TL_postAddress shipping_address; - public static TL_paymentRequestedInfo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_paymentRequestedInfo TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_paymentRequestedInfo.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_paymentRequestedInfo", constructor)); @@ -59691,7 +50433,7 @@ public static TL_paymentRequestedInfo TLdeserialize(AbstractSerializedData strea return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { name = stream.readString(exception); @@ -59707,7 +50449,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -59729,7 +50471,7 @@ public static abstract class Reaction extends TLObject { public long tag_long_id; // custom - public static Reaction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static Reaction TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { Reaction result = null; switch (constructor) { case 0x8935fc73: @@ -59772,11 +50514,11 @@ public static class TL_reactionCustomEmoji extends Reaction { public long document_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { document_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(document_id); } @@ -59785,8 +50527,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_reactionEmpty extends Reaction { public static final int constructor = 0x79f5d419; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -59794,8 +50535,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_reactionPaid extends Reaction { public static final int constructor = 0x523da4eb; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -59805,11 +50545,11 @@ public static class TL_reactionEmoji extends Reaction { public String emoticon; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { emoticon = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(emoticon); } @@ -59820,11 +50560,11 @@ public static class TL_messages_getEmojiGroups extends TLObject { public int hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return messages_EmojiGroups.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(hash); } @@ -59835,11 +50575,11 @@ public static class TL_messages_getEmojiStickerGroups extends TLObject { public int hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return messages_EmojiGroups.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(hash); } @@ -59850,11 +50590,11 @@ public static class TL_messages_getAvailableEffects extends TLObject { public int hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return messages_AvailableEffects.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(hash); } @@ -59865,11 +50605,11 @@ public static class TL_messages_getEmojiProfilePhotoGroups extends TLObject { public int hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return messages_EmojiGroups.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(hash); } @@ -59880,11 +50620,11 @@ public static class TL_messages_getEmojiStatusGroups extends TLObject { public int hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return messages_EmojiGroups.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(hash); } @@ -59896,11 +50636,11 @@ public static class TL_messages_searchCustomEmoji extends TLObject { public String emoticon; public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return EmojiList.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(emoticon); stream.writeInt64(hash); @@ -59914,11 +50654,11 @@ public static class TL_messages_togglePeerTranslations extends TLObject { public boolean disabled; public InputPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = disabled ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -59934,11 +50674,11 @@ public static class TL_auth_sendCode extends TLObject { public String api_hash; public TL_codeSettings settings; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_auth_sentCode.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(phone_number); stream.writeInt32(api_id); @@ -59955,11 +50695,11 @@ public static class TL_auth_signUp extends TLObject { public String first_name; public String last_name; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return auth_Authorization.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(phone_number); stream.writeString(phone_code_hash); @@ -59975,11 +50715,11 @@ public static class TL_auth_signInOld extends TLObject { public String phone_code_hash; public String phone_code; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return auth_Authorization.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(phone_number); stream.writeString(phone_code_hash); @@ -59996,11 +50736,11 @@ public static class TL_auth_signIn extends TLObject { public String phone_code; public EmailVerification email_verification; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return auth_Authorization.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(phone_number); @@ -60017,12 +50757,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_auth_logOut extends TLObject { public static final int constructor = 0x3e72ba19; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_auth_loggedOut.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -60033,11 +50772,11 @@ public static class TL_auth_resetLoginEmail extends TLObject { public String phone_number; public String phone_code_hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return auth_SentCode.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(phone_number); stream.writeString(phone_code_hash); @@ -60047,12 +50786,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_auth_resetAuthorizations extends TLObject { public static final int constructor = 0x9fab0d1a; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -60062,11 +50800,11 @@ public static class TL_auth_exportAuthorization extends TLObject { public int dc_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_auth_exportedAuthorization.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(dc_id); } @@ -60078,11 +50816,11 @@ public static class TL_auth_importAuthorization extends TLObject { public long id; public byte[] bytes; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return auth_Authorization.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeByteArray(bytes); @@ -60096,20 +50834,15 @@ public static class TL_auth_exportLoginToken extends TLObject { public String api_hash; public ArrayList except_ids = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return auth_LoginToken.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(api_id); stream.writeString(api_hash); - stream.writeInt32(0x1cb5c415); - int count = except_ids.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(except_ids.get(a)); - } + Vector.serializeLong(stream, except_ids); } } @@ -60118,11 +50851,11 @@ public static class TL_auth_importLoginToken extends TLObject { public byte[] token; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return auth_LoginToken.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeByteArray(token); } @@ -60133,11 +50866,11 @@ public static class TL_auth_acceptLoginToken extends TLObject { public byte[] token; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_authorization.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeByteArray(token); } @@ -60148,11 +50881,11 @@ public static class TL_auth_checkRecoveryPassword extends TLObject { public String code; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(code); } @@ -60168,11 +50901,11 @@ public static class TL_auth_requestFirebaseSms extends TLObject { public String play_integrity_token; public String ios_push_secret; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(phone_number); @@ -60189,292 +50922,18 @@ public void serializeToStream(AbstractSerializedData stream) { } } - public static class TL_account_registerDevice extends TLObject { - public static final int constructor = 0xec86017a; - - public int flags; - public boolean no_muted; - public int token_type; - public String token; - public boolean app_sandbox; - public byte[] secret; - public ArrayList other_uids = new ArrayList<>(); - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = no_muted ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeInt32(token_type); - stream.writeString(token); - stream.writeBool(app_sandbox); - stream.writeByteArray(secret); - stream.writeInt32(0x1cb5c415); - int count = other_uids.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(other_uids.get(a)); - } - } - } - - public static class TL_account_unregisterDevice extends TLObject { - public static final int constructor = 0x6a0d3206; - - public int token_type; - public String token; - public ArrayList other_uids = new ArrayList<>(); - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(token_type); - stream.writeString(token); - stream.writeInt32(0x1cb5c415); - int count = other_uids.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(other_uids.get(a)); - } - } - } - - public static class TL_account_updateNotifySettings extends TLObject { - public static final int constructor = 0x84be5b93; - - public InputNotifyPeer peer; - public TL_inputPeerNotifySettings settings; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - settings.serializeToStream(stream); - } - } - - public static class TL_account_getNotifySettings extends TLObject { - public static final int constructor = 0x12b3ad31; - - public InputNotifyPeer peer; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return PeerNotifySettings.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - } - } - - public static class TL_account_resetNotifySettings extends TLObject { - public static final int constructor = 0xdb7e1747; - - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_account_updateProfile extends TLObject { - public static final int constructor = 0x78515775; - - public int flags; - public String first_name; - public String last_name; - public String about; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return User.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - stream.writeString(first_name); - } - if ((flags & 2) != 0) { - stream.writeString(last_name); - } - if ((flags & 4) != 0) { - stream.writeString(about); - } - } - } - - public static class TL_account_updateStatus extends TLObject { - public static final int constructor = 0x6628562c; - - public boolean offline; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeBool(offline); - } - } - - public static class TL_account_getWallPapers extends TLObject { - public static final int constructor = 0x7967d36; - - public long hash; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return account_WallPapers.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(hash); - } - } - public static class TL_users_getUsers extends TLObject { public static final int constructor = 0xd91a548; public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, User::TLdeserialize); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - id.get(a).serializeToStream(stream); - } - } - } - - public static class TL_account_reportPeer extends TLObject { - public static final int constructor = 0xc5ba3d86; - - public InputPeer peer; - public ReportReason reason; - public String message; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - reason.serializeToStream(stream); - stream.writeString(message); - } - } - - public static class TL_account_resetPassword extends TLObject { - public static final int constructor = 0x9308ce1b; - - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return account_ResetPasswordResult.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_account_declinePasswordReset extends TLObject { - public static final int constructor = 0x4c9409f6; - - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_account_getChatThemes extends TLObject { - public static final int constructor = 0xd638de89; - - public long hash; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return account_Themes.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(hash); - } - } - - public static class TL_account_setAuthorizationTTL extends TLObject { - public static final int constructor = 0xbf899aa0; - - public int authorization_ttl_days; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(authorization_ttl_days); - } - } - - public static class TL_account_changeAuthorizationSettings extends TLObject { - public static final int constructor = 0x40f48462; - - public int flags; - public boolean confirmed; - public long hash; - public boolean encrypted_requests_disabled; - public boolean call_requests_disabled; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = confirmed ? (flags | 8) : (flags &~ 8); - stream.writeInt32(flags); - stream.writeInt64(hash); - if ((flags & 1) != 0) { - stream.writeBool(encrypted_requests_disabled); - } - if ((flags & 2) != 0) { - stream.writeBool(call_requests_disabled); - } + Vector.serialize(stream, id); } } @@ -60483,63 +50942,39 @@ public static class TL_users_getFullUser extends TLObject { public InputUser id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_users_userFull.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); id.serializeToStream(stream); } } - + public static class TL_users_getIsPremiumRequiredToContact extends TLObject { public static final int constructor = 0xa622aa10; - + public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - Bool object = Bool.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, Bool::TLdeserialize); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - id.get(i).serializeToStream(stream); - } + Vector.serialize(stream, id); } } public static class TL_contacts_getStatuses extends TLObject { public static final int constructor = 0xc4a353ee; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_contactStatus object = TL_contactStatus.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, TL_contactStatus::TLdeserialize); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -60549,11 +50984,11 @@ public static class TL_contacts_getContacts extends TLObject { public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return contacts_Contacts.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(hash); } @@ -60564,18 +50999,13 @@ public static class TL_contacts_importContacts extends TLObject { public ArrayList contacts = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_contacts_importedContacts.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = contacts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - contacts.get(a).serializeToStream(stream); - } + Vector.serialize(stream, contacts); } } @@ -60584,18 +51014,13 @@ public static class TL_contacts_deleteContacts extends TLObject { public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - id.get(a).serializeToStream(stream); - } + Vector.serialize(stream, id); } } @@ -60604,18 +51029,13 @@ public static class TL_contacts_deleteByPhones extends TLObject { public ArrayList phones = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = phones.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(phones.get(a)); - } + Vector.serializeString(stream, phones); } } @@ -60626,11 +51046,11 @@ public static class TL_contacts_block extends TLObject { public boolean my_stories_from; public InputPeer id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = my_stories_from ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -60645,11 +51065,11 @@ public static class TL_contacts_unblock extends TLObject { public boolean my_stories_from; public InputPeer id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = my_stories_from ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -60665,11 +51085,11 @@ public static class TL_contacts_getBlocked extends TLObject { public int offset; public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return contacts_Blocked.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = my_stories_from ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -60678,53 +51098,29 @@ public void serializeToStream(AbstractSerializedData stream) { } } - public static class TL_contacts_exportCard extends TLObject { - public static final int constructor = 0x84e53737; - - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - vector.objects.add(stream.readInt32(exception)); - } - return vector; - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - public static class TL_contacts_importCard extends TLObject { public static final int constructor = 0x4fe196fe; public ArrayList export_card = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return User.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = export_card.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(export_card.get(a)); - } + Vector.serializeInt(stream, export_card); } } public static class TL_contacts_resetSaved extends TLObject { public static final int constructor = 0x879537f1; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -60734,11 +51130,11 @@ public static class TL_contacts_toggleTopPeers extends TLObject { public boolean enabled; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeBool(enabled); } @@ -60754,11 +51150,11 @@ public static class TL_contacts_addContact extends TLObject { public String last_name; public String phone; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = add_phone_privacy_exception ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -60774,11 +51170,11 @@ public static class TL_contacts_acceptContact extends TLObject { public InputUser id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); id.serializeToStream(stream); } @@ -60793,11 +51189,11 @@ public static class TL_contacts_blockFromReplies extends TLObject { public boolean report_spam; public int msg_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = delete_message ? (flags | 1) : (flags &~ 1); flags = delete_history ? (flags | 2) : (flags &~ 2); @@ -60812,11 +51208,11 @@ public static class TL_contacts_resolvePhone extends TLObject { public String phone; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_contacts_resolvedPeer.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(phone); } @@ -60827,18 +51223,13 @@ public static class TL_messages_getMessages extends TLObject { public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return messages_Messages.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } + Vector.serializeInt(stream, id); } } @@ -60854,11 +51245,11 @@ public static class TL_messages_getDialogs extends TLObject { public int limit; public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return messages_Dialogs.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = exclude_pinned ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -60885,11 +51276,11 @@ public static class TL_messages_getHistory extends TLObject { public int min_id; public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return messages_Messages.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(offset_id); @@ -60922,11 +51313,11 @@ public static class TL_messages_search extends TLObject { public int min_id; public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return messages_Messages.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); peer.serializeToStream(stream); @@ -60938,12 +51329,7 @@ public void serializeToStream(AbstractSerializedData stream) { saved_peer_id.serializeToStream(stream); } if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = saved_reaction.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - saved_reaction.get(a).serializeToStream(stream); - } + Vector.serialize(stream, saved_reaction); } if ((flags & 2) != 0) { stream.writeInt32(top_msg_id); @@ -60963,12 +51349,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_help_getTermsOfServiceUpdate extends TLObject { public static final int constructor = 0x2ca51fd1; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return help_TermsOfServiceUpdate.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -60978,11 +51363,11 @@ public static class TL_help_acceptTermsOfService extends TLObject { public TL_dataJSON id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); id.serializeToStream(stream); } @@ -60993,11 +51378,11 @@ public static class TL_help_getPassportConfig extends TLObject { public int hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return help_PassportConfig.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(hash); } @@ -61006,12 +51391,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_help_getSupportName extends TLObject { public static final int constructor = 0xd360e72c; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_help_supportName.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -61019,12 +51403,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_help_getPremiumPromo extends TLObject { public static final int constructor = 0xb81b93d4; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_help_premiumPromo.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -61034,11 +51417,11 @@ public static class TL_help_getUserInfo extends TLObject { public InputUser user_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return help_UserInfo.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); user_id.serializeToStream(stream); } @@ -61051,32 +51434,26 @@ public static class TL_help_editUserInfo extends TLObject { public String message; public ArrayList entities = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return help_UserInfo.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); user_id.serializeToStream(stream); stream.writeString(message); - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } } public static class TL_help_getPromoData extends TLObject { public static final int constructor = 0xc0977421; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return help_PromoData.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -61086,11 +51463,11 @@ public static class TL_help_hidePromoData extends TLObject { public InputPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); } @@ -61102,11 +51479,11 @@ public static class TL_help_dismissSuggestion extends TLObject { public InputPeer peer; public String suggestion; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeString(suggestion); @@ -61119,11 +51496,11 @@ public static class TL_help_getCountriesList extends TLObject { public String lang_code; public int hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return help_CountriesList.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(lang_code); stream.writeInt32(hash); @@ -61136,11 +51513,11 @@ public static class TL_messages_readHistory extends TLObject { public InputPeer peer; public int max_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_messages_affectedMessages.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(max_id); @@ -61158,11 +51535,11 @@ public static class TL_messages_deleteHistory extends TLObject { public int min_date; public int max_date; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_messages_affectedHistory.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = just_clear ? (flags | 1) : (flags &~ 1); flags = revoke ? (flags | 2) : (flags &~ 2); @@ -61187,11 +51564,11 @@ public static class TL_messages_deleteSavedHistory extends TLObject { public int min_date; public int max_date; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_messages_affectedHistory.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); peer.serializeToStream(stream); @@ -61211,11 +51588,11 @@ public static class TL_channels_togglePreHistoryHidden extends TLObject { public InputChannel channel; public boolean enabled; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); channel.serializeToStream(stream); stream.writeBool(enabled); @@ -61225,12 +51602,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_channels_getGroupsForDiscussion extends TLObject { public static final int constructor = 0xf5dad378; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return messages_Chats.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -61241,11 +51617,11 @@ public static class TL_channels_setDiscussionGroup extends TLObject { public InputChannel broadcast; public InputChannel group; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); broadcast.serializeToStream(stream); group.serializeToStream(stream); @@ -61259,11 +51635,11 @@ public static class TL_channels_editCreator extends TLObject { public InputUser user_id; public InputCheckPasswordSRP password; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); channel.serializeToStream(stream); user_id.serializeToStream(stream); @@ -61278,11 +51654,11 @@ public static class TL_channels_editLocation extends TLObject { public InputGeoPoint geo_point; public String address; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); channel.serializeToStream(stream); geo_point.serializeToStream(stream); @@ -61297,11 +51673,11 @@ public static class TL_messages_editChatAdmin extends TLObject { public InputUser user_id; public boolean is_admin; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(chat_id); user_id.serializeToStream(stream); @@ -61314,11 +51690,11 @@ public static class TL_messages_migrateChat extends TLObject { public long chat_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(chat_id); } @@ -61329,6 +51705,8 @@ public static class TL_messages_searchGlobal extends TLObject { public int flags; public boolean broadcasts_only; + public boolean groups_only; + public boolean users_only; public int folder_id; public String q; public MessagesFilter filter; @@ -61339,13 +51717,15 @@ public static class TL_messages_searchGlobal extends TLObject { public int offset_id; public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return messages_Messages.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = broadcasts_only ? (flags | 2) : (flags &~ 2); + flags = groups_only ? (flags | 4) : (flags &~ 4); + flags = users_only ? (flags | 8) : (flags &~ 8); stream.writeInt32(flags); if ((flags & 1) != 0) { stream.writeInt32(folder_id); @@ -61370,7 +51750,7 @@ public static class TL_messages_deleteMessages extends TLObject { public boolean revoke; public ArrayList id = new ArrayList<>(); - public static TL_messages_deleteMessages TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_deleteMessages TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_deleteMessages.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_deleteMessages", constructor)); @@ -61383,36 +51763,21 @@ public static TL_messages_deleteMessages TLdeserialize(AbstractSerializedData st return result; } - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_messages_affectedMessages.TLdeserialize(stream, constructor, exception); } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); revoke = (flags & 1) != 0; - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - id.add(stream.readInt32(exception)); - } + id = Vector.deserializeInt(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = revoke ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } + Vector.serializeInt(stream, id); } } @@ -61421,20 +51786,11 @@ public static class TL_messages_receivedMessages extends TLObject { public int max_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_receivedNotifyMessage object = TL_receivedNotifyMessage.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, TL_receivedNotifyMessage::TLdeserialize); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(max_id); } @@ -61448,11 +51804,11 @@ public static class TL_messages_setTyping extends TLObject { public int top_msg_id; public SendMessageAction action; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); peer.serializeToStream(stream); @@ -61485,11 +51841,11 @@ public static class TL_messages_sendMessage extends TLObject { public InputQuickReplyShortcut quick_reply_shortcut; public long effect; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = no_webpage ? (flags | 2) : (flags &~ 2); flags = silent ? (flags | 32) : (flags &~ 32); @@ -61509,12 +51865,7 @@ public void serializeToStream(AbstractSerializedData stream) { reply_markup.serializeToStream(stream); } if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } if ((flags & 1024) != 0) { stream.writeInt32(schedule_date); @@ -61553,11 +51904,11 @@ public static class TL_messages_sendMedia extends TLObject { public InputQuickReplyShortcut quick_reply_shortcut; public long effect; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = silent ? (flags | 32) : (flags &~ 32); flags = background ? (flags | 64) : (flags &~ 64); @@ -61577,12 +51928,7 @@ public void serializeToStream(AbstractSerializedData stream) { reply_markup.serializeToStream(stream); } if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } if ((flags & 1024) != 0) { stream.writeInt32(schedule_date); @@ -61600,7 +51946,7 @@ public void serializeToStream(AbstractSerializedData stream) { } public static class TL_messages_forwardMessages extends TLObject { - public static final int constructor = 0xd5039208; + public static final int constructor = 0x6d74da08; public int flags; public boolean silent; @@ -61617,12 +51963,13 @@ public static class TL_messages_forwardMessages extends TLObject { public int schedule_date; public InputPeer send_as; public InputQuickReplyShortcut quick_reply_shortcut; + public int video_timestamp; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = silent ? (flags | 32) : (flags &~ 32); flags = background ? (flags | 64) : (flags &~ 64); @@ -61632,18 +51979,8 @@ public void serializeToStream(AbstractSerializedData stream) { flags = noforwards ? (flags | 16384) : (flags &~ 16384); stream.writeInt32(flags); from_peer.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } - stream.writeInt32(0x1cb5c415); - count = random_id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(random_id.get(a)); - } + Vector.serializeInt(stream, id); + Vector.serializeLong(stream, random_id); to_peer.serializeToStream(stream); if ((flags & 512) != 0) { stream.writeInt32(top_msg_id); @@ -61657,6 +51994,9 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 131072) != 0) { quick_reply_shortcut.serializeToStream(stream); } + if ((flags & 1048576) != 0) { + stream.writeInt32(video_timestamp); + } } } @@ -61665,11 +52005,11 @@ public static class TL_messages_reportSpam extends TLObject { public InputPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); } @@ -61680,11 +52020,11 @@ public static class TL_messages_getPeerSettings extends TLObject { public InputPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_messages_peerSettings.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); } @@ -61696,7 +52036,7 @@ public static class TL_messageReportOption extends TLObject { public String text; public byte[] option; - public static TL_messageReportOption TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messageReportOption TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messageReportOption.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messageReportOption", constructor)); @@ -61710,13 +52050,13 @@ public static TL_messageReportOption TLdeserialize(AbstractSerializedData stream } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = stream.readString(exception); option = stream.readByteArray(exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(text); stream.writeByteArray(option); @@ -61724,7 +52064,7 @@ public void serializeToStream(AbstractSerializedData stream) { } public static class ReportResult extends TLObject { - public static ReportResult TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static ReportResult TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { ReportResult result = null; switch (constructor) { case TL_reportResultChooseOption.constructor: @@ -61754,34 +52094,16 @@ public static class TL_reportResultChooseOption extends ReportResult { public ArrayList options = new ArrayList<>(); @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { title = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_messageReportOption object = TL_messageReportOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - options.add(object); - } + options = Vector.deserialize(stream, TL_messageReportOption::TLdeserialize, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(title); - stream.writeInt32(0x1cb5c415); - stream.writeInt32(options.size()); - for (int i = 0; i < options.size(); ++i) { - options.get(i).serializeToStream(stream); - } + Vector.serialize(stream, options); } } @@ -61793,14 +52115,14 @@ public static class TL_reportResultAddComment extends ReportResult { public byte[] option; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); optional = (flags & 1) != 0; option = stream.readByteArray(exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = optional ? flags | 1 : flags &~ 1; stream.writeInt32(flags); @@ -61812,10 +52134,10 @@ public static class TL_reportResultReported extends ReportResult { public static final int constructor = 0x8db33c4b; @Override - public void readParams(AbstractSerializedData stream, boolean exception) {} + public void readParams(InputSerializedData stream, boolean exception) {} @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -61828,19 +52150,14 @@ public static class TL_messages_report extends TLObject { public byte[] option; public String message; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return ReportResult.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } + Vector.serializeInt(stream, id); stream.writeByteArray(option); stream.writeString(message); } @@ -61851,18 +52168,13 @@ public static class TL_messages_getChats extends TLObject { public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return messages_Chats.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(id.get(a)); - } + Vector.serializeLong(stream, id); } } @@ -61871,11 +52183,11 @@ public static class TL_messages_getFullChat extends TLObject { public long chat_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_messages_chatFull.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(chat_id); } @@ -61887,11 +52199,11 @@ public static class TL_messages_editChatTitle extends TLObject { public long chat_id; public String title; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(chat_id); stream.writeString(title); @@ -61904,11 +52216,11 @@ public static class TL_messages_editChatPhoto extends TLObject { public long chat_id; public InputChatPhoto photo; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(chat_id); photo.serializeToStream(stream); @@ -61922,11 +52234,11 @@ public static class TL_messages_addChatUser extends TLObject { public InputUser user_id; public int fwd_limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_messages_invitedUsers.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(chat_id); user_id.serializeToStream(stream); @@ -61942,11 +52254,11 @@ public static class TL_messages_deleteChatUser extends TLObject { public long chat_id; public InputUser user_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = revoke_history ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -61963,19 +52275,14 @@ public static class TL_messages_createChat extends TLObject { public String title; public int ttl_period; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_messages_invitedUsers.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, users); stream.writeString(title); if ((flags & 1) != 0) { stream.writeInt32(ttl_period); @@ -61993,11 +52300,11 @@ public static class TL_messages_getSearchResultsCalendar extends TLObject { public int offset_id; public int offset_date; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_messages_searchResultsCalendar.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); peer.serializeToStream(stream); @@ -62013,12 +52320,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_updates_getState extends TLObject { public static final int constructor = 0xedd4882a; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_updates_state.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -62032,11 +52338,11 @@ public static class TL_updates_getDifference extends TLObject { public int date; public int qts; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return updates_Difference.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32(pts); @@ -62058,11 +52364,11 @@ public static class TL_updates_getChannelDifference extends TLObject { public int pts; public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return updates_ChannelDifference.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = force ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -62081,11 +52387,11 @@ public static class TL_photos_updateProfilePhoto extends TLObject { public InputUser bot; public InputPhoto id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_photos_photo.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = fallback ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -62107,11 +52413,11 @@ public static class TL_photos_uploadProfilePhoto extends TLObject { public double video_start_ts; public VideoSize video_emoji_markup; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_photos_photo.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = fallback ? (flags | 8) : (flags &~ 8); stream.writeInt32(flags); @@ -62138,23 +52444,13 @@ public static class TL_photos_deletePhotos extends TLObject { public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - vector.objects.add(stream.readInt64(exception)); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserializeLong(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - id.get(a).serializeToStream(stream); - } + Vector.serialize(stream, id); } } @@ -62168,11 +52464,11 @@ public static class TL_upload_getFile extends TLObject { public long offset; public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return upload_File.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = precise ? (flags | 1) : (flags &~ 1); flags = cdn_supported ? (flags | 2) : (flags &~ 2); @@ -62186,12 +52482,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_help_getConfig extends TLObject { public static final int constructor = 0xc4f9186b; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_config.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -62199,12 +52494,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_help_getNearestDc extends TLObject { public static final int constructor = 0x1fb33026; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_nearestDc.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -62214,11 +52508,11 @@ public static class TL_help_getAppUpdate extends TLObject { public String source; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return help_AppUpdate.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(source); } @@ -62229,46 +52523,39 @@ public static class TL_help_getAppConfig extends TLObject { public int hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return help_AppConfig.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(hash); } } - public static class TL_help_saveAppLog extends TLObject { public static final int constructor = 0x6f02f748; public ArrayList events = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = events.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - events.get(a).serializeToStream(stream); - } + Vector.serialize(stream, events); } } public static class TL_help_getInviteText extends TLObject { public static final int constructor = 0x4d392343; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_help_inviteText.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -62281,11 +52568,11 @@ public static class TL_photos_getUserPhotos extends TLObject { public long max_id; public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return photos_Photos.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); user_id.serializeToStream(stream); stream.writeInt32(offset); @@ -62301,11 +52588,11 @@ public static class TL_messages_forwardMessage extends TLObject { public int id; public long random_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(id); @@ -62319,11 +52606,11 @@ public static class TL_messages_getDhConfig extends TLObject { public int version; public int random_length; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return messages_DhConfig.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(version); stream.writeInt32(random_length); @@ -62337,11 +52624,11 @@ public static class TL_messages_requestEncryption extends TLObject { public int random_id; public byte[] g_a; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return EncryptedChat.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); user_id.serializeToStream(stream); stream.writeInt32(random_id); @@ -62356,11 +52643,11 @@ public static class TL_messages_acceptEncryption extends TLObject { public byte[] g_b; public long key_fingerprint; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return EncryptedChat.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeByteArray(g_b); @@ -62375,11 +52662,11 @@ public static class TL_messages_discardEncryption extends TLObject { public boolean delete_history; public int chat_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = delete_history ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -62393,11 +52680,11 @@ public static class TL_messages_setEncryptedTyping extends TLObject { public TL_inputEncryptedChat peer; public boolean typing; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeBool(typing); @@ -62410,11 +52697,11 @@ public static class TL_messages_readEncryptedHistory extends TLObject { public TL_inputEncryptedChat peer; public int max_date; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(max_date); @@ -62426,16 +52713,11 @@ public static class TL_messages_receivedQueue extends TLObject { public int max_qts; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - vector.objects.add(stream.readInt64(exception)); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserializeLong(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(max_qts); } @@ -62446,11 +52728,11 @@ public static class TL_messages_reportEncryptedSpam extends TLObject { public TL_inputEncryptedChat peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); } @@ -62459,12 +52741,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_help_getSupport extends TLObject { public static final int constructor = 0x9cdf08cd; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_help_support.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -62474,48 +52755,13 @@ public static class TL_messages_readMessageContents extends TLObject { public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_messages_affectedMessages.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } - } - } - - public static class TL_account_checkUsername extends TLObject { - public static final int constructor = 0x2714d86c; - - public String username; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(username); - } - } - - public static class TL_account_updateUsername extends TLObject { - public static final int constructor = 0x3e0bdd7c; - - public String username; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return User.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(username); + Vector.serializeInt(stream, id); } } @@ -62525,97 +52771,17 @@ public static class TL_contacts_search extends TLObject { public String q; public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_contacts_found.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(q); stream.writeInt32(limit); } } - public static class TL_account_getPrivacy extends TLObject { - public static final int constructor = 0xdadbc950; - - public InputPrivacyKey key; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_account_privacyRules.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - key.serializeToStream(stream); - } - } - - public static class TL_account_setPrivacy extends TLObject { - public static final int constructor = 0xc9f81ce8; - - public InputPrivacyKey key; - public ArrayList rules = new ArrayList<>(); - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_account_privacyRules.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - key.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = rules.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - rules.get(a).serializeToStream(stream); - } - } - } - - public static class TL_account_deleteAccount extends TLObject { - public static final int constructor = 0x418d4e0b; - - public String reason; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(reason); - } - } - - public static class TL_account_getAccountTTL extends TLObject { - public static final int constructor = 0x8fc711d; - - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_accountDaysTTL.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_account_setAccountTTL extends TLObject { - public static final int constructor = 0x2442485e; - - public TL_accountDaysTTL ttl; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - ttl.serializeToStream(stream); - } - } - public static class TL_contacts_resolveUsername extends TLObject { public static final int constructor = 0x725afbbc; @@ -62623,11 +52789,11 @@ public static class TL_contacts_resolveUsername extends TLObject { public String username; public String referer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_contacts_resolvedPeer.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(username); @@ -62654,11 +52820,11 @@ public static class TL_contacts_getTopPeers extends TLObject { public int limit; public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return contacts_TopPeers.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = correspondents ? (flags | 1) : (flags &~ 1); flags = bots_pm ? (flags | 2) : (flags &~ 2); @@ -62682,9837 +52848,5194 @@ public static class TL_contacts_resetTopPeerRating extends TLObject { public TopPeerCategory category; public InputPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); category.serializeToStream(stream); peer.serializeToStream(stream); } } - public static class TL_account_sendChangePhoneCode extends TLObject { - public static final int constructor = 0x82574ae5; + public static class TL_auth_checkPassword extends TLObject { + public static final int constructor = 0xd18b4d16; - public String phone_number; - public TL_codeSettings settings; + public InputCheckPasswordSRP password; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_auth_sentCode.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return auth_Authorization.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(phone_number); - settings.serializeToStream(stream); + password.serializeToStream(stream); } } - public static class TL_account_changePhone extends TLObject { - public static final int constructor = 0x70c32edb; - - public String phone_number; - public String phone_code_hash; - public String phone_code; + public static class TL_auth_requestPasswordRecovery extends TLObject { + public static final int constructor = 0xd897bc66; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return User.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_auth_passwordRecovery.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(phone_number); - stream.writeString(phone_code_hash); - stream.writeString(phone_code); } } - public static class TL_account_getWebAuthorizations extends TLObject { - public static final int constructor = 0x182e6d6f; + public static class TL_auth_recoverPassword extends TLObject { + public static final int constructor = 0x37096c70; + public int flags; + public String code; + public TL_account.passwordInputSettings new_settings; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_account_webAuthorizations.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return auth_Authorization.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeString(code); + if ((flags & 1) != 0) { + new_settings.serializeToStream(stream); + } } } - public static class TL_account_resetWebAuthorization extends TLObject { - public static final int constructor = 0x2d01b9ef; + public static class TL_auth_resendCode extends TLObject { + public static final int constructor = 0xcae47523; - public long hash; + public int flags; + public String phone_number; + public String phone_code_hash; + public String reason; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_auth_sentCode.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(hash); + stream.writeInt32(flags); + stream.writeString(phone_number); + stream.writeString(phone_code_hash); + if ((flags & 1) != 0) { + stream.writeString(reason); + } } } - public static class TL_account_resetWebAuthorizations extends TLObject { - public static final int constructor = 0x682d2594; + public static class TL_auth_cancelCode extends TLObject { + public static final int constructor = 0x1f040578; + public String phone_number; + public String phone_code_hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + stream.writeString(phone_number); + stream.writeString(phone_code_hash); } } - public static class TL_account_getMultiWallPapers extends TLObject { - public static final int constructor = 0x65ad71dc; + public static class TL_messages_exportChatInvite extends TLObject { + public static final int constructor = 0xa455de90; - public ArrayList wallpapers = new ArrayList<>(); + public int flags; + public boolean legacy_revoke_permanent; + public boolean request_needed; + public InputPeer peer; + public int expire_date; + public int usage_limit; + public String title; + public TL_stars.TL_starsSubscriptionPricing subscription_pricing; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - WallPaper object = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return ExportedChatInvite.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = wallpapers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - wallpapers.get(a).serializeToStream(stream); + flags = legacy_revoke_permanent ? (flags | 4) : (flags &~ 4); + flags = request_needed ? (flags | 8) : (flags &~ 8); + stream.writeInt32(flags); + peer.serializeToStream(stream); + if ((flags & 1) != 0) { + stream.writeInt32(expire_date); + } + if ((flags & 2) != 0) { + stream.writeInt32(usage_limit); + } + if ((flags & 16) != 0) { + stream.writeString(title); + } + if ((flags & 32) != 0) { + subscription_pricing.serializeToStream(stream); } } } - public static class TL_account_getGlobalPrivacySettings extends TLObject { - public static final int constructor = 0xeb2b4cf6; + public static class TL_messages_checkChatInvite extends TLObject { + public static final int constructor = 0x3eadb1bb; + public String hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_globalPrivacySettings.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return ChatInvite.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + stream.writeString(hash); } } - public static class TL_account_setGlobalPrivacySettings extends TLObject { - public static final int constructor = 0x1edaaac2; + public static class TL_messages_importChatInvite extends TLObject { + public static final int constructor = 0x6c50051c; - public TL_globalPrivacySettings settings; + public String hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_globalPrivacySettings.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - settings.serializeToStream(stream); + stream.writeString(hash); } } - public static class TL_account_reportProfilePhoto extends TLObject { - public static final int constructor = 0xfa8cc6f5; + public static class TL_messages_getStickerSet extends TLObject { + public static final int constructor = 0xc8a0ec74; - public InputPeer peer; - public InputPhoto photo_id; - public ReportReason reason; - public String message; + public InputStickerSet stickerset; + public int hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_stickerSet.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - photo_id.serializeToStream(stream); - reason.serializeToStream(stream); - stream.writeString(message); + stickerset.serializeToStream(stream); + stream.writeInt32(hash); } } - public static class TL_account_getAllSecureValues extends TLObject { - public static final int constructor = 0xb288bc7d; + public static class TL_messages_installStickerSet extends TLObject { + public static final int constructor = 0xc78fe460; + public InputStickerSet stickerset; + public boolean archived; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_secureValue object = TL_secureValue.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_StickerSetInstallResult.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + stickerset.serializeToStream(stream); + stream.writeBool(archived); } } - public static class TL_account_getSecureValue extends TLObject { - public static final int constructor = 0x73665bc2; + public static class TL_messages_uninstallStickerSet extends TLObject { + public static final int constructor = 0xf96e55de; - public ArrayList types = new ArrayList<>(); + public InputStickerSet stickerset; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_secureValue object = TL_secureValue.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = types.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - types.get(a).serializeToStream(stream); - } + stickerset.serializeToStream(stream); } } - public static class TL_account_saveSecureValue extends TLObject { - public static final int constructor = 0x899fe31d; + public static class TL_messages_startBot extends TLObject { + public static final int constructor = 0xe6df7378; - public TL_inputSecureValue value; - public long secure_secret_id; + public InputUser bot; + public InputPeer peer; + public long random_id; + public String start_param; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_secureValue.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - value.serializeToStream(stream); - stream.writeInt64(secure_secret_id); + bot.serializeToStream(stream); + peer.serializeToStream(stream); + stream.writeInt64(random_id); + stream.writeString(start_param); } } - public static class TL_account_deleteSecureValue extends TLObject { - public static final int constructor = 0xb880bc4b; + public static class TL_messages_getMessagesViews extends TLObject { + public static final int constructor = 0x5784d3e1; - public ArrayList types = new ArrayList<>(); + public InputPeer peer; + public ArrayList id = new ArrayList<>(); + public boolean increment; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_messageViews.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = types.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - types.get(a).serializeToStream(stream); - } + peer.serializeToStream(stream); + Vector.serializeInt(stream, id); + stream.writeBool(increment); } } - public static class TL_account_getAuthorizationForm extends TLObject { - public static final int constructor = 0xa929597a; + public static class TL_messages_getSavedGifs extends TLObject { + public static final int constructor = 0x5cf09635; - public long bot_id; - public String scope; - public String public_key; + public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_account_authorizationForm.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_SavedGifs.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(bot_id); - stream.writeString(scope); - stream.writeString(public_key); + stream.writeInt64(hash); } } - public static class TL_account_acceptAuthorization extends TLObject { - public static final int constructor = 0xf3ed4c73; + public static class TL_messages_saveGif extends TLObject { + public static final int constructor = 0x327a30cb; - public long bot_id; - public String scope; - public String public_key; - public ArrayList value_hashes = new ArrayList<>(); - public TL_secureCredentialsEncrypted credentials; + public InputDocument id; + public boolean unsave; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(bot_id); - stream.writeString(scope); - stream.writeString(public_key); - stream.writeInt32(0x1cb5c415); - int count = value_hashes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - value_hashes.get(a).serializeToStream(stream); - } - credentials.serializeToStream(stream); + id.serializeToStream(stream); + stream.writeBool(unsave); } } - public static class TL_account_sendVerifyPhoneCode extends TLObject { - public static final int constructor = 0xa5a356f9; + public static class TL_messages_getInlineBotResults extends TLObject { + public static final int constructor = 0x514e999d; - public String phone_number; - public TL_codeSettings settings; + public int flags; + public InputUser bot; + public InputPeer peer; + public InputGeoPoint geo_point; + public String query; + public String offset; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_auth_sentCode.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_BotResults.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(phone_number); - settings.serializeToStream(stream); + stream.writeInt32(flags); + bot.serializeToStream(stream); + peer.serializeToStream(stream); + if ((flags & 1) != 0) { + geo_point.serializeToStream(stream); + } + stream.writeString(query); + stream.writeString(offset); } } - public static class TL_account_verifyPhone extends TLObject { - public static final int constructor = 0x4dd3a7f6; + public static class TL_messages_sendInlineBotResult extends TLObject { + public static final int constructor = 0x3ebee86a; - public String phone_number; - public String phone_code_hash; - public String phone_code; + public int flags; + public boolean silent; + public boolean background; + public boolean clear_draft; + public boolean hide_via; + public InputPeer peer; + public InputReplyTo reply_to; + public long random_id; + public long query_id; + public String id; + public int schedule_date; + public InputPeer send_as; + public InputQuickReplyShortcut quick_reply_shortcut; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(phone_number); - stream.writeString(phone_code_hash); - stream.writeString(phone_code); + flags = silent ? (flags | 32) : (flags &~ 32); + flags = background ? (flags | 64) : (flags &~ 64); + flags = clear_draft ? (flags | 128) : (flags &~ 128); + flags = hide_via ? (flags | 2048) : (flags &~ 2048); + stream.writeInt32(flags); + peer.serializeToStream(stream); + if ((flags & 1) != 0) { + reply_to.serializeToStream(stream); + } + stream.writeInt64(random_id); + stream.writeInt64(query_id); + stream.writeString(id); + if ((flags & 1024) != 0) { + stream.writeInt32(schedule_date); + } + if ((flags & 8192) != 0) { + send_as.serializeToStream(stream); + } + if ((flags & 131072) != 0) { + quick_reply_shortcut.serializeToStream(stream); + } } } - public static class TL_account_sendVerifyEmailCode extends TLObject { - public static final int constructor = 0x98e037bb; + public static class TL_messages_getMessageEditData extends TLObject { + public static final int constructor = 0xfda68d36; - public EmailVerifyPurpose purpose; - public String email; + public InputPeer peer; + public int id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_account_sentEmailCode.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_messageEditData.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - purpose.serializeToStream(stream); - stream.writeString(email); + peer.serializeToStream(stream); + stream.writeInt32(id); } } - public static class TL_account_verifyEmail extends TLObject { - public static final int constructor = 0x32da4cf; + public static class TL_messages_editMessage extends TLObject { + public static final int constructor = 0xdfd14005; - public EmailVerifyPurpose purpose; - public EmailVerification verification; + public int flags; + public boolean no_webpage; + public boolean invert_media; + public InputPeer peer; + public int id; + public String message; + public InputMedia media; + public ReplyMarkup reply_markup; + public ArrayList entities = new ArrayList<>(); + public int schedule_date; + public int quick_reply_shortcut_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return account_EmailVerified.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - purpose.serializeToStream(stream); - verification.serializeToStream(stream); + flags = no_webpage ? (flags | 2) : (flags &~ 2); + flags = invert_media ? (flags | 65536) : (flags &~ 65536); + stream.writeInt32(flags); + peer.serializeToStream(stream); + stream.writeInt32(id); + if ((flags & 2048) != 0) { + stream.writeString(message); + } + if ((flags & 16384) != 0) { + media.serializeToStream(stream); + } + if ((flags & 4) != 0) { + reply_markup.serializeToStream(stream); + } + if ((flags & 8) != 0) { + Vector.serialize(stream, entities); + } + if ((flags & 32768) != 0) { + stream.writeInt32(schedule_date); + } + if ((flags & 131072) != 0) { + stream.writeInt32(quick_reply_shortcut_id); + } } } - public static class TL_account_confirmPasswordEmail extends TLObject { - public static final int constructor = 0x8fdf1920; + public static class TL_messages_getBotCallbackAnswer extends TLObject { + public static final int constructor = 0x9342ca07; - public String code; + public int flags; + public boolean game; + public InputPeer peer; + public int msg_id; + public byte[] data; + public InputCheckPasswordSRP password; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_botCallbackAnswer.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(code); + flags = game ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + peer.serializeToStream(stream); + stream.writeInt32(msg_id); + if ((flags & 1) != 0) { + stream.writeByteArray(data); + } + if ((flags & 4) != 0) { + password.serializeToStream(stream); + } } } - public static class TL_account_resendPasswordEmail extends TLObject { - public static final int constructor = 0x7a7f2a15; + public static class TL_messages_setBotCallbackAnswer extends TLObject { + public static final int constructor = 0xd58f130a; + public int flags; + public boolean alert; + public long query_id; + public String message; + public String url; + public int cache_time; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = alert ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + stream.writeInt64(query_id); + if ((flags & 1) != 0) { + stream.writeString(message); + } + if ((flags & 4) != 0) { + stream.writeString(url); + } + stream.writeInt32(cache_time); } } - public static class TL_account_cancelPasswordEmail extends TLObject { - public static final int constructor = 0xc1cbd5b6; + public static class TL_messages_getPeerDialogs extends TLObject { + public static final int constructor = 0xe470bcfd; + public ArrayList peers = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_peerDialogs.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + Vector.serialize(stream, peers); } } - public static class TL_account_getContactSignUpNotification extends TLObject { - public static final int constructor = 0x9f07c728; + public static class TL_messages_saveDraft extends TLObject { + public static final int constructor = 0xd372c5ce; + public int flags; + public boolean no_webpage; + public boolean invert_media; + public InputReplyTo reply_to; + public InputPeer peer; + public String message; + public ArrayList entities = new ArrayList<>(); + public InputMedia media; + public long effect; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - } + flags = no_webpage ? (flags | 2) : (flags &~ 2); + flags = invert_media ? (flags | 64) : (flags &~ 64); + stream.writeInt32(flags); + if ((flags & 16) != 0) { + reply_to.serializeToStream(stream); + } + peer.serializeToStream(stream); + stream.writeString(message); + if ((flags & 8) != 0) { + Vector.serialize(stream, entities); + } + if ((flags & 32) != 0) { + media.serializeToStream(stream); + } + if ((flags & 128) != 0) { + stream.writeInt64(effect); + } + } } - public static class TL_account_setContactSignUpNotification extends TLObject { - public static final int constructor = 0xcff43f61; - - public boolean silent; + public static class TL_messages_getAllDrafts extends TLObject { + public static final int constructor = 0x6a3f8d65; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeBool(silent); } } - public static class TL_account_getNotifyExceptions extends TLObject { - public static final int constructor = 0x53577479; + public static class TL_messages_getFeaturedStickers extends TLObject { + public static final int constructor = 0x64780b14; - public int flags; - public boolean compare_sound; - public InputNotifyPeer peer; + public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_FeaturedStickers.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = compare_sound ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - peer.serializeToStream(stream); - } + stream.writeInt64(hash); } } - public static class TL_account_getWallPaper extends TLObject { - public static final int constructor = 0xfc8ddbea; + public static class TL_messages_readFeaturedStickers extends TLObject { + public static final int constructor = 0x5b118126; - public InputWallPaper wallpaper; + public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return WallPaper.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - wallpaper.serializeToStream(stream); + Vector.serializeLong(stream, id); } } - public static class TL_account_uploadWallPaper extends TLObject { - public static final int constructor = 0xdd853661; + public static class TL_messages_getRecentStickers extends TLObject { + public static final int constructor = 0x9da9403b; - public InputFile file; - public String mime_type; - public TL_wallPaperSettings settings; + public int flags; + public boolean attached; + public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return WallPaper.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_RecentStickers.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - file.serializeToStream(stream); - stream.writeString(mime_type); - settings.serializeToStream(stream); + flags = attached ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeInt64(hash); } } - public static class TL_account_saveWallPaper extends TLObject { - public static final int constructor = 0x6c5a5b37; + public static class TL_messages_saveRecentSticker extends TLObject { + public static final int constructor = 0x392718f8; - public InputWallPaper wallpaper; + public int flags; + public boolean attached; + public InputDocument id; public boolean unsave; - public TL_wallPaperSettings settings; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - wallpaper.serializeToStream(stream); + flags = attached ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + id.serializeToStream(stream); stream.writeBool(unsave); - settings.serializeToStream(stream); } } - public static class TL_account_installWallPaper extends TLObject { - public static final int constructor = 0xfeed5769; + public static class TL_messages_clearRecentStickers extends TLObject { + public static final int constructor = 0x8999602d; - public InputWallPaper wallpaper; - public TL_wallPaperSettings settings; + public int flags; + public boolean attached; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - wallpaper.serializeToStream(stream); - settings.serializeToStream(stream); + flags = attached ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); } } - public static class TL_account_resetWallPapers extends TLObject { - public static final int constructor = 0xbb3b9804; + public static class TL_messages_getArchivedStickers extends TLObject { + public static final int constructor = 0x57f17692; + public int flags; + public boolean masks; + public boolean emojis; + public long offset_id; + public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_archivedStickers.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = masks ? (flags | 1) : (flags &~ 1); + flags = emojis ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + stream.writeInt64(offset_id); + stream.writeInt32(limit); } } - public static class TL_account_getAutoDownloadSettings extends TLObject { - public static final int constructor = 0x56da0b3f; + public static class TL_messages_setGameScore extends TLObject { + public static final int constructor = 0x8ef8ecc0; + public int flags; + public boolean edit_message; + public boolean force; + public InputPeer peer; + public int id; + public InputUser user_id; + public int score; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_account_autoDownloadSettings.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = edit_message ? (flags | 1) : (flags &~ 1); + flags = force ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + peer.serializeToStream(stream); + stream.writeInt32(id); + user_id.serializeToStream(stream); + stream.writeInt32(score); } } - public static class TL_account_saveAutoDownloadSettings extends TLObject { - public static final int constructor = 0x76f36233; + public static class TL_messages_setInlineGameScore extends TLObject { + public static final int constructor = 0x15ad9f64; public int flags; - public boolean low; - public boolean high; - public TL_autoDownloadSettings settings; + public boolean edit_message; + public boolean force; + public TL_inputBotInlineMessageID id; + public InputUser user_id; + public int score; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = low ? (flags | 1) : (flags &~ 1); - flags = high ? (flags | 2) : (flags &~ 2); + flags = edit_message ? (flags | 1) : (flags &~ 1); + flags = force ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); - settings.serializeToStream(stream); + id.serializeToStream(stream); + user_id.serializeToStream(stream); + stream.writeInt32(score); } } - public static class TL_account_uploadTheme extends TLObject { - public static final int constructor = 0x1c3db333; + public static class TL_messages_getMaskStickers extends TLObject { + public static final int constructor = 0x640f82b8; - public int flags; - public InputFile file; - public InputFile thumb; - public String file_name; - public String mime_type; + public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Document.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_AllStickers.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - file.serializeToStream(stream); - if ((flags & 1) != 0) { - thumb.serializeToStream(stream); - } - stream.writeString(file_name); - stream.writeString(mime_type); + stream.writeInt64(hash); } } - public static class TL_account_createTheme extends TLObject { - public static final int constructor = 0x8432c21f; + public static class TL_messages_getGameHighScores extends TLObject { + public static final int constructor = 0xe822649d; - public int flags; - public String slug; - public String title; - public InputDocument document; - public TL_inputThemeSettings settings; + public InputPeer peer; + public int id; + public InputUser user_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Theme.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_highScores.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeString(slug); - stream.writeString(title); - if ((flags & 4) != 0) { - document.serializeToStream(stream); - } - if ((flags & 8) != 0) { - settings.serializeToStream(stream); - } + peer.serializeToStream(stream); + stream.writeInt32(id); + user_id.serializeToStream(stream); } } - public static class TL_account_updateTheme extends TLObject { - public static final int constructor = 0x5cb367d5; + public static class TL_messages_getInlineGameHighScores extends TLObject { + public static final int constructor = 0xf635e1b; - public int flags; - public String format; - public InputTheme theme; - public String slug; - public String title; - public InputDocument document; - public TL_inputThemeSettings settings; + public TL_inputBotInlineMessageID id; + public InputUser user_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Theme.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_highScores.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeString(format); - theme.serializeToStream(stream); - if ((flags & 1) != 0) { - stream.writeString(slug); - } - if ((flags & 2) != 0) { - stream.writeString(title); - } - if ((flags & 4) != 0) { - document.serializeToStream(stream); - } - if ((flags & 8) != 0) { - settings.serializeToStream(stream); - } + id.serializeToStream(stream); + user_id.serializeToStream(stream); } } - public static class TL_account_saveTheme extends TLObject { - public static final int constructor = 0xf257106c; + public static class TL_messages_getAttachedStickers extends TLObject { + public static final int constructor = 0xcc5b67cc; - public InputTheme theme; - public boolean unsave; + public InputStickeredMedia media; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, StickerSetCovered::TLdeserialize); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - theme.serializeToStream(stream); - stream.writeBool(unsave); + media.serializeToStream(stream); } } - public static class TL_account_installTheme extends TLObject { - public static final int constructor = 0x7ae43737; + public static class TL_messages_getCommonChats extends TLObject { + public static final int constructor = 0xe40ca104; - public int flags; - public boolean dark; - public String format; - public InputTheme theme; + public InputUser user_id; + public long max_id; + public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_Chats.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = dark ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - if ((flags & 2) != 0) { - stream.writeString(format); - } - if ((flags & 2) != 0) { - theme.serializeToStream(stream); - } + user_id.serializeToStream(stream); + stream.writeInt64(max_id); + stream.writeInt32(limit); } } - public static class TL_account_getTheme extends TLObject { - public static final int constructor = 0x8d9d742b; + public static class TL_messages_getAllChats extends TLObject { + public static final int constructor = 0x875f74be; - public String format; - public InputTheme theme; - public long document_id; + public ArrayList except_ids = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Theme.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_Chats.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(format); - theme.serializeToStream(stream); - stream.writeInt64(document_id); + Vector.serializeLong(stream, except_ids); } } - public static class TL_account_getThemes extends TLObject { - public static final int constructor = 0x7206e458; + public static class TL_messages_getWebPage extends TLObject { + public static final int constructor = 0x8d9692a3; - public String format; - public long hash; + public String url; + public int hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return account_Themes.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_webPage.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(format); - stream.writeInt64(hash); + stream.writeString(url); + stream.writeInt32(hash); } } - public static class TL_account_updateEmojiStatus extends TLObject { - public static final int constructor = 0xfbd3de6b; + public static class TL_messages_toggleDialogPin extends TLObject { + public static final int constructor = 0xa731e257; - public EmojiStatus emoji_status; + public int flags; + public boolean pinned; + public InputDialogPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - emoji_status.serializeToStream(stream); + flags = pinned ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + peer.serializeToStream(stream); } } - public static class TL_account_getDefaultBackgroundEmojis extends TLObject { - public static final int constructor = 0xa60ab9ce; + public static class TL_messages_reorderPinnedDialogs extends TLObject { + public static final int constructor = 0x3b1adf37; - public long hash; + public int flags; + public boolean force; + public int folder_id; + public ArrayList order = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return EmojiList.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(hash); + flags = force ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeInt32(folder_id); + Vector.serialize(stream, order); } } - public static class TL_account_getChannelDefaultEmojiStatuses extends TLObject { - public static final int constructor = 0x7727a7d5; + public static class TL_messages_getPinnedDialogs extends TLObject { + public static final int constructor = 0xd6b94df2; - public long hash; + public int folder_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return account_EmojiStatuses.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_peerDialogs.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(hash); + stream.writeInt32(folder_id); } } - public static class TL_account_getDefaultEmojiStatuses extends TLObject { - public static final int constructor = 0xd6753386; + public static class TL_messages_uploadMedia extends TLObject { + public static final int constructor = 0x519bc2b1; - public long hash; + public InputPeer peer; + public InputMedia media; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return account_EmojiStatuses.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return MessageMedia.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(hash); + peer.serializeToStream(stream); + media.serializeToStream(stream); } } - public static class TL_account_getRecentEmojiStatuses extends TLObject { - public static final int constructor = 0xf578105; + public static class TL_messages_sendScreenshotNotification extends TLObject { + public static final int constructor = 0xa1405817; - public long hash; + public InputPeer peer; + public InputReplyTo reply_to; + public long random_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return account_EmojiStatuses.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(hash); + peer.serializeToStream(stream); + reply_to.serializeToStream(stream); + stream.writeInt64(random_id); } } - public static class TL_account_clearRecentEmojiStatuses extends TLObject { - public static final int constructor = 0x18201aae; + public static class TL_messages_getFavedStickers extends TLObject { + public static final int constructor = 0x4f1aaa9; + public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_FavedStickers.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + stream.writeInt64(hash); } } - public static class TL_account_updateDeviceLocked extends TLObject { - public static final int constructor = 0x38df3532; + public static class TL_messages_faveSticker extends TLObject { + public static final int constructor = 0xb9ffc55b; - public int period; + public InputDocument id; + public boolean unfave; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(period); + id.serializeToStream(stream); + stream.writeBool(unfave); } } - public static class TL_messages_getWebPagePreview extends TLObject { - public static final int constructor = 0x8b68b0cc; + public static class TL_messages_getUnreadMentions extends TLObject { + public static final int constructor = 0xf107e790; public int flags; - public String message; - public ArrayList entities = new ArrayList<>(); + public InputPeer peer; + public int top_msg_id; + public int offset_id; + public int add_offset; + public int limit; + public int max_id; + public int min_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return MessageMedia.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_Messages.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); - stream.writeString(message); - if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + peer.serializeToStream(stream); + if ((flags & 1) != 0) { + stream.writeInt32(top_msg_id); } + stream.writeInt32(offset_id); + stream.writeInt32(add_offset); + stream.writeInt32(limit); + stream.writeInt32(max_id); + stream.writeInt32(min_id); } } - public static class TL_account_getAuthorizations extends TLObject { - public static final int constructor = 0xe320c158; + public static class TL_messages_readMentions extends TLObject { + public static final int constructor = 0x36e5bf4d; + public int flags; + public InputPeer peer; + public int top_msg_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_account_authorizations.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_affectedHistory.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + stream.writeInt32(flags); + peer.serializeToStream(stream); + if ((flags & 1) != 0) { + stream.writeInt32(top_msg_id); + } } } - public static class TL_account_resetAuthorization extends TLObject { - public static final int constructor = 0xdf77f3bc; + public static class TL_messages_getRecentLocations extends TLObject { + public static final int constructor = 0x702a40e0; + public InputPeer peer; + public int limit; public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_Messages.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeInt32(limit); stream.writeInt64(hash); } } - public static class TL_account_getPassword extends TLObject { - public static final int constructor = 0x548a30f5; + public static class TL_messages_sendMultiMedia extends TLObject { + public static final int constructor = 0x37b74355; + public int flags; + public boolean silent; + public boolean background; + public boolean clear_draft; + public boolean noforwards; + public boolean update_stickersets_order; + public boolean invert_media; + public InputPeer peer; + public InputReplyTo reply_to; + public ArrayList multi_media = new ArrayList<>(); + public int schedule_date; + public InputPeer send_as; + public InputQuickReplyShortcut quick_reply_shortcut; + public long effect; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_account_password.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = silent ? (flags | 32) : (flags &~ 32); + flags = background ? (flags | 64) : (flags &~ 64); + flags = clear_draft ? (flags | 128) : (flags &~ 128); + flags = noforwards ? (flags | 16384) : (flags &~ 16384); + flags = update_stickersets_order ? (flags | 32768) : (flags &~ 32768); + flags = invert_media ? (flags | 65536) : (flags &~ 65536); + stream.writeInt32(flags); + peer.serializeToStream(stream); + if ((flags & 1) != 0) { + reply_to.serializeToStream(stream); + } + Vector.serialize(stream, multi_media); + if ((flags & 1024) != 0) { + stream.writeInt32(schedule_date); + } + if ((flags & 8192) != 0) { + send_as.serializeToStream(stream); + } + if ((flags & 131072) != 0) { + quick_reply_shortcut.serializeToStream(stream); + } + if ((flags & 262144) != 0) { + stream.writeInt64(effect); + } } } - public static class TL_account_getPasswordSettings extends TLObject { - public static final int constructor = 0x9cd4eaf9; - - public InputCheckPasswordSRP password; + public static class TL_messages_clearAllDrafts extends TLObject { + public static final int constructor = 0x7e58ee9c; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_account_passwordSettings.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - password.serializeToStream(stream); } } - public static class TL_account_updatePasswordSettings extends TLObject { - public static final int constructor = 0xa59b102f; + public static class TL_messages_updatePinnedMessage extends TLObject { + public static final int constructor = 0xd2aaf7ec; - public InputCheckPasswordSRP password; - public TL_account_passwordInputSettings new_settings; + public int flags; + public boolean silent; + public boolean unpin; + public boolean pm_oneside; + public InputPeer peer; + public int id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - password.serializeToStream(stream); - new_settings.serializeToStream(stream); + flags = silent ? (flags | 1) : (flags &~ 1); + flags = unpin ? (flags | 2) : (flags &~ 2); + flags = pm_oneside ? (flags | 4) : (flags &~ 4); + stream.writeInt32(flags); + peer.serializeToStream(stream); + stream.writeInt32(id); } } - public static class TL_account_sendConfirmPhoneCode extends TLObject { - public static final int constructor = 0x1b3faa88; + public static class TL_messages_sendVote extends TLObject { + public static final int constructor = 0x10ea6184; - public String hash; - public TL_codeSettings settings; + public InputPeer peer; + public int msg_id; + public ArrayList options = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_auth_sentCode.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(hash); - settings.serializeToStream(stream); + peer.serializeToStream(stream); + stream.writeInt32(msg_id); + stream.writeInt32(0x1cb5c415); + int count = options.size(); + stream.writeInt32(count); + for (int a = 0; a < count; a++) { + stream.writeByteArray(options.get(a)); + } } } - public static class TL_account_confirmPhone extends TLObject { - public static final int constructor = 0x5f2178c3; + public static class TL_messages_getPollResults extends TLObject { + public static final int constructor = 0x73bb643b; - public String phone_code_hash; - public String phone_code; + public InputPeer peer; + public int msg_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(phone_code_hash); - stream.writeString(phone_code); + peer.serializeToStream(stream); + stream.writeInt32(msg_id); } } - public static class TL_account_getTmpPassword extends TLObject { - public static final int constructor = 0x449e0b51; + public static class TL_messages_getOnlines extends TLObject { + public static final int constructor = 0x6e2be050; - public InputCheckPasswordSRP password; - public int period; + public InputPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_account_tmpPassword.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_chatOnlines.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - password.serializeToStream(stream); - stream.writeInt32(period); + peer.serializeToStream(stream); } } - public static class TL_auth_checkPassword extends TLObject { - public static final int constructor = 0xd18b4d16; + public static class TL_messages_getStatsURL extends TLObject { + public static final int constructor = 0x812c2ae6; - public InputCheckPasswordSRP password; + public int flags; + public boolean dark; + public InputPeer peer; + public String params; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return auth_Authorization.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_statsURL.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - password.serializeToStream(stream); + flags = dark ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + peer.serializeToStream(stream); + stream.writeString(params); } } - public static class TL_auth_requestPasswordRecovery extends TLObject { - public static final int constructor = 0xd897bc66; + public static class TL_messages_editChatAbout extends TLObject { + public static final int constructor = 0xdef60797; + public InputPeer peer; + public String about; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_auth_passwordRecovery.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeString(about); } } - public static class TL_auth_recoverPassword extends TLObject { - public static final int constructor = 0x37096c70; + public static class TL_messages_editChatDefaultBannedRights extends TLObject { + public static final int constructor = 0xa5866b41; - public int flags; - public String code; - public TL_account_passwordInputSettings new_settings; + public InputPeer peer; + public TL_chatBannedRights banned_rights; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return auth_Authorization.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeString(code); - if ((flags & 1) != 0) { - new_settings.serializeToStream(stream); - } + peer.serializeToStream(stream); + banned_rights.serializeToStream(stream); } } - public static class TL_auth_resendCode extends TLObject { - public static final int constructor = 0xcae47523; + public static class TL_messages_getEmojiKeywords extends TLObject { + public static final int constructor = 0x35a0e062; - public int flags; - public String phone_number; - public String phone_code_hash; - public String reason; + public String lang_code; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_auth_sentCode.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_emojiKeywordsDifference.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeString(phone_number); - stream.writeString(phone_code_hash); - if ((flags & 1) != 0) { - stream.writeString(reason); - } + stream.writeString(lang_code); } } - public static class TL_auth_cancelCode extends TLObject { - public static final int constructor = 0x1f040578; + public static class TL_messages_getEmojiKeywordsDifference extends TLObject { + public static final int constructor = 0x1508b6af; - public String phone_number; - public String phone_code_hash; + public String lang_code; + public int from_version; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_emojiKeywordsDifference.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(phone_number); - stream.writeString(phone_code_hash); - } + stream.writeString(lang_code); + stream.writeInt32(from_version); + } } - public static class TL_messages_exportChatInvite extends TLObject { - public static final int constructor = 0xa455de90; + public static class TL_messages_getEmojiKeywordsLanguages extends TLObject { + public static final int constructor = 0x4e9963b2; - public int flags; - public boolean legacy_revoke_permanent; - public boolean request_needed; - public InputPeer peer; - public int expire_date; - public int usage_limit; - public String title; - public TL_stars.TL_starsSubscriptionPricing subscription_pricing; + public ArrayList lang_codes = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return ExportedChatInvite.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, TL_emojiLanguage::TLdeserialize); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = legacy_revoke_permanent ? (flags | 4) : (flags &~ 4); - flags = request_needed ? (flags | 8) : (flags &~ 8); - stream.writeInt32(flags); - peer.serializeToStream(stream); - if ((flags & 1) != 0) { - stream.writeInt32(expire_date); - } - if ((flags & 2) != 0) { - stream.writeInt32(usage_limit); - } - if ((flags & 16) != 0) { - stream.writeString(title); - } - if ((flags & 32) != 0) { - subscription_pricing.serializeToStream(stream); - } + Vector.serializeString(stream, lang_codes); } } - public static class TL_messages_checkChatInvite extends TLObject { - public static final int constructor = 0x3eadb1bb; + public static class TL_messages_getEmojiURL extends TLObject { + public static final int constructor = 0xd5b10c26; - public String hash; + public String lang_code; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return ChatInvite.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_emojiURL.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(hash); + stream.writeString(lang_code); } } - public static class TL_messages_importChatInvite extends TLObject { - public static final int constructor = 0x6c50051c; + public static class TL_messages_getSearchCounters extends TLObject { + public static final int constructor = 0x1bbcf300; - public String hash; + public int flags; + public InputPeer peer; + public InputPeer saved_peer_id; + public int top_msg_id; + public ArrayList filters = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, TL_messages_searchCounter::TLdeserialize); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(hash); + stream.writeInt32(flags); + peer.serializeToStream(stream); + if ((flags & 4) != 0) { + saved_peer_id.serializeToStream(stream); + } + if ((flags & 1) != 0) { + stream.writeInt32(top_msg_id); + } + Vector.serialize(stream, filters); } } - public static class TL_messages_getStickerSet extends TLObject { - public static final int constructor = 0xc8a0ec74; + public static class TL_messages_requestUrlAuth extends TLObject { + public static final int constructor = 0x198fb446; - public InputStickerSet stickerset; - public int hash; + public int flags; + public InputPeer peer; + public int msg_id; + public int button_id; + public String url; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_stickerSet.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return UrlAuthResult.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stickerset.serializeToStream(stream); - stream.writeInt32(hash); + stream.writeInt32(flags); + if ((flags & 2) != 0) { + peer.serializeToStream(stream); + } + if ((flags & 2) != 0) { + stream.writeInt32(msg_id); + } + if ((flags & 2) != 0) { + stream.writeInt32(button_id); + } + if ((flags & 4) != 0) { + stream.writeString(url); + } } } - public static class TL_messages_installStickerSet extends TLObject { - public static final int constructor = 0xc78fe460; + public static class TL_messages_acceptUrlAuth extends TLObject { + public static final int constructor = 0xb12c7125; - public InputStickerSet stickerset; - public boolean archived; + public int flags; + public boolean write_allowed; + public InputPeer peer; + public int msg_id; + public int button_id; + public String url; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_StickerSetInstallResult.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return UrlAuthResult.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stickerset.serializeToStream(stream); - stream.writeBool(archived); + flags = write_allowed ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + if ((flags & 2) != 0) { + peer.serializeToStream(stream); + } + if ((flags & 2) != 0) { + stream.writeInt32(msg_id); + } + if ((flags & 2) != 0) { + stream.writeInt32(button_id); + } + if ((flags & 4) != 0) { + stream.writeString(url); + } } } - public static class TL_messages_uninstallStickerSet extends TLObject { - public static final int constructor = 0xf96e55de; + public static class TL_messages_hidePeerSettingsBar extends TLObject { + public static final int constructor = 0x4facb138; - public InputStickerSet stickerset; + public InputPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stickerset.serializeToStream(stream); + peer.serializeToStream(stream); } } - public static class TL_messages_startBot extends TLObject { - public static final int constructor = 0xe6df7378; + public static class TL_messages_getScheduledHistory extends TLObject { + public static final int constructor = 0xf516760b; - public InputUser bot; public InputPeer peer; - public long random_id; - public String start_param; + public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_Messages.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - bot.serializeToStream(stream); peer.serializeToStream(stream); - stream.writeInt64(random_id); - stream.writeString(start_param); + stream.writeInt64(hash); } } - public static class TL_messages_getMessagesViews extends TLObject { - public static final int constructor = 0x5784d3e1; + public static class TL_messages_getScheduledMessages extends TLObject { + public static final int constructor = 0xbdbb0464; public InputPeer peer; public ArrayList id = new ArrayList<>(); - public boolean increment; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_messageViews.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_Messages.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } - stream.writeBool(increment); + Vector.serializeInt(stream, id); } } - public static class TL_messages_getSavedGifs extends TLObject { - public static final int constructor = 0x5cf09635; + public static class TL_messages_sendScheduledMessages extends TLObject { + public static final int constructor = 0xbd38850a; - public long hash; + public InputPeer peer; + public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_SavedGifs.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(hash); + peer.serializeToStream(stream); + Vector.serializeInt(stream, id); } } - public static class TL_messages_saveGif extends TLObject { - public static final int constructor = 0x327a30cb; + public static class TL_messages_deleteScheduledMessages extends TLObject { + public static final int constructor = 0x59ae2b16; - public InputDocument id; - public boolean unsave; + public InputPeer peer; + public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public static TL_messages_deleteScheduledMessages TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_messages_deleteScheduledMessages.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_deleteScheduledMessages", constructor)); + } else { + return null; + } + } + TL_messages_deleteScheduledMessages result = new TL_messages_deleteScheduledMessages(); + result.readParams(stream, exception); + return result; + } + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void readParams(InputSerializedData stream, boolean exception) { + peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); + id = Vector.deserializeInt(stream, exception); + } + + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - id.serializeToStream(stream); - stream.writeBool(unsave); + peer.serializeToStream(stream); + Vector.serializeInt(stream, id); } } - public static class TL_messages_getInlineBotResults extends TLObject { - public static final int constructor = 0x514e999d; + public static class TL_messages_sendReaction extends TLObject { + public static final int constructor = 0xd30d78d4; public int flags; - public InputUser bot; + public boolean big; + public boolean add_to_recent; public InputPeer peer; - public InputGeoPoint geo_point; - public String query; - public String offset; + public int msg_id; + public ArrayList reaction = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_BotResults.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = big ? (flags | 2) : (flags &~ 2); + flags = add_to_recent ? (flags | 4) : (flags &~ 4); stream.writeInt32(flags); - bot.serializeToStream(stream); peer.serializeToStream(stream); + stream.writeInt32(msg_id); if ((flags & 1) != 0) { - geo_point.serializeToStream(stream); + Vector.serialize(stream, reaction); } - stream.writeString(query); - stream.writeString(offset); } } - public static class TL_messages_sendInlineBotResult extends TLObject { - public static final int constructor = 0x3ebee86a; + public static class TL_messages_sendPaidReaction extends TLObject { + public static final int constructor = 0x9dd6a67b; public int flags; - public boolean silent; - public boolean background; - public boolean clear_draft; - public boolean hide_via; + public Boolean isPrivate; public InputPeer peer; - public InputReplyTo reply_to; + public int msg_id; + public int count; public long random_id; - public long query_id; - public String id; - public int schedule_date; - public InputPeer send_as; - public InputQuickReplyShortcut quick_reply_shortcut; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = silent ? (flags | 32) : (flags &~ 32); - flags = background ? (flags | 64) : (flags &~ 64); - flags = clear_draft ? (flags | 128) : (flags &~ 128); - flags = hide_via ? (flags | 2048) : (flags &~ 2048); + flags = isPrivate != null ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); peer.serializeToStream(stream); - if ((flags & 1) != 0) { - reply_to.serializeToStream(stream); - } + stream.writeInt32(msg_id); + stream.writeInt32(count); stream.writeInt64(random_id); - stream.writeInt64(query_id); - stream.writeString(id); - if ((flags & 1024) != 0) { - stream.writeInt32(schedule_date); - } - if ((flags & 8192) != 0) { - send_as.serializeToStream(stream); - } - if ((flags & 131072) != 0) { - quick_reply_shortcut.serializeToStream(stream); + if ((flags & 1) != 0) { + stream.writeBool(isPrivate); } } } - public static class TL_messages_getMessageEditData extends TLObject { - public static final int constructor = 0xfda68d36; - - public InputPeer peer; - public int id; + public static class TL_messages_getPaidReactionPrivacy extends TLObject { + public static final int constructor = 0x472455aa; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_messageEditData.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(id); } } - public static class TL_messages_editMessage extends TLObject { - public static final int constructor = 0xdfd14005; + public static class TL_messages_togglePaidReactionPrivacy extends TLObject { + public static final int constructor = 0x849ad397; - public int flags; - public boolean no_webpage; - public boolean invert_media; public InputPeer peer; - public int id; - public String message; - public InputMedia media; - public ReplyMarkup reply_markup; - public ArrayList entities = new ArrayList<>(); - public int schedule_date; - public int quick_reply_shortcut_id; + public int msg_id; + public boolean isPrivate; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = no_webpage ? (flags | 2) : (flags &~ 2); - flags = invert_media ? (flags | 65536) : (flags &~ 65536); - stream.writeInt32(flags); peer.serializeToStream(stream); - stream.writeInt32(id); - if ((flags & 2048) != 0) { - stream.writeString(message); - } - if ((flags & 16384) != 0) { - media.serializeToStream(stream); - } - if ((flags & 4) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 32768) != 0) { - stream.writeInt32(schedule_date); - } - if ((flags & 131072) != 0) { - stream.writeInt32(quick_reply_shortcut_id); - } + stream.writeInt32(msg_id); + stream.writeBool(isPrivate); } } - public static class TL_messages_getBotCallbackAnswer extends TLObject { - public static final int constructor = 0x9342ca07; + public static class TL_messages_setDefaultReaction extends TLObject { + public static final int constructor = 0x4f47a016; - public int flags; - public boolean game; - public InputPeer peer; - public int msg_id; - public byte[] data; - public InputCheckPasswordSRP password; + public Reaction reaction; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_botCallbackAnswer.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = game ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - peer.serializeToStream(stream); - stream.writeInt32(msg_id); - if ((flags & 1) != 0) { - stream.writeByteArray(data); - } - if ((flags & 4) != 0) { - password.serializeToStream(stream); - } + reaction.serializeToStream(stream); } } - public static class TL_messages_setBotCallbackAnswer extends TLObject { - public static final int constructor = 0xd58f130a; + public static class TL_messages_translateText extends TLObject { + public static final int constructor = 0x63183030; public int flags; - public boolean alert; - public long query_id; - public String message; - public String url; - public int cache_time; + public InputPeer peer; + public ArrayList id = new ArrayList<>(); + public ArrayList text = new ArrayList<>(); + public String to_lang; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_translateResult.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = alert ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); - stream.writeInt64(query_id); if ((flags & 1) != 0) { - stream.writeString(message); + peer.serializeToStream(stream); } - if ((flags & 4) != 0) { - stream.writeString(url); + if ((flags & 1) != 0) { + Vector.serializeInt(stream, id); } - stream.writeInt32(cache_time); + if ((flags & 2) != 0) { + Vector.serialize(stream, text); + } + stream.writeString(to_lang); } } - public static class TL_messages_getPeerDialogs extends TLObject { - public static final int constructor = 0xe470bcfd; + public static class TL_messages_getUnreadReactions extends TLObject { + public static final int constructor = 0x3223495b; - public ArrayList peers = new ArrayList<>(); + public int flags; + public InputPeer peer; + public int top_msg_id; + public int offset_id; + public int add_offset; + public int limit; + public int max_id; + public int min_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_peerDialogs.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_Messages.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - peers.get(a).serializeToStream(stream); + stream.writeInt32(flags); + peer.serializeToStream(stream); + if ((flags & 1) != 0) { + stream.writeInt32(top_msg_id); } + stream.writeInt32(offset_id); + stream.writeInt32(add_offset); + stream.writeInt32(limit); + stream.writeInt32(max_id); + stream.writeInt32(min_id); } } - public static class TL_messages_saveDraft extends TLObject { - public static final int constructor = 0xd372c5ce; + public static class TL_messages_readReactions extends TLObject { + public static final int constructor = 0x54aa7f8e; public int flags; - public boolean no_webpage; - public boolean invert_media; - public InputReplyTo reply_to; public InputPeer peer; - public String message; - public ArrayList entities = new ArrayList<>(); - public InputMedia media; - public long effect; + public int top_msg_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_affectedHistory.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = no_webpage ? (flags | 2) : (flags &~ 2); - flags = invert_media ? (flags | 64) : (flags &~ 64); stream.writeInt32(flags); - if ((flags & 16) != 0) { - reply_to.serializeToStream(stream); - } peer.serializeToStream(stream); - stream.writeString(message); - if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 32) != 0) { - media.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt64(effect); + if ((flags & 1) != 0) { + stream.writeInt32(top_msg_id); } } } - public static class TL_messages_getAllDrafts extends TLObject { - public static final int constructor = 0x6a3f8d65; + public static class TL_messages_sendWebViewData extends TLObject { + public static final int constructor = 0xdc0242c8; + public InputUser bot; + public long random_id; + public String button_text; + public String data; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + bot.serializeToStream(stream); + stream.writeInt64(random_id); + stream.writeString(button_text); + stream.writeString(data); } } - public static class TL_messages_getFeaturedStickers extends TLObject { - public static final int constructor = 0x64780b14; + public static class TL_messages_getMessagesReactions extends TLObject { + public static final int constructor = 0x8bba90e6; - public long hash; + public InputPeer peer; + public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_FeaturedStickers.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(hash); + peer.serializeToStream(stream); + Vector.serializeInt(stream, id); } } - public static class TL_messages_readFeaturedStickers extends TLObject { - public static final int constructor = 0x5b118126; + public static class TL_messages_getMessageReactionsList extends TLObject { + public static final int constructor = 0x461b3f48; - public ArrayList id = new ArrayList<>(); + public int flags; + public InputPeer peer; + public int id; + public Reaction reaction; + public String offset; + public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_messageReactionsList.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(id.get(a)); + stream.writeInt32(flags); + peer.serializeToStream(stream); + stream.writeInt32(id); + if ((flags & 1) != 0) { + reaction.serializeToStream(stream); } + if ((flags & 2) != 0) { + stream.writeString(offset); + } + stream.writeInt32(limit); } } - public static class TL_messages_getRecentStickers extends TLObject { - public static final int constructor = 0x9da9403b; + public static class TL_messages_setChatAvailableReactions extends TLObject { + public static final int constructor = 0x864b2581; public int flags; - public boolean attached; - public long hash; + public InputPeer peer; + public ChatReactions available_reactions; + public int reactions_limit; + public boolean paid_enabled; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_RecentStickers.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = attached ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); - stream.writeInt64(hash); + peer.serializeToStream(stream); + available_reactions.serializeToStream(stream); + if ((flags & 1) != 0) { + stream.writeInt32(reactions_limit); + } + if ((flags & 2) != 0) { + stream.writeBool(paid_enabled); + } } } - public static class TL_messages_saveRecentSticker extends TLObject { - public static final int constructor = 0x392718f8; + public static class TL_messages_getAvailableReactions extends TLObject { + public static final int constructor = 0x18dea0ac; - public int flags; - public boolean attached; - public InputDocument id; - public boolean unsave; + public int hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_AvailableReactions.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = attached ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - id.serializeToStream(stream); - stream.writeBool(unsave); + stream.writeInt32(hash); } } - public static class TL_messages_clearRecentStickers extends TLObject { - public static final int constructor = 0x8999602d; + public static class TL_messages_searchResultsCalendar extends TLObject { + public static final int constructor = 0x147ee23c; public int flags; - public boolean attached; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public boolean inexact; + public int count; + public int min_date; + public int min_msg_id; + public int offset_id_offset; + public ArrayList periods = new ArrayList<>(); + public ArrayList messages = new ArrayList<>(); + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + + public static TL_messages_searchResultsCalendar TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_messages_searchResultsCalendar.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_searchResultsCalendar", constructor)); + } else { + return null; + } + } + TL_messages_searchResultsCalendar result = new TL_messages_searchResultsCalendar(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + inexact = (flags & 1) != 0; + count = stream.readInt32(exception); + min_date = stream.readInt32(exception); + min_msg_id = stream.readInt32(exception); + if ((flags & 2) != 0) { + offset_id_offset = stream.readInt32(exception); + } + periods = Vector.deserialize(stream, TL_searchResultsCalendarPeriod::TLdeserialize, exception); + messages = Vector.deserialize(stream, Message::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = attached ? (flags | 1) : (flags &~ 1); + flags = inexact ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); + stream.writeInt32(count); + stream.writeInt32(min_date); + stream.writeInt32(min_msg_id); + if ((flags & 2) != 0) { + stream.writeInt32(offset_id_offset); + } + Vector.serialize(stream, periods); + Vector.serialize(stream, messages); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } - public static class TL_messages_getArchivedStickers extends TLObject { - public static final int constructor = 0x57f17692; + public static class TL_messages_getPollVotes extends TLObject { + public static final int constructor = 0xb86e380e; public int flags; - public boolean masks; - public boolean emojis; - public long offset_id; + public InputPeer peer; + public int id; + public byte[] option; + public String offset; public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_archivedStickers.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_votesList.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = masks ? (flags | 1) : (flags &~ 1); - flags = emojis ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); - stream.writeInt64(offset_id); + peer.serializeToStream(stream); + stream.writeInt32(id); + if ((flags & 1) != 0) { + stream.writeByteArray(option); + } + if ((flags & 2) != 0) { + stream.writeString(offset); + } stream.writeInt32(limit); } } - public static class TL_messages_setGameScore extends TLObject { - public static final int constructor = 0x8ef8ecc0; + public static class TL_messages_dialogFilters extends TLObject { + public static final int constructor = 0x2ad93719; public int flags; - public boolean edit_message; - public boolean force; - public InputPeer peer; - public int id; - public InputUser user_id; - public int score; + public boolean tags_enabled; + public ArrayList filters = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public static TL_messages_dialogFilters TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_messages_dialogFilters.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_dialogFilters", constructor)); + } else { + return null; + } + } + TL_messages_dialogFilters result = new TL_messages_dialogFilters(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + tags_enabled = (flags & 1) != 0; + filters = Vector.deserialize(stream, DialogFilter::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = edit_message ? (flags | 1) : (flags &~ 1); - flags = force ? (flags | 2) : (flags &~ 2); + flags = tags_enabled ? (flags | 1) : (flags & 1); stream.writeInt32(flags); - peer.serializeToStream(stream); - stream.writeInt32(id); - user_id.serializeToStream(stream); - stream.writeInt32(score); + Vector.serialize(stream, filters); } } - public static class TL_messages_setInlineGameScore extends TLObject { - public static final int constructor = 0x15ad9f64; - - public int flags; - public boolean edit_message; - public boolean force; - public TL_inputBotInlineMessageID id; - public InputUser user_id; - public int score; + public static class TL_messages_getDialogFilters extends TLObject { + public static final int constructor = 0xefd48c89; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + if (constructor == 0x1cb5c415) { + return Vector.TLDeserialize(stream, constructor, exception, DialogFilter::TLdeserialize); + } + return TL_messages_dialogFilters.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = edit_message ? (flags | 1) : (flags &~ 1); - flags = force ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - id.serializeToStream(stream); - user_id.serializeToStream(stream); - stream.writeInt32(score); } } - public static class TL_messages_getMaskStickers extends TLObject { - public static final int constructor = 0x640f82b8; - - public long hash; + public static class TL_messages_getSuggestedDialogFilters extends TLObject { + public static final int constructor = 0xa29cd42c; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_AllStickers.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, TL_dialogFilterSuggested::TLdeserialize); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(hash); } } - public static class TL_messages_getGameHighScores extends TLObject { - public static final int constructor = 0xe822649d; + public static class TL_messages_updateDialogFilter extends TLObject { + public static final int constructor = 0x1ad4a04a; - public InputPeer peer; + public int flags; public int id; - public InputUser user_id; + public TL_dialogFilter filter; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_highScores.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); + stream.writeInt32(flags); stream.writeInt32(id); - user_id.serializeToStream(stream); + if ((flags & 1) != 0) { + filter.serializeToStream(stream); + } } } - public static class TL_messages_getInlineGameHighScores extends TLObject { - public static final int constructor = 0xf635e1b; + public static class TL_messages_updateDialogFiltersOrder extends TLObject { + public static final int constructor = 0xc563c1e4; - public TL_inputBotInlineMessageID id; - public InputUser user_id; + public ArrayList order = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_highScores.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - id.serializeToStream(stream); - user_id.serializeToStream(stream); + Vector.serializeInt(stream, order); } } - public static class TL_messages_getAttachedStickers extends TLObject { - public static final int constructor = 0xcc5b67cc; + public static class TL_messages_getOldFeaturedStickers extends TLObject { + public static final int constructor = 0x7ed094a1; - public InputStickeredMedia media; + public int offset; + public int limit; + public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - StickerSetCovered object = StickerSetCovered.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_FeaturedStickers.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - media.serializeToStream(stream); + stream.writeInt32(offset); + stream.writeInt32(limit); + stream.writeInt64(hash); } } - public static class TL_messages_getCommonChats extends TLObject { - public static final int constructor = 0xe40ca104; + public static class TL_messages_getReplies extends TLObject { + public static final int constructor = 0x22ddd30c; - public InputUser user_id; - public long max_id; + public InputPeer peer; + public int msg_id; + public int offset_id; + public int offset_date; + public int add_offset; public int limit; + public int max_id; + public int min_id; + public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_Chats.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_Messages.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - user_id.serializeToStream(stream); - stream.writeInt64(max_id); + peer.serializeToStream(stream); + stream.writeInt32(msg_id); + stream.writeInt32(offset_id); + stream.writeInt32(offset_date); + stream.writeInt32(add_offset); stream.writeInt32(limit); + stream.writeInt32(max_id); + stream.writeInt32(min_id); + stream.writeInt64(hash); } } - public static class TL_messages_getAllChats extends TLObject { - public static final int constructor = 0x875f74be; + public static class TL_messages_getDiscussionMessage extends TLObject { + public static final int constructor = 0x446972fd; - public ArrayList except_ids = new ArrayList<>(); + public InputPeer peer; + public int msg_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_Chats.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_discussionMessage.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = except_ids.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(except_ids.get(a)); - } + peer.serializeToStream(stream); + stream.writeInt32(msg_id); } } - public static class TL_messages_getWebPage extends TLObject { - public static final int constructor = 0x8d9692a3; + public static class TL_messages_readDiscussion extends TLObject { + public static final int constructor = 0xf731a9f4; - public String url; - public int hash; + public InputPeer peer; + public int msg_id; + public int read_max_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_webPage.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(url); - stream.writeInt32(hash); + peer.serializeToStream(stream); + stream.writeInt32(msg_id); + stream.writeInt32(read_max_id); } } - public static class TL_messages_toggleDialogPin extends TLObject { - public static final int constructor = 0xa731e257; + public static class TL_messages_unpinAllMessages extends TLObject { + public static final int constructor = 0xf025bc8b; - public int flags; - public boolean pinned; - public InputDialogPeer peer; + public InputPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_affectedHistory.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = pinned ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); peer.serializeToStream(stream); } } - public static class TL_messages_reorderPinnedDialogs extends TLObject { - public static final int constructor = 0x3b1adf37; + public static class TL_messages_getExportedChatInvites extends TLObject { + public static final int constructor = 0xa2b5a3f6; public int flags; - public boolean force; - public int folder_id; - public ArrayList order = new ArrayList<>(); + public boolean revoked; + public InputPeer peer; + public InputUser admin_id; + public int offset_date; + public String offset_link; + public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_exportedChatInvites.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = force ? (flags | 1) : (flags &~ 1); + flags = revoked ? (flags | 8) : (flags &~ 8); stream.writeInt32(flags); - stream.writeInt32(folder_id); - stream.writeInt32(0x1cb5c415); - int count = order.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - order.get(a).serializeToStream(stream); + peer.serializeToStream(stream); + admin_id.serializeToStream(stream); + if ((flags & 4) != 0) { + stream.writeInt32(offset_date); + } + if ((flags & 4) != 0) { + stream.writeString(offset_link); } + stream.writeInt32(limit); } } - public static class TL_messages_getPinnedDialogs extends TLObject { - public static final int constructor = 0xd6b94df2; + public static class TL_messages_getExportedChatInvite extends TLObject { + public static final int constructor = 0x73746f5c; - public int folder_id; + public InputPeer peer; + public String link; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_peerDialogs.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_ExportedChatInvite.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(folder_id); + peer.serializeToStream(stream); + stream.writeString(link); } } - public static class TL_messages_uploadMedia extends TLObject { - public static final int constructor = 0x519bc2b1; + public static class TL_messages_editExportedChatInvite extends TLObject { + public static final int constructor = 0xbdca2f75; + public int flags; + public boolean revoked; public InputPeer peer; - public InputMedia media; + public String link; + public int expire_date; + public int usage_limit; + public boolean request_needed; + public String title; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return MessageMedia.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_ExportedChatInvite.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = revoked ? (flags | 4) : (flags &~ 4); + stream.writeInt32(flags); peer.serializeToStream(stream); - media.serializeToStream(stream); + stream.writeString(link); + if ((flags & 1) != 0) { + stream.writeInt32(expire_date); + } + if ((flags & 2) != 0) { + stream.writeInt32(usage_limit); + } + if ((flags & 8) != 0) { + stream.writeBool(request_needed); + } + if ((flags & 16) != 0) { + stream.writeString(title); + } } } - public static class TL_messages_sendScreenshotNotification extends TLObject { - public static final int constructor = 0xa1405817; + public static class TL_messages_deleteRevokedExportedChatInvites extends TLObject { + public static final int constructor = 0x56987bd5; public InputPeer peer; - public InputReplyTo reply_to; - public long random_id; + public InputUser admin_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); - reply_to.serializeToStream(stream); - stream.writeInt64(random_id); + admin_id.serializeToStream(stream); } } - public static class TL_messages_getFavedStickers extends TLObject { - public static final int constructor = 0x4f1aaa9; + public static class TL_messages_deleteExportedChatInvite extends TLObject { + public static final int constructor = 0xd464a42b; - public long hash; + public InputPeer peer; + public String link; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_FavedStickers.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(hash); + peer.serializeToStream(stream); + stream.writeString(link); } } - public static class TL_messages_faveSticker extends TLObject { - public static final int constructor = 0xb9ffc55b; + public static class TL_messages_getAdminsWithInvites extends TLObject { + public static final int constructor = 0x3920e6ef; - public InputDocument id; - public boolean unfave; + public InputPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_chatAdminsWithInvites.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - id.serializeToStream(stream); - stream.writeBool(unfave); + peer.serializeToStream(stream); } } - public static class TL_messages_getUnreadMentions extends TLObject { - public static final int constructor = 0xf107e790; + public static class TL_messages_getChatInviteImporters extends TLObject { + public static final int constructor = 0xdf04dd4e; public int flags; + public boolean requested; + public boolean subscription_expired; public InputPeer peer; - public int top_msg_id; - public int offset_id; - public int add_offset; + public String link; + public String q; + public int offset_date; + public InputUser offset_user; public int limit; - public int max_id; - public int min_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_Messages.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_chatInviteImporters.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = requested ? (flags | 1) : (flags &~ 1); + flags = subscription_expired ? (flags | 8) : (flags &~ 8); stream.writeInt32(flags); peer.serializeToStream(stream); - if ((flags & 1) != 0) { - stream.writeInt32(top_msg_id); + if ((flags & 2) != 0) { + stream.writeString(link); } - stream.writeInt32(offset_id); - stream.writeInt32(add_offset); + if ((flags & 4) != 0) { + stream.writeString(q); + } + stream.writeInt32(offset_date); + offset_user.serializeToStream(stream); stream.writeInt32(limit); - stream.writeInt32(max_id); - stream.writeInt32(min_id); } } - public static class TL_messages_readMentions extends TLObject { - public static final int constructor = 0x36e5bf4d; + public static class TL_messages_hideChatJoinRequest extends TLObject { + public static final int constructor = 0x7fe7e815; public int flags; + public boolean approved; public InputPeer peer; - public int top_msg_id; + public InputUser user_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_affectedHistory.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = approved ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); peer.serializeToStream(stream); - if ((flags & 1) != 0) { - stream.writeInt32(top_msg_id); - } + user_id.serializeToStream(stream); } } - public static class TL_messages_getRecentLocations extends TLObject { - public static final int constructor = 0x702a40e0; + public static class TL_messages_hideAllChatJoinRequests extends TLObject { + public static final int constructor = 0xe085f4ea; + public int flags; + public boolean approved; public InputPeer peer; - public int limit; - public long hash; + public String link; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_Messages.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = approved ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); peer.serializeToStream(stream); - stream.writeInt32(limit); - stream.writeInt64(hash); + if ((flags & 2) != 0) { + stream.writeString(link); + } } } - public static class TL_messages_sendMultiMedia extends TLObject { - public static final int constructor = 0x37b74355; + public static class TL_messages_toggleNoForwards extends TLObject { + public static final int constructor = 0xb11eafa2; - public int flags; - public boolean silent; - public boolean background; - public boolean clear_draft; - public boolean noforwards; - public boolean update_stickersets_order; - public boolean invert_media; public InputPeer peer; - public InputReplyTo reply_to; - public ArrayList multi_media = new ArrayList<>(); - public int schedule_date; - public InputPeer send_as; - public InputQuickReplyShortcut quick_reply_shortcut; - public long effect; + public boolean enabled; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = silent ? (flags | 32) : (flags &~ 32); - flags = background ? (flags | 64) : (flags &~ 64); - flags = clear_draft ? (flags | 128) : (flags &~ 128); - flags = noforwards ? (flags | 16384) : (flags &~ 16384); - flags = update_stickersets_order ? (flags | 32768) : (flags &~ 32768); - flags = invert_media ? (flags | 65536) : (flags &~ 65536); - stream.writeInt32(flags); peer.serializeToStream(stream); - if ((flags & 1) != 0) { - reply_to.serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - int count = multi_media.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - multi_media.get(a).serializeToStream(stream); - } - if ((flags & 1024) != 0) { - stream.writeInt32(schedule_date); - } - if ((flags & 8192) != 0) { - send_as.serializeToStream(stream); - } - if ((flags & 131072) != 0) { - quick_reply_shortcut.serializeToStream(stream); - } - if ((flags & 262144) != 0) { - stream.writeInt64(effect); - } + stream.writeBool(enabled); } } - public static class TL_messages_clearAllDrafts extends TLObject { - public static final int constructor = 0x7e58ee9c; + public static class TL_messages_saveDefaultSendAs extends TLObject { + public static final int constructor = 0xccfddf96; + public InputPeer peer; + public InputPeer send_as; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + peer.serializeToStream(stream); + send_as.serializeToStream(stream); } } - public static class TL_messages_updatePinnedMessage extends TLObject { - public static final int constructor = 0xd2aaf7ec; + public static class TL_messages_setHistoryTTL extends TLObject { + public static final int constructor = 0xb80e5fe4; - public int flags; - public boolean silent; - public boolean unpin; - public boolean pm_oneside; public InputPeer peer; - public int id; + public int period; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = silent ? (flags | 1) : (flags &~ 1); - flags = unpin ? (flags | 2) : (flags &~ 2); - flags = pm_oneside ? (flags | 4) : (flags &~ 4); - stream.writeInt32(flags); peer.serializeToStream(stream); - stream.writeInt32(id); + stream.writeInt32(period); } } - public static class TL_messages_sendVote extends TLObject { - public static final int constructor = 0x10ea6184; + public static class TL_messages_deleteChat extends TLObject { + public static final int constructor = 0x5bd0ee50; - public InputPeer peer; - public int msg_id; - public ArrayList options = new ArrayList<>(); + public long chat_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(msg_id); - stream.writeInt32(0x1cb5c415); - int count = options.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeByteArray(options.get(a)); - } + stream.writeInt64(chat_id); } } - public static class TL_messages_getPollResults extends TLObject { - public static final int constructor = 0x73bb643b; + public static class TL_messages_deletePhoneCallHistory extends TLObject { + public static final int constructor = 0xf9cbe409; - public InputPeer peer; - public int msg_id; + public int flags; + public boolean revoke; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_affectedFoundMessages.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(msg_id); + flags = revoke ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); } } - public static class TL_messages_getOnlines extends TLObject { - public static final int constructor = 0x6e2be050; + public static class TL_messages_checkHistoryImport extends TLObject { + public static final int constructor = 0x43fe19f3; - public InputPeer peer; + public String import_head; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_chatOnlines.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_historyImportParsed.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); + stream.writeString(import_head); } } - public static class TL_messages_getStatsURL extends TLObject { - public static final int constructor = 0x812c2ae6; + public static class TL_messages_initHistoryImport extends TLObject { + public static final int constructor = 0x34090c3b; - public int flags; - public boolean dark; public InputPeer peer; - public String params; + public InputFile file; + public int media_count; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_statsURL.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_historyImport.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = dark ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); peer.serializeToStream(stream); - stream.writeString(params); + file.serializeToStream(stream); + stream.writeInt32(media_count); } } - public static class TL_messages_editChatAbout extends TLObject { - public static final int constructor = 0xdef60797; + public static class TL_messages_uploadImportedMedia extends TLObject { + public static final int constructor = 0x2a862092; public InputPeer peer; - public String about; + public long import_id; + public String file_name; + public InputMedia media; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return MessageMedia.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); - stream.writeString(about); + stream.writeInt64(import_id); + stream.writeString(file_name); + media.serializeToStream(stream); } } - public static class TL_messages_editChatDefaultBannedRights extends TLObject { - public static final int constructor = 0xa5866b41; + public static class TL_messages_startHistoryImport extends TLObject { + public static final int constructor = 0xb43df344; public InputPeer peer; - public TL_chatBannedRights banned_rights; + public long import_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); - banned_rights.serializeToStream(stream); + stream.writeInt64(import_id); } } - public static class TL_messages_getEmojiKeywords extends TLObject { - public static final int constructor = 0x35a0e062; + public static class TL_messages_checkHistoryImportPeer extends TLObject { + public static final int constructor = 0x5dc60f03; - public String lang_code; + public InputPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_emojiKeywordsDifference.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_checkedHistoryImportPeer.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(lang_code); + peer.serializeToStream(stream); } } - public static class TL_messages_getEmojiKeywordsDifference extends TLObject { - public static final int constructor = 0x1508b6af; + public static class TL_messages_setChatTheme extends TLObject { + public static final int constructor = 0xe63be13f; - public String lang_code; - public int from_version; + public InputPeer peer; + public String emoticon; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_emojiKeywordsDifference.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(lang_code); - stream.writeInt32(from_version); + peer.serializeToStream(stream); + stream.writeString(emoticon); } } - public static class TL_messages_getEmojiKeywordsLanguages extends TLObject { - public static final int constructor = 0x4e9963b2; + public static class TL_help_getAppChangelog extends TLObject { + public static final int constructor = 0x9010ef6f; - public ArrayList lang_codes = new ArrayList<>(); + public String prev_app_version; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_emojiLanguage object = TL_emojiLanguage.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = lang_codes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(lang_codes.get(a)); - } + stream.writeString(prev_app_version); } } - public static class TL_messages_getEmojiURL extends TLObject { - public static final int constructor = 0xd5b10c26; + public static class TL_messages_toggleStickerSets extends TLObject { + public static final int constructor = 0xb5052fea; - public String lang_code; + public int flags; + public boolean uninstall; + public boolean archive; + public boolean unarchive; + public ArrayList stickersets = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_emojiURL.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(lang_code); + flags = uninstall ? (flags | 1) : (flags &~ 1); + flags = archive ? (flags | 2) : (flags &~ 2); + flags = unarchive ? (flags | 4) : (flags &~ 4); + stream.writeInt32(flags); + Vector.serialize(stream, stickersets); } } - public static class TL_messages_getSearchCounters extends TLObject { - public static final int constructor = 0x1bbcf300; + public static class TL_messages_uploadEncryptedFile extends TLObject { + public static final int constructor = 0x5057c497; - public int flags; - public InputPeer peer; - public InputPeer saved_peer_id; - public int top_msg_id; - public ArrayList filters = new ArrayList<>(); + public TL_inputEncryptedChat peer; + public InputEncryptedFile file; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_messages_searchCounter object = TL_messages_searchCounter.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return EncryptedFile.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); peer.serializeToStream(stream); - if ((flags & 4) != 0) { - saved_peer_id.serializeToStream(stream); - } - if ((flags & 1) != 0) { - stream.writeInt32(top_msg_id); - } - stream.writeInt32(0x1cb5c415); - int count = filters.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - filters.get(a).serializeToStream(stream); - } + file.serializeToStream(stream); } } - public static class TL_messages_requestUrlAuth extends TLObject { - public static final int constructor = 0x198fb446; + public static class TL_messages_searchStickerSets extends TLObject { + public static final int constructor = 0x35705b8a; public int flags; - public InputPeer peer; - public int msg_id; - public int button_id; - public String url; + public boolean exclude_featured; + public String q; + public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return UrlAuthResult.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_FoundStickerSets.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = exclude_featured ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); - if ((flags & 2) != 0) { - peer.serializeToStream(stream); - } - if ((flags & 2) != 0) { - stream.writeInt32(msg_id); - } - if ((flags & 2) != 0) { - stream.writeInt32(button_id); - } - if ((flags & 4) != 0) { - stream.writeString(url); - } + stream.writeString(q); + stream.writeInt64(hash); } } - public static class TL_messages_acceptUrlAuth extends TLObject { - public static final int constructor = 0xb12c7125; + public static class TL_messages_searchEmojiStickerSets extends TLObject { + public static final int constructor = 0x92b4494c; public int flags; - public boolean write_allowed; - public InputPeer peer; - public int msg_id; - public int button_id; - public String url; + public boolean exclude_featured; + public String q; + public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return UrlAuthResult.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_FoundStickerSets.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = write_allowed ? (flags | 1) : (flags &~ 1); + flags = exclude_featured ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); - if ((flags & 2) != 0) { - peer.serializeToStream(stream); - } - if ((flags & 2) != 0) { - stream.writeInt32(msg_id); - } - if ((flags & 2) != 0) { - stream.writeInt32(button_id); - } - if ((flags & 4) != 0) { - stream.writeString(url); - } + stream.writeString(q); + stream.writeInt64(hash); } } - public static class TL_messages_hidePeerSettingsBar extends TLObject { - public static final int constructor = 0x4facb138; + public static class TL_messages_markDialogUnread extends TLObject { + public static final int constructor = 0xc286d98f; - public InputPeer peer; + public int flags; + public boolean unread; + public InputDialogPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = unread ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); peer.serializeToStream(stream); } } - public static class TL_messages_getScheduledHistory extends TLObject { - public static final int constructor = 0xf516760b; - - public InputPeer peer; - public long hash; + public static class TL_messages_getDialogUnreadMarks extends TLObject { + public static final int constructor = 0x22e24e22; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_Messages.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, DialogPeer::TLdeserialize); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt64(hash); } } - public static class TL_messages_getScheduledMessages extends TLObject { - public static final int constructor = 0xbdbb0464; + public static class TL_help_setBotUpdatesStatus extends TLObject { + public static final int constructor = 0xec22cfcd; - public InputPeer peer; - public ArrayList id = new ArrayList<>(); + public int pending_updates_count; + public String message; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_Messages.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } + stream.writeInt32(pending_updates_count); + stream.writeString(message); } } - public static class TL_messages_sendScheduledMessages extends TLObject { - public static final int constructor = 0xbd38850a; + public static class TL_messages_reorderStickerSets extends TLObject { + public static final int constructor = 0x78337739; - public InputPeer peer; - public ArrayList id = new ArrayList<>(); + public int flags; + public boolean masks; + public boolean emojis; + public ArrayList order = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } + flags = masks ? (flags | 1) : (flags &~ 1); + flags = emojis ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + Vector.serializeLong(stream, order); } } - public static class TL_messages_deleteScheduledMessages extends TLObject { - public static final int constructor = 0x59ae2b16; - - public InputPeer peer; - public ArrayList id = new ArrayList<>(); - - public static TL_messages_deleteScheduledMessages TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_deleteScheduledMessages.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_deleteScheduledMessages", constructor)); - } else { - return null; - } - } - TL_messages_deleteScheduledMessages result = new TL_messages_deleteScheduledMessages(); - result.readParams(stream, exception); - return result; - } + public static class TL_messages_getEmojiStickers extends TLObject { + public static final int constructor = 0xfbfca18f; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } + public long hash; - public void readParams(AbstractSerializedData stream, boolean exception) { - peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - id.add(stream.readInt32(exception)); - } + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_AllStickers.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } + stream.writeInt64(hash); } } - public static class TL_messages_sendReaction extends TLObject { - public static final int constructor = 0xd30d78d4; + public static class TL_messages_getFeaturedEmojiStickers extends TLObject { + public static final int constructor = 0xecf6736; - public int flags; - public boolean big; - public boolean add_to_recent; - public InputPeer peer; - public int msg_id; - public ArrayList reaction = new ArrayList<>(); + public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_FeaturedStickers.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = big ? (flags | 2) : (flags &~ 2); - flags = add_to_recent ? (flags | 4) : (flags &~ 4); - stream.writeInt32(flags); - peer.serializeToStream(stream); - stream.writeInt32(msg_id); - if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = reaction.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - reaction.get(a).serializeToStream(stream); - } - } + stream.writeInt64(hash); } } - public static class TL_messages_sendPaidReaction extends TLObject { - public static final int constructor = 0x9dd6a67b; + public static class TL_messages_getDocumentByHash extends TLObject { + public static final int constructor = 0x338e2464; - public int flags; - public Boolean isPrivate; - public InputPeer peer; - public int msg_id; - public int count; - public long random_id; + public byte[] sha256; + public int size; + public String mime_type; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Document.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = isPrivate != null ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - peer.serializeToStream(stream); - stream.writeInt32(msg_id); - stream.writeInt32(count); - stream.writeInt64(random_id); - if ((flags & 1) != 0) { - stream.writeBool(isPrivate); - } + stream.writeByteArray(sha256); + stream.writeInt32(size); + stream.writeString(mime_type); } } - public static class TL_messages_getPaidReactionPrivacy extends TLObject { - public static final int constructor = 0x472455aa; + public static class TL_help_getRecentMeUrls extends TLObject { + public static final int constructor = 0x3dc0f114; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public String referer; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_help_recentMeUrls.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + stream.writeString(referer); } } - public static class TL_messages_togglePaidReactionPrivacy extends TLObject { - public static final int constructor = 0x849ad397; + public static class TL_help_getDeepLinkInfo extends TLObject { + public static final int constructor = 0x3fedc75f; - public InputPeer peer; - public int msg_id; - public boolean isPrivate; + public String path; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return help_DeepLinkInfo.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(msg_id); - stream.writeBool(isPrivate); + stream.writeString(path); } } - public static class TL_messages_setDefaultReaction extends TLObject { - public static final int constructor = 0x4f47a016; + public static class TL_channels_readHistory extends TLObject { + public static final int constructor = 0xcc104937; - public Reaction reaction; + public InputChannel channel; + public int max_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - reaction.serializeToStream(stream); + channel.serializeToStream(stream); + stream.writeInt32(max_id); } } - public static class TL_messages_translateText extends TLObject { - public static final int constructor = 0x63183030; + public static class TL_channels_deleteMessages extends TLObject { + public static final int constructor = 0x84c1fd4e; - public int flags; - public InputPeer peer; + public InputChannel channel; public ArrayList id = new ArrayList<>(); - public ArrayList text = new ArrayList<>(); - public String to_lang; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_translateResult.TLdeserialize(stream, constructor, exception); - } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - peer.serializeToStream(stream); - } - if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } - } - if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - final int count = text.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - text.get(a).serializeToStream(stream); + public static TL_channels_deleteMessages TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_channels_deleteMessages.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_channels_deleteMessages", constructor)); + } else { + return null; } } - stream.writeString(to_lang); + TL_channels_deleteMessages result = new TL_channels_deleteMessages(); + result.readParams(stream, exception); + return result; } - } - - public static class TL_messages_getUnreadReactions extends TLObject { - public static final int constructor = 0x3223495b; - public int flags; - public InputPeer peer; - public int top_msg_id; - public int offset_id; - public int add_offset; - public int limit; - public int max_id; - public int min_id; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_affectedMessages.TLdeserialize(stream, constructor, exception); + } - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_Messages.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + channel = InputChannel.TLdeserialize(stream, stream.readInt32(exception), exception); + id = Vector.deserializeInt(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - peer.serializeToStream(stream); - if ((flags & 1) != 0) { - stream.writeInt32(top_msg_id); - } - stream.writeInt32(offset_id); - stream.writeInt32(add_offset); - stream.writeInt32(limit); - stream.writeInt32(max_id); - stream.writeInt32(min_id); + channel.serializeToStream(stream); + Vector.serializeInt(stream, id); } } - public static class TL_messages_readReactions extends TLObject { - public static final int constructor = 0x54aa7f8e; + public static class TL_channels_deleteParticipantHistory extends TLObject { + public static final int constructor = 0x367544db; - public int flags; - public InputPeer peer; - public int top_msg_id; + public InputChannel channel; + public InputPeer participant; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_messages_affectedHistory.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - peer.serializeToStream(stream); - if ((flags & 1) != 0) { - stream.writeInt32(top_msg_id); - } + channel.serializeToStream(stream); + participant.serializeToStream(stream); } } - public static class TL_messages_sendWebViewData extends TLObject { - public static final int constructor = 0xdc0242c8; + public static class TL_channels_reportSpam extends TLObject { + public static final int constructor = 0xf44a8315; - public InputUser bot; - public long random_id; - public String button_text; - public String data; + public InputChannel channel; + public InputPeer participant; + public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - bot.serializeToStream(stream); - stream.writeInt64(random_id); - stream.writeString(button_text); - stream.writeString(data); + channel.serializeToStream(stream); + participant.serializeToStream(stream); + Vector.serializeInt(stream, id); } } - public static class TL_messages_getMessagesReactions extends TLObject { - public static final int constructor = 0x8bba90e6; + public static class TL_channels_getMessages extends TLObject { + public static final int constructor = 0x93d7b347; - public InputPeer peer; + public InputChannel channel; public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_Messages.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } + channel.serializeToStream(stream); + Vector.serializeInt(stream, id); } } - public static class TL_messages_getMessageReactionsList extends TLObject { - public static final int constructor = 0x461b3f48; + public static class TL_channels_getParticipants extends TLObject { + public static final int constructor = 0x77ced9d0; - public int flags; - public InputPeer peer; - public int id; - public Reaction reaction; - public String offset; + public InputChannel channel; + public ChannelParticipantsFilter filter; + public int offset; public int limit; + public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_messageReactionsList.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return channels_ChannelParticipants.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - peer.serializeToStream(stream); - stream.writeInt32(id); - if ((flags & 1) != 0) { - reaction.serializeToStream(stream); - } - if ((flags & 2) != 0) { - stream.writeString(offset); - } + channel.serializeToStream(stream); + filter.serializeToStream(stream); + stream.writeInt32(offset); stream.writeInt32(limit); + stream.writeInt64(hash); } } - public static class TL_messages_setChatAvailableReactions extends TLObject { - public static final int constructor = 0x864b2581; + public static class TL_channels_getParticipant extends TLObject { + public static final int constructor = 0xa0ab6cc6; - public int flags; - public InputPeer peer; - public ChatReactions available_reactions; - public int reactions_limit; - public boolean paid_enabled; + public InputChannel channel; + public InputPeer participant; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_channels_channelParticipant.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - peer.serializeToStream(stream); - available_reactions.serializeToStream(stream); - if ((flags & 1) != 0) { - stream.writeInt32(reactions_limit); - } - if ((flags & 2) != 0) { - stream.writeBool(paid_enabled); - } + channel.serializeToStream(stream); + participant.serializeToStream(stream); } } - public static class TL_messages_getAvailableReactions extends TLObject { - public static final int constructor = 0x18dea0ac; + public static class TL_channels_getChannels extends TLObject { + public static final int constructor = 0xa7f6bbb; - public int hash; + public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_AvailableReactions.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_chats.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(hash); + Vector.serialize(stream, id); } } + public static class TL_channels_getFullChannel extends TLObject { + public static final int constructor = 0x8736a09; - public static class TL_messages_searchResultsCalendar extends TLObject { - public static final int constructor = 0x147ee23c; + public InputChannel channel; - public int flags; - public boolean inexact; - public int count; - public int min_date; - public int min_msg_id; - public int offset_id_offset; - public ArrayList periods = new ArrayList<>(); - public ArrayList messages = new ArrayList<>(); - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_chatFull.TLdeserialize(stream, constructor, exception); + } - public static TL_messages_searchResultsCalendar TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_searchResultsCalendar.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_searchResultsCalendar", constructor)); - } else { - return null; - } - } - TL_messages_searchResultsCalendar result = new TL_messages_searchResultsCalendar(); - result.readParams(stream, exception); - return result; + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + channel.serializeToStream(stream); } + } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - inexact = (flags & 1) != 0; - count = stream.readInt32(exception); - min_date = stream.readInt32(exception); - min_msg_id = stream.readInt32(exception); - if ((flags & 2) != 0) { - offset_id_offset = stream.readInt32(exception); - } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_searchResultsCalendarPeriod object = TL_searchResultsCalendarPeriod.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - periods.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + public static class TL_channels_createChannel extends TLObject { + public static final int constructor = 0x91006707; + + public int flags; + public boolean broadcast; + public boolean megagroup; + public boolean for_import; + public boolean forum; + public String title; + public String about; + public InputGeoPoint geo_point; + public String address; + public int ttl_period; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = inexact ? (flags | 1) : (flags &~ 1); + flags = broadcast ? (flags | 1) : (flags &~ 1); + flags = megagroup ? (flags | 2) : (flags &~ 2); + flags = for_import ? (flags | 8) : (flags &~ 8); + flags = forum ? (flags | 32) : (flags &~ 32); stream.writeInt32(flags); - stream.writeInt32(count); - stream.writeInt32(min_date); - stream.writeInt32(min_msg_id); - if ((flags & 2) != 0) { - stream.writeInt32(offset_id_offset); - } - stream.writeInt32(0x1cb5c415); - int count = periods.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - periods.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - messages.get(a).serializeToStream(stream); + stream.writeString(title); + stream.writeString(about); + if ((flags & 4) != 0) { + geo_point.serializeToStream(stream); } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); + if ((flags & 4) != 0) { + stream.writeString(address); } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); + if ((flags & 16) != 0) { + stream.writeInt32(ttl_period); } } } - public static class TL_messages_getPollVotes extends TLObject { - public static final int constructor = 0xb86e380e; + public static class TL_channels_editAdmin extends TLObject { + public static final int constructor = 0xd33c8902; - public int flags; - public InputPeer peer; - public int id; - public byte[] option; - public String offset; - public int limit; + public InputChannel channel; + public InputUser user_id; + public TL_chatAdminRights admin_rights; + public String rank; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_votesList.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - peer.serializeToStream(stream); - stream.writeInt32(id); - if ((flags & 1) != 0) { - stream.writeByteArray(option); - } - if ((flags & 2) != 0) { - stream.writeString(offset); - } - stream.writeInt32(limit); + channel.serializeToStream(stream); + user_id.serializeToStream(stream); + admin_rights.serializeToStream(stream); + stream.writeString(rank); } } - public static class TL_messages_dialogFilters extends TLObject { - public static final int constructor = 0x2ad93719; - - public int flags; - public boolean tags_enabled; - public ArrayList filters = new ArrayList<>(); + public static class TL_channels_editTitle extends TLObject { + public static final int constructor = 0x566decd0; - public static TL_messages_dialogFilters TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_dialogFilters.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_dialogFilters", constructor)); - } else { - return null; - } - } - TL_messages_dialogFilters result = new TL_messages_dialogFilters(); - result.readParams(stream, exception); - return result; - } + public InputChannel channel; + public String title; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - tags_enabled = (flags & 1) != 0; - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - DialogFilter object = DialogFilter.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - filters.add(object); - } + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = tags_enabled ? (flags | 1) : (flags & 1); - stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = filters.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - filters.get(a).serializeToStream(stream); - } + channel.serializeToStream(stream); + stream.writeString(title); } } - public static class TL_messages_getDialogFilters extends TLObject { - public static final int constructor = 0xefd48c89; + public static class TL_channels_editPhoto extends TLObject { + public static final int constructor = 0xf12e57c9; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - if (constructor == 0x1cb5c415) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - DialogFilter object = DialogFilter.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; - } - return TL_messages_dialogFilters.TLdeserialize(stream, constructor, exception); + public InputChannel channel; + public InputChatPhoto photo; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + channel.serializeToStream(stream); + photo.serializeToStream(stream); } } - public static class TL_messages_getSuggestedDialogFilters extends TLObject { - public static final int constructor = 0xa29cd42c; + public static class TL_channels_checkUsername extends TLObject { + public static final int constructor = 0x10e6bd2c; + public InputChannel channel; + public String username; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_dialogFilterSuggested object = TL_dialogFilterSuggested.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + channel.serializeToStream(stream); + stream.writeString(username); } } - public static class TL_messages_updateDialogFilter extends TLObject { - public static final int constructor = 0x1ad4a04a; + public static class TL_channels_updateUsername extends TLObject { + public static final int constructor = 0x3514b3de; - public int flags; - public int id; - public TL_dialogFilter filter; + public InputChannel channel; + public String username; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 1) != 0) { - filter.serializeToStream(stream); - } + channel.serializeToStream(stream); + stream.writeString(username); } } - public static class TL_messages_updateDialogFiltersOrder extends TLObject { - public static final int constructor = 0xc563c1e4; + public static class TL_channels_joinChannel extends TLObject { + public static final int constructor = 0x24b524c5; - public ArrayList order = new ArrayList<>(); + public InputChannel channel; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = order.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(order.get(a)); - } + channel.serializeToStream(stream); } } - public static class TL_messages_getOldFeaturedStickers extends TLObject { - public static final int constructor = 0x7ed094a1; + public static class TL_channels_leaveChannel extends TLObject { + public static final int constructor = 0xf836aa95; - public int offset; - public int limit; - public long hash; + public InputChannel channel; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_FeaturedStickers.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(offset); - stream.writeInt32(limit); - stream.writeInt64(hash); + channel.serializeToStream(stream); } } - public static class TL_messages_getReplies extends TLObject { - public static final int constructor = 0x22ddd30c; + public static class TL_channels_inviteToChannel extends TLObject { + public static final int constructor = 0x199f3a6c; - public InputPeer peer; - public int msg_id; - public int offset_id; - public int offset_date; - public int add_offset; - public int limit; - public int max_id; - public int min_id; - public long hash; + public InputChannel channel; + public ArrayList users = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_Messages.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_invitedUsers.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(msg_id); - stream.writeInt32(offset_id); - stream.writeInt32(offset_date); - stream.writeInt32(add_offset); - stream.writeInt32(limit); - stream.writeInt32(max_id); - stream.writeInt32(min_id); - stream.writeInt64(hash); + channel.serializeToStream(stream); + Vector.serialize(stream, users); } } - public static class TL_messages_getDiscussionMessage extends TLObject { - public static final int constructor = 0x446972fd; + public static class TL_channels_deleteChannel extends TLObject { + public static final int constructor = 0xc0111fe3; - public InputPeer peer; - public int msg_id; + public InputChannel channel; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_discussionMessage.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(msg_id); + channel.serializeToStream(stream); } } - public static class TL_messages_readDiscussion extends TLObject { - public static final int constructor = 0xf731a9f4; + public static class TL_channels_exportMessageLink extends TLObject { + public static final int constructor = 0xe63fadeb; - public InputPeer peer; - public int msg_id; - public int read_max_id; + public int flags; + public boolean grouped; + public boolean thread; + public InputChannel channel; + public int id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_exportedMessageLink.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(msg_id); - stream.writeInt32(read_max_id); + flags = grouped ? (flags | 1) : (flags &~ 1); + flags = thread ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + channel.serializeToStream(stream); + stream.writeInt32(id); } } - public static class TL_messages_unpinAllMessages extends TLObject { - public static final int constructor = 0xf025bc8b; + public static class TL_channels_toggleSignatures extends TLObject { + public static final int constructor = 0x418d549c; - public InputPeer peer; + public InputChannel channel; + public int flags; + public boolean signatures_enabled; + public boolean profiles_enabled; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_affectedHistory.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); + flags = signatures_enabled ? flags | 1 : flags &~ 1; + flags = profiles_enabled ? flags | 2 : flags &~ 2; + stream.writeInt32(flags); + channel.serializeToStream(stream); } } - public static class TL_messages_getExportedChatInvites extends TLObject { - public static final int constructor = 0xa2b5a3f6; + public static class TL_channels_getAdminedPublicChannels extends TLObject { + public static final int constructor = 0xf8b036af; public int flags; - public boolean revoked; - public InputPeer peer; - public InputUser admin_id; - public int offset_date; - public String offset_link; - public int limit; + public boolean by_location; + public boolean check_limit; + public boolean for_personal; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_exportedChatInvites.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_Chats.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = revoked ? (flags | 8) : (flags &~ 8); + flags = by_location ? (flags | 1) : (flags &~ 1); + flags = check_limit ? (flags | 2) : (flags &~ 2); + flags = for_personal ? (flags | 4) : (flags &~ 4); stream.writeInt32(flags); - peer.serializeToStream(stream); - admin_id.serializeToStream(stream); - if ((flags & 4) != 0) { - stream.writeInt32(offset_date); - } - if ((flags & 4) != 0) { - stream.writeString(offset_link); - } - stream.writeInt32(limit); } } - public static class TL_messages_getExportedChatInvite extends TLObject { - public static final int constructor = 0x73746f5c; + public static class TL_channels_editBanned extends TLObject { + public static final int constructor = 0x96e6cd81; - public InputPeer peer; - public String link; + public InputChannel channel; + public InputPeer participant; + public TL_chatBannedRights banned_rights; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_ExportedChatInvite.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeString(link); + channel.serializeToStream(stream); + participant.serializeToStream(stream); + banned_rights.serializeToStream(stream); } } - public static class TL_messages_editExportedChatInvite extends TLObject { - public static final int constructor = 0xbdca2f75; + public static class TL_channels_getAdminLog extends TLObject { + public static final int constructor = 0x33ddf480; public int flags; - public boolean revoked; - public InputPeer peer; - public String link; - public int expire_date; - public int usage_limit; - public boolean request_needed; - public String title; + public InputChannel channel; + public String q; + public TL_channelAdminLogEventsFilter events_filter; + public ArrayList admins = new ArrayList<>(); + public long max_id; + public long min_id; + public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_ExportedChatInvite.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_channels_adminLogResults.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = revoked ? (flags | 4) : (flags &~ 4); stream.writeInt32(flags); - peer.serializeToStream(stream); - stream.writeString(link); + channel.serializeToStream(stream); + stream.writeString(q); if ((flags & 1) != 0) { - stream.writeInt32(expire_date); + events_filter.serializeToStream(stream); } if ((flags & 2) != 0) { - stream.writeInt32(usage_limit); - } - if ((flags & 8) != 0) { - stream.writeBool(request_needed); - } - if ((flags & 16) != 0) { - stream.writeString(title); + Vector.serialize(stream, admins); } + stream.writeInt64(max_id); + stream.writeInt64(min_id); + stream.writeInt32(limit); } } - public static class TL_messages_deleteRevokedExportedChatInvites extends TLObject { - public static final int constructor = 0x56987bd5; + public static class TL_channels_setStickers extends TLObject { + public static final int constructor = 0xea8ca4f9; - public InputPeer peer; - public InputUser admin_id; + public InputChannel channel; + public InputStickerSet stickerset; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - admin_id.serializeToStream(stream); + channel.serializeToStream(stream); + stickerset.serializeToStream(stream); } } - public static class TL_messages_deleteExportedChatInvite extends TLObject { - public static final int constructor = 0xd464a42b; + public static class TL_channels_readMessageContents extends TLObject { + public static final int constructor = 0xeab5dc38; - public InputPeer peer; - public String link; + public InputChannel channel; + public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeString(link); + channel.serializeToStream(stream); + Vector.serializeInt(stream, id); } } - public static class TL_messages_getAdminsWithInvites extends TLObject { - public static final int constructor = 0x3920e6ef; + public static class TL_channels_deleteHistory extends TLObject { + public static final int constructor = 0x9baa9647; - public InputPeer peer; + public int flags; + public boolean for_everyone; + public InputChannel channel; + public int max_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_chatAdminsWithInvites.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); + flags = for_everyone ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + channel.serializeToStream(stream); + stream.writeInt32(max_id); } } - public static class TL_messages_getChatInviteImporters extends TLObject { - public static final int constructor = 0xdf04dd4e; + public static class TL_channels_searchPosts extends TLObject { + public static final int constructor = 0xd19f987b; - public int flags; - public boolean requested; - public boolean subscription_expired; - public InputPeer peer; - public String link; - public String q; - public int offset_date; - public InputUser offset_user; + public String hashtag; + public int offset_rate; + public InputPeer offset_peer; + public int offset_id; public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_chatInviteImporters.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_Messages.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = requested ? (flags | 1) : (flags &~ 1); - flags = subscription_expired ? (flags | 8) : (flags &~ 8); - stream.writeInt32(flags); - peer.serializeToStream(stream); - if ((flags & 2) != 0) { - stream.writeString(link); - } - if ((flags & 4) != 0) { - stream.writeString(q); - } - stream.writeInt32(offset_date); - offset_user.serializeToStream(stream); + stream.writeString(hashtag); + stream.writeInt32(offset_rate); + offset_peer.serializeToStream(stream); + stream.writeInt32(offset_id); stream.writeInt32(limit); } } - public static class TL_messages_hideChatJoinRequest extends TLObject { - public static final int constructor = 0x7fe7e815; + public static class TL_channels_toggleSlowMode extends TLObject { + public static final int constructor = 0xedd49ef0; - public int flags; - public boolean approved; - public InputPeer peer; - public InputUser user_id; + public InputChannel channel; + public int seconds; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = approved ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - peer.serializeToStream(stream); - user_id.serializeToStream(stream); + channel.serializeToStream(stream); + stream.writeInt32(seconds); } } - public static class TL_messages_hideAllChatJoinRequests extends TLObject { - public static final int constructor = 0xe085f4ea; - - public int flags; - public boolean approved; - public InputPeer peer; - public String link; + public static class TL_channels_getInactiveChannels extends TLObject { + public static final int constructor = 0x11e831ee; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_inactiveChats.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = approved ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - peer.serializeToStream(stream); - if ((flags & 2) != 0) { - stream.writeString(link); - } } } - public static class TL_messages_toggleNoForwards extends TLObject { - public static final int constructor = 0xb11eafa2; + public static class TL_channels_convertToGigagroup extends TLObject { + public static final int constructor = 0xb290c69; - public InputPeer peer; - public boolean enabled; + public InputChannel channel; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeBool(enabled); + channel.serializeToStream(stream); } } - public static class TL_messages_saveDefaultSendAs extends TLObject { - public static final int constructor = 0xccfddf96; + public static class TL_messages_viewSponsoredMessage extends TLObject { + public static final int constructor = 0x673ad8f1; public InputPeer peer; - public InputPeer send_as; + public byte[] random_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); - send_as.serializeToStream(stream); + stream.writeByteArray(random_id); } } - public static class TL_messages_setHistoryTTL extends TLObject { - public static final int constructor = 0xb80e5fe4; + public static class TL_messages_getSponsoredMessages extends TLObject { + public static final int constructor = 0x9bd2f439; public InputPeer peer; - public int period; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_SponsoredMessages.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); - stream.writeInt32(period); - } - } - - public static class TL_messages_deleteChat extends TLObject { - public static final int constructor = 0x5bd0ee50; - - public long chat_id; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(chat_id); - } - } - - public static class TL_messages_deletePhoneCallHistory extends TLObject { - public static final int constructor = 0xf9cbe409; - - public int flags; - public boolean revoke; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_affectedFoundMessages.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = revoke ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - } - } - - public static class TL_messages_checkHistoryImport extends TLObject { - public static final int constructor = 0x43fe19f3; - - public String import_head; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_historyImportParsed.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(import_head); } } - public static class TL_messages_initHistoryImport extends TLObject { - public static final int constructor = 0x34090c3b; + public static class TL_channels_getSendAs extends TLObject { + public static final int constructor = 0xdc770ee; public InputPeer peer; - public InputFile file; - public int media_count; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_historyImport.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_channels_sendAsPeers.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); - file.serializeToStream(stream); - stream.writeInt32(media_count); } } - public static class TL_messages_uploadImportedMedia extends TLObject { - public static final int constructor = 0x2a862092; + public static class TL_stickers_createStickerSet extends TLObject { + public static final int constructor = 0x9021ab67; - public InputPeer peer; - public long import_id; - public String file_name; - public InputMedia media; + public int flags; + public boolean masks; + public boolean emojis; + public InputUser user_id; + public String title; + public String short_name; + public InputDocument thumb; + public ArrayList stickers = new ArrayList<>(); + public String software; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return MessageMedia.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_StickerSet.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt64(import_id); - stream.writeString(file_name); - media.serializeToStream(stream); + flags = masks ? (flags | 1) : (flags &~ 1); + flags = emojis ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + user_id.serializeToStream(stream); + stream.writeString(title); + stream.writeString(short_name); + if ((flags & 4) != 0) { + thumb.serializeToStream(stream); + } + Vector.serialize(stream, stickers); + if ((flags & 8) != 0) { + stream.writeString(software); + } } } - public static class TL_messages_startHistoryImport extends TLObject { - public static final int constructor = 0xb43df344; + public static class TL_stickers_removeStickerFromSet extends TLObject { + public static final int constructor = 0xf7760f51; - public InputPeer peer; - public long import_id; + public InputDocument sticker; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_StickerSet.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt64(import_id); + sticker.serializeToStream(stream); } } - public static class TL_messages_checkHistoryImportPeer extends TLObject { - public static final int constructor = 0x5dc60f03; + public static class TL_stickers_changeStickerPosition extends TLObject { + public static final int constructor = 0xffb6d4ca; - public InputPeer peer; + public InputDocument sticker; + public int position; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_checkedHistoryImportPeer.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_StickerSet.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); + sticker.serializeToStream(stream); + stream.writeInt32(position); } } - public static class TL_messages_setChatTheme extends TLObject { - public static final int constructor = 0xe63be13f; + public static class TL_stickers_addStickerToSet extends TLObject { + public static final int constructor = 0x8653febe; - public InputPeer peer; - public String emoticon; + public InputStickerSet stickerset; + public TL_inputStickerSetItem sticker; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_StickerSet.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeString(emoticon); + stickerset.serializeToStream(stream); + sticker.serializeToStream(stream); } } - public static class TL_help_getAppChangelog extends TLObject { - public static final int constructor = 0x9010ef6f; + public static class TL_stickers_setStickerSetThumb extends TLObject { + public static final int constructor = 0xa76a5392; - public String prev_app_version; + public int flags; + public InputStickerSet stickerset; + public InputDocument thumb; + public long thumb_document_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_StickerSet.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(prev_app_version); + stream.writeInt32(flags); + stickerset.serializeToStream(stream); + if ((flags & 1) != 0) { + thumb.serializeToStream(stream); + } + if ((flags & 2) != 0) { + stream.writeInt64(thumb_document_id); + } } } - public static class TL_messages_toggleStickerSets extends TLObject { - public static final int constructor = 0xb5052fea; + public static class TL_stickers_changeSticker extends TLObject { + public static final int constructor = 0xf5537ebc; public int flags; - public boolean uninstall; - public boolean archive; - public boolean unarchive; - public ArrayList stickersets = new ArrayList<>(); + public InputDocument sticker; + public String emoji; + public TL_maskCoords mask_coords; + public String keywords; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_StickerSet.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = uninstall ? (flags | 1) : (flags &~ 1); - flags = archive ? (flags | 2) : (flags &~ 2); - flags = unarchive ? (flags | 4) : (flags &~ 4); stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = stickersets.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stickersets.get(a).serializeToStream(stream); + sticker.serializeToStream(stream); + if ((flags & 1) != 0) { + stream.writeString(emoji); + } + if ((flags & 2) != 0) { + mask_coords.serializeToStream(stream); + } + if ((flags & 4) != 0) { + stream.writeString(keywords); } } } - public static class TL_messages_uploadEncryptedFile extends TLObject { - public static final int constructor = 0x5057c497; + public static class TL_stickers_renameStickerSet extends TLObject { + public static final int constructor = 0x124b1c00; - public TL_inputEncryptedChat peer; - public InputEncryptedFile file; + public InputStickerSet stickerset; + public String title; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return EncryptedFile.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_StickerSet.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - file.serializeToStream(stream); + stickerset.serializeToStream(stream); + stream.writeString(title); } } - public static class TL_messages_searchStickerSets extends TLObject { - public static final int constructor = 0x35705b8a; + public static class TL_stickers_deleteStickerSet extends TLObject { + public static final int constructor = 0x87704394; - public int flags; - public boolean exclude_featured; - public String q; - public long hash; + public InputStickerSet stickerset; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_FoundStickerSets.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = exclude_featured ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeString(q); - stream.writeInt64(hash); + stickerset.serializeToStream(stream); } } - public static class TL_messages_searchEmojiStickerSets extends TLObject { - public static final int constructor = 0x92b4494c; + public static class TL_stickers_replaceSticker extends TLObject { + public static final int constructor = 0x4696459a; - public int flags; - public boolean exclude_featured; - public String q; - public long hash; + public InputDocument sticker; + public TL_inputStickerSetItem new_sticker; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_FoundStickerSets.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_StickerSet.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = exclude_featured ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeString(q); - stream.writeInt64(hash); + sticker.serializeToStream(stream); + new_sticker.serializeToStream(stream); } } - public static class TL_messages_markDialogUnread extends TLObject { - public static final int constructor = 0xc286d98f; + public static class TL_messages_getMyStickers extends TLObject { + public static final int constructor = 0xd0b5e1fc; - public int flags; - public boolean unread; - public InputDialogPeer peer; + public long offset_id; + public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_myStickers.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - peer.serializeToStream(stream); + stream.writeInt64(offset_id); + stream.writeInt32(limit); } } - public static class TL_messages_getDialogUnreadMarks extends TLObject { - public static final int constructor = 0x22e24e22; + public static class TL_messages_myStickers extends TLObject { + public static final int constructor = 0xfaff629d; + public int count; + public ArrayList sets = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - DialogPeer object = DialogPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; + public static TL_messages_myStickers TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_messages_myStickers.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_myStickers", constructor)); + } else { + return null; } - vector.objects.add(object); } - return vector; - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + TL_messages_myStickers result = new TL_messages_myStickers(); + result.readParams(stream, exception); + return result; } - } - - public static class TL_help_setBotUpdatesStatus extends TLObject { - public static final int constructor = 0xec22cfcd; - - public int pending_updates_count; - public String message; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + count = stream.readInt32(exception); + sets = Vector.deserialize(stream, StickerSetCovered::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(pending_updates_count); - stream.writeString(message); + stream.writeInt32(count); + Vector.serialize(stream, sets); } } - public static class TL_messages_reorderStickerSets extends TLObject { - public static final int constructor = 0x78337739; + public static class TL_stickers_checkShortName extends TLObject { + public static final int constructor = 0x284b3639; - public int flags; - public boolean masks; - public boolean emojis; - public ArrayList order = new ArrayList<>(); + public String short_name; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = masks ? (flags | 1) : (flags &~ 1); - flags = emojis ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = order.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(order.get(a)); - } + stream.writeString(short_name); } } - public static class TL_messages_getEmojiStickers extends TLObject { - public static final int constructor = 0xfbfca18f; + public static class TL_stickers_suggestShortName extends TLObject { + public static final int constructor = 0x4dafc503; - public long hash; + public String title; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_AllStickers.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_stickers_suggestedShortName.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(hash); + stream.writeString(title); } } - public static class TL_messages_getFeaturedEmojiStickers extends TLObject { - public static final int constructor = 0xecf6736; + public static class TL_payments_getPaymentForm extends TLObject { + public static final int constructor = 0x37148dbb; - public long hash; + public int flags; + public InputInvoice invoice; + public TL_dataJSON theme_params; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_FeaturedStickers.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return PaymentForm.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(hash); + stream.writeInt32(flags); + invoice.serializeToStream(stream); + if ((flags & 1) != 0) { + theme_params.serializeToStream(stream); + } } } - public static class TL_messages_getDocumentByHash extends TLObject { - public static final int constructor = 0x338e2464; + public static class TL_payments_getPaymentReceipt extends TLObject { + public static final int constructor = 0x2478d1cc; - public byte[] sha256; - public int size; - public String mime_type; + public InputPeer peer; + public int msg_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Document.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return PaymentReceipt.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeByteArray(sha256); - stream.writeInt32(size); - stream.writeString(mime_type); + peer.serializeToStream(stream); + stream.writeInt32(msg_id); } } - public static class TL_help_getRecentMeUrls extends TLObject { - public static final int constructor = 0x3dc0f114; + public static class TL_payments_validateRequestedInfo extends TLObject { + public static final int constructor = 0xb6c8f12b; - public String referer; + public int flags; + public boolean save; + public InputInvoice invoice; + public TL_paymentRequestedInfo info; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_help_recentMeUrls.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_payments_validatedRequestedInfo.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(referer); + flags = save ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + invoice.serializeToStream(stream); + info.serializeToStream(stream); } } - public static class TL_help_getDeepLinkInfo extends TLObject { - public static final int constructor = 0x3fedc75f; + public static class TL_payments_sendPaymentForm extends TLObject { + public static final int constructor = 0x2d03522f; - public String path; + public int flags; + public long form_id; + public InputInvoice invoice; + public String requested_info_id; + public String shipping_option_id; + public InputPaymentCredentials credentials; + public long tip_amount; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return help_DeepLinkInfo.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return payments_PaymentResult.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(path); + stream.writeInt32(flags); + stream.writeInt64(form_id); + invoice.serializeToStream(stream); + if ((flags & 1) != 0) { + stream.writeString(requested_info_id); + } + if ((flags & 2) != 0) { + stream.writeString(shipping_option_id); + } + credentials.serializeToStream(stream); + if ((flags & 4) != 0) { + stream.writeInt64(tip_amount); + } } } - public static class TL_channels_readHistory extends TLObject { - public static final int constructor = 0xcc104937; + public static class TL_help_supportName extends TLObject { + public static final int constructor = 0x8c05f1c9; - public InputChannel channel; - public int max_id; + public String name; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public static TL_help_supportName TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_help_supportName.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_help_supportName", constructor)); + } else { + return null; + } + } + TL_help_supportName result = new TL_help_supportName(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + name = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeInt32(max_id); + stream.writeString(name); } } - public static class TL_channels_deleteMessages extends TLObject { - public static final int constructor = 0x84c1fd4e; + public static class TL_inputThemeSettings extends TLObject { + public static final int constructor = 0x8fde504f; - public InputChannel channel; - public ArrayList id = new ArrayList<>(); + public int flags; + public boolean message_colors_animated; + public BaseTheme base_theme; + public int accent_color; + public int outbox_accent_color; + public ArrayList message_colors = new ArrayList<>(); + public InputWallPaper wallpaper; + public WallPaperSettings wallpaper_settings; - public static TL_channels_deleteMessages TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_channels_deleteMessages.constructor != constructor) { + public static TL_inputThemeSettings TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_inputThemeSettings.constructor != constructor) { if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_channels_deleteMessages", constructor)); + throw new RuntimeException(String.format("can't parse magic %x in TL_inputThemeSettings", constructor)); } else { return null; } } - TL_channels_deleteMessages result = new TL_channels_deleteMessages(); + TL_inputThemeSettings result = new TL_inputThemeSettings(); result.readParams(stream, exception); return result; } - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_affectedMessages.TLdeserialize(stream, constructor, exception); - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - channel = InputChannel.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + message_colors_animated = (flags & 4) != 0; + base_theme = BaseTheme.TLdeserialize(stream, stream.readInt32(exception), exception); + accent_color = stream.readInt32(exception); + if ((flags & 8) != 0) { + outbox_accent_color = stream.readInt32(exception); } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - id.add(stream.readInt32(exception)); + if ((flags & 1) != 0) { + message_colors = Vector.deserializeInt(stream, exception); + } + if ((flags & 2) != 0) { + wallpaper = InputWallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 2) != 0) { + wallpaper_settings = WallPaperSettings.TLdeserialize(stream, stream.readInt32(exception), exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); + flags = message_colors_animated ? (flags | 4) : (flags &~ 4); + stream.writeInt32(flags); + base_theme.serializeToStream(stream); + stream.writeInt32(accent_color); + if ((flags & 8) != 0) { + stream.writeInt32(outbox_accent_color); + } + if ((flags & 1) != 0) { + Vector.serializeInt(stream, message_colors); + } + if ((flags & 2) != 0) { + wallpaper.serializeToStream(stream); + } + if ((flags & 2) != 0) { + wallpaper_settings.serializeToStream(stream); } } } - public static class TL_channels_deleteParticipantHistory extends TLObject { - public static final int constructor = 0x367544db; + public static class TL_payments_assignPlayMarketTransaction extends TLObject { + public static final int constructor = 0xdffd50d3; - public InputChannel channel; - public InputPeer participant; + public TL_dataJSON receipt; + public InputStorePaymentPurpose purpose; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_affectedHistory.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - participant.serializeToStream(stream); + receipt.serializeToStream(stream); + purpose.serializeToStream(stream); } } - public static class TL_channels_reportSpam extends TLObject { - public static final int constructor = 0xf44a8315; - - public InputChannel channel; - public InputPeer participant; - public ArrayList id = new ArrayList<>(); - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } + public static abstract class InputStorePaymentPurpose extends TLObject { - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - channel.serializeToStream(stream); - participant.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); + public static InputStorePaymentPurpose TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + InputStorePaymentPurpose result = null; + switch (constructor) { + case TL_inputStorePaymentGiftPremium.constructor: + result = new TL_inputStorePaymentGiftPremium(); + break; + case TL_inputStorePaymentPremiumGiftCode.constructor: + result = new TL_inputStorePaymentPremiumGiftCode(); + break; + case TL_inputStorePaymentPremiumSubscription.constructor: + result = new TL_inputStorePaymentPremiumSubscription(); + break; + case TL_inputStorePaymentPremiumGiveaway.constructor: + result = new TL_inputStorePaymentPremiumGiveaway(); + break; + case TL_inputStorePaymentStarsGift.constructor: + result = new TL_inputStorePaymentStarsGift(); + break; + case TL_inputStorePaymentStarsTopup.constructor: + result = new TL_inputStorePaymentStarsTopup(); + break; + case TL_inputStorePaymentStarsGiveaway.constructor: + result = new TL_inputStorePaymentStarsGiveaway(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in InputStorePaymentPurpose", constructor)); } + if (result != null) { + result.readParams(stream, exception); + } + return result; } } - public static class TL_channels_getMessages extends TLObject { - public static final int constructor = 0x93d7b347; + public static class TL_inputStorePaymentPremiumSubscription extends InputStorePaymentPurpose { + public static final int constructor = 0xa6751e66; - public InputChannel channel; - public ArrayList id = new ArrayList<>(); + public int flags; + public boolean restore; + public boolean upgrade; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_Messages.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + restore = (flags & 1) != 0; + upgrade = (flags & 2) != 0; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } + flags = restore ? (flags | 1) : (flags &~ 1); + flags = upgrade ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); } } - public static class TL_channels_getParticipants extends TLObject { - public static final int constructor = 0x77ced9d0; + public static class TL_inputStorePaymentGiftPremium extends InputStorePaymentPurpose { + public static final int constructor = 0x616f7fe8; - public InputChannel channel; - public ChannelParticipantsFilter filter; - public int offset; - public int limit; - public long hash; + public InputUser user_id; + public String currency; + public long amount; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return channels_ChannelParticipants.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + user_id = InputUser.TLdeserialize(stream, stream.readInt32(exception), exception); + currency = stream.readString(exception); + amount = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - filter.serializeToStream(stream); - stream.writeInt32(offset); - stream.writeInt32(limit); - stream.writeInt64(hash); + user_id.serializeToStream(stream); + stream.writeString(currency); + stream.writeInt64(amount); } } - public static class TL_channels_getParticipant extends TLObject { - public static final int constructor = 0xa0ab6cc6; - - public InputChannel channel; - public InputPeer participant; + public static class TL_payments_getSavedInfo extends TLObject { + public static final int constructor = 0x227d824b; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_channels_channelParticipant.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_payments_savedInfo.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - participant.serializeToStream(stream); } } - public static class TL_channels_getChannels extends TLObject { - public static final int constructor = 0xa7f6bbb; + public static class TL_payments_clearSavedInfo extends TLObject { + public static final int constructor = 0xd83d70c1; - public ArrayList id = new ArrayList<>(); + public int flags; + public boolean credentials; + public boolean info; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_chats.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - id.get(a).serializeToStream(stream); - } + flags = credentials ? (flags | 1) : (flags &~ 1); + flags = info ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); } } - public static class TL_channels_getFullChannel extends TLObject { - public static final int constructor = 0x8736a09; + public static class TL_payments_getBankCardData extends TLObject { + public static final int constructor = 0x2e79d779; - public InputChannel channel; + public String number; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_chatFull.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_payments_bankCardData.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); + stream.writeString(number); } } - public static class TL_channels_createChannel extends TLObject { - public static final int constructor = 0x91006707; + public static class TL_langpack_getLangPack extends TLObject { + public static final int constructor = 0x9ab5c58e; - public int flags; - public boolean broadcast; - public boolean megagroup; - public boolean for_import; - public boolean forum; - public String title; - public String about; - public InputGeoPoint geo_point; - public String address; - public int ttl_period; + public String lang_code; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_langPackDifference.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = broadcast ? (flags | 1) : (flags &~ 1); - flags = megagroup ? (flags | 2) : (flags &~ 2); - flags = for_import ? (flags | 8) : (flags &~ 8); - flags = forum ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeString(title); - stream.writeString(about); - if ((flags & 4) != 0) { - geo_point.serializeToStream(stream); - } - if ((flags & 4) != 0) { - stream.writeString(address); - } - if ((flags & 16) != 0) { - stream.writeInt32(ttl_period); - } + stream.writeString(lang_code); } } - public static class TL_channels_editAdmin extends TLObject { - public static final int constructor = 0xd33c8902; + public static class TL_langpack_getStrings extends TLObject { + public static final int constructor = 0x2e1ee318; - public InputChannel channel; - public InputUser user_id; - public TL_chatAdminRights admin_rights; - public String rank; + public String lang_code; + public ArrayList keys = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, LangPackString::TLdeserialize); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - user_id.serializeToStream(stream); - admin_rights.serializeToStream(stream); - stream.writeString(rank); + stream.writeString(lang_code); + Vector.serializeString(stream, keys); } } - public static class TL_channels_editTitle extends TLObject { - public static final int constructor = 0x566decd0; + public static class TL_langpack_getDifference extends TLObject { + public static final int constructor = 0xcd984aa5; - public InputChannel channel; - public String title; + public String lang_pack; + public String lang_code; + public int from_version; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_langPackDifference.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeString(title); + stream.writeString(lang_pack); + stream.writeString(lang_code); + stream.writeInt32(from_version); } } - public static class TL_channels_editPhoto extends TLObject { - public static final int constructor = 0xf12e57c9; - - public InputChannel channel; - public InputChatPhoto photo; + public static class TL_langpack_getLanguages extends TLObject { + public static final int constructor = 0x800fd57d; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, TL_langPackLanguage::TLdeserialize); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - photo.serializeToStream(stream); } } - public static class TL_channels_checkUsername extends TLObject { - public static final int constructor = 0x10e6bd2c; + public static class TL_langpack_getLanguage extends TLObject { + public static final int constructor = 0x6a596502; - public InputChannel channel; - public String username; + public String lang_pack; + public String lang_code; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_langPackLanguage.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeString(username); + stream.writeString(lang_pack); + stream.writeString(lang_code); } } - public static class TL_channels_updateUsername extends TLObject { - public static final int constructor = 0x3514b3de; + public static class TL_folders_editPeerFolders extends TLObject { + public static final int constructor = 0x6847d0ab; - public InputChannel channel; - public String username; + public ArrayList folder_peers = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeString(username); + Vector.serialize(stream, folder_peers); } } - public static class TL_channels_joinChannel extends TLObject { - public static final int constructor = 0x24b524c5; + public static class TL_folders_deleteFolder extends TLObject { + public static final int constructor = 0x1c295881; - public InputChannel channel; + public int folder_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); + stream.writeInt32(folder_id); } } - public static class TL_channels_leaveChannel extends TLObject { - public static final int constructor = 0xf836aa95; + //manually created - public InputChannel channel; + public static class TL_photoPathSize extends PhotoSize { + public static final int constructor = 0xd8214d41; + public Path svgPath; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + type = stream.readString(exception); + bytes = stream.readByteArray(exception); + w = h = 512; + svgPath = SvgHelper.doPath(SvgHelper.decompress(bytes)); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); + stream.writeString(type); + stream.writeByteArray(bytes); } } - public static class TL_channels_inviteToChannel extends TLObject { - public static final int constructor = 0x199f3a6c; + //RichText start + public static abstract class RichText extends TLObject { + public String url; + public long webpage_id; + public String email; + public RichText text; + public ArrayList texts = new ArrayList<>(); + public RichText parentRichText; - public InputChannel channel; - public ArrayList users = new ArrayList<>(); + public static RichText TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + RichText result = null; + switch (constructor) { + case 0x1ccb966a: + result = new TL_textPhone(); + break; + case 0xc7fb5e01: + result = new TL_textSuperscript(); + break; + case 0x81ccf4f: + result = new TL_textImage(); + break; + case 0xc12622c4: + result = new TL_textUnderline(); + break; + case 0xed6a8504: + result = new TL_textSubscript(); + break; + case 0x3c2884c1: + result = new TL_textUrl(); + break; + case 0x35553762: + result = new TL_textAnchor(); + break; + case 0xdc3d824f: + result = new TL_textEmpty(); + break; + case 0xde5a0dd6: + result = new TL_textEmail(); + break; + case 0x744694e0: + result = new TL_textPlain(); + break; + case 0x6724abc4: + result = new TL_textBold(); + break; + case 0x9bf8bb95: + result = new TL_textStrike(); + break; + case 0x7e6260d7: + result = new TL_textConcat(); + break; + case 0xd912a59c: + result = new TL_textItalic(); + break; + case 0x34b8621: + result = new TL_textMarked(); + break; + case 0x6c3f19b9: + result = new TL_textFixed(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in RichText", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_invitedUsers.TLdeserialize(stream, constructor, exception); + public static class TL_pageBlockList_layer82 extends TL_pageBlockList { + public static final int constructor = 0x3a58c7f4; + + public void readParams(InputSerializedData stream, boolean exception) { + ordered = stream.readBool(exception); + int magic = stream.readInt32(exception); + if (magic != 0x1cb5c415) { + if (exception) { + throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + } + return; + } + int count = stream.readInt32(exception); + for (int a = 0; a < count; a++) { + RichText object = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + if (object == null) { + return; + } + TL_pageListItemText item = new TL_pageListItemText(); + item.text = object; + items.add(item); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); + stream.writeBool(ordered); stream.writeInt32(0x1cb5c415); - int count = users.size(); + int count = items.size(); stream.writeInt32(count); for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); + TL_pageListItemText item = (TL_pageListItemText) items.get(a); + item.text.serializeToStream(stream); } } } + //RichText end - public static class TL_channels_deleteChannel extends TLObject { - public static final int constructor = 0xc0111fe3; - - public InputChannel channel; + public static class TL_channels_sendAsPeers extends TLObject { + public static final int constructor = 0xf496b0c6; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } + public ArrayList peers = new ArrayList<>(); + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - channel.serializeToStream(stream); + public static TL_channels_sendAsPeers TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_channels_sendAsPeers.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_channels_sendAsPeers", constructor)); + } else { + return null; + } + } + TL_channels_sendAsPeers result = new TL_channels_sendAsPeers(); + result.readParams(stream, exception); + return result; } - } - - public static class TL_channels_exportMessageLink extends TLObject { - public static final int constructor = 0xe63fadeb; - - public int flags; - public boolean grouped; - public boolean thread; - public InputChannel channel; - public int id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_exportedMessageLink.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + peers = Vector.deserialize(stream, TL_sendAsPeer::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = grouped ? (flags | 1) : (flags &~ 1); - flags = thread ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - channel.serializeToStream(stream); - stream.writeInt32(id); + Vector.serialize(stream, peers); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } - public static class TL_channels_toggleSignatures extends TLObject { - public static final int constructor = 0x418d549c; + public static class TL_sendAsPeer extends TLObject { + public static final int constructor = 0xb81c7034; - public InputChannel channel; public int flags; - public boolean signatures_enabled; - public boolean profiles_enabled; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } + public boolean premium_required; + public Peer peer; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = signatures_enabled ? flags | 1 : flags &~ 1; - flags = profiles_enabled ? flags | 2 : flags &~ 2; - stream.writeInt32(flags); - channel.serializeToStream(stream); + public static TL_sendAsPeer TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_sendAsPeer.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_sendAsPeer", constructor)); + } else { + return null; + } + } + TL_sendAsPeer result = new TL_sendAsPeer(); + result.readParams(stream, exception); + return result; } - } - - public static class TL_channels_getAdminedPublicChannels extends TLObject { - public static final int constructor = 0xf8b036af; - - public int flags; - public boolean by_location; - public boolean check_limit; - public boolean for_personal; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_Chats.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + premium_required = (flags & 1) != 0; + peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = by_location ? (flags | 1) : (flags &~ 1); - flags = check_limit ? (flags | 2) : (flags &~ 2); - flags = for_personal ? (flags | 4) : (flags &~ 4); + flags = premium_required ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); + peer.serializeToStream(stream); } } - public static class TL_channels_editBanned extends TLObject { - public static final int constructor = 0x96e6cd81; - - public InputChannel channel; - public InputPeer participant; - public TL_chatBannedRights banned_rights; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - channel.serializeToStream(stream); - participant.serializeToStream(stream); - banned_rights.serializeToStream(stream); - } - } - - public static class TL_channels_getAdminLog extends TLObject { - public static final int constructor = 0x33ddf480; - + //MessageMedia start + public static abstract class MessageMedia extends TLObject { + public byte[] bytes; + public Audio audio_unused; public int flags; - public InputChannel channel; - public String q; - public TL_channelAdminLogEventsFilter events_filter; - public ArrayList admins = new ArrayList<>(); - public long max_id; - public long min_id; - public int limit; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_channels_adminLogResults.TLdeserialize(stream, constructor, exception); - } + public boolean shipping_address_requested; + public Photo photo; + public GeoPoint geo; + public int heading; + public String currency; + public String description; + public int receipt_msg_id; + public long total_amount; + public String start_param; + public String title; + public String address; + public String provider; + public String venue_id; + public Video video_unused; + public Document document; + public ArrayList alt_documents = new ArrayList<>(); + public Photo video_cover; + public int video_timestamp; + public String captionLegacy; + public TL_game game; + public String phone_number; + public String first_name; + public String last_name; + public String vcard; + public long user_id; + public WebPage webpage; + public String venue_type; + public boolean test; + public int period; + public int ttl_seconds; + public int proximity_notification_radius; + public boolean nopremium; + public boolean spoiler; + public int id; + public TL_stories.StoryItem storyItem; + public boolean via_mention; + public Peer peer; + public boolean force_large_media; + public boolean force_small_media; + public boolean manual; + public boolean safe; + public boolean video; + public boolean round; + public boolean voice; + public long stars_amount; + public ArrayList extended_media = new ArrayList<>(); + public String attachPath; //custom for bot previews - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - channel.serializeToStream(stream); - stream.writeString(q); - if ((flags & 1) != 0) { - events_filter.serializeToStream(stream); + public static MessageMedia TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + MessageMedia result = null; + switch (constructor) { + case 0x29632a36: + result = new TL_messageMediaUnsupported_old(); + break; + case 0xc6b68300: + result = new TL_messageMediaAudio_layer45(); + break; + case 0xc8c45a2a: + result = new TL_messageMediaPhoto_old(); + break; + case 0x84551347: + result = new TL_messageMediaInvoice_layer145(); + break; + case 0xf6a548d3: + result = new TL_messageMediaInvoice(); + break; + case 0x9f84f49e: + result = new TL_messageMediaUnsupported(); + break; + case 0x3ded6320: + result = new TL_messageMediaEmpty(); + break; + case 0x68cb6283: + result = new TL_messageMediaStory(); + break; + case 0xcbb20d88: + result = new TL_messageMediaStory_layer162(); + break; + case 0xc79aee1d: + result = new MessageMediaStoryFull(); //custom + break; + case 0xc79aee1f: + result = new MessageMediaStoryFull_old(); //custom + break; + case 0x7912b71f: + result = new TL_messageMediaVenue_layer71(); + break; + case 0xb940c666: + result = new TL_messageMediaGeoLive(); + break; + case 0x7c3c2609: + result = new TL_messageMediaGeoLive_layer119(); + break; + case 0x2ec0533f: + result = new TL_messageMediaVenue(); + break; + case 0xa2d24290: + result = new TL_messageMediaVideo_old(); + break; + case 0x2fda2204: + result = new TL_messageMediaDocument_old(); + break; + case 0xf3e02ea8: + result = new TL_messageMediaDocument_layer68(); + break; + case 0xfdb19008: + result = new TL_messageMediaGame(); + break; + case 0x7c4414d3: + result = new TL_messageMediaDocument_layer74(); + break; + case 0x5e7d2f39: + result = new TL_messageMediaContact_layer81(); + break; + case 0x695150d7: + result = new TL_messageMediaPhoto(); + break; + case 0x4bd6e798: + result = new TL_messageMediaPoll(); + break; + case TL_messageMediaGiveawayResults.constructor: + result = new TL_messageMediaGiveawayResults(); + break; + case TL_messageMediaGiveawayResults_layer186.constructor: + result = new TL_messageMediaGiveawayResults_layer186(); + break; + case TL_messageMediaGiveaway.constructor: + result = new TL_messageMediaGiveaway(); + break; + case TL_messageMediaGiveaway_layer186.constructor: + result = new TL_messageMediaGiveaway_layer186(); + break; + case TL_messageMediaGiveaway_layer167.constructor: + result = new TL_messageMediaGiveaway_layer167(); + break; + case TL_messageMediaPaidMedia.constructor: + result = new TL_messageMediaPaidMedia(); + break; + case 0xb5223b0f: + result = new TL_messageMediaPhoto_layer74(); + break; + case 0x3d8ce53d: + result = new TL_messageMediaPhoto_layer68(); + break; + case 0x5bcf1675: + result = new TL_messageMediaVideo_layer45(); + break; + case 0x3f7ee58b: + result = new TL_messageMediaDice(); + break; + case 0x638fe46b: + result = new TL_messageMediaDice_layer111(); + break; + case 0x56e0d474: + result = new TL_messageMediaGeo(); + break; + case 0xa32dd600: + result = new TL_messageMediaWebPage_layer165(); + break; + case 0xddf10c3b: + result = new TL_messageMediaWebPage(); + break; + case TL_messageMediaDocument.constructor: + result = new TL_messageMediaDocument(); + break; + case TL_messageMediaDocument_layer197_2.constructor: + result = new TL_messageMediaDocument_layer197_2(); + break; + case TL_messageMediaDocument_layer197.constructor: + result = new TL_messageMediaDocument_layer197(); + break; + case TL_messageMediaDocument_layer187.constructor: + result = new TL_messageMediaDocument_layer187(); + break; + case 0x9cb070d7: + result = new TL_messageMediaDocument_layer159(); + break; + case 0xcbf24940: + result = new TL_messageMediaContact_layer131(); + break; + case 0x70322949: + result = new TL_messageMediaContact(); + break; } - if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = admins.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - admins.get(a).serializeToStream(stream); + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in MessageMedia", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + if (result.video_unused != null) { + TL_messageMediaDocument mediaDocument = new TL_messageMediaDocument(); + if (result.video_unused instanceof TL_videoEncrypted) { + mediaDocument.document = new TL_documentEncrypted(); + mediaDocument.document.key = result.video_unused.key; + mediaDocument.document.iv = result.video_unused.iv; + } else { + mediaDocument.document = new TL_document(); + } + mediaDocument.flags = 3; + mediaDocument.document.file_reference = new byte[0]; + mediaDocument.document.id = result.video_unused.id; + mediaDocument.document.access_hash = result.video_unused.access_hash; + mediaDocument.document.date = result.video_unused.date; + if (result.video_unused.mime_type != null) { + mediaDocument.document.mime_type = result.video_unused.mime_type; + } else { + mediaDocument.document.mime_type = "video/mp4"; + } + mediaDocument.document.size = result.video_unused.size; + mediaDocument.document.thumbs.add(result.video_unused.thumb); + mediaDocument.document.dc_id = result.video_unused.dc_id; + mediaDocument.captionLegacy = result.captionLegacy; + TL_documentAttributeVideo attributeVideo = new TL_documentAttributeVideo(); + attributeVideo.w = result.video_unused.w; + attributeVideo.h = result.video_unused.h; + attributeVideo.duration = result.video_unused.duration; + mediaDocument.document.attributes.add(attributeVideo); + result = mediaDocument; + if (mediaDocument.captionLegacy == null) { + mediaDocument.captionLegacy = ""; + } + } else if (result.audio_unused != null) { + TL_messageMediaDocument mediaDocument = new TL_messageMediaDocument(); + if (result.audio_unused instanceof TL_audioEncrypted) { + mediaDocument.document = new TL_documentEncrypted(); + mediaDocument.document.key = result.audio_unused.key; + mediaDocument.document.iv = result.audio_unused.iv; + } else { + mediaDocument.document = new TL_document(); + } + mediaDocument.flags = 3; + mediaDocument.document.file_reference = new byte[0]; + mediaDocument.document.id = result.audio_unused.id; + mediaDocument.document.access_hash = result.audio_unused.access_hash; + mediaDocument.document.date = result.audio_unused.date; + if (result.audio_unused.mime_type != null) { + mediaDocument.document.mime_type = result.audio_unused.mime_type; + } else { + mediaDocument.document.mime_type = "audio/ogg"; + } + mediaDocument.document.size = result.audio_unused.size; + TL_photoSizeEmpty thumb = new TL_photoSizeEmpty(); + thumb.type = "s"; + mediaDocument.document.thumbs.add(thumb); + mediaDocument.document.dc_id = result.audio_unused.dc_id; + mediaDocument.captionLegacy = result.captionLegacy; + TL_documentAttributeAudio attributeAudio = new TL_documentAttributeAudio(); + attributeAudio.duration = result.audio_unused.duration; + attributeAudio.voice = true; + mediaDocument.document.attributes.add(attributeAudio); + result = mediaDocument; + if (mediaDocument.captionLegacy == null) { + mediaDocument.captionLegacy = ""; + } } } - stream.writeInt64(max_id); - stream.writeInt64(min_id); - stream.writeInt32(limit); - } - } - - public static class TL_channels_setStickers extends TLObject { - public static final int constructor = 0xea8ca4f9; - - public InputChannel channel; - public InputStickerSet stickerset; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - channel.serializeToStream(stream); - stickerset.serializeToStream(stream); - } - } - - public static class TL_channels_readMessageContents extends TLObject { - public static final int constructor = 0xeab5dc38; - - public InputChannel channel; - public ArrayList id = new ArrayList<>(); - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + return result; } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); + public Document getDocument() { + if (!alt_documents.isEmpty() && !MessagesController.isStoryQualityFull()) { + return alt_documents.get(0); } + return document; } } + //MessageMedia end - public static class TL_channels_deleteHistory extends TLObject { - public static final int constructor = 0x9baa9647; - - public int flags; - public boolean for_everyone; - public InputChannel channel; - public int max_id; + //PageBlock start + public static class TL_pageBlockAuthorDate_layer60 extends TL_pageBlockAuthorDate { + public static final int constructor = 0x3d5b64f2; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + String authorString = stream.readString(exception); + author = new TL_textPlain(); + ((TL_textPlain) author).text = authorString; + published_date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = for_everyone ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - channel.serializeToStream(stream); - stream.writeInt32(max_id); + stream.writeString(((TL_textPlain) author).text); + stream.writeInt32(published_date); } } - public static class TL_channels_searchPosts extends TLObject { - public static final int constructor = 0xd19f987b; - - public String hashtag; - public int offset_rate; - public InputPeer offset_peer; - public int offset_id; - public int limit; + public static class TL_pageBlockEmbedPost_layer82 extends TL_pageBlockEmbedPost { + public static final int constructor = 0x292c7be9; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_Messages.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + url = stream.readString(exception); + webpage_id = stream.readInt64(exception); + author_photo_id = stream.readInt64(exception); + author = stream.readString(exception); + date = stream.readInt32(exception); + blocks = Vector.deserialize(stream, PageBlock::TLdeserialize, exception); + caption = new TL_pageCaption(); + caption.text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + caption.credit = new TL_textEmpty(); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(hashtag); - stream.writeInt32(offset_rate); - offset_peer.serializeToStream(stream); - stream.writeInt32(offset_id); - stream.writeInt32(limit); + stream.writeString(url); + stream.writeInt64(webpage_id); + stream.writeInt64(author_photo_id); + stream.writeString(author); + stream.writeInt32(date); + Vector.serialize(stream, blocks); + caption.text.serializeToStream(stream); } } - public static class TL_channels_toggleSlowMode extends TLObject { - public static final int constructor = 0xedd49ef0; - - public InputChannel channel; - public int seconds; + public static class TL_pageBlockEmbed_layer82 extends TL_pageBlockEmbed { + public static final int constructor = 0xcde200d1; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + full_width = (flags & 1) != 0; + allow_scrolling = (flags & 8) != 0; + if ((flags & 2) != 0) { + url = stream.readString(exception); + } + if ((flags & 4) != 0) { + html = stream.readString(exception); + } + if ((flags & 16) != 0) { + poster_photo_id = stream.readInt64(exception); + } + w = stream.readInt32(exception); + h = stream.readInt32(exception); + caption = new TL_pageCaption(); + caption.text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + caption.credit = new TL_textEmpty(); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeInt32(seconds); + flags = full_width ? (flags | 1) : (flags &~ 1); + flags = allow_scrolling ? (flags | 8) : (flags &~ 8); + stream.writeInt32(flags); + if ((flags & 2) != 0) { + stream.writeString(url); + } + if ((flags & 4) != 0) { + stream.writeString(html); + } + if ((flags & 16) != 0) { + stream.writeInt64(poster_photo_id); + } + stream.writeInt32(w); + stream.writeInt32(h); + caption.text.serializeToStream(stream); } } - public static class TL_channels_getInactiveChannels extends TLObject { - public static final int constructor = 0x11e831ee; - + public static class TL_pageBlockVideo_layer82 extends TL_pageBlockVideo { + public static final int constructor = 0xd9d71866; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_inactiveChats.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + autoplay = (flags & 1) != 0; + loop = (flags & 2) != 0; + video_id = stream.readInt64(exception); + caption = new TL_pageCaption(); + caption.text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + caption.credit = new TL_textEmpty(); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = autoplay ? (flags | 1) : (flags &~ 1); + flags = loop ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + stream.writeInt64(video_id); + caption.text.serializeToStream(stream); } } - public static class TL_channels_convertToGigagroup extends TLObject { - public static final int constructor = 0xb290c69; - - public InputChannel channel; + public static class TL_pageBlockSlideshow_layer82 extends TL_pageBlockSlideshow { + public static final int constructor = 0x130c8963; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + items = Vector.deserialize(stream, PageBlock::TLdeserialize, exception); + caption = new TL_pageCaption(); + caption.text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + caption.credit = new TL_textEmpty(); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); + Vector.serialize(stream, items); + caption.text.serializeToStream(stream); } } - public static class TL_messages_viewSponsoredMessage extends TLObject { - public static final int constructor = 0x673ad8f1; - - public InputPeer peer; - public byte[] random_id; + public static class TL_pageBlockPhoto_layer82 extends TL_pageBlockPhoto { + public static final int constructor = 0xe9c69982; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + photo_id = stream.readInt64(exception); + caption = new TL_pageCaption(); + caption.text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + caption.credit = new TL_textEmpty(); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeByteArray(random_id); + stream.writeInt64(photo_id); + caption.text.serializeToStream(stream); } } - public static class TL_messages_getSponsoredMessages extends TLObject { - public static final int constructor = 0x9bd2f439; - - public InputPeer peer; + public static class TL_pageBlockCollage_layer82 extends TL_pageBlockCollage { + public static final int constructor = 0x8b31c4f; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_SponsoredMessages.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + items = Vector.deserialize(stream, PageBlock::TLdeserialize, exception); + caption = new TL_pageCaption(); + caption.text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + caption.credit = new TL_textEmpty(); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); + Vector.serialize(stream, items); + caption.text.serializeToStream(stream); } } - public static class TL_channels_getSendAs extends TLObject { - public static final int constructor = 0xdc770ee; - - public InputPeer peer; + public static class TL_pageBlockAudio_layer82 extends TL_pageBlockAudio { + public static final int constructor = 0x31b81a7f; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_channels_sendAsPeers.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + audio_id = stream.readInt64(exception); + caption = new TL_pageCaption(); + caption.text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); + caption.credit = new TL_textEmpty(); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); + stream.writeInt64(audio_id); + caption.text.serializeToStream(stream); } } + //PageBlock end - public static class TL_stickers_createStickerSet extends TLObject { - public static final int constructor = 0x9021ab67; - + //EncryptedChat start + public static abstract class EncryptedChat extends TLObject { public int flags; - public boolean masks; - public boolean emojis; - public InputUser user_id; - public String title; - public String short_name; - public InputDocument thumb; - public ArrayList stickers = new ArrayList<>(); - public String software; + public int folder_id; + public int id; + public long access_hash; + public int date; + public long admin_id; + public long participant_id; + public byte[] g_a; + public byte[] nonce; + public byte[] g_a_or_b; + public long key_fingerprint; + public boolean history_deleted; + public byte[] a_or_b; //custom + public byte[] auth_key; //custom + public long user_id; //custom + public int ttl; //custom + public int layer; //custom + public int seq_in; //custom + public int seq_out; //custom + public int in_seq_no; //custom + public int mtproto_seq; //custom + public byte[] key_hash; //custom + public short key_use_count_in; //custom + public short key_use_count_out; //custom + public long exchange_id; //custom + public int key_create_date; //custom + public long future_key_fingerprint; //custom + public byte[] future_auth_key; //custom - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_StickerSet.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = masks ? (flags | 1) : (flags &~ 1); - flags = emojis ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - user_id.serializeToStream(stream); - stream.writeString(title); - stream.writeString(short_name); - if ((flags & 4) != 0) { - thumb.serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - int count = stickers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stickers.get(a).serializeToStream(stream); - } - if ((flags & 8) != 0) { - stream.writeString(software); + public static EncryptedChat TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + EncryptedChat result = null; + switch (constructor) { + case 0xfda9a7b7: + result = new TL_encryptedChatRequested_old(); + break; + case 0xc878527e: + result = new TL_encryptedChatRequested_layer115(); + break; + case 0xfa56ce36: + result = new TL_encryptedChat_layer131(); + break; + case 0x62718a82: + result = new TL_encryptedChatRequested_layer131(); + break; + case 0x6601d14f: + result = new TL_encryptedChat_old(); + break; + case 0xab7ec0a0: + result = new TL_encryptedChatEmpty(); + break; + case 0x3bf703dc: + result = new TL_encryptedChatWaiting_layer131(); + break; + case 0x13d6dd27: + result = new TL_encryptedChatDiscarded_layer122(); + break; + case 0x1e1c7c45: + result = new TL_encryptedChatDiscarded(); + break; + case 0x66b25953: + result = new TL_encryptedChatWaiting(); + break; + case 0x48f1d94c: + result = new TL_encryptedChatRequested(); + break; + case 0x61f0d4c7: + result = new TL_encryptedChat(); + break; } - } - } - - public static class TL_stickers_removeStickerFromSet extends TLObject { - public static final int constructor = 0xf7760f51; - - public InputDocument sticker; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_StickerSet.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - sticker.serializeToStream(stream); - } - } - - public static class TL_stickers_changeStickerPosition extends TLObject { - public static final int constructor = 0xffb6d4ca; - - public InputDocument sticker; - public int position; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_StickerSet.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - sticker.serializeToStream(stream); - stream.writeInt32(position); - } - } - - public static class TL_stickers_addStickerToSet extends TLObject { - public static final int constructor = 0x8653febe; - - public InputStickerSet stickerset; - public TL_inputStickerSetItem sticker; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_StickerSet.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stickerset.serializeToStream(stream); - sticker.serializeToStream(stream); - } - } - - public static class TL_stickers_setStickerSetThumb extends TLObject { - public static final int constructor = 0xa76a5392; - - public int flags; - public InputStickerSet stickerset; - public InputDocument thumb; - public long thumb_document_id; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_StickerSet.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stickerset.serializeToStream(stream); - if ((flags & 1) != 0) { - thumb.serializeToStream(stream); + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in EncryptedChat", constructor)); } - if ((flags & 2) != 0) { - stream.writeInt64(thumb_document_id); + if (result != null) { + result.readParams(stream, exception); } + return result; } } + //EncryptedChat end - public static class TL_stickers_changeSticker extends TLObject { - public static final int constructor = 0xf5537ebc; - + //Message start + public static class Message extends TLObject { + public int id; + public Peer from_id; + public int from_boosts_applied; + public Peer peer_id; + public Peer saved_peer_id; + public int date; + public int expire_date; + public MessageAction action; + public String message; + public MessageMedia media; public int flags; - public InputDocument sticker; - public String emoji; - public TL_maskCoords mask_coords; - public String keywords; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_StickerSet.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - sticker.serializeToStream(stream); - if ((flags & 1) != 0) { - stream.writeString(emoji); - } - if ((flags & 2) != 0) { - mask_coords.serializeToStream(stream); - } - if ((flags & 4) != 0) { - stream.writeString(keywords); - } - } - } - - public static class TL_stickers_renameStickerSet extends TLObject { - public static final int constructor = 0x124b1c00; - - public InputStickerSet stickerset; - public String title; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_StickerSet.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stickerset.serializeToStream(stream); - stream.writeString(title); - } - } - - public static class TL_stickers_deleteStickerSet extends TLObject { - public static final int constructor = 0x87704394; - - public InputStickerSet stickerset; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stickerset.serializeToStream(stream); - } - } - - public static class TL_stickers_replaceSticker extends TLObject { - public static final int constructor = 0x4696459a; - - public InputDocument sticker; - public TL_inputStickerSetItem new_sticker; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_StickerSet.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - sticker.serializeToStream(stream); - new_sticker.serializeToStream(stream); - } - } - - public static class TL_messages_getMyStickers extends TLObject { - public static final int constructor = 0xd0b5e1fc; - - public long offset_id; - public int limit; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_myStickers.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(offset_id); - stream.writeInt32(limit); - } - } - - public static class TL_messages_myStickers extends TLObject { - public static final int constructor = 0xfaff629d; - - public int count; - public ArrayList sets = new ArrayList<>(); - - public static TL_messages_myStickers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_myStickers.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_myStickers", constructor)); - } else { - return null; - } - } - TL_messages_myStickers result = new TL_messages_myStickers(); - result.readParams(stream, exception); - return result; - } + public int flags2; + public boolean mentioned; + public boolean media_unread; + public boolean out; + public boolean unread; + public ArrayList entities = new ArrayList<>(); + public String via_bot_name; + public ReplyMarkup reply_markup; + public int views; + public int forwards; + public MessageReplies replies; + public int edit_date; + public boolean silent; + public boolean post; + public boolean from_scheduled; + public boolean legacy; + public boolean reactions_are_possible; + public boolean edit_hide; + public boolean pinned; + public MessageFwdHeader fwd_from; + public long via_bot_id; + public long via_business_bot_id; + public MessageReplyHeader reply_to; + public String post_author; + public long grouped_id; + public TL_messageReactions reactions; + public ArrayList restriction_reason = new ArrayList<>(); + public int ttl_period; + public int quick_reply_shortcut_id; + public long effect; + public boolean noforwards; + public boolean invert_media; + public boolean offline; + public boolean video_processing_pending; + public TL_factCheck factcheck; + public int report_delivery_until_date; + public int send_state = 0; //custom + public int fwd_msg_id = 0; //custom + public String attachPath = ""; //custom + public ArrayList attachPaths; //custom + public HashMap params; //custom + public long random_id; //custom + public int local_id = 0; //custom + public long dialog_id; //custom + public int ttl; //custom + public int destroyTime; //custom + public long destroyTimeMillis; //custom + public int layer; //custom + public int seq_in; //custom + public int seq_out; //custom + public boolean with_my_score; + public Message replyMessage; //custom + public int reqId; //custom + public int realId; //custom + public int stickerVerified = 1; //custom + public boolean isThreadMessage; //custom + public String voiceTranscription; //custom + public boolean voiceTranscriptionOpen; //custom + public boolean voiceTranscriptionRated; //custom + public boolean voiceTranscriptionFinal; //custom + public boolean voiceTranscriptionForce; //custom + public long voiceTranscriptionId; //custom + public boolean premiumEffectWasPlayed; //custom + public String originalLanguage; //custom + public String translatedToLanguage; //custom + public TL_textWithEntities translatedText; // custom + public TL_stories.StoryItem replyStory; //custom + public InputQuickReplyShortcut quick_reply_shortcut; //custom - public void readParams(AbstractSerializedData stream, boolean exception) { - count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - StickerSetCovered object = StickerSetCovered.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - sets.add(object); + public static Message TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + Message result = null; + switch (constructor) { + case 0x1d86f70e: + result = new TL_messageService_old2(); + break; + case 0xa7ab1991: + result = new TL_message_old3(); + break; + case 0xc3060325: + result = new TL_message_old4(); + break; + case 0x555555fa: + result = new TL_message_secret(); + break; + case 0x555555f9: + result = new TL_message_secret_layer72(); + break; + case 0x90dddc11: + result = new TL_message_layer72(); + break; + case 0xc09be45f: + result = new TL_message_layer68(); + break; + case 0xc992e15c: + result = new TL_message_layer47(); + break; + case 0x5ba66c13: + result = new TL_message_old7(); + break; + case 0xc06b9607: + result = new TL_messageService_layer48(); + break; + case 0x83e5de54: + result = new TL_messageEmpty_layer122(); + break; + case 0x2bebfa86: + result = new TL_message_old6(); + break; + case 0x44f9b43d: + result = new TL_message_layer104(); + break; + case 0x90a6ca84: + result = new TL_messageEmpty(); + break; + case 0x1c9b1027: + result = new TL_message_layer104_2(); + break; + case 0xa367e716: + result = new TL_messageForwarded_old2(); + break; + case 0x5f46804: + result = new TL_messageForwarded_old(); + break; + case 0x567699b3: + result = new TL_message_old2(); + break; + case 0x9f8d60bb: + result = new TL_messageService_old(); + break; + case 0x22eb6aba: + result = new TL_message_old(); + break; + case 0x555555F8: + result = new TL_message_secret_old(); + break; + case 0x9789dac4: + result = new TL_message_layer104_3(); + break; + case 0x452c0e65: + result = new TL_message_layer117(); + break; + case 0xf52e6b7f: + result = new TL_message_layer118(); + break; + case 0x58ae39c9: + result = new TL_message_layer123(); + break; + case 0xbce383d2: + result = new TL_message_layer131(); + break; + case 0x85d6cbe2: + result = new TL_message_layer135(); + break; + case TL_message.constructor: + result = new TL_message(); + break; + case TL_message_layer195.constructor: + result = new TL_message_layer195(); + break; + case TL_message_layer180.constructor: + result = new TL_message_layer180(); + break; + case 0xa4e97f37: + case TL_message_layer179.constructor: + result = new TL_message_layer179(); + break; + case TL_message_layer176.constructor: + result = new TL_message_layer176(); + break; + case TL_message_layer175.constructor: + result = new TL_message_layer175(); + break; + case TL_message_layer169.constructor: + result = new TL_message_layer169(); + break; + case TL_message_layer173.constructor: + result = new TL_message_layer173(); + break; + case 0x9e19a1f6: + result = new TL_messageService_layer118(); + break; + case 0x286fa604: + result = new TL_messageService_layer123(); + break; + case TL_messageService_layer195.constructor: + result = new TL_messageService_layer195(); + break; + case TL_messageService.constructor: + result = new TL_messageService(); + break; + case 0xf07814c8: + result = new TL_message_old5(); + break; } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = sets.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - sets.get(a).serializeToStream(stream); + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in Message", constructor)); } - } - } - - public static class TL_stickers_checkShortName extends TLObject { - public static final int constructor = 0x284b3639; - - public String short_name; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(short_name); - } - } - - public static class TL_stickers_suggestShortName extends TLObject { - public static final int constructor = 0x4dafc503; - - public String title; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_stickers_suggestedShortName.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(title); - } - } - - public static class TL_phone_getCallConfig extends TLObject { - public static final int constructor = 0x55451fa9; - - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_dataJSON.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_phone_requestCall extends TLObject { - public static final int constructor = 0x42ff96ed; - - public int flags; - public boolean video; - public InputUser user_id; - public int random_id; - public byte[] g_a_hash; - public TL_phoneCallProtocol protocol; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_phone_phoneCall.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = video ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - user_id.serializeToStream(stream); - stream.writeInt32(random_id); - stream.writeByteArray(g_a_hash); - protocol.serializeToStream(stream); - } - } - - public static class TL_phone_acceptCall extends TLObject { - public static final int constructor = 0x3bd2b4a0; - - public TL_inputPhoneCall peer; - public byte[] g_b; - public TL_phoneCallProtocol protocol; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_phone_phoneCall.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeByteArray(g_b); - protocol.serializeToStream(stream); - } - } - - public static class TL_phone_confirmCall extends TLObject { - public static final int constructor = 0x2efe1722; - - public TL_inputPhoneCall peer; - public byte[] g_a; - public long key_fingerprint; - public TL_phoneCallProtocol protocol; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_phone_phoneCall.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeByteArray(g_a); - stream.writeInt64(key_fingerprint); - protocol.serializeToStream(stream); - } - } - - public static class TL_phone_receivedCall extends TLObject { - public static final int constructor = 0x17d54f61; - - public TL_inputPhoneCall peer; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - } - } - - public static class TL_phone_discardCall extends TLObject { - public static final int constructor = 0xb2cbc1c0; - - public int flags; - public boolean video; - public TL_inputPhoneCall peer; - public int duration; - public PhoneCallDiscardReason reason; - public long connection_id; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = video ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - peer.serializeToStream(stream); - stream.writeInt32(duration); - reason.serializeToStream(stream); - stream.writeInt64(connection_id); - } - } - - public static class TL_phone_setCallRating extends TLObject { - public static final int constructor = 0x59ead627; - - public int flags; - public boolean user_initiative; - public TL_inputPhoneCall peer; - public int rating; - public String comment; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = user_initiative ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - peer.serializeToStream(stream); - stream.writeInt32(rating); - stream.writeString(comment); - } - } - - public static class TL_phone_saveCallDebug extends TLObject { - public static final int constructor = 0x277add7e; - - public TL_inputPhoneCall peer; - public TL_dataJSON debug; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - debug.serializeToStream(stream); - } - } - - public static class TL_phone_sendSignalingData extends TLObject { - public static final int constructor = 0xff7a9383; - - public TL_inputPhoneCall peer; - public byte[] data; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeByteArray(data); - } - } - - public static class TL_phone_createGroupCall extends TLObject { - public static final int constructor = 0x48cdc6d8; - - public int flags; - public InputPeer peer; - public int random_id; - public String title; - public int schedule_date; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - peer.serializeToStream(stream); - stream.writeInt32(random_id); - if ((flags & 1) != 0) { - stream.writeString(title); - } - if ((flags & 2) != 0) { - stream.writeInt32(schedule_date); - } - } - } - - public static class TL_phone_joinGroupCall extends TLObject { - public static final int constructor = 0xb132ff7b; - - public int flags; - public boolean muted; - public boolean video_stopped; - public TL_inputGroupCall call; - public InputPeer join_as; - public String invite_hash; - public TL_dataJSON params; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = muted ? (flags | 1) : (flags &~ 1); - flags = video_stopped ? (flags | 4) : (flags &~ 4); - stream.writeInt32(flags); - call.serializeToStream(stream); - join_as.serializeToStream(stream); - if ((flags & 2) != 0) { - stream.writeString(invite_hash); - } - params.serializeToStream(stream); - } - } - - public static class TL_phone_leaveGroupCall extends TLObject { - public static final int constructor = 0x500377f9; - - public TL_inputGroupCall call; - public int source; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - call.serializeToStream(stream); - stream.writeInt32(source); - } - } - - public static class TL_phone_inviteToGroupCall extends TLObject { - public static final int constructor = 0x7b393160; - - public TL_inputGroupCall call; - public ArrayList users = new ArrayList<>(); - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - call.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } - - public static class TL_phone_discardGroupCall extends TLObject { - public static final int constructor = 0x7a777135; - - public TL_inputGroupCall call; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - call.serializeToStream(stream); - } - } - - public static class TL_phone_toggleGroupCallSettings extends TLObject { - public static final int constructor = 0x74bbb43d; - - public int flags; - public boolean reset_invite_hash; - public TL_inputGroupCall call; - public boolean join_muted; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = reset_invite_hash ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - call.serializeToStream(stream); - if ((flags & 1) != 0) { - stream.writeBool(join_muted); - } - } - } - - public static class TL_phone_getGroupCall extends TLObject { - public static final int constructor = 0x41845db; - - public TL_inputGroupCall call; - public int limit; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_phone_groupCall.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - call.serializeToStream(stream); - stream.writeInt32(limit); - } - } - - public static class TL_phone_getGroupParticipants extends TLObject { - public static final int constructor = 0xc558d8ab; - - public TL_inputGroupCall call; - public ArrayList ids = new ArrayList<>(); - public ArrayList sources = new ArrayList<>(); - public String offset; - public int limit; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_phone_groupParticipants.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - call.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = ids.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - ids.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = sources.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(sources.get(a)); - } - stream.writeString(offset); - stream.writeInt32(limit); - } - } - - public static class TL_phone_checkGroupCall extends TLObject { - public static final int constructor = 0xb59cf977; - - public TL_inputGroupCall call; - public ArrayList sources = new ArrayList<>(); - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - vector.objects.add(stream.readInt32(exception)); - } - return vector; - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - call.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = sources.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(sources.get(a)); - } - } - } - - public static class TL_phone_toggleGroupCallRecord extends TLObject { - public static final int constructor = 0xf128c708; - - public int flags; - public boolean start; - public boolean video; - public TL_inputGroupCall call; - public String title; - public boolean video_portrait; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = start ? (flags | 1) : (flags &~ 1); - flags = video ? (flags | 4) : (flags &~ 4); - stream.writeInt32(flags); - call.serializeToStream(stream); - if ((flags & 2) != 0) { - stream.writeString(title); - } - if ((flags & 4) != 0) { - stream.writeBool(video_portrait); - } - } - } - - public static class TL_phone_editGroupCallParticipant extends TLObject { - public static final int constructor = 0xa5273abf; - - public int flags; - public TL_inputGroupCall call; - public InputPeer participant; - public boolean muted; - public int volume; - public boolean raise_hand; - public boolean video_stopped; - public boolean video_paused; - public boolean presentation_paused; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - call.serializeToStream(stream); - participant.serializeToStream(stream); - if ((flags & 1) != 0) { - stream.writeBool(muted); - } - if ((flags & 2) != 0) { - stream.writeInt32(volume); - } - if ((flags & 4) != 0) { - stream.writeBool(raise_hand); - } - if ((flags & 8) != 0) { - stream.writeBool(video_stopped); - } - if ((flags & 16) != 0) { - stream.writeBool(video_paused); - } - if ((flags & 32) != 0) { - stream.writeBool(presentation_paused); - } - } - } - - public static class TL_phone_editGroupCallTitle extends TLObject { - public static final int constructor = 0x1ca6ac0a; - - public TL_inputGroupCall call; - public String title; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - call.serializeToStream(stream); - stream.writeString(title); - } - } - - public static class TL_phone_getGroupCallJoinAs extends TLObject { - public static final int constructor = 0xef7c213a; - - public InputPeer peer; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_phone_joinAsPeers.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - } - } - - public static class TL_phone_exportGroupCallInvite extends TLObject { - public static final int constructor = 0xe6aa647f; - - public int flags; - public boolean can_self_unmute; - public TL_inputGroupCall call; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_phone_exportedGroupCallInvite.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = can_self_unmute ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - call.serializeToStream(stream); - } - } - - public static class TL_phone_toggleGroupCallStartSubscription extends TLObject { - public static final int constructor = 0x219c34e6; - - public TL_inputGroupCall call; - public boolean subscribed; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - call.serializeToStream(stream); - stream.writeBool(subscribed); - } - } - - public static class TL_phone_startScheduledGroupCall extends TLObject { - public static final int constructor = 0x5680e342; - - public TL_inputGroupCall call; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - call.serializeToStream(stream); - } - } - - public static class TL_phone_saveDefaultGroupCallJoinAs extends TLObject { - public static final int constructor = 0x575e1f8c; - - public InputPeer peer; - public InputPeer join_as; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - join_as.serializeToStream(stream); - } - } - - public static class TL_phone_joinGroupCallPresentation extends TLObject { - public static final int constructor = 0xcbea6bc4; - - public TL_inputGroupCall call; - public TL_dataJSON params; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - call.serializeToStream(stream); - params.serializeToStream(stream); - } - } - - public static class TL_groupCallStreamChannel extends TLObject { - public static final int constructor = 0x80eb48af; - - public int channel; - public int scale; - public long last_timestamp_ms; - - public static TL_groupCallStreamChannel TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_groupCallStreamChannel.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_groupCallStreamChannel", constructor)); - } else { - return null; - } - } - TL_groupCallStreamChannel result = new TL_groupCallStreamChannel(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - channel = stream.readInt32(exception); - scale = stream.readInt32(exception); - last_timestamp_ms = stream.readInt64(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(channel); - stream.writeInt32(scale); - stream.writeInt64(last_timestamp_ms); - } - } - - public static class TL_phone_groupCallStreamChannels extends TLObject { - public static final int constructor = 0xd0e482b2; - - public ArrayList channels = new ArrayList<>(); - - public static TL_phone_groupCallStreamChannels TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_phone_groupCallStreamChannels.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_phone_groupCallStreamChannels", constructor)); - } else { - return null; - } - } - TL_phone_groupCallStreamChannels result = new TL_phone_groupCallStreamChannels(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_groupCallStreamChannel object = TL_groupCallStreamChannel.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - channels.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = channels.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - channels.get(a).serializeToStream(stream); - } - } - } - - public static class TL_phone_leaveGroupCallPresentation extends TLObject { - public static final int constructor = 0x1c50d144; - - public TL_inputGroupCall call; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - call.serializeToStream(stream); - } - } - - public static class TL_phone_getGroupCallStreamChannels extends TLObject { - public static final int constructor = 0x1ab21940; - - public TL_inputGroupCall call; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_phone_groupCallStreamChannels.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - call.serializeToStream(stream); - } - } - - public static class TL_phone_getGroupCallStreamRtmpUrl extends TLObject { - public static final int constructor = 0xdeb3abbf; - - public InputPeer peer; - public boolean revoke; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_phone_groupCallStreamRtmpUrl.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeBool(revoke); - } - } - - public static class TL_payments_getPaymentForm extends TLObject { - public static final int constructor = 0x37148dbb; - - public int flags; - public InputInvoice invoice; - public TL_dataJSON theme_params; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return PaymentForm.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - invoice.serializeToStream(stream); - if ((flags & 1) != 0) { - theme_params.serializeToStream(stream); - } - } - } - - public static class TL_payments_getPaymentReceipt extends TLObject { - public static final int constructor = 0x2478d1cc; - - public InputPeer peer; - public int msg_id; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return PaymentReceipt.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(msg_id); - } - } - - public static class TL_payments_validateRequestedInfo extends TLObject { - public static final int constructor = 0xb6c8f12b; - - public int flags; - public boolean save; - public InputInvoice invoice; - public TL_paymentRequestedInfo info; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_payments_validatedRequestedInfo.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = save ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - invoice.serializeToStream(stream); - info.serializeToStream(stream); - } - } - - public static class TL_payments_sendPaymentForm extends TLObject { - public static final int constructor = 0x2d03522f; - - public int flags; - public long form_id; - public InputInvoice invoice; - public String requested_info_id; - public String shipping_option_id; - public InputPaymentCredentials credentials; - public long tip_amount; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return payments_PaymentResult.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeInt64(form_id); - invoice.serializeToStream(stream); - if ((flags & 1) != 0) { - stream.writeString(requested_info_id); - } - if ((flags & 2) != 0) { - stream.writeString(shipping_option_id); - } - credentials.serializeToStream(stream); - if ((flags & 4) != 0) { - stream.writeInt64(tip_amount); - } - } - } - - public static class TL_help_supportName extends TLObject { - public static final int constructor = 0x8c05f1c9; - - public String name; - - public static TL_help_supportName TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_help_supportName.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_help_supportName", constructor)); - } else { - return null; - } - } - TL_help_supportName result = new TL_help_supportName(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - name = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(name); - } - } - - public static class TL_inputThemeSettings extends TLObject { - public static final int constructor = 0x8fde504f; - - public int flags; - public boolean message_colors_animated; - public BaseTheme base_theme; - public int accent_color; - public int outbox_accent_color; - public ArrayList message_colors = new ArrayList<>(); - public InputWallPaper wallpaper; - public WallPaperSettings wallpaper_settings; - - public static TL_inputThemeSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_inputThemeSettings.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_inputThemeSettings", constructor)); - } else { - return null; - } - } - TL_inputThemeSettings result = new TL_inputThemeSettings(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - message_colors_animated = (flags & 4) != 0; - base_theme = BaseTheme.TLdeserialize(stream, stream.readInt32(exception), exception); - accent_color = stream.readInt32(exception); - if ((flags & 8) != 0) { - outbox_accent_color = stream.readInt32(exception); - } - if ((flags & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - message_colors.add(stream.readInt32(exception)); - } - } - if ((flags & 2) != 0) { - wallpaper = InputWallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 2) != 0) { - wallpaper_settings = WallPaperSettings.TLdeserialize(stream, stream.readInt32(exception), exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = message_colors_animated ? (flags | 4) : (flags &~ 4); - stream.writeInt32(flags); - base_theme.serializeToStream(stream); - stream.writeInt32(accent_color); - if ((flags & 8) != 0) { - stream.writeInt32(outbox_accent_color); - } - if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = message_colors.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(message_colors.get(a)); - } - } - if ((flags & 2) != 0) { - wallpaper.serializeToStream(stream); - } - if ((flags & 2) != 0) { - wallpaper_settings.serializeToStream(stream); - } - } - } - - public static class TL_payments_assignPlayMarketTransaction extends TLObject { - public static final int constructor = 0xdffd50d3; - - public TL_dataJSON receipt; - public InputStorePaymentPurpose purpose; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - receipt.serializeToStream(stream); - purpose.serializeToStream(stream); - } - } - - public static abstract class InputStorePaymentPurpose extends TLObject { - - public static InputStorePaymentPurpose TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - InputStorePaymentPurpose result = null; - switch (constructor) { - case TL_inputStorePaymentGiftPremium.constructor: - result = new TL_inputStorePaymentGiftPremium(); - break; - case TL_inputStorePaymentPremiumGiftCode.constructor: - result = new TL_inputStorePaymentPremiumGiftCode(); - break; - case TL_inputStorePaymentPremiumSubscription.constructor: - result = new TL_inputStorePaymentPremiumSubscription(); - break; - case TL_inputStorePaymentPremiumGiveaway.constructor: - result = new TL_inputStorePaymentPremiumGiveaway(); - break; - case TL_inputStorePaymentStarsGift.constructor: - result = new TL_inputStorePaymentStarsGift(); - break; - case TL_inputStorePaymentStarsTopup.constructor: - result = new TL_inputStorePaymentStarsTopup(); - break; - case TL_inputStorePaymentStarsGiveaway.constructor: - result = new TL_inputStorePaymentStarsGiveaway(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in InputStorePaymentPurpose", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } - - public static class TL_inputStorePaymentPremiumSubscription extends InputStorePaymentPurpose { - public static final int constructor = 0xa6751e66; - - public int flags; - public boolean restore; - public boolean upgrade; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - restore = (flags & 1) != 0; - upgrade = (flags & 2) != 0; - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = restore ? (flags | 1) : (flags &~ 1); - flags = upgrade ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - } - } - - public static class TL_inputStorePaymentGiftPremium extends InputStorePaymentPurpose { - public static final int constructor = 0x616f7fe8; - - public InputUser user_id; - public String currency; - public long amount; - - public void readParams(AbstractSerializedData stream, boolean exception) { - user_id = InputUser.TLdeserialize(stream, stream.readInt32(exception), exception); - currency = stream.readString(exception); - amount = stream.readInt64(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - user_id.serializeToStream(stream); - stream.writeString(currency); - stream.writeInt64(amount); - } - } - - public static class TL_payments_getSavedInfo extends TLObject { - public static final int constructor = 0x227d824b; - - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_payments_savedInfo.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_payments_clearSavedInfo extends TLObject { - public static final int constructor = 0xd83d70c1; - - public int flags; - public boolean credentials; - public boolean info; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = credentials ? (flags | 1) : (flags &~ 1); - flags = info ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - } - } - - public static class TL_payments_getBankCardData extends TLObject { - public static final int constructor = 0x2e79d779; - - public String number; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_payments_bankCardData.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(number); - } - } - - public static class TL_langpack_getLangPack extends TLObject { - public static final int constructor = 0x9ab5c58e; - - public String lang_code; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_langPackDifference.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(lang_code); - } - } - - public static class TL_langpack_getStrings extends TLObject { - public static final int constructor = 0x2e1ee318; - - public String lang_code; - public ArrayList keys = new ArrayList<>(); - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - LangPackString object = LangPackString.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(lang_code); - stream.writeInt32(0x1cb5c415); - int count = keys.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(keys.get(a)); - } - } - } - - public static class TL_langpack_getDifference extends TLObject { - public static final int constructor = 0xcd984aa5; - - public String lang_pack; - public String lang_code; - public int from_version; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_langPackDifference.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(lang_pack); - stream.writeString(lang_code); - stream.writeInt32(from_version); - } - } - - public static class TL_langpack_getLanguages extends TLObject { - public static final int constructor = 0x800fd57d; - - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_langPackLanguage object = TL_langPackLanguage.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_langpack_getLanguage extends TLObject { - public static final int constructor = 0x6a596502; - - public String lang_pack; - public String lang_code; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_langPackLanguage.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(lang_pack); - stream.writeString(lang_code); - } - } - - public static class TL_folders_editPeerFolders extends TLObject { - public static final int constructor = 0x6847d0ab; - - public ArrayList folder_peers = new ArrayList<>(); - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = folder_peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - folder_peers.get(a).serializeToStream(stream); - } - } - } - - public static class TL_folders_deleteFolder extends TLObject { - public static final int constructor = 0x1c295881; - - public int folder_id; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(folder_id); - } - } - - //manually created - - public static class TL_photoPathSize extends PhotoSize { - public static final int constructor = 0xd8214d41; - public Path svgPath; - - public void readParams(AbstractSerializedData stream, boolean exception) { - type = stream.readString(exception); - bytes = stream.readByteArray(exception); - w = h = 512; - svgPath = SvgHelper.doPath(SvgHelper.decompress(bytes)); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(type); - stream.writeByteArray(bytes); - } - } - - //RichText start - public static abstract class RichText extends TLObject { - public String url; - public long webpage_id; - public String email; - public RichText text; - public ArrayList texts = new ArrayList<>(); - public RichText parentRichText; - - public static RichText TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - RichText result = null; - switch (constructor) { - case 0x1ccb966a: - result = new TL_textPhone(); - break; - case 0xc7fb5e01: - result = new TL_textSuperscript(); - break; - case 0x81ccf4f: - result = new TL_textImage(); - break; - case 0xc12622c4: - result = new TL_textUnderline(); - break; - case 0xed6a8504: - result = new TL_textSubscript(); - break; - case 0x3c2884c1: - result = new TL_textUrl(); - break; - case 0x35553762: - result = new TL_textAnchor(); - break; - case 0xdc3d824f: - result = new TL_textEmpty(); - break; - case 0xde5a0dd6: - result = new TL_textEmail(); - break; - case 0x744694e0: - result = new TL_textPlain(); - break; - case 0x6724abc4: - result = new TL_textBold(); - break; - case 0x9bf8bb95: - result = new TL_textStrike(); - break; - case 0x7e6260d7: - result = new TL_textConcat(); - break; - case 0xd912a59c: - result = new TL_textItalic(); - break; - case 0x34b8621: - result = new TL_textMarked(); - break; - case 0x6c3f19b9: - result = new TL_textFixed(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in RichText", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } - - public static class TL_pageBlockList_layer82 extends TL_pageBlockList { - public static final int constructor = 0x3a58c7f4; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - ordered = stream.readBool(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RichText object = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - TL_pageListItemText item = new TL_pageListItemText(); - item.text = object; - items.add(item); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeBool(ordered); - stream.writeInt32(0x1cb5c415); - int count = items.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - TL_pageListItemText item = (TL_pageListItemText) items.get(a); - item.text.serializeToStream(stream); - } - } - } - //RichText end - - public static class TL_channels_sendAsPeers extends TLObject { - public static final int constructor = 0xf496b0c6; - - public ArrayList peers = new ArrayList<>(); - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); - - public static TL_channels_sendAsPeers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_channels_sendAsPeers.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_channels_sendAsPeers", constructor)); - } else { - return null; - } - } - TL_channels_sendAsPeers result = new TL_channels_sendAsPeers(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_sendAsPeer object = TL_sendAsPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - peers.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - peers.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - } - } - - public static class TL_sendAsPeer extends TLObject { - public static final int constructor = 0xb81c7034; - - public int flags; - public boolean premium_required; - public Peer peer; - - public static TL_sendAsPeer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_sendAsPeer.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_sendAsPeer", constructor)); - } else { - return null; - } - } - TL_sendAsPeer result = new TL_sendAsPeer(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - premium_required = (flags & 1) != 0; - peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = premium_required ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - peer.serializeToStream(stream); - } - } - - //MessageMedia start - public static abstract class MessageMedia extends TLObject { - public byte[] bytes; - public Audio audio_unused; - public int flags; - public boolean shipping_address_requested; - public Photo photo; - public GeoPoint geo; - public int heading; - public String currency; - public String description; - public int receipt_msg_id; - public long total_amount; - public String start_param; - public String title; - public String address; - public String provider; - public String venue_id; - public Video video_unused; - public Document document; - public ArrayList alt_documents = new ArrayList<>(); - public String captionLegacy; - public TL_game game; - public String phone_number; - public String first_name; - public String last_name; - public String vcard; - public long user_id; - public WebPage webpage; - public String venue_type; - public boolean test; - public int period; - public int ttl_seconds; - public int proximity_notification_radius; - public boolean nopremium; - public boolean spoiler; - public int id; - public TL_stories.StoryItem storyItem; - public boolean via_mention; - public Peer peer; - public boolean force_large_media; - public boolean force_small_media; - public boolean manual; - public boolean safe; - public boolean video; - public boolean round; - public boolean voice; - public long stars_amount; - public ArrayList extended_media = new ArrayList<>(); - public String attachPath; //custom for bot previews - - public static MessageMedia TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - MessageMedia result = null; - switch (constructor) { - case 0x29632a36: - result = new TL_messageMediaUnsupported_old(); - break; - case 0xc6b68300: - result = new TL_messageMediaAudio_layer45(); - break; - case 0xc8c45a2a: - result = new TL_messageMediaPhoto_old(); - break; - case 0x84551347: - result = new TL_messageMediaInvoice_layer145(); - break; - case 0xf6a548d3: - result = new TL_messageMediaInvoice(); - break; - case 0x9f84f49e: - result = new TL_messageMediaUnsupported(); - break; - case 0x3ded6320: - result = new TL_messageMediaEmpty(); - break; - case 0x68cb6283: - result = new TL_messageMediaStory(); - break; - case 0xcbb20d88: - result = new TL_messageMediaStory_layer162(); - break; - case 0xc79aee1d: - result = new MessageMediaStoryFull(); //custom - break; - case 0xc79aee1f: - result = new MessageMediaStoryFull_old(); //custom - break; - case 0x7912b71f: - result = new TL_messageMediaVenue_layer71(); - break; - case 0xb940c666: - result = new TL_messageMediaGeoLive(); - break; - case 0x7c3c2609: - result = new TL_messageMediaGeoLive_layer119(); - break; - case 0x2ec0533f: - result = new TL_messageMediaVenue(); - break; - case 0xa2d24290: - result = new TL_messageMediaVideo_old(); - break; - case 0x2fda2204: - result = new TL_messageMediaDocument_old(); - break; - case 0xf3e02ea8: - result = new TL_messageMediaDocument_layer68(); - break; - case 0xfdb19008: - result = new TL_messageMediaGame(); - break; - case 0x7c4414d3: - result = new TL_messageMediaDocument_layer74(); - break; - case 0x5e7d2f39: - result = new TL_messageMediaContact_layer81(); - break; - case 0x695150d7: - result = new TL_messageMediaPhoto(); - break; - case 0x4bd6e798: - result = new TL_messageMediaPoll(); - break; - case TL_messageMediaGiveawayResults.constructor: - result = new TL_messageMediaGiveawayResults(); - break; - case TL_messageMediaGiveawayResults_layer186.constructor: - result = new TL_messageMediaGiveawayResults_layer186(); - break; - case TL_messageMediaGiveaway.constructor: - result = new TL_messageMediaGiveaway(); - break; - case TL_messageMediaGiveaway_layer186.constructor: - result = new TL_messageMediaGiveaway_layer186(); - break; - case TL_messageMediaGiveaway_layer167.constructor: - result = new TL_messageMediaGiveaway_layer167(); - break; - case TL_messageMediaPaidMedia.constructor: - result = new TL_messageMediaPaidMedia(); - break; - case 0xb5223b0f: - result = new TL_messageMediaPhoto_layer74(); - break; - case 0x3d8ce53d: - result = new TL_messageMediaPhoto_layer68(); - break; - case 0x5bcf1675: - result = new TL_messageMediaVideo_layer45(); - break; - case 0x3f7ee58b: - result = new TL_messageMediaDice(); - break; - case 0x638fe46b: - result = new TL_messageMediaDice_layer111(); - break; - case 0x56e0d474: - result = new TL_messageMediaGeo(); - break; - case 0xa32dd600: - result = new TL_messageMediaWebPage_layer165(); - break; - case 0xddf10c3b: - result = new TL_messageMediaWebPage(); - break; - case TL_messageMediaDocument.constructor: - result = new TL_messageMediaDocument(); - break; - case TL_messageMediaDocument_layer187.constructor: - result = new TL_messageMediaDocument_layer187(); - break; - case 0x9cb070d7: - result = new TL_messageMediaDocument_layer159(); - break; - case 0xcbf24940: - result = new TL_messageMediaContact_layer131(); - break; - case 0x70322949: - result = new TL_messageMediaContact(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in MessageMedia", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - if (result.video_unused != null) { - TL_messageMediaDocument mediaDocument = new TL_messageMediaDocument(); - if (result.video_unused instanceof TL_videoEncrypted) { - mediaDocument.document = new TL_documentEncrypted(); - mediaDocument.document.key = result.video_unused.key; - mediaDocument.document.iv = result.video_unused.iv; - } else { - mediaDocument.document = new TL_document(); - } - mediaDocument.flags = 3; - mediaDocument.document.file_reference = new byte[0]; - mediaDocument.document.id = result.video_unused.id; - mediaDocument.document.access_hash = result.video_unused.access_hash; - mediaDocument.document.date = result.video_unused.date; - if (result.video_unused.mime_type != null) { - mediaDocument.document.mime_type = result.video_unused.mime_type; - } else { - mediaDocument.document.mime_type = "video/mp4"; - } - mediaDocument.document.size = result.video_unused.size; - mediaDocument.document.thumbs.add(result.video_unused.thumb); - mediaDocument.document.dc_id = result.video_unused.dc_id; - mediaDocument.captionLegacy = result.captionLegacy; - TL_documentAttributeVideo attributeVideo = new TL_documentAttributeVideo(); - attributeVideo.w = result.video_unused.w; - attributeVideo.h = result.video_unused.h; - attributeVideo.duration = result.video_unused.duration; - mediaDocument.document.attributes.add(attributeVideo); - result = mediaDocument; - if (mediaDocument.captionLegacy == null) { - mediaDocument.captionLegacy = ""; - } - } else if (result.audio_unused != null) { - TL_messageMediaDocument mediaDocument = new TL_messageMediaDocument(); - if (result.audio_unused instanceof TL_audioEncrypted) { - mediaDocument.document = new TL_documentEncrypted(); - mediaDocument.document.key = result.audio_unused.key; - mediaDocument.document.iv = result.audio_unused.iv; - } else { - mediaDocument.document = new TL_document(); - } - mediaDocument.flags = 3; - mediaDocument.document.file_reference = new byte[0]; - mediaDocument.document.id = result.audio_unused.id; - mediaDocument.document.access_hash = result.audio_unused.access_hash; - mediaDocument.document.date = result.audio_unused.date; - if (result.audio_unused.mime_type != null) { - mediaDocument.document.mime_type = result.audio_unused.mime_type; - } else { - mediaDocument.document.mime_type = "audio/ogg"; - } - mediaDocument.document.size = result.audio_unused.size; - TL_photoSizeEmpty thumb = new TL_photoSizeEmpty(); - thumb.type = "s"; - mediaDocument.document.thumbs.add(thumb); - mediaDocument.document.dc_id = result.audio_unused.dc_id; - mediaDocument.captionLegacy = result.captionLegacy; - TL_documentAttributeAudio attributeAudio = new TL_documentAttributeAudio(); - attributeAudio.duration = result.audio_unused.duration; - attributeAudio.voice = true; - mediaDocument.document.attributes.add(attributeAudio); - result = mediaDocument; - if (mediaDocument.captionLegacy == null) { - mediaDocument.captionLegacy = ""; - } - } - } - return result; - } - - public Document getDocument() { - if (!alt_documents.isEmpty() && !MessagesController.isStoryQualityFull()) { - return alt_documents.get(0); - } - return document; - } - } - //MessageMedia end - - //PageBlock start - public static class TL_pageBlockAuthorDate_layer60 extends TL_pageBlockAuthorDate { - public static final int constructor = 0x3d5b64f2; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - String authorString = stream.readString(exception); - author = new TL_textPlain(); - ((TL_textPlain) author).text = authorString; - published_date = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(((TL_textPlain) author).text); - stream.writeInt32(published_date); - } - } - - public static class TL_pageBlockEmbedPost_layer82 extends TL_pageBlockEmbedPost { - public static final int constructor = 0x292c7be9; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - url = stream.readString(exception); - webpage_id = stream.readInt64(exception); - author_photo_id = stream.readInt64(exception); - author = stream.readString(exception); - date = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - blocks.add(object); - } - caption = new TL_pageCaption(); - caption.text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - caption.credit = new TL_textEmpty(); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(url); - stream.writeInt64(webpage_id); - stream.writeInt64(author_photo_id); - stream.writeString(author); - stream.writeInt32(date); - stream.writeInt32(0x1cb5c415); - int count = blocks.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - blocks.get(a).serializeToStream(stream); - } - caption.text.serializeToStream(stream); - } - } - - public static class TL_pageBlockEmbed_layer82 extends TL_pageBlockEmbed { - public static final int constructor = 0xcde200d1; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - full_width = (flags & 1) != 0; - allow_scrolling = (flags & 8) != 0; - if ((flags & 2) != 0) { - url = stream.readString(exception); - } - if ((flags & 4) != 0) { - html = stream.readString(exception); - } - if ((flags & 16) != 0) { - poster_photo_id = stream.readInt64(exception); - } - w = stream.readInt32(exception); - h = stream.readInt32(exception); - caption = new TL_pageCaption(); - caption.text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - caption.credit = new TL_textEmpty(); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = full_width ? (flags | 1) : (flags &~ 1); - flags = allow_scrolling ? (flags | 8) : (flags &~ 8); - stream.writeInt32(flags); - if ((flags & 2) != 0) { - stream.writeString(url); - } - if ((flags & 4) != 0) { - stream.writeString(html); - } - if ((flags & 16) != 0) { - stream.writeInt64(poster_photo_id); - } - stream.writeInt32(w); - stream.writeInt32(h); - caption.text.serializeToStream(stream); - } - } - - public static class TL_pageBlockVideo_layer82 extends TL_pageBlockVideo { - public static final int constructor = 0xd9d71866; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - autoplay = (flags & 1) != 0; - loop = (flags & 2) != 0; - video_id = stream.readInt64(exception); - caption = new TL_pageCaption(); - caption.text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - caption.credit = new TL_textEmpty(); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = autoplay ? (flags | 1) : (flags &~ 1); - flags = loop ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - stream.writeInt64(video_id); - caption.text.serializeToStream(stream); - } - } - - public static class TL_pageBlockSlideshow_layer82 extends TL_pageBlockSlideshow { - public static final int constructor = 0x130c8963; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - items.add(object); - } - caption = new TL_pageCaption(); - caption.text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - caption.credit = new TL_textEmpty(); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = items.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - items.get(a).serializeToStream(stream); - } - caption.text.serializeToStream(stream); - } - } - - public static class TL_pageBlockPhoto_layer82 extends TL_pageBlockPhoto { - public static final int constructor = 0xe9c69982; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - photo_id = stream.readInt64(exception); - caption = new TL_pageCaption(); - caption.text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - caption.credit = new TL_textEmpty(); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(photo_id); - caption.text.serializeToStream(stream); - } - } - - public static class TL_pageBlockCollage_layer82 extends TL_pageBlockCollage { - public static final int constructor = 0x8b31c4f; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PageBlock object = PageBlock.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - items.add(object); - } - caption = new TL_pageCaption(); - caption.text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - caption.credit = new TL_textEmpty(); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = items.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - items.get(a).serializeToStream(stream); - } - caption.text.serializeToStream(stream); - } - } - - public static class TL_pageBlockAudio_layer82 extends TL_pageBlockAudio { - public static final int constructor = 0x31b81a7f; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - audio_id = stream.readInt64(exception); - caption = new TL_pageCaption(); - caption.text = RichText.TLdeserialize(stream, stream.readInt32(exception), exception); - caption.credit = new TL_textEmpty(); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(audio_id); - caption.text.serializeToStream(stream); - } - } - //PageBlock end - - //EncryptedChat start - public static abstract class EncryptedChat extends TLObject { - public int flags; - public int folder_id; - public int id; - public long access_hash; - public int date; - public long admin_id; - public long participant_id; - public byte[] g_a; - public byte[] nonce; - public byte[] g_a_or_b; - public long key_fingerprint; - public boolean history_deleted; - public byte[] a_or_b; //custom - public byte[] auth_key; //custom - public long user_id; //custom - public int ttl; //custom - public int layer; //custom - public int seq_in; //custom - public int seq_out; //custom - public int in_seq_no; //custom - public int mtproto_seq; //custom - public byte[] key_hash; //custom - public short key_use_count_in; //custom - public short key_use_count_out; //custom - public long exchange_id; //custom - public int key_create_date; //custom - public long future_key_fingerprint; //custom - public byte[] future_auth_key; //custom - - public static EncryptedChat TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - EncryptedChat result = null; - switch (constructor) { - case 0xfda9a7b7: - result = new TL_encryptedChatRequested_old(); - break; - case 0xc878527e: - result = new TL_encryptedChatRequested_layer115(); - break; - case 0xfa56ce36: - result = new TL_encryptedChat_layer131(); - break; - case 0x62718a82: - result = new TL_encryptedChatRequested_layer131(); - break; - case 0x6601d14f: - result = new TL_encryptedChat_old(); - break; - case 0xab7ec0a0: - result = new TL_encryptedChatEmpty(); - break; - case 0x3bf703dc: - result = new TL_encryptedChatWaiting_layer131(); - break; - case 0x13d6dd27: - result = new TL_encryptedChatDiscarded_layer122(); - break; - case 0x1e1c7c45: - result = new TL_encryptedChatDiscarded(); - break; - case 0x66b25953: - result = new TL_encryptedChatWaiting(); - break; - case 0x48f1d94c: - result = new TL_encryptedChatRequested(); - break; - case 0x61f0d4c7: - result = new TL_encryptedChat(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in EncryptedChat", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } - } - //EncryptedChat end - - //Message start - public static class Message extends TLObject { - public int id; - public Peer from_id; - public int from_boosts_applied; - public Peer peer_id; - public Peer saved_peer_id; - public int date; - public int expire_date; - public MessageAction action; - public String message; - public MessageMedia media; - public int flags; - public int flags2; - public boolean mentioned; - public boolean media_unread; - public boolean out; - public boolean unread; - public ArrayList entities = new ArrayList<>(); - public String via_bot_name; - public ReplyMarkup reply_markup; - public int views; - public int forwards; - public MessageReplies replies; - public int edit_date; - public boolean silent; - public boolean post; - public boolean from_scheduled; - public boolean legacy; - public boolean edit_hide; - public boolean pinned; - public MessageFwdHeader fwd_from; - public long via_bot_id; - public long via_business_bot_id; - public MessageReplyHeader reply_to; - public String post_author; - public long grouped_id; - public TL_messageReactions reactions; - public ArrayList restriction_reason = new ArrayList<>(); - public int ttl_period; - public int quick_reply_shortcut_id; - public long effect; - public boolean noforwards; - public boolean invert_media; - public boolean offline; - public boolean video_processing_pending; - public TL_factCheck factcheck; - public int send_state = 0; //custom - public int fwd_msg_id = 0; //custom - public String attachPath = ""; //custom - public ArrayList attachPaths; //custom - public HashMap params; //custom - public long random_id; //custom - public int local_id = 0; //custom - public long dialog_id; //custom - public int ttl; //custom - public int destroyTime; //custom - public long destroyTimeMillis; //custom - public int layer; //custom - public int seq_in; //custom - public int seq_out; //custom - public boolean with_my_score; - public Message replyMessage; //custom - public int reqId; //custom - public int realId; //custom - public int stickerVerified = 1; //custom - public boolean isThreadMessage; //custom - public String voiceTranscription; //custom - public boolean voiceTranscriptionOpen; //custom - public boolean voiceTranscriptionRated; //custom - public boolean voiceTranscriptionFinal; //custom - public boolean voiceTranscriptionForce; //custom - public long voiceTranscriptionId; //custom - public boolean premiumEffectWasPlayed; //custom - public String originalLanguage; //custom - public String translatedToLanguage; //custom - public TL_textWithEntities translatedText; // custom - public TL_stories.StoryItem replyStory; //custom - public InputQuickReplyShortcut quick_reply_shortcut; //custom - - public static Message TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - Message result = null; - switch (constructor) { - case 0x1d86f70e: - result = new TL_messageService_old2(); - break; - case 0xa7ab1991: - result = new TL_message_old3(); - break; - case 0xc3060325: - result = new TL_message_old4(); - break; - case 0x555555fa: - result = new TL_message_secret(); - break; - case 0x555555f9: - result = new TL_message_secret_layer72(); - break; - case 0x90dddc11: - result = new TL_message_layer72(); - break; - case 0xc09be45f: - result = new TL_message_layer68(); - break; - case 0xc992e15c: - result = new TL_message_layer47(); - break; - case 0x5ba66c13: - result = new TL_message_old7(); - break; - case 0xc06b9607: - result = new TL_messageService_layer48(); - break; - case 0x83e5de54: - result = new TL_messageEmpty_layer122(); - break; - case 0x2bebfa86: - result = new TL_message_old6(); - break; - case 0x44f9b43d: - result = new TL_message_layer104(); - break; - case 0x90a6ca84: - result = new TL_messageEmpty(); - break; - case 0x1c9b1027: - result = new TL_message_layer104_2(); - break; - case 0xa367e716: - result = new TL_messageForwarded_old2(); - break; - case 0x5f46804: - result = new TL_messageForwarded_old(); - break; - case 0x567699b3: - result = new TL_message_old2(); - break; - case 0x9f8d60bb: - result = new TL_messageService_old(); - break; - case 0x22eb6aba: - result = new TL_message_old(); - break; - case 0x555555F8: - result = new TL_message_secret_old(); - break; - case 0x9789dac4: - result = new TL_message_layer104_3(); - break; - case 0x452c0e65: - result = new TL_message_layer117(); - break; - case 0xf52e6b7f: - result = new TL_message_layer118(); - break; - case 0x58ae39c9: - result = new TL_message_layer123(); - break; - case 0xbce383d2: - result = new TL_message_layer131(); - break; - case 0x85d6cbe2: - result = new TL_message_layer135(); - break; - case TL_message.constructor: - result = new TL_message(); - break; - case TL_message_layer180.constructor: - result = new TL_message_layer180(); - break; - case 0xa4e97f37: - case TL_message_layer179.constructor: - result = new TL_message_layer179(); - break; - case TL_message_layer176.constructor: - result = new TL_message_layer176(); - break; - case TL_message_layer175.constructor: - result = new TL_message_layer175(); - break; - case TL_message_layer169.constructor: - result = new TL_message_layer169(); - break; - case TL_message_layer173.constructor: - result = new TL_message_layer173(); - break; - case 0x9e19a1f6: - result = new TL_messageService_layer118(); - break; - case 0x286fa604: - result = new TL_messageService_layer123(); - break; - case 0x2b085862: - result = new TL_messageService(); - break; - case 0xf07814c8: - result = new TL_message_old5(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in Message", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - if (result.from_id == null) { - if (result.id < 0 && result.random_id == 0) { - result.from_id = new TL_peerUser(); - } else { - result.from_id = result.peer_id; - } - } - } - return result; - } - - public void readAttachPath(AbstractSerializedData stream, long currentUserId) { - boolean hasMedia = media != null && !(media instanceof TL_messageMediaEmpty) && !(media instanceof TL_messageMediaWebPage); - boolean fixCaption = !TextUtils.isEmpty(message) && - (media instanceof TL_messageMediaPhoto_old || - media instanceof TL_messageMediaPhoto_layer68 || - media instanceof TL_messageMediaPhoto_layer74 || - media instanceof TL_messageMediaDocument_old || - media instanceof TL_messageMediaDocument_layer68 || - media instanceof TL_messageMediaDocument_layer74) - && message.startsWith("-1"); - if ((out || peer_id != null && from_id != null && peer_id.user_id != 0 && peer_id.user_id == from_id.user_id && from_id.user_id == currentUserId) && (id < 0 || hasMedia || send_state == 3) || legacy) { - if (hasMedia && fixCaption) { - if (message.length() > 6 && message.charAt(2) == '_') { - params = new HashMap<>(); - params.put("ve", message); - } - if (params != null || message.length() == 2) { - message = ""; - } - } - if (stream.remaining() > 0) { - attachPath = stream.readString(false); - if (attachPath != null) { - if ((id < 0 || send_state == 3 || legacy) && attachPath.startsWith("||")) { - String args[] = attachPath.split("\\|\\|"); - if (args.length > 0) { - if (params == null) { - params = new HashMap<>(); - } - for (int a = 1; a < args.length - 1; a++) { - String args2[] = args[a].split("\\|=\\|"); - if (args2.length == 2) { - params.put(args2[0], args2[1]); - } - } - attachPath = args[args.length - 1].trim(); - if (legacy) { - layer = Utilities.parseInt(params.get("legacy_layer")); - } - } - } else { - attachPath = attachPath.trim(); - } - } - } - } - if ((flags & MESSAGE_FLAG_FWD) != 0 && id < 0) { - fwd_msg_id = stream.readInt32(false); - } -// if (media instanceof TLRPC.TL_messageMediaPaidMedia && stream.remaining() > 0) { -// TLRPC.TL_messageMediaPaidMedia paidMedia = (TLRPC.TL_messageMediaPaidMedia) media; -// final int size = stream.readInt32(false); -// for (int i = 0; i < size; ++i) { -// final String attachPath = stream.readString(false); -// if (i < paidMedia.extended_media.size()) { -// paidMedia.extended_media.get(i).attachPath = attachPath; -// } -// } -// } - } - - protected void writeAttachPath(AbstractSerializedData stream) { - if (this instanceof TL_message_secret || this instanceof TL_message_secret_layer72) { - String path = attachPath != null ? attachPath : ""; - if (send_state == 1 && params != null && params.size() > 0) { - for (HashMap.Entry entry : params.entrySet()) { - path = entry.getKey() + "|=|" + entry.getValue() + "||" + path; - } - path = "||" + path; - } - stream.writeString(path); - } else { - String path = !TextUtils.isEmpty(attachPath) ? attachPath : " "; - if (legacy) { - if (params == null) { - params = new HashMap<>(); - } - layer = LAYER; - params.put("legacy_layer", "" + LAYER); - } - if ((id < 0 || send_state == 3 || legacy) && params != null && params.size() > 0) { - for (HashMap.Entry entry : params.entrySet()) { - path = entry.getKey() + "|=|" + entry.getValue() + "||" + path; - } - path = "||" + path; - } - stream.writeString(path); - if ((flags & MESSAGE_FLAG_FWD) != 0 && id < 0) { - stream.writeInt32(fwd_msg_id); - } -// if (media instanceof TLRPC.TL_messageMediaPaidMedia) { -// TLRPC.TL_messageMediaPaidMedia paidMedia = (TLRPC.TL_messageMediaPaidMedia) media; -// stream.writeInt32(paidMedia.extended_media.size()); -// for (int i = 0; i < paidMedia.extended_media.size(); ++i) { -// TLRPC.MessageExtendedMedia emedia = paidMedia.extended_media.get(i); -// String attachPath = emedia.attachPath == null ? "" : emedia.attachPath; -// stream.writeString(attachPath); -// } -// } - } - } - } - - public static class TL_messageEmpty_layer122 extends TL_messageEmpty { - public static final int constructor = 0x83e5de54; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - peer_id = new TL_peerUser(); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - } - } - - public static class TL_messageEmpty extends Message { - public static final int constructor = 0x90a6ca84; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - id = stream.readInt32(exception); - if ((flags & 1) != 0) { - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - } else { - peer_id = new TL_peerUser(); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 1) != 0) { - peer_id.serializeToStream(stream); - } - } - } - - public static class TL_messageService_old2 extends TL_messageService { - public static final int constructor = 0x1d86f70e; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - date = stream.readInt32(exception); - action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); - flags |= MESSAGE_FLAG_HAS_FROM_ID; - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeInt32((int) from_id.user_id); - peer_id.serializeToStream(stream); - stream.writeInt32(date); - action.serializeToStream(stream); - } - } - - public static class TL_message_layer72 extends TL_message { - public static final int constructor = 0x90dddc11; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - silent = (flags & 8192) != 0; - post = (flags & 16384) != 0; - id = stream.readInt32(exception); - if ((flags & 256) != 0) { - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); - } - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 4) != 0) { - fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 2048) != 0) { - via_bot_id = stream.readInt32(exception); - } - if ((flags & 8) != 0) { - reply_to = new TLRPC.TL_messageReplyHeader(); - reply_to.flags |= 16; - reply_to.reply_to_msg_id = stream.readInt32(exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null) { - ttl = media.ttl_seconds; - } - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - } - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 1024) != 0) { - views = stream.readInt32(exception); - } - if ((flags & 32768) != 0) { - edit_date = stream.readInt32(exception); - } - if ((flags & 65536) != 0) { - post_author = stream.readString(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - flags = silent ? (flags | 8192) : (flags &~ 8192); - flags = post ? (flags | 16384) : (flags &~ 16384); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 256) != 0) { - stream.writeInt32((int) from_id.user_id); - } - peer_id.serializeToStream(stream); - if ((flags & 4) != 0) { - fwd_from.serializeToStream(stream); - } - if ((flags & 2048) != 0) { - stream.writeInt32((int) via_bot_id); - } - if ((flags & 8) != 0) { - stream.writeInt32(reply_to.reply_to_msg_id); - } - stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 1024) != 0) { - stream.writeInt32(views); - } - if ((flags & 32768) != 0) { - stream.writeInt32(edit_date); - } - if ((flags & 65536) != 0) { - stream.writeString(post_author); - } - writeAttachPath(stream); - } - } - - public static class TL_message_layer68 extends TL_message { - public static final int constructor = 0xc09be45f; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - silent = (flags & 8192) != 0; - post = (flags & 16384) != 0; - with_my_score = (flags & 1073741824) != 0; - id = stream.readInt32(exception); - if ((flags & 256) != 0) { - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); - } - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (from_id == null) { - from_id = peer_id; - } - if ((flags & 4) != 0) { - fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 2048) != 0) { - via_bot_id = stream.readInt32(exception); - } - if ((flags & 8) != 0) { - reply_to = new TLRPC.TL_messageReplyHeader(); - reply_to.flags |= 16; - reply_to.reply_to_msg_id = stream.readInt32(exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - } else { - media = new TL_messageMediaEmpty(); - } - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 1024) != 0) { - views = stream.readInt32(exception); - } - if ((flags & 32768) != 0) { - edit_date = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - flags = silent ? (flags | 8192) : (flags &~ 8192); - flags = post ? (flags | 16384) : (flags &~ 16384); - flags = with_my_score ? (flags | 1073741824) : (flags &~ 1073741824); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 256) != 0) { - stream.writeInt32((int) from_id.user_id); - } - peer_id.serializeToStream(stream); - if ((flags & 4) != 0) { - fwd_from.serializeToStream(stream); - } - if ((flags & 2048) != 0) { - stream.writeInt32((int) via_bot_id); - } - if ((flags & 8) != 0) { - stream.writeInt32(reply_to.reply_to_msg_id); - } - stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 1024) != 0) { - stream.writeInt32(views); - } - if ((flags & 32768) != 0) { - stream.writeInt32(edit_date); - } - writeAttachPath(stream); - } - } - - public static class TL_message_layer47 extends TL_message { - public static final int constructor = 0xc992e15c; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - if ((flags & 256) != 0) { - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); - } - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (from_id == null) { - from_id = peer_id; - } - if ((flags & 4) != 0) { - fwd_from = new TL_messageFwdHeader(); - Peer peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (peer != null) { - fwd_from.from_id = peer; - fwd_from.flags |= 1; - } - fwd_from.date = stream.readInt32(exception); - } - if ((flags & 2048) != 0) { - via_bot_id = stream.readInt32(exception); - } - if ((flags & 8) != 0) { - reply_to = new TLRPC.TL_messageReplyHeader(); - reply_to.flags |= 16; - reply_to.reply_to_msg_id = stream.readInt32(exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - } else { - media = new TL_messageMediaEmpty(); - } - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 1024) != 0) { - views = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 256) != 0) { - stream.writeInt32((int) from_id.user_id); - } - peer_id.serializeToStream(stream); - if ((flags & 4) != 0) { - if (fwd_from.from_id != null) { - fwd_from.from_id.serializeToStream(stream); - } - stream.writeInt32(fwd_from.date); - } - if ((flags & 2048) != 0) { - stream.writeInt32((int) via_bot_id); - } - if ((flags & 8) != 0) { - stream.writeInt32(reply_to.reply_to_msg_id); - } - stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 1024) != 0) { - stream.writeInt32(views); - } - writeAttachPath(stream); - } - } - - public static class TL_message_old7 extends TL_message { - public static final int constructor = 0x5ba66c13; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - if ((flags & 256) != 0) { - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); - } - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (from_id == null) { - from_id = peer_id; - } - if ((flags & 4) != 0) { - fwd_from = new TL_messageFwdHeader(); - Peer peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (peer != null) { - fwd_from.from_id = peer; - fwd_from.flags |= 1; - } - fwd_from.date = stream.readInt32(exception); - } - if ((flags & 8) != 0) { - reply_to = new TLRPC.TL_messageReplyHeader(); - reply_to.flags |= 16; - reply_to.reply_to_msg_id = stream.readInt32(exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - } else { - media = new TL_messageMediaEmpty(); - } - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 1024) != 0) { - views = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 256) != 0) { - stream.writeInt32((int) from_id.user_id); - } - peer_id.serializeToStream(stream); - if ((flags & 4) != 0) { - if (fwd_from.from_id != null) { - fwd_from.from_id.serializeToStream(stream); - } - stream.writeInt32(fwd_from.date); - } - if ((flags & 8) != 0) { - stream.writeInt32(reply_to.reply_to_msg_id); - } - stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 1024) != 0) { - stream.writeInt32(views); - } - writeAttachPath(stream); - } - } - - public static class TL_messageForwarded_old2 extends Message { - public static final int constructor = 0xa367e716; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - fwd_from = new TL_messageFwdHeader(); - fwd_from.from_id = new TLRPC.TL_peerUser(); - fwd_from.from_id.user_id = stream.readInt32(exception); - fwd_from.flags |= 1; - fwd_from.date = stream.readInt32(exception); - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - date = stream.readInt32(exception); - message = stream.readString(exception); - flags |= MESSAGE_FLAG_FWD | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeInt32((int) fwd_from.from_id.user_id); - stream.writeInt32(fwd_from.date); - stream.writeInt32((int) from_id.user_id); - peer_id.serializeToStream(stream); - stream.writeInt32(date); - stream.writeString(message); - media.serializeToStream(stream); - } - } - - public static class TL_message extends Message { - public static final int constructor = 0x94345242; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - silent = (flags & 8192) != 0; - post = (flags & 16384) != 0; - from_scheduled = (flags & 262144) != 0; - legacy = (flags & 524288) != 0; - edit_hide = (flags & 2097152) != 0; - pinned = (flags & 16777216) != 0; - noforwards = (flags & 67108864) != 0; - invert_media = (flags & 134217728) != 0; - flags2 = stream.readInt32(exception); - offline = (flags2 & 2) != 0; - video_processing_pending = (flags2 & 16) != 0; - id = stream.readInt32(exception); - if ((flags & 256) != 0) { - from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 536870912) != 0) { - from_boosts_applied = stream.readInt32(exception); - } - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 268435456) != 0) { - saved_peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4) != 0) { - fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 2048) != 0) { - via_bot_id = stream.readInt64(exception); - } - if ((flags2 & 1) != 0) { - via_business_bot_id = stream.readInt64(exception); - } - if ((flags & 8) != 0) { - reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null) { - ttl = media.ttl_seconds; - } - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - } - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 1024) != 0) { - views = stream.readInt32(exception); - } - if ((flags & 1024) != 0) { - forwards = stream.readInt32(exception); - } - if ((flags & 8388608) != 0) { - replies = MessageReplies.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 32768) != 0) { - edit_date = stream.readInt32(exception); - } - if ((flags & 65536) != 0) { - post_author = stream.readString(exception); - } - if ((flags & 131072) != 0) { - grouped_id = stream.readInt64(exception); - } - if ((flags & 1048576) != 0) { - reactions = MessageReactions.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4194304) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } - } - if ((flags & 33554432) != 0) { - ttl_period = stream.readInt32(exception); - } - if ((flags & 1073741824) != 0) { - quick_reply_shortcut_id = stream.readInt32(exception); - } - if ((flags2 & 4) != 0) { - effect = stream.readInt64(exception); - } - if ((flags2 & 8) != 0) { - factcheck = TL_factCheck.TLdeserialize(stream, stream.readInt32(exception), exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - flags = silent ? (flags | 8192) : (flags &~ 8192); - flags = post ? (flags | 16384) : (flags &~ 16384); - flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); - flags = legacy ? (flags | 524288) : (flags &~ 524288); - flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); - flags = pinned ? (flags | 16777216) : (flags &~ 16777216); - flags = noforwards ? (flags | 67108864) : (flags &~ 67108864); - flags = invert_media ? (flags | 134217728) : (flags &~ 134217728); - stream.writeInt32(flags); - flags2 = offline ? (flags2 | 2) : (flags2 &~ 2); - flags2 = video_processing_pending ? (flags2 | 16) : (flags2 &~ 16); - stream.writeInt32(flags2); - stream.writeInt32(id); - if ((flags & 256) != 0) { - from_id.serializeToStream(stream); - } - if ((flags & 536870912) != 0) { - stream.writeInt32(from_boosts_applied); - } - peer_id.serializeToStream(stream); - if ((flags & 268435456) != 0) { - saved_peer_id.serializeToStream(stream); - } - if ((flags & 4) != 0) { - fwd_from.serializeToStream(stream); - } - if ((flags & 2048) != 0) { - stream.writeInt64(via_bot_id); - } - if ((flags2 & 1) != 0) { - stream.writeInt64(via_business_bot_id); - } - if ((flags & 8) != 0) { - reply_to.serializeToStream(stream); - } - stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 1024) != 0) { - stream.writeInt32(views); - } - if ((flags & 1024) != 0) { - stream.writeInt32(forwards); - } - if ((flags & 8388608) != 0) { - replies.serializeToStream(stream); - } - if ((flags & 32768) != 0) { - stream.writeInt32(edit_date); - } - if ((flags & 65536) != 0) { - stream.writeString(post_author); - } - if ((flags & 131072) != 0) { - stream.writeInt64(grouped_id); - } - if ((flags & 1048576) != 0) { - reactions.serializeToStream(stream); - } - if ((flags & 4194304) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } - } - if ((flags & 33554432) != 0) { - stream.writeInt32(ttl_period); - } - if ((flags & 1073741824) != 0) { - stream.writeInt32(quick_reply_shortcut_id); - } - if ((flags2 & 4) != 0) { - stream.writeInt64(effect); - } - if ((flags2 & 8) != 0) { - factcheck.serializeToStream(stream); - } - writeAttachPath(stream); - } - } - - public static class TL_message_layer180 extends TL_message { - public static final int constructor = 0xbde09c2e; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - silent = (flags & 8192) != 0; - post = (flags & 16384) != 0; - from_scheduled = (flags & 262144) != 0; - legacy = (flags & 524288) != 0; - edit_hide = (flags & 2097152) != 0; - pinned = (flags & 16777216) != 0; - noforwards = (flags & 67108864) != 0; - invert_media = (flags & 134217728) != 0; - flags2 = stream.readInt32(exception); - offline = (flags2 & 2) != 0; - id = stream.readInt32(exception); - if ((flags & 256) != 0) { - from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 536870912) != 0) { - from_boosts_applied = stream.readInt32(exception); - } - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 268435456) != 0) { - saved_peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4) != 0) { - fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 2048) != 0) { - via_bot_id = stream.readInt64(exception); - } - if ((flags2 & 1) != 0) { - via_business_bot_id = stream.readInt64(exception); - } - if ((flags & 8) != 0) { - reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null) { - ttl = media.ttl_seconds; - } - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - } - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 1024) != 0) { - views = stream.readInt32(exception); - } - if ((flags & 1024) != 0) { - forwards = stream.readInt32(exception); - } - if ((flags & 8388608) != 0) { - replies = MessageReplies.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 32768) != 0) { - edit_date = stream.readInt32(exception); - } - if ((flags & 65536) != 0) { - post_author = stream.readString(exception); - } - if ((flags & 131072) != 0) { - grouped_id = stream.readInt64(exception); - } - if ((flags & 1048576) != 0) { - reactions = MessageReactions.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4194304) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } - } - if ((flags & 33554432) != 0) { - ttl_period = stream.readInt32(exception); - } - if ((flags & 1073741824) != 0) { - quick_reply_shortcut_id = stream.readInt32(exception); - } - if ((flags2 & 4) != 0) { - effect = stream.readInt64(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - flags = silent ? (flags | 8192) : (flags &~ 8192); - flags = post ? (flags | 16384) : (flags &~ 16384); - flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); - flags = legacy ? (flags | 524288) : (flags &~ 524288); - flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); - flags = pinned ? (flags | 16777216) : (flags &~ 16777216); - flags = noforwards ? (flags | 67108864) : (flags &~ 67108864); - flags = invert_media ? (flags | 134217728) : (flags &~ 134217728); - stream.writeInt32(flags); - flags2 = offline ? (flags2 | 2) : (flags2 &~ 2); - stream.writeInt32(flags2); - stream.writeInt32(id); - if ((flags & 256) != 0) { - from_id.serializeToStream(stream); - } - if ((flags & 536870912) != 0) { - stream.writeInt32(from_boosts_applied); - } - peer_id.serializeToStream(stream); - if ((flags & 268435456) != 0) { - saved_peer_id.serializeToStream(stream); - } - if ((flags & 4) != 0) { - fwd_from.serializeToStream(stream); - } - if ((flags & 2048) != 0) { - stream.writeInt64(via_bot_id); - } - if ((flags2 & 1) != 0) { - stream.writeInt64(via_business_bot_id); - } - if ((flags & 8) != 0) { - reply_to.serializeToStream(stream); - } - stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 1024) != 0) { - stream.writeInt32(views); - } - if ((flags & 1024) != 0) { - stream.writeInt32(forwards); - } - if ((flags & 8388608) != 0) { - replies.serializeToStream(stream); - } - if ((flags & 32768) != 0) { - stream.writeInt32(edit_date); - } - if ((flags & 65536) != 0) { - stream.writeString(post_author); - } - if ((flags & 131072) != 0) { - stream.writeInt64(grouped_id); - } - if ((flags & 1048576) != 0) { - reactions.serializeToStream(stream); - } - if ((flags & 4194304) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } - } - if ((flags & 33554432) != 0) { - stream.writeInt32(ttl_period); - } - if ((flags & 1073741824) != 0) { - stream.writeInt32(quick_reply_shortcut_id); - } - if ((flags2 & 4) != 0) { - stream.writeInt64(effect); - } - writeAttachPath(stream); - } - } - - public static class TL_message_layer179 extends TL_message { - public static final int constructor = 0x2357bf25; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - silent = (flags & 8192) != 0; - post = (flags & 16384) != 0; - from_scheduled = (flags & 262144) != 0; - legacy = (flags & 524288) != 0; - edit_hide = (flags & 2097152) != 0; - pinned = (flags & 16777216) != 0; - noforwards = (flags & 67108864) != 0; - invert_media = (flags & 134217728) != 0; - flags2 = stream.readInt32(exception); - offline = (flags2 & 2) != 0; - id = stream.readInt32(exception); - if ((flags & 256) != 0) { - from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 536870912) != 0) { - from_boosts_applied = stream.readInt32(exception); - } - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 268435456) != 0) { - saved_peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4) != 0) { - fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 2048) != 0) { - via_bot_id = stream.readInt64(exception); - } - if ((flags2 & 1) != 0) { - via_business_bot_id = stream.readInt64(exception); - } - if ((flags & 8) != 0) { - reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null) { - ttl = media.ttl_seconds; - } - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - } - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 1024) != 0) { - views = stream.readInt32(exception); - } - if ((flags & 1024) != 0) { - forwards = stream.readInt32(exception); - } - if ((flags & 8388608) != 0) { - replies = MessageReplies.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 32768) != 0) { - edit_date = stream.readInt32(exception); - } - if ((flags & 65536) != 0) { - post_author = stream.readString(exception); - } - if ((flags & 131072) != 0) { - grouped_id = stream.readInt64(exception); - } - if ((flags & 1048576) != 0) { - reactions = MessageReactions.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4194304) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } - } - if ((flags & 33554432) != 0) { - ttl_period = stream.readInt32(exception); - } - if ((flags & 1073741824) != 0) { - quick_reply_shortcut_id = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - flags = silent ? (flags | 8192) : (flags &~ 8192); - flags = post ? (flags | 16384) : (flags &~ 16384); - flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); - flags = legacy ? (flags | 524288) : (flags &~ 524288); - flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); - flags = pinned ? (flags | 16777216) : (flags &~ 16777216); - flags = noforwards ? (flags | 67108864) : (flags &~ 67108864); - flags = invert_media ? (flags | 134217728) : (flags &~ 134217728); - stream.writeInt32(flags); - flags2 = offline ? (flags2 | 2) : (flags2 &~ 2); - stream.writeInt32(flags2); - stream.writeInt32(id); - if ((flags & 256) != 0) { - from_id.serializeToStream(stream); - } - if ((flags & 536870912) != 0) { - stream.writeInt32(from_boosts_applied); - } - peer_id.serializeToStream(stream); - if ((flags & 268435456) != 0) { - saved_peer_id.serializeToStream(stream); - } - if ((flags & 4) != 0) { - fwd_from.serializeToStream(stream); - } - if ((flags & 2048) != 0) { - stream.writeInt64(via_bot_id); - } - if ((flags2 & 1) != 0) { - stream.writeInt64(via_business_bot_id); - } - if ((flags & 8) != 0) { - reply_to.serializeToStream(stream); - } - stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 1024) != 0) { - stream.writeInt32(views); - } - if ((flags & 1024) != 0) { - stream.writeInt32(forwards); - } - if ((flags & 8388608) != 0) { - replies.serializeToStream(stream); - } - if ((flags & 32768) != 0) { - stream.writeInt32(edit_date); - } - if ((flags & 65536) != 0) { - stream.writeString(post_author); - } - if ((flags & 131072) != 0) { - stream.writeInt64(grouped_id); - } - if ((flags & 1048576) != 0) { - reactions.serializeToStream(stream); - } - if ((flags & 4194304) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } - } - if ((flags & 33554432) != 0) { - stream.writeInt32(ttl_period); - } - if ((flags & 1073741824) != 0) { - stream.writeInt32(quick_reply_shortcut_id); - } - writeAttachPath(stream); - } - } - - public static class TL_message_layer176 extends TL_message { - public static final int constructor = 0xa66c7efc; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - silent = (flags & 8192) != 0; - post = (flags & 16384) != 0; - from_scheduled = (flags & 262144) != 0; - legacy = (flags & 524288) != 0; - edit_hide = (flags & 2097152) != 0; - pinned = (flags & 16777216) != 0; - noforwards = (flags & 67108864) != 0; - invert_media = (flags & 134217728) != 0; - id = stream.readInt32(exception); - if ((flags & 256) != 0) { - from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 536870912) != 0) { - from_boosts_applied = stream.readInt32(exception); - } - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 268435456) != 0) { - saved_peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4) != 0) { - fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 2048) != 0) { - via_bot_id = stream.readInt64(exception); - } - if ((flags & 8) != 0) { - reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null) { - ttl = media.ttl_seconds; - } - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - } - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 1024) != 0) { - views = stream.readInt32(exception); - } - if ((flags & 1024) != 0) { - forwards = stream.readInt32(exception); - } - if ((flags & 8388608) != 0) { - replies = MessageReplies.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 32768) != 0) { - edit_date = stream.readInt32(exception); - } - if ((flags & 65536) != 0) { - post_author = stream.readString(exception); - } - if ((flags & 131072) != 0) { - grouped_id = stream.readInt64(exception); - } - if ((flags & 1048576) != 0) { - reactions = MessageReactions.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4194304) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } - } - if ((flags & 33554432) != 0) { - ttl_period = stream.readInt32(exception); - } - if ((flags & 1073741824) != 0) { - quick_reply_shortcut_id = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - flags = silent ? (flags | 8192) : (flags &~ 8192); - flags = post ? (flags | 16384) : (flags &~ 16384); - flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); - flags = legacy ? (flags | 524288) : (flags &~ 524288); - flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); - flags = pinned ? (flags | 16777216) : (flags &~ 16777216); - flags = noforwards ? (flags | 67108864) : (flags &~ 67108864); - flags = invert_media ? (flags | 134217728) : (flags &~ 134217728); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 256) != 0) { - from_id.serializeToStream(stream); - } - if ((flags & 536870912) != 0) { - stream.writeInt32(from_boosts_applied); - } - peer_id.serializeToStream(stream); - if ((flags & 268435456) != 0) { - saved_peer_id.serializeToStream(stream); - } - if ((flags & 4) != 0) { - fwd_from.serializeToStream(stream); - } - if ((flags & 2048) != 0) { - stream.writeInt64(via_bot_id); - } - if ((flags & 8) != 0) { - reply_to.serializeToStream(stream); - } - stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 1024) != 0) { - stream.writeInt32(views); - } - if ((flags & 1024) != 0) { - stream.writeInt32(forwards); - } - if ((flags & 8388608) != 0) { - replies.serializeToStream(stream); - } - if ((flags & 32768) != 0) { - stream.writeInt32(edit_date); - } - if ((flags & 65536) != 0) { - stream.writeString(post_author); - } - if ((flags & 131072) != 0) { - stream.writeInt64(grouped_id); - } - if ((flags & 1048576) != 0) { - reactions.serializeToStream(stream); - } - if ((flags & 4194304) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } - } - if ((flags & 33554432) != 0) { - stream.writeInt32(ttl_period); - } - if ((flags & 1073741824) != 0) { - stream.writeInt32(quick_reply_shortcut_id); - } - writeAttachPath(stream); - } - } - - public static class TL_message_layer175 extends TL_message { - public static final int constructor = 0x1e4c8a69; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - silent = (flags & 8192) != 0; - post = (flags & 16384) != 0; - from_scheduled = (flags & 262144) != 0; - legacy = (flags & 524288) != 0; - edit_hide = (flags & 2097152) != 0; - pinned = (flags & 16777216) != 0; - noforwards = (flags & 67108864) != 0; - invert_media = (flags & 134217728) != 0; - id = stream.readInt32(exception); - if ((flags & 256) != 0) { - from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 536870912) != 0) { - from_boosts_applied = stream.readInt32(exception); - } - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 268435456) != 0) { - saved_peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4) != 0) { - fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 2048) != 0) { - via_bot_id = stream.readInt64(exception); - } - if ((flags & 8) != 0) { - reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null) { - ttl = media.ttl_seconds; - } - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - } - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 1024) != 0) { - views = stream.readInt32(exception); - } - if ((flags & 1024) != 0) { - forwards = stream.readInt32(exception); - } - if ((flags & 8388608) != 0) { - replies = MessageReplies.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 32768) != 0) { - edit_date = stream.readInt32(exception); - } - if ((flags & 65536) != 0) { - post_author = stream.readString(exception); - } - if ((flags & 131072) != 0) { - grouped_id = stream.readInt64(exception); - } - if ((flags & 1048576) != 0) { - reactions = MessageReactions.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4194304) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } - } - if ((flags & 33554432) != 0) { - ttl_period = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - flags = silent ? (flags | 8192) : (flags &~ 8192); - flags = post ? (flags | 16384) : (flags &~ 16384); - flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); - flags = legacy ? (flags | 524288) : (flags &~ 524288); - flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); - flags = pinned ? (flags | 16777216) : (flags &~ 16777216); - flags = noforwards ? (flags | 67108864) : (flags &~ 67108864); - flags = invert_media ? (flags | 134217728) : (flags &~ 134217728); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 256) != 0) { - from_id.serializeToStream(stream); - } - if ((flags & 536870912) != 0) { - stream.writeInt32(from_boosts_applied); - } - peer_id.serializeToStream(stream); - if ((flags & 268435456) != 0) { - saved_peer_id.serializeToStream(stream); - } - if ((flags & 4) != 0) { - fwd_from.serializeToStream(stream); - } - if ((flags & 2048) != 0) { - stream.writeInt64(via_bot_id); - } - if ((flags & 8) != 0) { - reply_to.serializeToStream(stream); - } - stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 1024) != 0) { - stream.writeInt32(views); - } - if ((flags & 1024) != 0) { - stream.writeInt32(forwards); - } - if ((flags & 8388608) != 0) { - replies.serializeToStream(stream); - } - if ((flags & 32768) != 0) { - stream.writeInt32(edit_date); - } - if ((flags & 65536) != 0) { - stream.writeString(post_author); - } - if ((flags & 131072) != 0) { - stream.writeInt64(grouped_id); - } - if ((flags & 1048576) != 0) { - reactions.serializeToStream(stream); - } - if ((flags & 4194304) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } - } - if ((flags & 33554432) != 0) { - stream.writeInt32(ttl_period); - } - writeAttachPath(stream); - } - } - - public static class TL_message_layer173 extends TL_message { - public static final int constructor = 0x76bec211; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - silent = (flags & 8192) != 0; - post = (flags & 16384) != 0; - from_scheduled = (flags & 262144) != 0; - legacy = (flags & 524288) != 0; - edit_hide = (flags & 2097152) != 0; - pinned = (flags & 16777216) != 0; - noforwards = (flags & 67108864) != 0; - invert_media = (flags & 134217728) != 0; - id = stream.readInt32(exception); - if ((flags & 256) != 0) { - from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 268435456) != 0) { - saved_peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4) != 0) { - fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 2048) != 0) { - via_bot_id = stream.readInt64(exception); - } - if ((flags & 8) != 0) { - reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null) { - ttl = media.ttl_seconds; - } - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - } - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 1024) != 0) { - views = stream.readInt32(exception); - } - if ((flags & 1024) != 0) { - forwards = stream.readInt32(exception); - } - if ((flags & 8388608) != 0) { - replies = MessageReplies.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 32768) != 0) { - edit_date = stream.readInt32(exception); - } - if ((flags & 65536) != 0) { - post_author = stream.readString(exception); - } - if ((flags & 131072) != 0) { - grouped_id = stream.readInt64(exception); - } - if ((flags & 1048576) != 0) { - reactions = MessageReactions.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4194304) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } - } - if ((flags & 33554432) != 0) { - ttl_period = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - flags = silent ? (flags | 8192) : (flags &~ 8192); - flags = post ? (flags | 16384) : (flags &~ 16384); - flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); - flags = legacy ? (flags | 524288) : (flags &~ 524288); - flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); - flags = pinned ? (flags | 16777216) : (flags &~ 16777216); - flags = noforwards ? (flags | 67108864) : (flags &~ 67108864); - flags = invert_media ? (flags | 134217728) : (flags &~ 134217728); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 256) != 0) { - from_id.serializeToStream(stream); - } - peer_id.serializeToStream(stream); - if ((flags & 268435456) != 0) { - saved_peer_id.serializeToStream(stream); - } - if ((flags & 4) != 0) { - fwd_from.serializeToStream(stream); - } - if ((flags & 2048) != 0) { - stream.writeInt64(via_bot_id); - } - if ((flags & 8) != 0) { - reply_to.serializeToStream(stream); - } - stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 1024) != 0) { - stream.writeInt32(views); - } - if ((flags & 1024) != 0) { - stream.writeInt32(forwards); - } - if ((flags & 8388608) != 0) { - replies.serializeToStream(stream); - } - if ((flags & 32768) != 0) { - stream.writeInt32(edit_date); - } - if ((flags & 65536) != 0) { - stream.writeString(post_author); - } - if ((flags & 131072) != 0) { - stream.writeInt64(grouped_id); - } - if ((flags & 1048576) != 0) { - reactions.serializeToStream(stream); - } - if ((flags & 4194304) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } - } - if ((flags & 33554432) != 0) { - stream.writeInt32(ttl_period); - } - writeAttachPath(stream); - } - } - - public static class TL_message_layer169 extends TL_message { - public static final int constructor = 0x38116ee0; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - silent = (flags & 8192) != 0; - post = (flags & 16384) != 0; - from_scheduled = (flags & 262144) != 0; - legacy = (flags & 524288) != 0; - edit_hide = (flags & 2097152) != 0; - pinned = (flags & 16777216) != 0; - noforwards = (flags & 67108864) != 0; - invert_media = (flags & 134217728) != 0; - id = stream.readInt32(exception); - if ((flags & 256) != 0) { - from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 4) != 0) { - fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 2048) != 0) { - via_bot_id = stream.readInt64(exception); - } - if ((flags & 8) != 0) { - reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null) { - ttl = media.ttl_seconds; - } - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - } - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 1024) != 0) { - views = stream.readInt32(exception); - } - if ((flags & 1024) != 0) { - forwards = stream.readInt32(exception); - } - if ((flags & 8388608) != 0) { - replies = MessageReplies.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 32768) != 0) { - edit_date = stream.readInt32(exception); - } - if ((flags & 65536) != 0) { - post_author = stream.readString(exception); - } - if ((flags & 131072) != 0) { - grouped_id = stream.readInt64(exception); - } - if ((flags & 1048576) != 0) { - reactions = MessageReactions.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4194304) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } - } - if ((flags & 33554432) != 0) { - ttl_period = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - flags = silent ? (flags | 8192) : (flags &~ 8192); - flags = post ? (flags | 16384) : (flags &~ 16384); - flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); - flags = legacy ? (flags | 524288) : (flags &~ 524288); - flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); - flags = pinned ? (flags | 16777216) : (flags &~ 16777216); - flags = noforwards ? (flags | 67108864) : (flags &~ 67108864); - flags = invert_media ? (flags | 134217728) : (flags &~ 134217728); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 256) != 0) { - from_id.serializeToStream(stream); - } - peer_id.serializeToStream(stream); - if ((flags & 4) != 0) { - fwd_from.serializeToStream(stream); - } - if ((flags & 2048) != 0) { - stream.writeInt64(via_bot_id); - } - if ((flags & 8) != 0) { - reply_to.serializeToStream(stream); - } - stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 1024) != 0) { - stream.writeInt32(views); - } - if ((flags & 1024) != 0) { - stream.writeInt32(forwards); - } - if ((flags & 8388608) != 0) { - replies.serializeToStream(stream); - } - if ((flags & 32768) != 0) { - stream.writeInt32(edit_date); - } - if ((flags & 65536) != 0) { - stream.writeString(post_author); - } - if ((flags & 131072) != 0) { - stream.writeInt64(grouped_id); - } - if ((flags & 1048576) != 0) { - reactions.serializeToStream(stream); - } - if ((flags & 4194304) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } - } - if ((flags & 33554432) != 0) { - stream.writeInt32(ttl_period); - } - writeAttachPath(stream); - } - } - - public static class TL_message_layer135 extends TL_message { - public static final int constructor = 0x85d6cbe2; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - silent = (flags & 8192) != 0; - post = (flags & 16384) != 0; - from_scheduled = (flags & 262144) != 0; - legacy = (flags & 524288) != 0; - edit_hide = (flags & 2097152) != 0; - pinned = (flags & 16777216) != 0; - noforwards = (flags & 67108864) != 0; - id = stream.readInt32(exception); - if ((flags & 256) != 0) { - from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 4) != 0) { - fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 2048) != 0) { - via_bot_id = stream.readInt64(exception); - } - if ((flags & 8) != 0) { - reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null) { - ttl = media.ttl_seconds; - } - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - } - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 1024) != 0) { - views = stream.readInt32(exception); - } - if ((flags & 1024) != 0) { - forwards = stream.readInt32(exception); - } - if ((flags & 8388608) != 0) { - replies = MessageReplies.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 32768) != 0) { - edit_date = stream.readInt32(exception); - } - if ((flags & 65536) != 0) { - post_author = stream.readString(exception); - } - if ((flags & 131072) != 0) { - grouped_id = stream.readInt64(exception); - } - if ((flags & 4194304) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } - } - if ((flags & 33554432) != 0) { - ttl_period = stream.readInt32(exception); - } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - flags = silent ? (flags | 8192) : (flags &~ 8192); - flags = post ? (flags | 16384) : (flags &~ 16384); - flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); - flags = legacy ? (flags | 524288) : (flags &~ 524288); - flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); - flags = pinned ? (flags | 16777216) : (flags &~ 16777216); - flags = noforwards ? (flags | 67108864) : (flags &~ 67108864); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 256) != 0) { - from_id.serializeToStream(stream); - } - peer_id.serializeToStream(stream); - if ((flags & 4) != 0) { - fwd_from.serializeToStream(stream); - } - if ((flags & 2048) != 0) { - stream.writeInt64(via_bot_id); - } - if ((flags & 8) != 0) { - reply_to.serializeToStream(stream); - } - stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 1024) != 0) { - stream.writeInt32(views); - } - if ((flags & 1024) != 0) { - stream.writeInt32(forwards); - } - if ((flags & 8388608) != 0) { - replies.serializeToStream(stream); - } - if ((flags & 32768) != 0) { - stream.writeInt32(edit_date); - } - if ((flags & 65536) != 0) { - stream.writeString(post_author); - } - if ((flags & 131072) != 0) { - stream.writeInt64(grouped_id); - } - if ((flags & 4194304) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } - } - if ((flags & 33554432) != 0) { - stream.writeInt32(ttl_period); - } - writeAttachPath(stream); - } - } - - public static class TL_message_layer131 extends TL_message { - public static final int constructor = 0xbce383d2; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - silent = (flags & 8192) != 0; - post = (flags & 16384) != 0; - from_scheduled = (flags & 262144) != 0; - legacy = (flags & 524288) != 0; - edit_hide = (flags & 2097152) != 0; - pinned = (flags & 16777216) != 0; - id = stream.readInt32(exception); - if ((flags & 256) != 0) { - from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 4) != 0) { - fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 2048) != 0) { - via_bot_id = stream.readInt32(exception); - } - if ((flags & 8) != 0) { - reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - date = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null) { - ttl = media.ttl_seconds; //custom - } - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; + if (result != null) { + result.readParams(stream, exception); + if (result.from_id == null) { + if (result.id < 0 && result.random_id == 0) { + result.from_id = new TL_peerUser(); + } else { + result.from_id = result.peer_id; + } } } - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + return result; + } + + public void readAttachPath(InputSerializedData stream, long currentUserId) { + boolean hasMedia = media != null && !(media instanceof TL_messageMediaEmpty) && !(media instanceof TL_messageMediaWebPage); + boolean fixCaption = !TextUtils.isEmpty(message) && + (media instanceof TL_messageMediaPhoto_old || + media instanceof TL_messageMediaPhoto_layer68 || + media instanceof TL_messageMediaPhoto_layer74 || + media instanceof TL_messageMediaDocument_old || + media instanceof TL_messageMediaDocument_layer68 || + media instanceof TL_messageMediaDocument_layer74) + && message.startsWith("-1"); + if ((out || peer_id != null && from_id != null && peer_id.user_id != 0 && peer_id.user_id == from_id.user_id && from_id.user_id == currentUserId) && (id < 0 || hasMedia || send_state == 3) || legacy) { + if (hasMedia && fixCaption) { + if (message.length() > 6 && message.charAt(2) == '_') { + params = new HashMap<>(); + params.put("ve", message); + } + if (params != null || message.length() == 2) { + message = ""; } - return; } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; + if (stream.remaining() > 0) { + attachPath = stream.readString(false); + if (attachPath != null) { + if ((id < 0 || send_state == 3 || legacy) && attachPath.startsWith("||")) { + String args[] = attachPath.split("\\|\\|"); + if (args.length > 0) { + if (params == null) { + params = new HashMap<>(); + } + for (int a = 1; a < args.length - 1; a++) { + String args2[] = args[a].split("\\|=\\|"); + if (args2.length == 2) { + params.put(args2[0], args2[1]); + } + } + attachPath = args[args.length - 1].trim(); + if (legacy) { + layer = Utilities.parseInt(params.get("legacy_layer")); + } + } + } else { + attachPath = attachPath.trim(); + } } - entities.add(object); } } - if ((flags & 1024) != 0) { - views = stream.readInt32(exception); - } - if ((flags & 1024) != 0) { - forwards = stream.readInt32(exception); - } - if ((flags & 8388608) != 0) { - replies = MessageReplies.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 32768) != 0) { - edit_date = stream.readInt32(exception); - } - if ((flags & 65536) != 0) { - post_author = stream.readString(exception); - } - if ((flags & 131072) != 0) { - grouped_id = stream.readInt64(exception); + if ((flags & MESSAGE_FLAG_FWD) != 0 && id < 0) { + fwd_msg_id = stream.readInt32(false); } - if ((flags & 4194304) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); +// if (media instanceof TLRPC.TL_messageMediaPaidMedia && stream.remaining() > 0) { +// TLRPC.TL_messageMediaPaidMedia paidMedia = (TLRPC.TL_messageMediaPaidMedia) media; +// final int size = stream.readInt32(false); +// for (int i = 0; i < size; ++i) { +// final String attachPath = stream.readString(false); +// if (i < paidMedia.extended_media.size()) { +// paidMedia.extended_media.get(i).attachPath = attachPath; +// } +// } +// } + } + + protected void writeAttachPath(OutputSerializedData stream) { + if (this instanceof TL_message_secret || this instanceof TL_message_secret_layer72) { + String path = attachPath != null ? attachPath : ""; + if (send_state == 1 && params != null && params.size() > 0) { + for (HashMap.Entry entry : params.entrySet()) { + path = entry.getKey() + "|=|" + entry.getValue() + "||" + path; } - return; + path = "||" + path; } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; + stream.writeString(path); + } else { + String path = !TextUtils.isEmpty(attachPath) ? attachPath : " "; + if (legacy) { + if (params == null) { + params = new HashMap<>(); + } + layer = LAYER; + params.put("legacy_layer", "" + LAYER); + } + if ((id < 0 || send_state == 3 || legacy) && params != null && params.size() > 0) { + for (HashMap.Entry entry : params.entrySet()) { + path = entry.getKey() + "|=|" + entry.getValue() + "||" + path; } - restriction_reason.add(object); + path = "||" + path; + } + stream.writeString(path); + if ((flags & MESSAGE_FLAG_FWD) != 0 && id < 0) { + stream.writeInt32(fwd_msg_id); } +// if (media instanceof TLRPC.TL_messageMediaPaidMedia) { +// TLRPC.TL_messageMediaPaidMedia paidMedia = (TLRPC.TL_messageMediaPaidMedia) media; +// stream.writeInt32(paidMedia.extended_media.size()); +// for (int i = 0; i < paidMedia.extended_media.size(); ++i) { +// TLRPC.MessageExtendedMedia emedia = paidMedia.extended_media.get(i); +// String attachPath = emedia.attachPath == null ? "" : emedia.attachPath; +// stream.writeString(attachPath); +// } +// } } - if ((flags & 33554432) != 0) { - ttl_period = stream.readInt32(exception); + } + } + + public static class TL_messageEmpty_layer122 extends TL_messageEmpty { + public static final int constructor = 0x83e5de54; + + public void readParams(InputSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + peer_id = new TL_peerUser(); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(id); + } + } + + public static class TL_messageEmpty extends Message { + public static final int constructor = 0x90a6ca84; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + id = stream.readInt32(exception); + if ((flags & 1) != 0) { + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } else { + peer_id = new TL_peerUser(); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - flags = silent ? (flags | 8192) : (flags &~ 8192); - flags = post ? (flags | 16384) : (flags &~ 16384); - flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); - flags = legacy ? (flags | 524288) : (flags &~ 524288); - flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); - flags = pinned ? (flags | 16777216) : (flags &~ 16777216); stream.writeInt32(flags); stream.writeInt32(id); - if ((flags & 256) != 0) { - from_id.serializeToStream(stream); - } - peer_id.serializeToStream(stream); - if ((flags & 4) != 0) { - fwd_from.serializeToStream(stream); - } - if ((flags & 2048) != 0) { - stream.writeInt32((int) via_bot_id); - } - if ((flags & 8) != 0) { - reply_to.serializeToStream(stream); - } - stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 1024) != 0) { - stream.writeInt32(views); - } - if ((flags & 1024) != 0) { - stream.writeInt32(forwards); - } - if ((flags & 8388608) != 0) { - replies.serializeToStream(stream); - } - if ((flags & 32768) != 0) { - stream.writeInt32(edit_date); - } - if ((flags & 65536) != 0) { - stream.writeString(post_author); - } - if ((flags & 131072) != 0) { - stream.writeInt64(grouped_id); - } - if ((flags & 4194304) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } - } - if ((flags & 33554432) != 0) { - stream.writeInt32(ttl_period); + if ((flags & 1) != 0) { + peer_id.serializeToStream(stream); } - writeAttachPath(stream); //custom } } - public static class TL_message_layer123 extends TL_message { - public static final int constructor = 0x58ae39c9; - + public static class TL_messageService_old2 extends TL_messageService { + public static final int constructor = 0x1d86f70e; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); + unread = (flags & 1) != 0; out = (flags & 2) != 0; mentioned = (flags & 16) != 0; media_unread = (flags & 32) != 0; - silent = (flags & 8192) != 0; - post = (flags & 16384) != 0; - from_scheduled = (flags & 262144) != 0; - legacy = (flags & 524288) != 0; - edit_hide = (flags & 2097152) != 0; - pinned = (flags & 16777216) != 0; id = stream.readInt32(exception); - if ((flags & 256) != 0) { - from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - } + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 4) != 0) { - fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 2048) != 0) { - via_bot_id = stream.readInt32(exception); - } - if ((flags & 8) != 0) { - reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); - } date = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 512) != 0) { - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null) { - ttl = media.ttl_seconds; //custom - } - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - } - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 1024) != 0) { - views = stream.readInt32(exception); - } - if ((flags & 1024) != 0) { - forwards = stream.readInt32(exception); - } - if ((flags & 8388608) != 0) { - replies = MessageReplies.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 32768) != 0) { - edit_date = stream.readInt32(exception); - } - if ((flags & 65536) != 0) { - post_author = stream.readString(exception); - } - if ((flags & 131072) != 0) { - grouped_id = stream.readInt64(exception); - } - if ((flags & 4194304) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } - } + action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); + flags |= MESSAGE_FLAG_HAS_FROM_ID; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = unread ? (flags | 1) : (flags &~ 1); flags = out ? (flags | 2) : (flags &~ 2); flags = mentioned ? (flags | 16) : (flags &~ 16); flags = media_unread ? (flags | 32) : (flags &~ 32); - flags = silent ? (flags | 8192) : (flags &~ 8192); - flags = post ? (flags | 16384) : (flags &~ 16384); - flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); - flags = legacy ? (flags | 524288) : (flags &~ 524288); - flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); - flags = pinned ? (flags | 16777216) : (flags &~ 16777216); stream.writeInt32(flags); stream.writeInt32(id); - if ((flags & 256) != 0) { - from_id.serializeToStream(stream); - } + stream.writeInt32((int) from_id.user_id); peer_id.serializeToStream(stream); - if ((flags & 4) != 0) { - fwd_from.serializeToStream(stream); - } - if ((flags & 2048) != 0) { - stream.writeInt32((int) via_bot_id); - } - if ((flags & 8) != 0) { - reply_to.serializeToStream(stream); - } stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); - } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); - } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 1024) != 0) { - stream.writeInt32(views); - } - if ((flags & 1024) != 0) { - stream.writeInt32(forwards); - } - if ((flags & 8388608) != 0) { - replies.serializeToStream(stream); - } - if ((flags & 32768) != 0) { - stream.writeInt32(edit_date); - } - if ((flags & 65536) != 0) { - stream.writeString(post_author); - } - if ((flags & 131072) != 0) { - stream.writeInt64(grouped_id); - } - if ((flags & 4194304) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } - } - writeAttachPath(stream); + action.serializeToStream(stream); } } - public static class TL_message_layer118 extends TL_message { - public static final int constructor = 0xf52e6b7f; - + public static class TL_message_layer72 extends TL_message { + public static final int constructor = 0x90dddc11; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); out = (flags & 2) != 0; mentioned = (flags & 16) != 0; media_unread = (flags & 32) != 0; silent = (flags & 8192) != 0; post = (flags & 16384) != 0; - from_scheduled = (flags & 262144) != 0; - legacy = (flags & 524288) != 0; - edit_hide = (flags & 2097152) != 0; id = stream.readInt32(exception); if ((flags & 256) != 0) { from_id = new TLRPC.TL_peerUser(); @@ -72535,7 +58058,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 512) != 0) { media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); if (media != null) { - ttl = media.ttl_seconds; //custom + ttl = media.ttl_seconds; } if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { message = media.captionLegacy; @@ -72545,66 +58068,26 @@ public void readParams(AbstractSerializedData stream, boolean exception) { reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } if ((flags & 1024) != 0) { views = stream.readInt32(exception); } - if ((flags & 1024) != 0) { - forwards = stream.readInt32(exception); - } if ((flags & 32768) != 0) { edit_date = stream.readInt32(exception); } if ((flags & 65536) != 0) { post_author = stream.readString(exception); } - if ((flags & 131072) != 0) { - grouped_id = stream.readInt64(exception); - } - if ((flags & 4194304) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } - } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = out ? (flags | 2) : (flags &~ 2); flags = mentioned ? (flags | 16) : (flags &~ 16); flags = media_unread ? (flags | 32) : (flags &~ 32); flags = silent ? (flags | 8192) : (flags &~ 8192); flags = post ? (flags | 16384) : (flags &~ 16384); - flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); - flags = legacy ? (flags | 524288) : (flags &~ 524288); - flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); stream.writeInt32(flags); stream.writeInt32(id); if ((flags & 256) != 0) { @@ -72629,60 +58112,42 @@ public void serializeToStream(AbstractSerializedData stream) { reply_markup.serializeToStream(stream); } if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } if ((flags & 1024) != 0) { stream.writeInt32(views); } - if ((flags & 1024) != 0) { - stream.writeInt32(forwards); - } if ((flags & 32768) != 0) { stream.writeInt32(edit_date); } if ((flags & 65536) != 0) { stream.writeString(post_author); } - if ((flags & 131072) != 0) { - stream.writeInt64(grouped_id); - } - if ((flags & 4194304) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } - } writeAttachPath(stream); } } - public static class TL_message_layer117 extends TL_message { - public static final int constructor = 0x452c0e65; - + public static class TL_message_layer68 extends TL_message { + public static final int constructor = 0xc09be45f; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); + unread = (flags & 1) != 0; out = (flags & 2) != 0; mentioned = (flags & 16) != 0; media_unread = (flags & 32) != 0; silent = (flags & 8192) != 0; post = (flags & 16384) != 0; - from_scheduled = (flags & 262144) != 0; - legacy = (flags & 524288) != 0; - edit_hide = (flags & 2097152) != 0; + with_my_score = (flags & 1073741824) != 0; id = stream.readInt32(exception); if ((flags & 256) != 0) { from_id = new TLRPC.TL_peerUser(); from_id.user_id = stream.readInt32(exception); } peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if (from_id == null) { + from_id = peer_id; + } if ((flags & 4) != 0) { fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); } @@ -72698,32 +58163,17 @@ public void readParams(AbstractSerializedData stream, boolean exception) { message = stream.readString(exception); if ((flags & 512) != 0) { media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null) { - ttl = media.ttl_seconds; //custom - } if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { message = media.captionLegacy; } + } else { + media = new TL_messageMediaEmpty(); } if ((flags & 64) != 0) { reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } if ((flags & 1024) != 0) { views = stream.readInt32(exception); @@ -72731,41 +58181,17 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 32768) != 0) { edit_date = stream.readInt32(exception); } - if ((flags & 65536) != 0) { - post_author = stream.readString(exception); - } - if ((flags & 131072) != 0) { - grouped_id = stream.readInt64(exception); - } - if ((flags & 4194304) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } - } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = unread ? (flags | 1) : (flags &~ 1); flags = out ? (flags | 2) : (flags &~ 2); flags = mentioned ? (flags | 16) : (flags &~ 16); flags = media_unread ? (flags | 32) : (flags &~ 32); flags = silent ? (flags | 8192) : (flags &~ 8192); flags = post ? (flags | 16384) : (flags &~ 16384); - flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); - flags = legacy ? (flags | 524288) : (flags &~ 524288); - flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); + flags = with_my_score ? (flags | 1073741824) : (flags &~ 1073741824); stream.writeInt32(flags); stream.writeInt32(id); if ((flags & 256) != 0) { @@ -72790,59 +58216,44 @@ public void serializeToStream(AbstractSerializedData stream) { reply_markup.serializeToStream(stream); } if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } if ((flags & 1024) != 0) { stream.writeInt32(views); } if ((flags & 32768) != 0) { - stream.writeInt32(edit_date); - } - if ((flags & 65536) != 0) { - stream.writeString(post_author); - } - if ((flags & 131072) != 0) { - stream.writeInt64(grouped_id); - } - if ((flags & 4194304) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } + stream.writeInt32(edit_date); } writeAttachPath(stream); } } - public static class TL_message_layer104_3 extends TL_message { - public static final int constructor = 0x9789dac4; - + public static class TL_message_layer47 extends TL_message { + public static final int constructor = 0xc992e15c; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); + unread = (flags & 1) != 0; out = (flags & 2) != 0; mentioned = (flags & 16) != 0; media_unread = (flags & 32) != 0; - silent = (flags & 8192) != 0; - post = (flags & 16384) != 0; - from_scheduled = (flags & 262144) != 0; - legacy = (flags & 524288) != 0; - edit_hide = (flags & 2097152) != 0; id = stream.readInt32(exception); if ((flags & 256) != 0) { from_id = new TLRPC.TL_peerUser(); from_id.user_id = stream.readInt32(exception); } peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if (from_id == null) { + from_id = peer_id; + } if ((flags & 4) != 0) { - fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + fwd_from = new TL_messageFwdHeader(); + Peer peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if (peer != null) { + fwd_from.from_id = peer; + fwd_from.flags |= 1; + } + fwd_from.date = stream.readInt32(exception); } if ((flags & 2048) != 0) { via_bot_id = stream.readInt32(exception); @@ -72856,77 +58267,29 @@ public void readParams(AbstractSerializedData stream, boolean exception) { message = stream.readString(exception); if ((flags & 512) != 0) { media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null) { - ttl = media.ttl_seconds; //custom - } if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { message = media.captionLegacy; } + } else { + media = new TL_messageMediaEmpty(); } if ((flags & 64) != 0) { reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } if ((flags & 1024) != 0) { views = stream.readInt32(exception); } - if ((flags & 32768) != 0) { - edit_date = stream.readInt32(exception); - } - if ((flags & 65536) != 0) { - post_author = stream.readString(exception); - } - if ((flags & 131072) != 0) { - grouped_id = stream.readInt64(exception); - } - if ((flags & 1048576) != 0) { - reactions = MessageReactions.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4194304) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - restriction_reason.add(object); - } - } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = unread ? (flags | 1) : (flags &~ 1); flags = out ? (flags | 2) : (flags &~ 2); flags = mentioned ? (flags | 16) : (flags &~ 16); flags = media_unread ? (flags | 32) : (flags &~ 32); - flags = silent ? (flags | 8192) : (flags &~ 8192); - flags = post ? (flags | 16384) : (flags &~ 16384); - flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); - flags = legacy ? (flags | 524288) : (flags &~ 524288); - flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); stream.writeInt32(flags); stream.writeInt32(id); if ((flags & 256) != 0) { @@ -72934,7 +58297,10 @@ public void serializeToStream(AbstractSerializedData stream) { } peer_id.serializeToStream(stream); if ((flags & 4) != 0) { - fwd_from.serializeToStream(stream); + if (fwd_from.from_id != null) { + fwd_from.from_id.serializeToStream(stream); + } + stream.writeInt32(fwd_from.date); } if ((flags & 2048) != 0) { stream.writeInt32((int) via_bot_id); @@ -72951,65 +58317,41 @@ public void serializeToStream(AbstractSerializedData stream) { reply_markup.serializeToStream(stream); } if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } if ((flags & 1024) != 0) { stream.writeInt32(views); } - if ((flags & 32768) != 0) { - stream.writeInt32(edit_date); - } - if ((flags & 65536) != 0) { - stream.writeString(post_author); - } - if ((flags & 131072) != 0) { - stream.writeInt64(grouped_id); - } - if ((flags & 1048576) != 0) { - reactions.serializeToStream(stream); - } - if ((flags & 4194304) != 0) { - stream.writeInt32(0x1cb5c415); - int count = restriction_reason.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - restriction_reason.get(a).serializeToStream(stream); - } - } writeAttachPath(stream); } } - public static class TL_message_layer104_2 extends TL_message { - public static final int constructor = 0x1c9b1027; - + public static class TL_message_old7 extends TL_message { + public static final int constructor = 0x5ba66c13; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); + unread = (flags & 1) != 0; out = (flags & 2) != 0; mentioned = (flags & 16) != 0; media_unread = (flags & 32) != 0; - silent = (flags & 8192) != 0; - post = (flags & 16384) != 0; - from_scheduled = (flags & 262144) != 0; - legacy = (flags & 524288) != 0; - edit_hide = (flags & 2097152) != 0; id = stream.readInt32(exception); if ((flags & 256) != 0) { from_id = new TLRPC.TL_peerUser(); from_id.user_id = stream.readInt32(exception); } peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 4) != 0) { - fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + if (from_id == null) { + from_id = peer_id; } - if ((flags & 2048) != 0) { - via_bot_id = stream.readInt32(exception); + if ((flags & 4) != 0) { + fwd_from = new TL_messageFwdHeader(); + Peer peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if (peer != null) { + fwd_from.from_id = peer; + fwd_from.flags |= 1; + } + fwd_from.date = stream.readInt32(exception); } if ((flags & 8) != 0) { reply_to = new TLRPC.TL_messageReplyHeader(); @@ -73020,63 +58362,29 @@ public void readParams(AbstractSerializedData stream, boolean exception) { message = stream.readString(exception); if ((flags & 512) != 0) { media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null) { - ttl = media.ttl_seconds; //custom - } if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { message = media.captionLegacy; } + } else { + media = new TL_messageMediaEmpty(); } if ((flags & 64) != 0) { reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } if ((flags & 1024) != 0) { views = stream.readInt32(exception); } - if ((flags & 32768) != 0) { - edit_date = stream.readInt32(exception); - } - if ((flags & 65536) != 0) { - post_author = stream.readString(exception); - } - if ((flags & 131072) != 0) { - grouped_id = stream.readInt64(exception); - } - if ((flags & 1048576) != 0) { - reactions = MessageReactions.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4194304) != 0) { - stream.readString(exception); - } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = unread ? (flags | 1) : (flags &~ 1); flags = out ? (flags | 2) : (flags &~ 2); flags = mentioned ? (flags | 16) : (flags &~ 16); flags = media_unread ? (flags | 32) : (flags &~ 32); - flags = silent ? (flags | 8192) : (flags &~ 8192); - flags = post ? (flags | 16384) : (flags &~ 16384); - flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); - flags = legacy ? (flags | 524288) : (flags &~ 524288); - flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); stream.writeInt32(flags); stream.writeInt32(id); if ((flags & 256) != 0) { @@ -73084,10 +58392,10 @@ public void serializeToStream(AbstractSerializedData stream) { } peer_id.serializeToStream(stream); if ((flags & 4) != 0) { - fwd_from.serializeToStream(stream); - } - if ((flags & 2048) != 0) { - stream.writeInt32((int) via_bot_id); + if (fwd_from.from_id != null) { + fwd_from.from_id.serializeToStream(stream); + } + stream.writeInt32(fwd_from.date); } if ((flags & 8) != 0) { stream.writeInt32(reply_to.reply_to_msg_id); @@ -73101,39 +58409,64 @@ public void serializeToStream(AbstractSerializedData stream) { reply_markup.serializeToStream(stream); } if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } if ((flags & 1024) != 0) { stream.writeInt32(views); } - if ((flags & 32768) != 0) { - stream.writeInt32(edit_date); - } - if ((flags & 65536) != 0) { - stream.writeString(post_author); - } - if ((flags & 131072) != 0) { - stream.writeInt64(grouped_id); - } - if ((flags & 1048576) != 0) { - reactions.serializeToStream(stream); - } - if ((flags & 4194304) != 0) { - stream.writeString(""); - } writeAttachPath(stream); } } - public static class TL_message_layer104 extends TL_message { - public static final int constructor = 0x44f9b43d; + public static class TL_messageForwarded_old2 extends Message { + public static final int constructor = 0xa367e716; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + id = stream.readInt32(exception); + fwd_from = new TL_messageFwdHeader(); + fwd_from.from_id = new TLRPC.TL_peerUser(); + fwd_from.from_id.user_id = stream.readInt32(exception); + fwd_from.flags |= 1; + fwd_from.date = stream.readInt32(exception); + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + date = stream.readInt32(exception); + message = stream.readString(exception); + flags |= MESSAGE_FLAG_FWD | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + stream.writeInt32(id); + stream.writeInt32((int) fwd_from.from_id.user_id); + stream.writeInt32(fwd_from.date); + stream.writeInt32((int) from_id.user_id); + peer_id.serializeToStream(stream); + stream.writeInt32(date); + stream.writeString(message); + media.serializeToStream(stream); + } + } - public void readParams(AbstractSerializedData stream, boolean exception) { + public static class TL_message extends Message { + public static final int constructor = 0x96fdbbe9; + + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); out = (flags & 2) != 0; mentioned = (flags & 16) != 0; @@ -73142,29 +58475,42 @@ public void readParams(AbstractSerializedData stream, boolean exception) { post = (flags & 16384) != 0; from_scheduled = (flags & 262144) != 0; legacy = (flags & 524288) != 0; + edit_hide = (flags & 2097152) != 0; + pinned = (flags & 16777216) != 0; + noforwards = (flags & 67108864) != 0; + invert_media = (flags & 134217728) != 0; + flags2 = stream.readInt32(exception); + offline = (flags2 & 2) != 0; + video_processing_pending = (flags2 & 16) != 0; id = stream.readInt32(exception); if ((flags & 256) != 0) { - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); + from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 536870912) != 0) { + from_boosts_applied = stream.readInt32(exception); } peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 268435456) != 0) { + saved_peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } if ((flags & 4) != 0) { fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 2048) != 0) { - via_bot_id = stream.readInt32(exception); + via_bot_id = stream.readInt64(exception); + } + if ((flags2 & 1) != 0) { + via_business_bot_id = stream.readInt64(exception); } if ((flags & 8) != 0) { - reply_to = new TLRPC.TL_messageReplyHeader(); - reply_to.flags |= 16; - reply_to.reply_to_msg_id = stream.readInt32(exception); + reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); } date = stream.readInt32(exception); message = stream.readString(exception); if ((flags & 512) != 0) { media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); if (media != null) { - ttl = media.ttl_seconds; //custom + ttl = media.ttl_seconds; } if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { message = media.captionLegacy; @@ -73174,25 +58520,17 @@ public void readParams(AbstractSerializedData stream, boolean exception) { reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } if ((flags & 1024) != 0) { views = stream.readInt32(exception); } + if ((flags & 1024) != 0) { + forwards = stream.readInt32(exception); + } + if ((flags & 8388608) != 0) { + replies = MessageReplies.TLdeserialize(stream, stream.readInt32(exception), exception); + } if ((flags & 32768) != 0) { edit_date = stream.readInt32(exception); } @@ -73202,9 +58540,30 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 131072) != 0) { grouped_id = stream.readInt64(exception); } + if ((flags & 1048576) != 0) { + reactions = MessageReactions.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4194304) != 0) { + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); + } + if ((flags & 33554432) != 0) { + ttl_period = stream.readInt32(exception); + } + if ((flags & 1073741824) != 0) { + quick_reply_shortcut_id = stream.readInt32(exception); + } + if ((flags2 & 4) != 0) { + effect = stream.readInt64(exception); + } + if ((flags2 & 8) != 0) { + factcheck = TL_factCheck.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags2 & 32) != 0) { + report_delivery_until_date = stream.readInt32(exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = out ? (flags | 2) : (flags &~ 2); flags = mentioned ? (flags | 16) : (flags &~ 16); @@ -73213,20 +58572,36 @@ public void serializeToStream(AbstractSerializedData stream) { flags = post ? (flags | 16384) : (flags &~ 16384); flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); flags = legacy ? (flags | 524288) : (flags &~ 524288); + flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); + flags = pinned ? (flags | 16777216) : (flags &~ 16777216); + flags = noforwards ? (flags | 67108864) : (flags &~ 67108864); + flags = invert_media ? (flags | 134217728) : (flags &~ 134217728); stream.writeInt32(flags); + flags2 = offline ? (flags2 | 2) : (flags2 &~ 2); + flags2 = video_processing_pending ? (flags2 | 16) : (flags2 &~ 16); + stream.writeInt32(flags2); stream.writeInt32(id); if ((flags & 256) != 0) { - stream.writeInt32((int) from_id.user_id); + from_id.serializeToStream(stream); + } + if ((flags & 536870912) != 0) { + stream.writeInt32(from_boosts_applied); } peer_id.serializeToStream(stream); + if ((flags & 268435456) != 0) { + saved_peer_id.serializeToStream(stream); + } if ((flags & 4) != 0) { fwd_from.serializeToStream(stream); } if ((flags & 2048) != 0) { - stream.writeInt32((int) via_bot_id); + stream.writeInt64(via_bot_id); + } + if ((flags2 & 1) != 0) { + stream.writeInt64(via_business_bot_id); } if ((flags & 8) != 0) { - stream.writeInt32(reply_to.reply_to_msg_id); + reply_to.serializeToStream(stream); } stream.writeInt32(date); stream.writeString(message); @@ -73237,16 +58612,17 @@ public void serializeToStream(AbstractSerializedData stream) { reply_markup.serializeToStream(stream); } if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } if ((flags & 1024) != 0) { stream.writeInt32(views); } + if ((flags & 1024) != 0) { + stream.writeInt32(forwards); + } + if ((flags & 8388608) != 0) { + replies.serializeToStream(stream); + } if ((flags & 32768) != 0) { stream.writeInt32(edit_date); } @@ -73256,3276 +58632,3051 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 131072) != 0) { stream.writeInt64(grouped_id); } + if ((flags & 1048576) != 0) { + reactions.serializeToStream(stream); + } + if ((flags & 4194304) != 0) { + Vector.serialize(stream, restriction_reason); + } + if ((flags & 33554432) != 0) { + stream.writeInt32(ttl_period); + } + if ((flags & 1073741824) != 0) { + stream.writeInt32(quick_reply_shortcut_id); + } + if ((flags2 & 4) != 0) { + stream.writeInt64(effect); + } + if ((flags2 & 8) != 0) { + factcheck.serializeToStream(stream); + } + if ((flags2 & 32) != 0) { + stream.writeInt32(report_delivery_until_date); + } writeAttachPath(stream); } } - public static class TL_message_old6 extends TL_message { - public static final int constructor = 0x2bebfa86; - + public static class TL_message_layer195 extends TL_message { + public static final int constructor = 0x94345242; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID; - unread = (flags & 1) != 0; + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); out = (flags & 2) != 0; mentioned = (flags & 16) != 0; media_unread = (flags & 32) != 0; + silent = (flags & 8192) != 0; + post = (flags & 16384) != 0; + from_scheduled = (flags & 262144) != 0; + legacy = (flags & 524288) != 0; + edit_hide = (flags & 2097152) != 0; + pinned = (flags & 16777216) != 0; + noforwards = (flags & 67108864) != 0; + invert_media = (flags & 134217728) != 0; + flags2 = stream.readInt32(exception); + offline = (flags2 & 2) != 0; + video_processing_pending = (flags2 & 16) != 0; id = stream.readInt32(exception); - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); + if ((flags & 256) != 0) { + from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 536870912) != 0) { + from_boosts_applied = stream.readInt32(exception); + } peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 268435456) != 0) { + saved_peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } if ((flags & 4) != 0) { - fwd_from = new TL_messageFwdHeader(); - fwd_from.from_id = new TLRPC.TL_peerUser(); - fwd_from.from_id.user_id = stream.readInt32(exception); - fwd_from.flags |= 1; - fwd_from.date = stream.readInt32(exception); + fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 2048) != 0) { + via_bot_id = stream.readInt64(exception); + } + if ((flags2 & 1) != 0) { + via_business_bot_id = stream.readInt64(exception); } if ((flags & 8) != 0) { - reply_to = new TLRPC.TL_messageReplyHeader(); - reply_to.flags |= 16; - reply_to.reply_to_msg_id = stream.readInt32(exception); + reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); } date = stream.readInt32(exception); message = stream.readString(exception); if ((flags & 512) != 0) { media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null) { + ttl = media.ttl_seconds; + } if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { message = media.captionLegacy; } - } else { - media = new TL_messageMediaEmpty(); } if ((flags & 64) != 0) { reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeInt32((int) from_id.user_id); - peer_id.serializeToStream(stream); - if ((flags & 4) != 0) { - stream.writeInt32((int) fwd_from.from_id.user_id); - stream.writeInt32(fwd_from.date); + if ((flags & 1024) != 0) { + views = stream.readInt32(exception); } - if ((flags & 8) != 0) { - stream.writeInt32(reply_to.reply_to_msg_id); + if ((flags & 1024) != 0) { + forwards = stream.readInt32(exception); } - stream.writeInt32(date); - stream.writeString(message); - if ((flags & 512) != 0) { - media.serializeToStream(stream); + if ((flags & 8388608) != 0) { + replies = MessageReplies.TLdeserialize(stream, stream.readInt32(exception), exception); } - if ((flags & 64) != 0) { - reply_markup.serializeToStream(stream); + if ((flags & 32768) != 0) { + edit_date = stream.readInt32(exception); } - if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + if ((flags & 65536) != 0) { + post_author = stream.readString(exception); } - writeAttachPath(stream); - } - } - - public static class TL_message_old5 extends TL_message { - public static final int constructor = 0xf07814c8; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 4) != 0) { - fwd_from = new TL_messageFwdHeader(); - fwd_from.from_id = new TLRPC.TL_peerUser(); - fwd_from.from_id.user_id = stream.readInt32(exception); - fwd_from.flags |= 1; - fwd_from.date = stream.readInt32(exception); + if ((flags & 131072) != 0) { + grouped_id = stream.readInt64(exception); } - if ((flags & 8) != 0) { - reply_to = new TLRPC.TL_messageReplyHeader(); - reply_to.flags |= 16; - reply_to.reply_to_msg_id = stream.readInt32(exception); + if ((flags & 1048576) != 0) { + reactions = MessageReactions.TLdeserialize(stream, stream.readInt32(exception), exception); } - date = stream.readInt32(exception); - message = stream.readString(exception); - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; + if ((flags & 4194304) != 0) { + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } - if ((flags & 64) != 0) { - reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 33554432) != 0) { + ttl_period = stream.readInt32(exception); } - if ((flags & 128) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + if ((flags & 1073741824) != 0) { + quick_reply_shortcut_id = stream.readInt32(exception); + } + if ((flags2 & 4) != 0) { + effect = stream.readInt64(exception); + } + if ((flags2 & 8) != 0) { + factcheck = TL_factCheck.TLdeserialize(stream, stream.readInt32(exception), exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); flags = out ? (flags | 2) : (flags &~ 2); flags = mentioned ? (flags | 16) : (flags &~ 16); flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); + flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); + flags = legacy ? (flags | 524288) : (flags &~ 524288); + flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); + flags = pinned ? (flags | 16777216) : (flags &~ 16777216); + flags = noforwards ? (flags | 67108864) : (flags &~ 67108864); + flags = invert_media ? (flags | 134217728) : (flags &~ 134217728); stream.writeInt32(flags); + flags2 = offline ? (flags2 | 2) : (flags2 &~ 2); + flags2 = video_processing_pending ? (flags2 | 16) : (flags2 &~ 16); + stream.writeInt32(flags2); stream.writeInt32(id); - stream.writeInt32((int) from_id.user_id); + if ((flags & 256) != 0) { + from_id.serializeToStream(stream); + } + if ((flags & 536870912) != 0) { + stream.writeInt32(from_boosts_applied); + } peer_id.serializeToStream(stream); + if ((flags & 268435456) != 0) { + saved_peer_id.serializeToStream(stream); + } if ((flags & 4) != 0) { - stream.writeInt32((int) fwd_from.from_id.user_id); - stream.writeInt32(fwd_from.date); + fwd_from.serializeToStream(stream); + } + if ((flags & 2048) != 0) { + stream.writeInt64(via_bot_id); + } + if ((flags2 & 1) != 0) { + stream.writeInt64(via_business_bot_id); } if ((flags & 8) != 0) { - stream.writeInt32(reply_to.reply_to_msg_id); + reply_to.serializeToStream(stream); } stream.writeInt32(date); stream.writeString(message); - media.serializeToStream(stream); + if ((flags & 512) != 0) { + media.serializeToStream(stream); + } if ((flags & 64) != 0) { reply_markup.serializeToStream(stream); } if ((flags & 128) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); + } + if ((flags & 1024) != 0) { + stream.writeInt32(views); + } + if ((flags & 1024) != 0) { + stream.writeInt32(forwards); + } + if ((flags & 8388608) != 0) { + replies.serializeToStream(stream); + } + if ((flags & 32768) != 0) { + stream.writeInt32(edit_date); + } + if ((flags & 65536) != 0) { + stream.writeString(post_author); + } + if ((flags & 131072) != 0) { + stream.writeInt64(grouped_id); + } + if ((flags & 1048576) != 0) { + reactions.serializeToStream(stream); + } + if ((flags & 4194304) != 0) { + Vector.serialize(stream, restriction_reason); + } + if ((flags & 33554432) != 0) { + stream.writeInt32(ttl_period); + } + if ((flags & 1073741824) != 0) { + stream.writeInt32(quick_reply_shortcut_id); + } + if ((flags2 & 4) != 0) { + stream.writeInt64(effect); + } + if ((flags2 & 8) != 0) { + factcheck.serializeToStream(stream); } writeAttachPath(stream); } } - public static class TL_messageService_layer48 extends TL_messageService { - public static final int constructor = 0xc06b9607; - + public static class TL_message_layer180 extends TL_message { + public static final int constructor = 0xbde09c2e; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - unread = (flags & 1) != 0; out = (flags & 2) != 0; mentioned = (flags & 16) != 0; media_unread = (flags & 32) != 0; silent = (flags & 8192) != 0; post = (flags & 16384) != 0; + from_scheduled = (flags & 262144) != 0; + legacy = (flags & 524288) != 0; + edit_hide = (flags & 2097152) != 0; + pinned = (flags & 16777216) != 0; + noforwards = (flags & 67108864) != 0; + invert_media = (flags & 134217728) != 0; + flags2 = stream.readInt32(exception); + offline = (flags2 & 2) != 0; id = stream.readInt32(exception); if ((flags & 256) != 0) { - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); - } - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (from_id == null) { - from_id = peer_id; + from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); } - date = stream.readInt32(exception); - action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - flags = silent ? (flags | 8192) : (flags &~ 8192); - flags = post ? (flags | 16384) : (flags &~ 16384); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 256) != 0) { - stream.writeInt32((int) from_id.user_id); + if ((flags & 536870912) != 0) { + from_boosts_applied = stream.readInt32(exception); } - peer_id.serializeToStream(stream); - stream.writeInt32(date); - action.serializeToStream(stream); - } - } - - public static class TL_message_old4 extends TL_message { - public static final int constructor = 0xc3060325; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 268435456) != 0) { + saved_peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } if ((flags & 4) != 0) { - fwd_from = new TL_messageFwdHeader(); - fwd_from.from_id = new TLRPC.TL_peerUser(); - fwd_from.from_id.user_id = stream.readInt32(exception); - fwd_from.flags |= 1; - fwd_from.date = stream.readInt32(exception); + fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 2048) != 0) { + via_bot_id = stream.readInt64(exception); + } + if ((flags2 & 1) != 0) { + via_business_bot_id = stream.readInt64(exception); } if ((flags & 8) != 0) { - reply_to = new TLRPC.TL_messageReplyHeader(); - reply_to.flags |= 16; - reply_to.reply_to_msg_id = stream.readInt32(exception); + reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); } date = stream.readInt32(exception); message = stream.readString(exception); - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; + if ((flags & 512) != 0) { + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null) { + ttl = media.ttl_seconds; + } + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } } if ((flags & 64) != 0) { reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); } + if ((flags & 128) != 0) { + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); + } + if ((flags & 1024) != 0) { + views = stream.readInt32(exception); + } + if ((flags & 1024) != 0) { + forwards = stream.readInt32(exception); + } + if ((flags & 8388608) != 0) { + replies = MessageReplies.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 32768) != 0) { + edit_date = stream.readInt32(exception); + } + if ((flags & 65536) != 0) { + post_author = stream.readString(exception); + } + if ((flags & 131072) != 0) { + grouped_id = stream.readInt64(exception); + } + if ((flags & 1048576) != 0) { + reactions = MessageReactions.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4194304) != 0) { + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); + } + if ((flags & 33554432) != 0) { + ttl_period = stream.readInt32(exception); + } + if ((flags & 1073741824) != 0) { + quick_reply_shortcut_id = stream.readInt32(exception); + } + if ((flags2 & 4) != 0) { + effect = stream.readInt64(exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); flags = out ? (flags | 2) : (flags &~ 2); flags = mentioned ? (flags | 16) : (flags &~ 16); flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); + flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); + flags = legacy ? (flags | 524288) : (flags &~ 524288); + flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); + flags = pinned ? (flags | 16777216) : (flags &~ 16777216); + flags = noforwards ? (flags | 67108864) : (flags &~ 67108864); + flags = invert_media ? (flags | 134217728) : (flags &~ 134217728); stream.writeInt32(flags); + flags2 = offline ? (flags2 | 2) : (flags2 &~ 2); + stream.writeInt32(flags2); stream.writeInt32(id); - stream.writeInt32((int) from_id.user_id); + if ((flags & 256) != 0) { + from_id.serializeToStream(stream); + } + if ((flags & 536870912) != 0) { + stream.writeInt32(from_boosts_applied); + } peer_id.serializeToStream(stream); + if ((flags & 268435456) != 0) { + saved_peer_id.serializeToStream(stream); + } if ((flags & 4) != 0) { - stream.writeInt32((int) fwd_from.from_id.user_id); - stream.writeInt32(fwd_from.date); + fwd_from.serializeToStream(stream); + } + if ((flags & 2048) != 0) { + stream.writeInt64(via_bot_id); + } + if ((flags2 & 1) != 0) { + stream.writeInt64(via_business_bot_id); } if ((flags & 8) != 0) { - stream.writeInt32(reply_to.reply_to_msg_id); + reply_to.serializeToStream(stream); } stream.writeInt32(date); stream.writeString(message); - media.serializeToStream(stream); + if ((flags & 512) != 0) { + media.serializeToStream(stream); + } if ((flags & 64) != 0) { reply_markup.serializeToStream(stream); } - writeAttachPath(stream); - } - } - - public static class TL_message_old3 extends TL_message { - public static final int constructor = 0xa7ab1991; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 4) != 0) { - fwd_from = new TL_messageFwdHeader(); - fwd_from.from_id = new TLRPC.TL_peerUser(); - fwd_from.from_id.user_id = stream.readInt32(exception); - fwd_from.flags |= 1; - fwd_from.date = stream.readInt32(exception); + if ((flags & 128) != 0) { + Vector.serialize(stream, entities); } - if ((flags & 8) != 0) { - reply_to = new TLRPC.TL_messageReplyHeader(); - reply_to.flags |= 16; - reply_to.reply_to_msg_id = stream.readInt32(exception); + if ((flags & 1024) != 0) { + stream.writeInt32(views); } - date = stream.readInt32(exception); - message = stream.readString(exception); - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; + if ((flags & 1024) != 0) { + stream.writeInt32(forwards); } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeInt32((int) from_id.user_id); - peer_id.serializeToStream(stream); - if ((flags & 4) != 0) { - stream.writeInt32((int) fwd_from.from_id.user_id); - stream.writeInt32(fwd_from.date); + if ((flags & 8388608) != 0) { + replies.serializeToStream(stream); } - if ((flags & 8) != 0) { - stream.writeInt32(reply_to.reply_to_msg_id); + if ((flags & 32768) != 0) { + stream.writeInt32(edit_date); } - stream.writeInt32(date); - stream.writeString(message); - media.serializeToStream(stream); - writeAttachPath(stream); - } - } - - public static class TL_message_old2 extends TL_message { - public static final int constructor = 0x567699b3; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - date = stream.readInt32(exception); - message = stream.readString(exception); - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; + if ((flags & 65536) != 0) { + stream.writeString(post_author); } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeInt32((int) from_id.user_id); - peer_id.serializeToStream(stream); - stream.writeInt32(date); - stream.writeString(message); - media.serializeToStream(stream); - writeAttachPath(stream); - } - } - - public static class TL_messageService_old extends TL_messageService { - public static final int constructor = 0x9f8d60bb; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - out = stream.readBool(exception); - unread = stream.readBool(exception); - flags |= MESSAGE_FLAG_HAS_FROM_ID; - date = stream.readInt32(exception); - action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeInt32((int) from_id.user_id); - peer_id.serializeToStream(stream); - stream.writeBool(out); - stream.writeBool(unread); - stream.writeInt32(date); - action.serializeToStream(stream); - } - } - - public static class TL_messageForwarded_old extends TL_messageForwarded_old2 { - public static final int constructor = 0x5f46804; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - fwd_from = new TL_messageFwdHeader(); - fwd_from.from_id = new TLRPC.TL_peerUser(); - fwd_from.from_id.user_id = stream.readInt32(exception); - fwd_from.flags |= 1; - fwd_from.date = stream.readInt32(exception); - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - out = stream.readBool(exception); - unread = stream.readBool(exception); - flags |= MESSAGE_FLAG_FWD | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; - date = stream.readInt32(exception); - message = stream.readString(exception); - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; + if ((flags & 131072) != 0) { + stream.writeInt64(grouped_id); } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeInt32((int) fwd_from.from_id.user_id); - stream.writeInt32(fwd_from.date); - stream.writeInt32((int) from_id.user_id); - peer_id.serializeToStream(stream); - stream.writeBool(out); - stream.writeBool(unread); - stream.writeInt32(date); - stream.writeString(message); - media.serializeToStream(stream); - writeAttachPath(stream); - } - } - - public static class TL_message_old extends TL_message { - public static final int constructor = 0x22eb6aba; - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - out = stream.readBool(exception); - unread = stream.readBool(exception); - flags |= MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; - date = stream.readInt32(exception); - message = stream.readString(exception); - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; + if ((flags & 1048576) != 0) { + reactions.serializeToStream(stream); + } + if ((flags & 4194304) != 0) { + Vector.serialize(stream, restriction_reason); + } + if ((flags & 33554432) != 0) { + stream.writeInt32(ttl_period); + } + if ((flags & 1073741824) != 0) { + stream.writeInt32(quick_reply_shortcut_id); + } + if ((flags2 & 4) != 0) { + stream.writeInt64(effect); } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeInt32((int) from_id.user_id); - peer_id.serializeToStream(stream); - stream.writeBool(out); - stream.writeBool(unread); - stream.writeInt32(date); - stream.writeString(message); - media.serializeToStream(stream); writeAttachPath(stream); } } - public static class TL_message_secret extends TL_message { - public static final int constructor = 0x555555fa; + public static class TL_message_layer179 extends TL_message { + public static final int constructor = 0x2357bf25; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - unread = (flags & 1) != 0; out = (flags & 2) != 0; mentioned = (flags & 16) != 0; media_unread = (flags & 32) != 0; + silent = (flags & 8192) != 0; + post = (flags & 16384) != 0; + from_scheduled = (flags & 262144) != 0; + legacy = (flags & 524288) != 0; + edit_hide = (flags & 2097152) != 0; + pinned = (flags & 16777216) != 0; + noforwards = (flags & 67108864) != 0; + invert_media = (flags & 134217728) != 0; + flags2 = stream.readInt32(exception); + offline = (flags2 & 2) != 0; id = stream.readInt32(exception); - ttl = stream.readInt32(exception); - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); + if ((flags & 256) != 0) { + from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 536870912) != 0) { + from_boosts_applied = stream.readInt32(exception); + } peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 268435456) != 0) { + saved_peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4) != 0) { + fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 2048) != 0) { + via_bot_id = stream.readInt64(exception); + } + if ((flags2 & 1) != 0) { + via_business_bot_id = stream.readInt64(exception); + } + if ((flags & 8) != 0) { + reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + } date = stream.readInt32(exception); message = stream.readString(exception); - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; - } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + if ((flags & 512) != 0) { + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null) { + ttl = media.ttl_seconds; } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; } - entities.add(object); } - if ((flags & 2048) != 0) { - via_bot_name = stream.readString(exception); + if ((flags & 64) != 0) { + reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 128) != 0) { + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); + } + if ((flags & 1024) != 0) { + views = stream.readInt32(exception); + } + if ((flags & 1024) != 0) { + forwards = stream.readInt32(exception); + } + if ((flags & 8388608) != 0) { + replies = MessageReplies.TLdeserialize(stream, stream.readInt32(exception), exception); } - if ((flags & 8) != 0) { - reply_to = new TL_messageReplyHeader(); - reply_to.reply_to_random_id = stream.readInt64(exception); + if ((flags & 32768) != 0) { + edit_date = stream.readInt32(exception); + } + if ((flags & 65536) != 0) { + post_author = stream.readString(exception); } if ((flags & 131072) != 0) { grouped_id = stream.readInt64(exception); } + if ((flags & 1048576) != 0) { + reactions = MessageReactions.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4194304) != 0) { + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); + } + if ((flags & 33554432) != 0) { + ttl_period = stream.readInt32(exception); + } + if ((flags & 1073741824) != 0) { + quick_reply_shortcut_id = stream.readInt32(exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); flags = out ? (flags | 2) : (flags &~ 2); flags = mentioned ? (flags | 16) : (flags &~ 16); flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); + flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); + flags = legacy ? (flags | 524288) : (flags &~ 524288); + flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); + flags = pinned ? (flags | 16777216) : (flags &~ 16777216); + flags = noforwards ? (flags | 67108864) : (flags &~ 67108864); + flags = invert_media ? (flags | 134217728) : (flags &~ 134217728); stream.writeInt32(flags); + flags2 = offline ? (flags2 | 2) : (flags2 &~ 2); + stream.writeInt32(flags2); stream.writeInt32(id); - stream.writeInt32(ttl); - stream.writeInt32((int) from_id.user_id); + if ((flags & 256) != 0) { + from_id.serializeToStream(stream); + } + if ((flags & 536870912) != 0) { + stream.writeInt32(from_boosts_applied); + } peer_id.serializeToStream(stream); - stream.writeInt32(date); - stream.writeString(message); - media.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); + if ((flags & 268435456) != 0) { + saved_peer_id.serializeToStream(stream); + } + if ((flags & 4) != 0) { + fwd_from.serializeToStream(stream); } if ((flags & 2048) != 0) { - stream.writeString(via_bot_name); + stream.writeInt64(via_bot_id); + } + if ((flags2 & 1) != 0) { + stream.writeInt64(via_business_bot_id); } if ((flags & 8) != 0) { - stream.writeInt64(reply_to.reply_to_random_id); + reply_to.serializeToStream(stream); } - if ((flags & 131072) != 0) { - stream.writeInt64(grouped_id); + stream.writeInt32(date); + stream.writeString(message); + if ((flags & 512) != 0) { + media.serializeToStream(stream); } - writeAttachPath(stream); - } - } - - public static class TL_message_secret_layer72 extends TL_message { - public static final int constructor = 0x555555f9; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - ttl = stream.readInt32(exception); - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - date = stream.readInt32(exception); - message = stream.readString(exception); - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; + if ((flags & 64) != 0) { + reply_markup.serializeToStream(stream); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + if ((flags & 128) != 0) { + Vector.serialize(stream, entities); } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); + if ((flags & 1024) != 0) { + stream.writeInt32(views); } - if ((flags & 2048) != 0) { - via_bot_name = stream.readString(exception); + if ((flags & 1024) != 0) { + stream.writeInt32(forwards); } - if ((flags & 8) != 0) { - reply_to = new TL_messageReplyHeader(); - reply_to.reply_to_random_id = stream.readInt64(exception); + if ((flags & 8388608) != 0) { + replies.serializeToStream(stream); } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeInt32(ttl); - stream.writeInt32((int) from_id.user_id); - peer_id.serializeToStream(stream); - stream.writeInt32(date); - stream.writeString(message); - media.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); + if ((flags & 32768) != 0) { + stream.writeInt32(edit_date); } - if ((flags & 2048) != 0) { - stream.writeString(via_bot_name); + if ((flags & 65536) != 0) { + stream.writeString(post_author); } - if ((flags & 8) != 0) { - stream.writeInt64(reply_to.reply_to_random_id); + if ((flags & 131072) != 0) { + stream.writeInt64(grouped_id); } - writeAttachPath(stream); - } - } - - public static class TL_message_secret_old extends TL_message_secret { - public static final int constructor = 0x555555F8; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; - unread = (flags & 1) != 0; - out = (flags & 2) != 0; - mentioned = (flags & 16) != 0; - media_unread = (flags & 32) != 0; - id = stream.readInt32(exception); - ttl = stream.readInt32(exception); - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); - peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - date = stream.readInt32(exception); - message = stream.readString(exception); - media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { - message = media.captionLegacy; + if ((flags & 1048576) != 0) { + reactions.serializeToStream(stream); + } + if ((flags & 4194304) != 0) { + Vector.serialize(stream, restriction_reason); + } + if ((flags & 33554432) != 0) { + stream.writeInt32(ttl_period); + } + if ((flags & 1073741824) != 0) { + stream.writeInt32(quick_reply_shortcut_id); } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeInt32(ttl); - stream.writeInt32((int) from_id.user_id); - peer_id.serializeToStream(stream); - stream.writeInt32(date); - stream.writeString(message); - media.serializeToStream(stream); writeAttachPath(stream); } } - public static class TL_messageService_layer123 extends TL_messageService { - public static final int constructor = 0x286fa604; - + public static class TL_message_layer176 extends TL_message { + public static final int constructor = 0xa66c7efc; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); out = (flags & 2) != 0; mentioned = (flags & 16) != 0; media_unread = (flags & 32) != 0; silent = (flags & 8192) != 0; post = (flags & 16384) != 0; + from_scheduled = (flags & 262144) != 0; legacy = (flags & 524288) != 0; + edit_hide = (flags & 2097152) != 0; + pinned = (flags & 16777216) != 0; + noforwards = (flags & 67108864) != 0; + invert_media = (flags & 134217728) != 0; id = stream.readInt32(exception); if ((flags & 256) != 0) { from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); } + if ((flags & 536870912) != 0) { + from_boosts_applied = stream.readInt32(exception); + } peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 268435456) != 0) { + saved_peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4) != 0) { + fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 2048) != 0) { + via_bot_id = stream.readInt64(exception); + } if ((flags & 8) != 0) { reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); } date = stream.readInt32(exception); - action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); + message = stream.readString(exception); + if ((flags & 512) != 0) { + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null) { + ttl = media.ttl_seconds; + } + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } + } + if ((flags & 64) != 0) { + reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 128) != 0) { + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); + } + if ((flags & 1024) != 0) { + views = stream.readInt32(exception); + } + if ((flags & 1024) != 0) { + forwards = stream.readInt32(exception); + } + if ((flags & 8388608) != 0) { + replies = MessageReplies.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 32768) != 0) { + edit_date = stream.readInt32(exception); + } + if ((flags & 65536) != 0) { + post_author = stream.readString(exception); + } + if ((flags & 131072) != 0) { + grouped_id = stream.readInt64(exception); + } + if ((flags & 1048576) != 0) { + reactions = MessageReactions.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4194304) != 0) { + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); + } + if ((flags & 33554432) != 0) { + ttl_period = stream.readInt32(exception); + } + if ((flags & 1073741824) != 0) { + quick_reply_shortcut_id = stream.readInt32(exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = out ? (flags | 2) : (flags &~ 2); flags = mentioned ? (flags | 16) : (flags &~ 16); flags = media_unread ? (flags | 32) : (flags &~ 32); flags = silent ? (flags | 8192) : (flags &~ 8192); flags = post ? (flags | 16384) : (flags &~ 16384); + flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); flags = legacy ? (flags | 524288) : (flags &~ 524288); + flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); + flags = pinned ? (flags | 16777216) : (flags &~ 16777216); + flags = noforwards ? (flags | 67108864) : (flags &~ 67108864); + flags = invert_media ? (flags | 134217728) : (flags &~ 134217728); stream.writeInt32(flags); stream.writeInt32(id); if ((flags & 256) != 0) { from_id.serializeToStream(stream); } + if ((flags & 536870912) != 0) { + stream.writeInt32(from_boosts_applied); + } peer_id.serializeToStream(stream); + if ((flags & 268435456) != 0) { + saved_peer_id.serializeToStream(stream); + } + if ((flags & 4) != 0) { + fwd_from.serializeToStream(stream); + } + if ((flags & 2048) != 0) { + stream.writeInt64(via_bot_id); + } if ((flags & 8) != 0) { reply_to.serializeToStream(stream); } stream.writeInt32(date); - action.serializeToStream(stream); + stream.writeString(message); + if ((flags & 512) != 0) { + media.serializeToStream(stream); + } + if ((flags & 64) != 0) { + reply_markup.serializeToStream(stream); + } + if ((flags & 128) != 0) { + Vector.serialize(stream, entities); + } + if ((flags & 1024) != 0) { + stream.writeInt32(views); + } + if ((flags & 1024) != 0) { + stream.writeInt32(forwards); + } + if ((flags & 8388608) != 0) { + replies.serializeToStream(stream); + } + if ((flags & 32768) != 0) { + stream.writeInt32(edit_date); + } + if ((flags & 65536) != 0) { + stream.writeString(post_author); + } + if ((flags & 131072) != 0) { + stream.writeInt64(grouped_id); + } + if ((flags & 1048576) != 0) { + reactions.serializeToStream(stream); + } + if ((flags & 4194304) != 0) { + Vector.serialize(stream, restriction_reason); + } + if ((flags & 33554432) != 0) { + stream.writeInt32(ttl_period); + } + if ((flags & 1073741824) != 0) { + stream.writeInt32(quick_reply_shortcut_id); + } writeAttachPath(stream); } } - public static class TL_messageService extends Message { - public static final int constructor = 0x2b085862; - + public static class TL_message_layer175 extends TL_message { + public static final int constructor = 0x1e4c8a69; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); out = (flags & 2) != 0; mentioned = (flags & 16) != 0; media_unread = (flags & 32) != 0; silent = (flags & 8192) != 0; post = (flags & 16384) != 0; + from_scheduled = (flags & 262144) != 0; legacy = (flags & 524288) != 0; + edit_hide = (flags & 2097152) != 0; + pinned = (flags & 16777216) != 0; + noforwards = (flags & 67108864) != 0; + invert_media = (flags & 134217728) != 0; id = stream.readInt32(exception); if ((flags & 256) != 0) { from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); } + if ((flags & 536870912) != 0) { + from_boosts_applied = stream.readInt32(exception); + } peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 268435456) != 0) { + saved_peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4) != 0) { + fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 2048) != 0) { + via_bot_id = stream.readInt64(exception); + } if ((flags & 8) != 0) { reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); } date = stream.readInt32(exception); - action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); + message = stream.readString(exception); + if ((flags & 512) != 0) { + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null) { + ttl = media.ttl_seconds; + } + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } + } + if ((flags & 64) != 0) { + reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 128) != 0) { + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); + } + if ((flags & 1024) != 0) { + views = stream.readInt32(exception); + } + if ((flags & 1024) != 0) { + forwards = stream.readInt32(exception); + } + if ((flags & 8388608) != 0) { + replies = MessageReplies.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 32768) != 0) { + edit_date = stream.readInt32(exception); + } + if ((flags & 65536) != 0) { + post_author = stream.readString(exception); + } + if ((flags & 131072) != 0) { + grouped_id = stream.readInt64(exception); + } + if ((flags & 1048576) != 0) { + reactions = MessageReactions.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4194304) != 0) { + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); + } if ((flags & 33554432) != 0) { ttl_period = stream.readInt32(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = out ? (flags | 2) : (flags &~ 2); flags = mentioned ? (flags | 16) : (flags &~ 16); flags = media_unread ? (flags | 32) : (flags &~ 32); flags = silent ? (flags | 8192) : (flags &~ 8192); flags = post ? (flags | 16384) : (flags &~ 16384); + flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); flags = legacy ? (flags | 524288) : (flags &~ 524288); + flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); + flags = pinned ? (flags | 16777216) : (flags &~ 16777216); + flags = noforwards ? (flags | 67108864) : (flags &~ 67108864); + flags = invert_media ? (flags | 134217728) : (flags &~ 134217728); stream.writeInt32(flags); stream.writeInt32(id); if ((flags & 256) != 0) { from_id.serializeToStream(stream); } + if ((flags & 536870912) != 0) { + stream.writeInt32(from_boosts_applied); + } peer_id.serializeToStream(stream); + if ((flags & 268435456) != 0) { + saved_peer_id.serializeToStream(stream); + } + if ((flags & 4) != 0) { + fwd_from.serializeToStream(stream); + } + if ((flags & 2048) != 0) { + stream.writeInt64(via_bot_id); + } if ((flags & 8) != 0) { reply_to.serializeToStream(stream); } stream.writeInt32(date); - action.serializeToStream(stream); + stream.writeString(message); + if ((flags & 512) != 0) { + media.serializeToStream(stream); + } + if ((flags & 64) != 0) { + reply_markup.serializeToStream(stream); + } + if ((flags & 128) != 0) { + Vector.serialize(stream, entities); + } + if ((flags & 1024) != 0) { + stream.writeInt32(views); + } + if ((flags & 1024) != 0) { + stream.writeInt32(forwards); + } + if ((flags & 8388608) != 0) { + replies.serializeToStream(stream); + } + if ((flags & 32768) != 0) { + stream.writeInt32(edit_date); + } + if ((flags & 65536) != 0) { + stream.writeString(post_author); + } + if ((flags & 131072) != 0) { + stream.writeInt64(grouped_id); + } + if ((flags & 1048576) != 0) { + reactions.serializeToStream(stream); + } + if ((flags & 4194304) != 0) { + Vector.serialize(stream, restriction_reason); + } if ((flags & 33554432) != 0) { stream.writeInt32(ttl_period); } + writeAttachPath(stream); } } - public static class TL_messageService_layer118 extends TL_messageService { - public static final int constructor = 0x9e19a1f6; + public static class TL_message_layer173 extends TL_message { + public static final int constructor = 0x76bec211; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - unread = (flags & 1) != 0; out = (flags & 2) != 0; mentioned = (flags & 16) != 0; media_unread = (flags & 32) != 0; silent = (flags & 8192) != 0; post = (flags & 16384) != 0; + from_scheduled = (flags & 262144) != 0; legacy = (flags & 524288) != 0; + edit_hide = (flags & 2097152) != 0; + pinned = (flags & 16777216) != 0; + noforwards = (flags & 67108864) != 0; + invert_media = (flags & 134217728) != 0; id = stream.readInt32(exception); if ((flags & 256) != 0) { - from_id = new TLRPC.TL_peerUser(); - from_id.user_id = stream.readInt32(exception); + from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); } peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 8) != 0) { - reply_to = new TLRPC.TL_messageReplyHeader(); - reply_to.flags |= 16; - reply_to.reply_to_msg_id = stream.readInt32(exception); + if ((flags & 268435456) != 0) { + saved_peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); } - date = stream.readInt32(exception); - action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = unread ? (flags | 1) : (flags &~ 1); - flags = out ? (flags | 2) : (flags &~ 2); - flags = mentioned ? (flags | 16) : (flags &~ 16); - flags = media_unread ? (flags | 32) : (flags &~ 32); - flags = silent ? (flags | 8192) : (flags &~ 8192); - flags = post ? (flags | 16384) : (flags &~ 16384); - flags = legacy ? (flags | 524288) : (flags &~ 524288); - stream.writeInt32(flags); - stream.writeInt32(id); - if ((flags & 256) != 0) { - stream.writeInt32((int) from_id.user_id); + if ((flags & 4) != 0) { + fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 2048) != 0) { + via_bot_id = stream.readInt64(exception); } - peer_id.serializeToStream(stream); if ((flags & 8) != 0) { - stream.writeInt32(reply_to.reply_to_msg_id); + reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); } - stream.writeInt32(date); - action.serializeToStream(stream); - writeAttachPath(stream); - } - } - //Message end - - //TL_dialog start - public static abstract class Dialog extends TLObject { - - public int flags; - public boolean pinned; - public boolean unread_mark; - public boolean view_forum_as_messages; - public Peer peer; - public int top_message; - public int read_inbox_max_id; - public int read_outbox_max_id; - public int unread_count; - public int unread_mentions_count; - public int unread_reactions_count; - public PeerNotifySettings notify_settings; - public int pts; - public DraftMessage draft; - public int folder_id; - public int ttl_period; - public int last_message_date; //custom - public long id; //custom - public int pinnedNum; //custom - public boolean isFolder; //custom - - public static Dialog TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - Dialog result = null; - switch (constructor) { - case 0xd58a08c6: - result = new TL_dialog(); - break; - case 0xa8edd0f5: - result = new TL_dialog_layer149(); - break; - case 0x71bd134c: - result = new TL_dialogFolder(); - result.isFolder = true; - break; + date = stream.readInt32(exception); + message = stream.readString(exception); + if ((flags & 512) != 0) { + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null) { + ttl = media.ttl_seconds; + } + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in Dialog", constructor)); + if ((flags & 64) != 0) { + reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); } - if (result != null) { - result.readParams(stream, exception); + if ((flags & 128) != 0) { + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } - return result; - } - } - - public static class TL_dialog extends Dialog { - public static final int constructor = 0xd58a08c6; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - pinned = (flags & 4) != 0; - unread_mark = (flags & 8) != 0; - view_forum_as_messages = (flags & 64) != 0; - peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - top_message = stream.readInt32(exception); - read_inbox_max_id = stream.readInt32(exception); - read_outbox_max_id = stream.readInt32(exception); - unread_count = stream.readInt32(exception); - unread_mentions_count = stream.readInt32(exception); - unread_reactions_count = stream.readInt32(exception); - notify_settings = TL_peerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 1) != 0) { - pts = stream.readInt32(exception); + if ((flags & 1024) != 0) { + views = stream.readInt32(exception); } - if ((flags & 2) != 0) { - draft = DraftMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 1024) != 0) { + forwards = stream.readInt32(exception); } - if ((flags & 16) != 0) { - folder_id = stream.readInt32(exception); + if ((flags & 8388608) != 0) { + replies = MessageReplies.TLdeserialize(stream, stream.readInt32(exception), exception); } - if ((flags & 32) != 0) { + if ((flags & 32768) != 0) { + edit_date = stream.readInt32(exception); + } + if ((flags & 65536) != 0) { + post_author = stream.readString(exception); + } + if ((flags & 131072) != 0) { + grouped_id = stream.readInt64(exception); + } + if ((flags & 1048576) != 0) { + reactions = MessageReactions.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4194304) != 0) { + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); + } + if ((flags & 33554432) != 0) { ttl_period = stream.readInt32(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = pinned ? (flags | 4) : (flags &~ 4); - flags = unread_mark ? (flags | 8) : (flags &~ 8); - flags = view_forum_as_messages ? (flags | 64) : (flags &~ 64); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); + flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); + flags = legacy ? (flags | 524288) : (flags &~ 524288); + flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); + flags = pinned ? (flags | 16777216) : (flags &~ 16777216); + flags = noforwards ? (flags | 67108864) : (flags &~ 67108864); + flags = invert_media ? (flags | 134217728) : (flags &~ 134217728); stream.writeInt32(flags); - peer.serializeToStream(stream); - stream.writeInt32(top_message); - stream.writeInt32(read_inbox_max_id); - stream.writeInt32(read_outbox_max_id); - stream.writeInt32(unread_count); - stream.writeInt32(unread_mentions_count); - stream.writeInt32(unread_reactions_count); - notify_settings.serializeToStream(stream); - if ((flags & 1) != 0) { - stream.writeInt32(pts); + stream.writeInt32(id); + if ((flags & 256) != 0) { + from_id.serializeToStream(stream); } - if ((flags & 2) != 0) { - draft.serializeToStream(stream); + peer_id.serializeToStream(stream); + if ((flags & 268435456) != 0) { + saved_peer_id.serializeToStream(stream); } - if ((flags & 16) != 0) { - stream.writeInt32(folder_id); + if ((flags & 4) != 0) { + fwd_from.serializeToStream(stream); } - if ((flags & 32) != 0) { - stream.writeInt32(ttl_period); + if ((flags & 2048) != 0) { + stream.writeInt64(via_bot_id); } - } - } - - public static class TL_dialog_layer149 extends TL_dialog { - public static final int constructor = 0xa8edd0f5; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - pinned = (flags & 4) != 0; - unread_mark = (flags & 8) != 0; - peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - top_message = stream.readInt32(exception); - read_inbox_max_id = stream.readInt32(exception); - read_outbox_max_id = stream.readInt32(exception); - unread_count = stream.readInt32(exception); - unread_mentions_count = stream.readInt32(exception); - unread_reactions_count = stream.readInt32(exception); - notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 1) != 0) { - pts = stream.readInt32(exception); + if ((flags & 8) != 0) { + reply_to.serializeToStream(stream); } - if ((flags & 2) != 0) { - draft = DraftMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + stream.writeInt32(date); + stream.writeString(message); + if ((flags & 512) != 0) { + media.serializeToStream(stream); } - if ((flags & 16) != 0) { - folder_id = stream.readInt32(exception); + if ((flags & 64) != 0) { + reply_markup.serializeToStream(stream); } - if ((flags & 32) != 0) { - ttl_period = stream.readInt32(exception); + if ((flags & 128) != 0) { + Vector.serialize(stream, entities); } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = pinned ? (flags | 4) : (flags &~ 4); - flags = unread_mark ? (flags | 8) : (flags &~ 8); - stream.writeInt32(flags); - peer.serializeToStream(stream); - stream.writeInt32(top_message); - stream.writeInt32(read_inbox_max_id); - stream.writeInt32(read_outbox_max_id); - stream.writeInt32(unread_count); - stream.writeInt32(unread_mentions_count); - stream.writeInt32(unread_reactions_count); - notify_settings.serializeToStream(stream); - if ((flags & 1) != 0) { - stream.writeInt32(pts); + if ((flags & 1024) != 0) { + stream.writeInt32(views); } - if ((flags & 2) != 0) { - draft.serializeToStream(stream); + if ((flags & 1024) != 0) { + stream.writeInt32(forwards); } - if ((flags & 16) != 0) { - stream.writeInt32(folder_id); + if ((flags & 8388608) != 0) { + replies.serializeToStream(stream); } - if ((flags & 32) != 0) { + if ((flags & 32768) != 0) { + stream.writeInt32(edit_date); + } + if ((flags & 65536) != 0) { + stream.writeString(post_author); + } + if ((flags & 131072) != 0) { + stream.writeInt64(grouped_id); + } + if ((flags & 1048576) != 0) { + reactions.serializeToStream(stream); + } + if ((flags & 4194304) != 0) { + Vector.serialize(stream, restriction_reason); + } + if ((flags & 33554432) != 0) { stream.writeInt32(ttl_period); } + writeAttachPath(stream); } } - public static class TL_dialogFolder extends Dialog { - public static final int constructor = 0x71bd134c; - - public TL_folder folder; - public int unread_muted_peers_count; - public int unread_unmuted_peers_count; - public int unread_muted_messages_count; - public int unread_unmuted_messages_count; + public static class TL_message_layer169 extends TL_message { + public static final int constructor = 0x38116ee0; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - pinned = (flags & 4) != 0; - folder = TL_folder.TLdeserialize(stream, stream.readInt32(exception), exception); - peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - top_message = stream.readInt32(exception); - unread_muted_peers_count = stream.readInt32(exception); - unread_unmuted_peers_count = stream.readInt32(exception); - unread_muted_messages_count = stream.readInt32(exception); - unread_unmuted_messages_count = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = pinned ? (flags | 4) : (flags &~ 4); - stream.writeInt32(flags); - folder.serializeToStream(stream); - peer.serializeToStream(stream); - stream.writeInt32(top_message); - stream.writeInt32(unread_muted_peers_count); - stream.writeInt32(unread_unmuted_peers_count); - stream.writeInt32(unread_muted_messages_count); - stream.writeInt32(unread_unmuted_messages_count); - } - } - //TL_dialog end - - //ChatParticipant start - public static class TL_chatChannelParticipant extends ChatParticipant { - public static final int constructor = 0xc8d7493e; - - public ChannelParticipant channelParticipant; - } - //ChatParticipant end - - //Chat start - public static class TL_chatEmpty extends Chat { - public static final int constructor = 0x29562865; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - - title = "DELETED"; - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - } - } - - public static class TL_chatEmpty_layer131 extends TL_chatEmpty { - public static final int constructor = 0x9ba2d800; - - - public void readParams(AbstractSerializedData stream, boolean exception) { + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + silent = (flags & 8192) != 0; + post = (flags & 16384) != 0; + from_scheduled = (flags & 262144) != 0; + legacy = (flags & 524288) != 0; + edit_hide = (flags & 2097152) != 0; + pinned = (flags & 16777216) != 0; + noforwards = (flags & 67108864) != 0; + invert_media = (flags & 134217728) != 0; id = stream.readInt32(exception); - - title = "DELETED"; - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32((int) id); - } - } - //Chat end - - //functions memory optimize - public static class TL_upload_saveFilePart extends TLObject { - public static final int constructor = 0xb304a621; - - public long file_id; - public int file_part; - public NativeByteBuffer bytes; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(file_id); - stream.writeInt32(file_part); - stream.writeByteBuffer(bytes); - } - - @Override - public void freeResources() { - if (disableFree) { - return; - } - if (bytes != null) { - bytes.reuse(); - bytes = null; + if ((flags & 256) != 0) { + from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); } - } - } - - public static class TL_messages_getStickers extends TLObject { - public static final int constructor = 0xd5a5d3a1; - - public String emoticon; - public long hash; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_Stickers.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(emoticon); - stream.writeInt64(hash); - } - } - - public static class TL_messages_getAllStickers extends TLObject { - public static final int constructor = 0xb8a0a1a8; - - public long hash; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_AllStickers.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(hash); - } - } - - public static class TL_upload_saveBigFilePart extends TLObject { - public static final int constructor = 0xde7b673d; - - public long file_id; - public int file_part; - public int file_total_parts; - public NativeByteBuffer bytes; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(file_id); - stream.writeInt32(file_part); - stream.writeInt32(file_total_parts); - stream.writeByteBuffer(bytes); - } - - @Override - public void freeResources() { - if (disableFree) { - return; + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 4) != 0) { + fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); } - if (bytes != null) { - bytes.reuse(); - bytes = null; + if ((flags & 2048) != 0) { + via_bot_id = stream.readInt64(exception); } - } - } - - public static class TL_upload_getWebFile extends TLObject { - public static final int constructor = 0x24e6818d; - - public InputWebFileLocation location; - public int offset; - public int limit; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_upload_webFile.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - location.serializeToStream(stream); - stream.writeInt32(offset); - stream.writeInt32(limit); - } - } - - public static class TL_upload_getCdnFile extends TLObject { - public static final int constructor = 0x395f69da; - - public byte[] file_token; - public long offset; - public int limit; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return upload_CdnFile.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(file_token); - stream.writeInt64(offset); - stream.writeInt32(limit); - } - } - - public static class TL_upload_reuploadCdnFile extends TLObject { - public static final int constructor = 0x9b2754a8; - - public byte[] file_token; - public byte[] request_token; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_fileHash object = TL_fileHash.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); + if ((flags & 8) != 0) { + reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); } - return vector; - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(file_token); - stream.writeByteArray(request_token); - } - } - - public static class TL_upload_getCdnFileHashes extends TLObject { - public static final int constructor = 0x91dc3f31; - - public byte[] file_token; - public long offset; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_fileHash object = TL_fileHash.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; + date = stream.readInt32(exception); + message = stream.readString(exception); + if ((flags & 512) != 0) { + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null) { + ttl = media.ttl_seconds; } - vector.objects.add(object); - } - return vector; - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(file_token); - stream.writeInt64(offset); - } - } - - public static class TL_upload_getFileHashes extends TLObject { - public static final int constructor = 0xc7025931; - - public InputFileLocation location; - public int offset; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_fileHash object = TL_fileHash.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; } - vector.objects.add(object); } - return vector; - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - location.serializeToStream(stream); - stream.writeInt32(offset); - } - } - - public static class TL_upload_webFile extends TLObject { - public static final int constructor = 0x21e753bc; - - public int size; - public String mime_type; - public storage_FileType file_type; - public int mtime; - public NativeByteBuffer bytes; - - public static TL_upload_webFile TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_upload_webFile.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_upload_webFile", constructor)); - } else { - return null; - } + if ((flags & 64) != 0) { + reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); } - TL_upload_webFile result = new TL_upload_webFile(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - size = stream.readInt32(exception); - mime_type = stream.readString(exception); - file_type = storage_FileType.TLdeserialize(stream, stream.readInt32(exception), exception); - mtime = stream.readInt32(exception); - bytes = stream.readByteBuffer(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(size); - stream.writeString(mime_type); - file_type.serializeToStream(stream); - stream.writeInt32(mtime); - stream.writeByteBuffer(bytes); - } - - @Override - public void freeResources() { - if (disableFree) { - return; + if ((flags & 128) != 0) { + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } - if (bytes != null) { - bytes.reuse(); - bytes = null; + if ((flags & 1024) != 0) { + views = stream.readInt32(exception); } - } - } - - public static abstract class upload_File extends TLObject { - public storage_FileType type; - public int mtime; - public NativeByteBuffer bytes; - public int dc_id; - public byte[] file_token; - public byte[] encryption_key; - public byte[] encryption_iv; - public ArrayList file_hashes = new ArrayList<>(); - - public static upload_File TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - upload_File result = null; - switch (constructor) { - case 0x96a18d5: - result = new TL_upload_file(); - break; - case 0xf18cda44: - result = new TL_upload_fileCdnRedirect(); - break; + if ((flags & 1024) != 0) { + forwards = stream.readInt32(exception); } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in upload_File", constructor)); + if ((flags & 8388608) != 0) { + replies = MessageReplies.TLdeserialize(stream, stream.readInt32(exception), exception); } - if (result != null) { - result.readParams(stream, exception); + if ((flags & 32768) != 0) { + edit_date = stream.readInt32(exception); } - return result; - } - } - - public static abstract class upload_CdnFile extends TLObject { - public NativeByteBuffer bytes; - public byte[] request_token; - - public static upload_CdnFile TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - upload_CdnFile result = null; - switch (constructor) { - case 0xa99fca4f: - result = new TL_upload_cdnFile(); - break; - case 0xeea8e46e: - result = new TL_upload_cdnFileReuploadNeeded(); - break; + if ((flags & 65536) != 0) { + post_author = stream.readString(exception); } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in upload_CdnFile", constructor)); + if ((flags & 131072) != 0) { + grouped_id = stream.readInt64(exception); } - if (result != null) { - result.readParams(stream, exception); + if ((flags & 1048576) != 0) { + reactions = MessageReactions.TLdeserialize(stream, stream.readInt32(exception), exception); } - return result; - } - } - - public static class TL_upload_cdnFile extends upload_CdnFile { - public static final int constructor = 0xa99fca4f; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - bytes = stream.readByteBuffer(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteBuffer(bytes); - } - - @Override - public void freeResources() { - if (disableFree) { - return; + if ((flags & 4194304) != 0) { + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } - if (bytes != null) { - bytes.reuse(); - bytes = null; + if ((flags & 33554432) != 0) { + ttl_period = stream.readInt32(exception); } } - } - - public static class TL_upload_cdnFileReuploadNeeded extends upload_CdnFile { - public static final int constructor = 0xeea8e46e; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - request_token = stream.readByteArray(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeByteArray(request_token); - } - } - - public static class TL_upload_file extends upload_File { - public static final int constructor = 0x96a18d5; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - type = storage_FileType.TLdeserialize(stream, stream.readInt32(exception), exception); - mtime = stream.readInt32(exception); - bytes = stream.readByteBuffer(exception); - } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - type.serializeToStream(stream); - stream.writeInt32(mtime); - stream.writeByteBuffer(bytes); - } - - @Override - public void freeResources() { - if (disableFree) { - return; + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); + flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); + flags = legacy ? (flags | 524288) : (flags &~ 524288); + flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); + flags = pinned ? (flags | 16777216) : (flags &~ 16777216); + flags = noforwards ? (flags | 67108864) : (flags &~ 67108864); + flags = invert_media ? (flags | 134217728) : (flags &~ 134217728); + stream.writeInt32(flags); + stream.writeInt32(id); + if ((flags & 256) != 0) { + from_id.serializeToStream(stream); } - if (bytes != null) { - bytes.reuse(); - bytes = null; + peer_id.serializeToStream(stream); + if ((flags & 4) != 0) { + fwd_from.serializeToStream(stream); } - } - } - - public static class TL_upload_fileCdnRedirect extends upload_File { - public static final int constructor = 0xf18cda44; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - dc_id = stream.readInt32(exception); - file_token = stream.readByteArray(exception); - encryption_key = stream.readByteArray(exception); - encryption_iv = stream.readByteArray(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + if ((flags & 2048) != 0) { + stream.writeInt64(via_bot_id); } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_fileHash object = TL_fileHash.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - file_hashes.add(object); + if ((flags & 8) != 0) { + reply_to.serializeToStream(stream); } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(dc_id); - stream.writeByteArray(file_token); - stream.writeByteArray(encryption_key); - stream.writeByteArray(encryption_iv); - stream.writeInt32(0x1cb5c415); - int count = file_hashes.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - file_hashes.get(a).serializeToStream(stream); + stream.writeInt32(date); + stream.writeString(message); + if ((flags & 512) != 0) { + media.serializeToStream(stream); } - } - } - - public static abstract class PhoneCallProtocol extends TLObject { - public int flags; - public boolean udp_p2p; - public boolean udp_reflector; - public int min_layer; - public int max_layer; - public ArrayList library_versions = new ArrayList<>(); - - public static PhoneCallProtocol TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - PhoneCallProtocol result = null; - switch (constructor) { - case 0xfc878fc8: - result = new TL_phoneCallProtocol(); - break; - case 0xa2bb35cb: - result = new TL_phoneCallProtocol_layer110(); - break; + if ((flags & 64) != 0) { + reply_markup.serializeToStream(stream); } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in PhoneCallProtocol", constructor)); + if ((flags & 128) != 0) { + Vector.serialize(stream, entities); } - if (result != null) { - result.readParams(stream, exception); + if ((flags & 1024) != 0) { + stream.writeInt32(views); } - return result; + if ((flags & 1024) != 0) { + stream.writeInt32(forwards); + } + if ((flags & 8388608) != 0) { + replies.serializeToStream(stream); + } + if ((flags & 32768) != 0) { + stream.writeInt32(edit_date); + } + if ((flags & 65536) != 0) { + stream.writeString(post_author); + } + if ((flags & 131072) != 0) { + stream.writeInt64(grouped_id); + } + if ((flags & 1048576) != 0) { + reactions.serializeToStream(stream); + } + if ((flags & 4194304) != 0) { + Vector.serialize(stream, restriction_reason); + } + if ((flags & 33554432) != 0) { + stream.writeInt32(ttl_period); + } + writeAttachPath(stream); } } - public static class TL_phoneCallProtocol extends PhoneCallProtocol { - public static final int constructor = 0xfc878fc8; - + public static class TL_message_layer135 extends TL_message { + public static final int constructor = 0x85d6cbe2; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - udp_p2p = (flags & 1) != 0; - udp_reflector = (flags & 2) != 0; - min_layer = stream.readInt32(exception); - max_layer = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + silent = (flags & 8192) != 0; + post = (flags & 16384) != 0; + from_scheduled = (flags & 262144) != 0; + legacy = (flags & 524288) != 0; + edit_hide = (flags & 2097152) != 0; + pinned = (flags & 16777216) != 0; + noforwards = (flags & 67108864) != 0; + id = stream.readInt32(exception); + if ((flags & 256) != 0) { + from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 4) != 0) { + fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 2048) != 0) { + via_bot_id = stream.readInt64(exception); + } + if ((flags & 8) != 0) { + reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + } + date = stream.readInt32(exception); + message = stream.readString(exception); + if ((flags & 512) != 0) { + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null) { + ttl = media.ttl_seconds; + } + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; } - return; } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - library_versions.add(stream.readString(exception)); + if ((flags & 64) != 0) { + reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = udp_p2p ? (flags | 1) : (flags &~ 1); - flags = udp_reflector ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - stream.writeInt32(min_layer); - stream.writeInt32(max_layer); - stream.writeInt32(0x1cb5c415); - int count = library_versions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(library_versions.get(a)); + if ((flags & 128) != 0) { + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } - } - } - - public static class TL_phoneCallProtocol_layer110 extends TL_phoneCallProtocol { - public static final int constructor = 0xa2bb35cb; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - udp_p2p = (flags & 1) != 0; - udp_reflector = (flags & 2) != 0; - min_layer = stream.readInt32(exception); - max_layer = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = udp_p2p ? (flags | 1) : (flags &~ 1); - flags = udp_reflector ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - stream.writeInt32(min_layer); - stream.writeInt32(max_layer); - } - } - - public static class TL_messages_sendEncryptedFile extends TLObject { - public static final int constructor = 0x5559481d; - - public int flags; - public boolean silent; - public TL_inputEncryptedChat peer; - public long random_id; - public NativeByteBuffer data; - public InputEncryptedFile file; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_SentEncryptedMessage.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = silent ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - peer.serializeToStream(stream); - stream.writeInt64(random_id); - stream.writeByteBuffer(data); - file.serializeToStream(stream); - } - - @Override - public void freeResources() { - if (data != null) { - data.reuse(); - data = null; + if ((flags & 1024) != 0) { + views = stream.readInt32(exception); } - } - } - - public static class TL_messages_sendEncryptedMultiMedia extends TLObject { - public static final int constructor = 0xcacacaca; - - public ArrayList messages = new ArrayList<>(); - public ArrayList files = new ArrayList<>(); - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_SentEncryptedMessage.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - - } - - @Override - public void freeResources() { - - } - } - - public static class TL_messages_sendEncrypted extends TLObject { - public static final int constructor = 0x44fa7a15; - - public int flags; - public boolean silent; - public TL_inputEncryptedChat peer; - public long random_id; - public NativeByteBuffer data; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_SentEncryptedMessage.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = silent ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - peer.serializeToStream(stream); - stream.writeInt64(random_id); - stream.writeByteBuffer(data); - } - - @Override - public void freeResources() { - if (data != null) { - data.reuse(); - data = null; + if ((flags & 1024) != 0) { + forwards = stream.readInt32(exception); } - } - } - - public static class TL_messages_sendEncryptedService extends TLObject { - public static final int constructor = 0x32d439a4; - - public TL_inputEncryptedChat peer; - public long random_id; - public NativeByteBuffer data; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_SentEncryptedMessage.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt64(random_id); - stream.writeByteBuffer(data); - } - - @Override - public void freeResources() { - if (data != null) { - data.reuse(); - data = null; + if ((flags & 8388608) != 0) { + replies = MessageReplies.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 32768) != 0) { + edit_date = stream.readInt32(exception); + } + if ((flags & 65536) != 0) { + post_author = stream.readString(exception); + } + if ((flags & 131072) != 0) { + grouped_id = stream.readInt64(exception); + } + if ((flags & 4194304) != 0) { + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); + } + if ((flags & 33554432) != 0) { + ttl_period = stream.readInt32(exception); } - } - } - - public static class TL_messages_getSearchResultsPositions extends TLObject { - public static final int constructor = 0x9c7f2f10; - - public int flags; - public InputPeer peer; - public InputPeer saved_peer_id; - public MessagesFilter filter; - public int offset_id; - public int limit; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_searchResultsPositions.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); + flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); + flags = legacy ? (flags | 524288) : (flags &~ 524288); + flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); + flags = pinned ? (flags | 16777216) : (flags &~ 16777216); + flags = noforwards ? (flags | 67108864) : (flags &~ 67108864); stream.writeInt32(flags); - peer.serializeToStream(stream); + stream.writeInt32(id); + if ((flags & 256) != 0) { + from_id.serializeToStream(stream); + } + peer_id.serializeToStream(stream); if ((flags & 4) != 0) { - saved_peer_id.serializeToStream(stream); + fwd_from.serializeToStream(stream); } - filter.serializeToStream(stream); - stream.writeInt32(offset_id); - stream.writeInt32(limit); + if ((flags & 2048) != 0) { + stream.writeInt64(via_bot_id); + } + if ((flags & 8) != 0) { + reply_to.serializeToStream(stream); + } + stream.writeInt32(date); + stream.writeString(message); + if ((flags & 512) != 0) { + media.serializeToStream(stream); + } + if ((flags & 64) != 0) { + reply_markup.serializeToStream(stream); + } + if ((flags & 128) != 0) { + Vector.serialize(stream, entities); + } + if ((flags & 1024) != 0) { + stream.writeInt32(views); + } + if ((flags & 1024) != 0) { + stream.writeInt32(forwards); + } + if ((flags & 8388608) != 0) { + replies.serializeToStream(stream); + } + if ((flags & 32768) != 0) { + stream.writeInt32(edit_date); + } + if ((flags & 65536) != 0) { + stream.writeString(post_author); + } + if ((flags & 131072) != 0) { + stream.writeInt64(grouped_id); + } + if ((flags & 4194304) != 0) { + Vector.serialize(stream, restriction_reason); + } + if ((flags & 33554432) != 0) { + stream.writeInt32(ttl_period); + } + writeAttachPath(stream); } } - public static class TL_attachMenuBot_layer140 extends TL_attachMenuBot { - public static final int constructor = 0xe93cb772; + public static class TL_message_layer131 extends TL_message { + public static final int constructor = 0xbce383d2; - public static TL_attachMenuBot TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_attachMenuBot.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_attachMenuBot", constructor)); - } else { - return null; + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + silent = (flags & 8192) != 0; + post = (flags & 16384) != 0; + from_scheduled = (flags & 262144) != 0; + legacy = (flags & 524288) != 0; + edit_hide = (flags & 2097152) != 0; + pinned = (flags & 16777216) != 0; + id = stream.readInt32(exception); + if ((flags & 256) != 0) { + from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 4) != 0) { + fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 2048) != 0) { + via_bot_id = stream.readInt32(exception); + } + if ((flags & 8) != 0) { + reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + } + date = stream.readInt32(exception); + message = stream.readString(exception); + if ((flags & 512) != 0) { + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null) { + ttl = media.ttl_seconds; //custom + } + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; } } - TL_attachMenuBot result = new TL_attachMenuBot(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - inactive = (flags & 1) != 0; - bot_id = stream.readInt64(exception); - short_name = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + if ((flags & 64) != 0) { + reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 128) != 0) { + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); + } + if ((flags & 1024) != 0) { + views = stream.readInt32(exception); + } + if ((flags & 1024) != 0) { + forwards = stream.readInt32(exception); + } + if ((flags & 8388608) != 0) { + replies = MessageReplies.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 32768) != 0) { + edit_date = stream.readInt32(exception); + } + if ((flags & 65536) != 0) { + post_author = stream.readString(exception); + } + if ((flags & 131072) != 0) { + grouped_id = stream.readInt64(exception); } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_attachMenuBotIcon object = TL_attachMenuBotIcon.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - icons.add(object); + if ((flags & 4194304) != 0) { + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); + } + if ((flags & 33554432) != 0) { + ttl_period = stream.readInt32(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = inactive ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); + flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); + flags = legacy ? (flags | 524288) : (flags &~ 524288); + flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); + flags = pinned ? (flags | 16777216) : (flags &~ 16777216); stream.writeInt32(flags); - stream.writeInt64(bot_id); - stream.writeString(short_name); - stream.writeInt32(0x1cb5c415); - int count = icons.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - icons.get(a).serializeToStream(stream); + stream.writeInt32(id); + if ((flags & 256) != 0) { + from_id.serializeToStream(stream); + } + peer_id.serializeToStream(stream); + if ((flags & 4) != 0) { + fwd_from.serializeToStream(stream); + } + if ((flags & 2048) != 0) { + stream.writeInt32((int) via_bot_id); + } + if ((flags & 8) != 0) { + reply_to.serializeToStream(stream); + } + stream.writeInt32(date); + stream.writeString(message); + if ((flags & 512) != 0) { + media.serializeToStream(stream); + } + if ((flags & 64) != 0) { + reply_markup.serializeToStream(stream); + } + if ((flags & 128) != 0) { + Vector.serialize(stream, entities); } + if ((flags & 1024) != 0) { + stream.writeInt32(views); + } + if ((flags & 1024) != 0) { + stream.writeInt32(forwards); + } + if ((flags & 8388608) != 0) { + replies.serializeToStream(stream); + } + if ((flags & 32768) != 0) { + stream.writeInt32(edit_date); + } + if ((flags & 65536) != 0) { + stream.writeString(post_author); + } + if ((flags & 131072) != 0) { + stream.writeInt64(grouped_id); + } + if ((flags & 4194304) != 0) { + Vector.serialize(stream, restriction_reason); + } + if ((flags & 33554432) != 0) { + stream.writeInt32(ttl_period); + } + writeAttachPath(stream); //custom } } - public static class TL_attachMenuBot_layer162 extends TL_attachMenuBot { - public static final int constructor = 0xc8aa2cd2; + public static class TL_message_layer123 extends TL_message { + public static final int constructor = 0x58ae39c9; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - inactive = (flags & 1) != 0; - has_settings = (flags & 2) != 0; - request_write_access = (flags & 4) != 0; - bot_id = stream.readInt64(exception); - short_name = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + silent = (flags & 8192) != 0; + post = (flags & 16384) != 0; + from_scheduled = (flags & 262144) != 0; + legacy = (flags & 524288) != 0; + edit_hide = (flags & 2097152) != 0; + pinned = (flags & 16777216) != 0; + id = stream.readInt32(exception); + if ((flags & 256) != 0) { + from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - AttachMenuPeerType object = AttachMenuPeerType.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - peer_types.add(object); + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 4) != 0) { + fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + if ((flags & 2048) != 0) { + via_bot_id = stream.readInt32(exception); } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_attachMenuBotIcon object = TL_attachMenuBotIcon.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; + if ((flags & 8) != 0) { + reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + } + date = stream.readInt32(exception); + message = stream.readString(exception); + if ((flags & 512) != 0) { + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null) { + ttl = media.ttl_seconds; //custom + } + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; } - icons.add(object); + } + if ((flags & 64) != 0) { + reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 128) != 0) { + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); + } + if ((flags & 1024) != 0) { + views = stream.readInt32(exception); + } + if ((flags & 1024) != 0) { + forwards = stream.readInt32(exception); + } + if ((flags & 8388608) != 0) { + replies = MessageReplies.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 32768) != 0) { + edit_date = stream.readInt32(exception); + } + if ((flags & 65536) != 0) { + post_author = stream.readString(exception); + } + if ((flags & 131072) != 0) { + grouped_id = stream.readInt64(exception); + } + if ((flags & 4194304) != 0) { + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = inactive ? (flags | 1) : (flags &~ 1); - flags = has_settings ? (flags | 2) : (flags &~ 2); - flags = request_write_access ? (flags | 4) : (flags &~ 4); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); + flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); + flags = legacy ? (flags | 524288) : (flags &~ 524288); + flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); + flags = pinned ? (flags | 16777216) : (flags &~ 16777216); stream.writeInt32(flags); - stream.writeInt64(bot_id); - stream.writeString(short_name); - stream.writeInt32(0x1cb5c415); - int count = peer_types.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - peer_types.get(a).serializeToStream(stream); + stream.writeInt32(id); + if ((flags & 256) != 0) { + from_id.serializeToStream(stream); } - stream.writeInt32(0x1cb5c415); - count = icons.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - icons.get(a).serializeToStream(stream); + peer_id.serializeToStream(stream); + if ((flags & 4) != 0) { + fwd_from.serializeToStream(stream); + } + if ((flags & 2048) != 0) { + stream.writeInt32((int) via_bot_id); + } + if ((flags & 8) != 0) { + reply_to.serializeToStream(stream); + } + stream.writeInt32(date); + stream.writeString(message); + if ((flags & 512) != 0) { + media.serializeToStream(stream); + } + if ((flags & 64) != 0) { + reply_markup.serializeToStream(stream); + } + if ((flags & 128) != 0) { + Vector.serialize(stream, entities); + } + if ((flags & 1024) != 0) { + stream.writeInt32(views); + } + if ((flags & 1024) != 0) { + stream.writeInt32(forwards); + } + if ((flags & 8388608) != 0) { + replies.serializeToStream(stream); + } + if ((flags & 32768) != 0) { + stream.writeInt32(edit_date); + } + if ((flags & 65536) != 0) { + stream.writeString(post_author); + } + if ((flags & 131072) != 0) { + stream.writeInt64(grouped_id); + } + if ((flags & 4194304) != 0) { + Vector.serialize(stream, restriction_reason); } + writeAttachPath(stream); } } - public static class TL_attachMenuBot extends AttachMenuBot { - public static final int constructor = 0xd90d8dfe; - - public int flags; - public boolean inactive; - public boolean has_settings; - public boolean request_write_access; - public boolean show_in_attach_menu; - public boolean show_in_side_menu; - public boolean side_menu_disclaimer_needed; - public long bot_id; - public String short_name; - public ArrayList peer_types = new ArrayList<>(); - public ArrayList icons = new ArrayList<>(); + public static class TL_message_layer118 extends TL_message { + public static final int constructor = 0xf52e6b7f; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - inactive = (flags & 1) != 0; - has_settings = (flags & 2) != 0; - request_write_access = (flags & 4) != 0; - show_in_attach_menu = (flags & 8) != 0; - show_in_side_menu = (flags & 16) != 0; - side_menu_disclaimer_needed = (flags & 32) != 0; - bot_id = stream.readInt64(exception); - short_name = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + silent = (flags & 8192) != 0; + post = (flags & 16384) != 0; + from_scheduled = (flags & 262144) != 0; + legacy = (flags & 524288) != 0; + edit_hide = (flags & 2097152) != 0; + id = stream.readInt32(exception); + if ((flags & 256) != 0) { + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - AttachMenuPeerType object = AttachMenuPeerType.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - peer_types.add(object); + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 4) != 0) { + fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + if ((flags & 2048) != 0) { + via_bot_id = stream.readInt32(exception); } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_attachMenuBotIcon object = TL_attachMenuBotIcon.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; + if ((flags & 8) != 0) { + reply_to = new TLRPC.TL_messageReplyHeader(); + reply_to.flags |= 16; + reply_to.reply_to_msg_id = stream.readInt32(exception); + } + date = stream.readInt32(exception); + message = stream.readString(exception); + if ((flags & 512) != 0) { + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null) { + ttl = media.ttl_seconds; //custom + } + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; } - icons.add(object); + } + if ((flags & 64) != 0) { + reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 128) != 0) { + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); + } + if ((flags & 1024) != 0) { + views = stream.readInt32(exception); + } + if ((flags & 1024) != 0) { + forwards = stream.readInt32(exception); + } + if ((flags & 32768) != 0) { + edit_date = stream.readInt32(exception); + } + if ((flags & 65536) != 0) { + post_author = stream.readString(exception); + } + if ((flags & 131072) != 0) { + grouped_id = stream.readInt64(exception); + } + if ((flags & 4194304) != 0) { + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = inactive ? (flags | 1) : (flags &~ 1); - flags = has_settings ? (flags | 2) : (flags &~ 2); - flags = request_write_access ? (flags | 4) : (flags &~ 4); - flags = show_in_attach_menu ? (flags | 8) : (flags &~ 8); - flags = show_in_side_menu ? (flags | 16) : (flags &~ 16); - flags = side_menu_disclaimer_needed ? (flags | 32) : (flags &~ 32); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); + flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); + flags = legacy ? (flags | 524288) : (flags &~ 524288); + flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); stream.writeInt32(flags); - stream.writeInt64(bot_id); - stream.writeString(short_name); - stream.writeInt32(0x1cb5c415); - int count = peer_types.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - peer_types.get(a).serializeToStream(stream); + stream.writeInt32(id); + if ((flags & 256) != 0) { + stream.writeInt32((int) from_id.user_id); } - stream.writeInt32(0x1cb5c415); - count = icons.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - icons.get(a).serializeToStream(stream); + peer_id.serializeToStream(stream); + if ((flags & 4) != 0) { + fwd_from.serializeToStream(stream); } - } - } - - public static abstract class AttachMenuBot extends TLObject { - - public static TL_attachMenuBot TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - TL_attachMenuBot result = null; - switch (constructor) { - case 0xd90d8dfe: - result = new TL_attachMenuBot(); - break; - case 0xc8aa2cd2: - result = new TL_attachMenuBot_layer162(); - break; - case 0xe93cb772: - result = new TL_attachMenuBot_layer140(); - break; + if ((flags & 2048) != 0) { + stream.writeInt32((int) via_bot_id); } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in AttachMenuBot", constructor)); + if ((flags & 8) != 0) { + stream.writeInt32(reply_to.reply_to_msg_id); } - if (result != null) { - result.readParams(stream, exception); + stream.writeInt32(date); + stream.writeString(message); + if ((flags & 512) != 0) { + media.serializeToStream(stream); } - return result; - } - } - - public static abstract class AttachMenuBots extends TLObject { - - public static AttachMenuBots TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - AttachMenuBots result = null; - switch (constructor) { - case 0xf1d88a5c: - result = new TL_attachMenuBotsNotModified(); - break; - case 0x3c4301c0: - result = new TL_attachMenuBots(); - break; + if ((flags & 64) != 0) { + reply_markup.serializeToStream(stream); } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in AttachMenuBots", constructor)); + if ((flags & 128) != 0) { + Vector.serialize(stream, entities); } - if (result != null) { - result.readParams(stream, exception); + if ((flags & 1024) != 0) { + stream.writeInt32(views); } - return result; - } - } - - public static class TL_attachMenuBotsNotModified extends AttachMenuBots { - public static final int constructor = 0xf1d88a5c; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + if ((flags & 1024) != 0) { + stream.writeInt32(forwards); + } + if ((flags & 32768) != 0) { + stream.writeInt32(edit_date); + } + if ((flags & 65536) != 0) { + stream.writeString(post_author); + } + if ((flags & 131072) != 0) { + stream.writeInt64(grouped_id); + } + if ((flags & 4194304) != 0) { + Vector.serialize(stream, restriction_reason); + } + writeAttachPath(stream); } } - public static class TL_attachMenuBots extends AttachMenuBots { - public static final int constructor = 0x3c4301c0; - - public long hash; - public ArrayList bots = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); + public static class TL_message_layer117 extends TL_message { + public static final int constructor = 0x452c0e65; - public void readParams(AbstractSerializedData stream, boolean exception) { - hash = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + silent = (flags & 8192) != 0; + post = (flags & 16384) != 0; + from_scheduled = (flags & 262144) != 0; + legacy = (flags & 524288) != 0; + edit_hide = (flags & 2097152) != 0; + id = stream.readInt32(exception); + if ((flags & 256) != 0) { + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_attachMenuBot object = TL_attachMenuBot.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - bots.add(object); + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 4) != 0) { + fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + if ((flags & 2048) != 0) { + via_bot_id = stream.readInt32(exception); } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; + if ((flags & 8) != 0) { + reply_to = new TLRPC.TL_messageReplyHeader(); + reply_to.flags |= 16; + reply_to.reply_to_msg_id = stream.readInt32(exception); + } + date = stream.readInt32(exception); + message = stream.readString(exception); + if ((flags & 512) != 0) { + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null) { + ttl = media.ttl_seconds; //custom } - users.add(object); + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } + } + if ((flags & 64) != 0) { + reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 128) != 0) { + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); + } + if ((flags & 1024) != 0) { + views = stream.readInt32(exception); + } + if ((flags & 32768) != 0) { + edit_date = stream.readInt32(exception); + } + if ((flags & 65536) != 0) { + post_author = stream.readString(exception); + } + if ((flags & 131072) != 0) { + grouped_id = stream.readInt64(exception); + } + if ((flags & 4194304) != 0) { + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(hash); - stream.writeInt32(0x1cb5c415); - int count = bots.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - bots.get(a).serializeToStream(stream); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); + flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); + flags = legacy ? (flags | 524288) : (flags &~ 524288); + flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); + stream.writeInt32(flags); + stream.writeInt32(id); + if ((flags & 256) != 0) { + stream.writeInt32((int) from_id.user_id); } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); + peer_id.serializeToStream(stream); + if ((flags & 4) != 0) { + fwd_from.serializeToStream(stream); } - } - } - - public static class TL_updateAttachMenuBots extends Update { - public static final int constructor = 0x17b7a20b; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_messages_webViewResult extends TLObject { - public static final int constructor = 0xaadf159b; - - public BotInlineResult result; - public ArrayList users = new ArrayList<>(); - - public static TL_messages_webViewResult TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_webViewResult.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_webViewResult", constructor)); - } else { - return null; - } + if ((flags & 2048) != 0) { + stream.writeInt32((int) via_bot_id); } - TL_messages_webViewResult result = new TL_messages_webViewResult(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - result = BotInlineResult.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + if ((flags & 8) != 0) { + stream.writeInt32(reply_to.reply_to_msg_id); } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); + stream.writeInt32(date); + stream.writeString(message); + if ((flags & 512) != 0) { + media.serializeToStream(stream); } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - result.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); + if ((flags & 64) != 0) { + reply_markup.serializeToStream(stream); } - } - } - - public static class TL_keyboardButtonWebView extends KeyboardButton { - public static final int constructor = 0x13767230; - - public void readParams(AbstractSerializedData stream, boolean exception) { - text = stream.readString(exception); - url = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(text); - stream.writeString(url); - } - } - - public static class RequestPeerType extends TLObject { - - public int flags; - - public Boolean creator; - public TL_chatAdminRights user_admin_rights; - public TL_chatAdminRights bot_admin_rights; - public Boolean has_username; - public Boolean forum; - public Boolean bot_participant; - - public static RequestPeerType TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - RequestPeerType result = null; - switch (constructor) { - case TL_requestPeerTypeUser.constructor: - result = new TL_requestPeerTypeUser(); - break; - case TL_requestPeerTypeChat.constructor: - result = new TL_requestPeerTypeChat(); - break; - case TL_requestPeerTypeBroadcast.constructor: - result = new TL_requestPeerTypeBroadcast(); - break; + if ((flags & 128) != 0) { + Vector.serialize(stream, entities); } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in RequestPeerType", constructor)); + if ((flags & 1024) != 0) { + stream.writeInt32(views); } - if (result != null) { - result.readParams(stream, exception); + if ((flags & 32768) != 0) { + stream.writeInt32(edit_date); } - return result; + if ((flags & 65536) != 0) { + stream.writeString(post_author); + } + if ((flags & 131072) != 0) { + stream.writeInt64(grouped_id); + } + if ((flags & 4194304) != 0) { + Vector.serialize(stream, restriction_reason); + } + writeAttachPath(stream); } } - public static class TL_requestPeerTypeUser extends RequestPeerType { - public static final int constructor = 0x5f3b8a00; - - public Boolean bot; - public Boolean premium; + public static class TL_message_layer104_3 extends TL_message { + public static final int constructor = 0x9789dac4; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - if ((flags & 1) != 0) { - bot = stream.readBool(exception); + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + silent = (flags & 8192) != 0; + post = (flags & 16384) != 0; + from_scheduled = (flags & 262144) != 0; + legacy = (flags & 524288) != 0; + edit_hide = (flags & 2097152) != 0; + id = stream.readInt32(exception); + if ((flags & 256) != 0) { + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); } - if ((flags & 2) != 0) { - premium = stream.readBool(exception); + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 4) != 0) { + fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 2048) != 0) { + via_bot_id = stream.readInt32(exception); + } + if ((flags & 8) != 0) { + reply_to = new TLRPC.TL_messageReplyHeader(); + reply_to.flags |= 16; + reply_to.reply_to_msg_id = stream.readInt32(exception); + } + date = stream.readInt32(exception); + message = stream.readString(exception); + if ((flags & 512) != 0) { + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null) { + ttl = media.ttl_seconds; //custom + } + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } + } + if ((flags & 64) != 0) { + reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 128) != 0) { + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); + } + if ((flags & 1024) != 0) { + views = stream.readInt32(exception); + } + if ((flags & 32768) != 0) { + edit_date = stream.readInt32(exception); + } + if ((flags & 65536) != 0) { + post_author = stream.readString(exception); + } + if ((flags & 131072) != 0) { + grouped_id = stream.readInt64(exception); + } + if ((flags & 1048576) != 0) { + reactions = MessageReactions.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4194304) != 0) { + restriction_reason = Vector.deserialize(stream, RestrictionReason::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = bot != null ? (flags | 1) : (flags &~ 1); - flags = premium != null ? (flags | 2) : (flags &~ 2); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); + flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); + flags = legacy ? (flags | 524288) : (flags &~ 524288); + flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); stream.writeInt32(flags); - if (bot != null) { - stream.writeBool(bot); + stream.writeInt32(id); + if ((flags & 256) != 0) { + stream.writeInt32((int) from_id.user_id); } - if (premium != null) { - stream.writeBool(premium); + peer_id.serializeToStream(stream); + if ((flags & 4) != 0) { + fwd_from.serializeToStream(stream); + } + if ((flags & 2048) != 0) { + stream.writeInt32((int) via_bot_id); } - } - } - - public static class TL_requestPeerTypeChat extends RequestPeerType { - public static final int constructor = 0xc9f06e1b; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - bot_participant = (flags & 32) != 0; - creator = (flags & 1) != 0; if ((flags & 8) != 0) { - has_username = stream.readBool(exception); + stream.writeInt32(reply_to.reply_to_msg_id); } - if ((flags & 16) != 0) { - forum = stream.readBool(exception); + stream.writeInt32(date); + stream.writeString(message); + if ((flags & 512) != 0) { + media.serializeToStream(stream); } - if ((flags & 2) != 0) { - user_admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 64) != 0) { + reply_markup.serializeToStream(stream); } - if ((flags & 4) != 0) { - bot_admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 128) != 0) { + Vector.serialize(stream, entities); } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = creator != null && creator ? (flags | 1) : (flags &~ 1); - flags = user_admin_rights != null ? (flags | 2) : (flags &~ 2); - flags = bot_admin_rights != null ? (flags | 4) : (flags &~ 4); - flags = has_username != null ? (flags | 8) : (flags &~ 8); - flags = forum != null ? (flags | 16) : (flags &~ 16); - flags = bot_participant != null && bot_participant ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - if (has_username != null) { - stream.writeBool(has_username); + if ((flags & 1024) != 0) { + stream.writeInt32(views); } - if (forum != null) { - stream.writeBool(forum); + if ((flags & 32768) != 0) { + stream.writeInt32(edit_date); } - if (user_admin_rights != null) { - user_admin_rights.serializeToStream(stream); + if ((flags & 65536) != 0) { + stream.writeString(post_author); } - if (bot_admin_rights != null) { - bot_admin_rights.serializeToStream(stream); + if ((flags & 131072) != 0) { + stream.writeInt64(grouped_id); + } + if ((flags & 1048576) != 0) { + reactions.serializeToStream(stream); + } + if ((flags & 4194304) != 0) { + Vector.serialize(stream, restriction_reason); } + writeAttachPath(stream); } } - public static class TL_requestPeerTypeBroadcast extends RequestPeerType { - public static final int constructor = 0x339bef6c; + public static class TL_message_layer104_2 extends TL_message { + public static final int constructor = 0x1c9b1027; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - creator = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + silent = (flags & 8192) != 0; + post = (flags & 16384) != 0; + from_scheduled = (flags & 262144) != 0; + legacy = (flags & 524288) != 0; + edit_hide = (flags & 2097152) != 0; + id = stream.readInt32(exception); + if ((flags & 256) != 0) { + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); + } + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 4) != 0) { + fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 2048) != 0) { + via_bot_id = stream.readInt32(exception); + } if ((flags & 8) != 0) { - has_username = stream.readBool(exception); + reply_to = new TLRPC.TL_messageReplyHeader(); + reply_to.flags |= 16; + reply_to.reply_to_msg_id = stream.readInt32(exception); } - if ((flags & 2) != 0) { - user_admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); + date = stream.readInt32(exception); + message = stream.readString(exception); + if ((flags & 512) != 0) { + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null) { + ttl = media.ttl_seconds; //custom + } + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } } - if ((flags & 4) != 0) { - bot_admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 64) != 0) { + reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = creator != null && creator ? (flags | 1) : (flags &~ 1); - flags = user_admin_rights != null ? (flags | 2) : (flags &~ 2); - flags = bot_admin_rights != null ? (flags | 4) : (flags &~ 4); - flags = has_username != null ? (flags | 8) : (flags &~ 8); - stream.writeInt32(flags); - if (has_username != null) { - stream.writeBool(has_username); + if ((flags & 128) != 0) { + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } - if (user_admin_rights != null) { - user_admin_rights.serializeToStream(stream); + if ((flags & 1024) != 0) { + views = stream.readInt32(exception); } - if (bot_admin_rights != null) { - bot_admin_rights.serializeToStream(stream); + if ((flags & 32768) != 0) { + edit_date = stream.readInt32(exception); + } + if ((flags & 65536) != 0) { + post_author = stream.readString(exception); + } + if ((flags & 131072) != 0) { + grouped_id = stream.readInt64(exception); + } + if ((flags & 1048576) != 0) { + reactions = MessageReactions.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4194304) != 0) { + stream.readString(exception); } - } - } - - public static class TL_keyboardButtonRequestPeer_layer168 extends TL_keyboardButtonRequestPeer { - public static final int constructor = 0xd0b468c; - - public void readParams(AbstractSerializedData stream, boolean exception) { - text = stream.readString(exception); - button_id = stream.readInt32(exception); - peer_type = RequestPeerType.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(text); - stream.writeInt32(button_id); - peer_type.serializeToStream(stream); - } - } - - public static class TL_keyboardButtonRequestPeer extends KeyboardButton { - public static final int constructor = 0x53d7bfd8; - - public RequestPeerType peer_type; - public int max_quantity; - - public void readParams(AbstractSerializedData stream, boolean exception) { - text = stream.readString(exception); - button_id = stream.readInt32(exception); - peer_type = RequestPeerType.TLdeserialize(stream, stream.readInt32(exception), exception); - max_quantity = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(text); - stream.writeInt32(button_id); - peer_type.serializeToStream(stream); - stream.writeInt32(max_quantity); - } - } - - public static class TL_keyboardButtonCopy extends KeyboardButton { - public static final int constructor = 0x75d2698e; - - public String copy_text; - - public void readParams(AbstractSerializedData stream, boolean exception) { - text = stream.readString(exception); - copy_text = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(text); - stream.writeString(copy_text); - } - } - - public static class TL_messages_getAttachMenuBots extends TLObject { - public static final int constructor = 0x16fcc2cb; - - public long hash; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return AttachMenuBots.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(hash); - } - } - - public static class TL_messages_toggleBotInAttachMenu extends TLObject { - public static final int constructor = 0x69f59d69; - - public int flags; - public boolean write_allowed; - public InputUser bot; - public boolean enabled; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = write_allowed ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); + flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); + flags = legacy ? (flags | 524288) : (flags &~ 524288); + flags = edit_hide ? (flags | 2097152) : (flags &~ 2097152); stream.writeInt32(flags); - bot.serializeToStream(stream); - stream.writeBool(enabled); - } - } - - public static class TL_webViewResultUrl extends TLObject { - public static final int constructor = 0x4d22ff98; - - public int flags; - public boolean fullsize; - public boolean fullscreen; - public long query_id; - public String url; - - public static TL_webViewResultUrl TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_webViewResultUrl.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_webViewResultUrl", constructor)); - } else { - return null; - } + stream.writeInt32(id); + if ((flags & 256) != 0) { + stream.writeInt32((int) from_id.user_id); } - TL_webViewResultUrl result = new TL_webViewResultUrl(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - fullsize = (flags & 2) != 0; - fullscreen = (flags & 4) != 0; - if ((flags & 1) != 0) { - query_id = stream.readInt64(exception); + peer_id.serializeToStream(stream); + if ((flags & 4) != 0) { + fwd_from.serializeToStream(stream); + } + if ((flags & 2048) != 0) { + stream.writeInt32((int) via_bot_id); + } + if ((flags & 8) != 0) { + stream.writeInt32(reply_to.reply_to_msg_id); + } + stream.writeInt32(date); + stream.writeString(message); + if ((flags & 512) != 0) { + media.serializeToStream(stream); + } + if ((flags & 64) != 0) { + reply_markup.serializeToStream(stream); + } + if ((flags & 128) != 0) { + Vector.serialize(stream, entities); + } + if ((flags & 1024) != 0) { + stream.writeInt32(views); + } + if ((flags & 32768) != 0) { + stream.writeInt32(edit_date); + } + if ((flags & 65536) != 0) { + stream.writeString(post_author); + } + if ((flags & 131072) != 0) { + stream.writeInt64(grouped_id); + } + if ((flags & 1048576) != 0) { + reactions.serializeToStream(stream); } - url = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = fullsize ? flags | 2 : flags &~ 2; - flags = fullscreen ? flags | 4 : flags &~ 4; - stream.writeInt32(flags); - if ((flags & 1) != 0) { - stream.writeInt64(query_id); + if ((flags & 4194304) != 0) { + stream.writeString(""); } - stream.writeString(url); + writeAttachPath(stream); } } - public static class TL_messages_requestWebView extends TLObject { - public static final int constructor = 0x269dc2c1; - - public int flags; - public boolean from_bot_menu; - public boolean silent; - public boolean compact; - public boolean fullscreen; - public InputPeer peer; - public InputUser bot; - public String url; - public String start_param; - public TL_dataJSON theme_params; - public String platform; - public InputReplyTo reply_to; - public InputPeer send_as; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_webViewResultUrl.TLdeserialize(stream, constructor, exception); - } + public static class TL_message_layer104 extends TL_message { + public static final int constructor = 0x44f9b43d; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = from_bot_menu ? (flags | 16) : (flags &~ 16); - flags = silent ? (flags | 32) : (flags &~ 32); - flags = compact ? (flags | 128) : (flags &~ 128); - flags = fullscreen ? (flags | 256) : (flags &~ 256); - stream.writeInt32(flags); - peer.serializeToStream(stream); - bot.serializeToStream(stream); - if ((flags & 2) != 0) { - stream.writeString(url); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + silent = (flags & 8192) != 0; + post = (flags & 16384) != 0; + from_scheduled = (flags & 262144) != 0; + legacy = (flags & 524288) != 0; + id = stream.readInt32(exception); + if ((flags & 256) != 0) { + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); + } + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 4) != 0) { + fwd_from = MessageFwdHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 2048) != 0) { + via_bot_id = stream.readInt32(exception); } if ((flags & 8) != 0) { - stream.writeString(start_param); + reply_to = new TLRPC.TL_messageReplyHeader(); + reply_to.flags |= 16; + reply_to.reply_to_msg_id = stream.readInt32(exception); } - if ((flags & 4) != 0) { - theme_params.serializeToStream(stream); + date = stream.readInt32(exception); + message = stream.readString(exception); + if ((flags & 512) != 0) { + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null) { + ttl = media.ttl_seconds; //custom + } + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } } - stream.writeString(platform); - if ((flags & 1) != 0) { - reply_to.serializeToStream(stream); + if ((flags & 64) != 0) { + reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); } - if ((flags & 8192) != 0) { - send_as.serializeToStream(stream); + if ((flags & 128) != 0) { + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } - } - } - - public static class TL_messages_requestMainWebView extends TLObject { - public static final int constructor = 0xc9e01e7b; - - public int flags; - public boolean compact; - public boolean fullscreen; - public InputPeer peer; - public InputUser bot; - public String start_param; - public TL_dataJSON theme_params; - public String platform; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_webViewResultUrl.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = compact ? (flags | 128) : (flags &~ 128); - flags = fullscreen ? (flags | 256) : (flags &~ 256); - stream.writeInt32(flags); - peer.serializeToStream(stream); - bot.serializeToStream(stream); - if ((flags & 2) != 0) { - stream.writeString(start_param); + if ((flags & 1024) != 0) { + views = stream.readInt32(exception); } - if ((flags & 1) != 0) { - theme_params.serializeToStream(stream); + if ((flags & 32768) != 0) { + edit_date = stream.readInt32(exception); } - stream.writeString(platform); - } - } - - public static class TL_messages_prolongWebView extends TLObject { - public static final int constructor = 0xb0d81a83; - - public int flags; - public boolean silent; - public InputPeer peer; - public InputUser bot; - public long query_id; - public InputReplyTo reply_to; - public InputPeer send_as; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = silent ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - peer.serializeToStream(stream); - bot.serializeToStream(stream); - stream.writeInt64(query_id); - if ((flags & 1) != 0) { - reply_to.serializeToStream(stream); + if ((flags & 65536) != 0) { + post_author = stream.readString(exception); } - if ((flags & 8192) != 0) { - send_as.serializeToStream(stream); + if ((flags & 131072) != 0) { + grouped_id = stream.readInt64(exception); } } - } - - public static class TL_messages_getBotApp extends TLObject { - public static final int constructor = 0x34fdc5c3; - - public InputBotApp app; - public long hash; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_botApp.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - app.serializeToStream(stream); - stream.writeInt64(hash); - } - } - - public static class TL_messages_requestAppWebView extends TLObject { - public static final int constructor = 0x53618bce; - - public int flags; - public boolean write_allowed; - public boolean compact; - public boolean fullscreen; - public InputPeer peer; - public InputBotApp app; - public String start_param; - public TL_dataJSON theme_params; - public String platform; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_webViewResultUrl.TLdeserialize(stream, constructor, exception); - } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = write_allowed ? (flags | 1) : (flags &~ 1); - flags = compact ? (flags | 128) : (flags &~ 128); - flags = fullscreen ? (flags | 256) : (flags &~ 256); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); + flags = from_scheduled ? (flags | 262144) : (flags &~ 262144); + flags = legacy ? (flags | 524288) : (flags &~ 524288); stream.writeInt32(flags); - peer.serializeToStream(stream); - app.serializeToStream(stream); - if ((flags & 2) != 0) { - stream.writeString(start_param); + stream.writeInt32(id); + if ((flags & 256) != 0) { + stream.writeInt32((int) from_id.user_id); } + peer_id.serializeToStream(stream); if ((flags & 4) != 0) { - theme_params.serializeToStream(stream); + fwd_from.serializeToStream(stream); + } + if ((flags & 2048) != 0) { + stream.writeInt32((int) via_bot_id); } - stream.writeString(platform); - } - } - - public static class TL_messages_requestSimpleWebView extends TLObject { - public static final int constructor = 0x413a3e73; - - public int flags; - public boolean from_switch_webview; - public boolean from_side_menu; - public boolean compact; - public boolean fullscreen; - public InputUser bot; - public String url; - public String start_param; - public TL_dataJSON theme_params; - public String platform; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_webViewResultUrl.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = from_switch_webview ? (flags | 2) : (flags &~ 2); - flags = from_side_menu ? (flags | 4) : (flags &~ 4); - flags = compact ? (flags | 128) : (flags &~ 128); - flags = fullscreen ? (flags | 256) : (flags &~ 256); - stream.writeInt32(flags); - bot.serializeToStream(stream); if ((flags & 8) != 0) { - stream.writeString(url); + stream.writeInt32(reply_to.reply_to_msg_id); } - if ((flags & 16) != 0) { - stream.writeString(start_param); + stream.writeInt32(date); + stream.writeString(message); + if ((flags & 512) != 0) { + media.serializeToStream(stream); } - if ((flags & 1) != 0) { - theme_params.serializeToStream(stream); + if ((flags & 64) != 0) { + reply_markup.serializeToStream(stream); } - stream.writeString(platform); - } - } - - public static class TL_messages_sendWebViewResultMessage extends TLObject { - public static final int constructor = 0xddcf50eb; - - public long query_id; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_webViewMessageSent.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(query_id); - } - } - - public static class TL_messages_setWebViewResult extends TLObject { - public static final int constructor = 0xe41cd11d; - - public long query_id; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(query_id); - } - } - - public static class TL_messages_getWebViewResult extends TLObject { - public static final int constructor = 0x22b6c214; - - public InputPeer peer; - public InputUser bot; - public long query_id; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_webViewResult.TLdeserialize(stream, constructor, exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - bot.serializeToStream(stream); - stream.writeInt64(query_id); - } - } - - public static class TL_attachMenuBotsBot extends TLObject { - public static final int constructor = 0x93bf667f; - - public TL_attachMenuBot bot; - public ArrayList users = new ArrayList<>(); - - public static TL_attachMenuBotsBot TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_attachMenuBotsBot.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_attachMenuBotsBot", constructor)); - } else { - return null; - } + if ((flags & 128) != 0) { + Vector.serialize(stream, entities); } - TL_attachMenuBotsBot result = new TL_attachMenuBotsBot(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - bot = TL_attachMenuBot.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + if ((flags & 1024) != 0) { + stream.writeInt32(views); } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); + if ((flags & 32768) != 0) { + stream.writeInt32(edit_date); } - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - bot.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); + if ((flags & 65536) != 0) { + stream.writeString(post_author); } - } - } - - public static class TL_simpleWebViewResultUrl extends TLObject { - public static final int constructor = 0x882f76bb; - - public String url; - - public static TL_simpleWebViewResultUrl TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_simpleWebViewResultUrl.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_simpleWebViewResultUrl", constructor)); - } else { - return null; - } + if ((flags & 131072) != 0) { + stream.writeInt64(grouped_id); } - TL_simpleWebViewResultUrl result = new TL_simpleWebViewResultUrl(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - url = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(url); + writeAttachPath(stream); } } - public static class TL_webViewMessageSent extends TLObject { - public static final int constructor = 0xc94511c; - - public int flags; - public TL_inputBotInlineMessageID msg_id; + public static class TL_message_old6 extends TL_message { + public static final int constructor = 0x2bebfa86; - public static TL_webViewMessageSent TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_webViewMessageSent.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_webViewMessageSent", constructor)); - } else { - return null; + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID; + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + id = stream.readInt32(exception); + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 4) != 0) { + fwd_from = new TL_messageFwdHeader(); + fwd_from.from_id = new TLRPC.TL_peerUser(); + fwd_from.from_id.user_id = stream.readInt32(exception); + fwd_from.flags |= 1; + fwd_from.date = stream.readInt32(exception); + } + if ((flags & 8) != 0) { + reply_to = new TLRPC.TL_messageReplyHeader(); + reply_to.flags |= 16; + reply_to.reply_to_msg_id = stream.readInt32(exception); + } + date = stream.readInt32(exception); + message = stream.readString(exception); + if ((flags & 512) != 0) { + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; } + } else { + media = new TL_messageMediaEmpty(); } - TL_webViewMessageSent result = new TL_webViewMessageSent(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - if ((flags & 1) != 0) { - msg_id = TL_inputBotInlineMessageID.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 64) != 0) { + reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 128) != 0) { + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); stream.writeInt32(flags); - if ((flags & 1) != 0) { - msg_id.serializeToStream(stream); + stream.writeInt32(id); + stream.writeInt32((int) from_id.user_id); + peer_id.serializeToStream(stream); + if ((flags & 4) != 0) { + stream.writeInt32((int) fwd_from.from_id.user_id); + stream.writeInt32(fwd_from.date); } + if ((flags & 8) != 0) { + stream.writeInt32(reply_to.reply_to_msg_id); + } + stream.writeInt32(date); + stream.writeString(message); + if ((flags & 512) != 0) { + media.serializeToStream(stream); + } + if ((flags & 64) != 0) { + reply_markup.serializeToStream(stream); + } + if ((flags & 128) != 0) { + Vector.serialize(stream, entities); + } + writeAttachPath(stream); } } - public static class TL_updateWebViewResultSent extends Update { - public static final int constructor = 0x1592b79d; - - public long query_id; - - public void readParams(AbstractSerializedData stream, boolean exception) { - query_id = stream.readInt64(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(query_id); - } - } - - public static class TL_keyboardButtonSimpleWebView extends KeyboardButton { - public static final int constructor = 0xa0c0505c; + public static class TL_message_old5 extends TL_message { + public static final int constructor = 0xf07814c8; - public void readParams(AbstractSerializedData stream, boolean exception) { - text = stream.readString(exception); - url = stream.readString(exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + id = stream.readInt32(exception); + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 4) != 0) { + fwd_from = new TL_messageFwdHeader(); + fwd_from.from_id = new TLRPC.TL_peerUser(); + fwd_from.from_id.user_id = stream.readInt32(exception); + fwd_from.flags |= 1; + fwd_from.date = stream.readInt32(exception); + } + if ((flags & 8) != 0) { + reply_to = new TLRPC.TL_messageReplyHeader(); + reply_to.flags |= 16; + reply_to.reply_to_msg_id = stream.readInt32(exception); + } + date = stream.readInt32(exception); + message = stream.readString(exception); + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } + if ((flags & 64) != 0) { + reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 128) != 0) { + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(text); - stream.writeString(url); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + stream.writeInt32(id); + stream.writeInt32((int) from_id.user_id); + peer_id.serializeToStream(stream); + if ((flags & 4) != 0) { + stream.writeInt32((int) fwd_from.from_id.user_id); + stream.writeInt32(fwd_from.date); + } + if ((flags & 8) != 0) { + stream.writeInt32(reply_to.reply_to_msg_id); + } + stream.writeInt32(date); + stream.writeString(message); + media.serializeToStream(stream); + if ((flags & 64) != 0) { + reply_markup.serializeToStream(stream); + } + if ((flags & 128) != 0) { + Vector.serialize(stream, entities); + } + writeAttachPath(stream); } } - public static class TL_messages_getAttachMenuBot extends TLObject { - public static final int constructor = 0x77216192; - - public InputUser bot; + public static class TL_messageService_layer48 extends TL_messageService { + public static final int constructor = 0xc06b9607; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_attachMenuBotsBot.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + silent = (flags & 8192) != 0; + post = (flags & 16384) != 0; + id = stream.readInt32(exception); + if ((flags & 256) != 0) { + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); + } + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if (from_id == null) { + from_id = peer_id; + } + date = stream.readInt32(exception); + action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - bot.serializeToStream(stream); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); + stream.writeInt32(flags); + stream.writeInt32(id); + if ((flags & 256) != 0) { + stream.writeInt32((int) from_id.user_id); + } + peer_id.serializeToStream(stream); + stream.writeInt32(date); + action.serializeToStream(stream); } } - public static abstract class account_SavedRingtones extends TLObject { + public static class TL_message_old4 extends TL_message { + public static final int constructor = 0xc3060325; - public static account_SavedRingtones TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - account_SavedRingtones result = null; - switch (constructor) { - case 0xfbf6e8b1: - result = new TL_account_savedRingtonesNotModified(); - break; - case 0xc1e92cc5: - result = new TL_account_savedRingtones(); - break; + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + id = stream.readInt32(exception); + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 4) != 0) { + fwd_from = new TL_messageFwdHeader(); + fwd_from.from_id = new TLRPC.TL_peerUser(); + fwd_from.from_id.user_id = stream.readInt32(exception); + fwd_from.flags |= 1; + fwd_from.date = stream.readInt32(exception); } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in account_SavedRingtones", constructor)); + if ((flags & 8) != 0) { + reply_to = new TLRPC.TL_messageReplyHeader(); + reply_to.flags |= 16; + reply_to.reply_to_msg_id = stream.readInt32(exception); } - if (result != null) { - result.readParams(stream, exception); + date = stream.readInt32(exception); + message = stream.readString(exception); + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } + if ((flags & 64) != 0) { + reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception); } - return result; } - } - - public static class TL_account_savedRingtonesNotModified extends account_SavedRingtones { - public static final int constructor = 0xfbf6e8b1; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + stream.writeInt32(id); + stream.writeInt32((int) from_id.user_id); + peer_id.serializeToStream(stream); + if ((flags & 4) != 0) { + stream.writeInt32((int) fwd_from.from_id.user_id); + stream.writeInt32(fwd_from.date); + } + if ((flags & 8) != 0) { + stream.writeInt32(reply_to.reply_to_msg_id); + } + stream.writeInt32(date); + stream.writeString(message); + media.serializeToStream(stream); + if ((flags & 64) != 0) { + reply_markup.serializeToStream(stream); + } + writeAttachPath(stream); } } - public static class TL_account_savedRingtones extends account_SavedRingtones { - public static final int constructor = 0xc1e92cc5; - - public long hash; - public ArrayList ringtones = new ArrayList<>(); + public static class TL_message_old3 extends TL_message { + public static final int constructor = 0xa7ab1991; - public void readParams(AbstractSerializedData stream, boolean exception) { - hash = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + id = stream.readInt32(exception); + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 4) != 0) { + fwd_from = new TL_messageFwdHeader(); + fwd_from.from_id = new TLRPC.TL_peerUser(); + fwd_from.from_id.user_id = stream.readInt32(exception); + fwd_from.flags |= 1; + fwd_from.date = stream.readInt32(exception); } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - ringtones.add(object); + if ((flags & 8) != 0) { + reply_to = new TLRPC.TL_messageReplyHeader(); + reply_to.flags |= 16; + reply_to.reply_to_msg_id = stream.readInt32(exception); + } + date = stream.readInt32(exception); + message = stream.readString(exception); + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(hash); - stream.writeInt32(0x1cb5c415); - int count = ringtones.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - ringtones.get(a).serializeToStream(stream); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + stream.writeInt32(id); + stream.writeInt32((int) from_id.user_id); + peer_id.serializeToStream(stream); + if ((flags & 4) != 0) { + stream.writeInt32((int) fwd_from.from_id.user_id); + stream.writeInt32(fwd_from.date); + } + if ((flags & 8) != 0) { + stream.writeInt32(reply_to.reply_to_msg_id); } + stream.writeInt32(date); + stream.writeString(message); + media.serializeToStream(stream); + writeAttachPath(stream); } } - public static class TL_account_uploadRingtone extends TLObject { - public static final int constructor = 0x831a83a2; - - public InputFile file; - public String file_name; - public String mime_type; + public static class TL_message_old2 extends TL_message { + public static final int constructor = 0x567699b3; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Document.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + id = stream.readInt32(exception); + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + date = stream.readInt32(exception); + message = stream.readString(exception); + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - file.serializeToStream(stream); - stream.writeString(file_name); - stream.writeString(mime_type); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + stream.writeInt32(id); + stream.writeInt32((int) from_id.user_id); + peer_id.serializeToStream(stream); + stream.writeInt32(date); + stream.writeString(message); + media.serializeToStream(stream); + writeAttachPath(stream); } } - public static class TL_account_getSavedRingtones extends TLObject { - public static final int constructor = 0xe1902288; - - public long hash; + public static class TL_messageService_old extends TL_messageService { + public static final int constructor = 0x9f8d60bb; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return account_SavedRingtones.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + out = stream.readBool(exception); + unread = stream.readBool(exception); + flags |= MESSAGE_FLAG_HAS_FROM_ID; + date = stream.readInt32(exception); + action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(hash); + stream.writeInt32(id); + stream.writeInt32((int) from_id.user_id); + peer_id.serializeToStream(stream); + stream.writeBool(out); + stream.writeBool(unread); + stream.writeInt32(date); + action.serializeToStream(stream); } } - public static class TL_account_saveRingtone extends TLObject { - public static final int constructor = 0x3dea5b03; - - public InputDocument id; - public boolean unsave; + public static class TL_messageForwarded_old extends TL_messageForwarded_old2 { + public static final int constructor = 0x5f46804; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return account_SavedRingtone.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + fwd_from = new TL_messageFwdHeader(); + fwd_from.from_id = new TLRPC.TL_peerUser(); + fwd_from.from_id.user_id = stream.readInt32(exception); + fwd_from.flags |= 1; + fwd_from.date = stream.readInt32(exception); + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + out = stream.readBool(exception); + unread = stream.readBool(exception); + flags |= MESSAGE_FLAG_FWD | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; + date = stream.readInt32(exception); + message = stream.readString(exception); + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - id.serializeToStream(stream); - stream.writeBool(unsave); + stream.writeInt32(id); + stream.writeInt32((int) fwd_from.from_id.user_id); + stream.writeInt32(fwd_from.date); + stream.writeInt32((int) from_id.user_id); + peer_id.serializeToStream(stream); + stream.writeBool(out); + stream.writeBool(unread); + stream.writeInt32(date); + stream.writeString(message); + media.serializeToStream(stream); + writeAttachPath(stream); } } - public static class TL_attachMenuBotIconColor extends TLObject { - public static final int constructor = 0x4576f3f0; - - public String name; - public int color; + public static class TL_message_old extends TL_message { + public static final int constructor = 0x22eb6aba; - public static TL_attachMenuBotIconColor TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_attachMenuBotIconColor.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_attachMenuBotIconColor", constructor)); - } else { - return null; - } + public void readParams(InputSerializedData stream, boolean exception) { + id = stream.readInt32(exception); + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + out = stream.readBool(exception); + unread = stream.readBool(exception); + flags |= MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; + date = stream.readInt32(exception); + message = stream.readString(exception); + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; } - TL_attachMenuBotIconColor result = new TL_attachMenuBotIconColor(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - name = stream.readString(exception); - color = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(name); - stream.writeInt32(color); + stream.writeInt32(id); + stream.writeInt32((int) from_id.user_id); + peer_id.serializeToStream(stream); + stream.writeBool(out); + stream.writeBool(unread); + stream.writeInt32(date); + stream.writeString(message); + media.serializeToStream(stream); + writeAttachPath(stream); } } - public static class TL_attachMenuBotIcon extends TLObject { - public static final int constructor = 0xb2a7386b; - - public int flags; - public String name; - public Document icon; - public ArrayList colors = new ArrayList<>(); - - public static TL_attachMenuBotIcon TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_attachMenuBotIcon.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_attachMenuBotIcon", constructor)); - } else { - return null; - } - } - TL_attachMenuBotIcon result = new TL_attachMenuBotIcon(); - result.readParams(stream, exception); - return result; - } + public static class TL_message_secret extends TL_message { + public static final int constructor = 0x555555fa; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - name = stream.readString(exception); - icon = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_attachMenuBotIconColor object = TL_attachMenuBotIconColor.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - colors.add(object); - } + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + id = stream.readInt32(exception); + ttl = stream.readInt32(exception); + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + date = stream.readInt32(exception); + message = stream.readString(exception); + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); + if ((flags & 2048) != 0) { + via_bot_name = stream.readString(exception); + } + if ((flags & 8) != 0) { + reply_to = new TL_messageReplyHeader(); + reply_to.reply_to_random_id = stream.readInt64(exception); + } + if ((flags & 131072) != 0) { + grouped_id = stream.readInt64(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); stream.writeInt32(flags); - stream.writeString(name); - icon.serializeToStream(stream); - if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = colors.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - colors.get(a).serializeToStream(stream); - } + stream.writeInt32(id); + stream.writeInt32(ttl); + stream.writeInt32((int) from_id.user_id); + peer_id.serializeToStream(stream); + stream.writeInt32(date); + stream.writeString(message); + media.serializeToStream(stream); + Vector.serialize(stream, entities); + if ((flags & 2048) != 0) { + stream.writeString(via_bot_name); + } + if ((flags & 8) != 0) { + stream.writeInt64(reply_to.reply_to_random_id); + } + if ((flags & 131072) != 0) { + stream.writeInt64(grouped_id); } + writeAttachPath(stream); } } - public static abstract class InputBotApp extends TLObject { + public static class TL_message_secret_layer72 extends TL_message { + public static final int constructor = 0x555555f9; - public static InputBotApp TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - InputBotApp result = null; - switch (constructor) { - case 0xa920bd7a: - result = new TL_inputBotAppID(); - break; - case 0x908c0407: - result = new TL_inputBotAppShortName(); - break; + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + id = stream.readInt32(exception); + ttl = stream.readInt32(exception); + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + date = stream.readInt32(exception); + message = stream.readString(exception); + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in InputBotApp", constructor)); + entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); + if ((flags & 2048) != 0) { + via_bot_name = stream.readString(exception); } - if (result != null) { - result.readParams(stream, exception); + if ((flags & 8) != 0) { + reply_to = new TL_messageReplyHeader(); + reply_to.reply_to_random_id = stream.readInt64(exception); } - return result; - } - } - - public static class TL_inputBotAppID extends InputBotApp { - public static final int constructor = 0xa920bd7a; - - public long id; - public long access_hash; - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - } - } - - public static class TL_inputBotAppShortName extends InputBotApp { - public static final int constructor = 0x908c0407; - - public InputUser bot_id; - public String short_name; - - public void readParams(AbstractSerializedData stream, boolean exception) { - bot_id = InputUser.TLdeserialize(stream, stream.readInt32(exception), exception); - short_name = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - bot_id.serializeToStream(stream); - stream.writeString(short_name); - } - } - - public static abstract class BotApp extends TLObject { - public int flags; - public long id; - public long access_hash; - public String short_name; - public String title; - public String description; - public Photo photo; - public Document document; - public long hash; - - public static BotApp TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - BotApp result = null; - switch (constructor) { - case 0x5da674b7: - result = new TL_botAppNotModified(); - break; - case 0x95fcd1d6: - result = new TL_botApp(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in BotApp", constructor)); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + stream.writeInt32(id); + stream.writeInt32(ttl); + stream.writeInt32((int) from_id.user_id); + peer_id.serializeToStream(stream); + stream.writeInt32(date); + stream.writeString(message); + media.serializeToStream(stream); + Vector.serialize(stream, entities); + if ((flags & 2048) != 0) { + stream.writeString(via_bot_name); } - if (result != null) { - result.readParams(stream, exception); + if ((flags & 8) != 0) { + stream.writeInt64(reply_to.reply_to_random_id); } - return result; + writeAttachPath(stream); } } - public static class TL_botAppNotModified extends BotApp { - public static final int constructor = 0x5da674b7; - + public static class TL_message_secret_old extends TL_message_secret { + public static final int constructor = 0x555555F8; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception) | MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA; + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + id = stream.readInt32(exception); + ttl = stream.readInt32(exception); + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + date = stream.readInt32(exception); + message = stream.readString(exception); + media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + if (media != null && !TextUtils.isEmpty(media.captionLegacy)) { + message = media.captionLegacy; + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + stream.writeInt32(id); + stream.writeInt32(ttl); + stream.writeInt32((int) from_id.user_id); + peer_id.serializeToStream(stream); + stream.writeInt32(date); + stream.writeString(message); + media.serializeToStream(stream); + writeAttachPath(stream); } } - public static class TL_botApp extends BotApp { - public static final int constructor = 0x95fcd1d6; - + public static class TL_messageService_layer123 extends TL_messageService { + public static final int constructor = 0x286fa604; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - short_name = stream.readString(exception); - title = stream.readString(exception); - description = stream.readString(exception); - photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 1) != 0) { - document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + silent = (flags & 8192) != 0; + post = (flags & 16384) != 0; + legacy = (flags & 524288) != 0; + id = stream.readInt32(exception); + if ((flags & 256) != 0) { + from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); } - hash = stream.readInt64(exception); + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 8) != 0) { + reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + } + date = stream.readInt32(exception); + action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); + flags = legacy ? (flags | 524288) : (flags &~ 524288); stream.writeInt32(flags); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeString(short_name); - stream.writeString(title); - stream.writeString(description); - photo.serializeToStream(stream); - if ((flags & 1) != 0) { - document.serializeToStream(stream); + stream.writeInt32(id); + if ((flags & 256) != 0) { + from_id.serializeToStream(stream); } - stream.writeInt64(hash); + peer_id.serializeToStream(stream); + if ((flags & 8) != 0) { + reply_to.serializeToStream(stream); + } + stream.writeInt32(date); + action.serializeToStream(stream); + writeAttachPath(stream); } } - public static class TL_messages_botApp extends TLObject { - public static final int constructor = 0xeb50adf5; - - public int flags; - public boolean inactive; - public boolean request_write_access; - public BotApp app; - - public static TL_messages_botApp TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_botApp.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_botApp", constructor)); - } else { - return null; - } - } - TL_messages_botApp result = new TL_messages_botApp(); - result.readParams(stream, exception); - return result; - } + public static class TL_messageService extends Message { + public static final int constructor = 0xd3d28540; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - inactive = (flags & 1) != 0; - request_write_access = (flags & 2) != 0; - app = BotApp.TLdeserialize(stream, stream.readInt32(exception), exception); + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + silent = (flags & 8192) != 0; + post = (flags & 16384) != 0; + legacy = (flags & 524288) != 0; + reactions_are_possible = (flags & 512) != 0; + id = stream.readInt32(exception); + if ((flags & 256) != 0) { + from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 8) != 0) { + reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + } + date = stream.readInt32(exception); + action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 1048576) != 0) { + reactions = TL_messageReactions.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 33554432) != 0) { + ttl_period = stream.readInt32(exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = inactive ? (flags | 1) : (flags &~ 1); - flags = request_write_access ? (flags | 2) : (flags &~ 2); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); + flags = legacy ? (flags | 524288) : (flags &~ 524288); + flags = reactions_are_possible ? (flags | 512) : (flags &~ 512); stream.writeInt32(flags); - app.serializeToStream(stream); + stream.writeInt32(id); + if ((flags & 256) != 0) { + from_id.serializeToStream(stream); + } + peer_id.serializeToStream(stream); + if ((flags & 8) != 0) { + reply_to.serializeToStream(stream); + } + stream.writeInt32(date); + action.serializeToStream(stream); + if ((flags & 1048576) != 0) { + reactions.serializeToStream(stream); + } + if ((flags & 33554432) != 0) { + stream.writeInt32(ttl_period); + } } } - public static class TL_appWebViewResultUrl extends TLObject { - public static final int constructor = 0x3c1b4f0d; - - public String url; + public static class TL_messageService_layer195 extends TL_messageService { + public static final int constructor = 0x2b085862; - public static TL_appWebViewResultUrl TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_appWebViewResultUrl.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_appWebViewResultUrl", constructor)); - } else { - return null; - } + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + silent = (flags & 8192) != 0; + post = (flags & 16384) != 0; + legacy = (flags & 524288) != 0; + id = stream.readInt32(exception); + if ((flags & 256) != 0) { + from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 8) != 0) { + reply_to = MessageReplyHeader.TLdeserialize(stream, stream.readInt32(exception), exception); + } + date = stream.readInt32(exception); + action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 33554432) != 0) { + ttl_period = stream.readInt32(exception); } - TL_appWebViewResultUrl result = new TL_appWebViewResultUrl(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - url = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(url); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); + flags = legacy ? (flags | 524288) : (flags &~ 524288); + stream.writeInt32(flags); + stream.writeInt32(id); + if ((flags & 256) != 0) { + from_id.serializeToStream(stream); + } + peer_id.serializeToStream(stream); + if ((flags & 8) != 0) { + reply_to.serializeToStream(stream); + } + stream.writeInt32(date); + action.serializeToStream(stream); + if ((flags & 33554432) != 0) { + stream.writeInt32(ttl_period); + } } } - public static class TL_inlineBotWebView extends TLObject { - public static final int constructor = 0xb57295d5; - - public String text; - public String url; + public static class TL_messageService_layer118 extends TL_messageService { + public static final int constructor = 0x9e19a1f6; - public static TL_inlineBotWebView TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_inlineBotWebView.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_inlineBotWebView", constructor)); - } else { - return null; - } + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + unread = (flags & 1) != 0; + out = (flags & 2) != 0; + mentioned = (flags & 16) != 0; + media_unread = (flags & 32) != 0; + silent = (flags & 8192) != 0; + post = (flags & 16384) != 0; + legacy = (flags & 524288) != 0; + id = stream.readInt32(exception); + if ((flags & 256) != 0) { + from_id = new TLRPC.TL_peerUser(); + from_id.user_id = stream.readInt32(exception); } - TL_inlineBotWebView result = new TL_inlineBotWebView(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - text = stream.readString(exception); - url = stream.readString(exception); + peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 8) != 0) { + reply_to = new TLRPC.TL_messageReplyHeader(); + reply_to.flags |= 16; + reply_to.reply_to_msg_id = stream.readInt32(exception); + } + date = stream.readInt32(exception); + action = MessageAction.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(text); - stream.writeString(url); + flags = unread ? (flags | 1) : (flags &~ 1); + flags = out ? (flags | 2) : (flags &~ 2); + flags = mentioned ? (flags | 16) : (flags &~ 16); + flags = media_unread ? (flags | 32) : (flags &~ 32); + flags = silent ? (flags | 8192) : (flags &~ 8192); + flags = post ? (flags | 16384) : (flags &~ 16384); + flags = legacy ? (flags | 524288) : (flags &~ 524288); + stream.writeInt32(flags); + stream.writeInt32(id); + if ((flags & 256) != 0) { + stream.writeInt32((int) from_id.user_id); + } + peer_id.serializeToStream(stream); + if ((flags & 8) != 0) { + stream.writeInt32(reply_to.reply_to_msg_id); + } + stream.writeInt32(date); + action.serializeToStream(stream); + writeAttachPath(stream); } } + //Message end + + //TL_dialog start + public static abstract class Dialog extends TLObject { - public static abstract class account_SavedRingtone extends TLObject { + public int flags; + public boolean pinned; + public boolean unread_mark; + public boolean view_forum_as_messages; + public Peer peer; + public int top_message; + public int read_inbox_max_id; + public int read_outbox_max_id; + public int unread_count; + public int unread_mentions_count; + public int unread_reactions_count; + public PeerNotifySettings notify_settings; + public int pts; + public DraftMessage draft; + public int folder_id; + public int ttl_period; + public int last_message_date; //custom + public long id; //custom + public int pinnedNum; //custom + public boolean isFolder; //custom - public static account_SavedRingtone TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - account_SavedRingtone result = null; + public static Dialog TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + Dialog result = null; switch (constructor) { - case 0x1f307eb7: - result = new TL_account_savedRingtoneConverted(); + case 0xd58a08c6: + result = new TL_dialog(); + break; + case 0xa8edd0f5: + result = new TL_dialog_layer149(); break; - case 0xb7263f6d: - result = new TL_account_savedRingtone(); + case 0x71bd134c: + result = new TL_dialogFolder(); + result.isFolder = true; break; } if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in account_SavedRingtone", constructor)); + throw new RuntimeException(String.format("can't parse magic %x in Dialog", constructor)); } if (result != null) { result.readParams(stream, exception); @@ -76534,465 +61685,479 @@ public static account_SavedRingtone TLdeserialize(AbstractSerializedData stream, } } - public static class TL_account_savedRingtoneConverted extends account_SavedRingtone { - public static final int constructor = 0x1f307eb7; - - public Document document; - - public void readParams(AbstractSerializedData stream, boolean exception) { - document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - document.serializeToStream(stream); - } - } - - public static class TL_account_savedRingtone extends account_SavedRingtone { - public static final int constructor = 0xb7263f6d; - - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } - - public static class TL_channels_toggleJoinToSend extends TLObject { - public static final int constructor = 0xe4cb9580; - - public InputChannel channel; - public boolean enabled; + public static class TL_dialog extends Dialog { + public static final int constructor = 0xd58a08c6; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + pinned = (flags & 4) != 0; + unread_mark = (flags & 8) != 0; + view_forum_as_messages = (flags & 64) != 0; + peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + top_message = stream.readInt32(exception); + read_inbox_max_id = stream.readInt32(exception); + read_outbox_max_id = stream.readInt32(exception); + unread_count = stream.readInt32(exception); + unread_mentions_count = stream.readInt32(exception); + unread_reactions_count = stream.readInt32(exception); + notify_settings = TL_peerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 1) != 0) { + pts = stream.readInt32(exception); + } + if ((flags & 2) != 0) { + draft = DraftMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 16) != 0) { + folder_id = stream.readInt32(exception); + } + if ((flags & 32) != 0) { + ttl_period = stream.readInt32(exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeBool(enabled); + flags = pinned ? (flags | 4) : (flags &~ 4); + flags = unread_mark ? (flags | 8) : (flags &~ 8); + flags = view_forum_as_messages ? (flags | 64) : (flags &~ 64); + stream.writeInt32(flags); + peer.serializeToStream(stream); + stream.writeInt32(top_message); + stream.writeInt32(read_inbox_max_id); + stream.writeInt32(read_outbox_max_id); + stream.writeInt32(unread_count); + stream.writeInt32(unread_mentions_count); + stream.writeInt32(unread_reactions_count); + notify_settings.serializeToStream(stream); + if ((flags & 1) != 0) { + stream.writeInt32(pts); + } + if ((flags & 2) != 0) { + draft.serializeToStream(stream); + } + if ((flags & 16) != 0) { + stream.writeInt32(folder_id); + } + if ((flags & 32) != 0) { + stream.writeInt32(ttl_period); + } } } - public static class TL_channels_toggleJoinRequest extends TLObject { - public static final int constructor = 0x4c2985b6; - - public InputChannel channel; - public boolean enabled; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } + public static class TL_dialog_layer149 extends TL_dialog { + public static final int constructor = 0xa8edd0f5; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeBool(enabled); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + pinned = (flags & 4) != 0; + unread_mark = (flags & 8) != 0; + peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + top_message = stream.readInt32(exception); + read_inbox_max_id = stream.readInt32(exception); + read_outbox_max_id = stream.readInt32(exception); + unread_count = stream.readInt32(exception); + unread_mentions_count = stream.readInt32(exception); + unread_reactions_count = stream.readInt32(exception); + notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 1) != 0) { + pts = stream.readInt32(exception); + } + if ((flags & 2) != 0) { + draft = DraftMessage.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 16) != 0) { + folder_id = stream.readInt32(exception); + } + if ((flags & 32) != 0) { + ttl_period = stream.readInt32(exception); + } } - } - public static class TL_chatInvitePublicJoinRequests extends TL_chatInviteExported { - public static final int constructor = 0xed107ab7; - - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - + flags = pinned ? (flags | 4) : (flags &~ 4); + flags = unread_mark ? (flags | 8) : (flags &~ 8); + stream.writeInt32(flags); + peer.serializeToStream(stream); + stream.writeInt32(top_message); + stream.writeInt32(read_inbox_max_id); + stream.writeInt32(read_outbox_max_id); + stream.writeInt32(unread_count); + stream.writeInt32(unread_mentions_count); + stream.writeInt32(unread_reactions_count); + notify_settings.serializeToStream(stream); + if ((flags & 1) != 0) { + stream.writeInt32(pts); + } + if ((flags & 2) != 0) { + draft.serializeToStream(stream); + } + if ((flags & 16) != 0) { + stream.writeInt32(folder_id); + } + if ((flags & 32) != 0) { + stream.writeInt32(ttl_period); + } } } - public static class TL_phone_saveCallLog extends TLObject { - public static final int constructor = 0x41248786; + public static class TL_dialogFolder extends Dialog { + public static final int constructor = 0x71bd134c; - public TL_inputPhoneCall peer; - public InputFile file; + public TL_folder folder; + public int unread_muted_peers_count; + public int unread_unmuted_peers_count; + public int unread_muted_messages_count; + public int unread_unmuted_messages_count; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + pinned = (flags & 4) != 0; + folder = TL_folder.TLdeserialize(stream, stream.readInt32(exception), exception); + peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + top_message = stream.readInt32(exception); + unread_muted_peers_count = stream.readInt32(exception); + unread_unmuted_peers_count = stream.readInt32(exception); + unread_muted_messages_count = stream.readInt32(exception); + unread_unmuted_messages_count = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = pinned ? (flags | 4) : (flags &~ 4); + stream.writeInt32(flags); + folder.serializeToStream(stream); peer.serializeToStream(stream); - file.serializeToStream(stream); + stream.writeInt32(top_message); + stream.writeInt32(unread_muted_peers_count); + stream.writeInt32(unread_unmuted_peers_count); + stream.writeInt32(unread_muted_messages_count); + stream.writeInt32(unread_unmuted_messages_count); } } + //TL_dialog end - public static abstract class AttachMenuPeerType extends TLObject { + //ChatParticipant start + public static class TL_chatChannelParticipant extends ChatParticipant { + public static final int constructor = 0xc8d7493e; - public static AttachMenuPeerType TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - AttachMenuPeerType result = null; - switch (constructor) { - case 0xc32bfa1a: - result = new TL_attachMenuPeerTypeBotPM(); - break; - case 0xf146d31f: - result = new TL_attachMenuPeerTypePM(); - break; - case 0x7bfbdefc: - result = new TL_attachMenuPeerTypeBroadcast(); - break; - case 0x509113f: - result = new TL_attachMenuPeerTypeChat(); - break; - case 0x7d6be90e: - result = new TL_attachMenuPeerTypeSameBotPM(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in AttachMenuPeerType", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } + public ChannelParticipant channelParticipant; } + //ChatParticipant end - public static class TL_attachMenuPeerTypeBotPM extends AttachMenuPeerType { - public static final int constructor = 0xc32bfa1a; + //Chat start + public static class TL_chatEmpty extends Chat { + public static final int constructor = 0x29562865; + + public void readParams(InputSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + title = "DELETED"; + } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + stream.writeInt64(id); } } - public static class TL_attachMenuPeerTypePM extends AttachMenuPeerType { - public static final int constructor = 0xf146d31f; + public static class TL_chatEmpty_layer131 extends TL_chatEmpty { + public static final int constructor = 0x9ba2d800; + public void readParams(InputSerializedData stream, boolean exception) { + id = stream.readInt32(exception); - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + title = "DELETED"; } - } - - public static class TL_attachMenuPeerTypeBroadcast extends AttachMenuPeerType { - public static final int constructor = 0x7bfbdefc; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + stream.writeInt32((int) id); } } + //Chat end - public static class TL_attachMenuPeerTypeChat extends AttachMenuPeerType { - public static final int constructor = 0x509113f; + //functions memory optimize + public static class TL_upload_saveFilePart extends TLObject { + public static final int constructor = 0xb304a621; + public long file_id; + public int file_part; + public NativeByteBuffer bytes; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - } - - public static class TL_attachMenuPeerTypeSameBotPM extends AttachMenuPeerType { - public static final int constructor = 0x7d6be90e; - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + stream.writeInt64(file_id); + stream.writeInt32(file_part); + stream.writeByteBuffer(bytes); } - } - - public static abstract class InputInvoice extends TLObject { - public static InputInvoice TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - InputInvoice result = null; - switch (constructor) { - case TL_inputInvoicePremiumGiftCode.constructor: - result = new TL_inputInvoicePremiumGiftCode(); - break; - case TL_inputInvoiceMessage.constructor: - result = new TL_inputInvoiceMessage(); - break; - case TL_inputInvoiceSlug.constructor: - result = new TL_inputInvoiceSlug(); - break; - case TL_inputInvoiceStars.constructor: - result = new TL_inputInvoiceStars(); - break; - case TL_inputInvoiceChatInviteSubscription.constructor: - result = new TL_inputInvoiceChatInviteSubscription(); - break; - case TL_inputInvoiceStarGift.constructor: - result = new TL_inputInvoiceStarGift(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in InputInvoice", constructor)); + @Override + public void freeResources() { + if (disableFree) { + return; } - if (result != null) { - result.readParams(stream, exception); + if (bytes != null) { + bytes.reuse(); + bytes = null; } - return result; } } - public static class TL_inputInvoiceMessage extends InputInvoice { - public static final int constructor = 0xc5b56859; + public static class TL_messages_getStickers extends TLObject { + public static final int constructor = 0xd5a5d3a1; - public InputPeer peer; - public int msg_id; + public String emoticon; + public long hash; - public void readParams(AbstractSerializedData stream, boolean exception) { - peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - msg_id = stream.readInt32(exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_Stickers.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(msg_id); + stream.writeString(emoticon); + stream.writeInt64(hash); } } - public static class TL_inputInvoiceSlug extends InputInvoice { - public static final int constructor = 0xc326caef; + public static class TL_messages_getAllStickers extends TLObject { + public static final int constructor = 0xb8a0a1a8; - public String slug; + public long hash; - public void readParams(AbstractSerializedData stream, boolean exception) { - slug = stream.readString(exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_AllStickers.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(slug); + stream.writeInt64(hash); } } - public static class TL_payments_exportedInvoice extends TLObject { - public static final int constructor = 0xaed0cbd9; + public static class TL_upload_saveBigFilePart extends TLObject { + public static final int constructor = 0xde7b673d; - public String url; + public long file_id; + public int file_part; + public int file_total_parts; + public NativeByteBuffer bytes; - public static TL_payments_exportedInvoice TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_payments_exportedInvoice.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_payments_exportedInvoice", constructor)); - } else { - return null; - } - } - TL_payments_exportedInvoice result = new TL_payments_exportedInvoice(); - result.readParams(stream, exception); - return result; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void readParams(AbstractSerializedData stream, boolean exception) { - url = stream.readString(exception); + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(file_id); + stream.writeInt32(file_part); + stream.writeInt32(file_total_parts); + stream.writeByteBuffer(bytes); } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeString(url); + @Override + public void freeResources() { + if (disableFree) { + return; + } + if (bytes != null) { + bytes.reuse(); + bytes = null; + } } } - public static class TL_payments_exportInvoice extends TLObject { - public static final int constructor = 0xf91b065; + public static class TL_upload_getWebFile extends TLObject { + public static final int constructor = 0x24e6818d; - public InputMedia invoice_media; + public InputWebFileLocation location; + public int offset; + public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_payments_exportedInvoice.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_upload_webFile.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - invoice_media.serializeToStream(stream); + location.serializeToStream(stream); + stream.writeInt32(offset); + stream.writeInt32(limit); } } - public static class TL_messages_transcribeAudio extends TLObject { - public static final int constructor = 0x269e9a49; + public static class TL_upload_getCdnFile extends TLObject { + public static final int constructor = 0x395f69da; - public InputPeer peer; - public int msg_id; + public byte[] file_token; + public long offset; + public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_transcribedAudio.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return upload_CdnFile.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(msg_id); + stream.writeByteArray(file_token); + stream.writeInt64(offset); + stream.writeInt32(limit); } } - public static class TL_messages_rateTranscribedAudio extends TLObject { - public static final int constructor = 0x7f1d072f; + public static class TL_upload_reuploadCdnFile extends TLObject { + public static final int constructor = 0x9b2754a8; - public InputPeer peer; - public int msg_id; - public long transcription_id; - public boolean good; + public byte[] file_token; + public byte[] request_token; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, TL_fileHash::TLdeserialize); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(msg_id); - stream.writeInt64(transcription_id); - stream.writeBool(good); + stream.writeByteArray(file_token); + stream.writeByteArray(request_token); } } - public static class TL_messages_transcribedAudio extends TLObject { - public static final int constructor = 0xcfb9d957; - - public int flags; - public boolean pending; - public long transcription_id; - public String text; - public int trial_remains_num; - public int trial_remains_until_date; + public static class TL_upload_getCdnFileHashes extends TLObject { + public static final int constructor = 0x91dc3f31; - public static TL_messages_transcribedAudio TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_transcribedAudio.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_transcribedAudio", constructor)); - } else { - return null; - } - } - TL_messages_transcribedAudio result = new TL_messages_transcribedAudio(); - result.readParams(stream, exception); - return result; - } + public byte[] file_token; + public long offset; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - pending = (flags & 1) != 0; - transcription_id = stream.readInt64(exception); - text = stream.readString(exception); - if ((flags & 2) != 0) { - trial_remains_num = stream.readInt32(exception); - trial_remains_until_date = stream.readInt32(exception); - } + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, TL_fileHash::TLdeserialize); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = pending ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeInt64(transcription_id); - stream.writeString(text); - if ((flags & 2) != 0) { - stream.writeInt32(trial_remains_num); - stream.writeInt32(trial_remains_until_date); - } + stream.writeByteArray(file_token); + stream.writeInt64(offset); } } - public static class TL_payments_canPurchasePremium extends TLObject { - public static final int constructor = 0x9fc19eb6; + public static class TL_upload_getFileHashes extends TLObject { + public static final int constructor = 0xc7025931; - public InputStorePaymentPurpose purpose; + public InputFileLocation location; + public int offset; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, TL_fileHash::TLdeserialize); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - purpose.serializeToStream(stream); + location.serializeToStream(stream); + stream.writeInt32(offset); } } - public static class TL_payments_requestRecurringPayment extends TLObject { - public static final int constructor = 0x146e958d; + public static class TL_upload_webFile extends TLObject { + public static final int constructor = 0x21e753bc; - public InputUser user_id; - public String recurring_init_charge; - public InputMedia invoice_media; + public int size; + public String mime_type; + public storage_FileType file_type; + public int mtime; + public NativeByteBuffer bytes; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public static TL_upload_webFile TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_upload_webFile.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_upload_webFile", constructor)); + } else { + return null; + } + } + TL_upload_webFile result = new TL_upload_webFile(); + result.readParams(stream, exception); + return result; } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - user_id.serializeToStream(stream); - stream.writeString(recurring_init_charge); - invoice_media.serializeToStream(stream); + public void readParams(InputSerializedData stream, boolean exception) { + size = stream.readInt32(exception); + mime_type = stream.readString(exception); + file_type = storage_FileType.TLdeserialize(stream, stream.readInt32(exception), exception); + mtime = stream.readInt32(exception); + bytes = stream.readByteBuffer(exception); } - } - - public static class TL_messageEntityCustomEmoji extends MessageEntity { - public static final int constructor = 0xc8cf05f8; - - public long document_id; - public TLRPC.Document document; //custom - public void readParams(AbstractSerializedData stream, boolean exception) { - offset = stream.readInt32(exception); - length = stream.readInt32(exception); - document_id = stream.readInt64(exception); + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(size); + stream.writeString(mime_type); + file_type.serializeToStream(stream); + stream.writeInt32(mtime); + stream.writeByteBuffer(bytes); } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(offset); - stream.writeInt32(length); - stream.writeInt64(document_id); + @Override + public void freeResources() { + if (disableFree) { + return; + } + if (bytes != null) { + bytes.reuse(); + bytes = null; + } } } - public static class TL_messages_getCustomEmojiDocuments extends TLObject { - public static final int constructor = 0xd9ab0f54; - - public ArrayList document_id = new ArrayList<>(); + public static abstract class upload_File extends TLObject { + public storage_FileType type; + public int mtime; + public NativeByteBuffer bytes; + public int dc_id; + public byte[] file_token; + public byte[] encryption_key; + public byte[] encryption_iv; + public ArrayList file_hashes = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); + public static upload_File TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + upload_File result = null; + switch (constructor) { + case 0x96a18d5: + result = new TL_upload_file(); + break; + case 0xf18cda44: + result = new TL_upload_fileCdnRedirect(); + break; } - return vector; - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = document_id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(document_id.get(a)); + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in upload_File", constructor)); + } + if (result != null) { + result.readParams(stream, exception); } + return result; } } - public static abstract class ChatReactions extends TLObject { + public static abstract class upload_CdnFile extends TLObject { + public NativeByteBuffer bytes; + public byte[] request_token; - public static ChatReactions TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - ChatReactions result = null; + public static upload_CdnFile TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + upload_CdnFile result = null; switch (constructor) { - case 0x661d4037: - result = new TL_chatReactionsSome(); - break; - case 0xeafc32bc: - result = new TL_chatReactionsNone(); + case 0xa99fca4f: + result = new TL_upload_cdnFile(); break; - case 0x52928bca: - result = new TL_chatReactionsAll(); + case 0xeea8e46e: + result = new TL_upload_cdnFileReuploadNeeded(); break; } if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in ChatReactions", constructor)); + throw new RuntimeException(String.format("can't parse magic %x in upload_CdnFile", constructor)); } if (result != null) { result.readParams(stream, exception); @@ -77001,235 +62166,353 @@ public static ChatReactions TLdeserialize(AbstractSerializedData stream, int con } } - public static class TL_chatReactionsSome extends ChatReactions { - public static final int constructor = 0x661d4037; + public static class TL_upload_cdnFile extends upload_CdnFile { + public static final int constructor = 0xa99fca4f; - public ArrayList reactions = new ArrayList<>(); + public void readParams(InputSerializedData stream, boolean exception) { + bytes = stream.readByteBuffer(exception); + } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteBuffer(bytes); + } + + @Override + public void freeResources() { + if (disableFree) { return; } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Reaction object = Reaction.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - reactions.add(object); + if (bytes != null) { + bytes.reuse(); + bytes = null; } } + } + + public static class TL_upload_cdnFileReuploadNeeded extends upload_CdnFile { + public static final int constructor = 0xeea8e46e; - public void serializeToStream(AbstractSerializedData stream) { + public void readParams(InputSerializedData stream, boolean exception) { + request_token = stream.readByteArray(exception); + } + + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = reactions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - reactions.get(a).serializeToStream(stream); + stream.writeByteArray(request_token); + } + } + + public static class TL_upload_file extends upload_File { + public static final int constructor = 0x96a18d5; + + public void readParams(InputSerializedData stream, boolean exception) { + type = storage_FileType.TLdeserialize(stream, stream.readInt32(exception), exception); + mtime = stream.readInt32(exception); + bytes = stream.readByteBuffer(exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + type.serializeToStream(stream); + stream.writeInt32(mtime); + stream.writeByteBuffer(bytes); + } + + @Override + public void freeResources() { + if (disableFree) { + return; + } + if (bytes != null) { + bytes.reuse(); + bytes = null; } } } - public static class TL_chatReactionsNone extends ChatReactions { - public static final int constructor = 0xeafc32bc; + public static class TL_upload_fileCdnRedirect extends upload_File { + public static final int constructor = 0xf18cda44; + public void readParams(InputSerializedData stream, boolean exception) { + dc_id = stream.readInt32(exception); + file_token = stream.readByteArray(exception); + encryption_key = stream.readByteArray(exception); + encryption_iv = stream.readByteArray(exception); + file_hashes = Vector.deserialize(stream, TL_fileHash::TLdeserialize, exception); + } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + stream.writeInt32(dc_id); + stream.writeByteArray(file_token); + stream.writeByteArray(encryption_key); + stream.writeByteArray(encryption_iv); + Vector.serialize(stream, file_hashes); } } - public static class TL_chatReactionsAll extends ChatReactions { - public static final int constructor = 0x52928bca; + public static class TL_messages_sendEncryptedFile extends TLObject { + public static final int constructor = 0x5559481d; public int flags; - public boolean allow_custom; + public boolean silent; + public TL_inputEncryptedChat peer; + public long random_id; + public NativeByteBuffer data; + public InputEncryptedFile file; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - allow_custom = (flags & 1) != 0; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_SentEncryptedMessage.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = allow_custom ? (flags | 1) : (flags &~ 1); + flags = silent ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); + peer.serializeToStream(stream); + stream.writeInt64(random_id); + stream.writeByteBuffer(data); + file.serializeToStream(stream); + } + + @Override + public void freeResources() { + if (data != null) { + data.reuse(); + data = null; + } } } - public static class TL_messages_reportReaction extends TLObject { - public static final int constructor = 0x61422a48; + public static class TL_messages_sendEncryptedMultiMedia extends TLObject { + public static final int constructor = 0xcacacaca; - public InputPeer peer; - public int id; - public InputUser user_id; + public ArrayList messages = new ArrayList<>(); + public ArrayList files = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_SentEncryptedMessage.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(id); - user_id.serializeToStream(stream); + public void serializeToStream(OutputSerializedData stream) { + + } + + @Override + public void freeResources() { + } } - public static class TL_messages_clearRecentReactions extends TLObject { - public static final int constructor = 0x9dfeefb4; + public static class TL_messages_sendEncrypted extends TLObject { + public static final int constructor = 0x44fa7a15; + public int flags; + public boolean silent; + public TL_inputEncryptedChat peer; + public long random_id; + public NativeByteBuffer data; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_SentEncryptedMessage.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = silent ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + peer.serializeToStream(stream); + stream.writeInt64(random_id); + stream.writeByteBuffer(data); } - } - - public static abstract class messages_Reactions extends TLObject { - public static messages_Reactions TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - messages_Reactions result = null; - switch (constructor) { - case 0xb06fdbdf: - result = new TL_messages_reactionsNotModified(); - break; - case 0xeafdf716: - result = new TL_messages_reactions(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in messages_Reactions", constructor)); - } - if (result != null) { - result.readParams(stream, exception); + @Override + public void freeResources() { + if (data != null) { + data.reuse(); + data = null; } - return result; } } - public static class TL_messages_reactionsNotModified extends messages_Reactions { - public static final int constructor = 0xb06fdbdf; + public static class TL_messages_sendEncryptedService extends TLObject { + public static final int constructor = 0x32d439a4; + + public TL_inputEncryptedChat peer; + public long random_id; + public NativeByteBuffer data; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_SentEncryptedMessage.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeInt64(random_id); + stream.writeByteBuffer(data); + } + + @Override + public void freeResources() { + if (data != null) { + data.reuse(); + data = null; + } } } - public static class TL_messages_reactions extends messages_Reactions { - public static final int constructor = 0xeafdf716; + public static class TL_messages_getSearchResultsPositions extends TLObject { + public static final int constructor = 0x9c7f2f10; - public long hash; - public ArrayList reactions = new ArrayList<>(); + public int flags; + public InputPeer peer; + public InputPeer saved_peer_id; + public MessagesFilter filter; + public int offset_id; + public int limit; - public void readParams(AbstractSerializedData stream, boolean exception) { - hash = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Reaction object = Reaction.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - reactions.add(object); - } + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_searchResultsPositions.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(hash); - stream.writeInt32(0x1cb5c415); - int count = reactions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - reactions.get(a).serializeToStream(stream); + stream.writeInt32(flags); + peer.serializeToStream(stream); + if ((flags & 4) != 0) { + saved_peer_id.serializeToStream(stream); } + filter.serializeToStream(stream); + stream.writeInt32(offset_id); + stream.writeInt32(limit); } } - public static class TL_messages_getTopReactions extends TLObject { - public static final int constructor = 0xbb8125ba; + public static class TL_attachMenuBot_layer140 extends TL_attachMenuBot { + public static final int constructor = 0xe93cb772; - public int limit; - public long hash; + public static TL_attachMenuBot TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_attachMenuBot.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_attachMenuBot", constructor)); + } else { + return null; + } + } + TL_attachMenuBot result = new TL_attachMenuBot(); + result.readParams(stream, exception); + return result; + } - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_Reactions.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + inactive = (flags & 1) != 0; + bot_id = stream.readInt64(exception); + short_name = stream.readString(exception); + icons = Vector.deserialize(stream, TL_attachMenuBotIcon::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(limit); - stream.writeInt64(hash); + flags = inactive ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeInt64(bot_id); + stream.writeString(short_name); + Vector.serialize(stream, icons); } } - public static class TL_messages_getRecentReactions extends TLObject { - public static final int constructor = 0x39461db2; - - public int limit; - public long hash; + public static class TL_attachMenuBot_layer162 extends TL_attachMenuBot { + public static final int constructor = 0xc8aa2cd2; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_Reactions.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + inactive = (flags & 1) != 0; + has_settings = (flags & 2) != 0; + request_write_access = (flags & 4) != 0; + bot_id = stream.readInt64(exception); + short_name = stream.readString(exception); + peer_types = Vector.deserialize(stream, AttachMenuPeerType::TLdeserialize, exception); + icons = Vector.deserialize(stream, TL_attachMenuBotIcon::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(limit); - stream.writeInt64(hash); + flags = inactive ? (flags | 1) : (flags &~ 1); + flags = has_settings ? (flags | 2) : (flags &~ 2); + flags = request_write_access ? (flags | 4) : (flags &~ 4); + stream.writeInt32(flags); + stream.writeInt64(bot_id); + stream.writeString(short_name); + Vector.serialize(stream, peer_types); + Vector.serialize(stream, icons); } } - public static class TL_messages_getDefaultTagReactions extends TLObject { - public static final int constructor = 0xbdf93428; + public static class TL_attachMenuBot extends AttachMenuBot { + public static final int constructor = 0xd90d8dfe; - public long hash; + public int flags; + public boolean inactive; + public boolean has_settings; + public boolean request_write_access; + public boolean show_in_attach_menu; + public boolean show_in_side_menu; + public boolean side_menu_disclaimer_needed; + public long bot_id; + public String short_name; + public ArrayList peer_types = new ArrayList<>(); + public ArrayList icons = new ArrayList<>(); - @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_Reactions.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + inactive = (flags & 1) != 0; + has_settings = (flags & 2) != 0; + request_write_access = (flags & 4) != 0; + show_in_attach_menu = (flags & 8) != 0; + show_in_side_menu = (flags & 16) != 0; + side_menu_disclaimer_needed = (flags & 32) != 0; + bot_id = stream.readInt64(exception); + short_name = stream.readString(exception); + peer_types = Vector.deserialize(stream, AttachMenuPeerType::TLdeserialize, exception); + icons = Vector.deserialize(stream, TL_attachMenuBotIcon::TLdeserialize, exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(hash); + flags = inactive ? (flags | 1) : (flags &~ 1); + flags = has_settings ? (flags | 2) : (flags &~ 2); + flags = request_write_access ? (flags | 4) : (flags &~ 4); + flags = show_in_attach_menu ? (flags | 8) : (flags &~ 8); + flags = show_in_side_menu ? (flags | 16) : (flags &~ 16); + flags = side_menu_disclaimer_needed ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + stream.writeInt64(bot_id); + stream.writeString(short_name); + Vector.serialize(stream, peer_types); + Vector.serialize(stream, icons); } } - public static abstract class ForumTopic extends TLObject { + public static abstract class AttachMenuBot extends TLObject { - public static ForumTopic TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - ForumTopic result = null; + public static TL_attachMenuBot TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + TL_attachMenuBot result = null; switch (constructor) { - case 0x23f109b: - result = new TL_forumTopicDeleted(); + case 0xd90d8dfe: + result = new TL_attachMenuBot(); break; - case 0x5920d6dc: - result = new TL_forumTopic_layer147(); + case 0xc8aa2cd2: + result = new TL_attachMenuBot_layer162(); break; - case 0x71701da9: - result = new TL_forumTopic(); + case 0xe93cb772: + result = new TL_attachMenuBot_layer140(); break; } if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in ForumTopic", constructor)); + throw new RuntimeException(String.format("can't parse magic %x in AttachMenuBot", constructor)); } if (result != null) { result.readParams(stream, exception); @@ -77238,980 +62521,937 @@ public static ForumTopic TLdeserialize(AbstractSerializedData stream, int constr } } - public static class TL_forumTopicDeleted extends TL_forumTopic { - public static final int constructor = 0x23f109b; - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - } - } - - public static class TL_forumTopic_layer147 extends TL_forumTopic { - public static final int constructor = 0x5920d6dc; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - my = (flags & 2) != 0; - closed = (flags & 4) != 0; - pinned = (flags & 8) != 0; - id = stream.readInt32(exception); - date = stream.readInt32(exception); - title = stream.readString(exception); - icon_color = stream.readInt32(exception); - if ((flags & 1) != 0) { - icon_emoji_id = stream.readInt64(exception); - } - top_message = stream.readInt32(exception); - read_inbox_max_id = stream.readInt32(exception); - read_outbox_max_id = stream.readInt32(exception); - unread_count = stream.readInt32(exception); - unread_mentions_count = stream.readInt32(exception); - unread_reactions_count = stream.readInt32(exception); - from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = my ? (flags | 2) : (flags &~ 2); - flags = closed ? (flags | 4) : (flags &~ 4); - flags = pinned ? (flags | 8) : (flags &~ 8); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeInt32(date); - stream.writeString(title); - stream.writeInt32(icon_color); - if ((flags & 1) != 0) { - stream.writeInt64(icon_emoji_id); - } - stream.writeInt32(top_message); - stream.writeInt32(read_inbox_max_id); - stream.writeInt32(read_outbox_max_id); - stream.writeInt32(unread_count); - stream.writeInt32(unread_mentions_count); - stream.writeInt32(unread_reactions_count); - from_id.serializeToStream(stream); - notify_settings.serializeToStream(stream); - } - } - - public static class TL_forumTopic extends ForumTopic { - public static final int constructor = 0x71701da9; - - public int flags; - public boolean my; - public boolean closed; - public boolean pinned; - public boolean isShort; - public boolean hidden; - public int id; - public int date; - public String title; - public int icon_color; - public long icon_emoji_id; - public int top_message; - public int read_inbox_max_id; - public int read_outbox_max_id; - public int unread_count; - public int unread_mentions_count; - public int unread_reactions_count; - public Peer from_id; - public PeerNotifySettings notify_settings; - public DraftMessage draft; - public Message topicStartMessage; // custom - public ArrayList groupedMessages; // custom - public Message topMessage; // custom - public String searchQuery; //custom - public int pinnedOrder; // custom - public int totalMessagesCount; // custom + public static abstract class AttachMenuBots extends TLObject { - public static TL_forumTopic TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - TL_forumTopic result = null; + public static AttachMenuBots TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + AttachMenuBots result = null; switch (constructor) { - case 0x23f109b: - result = new TL_forumTopicDeleted(); - break; - case 0x5920d6dc: - result = new TL_forumTopic_layer147(); + case 0xf1d88a5c: + result = new TL_attachMenuBotsNotModified(); break; - case 0x71701da9: - result = new TL_forumTopic(); + case 0x3c4301c0: + result = new TL_attachMenuBots(); break; } if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_forumTopic", constructor)); + throw new RuntimeException(String.format("can't parse magic %x in AttachMenuBots", constructor)); } if (result != null) { result.readParams(stream, exception); } return result; } + } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - my = (flags & 2) != 0; - closed = (flags & 4) != 0; - pinned = (flags & 8) != 0; - isShort = (flags & 32) != 0; - hidden = (flags & 64) != 0; - id = stream.readInt32(exception); - date = stream.readInt32(exception); - title = stream.readString(exception); - icon_color = stream.readInt32(exception); - if ((flags & 1) != 0) { - icon_emoji_id = stream.readInt64(exception); - } - top_message = stream.readInt32(exception); - read_inbox_max_id = stream.readInt32(exception); - read_outbox_max_id = stream.readInt32(exception); - unread_count = stream.readInt32(exception); - unread_mentions_count = stream.readInt32(exception); - unread_reactions_count = stream.readInt32(exception); - from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 16) != 0) { - draft = DraftMessage.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public static class TL_attachMenuBotsNotModified extends AttachMenuBots { + public static final int constructor = 0xf1d88a5c; + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_attachMenuBots extends AttachMenuBots { + public static final int constructor = 0x3c4301c0; + + public long hash; + public ArrayList bots = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + + public void readParams(InputSerializedData stream, boolean exception) { + hash = stream.readInt64(exception); + bots = Vector.deserialize(stream, TL_attachMenuBot::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = my ? (flags | 2) : (flags &~ 2); - flags = closed ? (flags | 4) : (flags &~ 4); - flags = pinned ? (flags | 8) : (flags &~ 8); - flags = isShort ? (flags | 32) : (flags &~ 32); - flags = hidden ? (flags | 64) : (flags &~ 64); - stream.writeInt32(flags); - stream.writeInt32(id); - stream.writeInt32(date); - stream.writeString(title); - stream.writeInt32(icon_color); - if ((flags & 1) != 0) { - stream.writeInt64(icon_emoji_id); - } - stream.writeInt32(top_message); - stream.writeInt32(read_inbox_max_id); - stream.writeInt32(read_outbox_max_id); - stream.writeInt32(unread_count); - stream.writeInt32(unread_mentions_count); - stream.writeInt32(unread_reactions_count); - from_id.serializeToStream(stream); - notify_settings.serializeToStream(stream); - if ((flags & 16) != 0) { - draft.serializeToStream(stream); - } + stream.writeInt64(hash); + Vector.serialize(stream, bots); + Vector.serialize(stream, users); } } - public static class TL_messages_forumTopics extends TLObject { - public static final int constructor = 0x367617d3; + public static class TL_updateAttachMenuBots extends Update { + public static final int constructor = 0x17b7a20b; - public int flags; - public boolean order_by_create_date; - public int count; - public ArrayList topics = new ArrayList<>(); - public ArrayList messages = new ArrayList<>(); - public ArrayList chats = new ArrayList<>(); + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_messages_webViewResult extends TLObject { + public static final int constructor = 0xaadf159b; + + public BotInlineResult result; public ArrayList users = new ArrayList<>(); - public int pts; - public static TL_messages_forumTopics TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_forumTopics.constructor != constructor) { + public static TL_messages_webViewResult TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_messages_webViewResult.constructor != constructor) { if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_forumTopics", constructor)); + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_webViewResult", constructor)); } else { return null; } } - TL_messages_forumTopics result = new TL_messages_forumTopics(); + TL_messages_webViewResult result = new TL_messages_webViewResult(); result.readParams(stream, exception); return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - order_by_create_date = (flags & 1) != 0; - count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_forumTopic object = TL_forumTopic.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - topics.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Message object = Message.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - messages.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - pts = stream.readInt32(exception); + public void readParams(InputSerializedData stream, boolean exception) { + result = BotInlineResult.TLdeserialize(stream, stream.readInt32(exception), exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = order_by_create_date ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = topics.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - topics.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = messages.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - messages.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } - stream.writeInt32(pts); + result.serializeToStream(stream); + Vector.serialize(stream, users); } } - public static class TL_channels_toggleForum extends TLObject { - public static final int constructor = 0xa4298b29; - - public InputChannel channel; - public boolean enabled; + public static class TL_keyboardButtonWebView extends KeyboardButton { + public static final int constructor = 0x13767230; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + text = stream.readString(exception); + url = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeBool(enabled); + stream.writeString(text); + stream.writeString(url); } } - public static class TL_channels_createForumTopic extends TLObject { - public static final int constructor = 0xf40c0224; + public static class RequestPeerType extends TLObject { public int flags; - public InputChannel channel; - public String title; - public int icon_color; - public long icon_emoji_id; - public long random_id; - public InputPeer send_as; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } + public Boolean creator; + public TL_chatAdminRights user_admin_rights; + public TL_chatAdminRights bot_admin_rights; + public Boolean has_username; + public Boolean forum; + public Boolean bot_participant; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - channel.serializeToStream(stream); - stream.writeString(title); - if ((flags & 1) != 0) { - stream.writeInt32(icon_color); + public static RequestPeerType TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + RequestPeerType result = null; + switch (constructor) { + case TL_requestPeerTypeUser.constructor: + result = new TL_requestPeerTypeUser(); + break; + case TL_requestPeerTypeChat.constructor: + result = new TL_requestPeerTypeChat(); + break; + case TL_requestPeerTypeBroadcast.constructor: + result = new TL_requestPeerTypeBroadcast(); + break; } - if ((flags & 8) != 0) { - stream.writeInt64(icon_emoji_id); + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in RequestPeerType", constructor)); } - stream.writeInt64(random_id); - if ((flags & 4) != 0) { - send_as.serializeToStream(stream); + if (result != null) { + result.readParams(stream, exception); } + return result; } } - public static class TL_channels_editForumTopic extends TLObject { - public static final int constructor = 0xf4dfa185; - - public int flags; - public InputChannel channel; - public int topic_id; - public String title; - public long icon_emoji_id; - public boolean closed; - public boolean hidden; - - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } + public static class TL_requestPeerTypeUser extends RequestPeerType { + public static final int constructor = 0x5f3b8a00; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(flags); - channel.serializeToStream(stream); - stream.writeInt32(topic_id); + public Boolean bot; + public Boolean premium; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); if ((flags & 1) != 0) { - stream.writeString(title); + bot = stream.readBool(exception); } if ((flags & 2) != 0) { - stream.writeInt64(icon_emoji_id); + premium = stream.readBool(exception); } - if ((flags & 4) != 0) { - stream.writeBool(closed); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = bot != null ? (flags | 1) : (flags &~ 1); + flags = premium != null ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + if (bot != null) { + stream.writeBool(bot); } - if ((flags & 8) != 0) { - stream.writeBool(hidden); + if (premium != null) { + stream.writeBool(premium); } } } - public static class TL_channels_updatePinnedForumTopic extends TLObject { - public static final int constructor = 0x6c2d9026; - - public InputChannel channel; - public int topic_id; - public boolean pinned; + public static class TL_requestPeerTypeChat extends RequestPeerType { + public static final int constructor = 0xc9f06e1b; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + bot_participant = (flags & 32) != 0; + creator = (flags & 1) != 0; + if ((flags & 8) != 0) { + has_username = stream.readBool(exception); + } + if ((flags & 16) != 0) { + forum = stream.readBool(exception); + } + if ((flags & 2) != 0) { + user_admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4) != 0) { + bot_admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeInt32(topic_id); - stream.writeBool(pinned); + flags = creator != null && creator ? (flags | 1) : (flags &~ 1); + flags = user_admin_rights != null ? (flags | 2) : (flags &~ 2); + flags = bot_admin_rights != null ? (flags | 4) : (flags &~ 4); + flags = has_username != null ? (flags | 8) : (flags &~ 8); + flags = forum != null ? (flags | 16) : (flags &~ 16); + flags = bot_participant != null && bot_participant ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + if (has_username != null) { + stream.writeBool(has_username); + } + if (forum != null) { + stream.writeBool(forum); + } + if (user_admin_rights != null) { + user_admin_rights.serializeToStream(stream); + } + if (bot_admin_rights != null) { + bot_admin_rights.serializeToStream(stream); + } } } - public static class TL_channels_getForumTopics extends TLObject { - public static final int constructor = 0xde560d1; - - public int flags; - public InputChannel channel; - public String q; - public int offset_date; - public int offset_id; - public int offset_topic; - public int limit; + public static class TL_requestPeerTypeBroadcast extends RequestPeerType { + public static final int constructor = 0x339bef6c; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_forumTopics.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + creator = (flags & 1) != 0; + if ((flags & 8) != 0) { + has_username = stream.readBool(exception); + } + if ((flags & 2) != 0) { + user_admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4) != 0) { + bot_admin_rights = TL_chatAdminRights.TLdeserialize(stream, stream.readInt32(exception), exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = creator != null && creator ? (flags | 1) : (flags &~ 1); + flags = user_admin_rights != null ? (flags | 2) : (flags &~ 2); + flags = bot_admin_rights != null ? (flags | 4) : (flags &~ 4); + flags = has_username != null ? (flags | 8) : (flags &~ 8); stream.writeInt32(flags); - channel.serializeToStream(stream); - if ((flags & 1) != 0) { - stream.writeString(q); + if (has_username != null) { + stream.writeBool(has_username); + } + if (user_admin_rights != null) { + user_admin_rights.serializeToStream(stream); + } + if (bot_admin_rights != null) { + bot_admin_rights.serializeToStream(stream); } - stream.writeInt32(offset_date); - stream.writeInt32(offset_id); - stream.writeInt32(offset_topic); - stream.writeInt32(limit); } } - public static class TL_channels_getForumTopicsByID extends TLObject { - public static final int constructor = 0xb0831eb9; - - public InputChannel channel; - public ArrayList topics = new ArrayList<>(); + public static class TL_keyboardButtonRequestPeer_layer168 extends TL_keyboardButtonRequestPeer { + public static final int constructor = 0xd0b468c; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_forumTopics.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + text = stream.readString(exception); + button_id = stream.readInt32(exception); + peer_type = RequestPeerType.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = topics.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(topics.get(a)); - } + stream.writeString(text); + stream.writeInt32(button_id); + peer_type.serializeToStream(stream); } } - public static class TL_username extends TLObject { - public static final int constructor = 0xb4073647; - - public int flags; - public boolean editable; - public boolean active; - public String username; + public static class TL_keyboardButtonRequestPeer extends KeyboardButton { + public static final int constructor = 0x53d7bfd8; - public static TL_username TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_username.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_username", constructor)); - } else { - return null; - } - } - TL_username result = new TL_username(); - result.readParams(stream, exception); - return result; - } + public RequestPeerType peer_type; + public int max_quantity; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - editable = (flags & 1) != 0; - active = (flags & 2) != 0; - username = stream.readString(exception); + public void readParams(InputSerializedData stream, boolean exception) { + text = stream.readString(exception); + button_id = stream.readInt32(exception); + peer_type = RequestPeerType.TLdeserialize(stream, stream.readInt32(exception), exception); + max_quantity = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = editable ? (flags | 1) : (flags &~ 1); - flags = active ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - stream.writeString(username); + stream.writeString(text); + stream.writeInt32(button_id); + peer_type.serializeToStream(stream); + stream.writeInt32(max_quantity); } } - public static class TL_channels_deleteTopicHistory extends TLObject { - public static final int constructor = 0x34435f2d; - public InputChannel channel; - public int top_msg_id; + public static class TL_keyboardButtonCopy extends KeyboardButton { + public static final int constructor = 0x75d2698e; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_messages_affectedHistory.TLdeserialize(stream, constructor, exception); + public String copy_text; + + public void readParams(InputSerializedData stream, boolean exception) { + text = stream.readString(exception); + copy_text = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeInt32(top_msg_id); + stream.writeString(text); + stream.writeString(copy_text); } } - public static class TL_channels_setEmojiStickers extends TLObject { - public static final int constructor = 0x3cd930b7; + public static class TL_messages_getAttachMenuBots extends TLObject { + public static final int constructor = 0x16fcc2cb; - public InputChannel channel; - public InputStickerSet stickerset; + public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return AttachMenuBots.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - stickerset.serializeToStream(stream); + stream.writeInt64(hash); } } - public static class TL_channels_setBoostsToUnblockRestrictions extends TLObject { - public static final int constructor = 0xad399cee; + public static class TL_messages_toggleBotInAttachMenu extends TLObject { + public static final int constructor = 0x69f59d69; - public InputChannel channel; - public int boosts; + public int flags; + public boolean write_allowed; + public InputUser bot; + public boolean enabled; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeInt32(boosts); + flags = write_allowed ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + bot.serializeToStream(stream); + stream.writeBool(enabled); } } - public static class TL_account_reorderUsernames extends TLObject { - public static final int constructor = 0xef500eab; + public static class TL_webViewResultUrl extends TLObject { + public static final int constructor = 0x4d22ff98; - public ArrayList order = new ArrayList<>(); + public int flags; + public boolean fullsize; + public boolean fullscreen; + public long query_id; + public String url; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public static TL_webViewResultUrl TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_webViewResultUrl.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_webViewResultUrl", constructor)); + } else { + return null; + } + } + TL_webViewResultUrl result = new TL_webViewResultUrl(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + fullsize = (flags & 2) != 0; + fullscreen = (flags & 4) != 0; + if ((flags & 1) != 0) { + query_id = stream.readInt64(exception); + } + url = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = order.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(order.get(a)); + flags = fullsize ? flags | 2 : flags &~ 2; + flags = fullscreen ? flags | 4 : flags &~ 4; + stream.writeInt32(flags); + if ((flags & 1) != 0) { + stream.writeInt64(query_id); } + stream.writeString(url); } } - public static class TL_account_toggleUsername extends TLObject { - public static final int constructor = 0x58d6b376; + public static class TL_messages_requestWebView extends TLObject { + public static final int constructor = 0x269dc2c1; - public String username; - public boolean active; + public int flags; + public boolean from_bot_menu; + public boolean silent; + public boolean compact; + public boolean fullscreen; + public InputPeer peer; + public InputUser bot; + public String url; + public String start_param; + public TL_dataJSON theme_params; + public String platform; + public InputReplyTo reply_to; + public InputPeer send_as; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_webViewResultUrl.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(username); - stream.writeBool(active); + flags = from_bot_menu ? (flags | 16) : (flags &~ 16); + flags = silent ? (flags | 32) : (flags &~ 32); + flags = compact ? (flags | 128) : (flags &~ 128); + flags = fullscreen ? (flags | 256) : (flags &~ 256); + stream.writeInt32(flags); + peer.serializeToStream(stream); + bot.serializeToStream(stream); + if ((flags & 2) != 0) { + stream.writeString(url); + } + if ((flags & 8) != 0) { + stream.writeString(start_param); + } + if ((flags & 4) != 0) { + theme_params.serializeToStream(stream); + } + stream.writeString(platform); + if ((flags & 1) != 0) { + reply_to.serializeToStream(stream); + } + if ((flags & 8192) != 0) { + send_as.serializeToStream(stream); + } } } - public static class TL_channels_reorderUsernames extends TLObject { - public static final int constructor = 0xb45ced1d; + public static class TL_messages_requestMainWebView extends TLObject { + public static final int constructor = 0xc9e01e7b; - public InputChannel channel; - public ArrayList order = new ArrayList<>(); + public int flags; + public boolean compact; + public boolean fullscreen; + public InputPeer peer; + public InputUser bot; + public String start_param; + public TL_dataJSON theme_params; + public String platform; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_webViewResultUrl.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = order.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(order.get(a)); + flags = compact ? (flags | 128) : (flags &~ 128); + flags = fullscreen ? (flags | 256) : (flags &~ 256); + stream.writeInt32(flags); + peer.serializeToStream(stream); + bot.serializeToStream(stream); + if ((flags & 2) != 0) { + stream.writeString(start_param); + } + if ((flags & 1) != 0) { + theme_params.serializeToStream(stream); } + stream.writeString(platform); } } - public static class TL_channels_toggleUsername extends TLObject { - public static final int constructor = 0x50f24105; + public static class TL_messages_prolongWebView extends TLObject { + public static final int constructor = 0xb0d81a83; - public InputChannel channel; - public String username; - public boolean active; + public int flags; + public boolean silent; + public InputPeer peer; + public InputUser bot; + public long query_id; + public InputReplyTo reply_to; + public InputPeer send_as; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeString(username); - stream.writeBool(active); + flags = silent ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + peer.serializeToStream(stream); + bot.serializeToStream(stream); + stream.writeInt64(query_id); + if ((flags & 1) != 0) { + reply_to.serializeToStream(stream); + } + if ((flags & 8192) != 0) { + send_as.serializeToStream(stream); + } } } - public static class TL_channels_deactivateAllUsernames extends TLObject { - public static final int constructor = 0xa245dd3; + public static class TL_messages_getBotApp extends TLObject { + public static final int constructor = 0x34fdc5c3; - public InputChannel channel; + public InputBotApp app; + public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_botApp.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); + app.serializeToStream(stream); + stream.writeInt64(hash); } } - public static class TL_channels_reorderPinnedForumTopics extends TLObject { - public static final int constructor = 0x2950a18f; + public static class TL_messages_requestAppWebView extends TLObject { + public static final int constructor = 0x53618bce; public int flags; - public boolean force; - public InputChannel channel; - public ArrayList order = new ArrayList<>(); + public boolean write_allowed; + public boolean compact; + public boolean fullscreen; + public InputPeer peer; + public InputBotApp app; + public String start_param; + public TL_dataJSON theme_params; + public String platform; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_webViewResultUrl.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = force ? (flags | 1) : (flags &~ 1); + flags = write_allowed ? (flags | 1) : (flags &~ 1); + flags = compact ? (flags | 128) : (flags &~ 128); + flags = fullscreen ? (flags | 256) : (flags &~ 256); stream.writeInt32(flags); - channel.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = order.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(order.get(a)); + peer.serializeToStream(stream); + app.serializeToStream(stream); + if ((flags & 2) != 0) { + stream.writeString(start_param); } + if ((flags & 4) != 0) { + theme_params.serializeToStream(stream); + } + stream.writeString(platform); } } - public static class TL_channels_toggleAntiSpam extends TLObject { - public static final int constructor = 0x68f3e4eb; + public static class TL_messages_requestSimpleWebView extends TLObject { + public static final int constructor = 0x413a3e73; - public InputChannel channel; - public boolean enabled; + public int flags; + public boolean from_switch_webview; + public boolean from_side_menu; + public boolean compact; + public boolean fullscreen; + public InputUser bot; + public String url; + public String start_param; + public TL_dataJSON theme_params; + public String platform; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_webViewResultUrl.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeBool(enabled); + flags = from_switch_webview ? (flags | 2) : (flags &~ 2); + flags = from_side_menu ? (flags | 4) : (flags &~ 4); + flags = compact ? (flags | 128) : (flags &~ 128); + flags = fullscreen ? (flags | 256) : (flags &~ 256); + stream.writeInt32(flags); + bot.serializeToStream(stream); + if ((flags & 8) != 0) { + stream.writeString(url); + } + if ((flags & 16) != 0) { + stream.writeString(start_param); + } + if ((flags & 1) != 0) { + theme_params.serializeToStream(stream); + } + stream.writeString(platform); } } - public static class TL_channels_reportAntiSpamFalsePositive extends TLObject { - public static final int constructor = 0xa850a693; + public static class TL_messages_sendWebViewResultMessage extends TLObject { + public static final int constructor = 0xddcf50eb; - public InputChannel channel; - public int msg_id; + public long query_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_webViewMessageSent.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeInt32(msg_id); + stream.writeInt64(query_id); } } - public static class TL_channels_toggleParticipantsHidden extends TLObject { - public static final int constructor = 0x6a6e7854; + public static class TL_messages_setWebViewResult extends TLObject { + public static final int constructor = 0xe41cd11d; - public InputChannel channel; - public boolean enabled; + public long query_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeBool(enabled); + stream.writeInt64(query_id); } } - public static class TL_messages_clickSponsoredMessage extends TLObject { - public static final int constructor = 0xf093465; + public static class TL_messages_getWebViewResult extends TLObject { + public static final int constructor = 0x22b6c214; - public int flags; - public boolean media; - public boolean fullscreen; public InputPeer peer; - public byte[] random_id; + public InputUser bot; + public long query_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_webViewResult.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = media ? flags | 1 : flags &~ 1; - flags = fullscreen ? flags | 2 : flags &~ 2; - stream.writeInt32(flags); peer.serializeToStream(stream); - stream.writeByteArray(random_id); + bot.serializeToStream(stream); + stream.writeInt64(query_id); } } - public static class TL_messages_setDefaultHistoryTTL extends TLObject { - public static final int constructor = 0x9eb51445; + public static class TL_attachMenuBotsBot extends TLObject { + public static final int constructor = 0x93bf667f; - public int period; + public TL_attachMenuBot bot; + public ArrayList users = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public static TL_attachMenuBotsBot TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_attachMenuBotsBot.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_attachMenuBotsBot", constructor)); + } else { + return null; + } + } + TL_attachMenuBotsBot result = new TL_attachMenuBotsBot(); + result.readParams(stream, exception); + return result; } - public void serializeToStream(AbstractSerializedData stream) { + public void readParams(InputSerializedData stream, boolean exception) { + bot = TL_attachMenuBot.TLdeserialize(stream, stream.readInt32(exception), exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); + } + + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(period); + bot.serializeToStream(stream); + Vector.serialize(stream, users); } } - public static class TL_messages_getDefaultHistoryTTL extends TLObject { - public static final int constructor = 0x658b7188; + public static class TL_simpleWebViewResultUrl extends TLObject { + public static final int constructor = 0x882f76bb; + + public String url; + public static TL_simpleWebViewResultUrl TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_simpleWebViewResultUrl.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_simpleWebViewResultUrl", constructor)); + } else { + return null; + } + } + TL_simpleWebViewResultUrl result = new TL_simpleWebViewResultUrl(); + result.readParams(stream, exception); + return result; + } - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_defaultHistoryTTL.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + url = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + stream.writeString(url); } } - public static class TL_defaultHistoryTTL extends TLObject { - public static final int constructor = 0x43b46b20; + public static class TL_webViewMessageSent extends TLObject { + public static final int constructor = 0xc94511c; - public int period; + public int flags; + public TL_inputBotInlineMessageID msg_id; - public static TL_defaultHistoryTTL TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_defaultHistoryTTL.constructor != constructor) { + public static TL_webViewMessageSent TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_webViewMessageSent.constructor != constructor) { if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_defaultHistoryTTL", constructor)); + throw new RuntimeException(String.format("can't parse magic %x in TL_webViewMessageSent", constructor)); } else { return null; } } - TL_defaultHistoryTTL result = new TL_defaultHistoryTTL(); + TL_webViewMessageSent result = new TL_webViewMessageSent(); result.readParams(stream, exception); return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { - period = stream.readInt32(exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + if ((flags & 1) != 0) { + msg_id = TL_inputBotInlineMessageID.TLdeserialize(stream, stream.readInt32(exception), exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(period); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + msg_id.serializeToStream(stream); + } } } - public static class TL_messages_sendBotRequestedPeer extends TLObject { - public static final int constructor = 0x91b2d060; + public static class TL_updateWebViewResultSent extends Update { + public static final int constructor = 0x1592b79d; - public InputPeer peer; - public int msg_id; - public int button_id; - public ArrayList requested_peers = new ArrayList<>(); + public long query_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + query_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(msg_id); - stream.writeInt32(button_id); - stream.writeInt32(0x1cb5c415); - int count = requested_peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - requested_peers.get(a).serializeToStream(stream); - } + stream.writeInt64(query_id); } } - public static class TL_contacts_exportContactToken extends TLObject { - public static final int constructor = 0xf8654027; - + public static class TL_keyboardButtonSimpleWebView extends KeyboardButton { + public static final int constructor = 0xa0c0505c; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_exportedContactToken.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + text = stream.readString(exception); + url = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + stream.writeString(text); + stream.writeString(url); } } - public static class TL_contacts_importContactToken extends TLObject { - public static final int constructor = 0x13005788; + public static class TL_messages_getAttachMenuBot extends TLObject { + public static final int constructor = 0x77216192; - public String token; + public InputUser bot; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return User.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_attachMenuBotsBot.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(token); + bot.serializeToStream(stream); } } - public static class TL_messageActionSuggestProfilePhoto extends MessageAction { - public static final int constructor = 0x57de635e; + public static class TL_attachMenuBotIconColor extends TLObject { + public static final int constructor = 0x4576f3f0; - public void readParams(AbstractSerializedData stream, boolean exception) { - photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public String name; + public int color; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - photo.serializeToStream(stream); + public static TL_attachMenuBotIconColor TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_attachMenuBotIconColor.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_attachMenuBotIconColor", constructor)); + } else { + return null; + } + } + TL_attachMenuBotIconColor result = new TL_attachMenuBotIconColor(); + result.readParams(stream, exception); + return result; } - } - public static class TL_messageActionAttachMenuBotAllowed extends MessageAction { - public static final int constructor = 0xe7e75f97; - - - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { + name = stream.readString(exception); + color = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + stream.writeString(name); + stream.writeInt32(color); } } - public static class TL_messageActionRequestedPeer_layer168 extends TL_messageActionRequestedPeer { - public static final int constructor = 0xfe77345d; + public static class TL_attachMenuBotIcon extends TLObject { + public static final int constructor = 0xb2a7386b; - public TLRPC.Peer peer; + public int flags; + public String name; + public Document icon; + public ArrayList colors = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - button_id = stream.readInt32(exception); - peer = TLRPC.Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (peer == null) { - return; + public static TL_attachMenuBotIcon TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_attachMenuBotIcon.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_attachMenuBotIcon", constructor)); + } else { + return null; + } + } + TL_attachMenuBotIcon result = new TL_attachMenuBotIcon(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + name = stream.readString(exception); + icon = Document.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 1) != 0) { + colors = Vector.deserialize(stream, TL_attachMenuBotIconColor::TLdeserialize, exception); } - peers.add(peer); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(button_id); - peer.serializeToStream(stream); + stream.writeInt32(flags); + stream.writeString(name); + icon.serializeToStream(stream); + if ((flags & 1) != 0) { + Vector.serialize(stream, colors); + } } } - public static class TL_messageActionRequestedPeer extends MessageAction { - public static final int constructor = 0x31518e9b; - - public int button_id; - public ArrayList peers = new ArrayList<>(); + public static abstract class InputBotApp extends TLObject { - public void readParams(AbstractSerializedData stream, boolean exception) { - button_id = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + public static InputBotApp TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + InputBotApp result = null; + switch (constructor) { + case 0xa920bd7a: + result = new TL_inputBotAppID(); + break; + case 0x908c0407: + result = new TL_inputBotAppShortName(); + break; } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Peer object = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - peers.add(object); + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in InputBotApp", constructor)); + } + if (result != null) { + result.readParams(stream, exception); } + return result; + } + } + + public static class TL_inputBotAppID extends InputBotApp { + public static final int constructor = 0xa920bd7a; + + public long id; + public long access_hash; + + public void readParams(InputSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(button_id); - stream.writeInt32(0x1cb5c415); - int count = peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - peers.get(a).serializeToStream(stream); - } + stream.writeInt64(id); + stream.writeInt64(access_hash); } } - public static class TL_photos_uploadContactProfilePhoto extends TLObject { - public static final int constructor = 0xe14c4a71; + public static class TL_inputBotAppShortName extends InputBotApp { + public static final int constructor = 0x908c0407; - public int flags; - public boolean suggest; - public boolean save; - public InputUser user_id; - public InputFile file; - public InputFile video; - public double video_start_ts; - public VideoSize video_emoji_markup; + public InputUser bot_id; + public String short_name; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_photos_photo.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + bot_id = InputUser.TLdeserialize(stream, stream.readInt32(exception), exception); + short_name = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = suggest ? (flags | 8) : (flags &~ 8); - flags = save ? (flags | 16) : (flags &~ 16); - stream.writeInt32(flags); - user_id.serializeToStream(stream); - if ((flags & 1) != 0) { - file.serializeToStream(stream); - } - if ((flags & 2) != 0) { - video.serializeToStream(stream); - } - if ((flags & 4) != 0) { - stream.writeDouble(video_start_ts); - } - if ((flags & 32) != 0) { - video_emoji_markup.serializeToStream(stream); - } + bot_id.serializeToStream(stream); + stream.writeString(short_name); } } - public static abstract class EmojiList extends TLObject { + public static abstract class BotApp extends TLObject { + public int flags; + public long id; + public long access_hash; + public String short_name; + public String title; + public String description; + public Photo photo; + public Document document; + public long hash; - public static EmojiList TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - EmojiList result = null; + public static BotApp TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + BotApp result = null; switch (constructor) { - case 0x7a1e11d1: - result = new TL_emojiList(); + case 0x5da674b7: + result = new TL_botAppNotModified(); break; - case 0x481eadfa: - result = new TL_emojiListNotModified(); + case 0x95fcd1d6: + result = new TL_botApp(); break; } if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in EmojiList", constructor)); + throw new RuntimeException(String.format("can't parse magic %x in BotApp", constructor)); } if (result != null) { result.readParams(stream, exception); @@ -78220,610 +63460,644 @@ public static EmojiList TLdeserialize(AbstractSerializedData stream, int constru } } - public static class TL_emojiList extends EmojiList { - public static final int constructor = 0x7a1e11d1; + public static class TL_botAppNotModified extends BotApp { + public static final int constructor = 0x5da674b7; - public long hash; - public ArrayList document_id = new ArrayList<>(); + public void readParams(InputSerializedData stream, boolean exception) { + } - public void readParams(AbstractSerializedData stream, boolean exception) { - hash = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - document_id.add(stream.readInt64(exception)); + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_botApp extends BotApp { + public static final int constructor = 0x95fcd1d6; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + short_name = stream.readString(exception); + title = stream.readString(exception); + description = stream.readString(exception); + photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 1) != 0) { + document = Document.TLdeserialize(stream, stream.readInt32(exception), exception); } + hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(hash); - stream.writeInt32(0x1cb5c415); - int count = document_id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(document_id.get(a)); + stream.writeInt32(flags); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeString(short_name); + stream.writeString(title); + stream.writeString(description); + photo.serializeToStream(stream); + if ((flags & 1) != 0) { + document.serializeToStream(stream); } + stream.writeInt64(hash); } } - public static class TL_emojiListNotModified extends EmojiList { - public static final int constructor = 0x481eadfa; + public static class TL_messages_botApp extends TLObject { + public static final int constructor = 0xeb50adf5; + + public int flags; + public boolean inactive; + public boolean request_write_access; + public BotApp app; + + public static TL_messages_botApp TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_messages_botApp.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_botApp", constructor)); + } else { + return null; + } + } + TL_messages_botApp result = new TL_messages_botApp(); + result.readParams(stream, exception); + return result; + } + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + inactive = (flags & 1) != 0; + request_write_access = (flags & 2) != 0; + app = BotApp.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = inactive ? (flags | 1) : (flags &~ 1); + flags = request_write_access ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + app.serializeToStream(stream); } } - public static class TL_account_getDefaultProfilePhotoEmojis extends TLObject { - public static final int constructor = 0xe2750328; + public static class TL_appWebViewResultUrl extends TLObject { + public static final int constructor = 0x3c1b4f0d; + + public String url; - public long hash; + public static TL_appWebViewResultUrl TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_appWebViewResultUrl.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_appWebViewResultUrl", constructor)); + } else { + return null; + } + } + TL_appWebViewResultUrl result = new TL_appWebViewResultUrl(); + result.readParams(stream, exception); + return result; + } - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return EmojiList.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + url = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(hash); + stream.writeString(url); } } - public static class TL_account_getDefaultGroupPhotoEmojis extends TLObject { - public static final int constructor = 0x915860ae; + public static class TL_inlineBotWebView extends TLObject { + public static final int constructor = 0xb57295d5; - public long hash; + public String text; + public String url; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return EmojiList.TLdeserialize(stream, constructor, exception); + public static TL_inlineBotWebView TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_inlineBotWebView.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_inlineBotWebView", constructor)); + } else { + return null; + } + } + TL_inlineBotWebView result = new TL_inlineBotWebView(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + text = stream.readString(exception); + url = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(hash); + stream.writeString(text); + stream.writeString(url); } } - public static class TL_account_getChannelRestrictedStatusEmojis extends TLObject { - public static final int constructor = 0x35a9e0d5; + public static class TL_channels_toggleJoinToSend extends TLObject { + public static final int constructor = 0xe4cb9580; - public long hash; + public InputChannel channel; + public boolean enabled; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return EmojiList.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(hash); + channel.serializeToStream(stream); + stream.writeBool(enabled); } } - public static class TL_channels_updateColor extends TLObject { - public static final int constructor = 0xd8aa3671; + public static class TL_channels_toggleJoinRequest extends TLObject { + public static final int constructor = 0x4c2985b6; - public int flags; - public boolean for_profile; public InputChannel channel; - public int color; - public long background_emoji_id; + public boolean enabled; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = for_profile ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); channel.serializeToStream(stream); - if ((flags & 4) != 0) { - stream.writeInt32(color); - } - if ((flags & 1) != 0) { - stream.writeInt64(background_emoji_id); - } + stream.writeBool(enabled); } } - public static class TL_account_updateColor extends TLObject { - public static final int constructor = 0x7cefa15d; + public static class TL_chatInvitePublicJoinRequests extends TL_chatInviteExported { + public static final int constructor = 0xed107ab7; + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } - public int flags; - public boolean for_profile; - public int color; - public long background_emoji_id; + public void readParams(InputSerializedData stream, boolean exception) { - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = for_profile ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - if ((flags & 4) != 0) { - stream.writeInt32(color); + public static abstract class AttachMenuPeerType extends TLObject { + + public static AttachMenuPeerType TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + AttachMenuPeerType result = null; + switch (constructor) { + case 0xc32bfa1a: + result = new TL_attachMenuPeerTypeBotPM(); + break; + case 0xf146d31f: + result = new TL_attachMenuPeerTypePM(); + break; + case 0x7bfbdefc: + result = new TL_attachMenuPeerTypeBroadcast(); + break; + case 0x509113f: + result = new TL_attachMenuPeerTypeChat(); + break; + case 0x7d6be90e: + result = new TL_attachMenuPeerTypeSameBotPM(); + break; } - if ((flags & 1) != 0) { - stream.writeInt64(background_emoji_id); + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in AttachMenuPeerType", constructor)); + } + if (result != null) { + result.readParams(stream, exception); } + return result; } } - public static class TL_updateChannelViewForumAsMessages extends Update { - public static final int constructor = 0x7b68920; - - public long channel_id; - public boolean enabled; + public static class TL_attachMenuPeerTypeBotPM extends AttachMenuPeerType { + public static final int constructor = 0xc32bfa1a; - public void readParams(AbstractSerializedData stream, boolean exception) { - channel_id = stream.readInt64(exception); - enabled = stream.readBool(exception); + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); } + } - public void serializeToStream(AbstractSerializedData stream) { + public static class TL_attachMenuPeerTypePM extends AttachMenuPeerType { + public static final int constructor = 0xf146d31f; + + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(channel_id); - stream.writeBool(enabled); } } - public static class TL_updatePinnedSavedDialogs extends Update { - public static final int constructor = 0x686c85a6; + public static class TL_attachMenuPeerTypeBroadcast extends AttachMenuPeerType { + public static final int constructor = 0x7bfbdefc; - public int flags; - public ArrayList order = new ArrayList<>(); + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - if ((flags & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - order.add(DialogPeer.TLdeserialize(stream, stream.readInt32(exception), exception)); - } - } + public static class TL_attachMenuPeerTypeChat extends AttachMenuPeerType { + public static final int constructor = 0x509113f; + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); } + } + + public static class TL_attachMenuPeerTypeSameBotPM extends AttachMenuPeerType { + public static final int constructor = 0x7d6be90e; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = order.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - order.get(i).serializeToStream(stream); - } + } + } + + public static abstract class InputInvoice extends TLObject { + + public static InputInvoice TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + InputInvoice result = null; + switch (constructor) { + case TL_inputInvoicePremiumGiftCode.constructor: + result = new TL_inputInvoicePremiumGiftCode(); + break; + case TL_inputInvoiceMessage.constructor: + result = new TL_inputInvoiceMessage(); + break; + case TL_inputInvoiceSlug.constructor: + result = new TL_inputInvoiceSlug(); + break; + case TL_inputInvoiceStars.constructor: + result = new TL_inputInvoiceStars(); + break; + case TL_inputInvoiceChatInviteSubscription.constructor: + result = new TL_inputInvoiceChatInviteSubscription(); + break; + case TL_inputInvoiceStarGift.constructor: + result = new TL_inputInvoiceStarGift(); + break; + case TL_inputInvoiceStarGiftUpgrade.constructor: + result = new TL_inputInvoiceStarGiftUpgrade(); + break; + case TL_inputInvoiceStarGiftTransfer.constructor: + result = new TL_inputInvoiceStarGiftTransfer(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in InputInvoice", constructor)); + } + if (result != null) { + result.readParams(stream, exception); } + return result; } } - - public static class TL_updateQuickReplies extends Update { - public static final int constructor = 0xf9470ab2; - public ArrayList quick_replies = new ArrayList<>(); + public static class TL_inputInvoiceMessage extends InputInvoice { + public static final int constructor = 0xc5b56859; - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - quick_replies.add(TL_quickReply.TLdeserialize(stream, stream.readInt32(exception), exception)); - } + public InputPeer peer; + public int msg_id; + + public void readParams(InputSerializedData stream, boolean exception) { + peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); + msg_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = quick_replies.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - quick_replies.get(i).serializeToStream(stream); - } + peer.serializeToStream(stream); + stream.writeInt32(msg_id); } } - - public static class TL_updateNewQuickReply extends Update { - public static final int constructor = 0xf53da717; - public TL_quickReply quick_reply; + public static class TL_inputInvoiceSlug extends InputInvoice { + public static final int constructor = 0xc326caef; - public void readParams(AbstractSerializedData stream, boolean exception) { - quick_reply = TL_quickReply.TLdeserialize(stream, stream.readInt32(exception), exception); + public String slug; + + public void readParams(InputSerializedData stream, boolean exception) { + slug = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - quick_reply.serializeToStream(stream); + stream.writeString(slug); } } - - public static class TL_updateDeleteQuickReply extends Update { - public static final int constructor = 0x53e6f1ec; - public int shortcut_id; + public static class TL_payments_exportedInvoice extends TLObject { + public static final int constructor = 0xaed0cbd9; - public void readParams(AbstractSerializedData stream, boolean exception) { - shortcut_id = stream.readInt32(exception); - } + public String url; - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(shortcut_id); + public static TL_payments_exportedInvoice TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_payments_exportedInvoice.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_payments_exportedInvoice", constructor)); + } else { + return null; + } + } + TL_payments_exportedInvoice result = new TL_payments_exportedInvoice(); + result.readParams(stream, exception); + return result; } - } - - public static class TL_updateQuickReplyMessage extends Update { - public static final int constructor = 0x3e050d0f; - - public Message message; - public void readParams(AbstractSerializedData stream, boolean exception) { - message = Message.TLdeserialize(stream, stream.readInt32(exception), exception); + public void readParams(InputSerializedData stream, boolean exception) { + url = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - message.serializeToStream(stream); + stream.writeString(url); } } - - public static class TL_updateDeleteQuickReplyMessages extends Update { - public static final int constructor = 0x566fe7cd; - public int shortcut_id; - public ArrayList messages = new ArrayList<>(); + public static class TL_payments_exportInvoice extends TLObject { + public static final int constructor = 0xf91b065; - public void readParams(AbstractSerializedData stream, boolean exception) { - shortcut_id = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - messages.add(stream.readInt32(exception)); - } + public InputMedia invoice_media; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_payments_exportedInvoice.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(shortcut_id); - stream.writeInt32(0x1cb5c415); - int count = messages.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - stream.writeInt32(messages.get(i)); - } + invoice_media.serializeToStream(stream); } } - - public static class TL_updateNewStoryReaction extends Update { - public static final int constructor = 0x1824e40b; - public int story_id; - public Peer peer; - public Reaction reaction; + public static class TL_messages_transcribeAudio extends TLObject { + public static final int constructor = 0x269e9a49; - public void readParams(AbstractSerializedData stream, boolean exception) { - story_id = stream.readInt32(exception); - peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - reaction = Reaction.TLdeserialize(stream, stream.readInt32(exception), exception); + public InputPeer peer; + public int msg_id; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_transcribedAudio.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(story_id); peer.serializeToStream(stream); - reaction.serializeToStream(stream); + stream.writeInt32(msg_id); } } - - public static class TL_updateBroadcastRevenueTransactions extends Update { - public static final int constructor = 0xdfd961f5; - public Peer peer; - public BroadcastRevenueBalances balances; + public static class TL_messages_rateTranscribedAudio extends TLObject { + public static final int constructor = 0x7f1d072f; - public void readParams(AbstractSerializedData stream, boolean exception) { - peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - balances = BroadcastRevenueBalances.TLdeserialize(stream, stream.readInt32(exception), exception); + public InputPeer peer; + public int msg_id; + public long transcription_id; + public boolean good; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); - balances.serializeToStream(stream); + stream.writeInt32(msg_id); + stream.writeInt64(transcription_id); + stream.writeBool(good); } } - - public static class TL_updateStarsBalance extends Update { - public static final int constructor = 0x4e80a379; - public TL_stars.StarsAmount balance; + public static class TL_messages_transcribedAudio extends TLObject { + public static final int constructor = 0xcfb9d957; - public void readParams(AbstractSerializedData stream, boolean exception) { - balance = TL_stars.StarsAmount.TLdeserialize(stream, stream.readInt32(exception), exception); + public int flags; + public boolean pending; + public long transcription_id; + public String text; + public int trial_remains_num; + public int trial_remains_until_date; + + public static TL_messages_transcribedAudio TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_messages_transcribedAudio.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_transcribedAudio", constructor)); + } else { + return null; + } + } + TL_messages_transcribedAudio result = new TL_messages_transcribedAudio(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + pending = (flags & 1) != 0; + transcription_id = stream.readInt64(exception); + text = stream.readString(exception); + if ((flags & 2) != 0) { + trial_remains_num = stream.readInt32(exception); + trial_remains_until_date = stream.readInt32(exception); + } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - balance.serializeToStream(stream); + flags = pending ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeInt64(transcription_id); + stream.writeString(text); + if ((flags & 2) != 0) { + stream.writeInt32(trial_remains_num); + stream.writeInt32(trial_remains_until_date); + } } } - public static class TL_updateStarsBalance_layer194 extends TL_updateStarsBalance { - public static final int constructor = 0xfb85198; + public static class TL_payments_canPurchasePremium extends TLObject { + public static final int constructor = 0x9fc19eb6; - public long balance; + public InputStorePaymentPurpose purpose; - public void readParams(AbstractSerializedData stream, boolean exception) { - balance = stream.readInt64(exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(balance); + purpose.serializeToStream(stream); } } - - public static class TL_updateStarsRevenueStatus extends Update { - public static final int constructor = 0xa584b019; - public Peer peer; - public TL_starsRevenueStatus status; + public static class TL_payments_requestRecurringPayment extends TLObject { + public static final int constructor = 0x146e958d; - public void readParams(AbstractSerializedData stream, boolean exception) { - peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - status = TL_starsRevenueStatus.TLdeserialize(stream, stream.readInt32(exception), exception); + public InputUser user_id; + public String recurring_init_charge; + public InputMedia invoice_media; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - status.serializeToStream(stream); + user_id.serializeToStream(stream); + stream.writeString(recurring_init_charge); + invoice_media.serializeToStream(stream); } } - public static class TL_updateBotPurchasedPaidMedia extends Update { - public static final int constructor = 0x283bd312; + public static class TL_messageEntityCustomEmoji extends MessageEntity { + public static final int constructor = 0xc8cf05f8; - public long user_id; - public String payload; - public int qts; + public long document_id; + public TLRPC.Document document; //custom - public void readParams(AbstractSerializedData stream, boolean exception) { - user_id = stream.readInt64(exception); - payload = stream.readString(exception); - qts = stream.readInt32(exception); + public void readParams(InputSerializedData stream, boolean exception) { + offset = stream.readInt32(exception); + length = stream.readInt32(exception); + document_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(user_id); - stream.writeString(payload); - stream.writeInt32(qts); + stream.writeInt32(offset); + stream.writeInt32(length); + stream.writeInt64(document_id); } } - public static class TL_updatePaidReactionPrivacy extends Update { - public static final int constructor = 0x51ca7aec; + public static class TL_messages_getCustomEmojiDocuments extends TLObject { + public static final int constructor = 0xd9ab0f54; - public boolean isPrivate; + public ArrayList document_id = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - isPrivate = stream.readBool(exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, Document::TLdeserialize); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeBool(isPrivate); + Vector.serializeLong(stream, document_id); } } - public static class TL_updateBotSubscriptionExpire extends Update { - public static final int constructor = 0xa8ae3eb1; - - public long user_id; - public String payload; - public int until_date; - public int qts; - - public void readParams(AbstractSerializedData stream, boolean exception) { - user_id = stream.readInt64(exception); - payload = stream.readString(exception); - until_date = stream.readInt32(exception); - qts = stream.readInt32(exception); - } + public static abstract class ChatReactions extends TLObject { - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(user_id); - stream.writeString(payload); - stream.writeInt32(until_date); - stream.writeInt32(qts); + public static ChatReactions TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + ChatReactions result = null; + switch (constructor) { + case 0x661d4037: + result = new TL_chatReactionsSome(); + break; + case 0xeafc32bc: + result = new TL_chatReactionsNone(); + break; + case 0x52928bca: + result = new TL_chatReactionsAll(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in ChatReactions", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; } } - public static class TL_updateSavedDialogPinned extends Update { - public static final int constructor = 0xaeaf9e74; + public static class TL_chatReactionsSome extends ChatReactions { + public static final int constructor = 0x661d4037; - public int flags; - public boolean pinned; - public DialogPeer peer; + public ArrayList reactions = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - pinned = (flags & 1) != 0; - peer = DialogPeer.TLdeserialize(stream, stream.readInt32(exception), exception); + public void readParams(InputSerializedData stream, boolean exception) { + reactions = Vector.deserialize(stream, Reaction::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = pinned ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - peer.serializeToStream(stream); + Vector.serialize(stream, reactions); } } - public static class TL_updatePeerWallpaper extends Update { - public static final int constructor = 0xae3f101d; - - public int flags; - public boolean wallpaper_overridden; - public Peer peer; - public WallPaper wallpaper; - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - wallpaper_overridden = (flags & 2) != 0; - peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 1) != 0) { - wallpaper = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); - } - } + public static class TL_chatReactionsNone extends ChatReactions { + public static final int constructor = 0xeafc32bc; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = wallpaper_overridden ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - peer.serializeToStream(stream); - if ((flags & 1) != 0) { - wallpaper.serializeToStream(stream); - } } } - public static class TL_messages_setChatWallPaper extends TLObject { - public static final int constructor = 0x8ffacae1; + public static class TL_chatReactionsAll extends ChatReactions { + public static final int constructor = 0x52928bca; public int flags; - public boolean for_both; - public boolean revert; - public InputPeer peer; - public InputWallPaper wallpaper; - public WallPaperSettings settings; - public int id; + public boolean allow_custom; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + allow_custom = (flags & 1) != 0; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = for_both ? (flags | 8) : (flags &~ 8); - flags = revert ? (flags | 16) : (flags &~ 16); + flags = allow_custom ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); - peer.serializeToStream(stream); - if ((flags & 1) != 0) { - wallpaper.serializeToStream(stream); - } - if ((flags & 4) != 0) { - settings.serializeToStream(stream); - } - if ((flags & 2) != 0) { - stream.writeInt32(id); - } } } - public static class TL_contacts_setBlocked extends TLObject { - public static final int constructor = 0x94c65c76; + public static class TL_messages_reportReaction extends TLObject { + public static final int constructor = 0x61422a48; - public int flags; - public boolean my_stories_from; - public ArrayList id = new ArrayList<>(); - public int limit; + public InputPeer peer; + public int id; + public InputUser user_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = my_stories_from ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - stream.writeInt32(id.size()); - for (int i = 0; i < id.size(); ++i) { - id.get(i).serializeToStream(stream); - } - stream.writeInt32(limit); + peer.serializeToStream(stream); + stream.writeInt32(id); + user_id.serializeToStream(stream); } } - public static class TL_editCloseFriends extends TLObject { - public static final int constructor = 0xba6705f0; - - public ArrayList id = new ArrayList<>(); + public static class TL_messages_clearRecentReactions extends TLObject { + public static final int constructor = 0x9dfeefb4; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(id.get(a)); - } } } - public static abstract class InputReplyTo extends TLObject { - - public int flags; - public int reply_to_msg_id; - public int top_msg_id; - public InputPeer reply_to_peer_id; - public String quote_text; - public ArrayList quote_entities = new ArrayList<>(); - public int quote_offset; - - public InputPeer peer; - public int story_id; + public static abstract class messages_Reactions extends TLObject { - public static InputReplyTo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - InputReplyTo result = null; + public static messages_Reactions TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + messages_Reactions result = null; switch (constructor) { - case TL_inputReplyToMessage.constructor: - result = new TL_inputReplyToMessage(); - break; - case TL_inputReplyToMessage_layer166.constructor: - result = new TL_inputReplyToMessage_layer166(); + case 0xb06fdbdf: + result = new TL_messages_reactionsNotModified(); break; - case TL_inputReplyToStory.constructor: - result = new TL_inputReplyToStory(); + case 0xeafdf716: + result = new TL_messages_reactions(); break; } if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in InputReplyTo", constructor)); + throw new RuntimeException(String.format("can't parse magic %x in messages_Reactions", constructor)); } if (result != null) { result.readParams(stream, exception); @@ -78832,1439 +64106,927 @@ public static InputReplyTo TLdeserialize(AbstractSerializedData stream, int cons } } - public static class TL_inputReplyToMessage extends InputReplyTo { - public static final int constructor = 0x22c0f6d5; + public static class TL_messages_reactionsNotModified extends messages_Reactions { + public static final int constructor = 0xb06fdbdf; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - reply_to_msg_id = stream.readInt32(exception); - if ((flags & 1) != 0) { - top_msg_id = stream.readInt32(exception); - } - if ((flags & 2) != 0) { - reply_to_peer_id = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4) != 0) { - quote_text = stream.readString(exception); - } - if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - quote_entities.add(object); - } - } - if ((flags & 16) != 0) { - quote_offset = stream.readInt32(exception); - } + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_messages_reactions extends messages_Reactions { + public static final int constructor = 0xeafdf716; + + public long hash; + public ArrayList reactions = new ArrayList<>(); + + public void readParams(InputSerializedData stream, boolean exception) { + hash = stream.readInt64(exception); + reactions = Vector.deserialize(stream, Reaction::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeInt32(reply_to_msg_id); - if ((flags & 1) != 0) { - stream.writeInt32(top_msg_id); - } - if ((flags & 2) != 0) { - reply_to_peer_id.serializeToStream(stream); - } - if ((flags & 4) != 0) { - stream.writeString(quote_text); - } - if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = quote_entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; ++a) { - quote_entities.get(a).serializeToStream(stream); - } - } - if ((flags & 16) != 0) { - stream.writeInt32(quote_offset); - } + stream.writeInt64(hash); + Vector.serialize(stream, reactions); } } - public static class TL_inputReplyToMessage_layer166 extends TL_inputReplyToMessage { - public static final int constructor = 0x73ec805; + public static class TL_messages_getTopReactions extends TLObject { + public static final int constructor = 0xbb8125ba; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - reply_to_msg_id = stream.readInt32(exception); - if ((flags & 1) != 0) { - top_msg_id = stream.readInt32(exception); - } - if ((flags & 2) != 0) { - reply_to_peer_id = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 4) != 0) { - quote_text = stream.readString(exception); - } - if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - quote_entities.add(object); - } - } + public int limit; + public long hash; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_Reactions.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeInt32(reply_to_msg_id); - if ((flags & 1) != 0) { - stream.writeInt32(top_msg_id); - } - if ((flags & 2) != 0) { - reply_to_peer_id.serializeToStream(stream); - } - if ((flags & 4) != 0) { - stream.writeString(quote_text); - } - if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = quote_entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; ++a) { - quote_entities.get(a).serializeToStream(stream); - } - } + stream.writeInt32(limit); + stream.writeInt64(hash); } } - public static class TL_inputReplyToStory extends InputReplyTo { - public static final int constructor = 0x5881323a; + public static class TL_messages_getRecentReactions extends TLObject { + public static final int constructor = 0x39461db2; + + public int limit; + public long hash; - public void readParams(AbstractSerializedData stream, boolean exception) { - peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - story_id = stream.readInt32(exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_Reactions.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(story_id); + stream.writeInt32(limit); + stream.writeInt64(hash); } } - public static class TL_inputMediaStory extends InputMedia { - public static final int constructor = 0x89fdd778; + public static class TL_messages_getDefaultTagReactions extends TLObject { + public static final int constructor = 0xbdf93428; - public InputPeer peer; - public int id; + public long hash; - public void readParams(AbstractSerializedData stream, boolean exception) { - peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - id = stream.readInt32(exception); + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_Reactions.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + @Override + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(id); + stream.writeInt64(hash); } } - public static class TL_messageMediaStory extends MessageMedia { - public static final int constructor = 0x68cb6283; + public static abstract class ForumTopic extends TLObject { - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - via_mention = (flags & 2) != 0; - peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - id = stream.readInt32(exception); - if ((flags & 1) != 0) { - storyItem = TL_stories.StoryItem.TLdeserialize(stream, stream.readInt32(exception), exception); + public static ForumTopic TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + ForumTopic result = null; + switch (constructor) { + case 0x23f109b: + result = new TL_forumTopicDeleted(); + break; + case 0x5920d6dc: + result = new TL_forumTopic_layer147(); + break; + case 0x71701da9: + result = new TL_forumTopic(); + break; } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in ForumTopic", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } + + public static class TL_forumTopicDeleted extends TL_forumTopic { + public static final int constructor = 0x23f109b; + + public void readParams(InputSerializedData stream, boolean exception) { + id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = via_mention ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - peer.serializeToStream(stream); stream.writeInt32(id); - if ((flags & 1) != 0) { - storyItem.serializeToStream(stream); - } } } - public static class TL_messageMediaStory_layer162 extends MessageMedia { - public static final int constructor = 0xcbb20d88; + public static class TL_forumTopic_layer147 extends TL_forumTopic { + public static final int constructor = 0x5920d6dc; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - via_mention = (flags & 2) != 0; - user_id = stream.readInt64(exception); + my = (flags & 2) != 0; + closed = (flags & 4) != 0; + pinned = (flags & 8) != 0; id = stream.readInt32(exception); + date = stream.readInt32(exception); + title = stream.readString(exception); + icon_color = stream.readInt32(exception); if ((flags & 1) != 0) { - storyItem = TL_stories.StoryItem.TLdeserialize(stream, stream.readInt32(exception), exception); + icon_emoji_id = stream.readInt64(exception); } - peer = new TL_peerUser(); - peer.user_id = user_id; + top_message = stream.readInt32(exception); + read_inbox_max_id = stream.readInt32(exception); + read_outbox_max_id = stream.readInt32(exception); + unread_count = stream.readInt32(exception); + unread_mentions_count = stream.readInt32(exception); + unread_reactions_count = stream.readInt32(exception); + from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { - if (storyItem != null) { - flags |= 1; - } else { - flags &= ~1; - } + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = via_mention ? (flags | 2) : (flags &~ 2); + flags = my ? (flags | 2) : (flags &~ 2); + flags = closed ? (flags | 4) : (flags &~ 4); + flags = pinned ? (flags | 8) : (flags &~ 8); stream.writeInt32(flags); - stream.writeInt64(peer.user_id); stream.writeInt32(id); + stream.writeInt32(date); + stream.writeString(title); + stream.writeInt32(icon_color); if ((flags & 1) != 0) { - storyItem.serializeToStream(stream); + stream.writeInt64(icon_emoji_id); } + stream.writeInt32(top_message); + stream.writeInt32(read_inbox_max_id); + stream.writeInt32(read_outbox_max_id); + stream.writeInt32(unread_count); + stream.writeInt32(unread_mentions_count); + stream.writeInt32(unread_reactions_count); + from_id.serializeToStream(stream); + notify_settings.serializeToStream(stream); } } - public static class TL_messages_webPage extends TLObject { - public static final int constructor = 0xfd5e12bd; - - public WebPage webpage; - public ArrayList chats; - public ArrayList users; + public static class TL_forumTopic extends ForumTopic { + public static final int constructor = 0x71701da9; - public static TL_messages_webPage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messages_webPage.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_webPage", constructor)); - } else { - return null; - } - } - TL_messages_webPage result = new TL_messages_webPage(); - result.readParams(stream, exception); - return result; - } + public int flags; + public boolean my; + public boolean closed; + public boolean pinned; + public boolean isShort; + public boolean hidden; + public int id; + public int date; + public String title; + public int icon_color; + public long icon_emoji_id; + public int top_message; + public int read_inbox_max_id; + public int read_outbox_max_id; + public int unread_count; + public int unread_mentions_count; + public int unread_reactions_count; + public Peer from_id; + public PeerNotifySettings notify_settings; + public DraftMessage draft; + public Message topicStartMessage; // custom + public ArrayList groupedMessages; // custom + public Message topMessage; // custom + public String searchQuery; //custom + public int pinnedOrder; // custom + public int totalMessagesCount; // custom - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - webpage = WebPage.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); + public static TL_forumTopic TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + TL_forumTopic result = null; + switch (constructor) { + case 0x23f109b: + result = new TL_forumTopicDeleted(); + break; + case 0x5920d6dc: + result = new TL_forumTopic_layer147(); + break; + case 0x71701da9: + result = new TL_forumTopic(); + break; } - } - - @Override - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - webpage.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_forumTopic", constructor)); } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); + if (result != null) { + result.readParams(stream, exception); } + return result; } - } - - public static class TL_messageActionGiftCode extends MessageAction { - public static final int constructor = 0x56d03994; - - public boolean via_giveaway; - public boolean unclaimed; - public Peer boost_peer; - public String slug; - public TL_textWithEntities message; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - via_giveaway = (flags & 1) != 0; - unclaimed = (flags & 4) != 0; - if ((flags & 2) != 0) { - boost_peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - months = stream.readInt32(exception); - slug = stream.readString(exception); - if ((flags & 4) != 0) { - currency = stream.readString(exception); - amount = stream.readInt64(exception); - } - if ((flags & 8) != 0) { - cryptoCurrency = stream.readString(exception); - cryptoAmount = stream.readInt64(exception); + my = (flags & 2) != 0; + closed = (flags & 4) != 0; + pinned = (flags & 8) != 0; + isShort = (flags & 32) != 0; + hidden = (flags & 64) != 0; + id = stream.readInt32(exception); + date = stream.readInt32(exception); + title = stream.readString(exception); + icon_color = stream.readInt32(exception); + if ((flags & 1) != 0) { + icon_emoji_id = stream.readInt64(exception); } + top_message = stream.readInt32(exception); + read_inbox_max_id = stream.readInt32(exception); + read_outbox_max_id = stream.readInt32(exception); + unread_count = stream.readInt32(exception); + unread_mentions_count = stream.readInt32(exception); + unread_reactions_count = stream.readInt32(exception); + from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 16) != 0) { - message = TL_textWithEntities.TLdeserialize(stream, stream.readInt32(exception), exception); + draft = DraftMessage.TLdeserialize(stream, stream.readInt32(exception), exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = via_giveaway ? (flags | 1) : (flags &~ 1); - flags = unclaimed ? (flags | 4) : (flags &~ 4); + flags = my ? (flags | 2) : (flags &~ 2); + flags = closed ? (flags | 4) : (flags &~ 4); + flags = pinned ? (flags | 8) : (flags &~ 8); + flags = isShort ? (flags | 32) : (flags &~ 32); + flags = hidden ? (flags | 64) : (flags &~ 64); stream.writeInt32(flags); - if ((flags & 2) != 0) { - boost_peer.serializeToStream(stream); - } - stream.writeInt32(months); - stream.writeString(slug); - if ((flags & 4) != 0) { - stream.writeString(currency); - stream.writeInt64(amount); - } - if ((flags & 8) != 0) { - stream.writeString(cryptoCurrency); - stream.writeInt64(cryptoAmount); + stream.writeInt32(id); + stream.writeInt32(date); + stream.writeString(title); + stream.writeInt32(icon_color); + if ((flags & 1) != 0) { + stream.writeInt64(icon_emoji_id); } + stream.writeInt32(top_message); + stream.writeInt32(read_inbox_max_id); + stream.writeInt32(read_outbox_max_id); + stream.writeInt32(unread_count); + stream.writeInt32(unread_mentions_count); + stream.writeInt32(unread_reactions_count); + from_id.serializeToStream(stream); + notify_settings.serializeToStream(stream); if ((flags & 16) != 0) { - message.serializeToStream(stream); + draft.serializeToStream(stream); } } } - public static class TL_messageActionGiftCode_layer189 extends TL_messageActionGiftCode { - public static final int constructor = 0x678c2e09; + public static class TL_messages_forumTopics extends TLObject { + public static final int constructor = 0x367617d3; - public boolean via_giveaway; - public boolean unclaimed; - public Peer boost_peer; - public String slug; + public int flags; + public boolean order_by_create_date; + public int count; + public ArrayList topics = new ArrayList<>(); + public ArrayList messages = new ArrayList<>(); + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + public int pts; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - via_giveaway = (flags & 1) != 0; - unclaimed = (flags & 4) != 0; - if ((flags & 2) != 0) { - boost_peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - months = stream.readInt32(exception); - slug = stream.readString(exception); - if ((flags & 4) != 0) { - currency = stream.readString(exception); - } - if ((flags & 4) != 0) { - amount = stream.readInt64(exception); - } - if ((flags & 8) != 0) { - cryptoCurrency = stream.readString(exception); - } - if ((flags & 8) != 0) { - cryptoAmount = stream.readInt64(exception); + public static TL_messages_forumTopics TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_messages_forumTopics.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_forumTopics", constructor)); + } else { + return null; + } } + TL_messages_forumTopics result = new TL_messages_forumTopics(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + order_by_create_date = (flags & 1) != 0; + count = stream.readInt32(exception); + topics = Vector.deserialize(stream, TL_forumTopic::TLdeserialize, exception); + messages = Vector.deserialize(stream, Message::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); + pts = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = via_giveaway ? (flags | 1) : (flags &~ 1); - flags = unclaimed ? (flags | 4) : (flags &~ 4); + flags = order_by_create_date ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); - if ((flags & 2) != 0) { - boost_peer.serializeToStream(stream); - } - stream.writeInt32(months); - stream.writeString(slug); - if ((flags & 4) != 0) { - stream.writeString(currency); - } - if ((flags & 4) != 0) { - stream.writeInt64(amount); - } - if ((flags & 8) != 0) { - stream.writeString(cryptoCurrency); - } - if ((flags & 8) != 0) { - stream.writeInt64(cryptoAmount); - } + stream.writeInt32(count); + Vector.serialize(stream, topics); + Vector.serialize(stream, messages); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); + stream.writeInt32(pts); } } - public static class TL_messageActionGiftCode_layer167 extends TL_messageActionGiftCode { - public static final int constructor = 0xd2cfdb0e; + public static class TL_channels_toggleForum extends TLObject { + public static final int constructor = 0xa4298b29; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - via_giveaway = (flags & 1) != 0; - unclaimed = (flags & 4) != 0; - if ((flags & 2) != 0) { - boost_peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - months = stream.readInt32(exception); - slug = stream.readString(exception); + public InputChannel channel; + public boolean enabled; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = via_giveaway ? (flags | 1) : (flags &~ 1); - flags = unclaimed ? (flags | 4) : (flags &~ 4); - stream.writeInt32(flags); - if ((flags & 2) != 0) { - boost_peer.serializeToStream(stream); - } - stream.writeInt32(months); - stream.writeString(slug); + channel.serializeToStream(stream); + stream.writeBool(enabled); } } - public static class TL_inputStorePaymentPremiumGiftCode extends InputStorePaymentPurpose { - public static final int constructor = 0xfb790393; + public static class TL_channels_createForumTopic extends TLObject { + public static final int constructor = 0xf40c0224; public int flags; - public ArrayList users = new ArrayList<>(); - public InputPeer boost_peer; - public String currency; - public long amount; - public TL_textWithEntities message; + public InputChannel channel; + public String title; + public int icon_color; + public long icon_emoji_id; + public long random_id; + public InputPeer send_as; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputUser object = InputUser.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } - if ((flags & 1) != 0) { - boost_peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - currency = stream.readString(exception); - amount = stream.readInt64(exception); - if ((flags & 2) != 0) { - message = TL_textWithEntities.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + channel.serializeToStream(stream); + stream.writeString(title); if ((flags & 1) != 0) { - boost_peer.serializeToStream(stream); + stream.writeInt32(icon_color); } - stream.writeString(currency); - stream.writeInt64(amount); - if ((flags & 2) != 0) { - message.serializeToStream(stream); + if ((flags & 8) != 0) { + stream.writeInt64(icon_emoji_id); + } + stream.writeInt64(random_id); + if ((flags & 4) != 0) { + send_as.serializeToStream(stream); } } } - public static class TL_inputStorePaymentPremiumGiveaway extends InputStorePaymentPurpose { - public static final int constructor = 0x160544ca; + public static class TL_channels_editForumTopic extends TLObject { + public static final int constructor = 0xf4dfa185; public int flags; - public boolean only_new_subscribers; - public boolean winners_are_visible; - public InputPeer boost_peer; - public ArrayList additional_peers = new ArrayList<>(); - public ArrayList countries_iso2 = new ArrayList<>(); - public String prize_description; - public long random_id; - public int until_date; - public String currency; - public long amount; + public InputChannel channel; + public int topic_id; + public String title; + public long icon_emoji_id; + public boolean closed; + public boolean hidden; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - only_new_subscribers = (flags & 1) != 0; - winners_are_visible = (flags & 8) != 0; - boost_peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputPeer object = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - additional_peers.add(object); - } - } - if ((flags & 4) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - countries_iso2.add(stream.readString(exception)); - } - } - if ((flags & 16) != 0) { - prize_description = stream.readString(exception); - } - random_id = stream.readInt64(exception); - until_date = stream.readInt32(exception); - currency = stream.readString(exception); - amount = stream.readInt64(exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = only_new_subscribers ? (flags | 1) : (flags &~ 1); - flags = winners_are_visible ? (flags | 8) : (flags &~ 8); stream.writeInt32(flags); - boost_peer.serializeToStream(stream); + channel.serializeToStream(stream); + stream.writeInt32(topic_id); + if ((flags & 1) != 0) { + stream.writeString(title); + } if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = additional_peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - additional_peers.get(a).serializeToStream(stream); - } + stream.writeInt64(icon_emoji_id); } if ((flags & 4) != 0) { - stream.writeInt32(0x1cb5c415); - int count = countries_iso2.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(countries_iso2.get(a)); - } + stream.writeBool(closed); } - if ((flags & 16) != 0) { - stream.writeString(prize_description); + if ((flags & 8) != 0) { + stream.writeBool(hidden); } - stream.writeInt64(random_id); - stream.writeInt32(until_date); - stream.writeString(currency); - stream.writeInt64(amount); } } - public static class TL_inputStorePaymentStarsTopup extends InputStorePaymentPurpose { - public static final int constructor = 0xdddd0f56; + public static class TL_channels_updatePinnedForumTopic extends TLObject { + public static final int constructor = 0x6c2d9026; - public long stars; - public String currency; - public long amount; + public InputChannel channel; + public int topic_id; + public boolean pinned; - public void readParams(AbstractSerializedData stream, boolean exception) { - stars = stream.readInt64(exception); - currency = stream.readString(exception); - amount = stream.readInt64(exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(stars); - stream.writeString(currency); - stream.writeInt64(amount); + channel.serializeToStream(stream); + stream.writeInt32(topic_id); + stream.writeBool(pinned); } } - public static class TL_inputStorePaymentStarsGiveaway extends InputStorePaymentPurpose { - public static final int constructor = 0x751f08fa; + public static class TL_channels_getForumTopics extends TLObject { + public static final int constructor = 0xde560d1; public int flags; - public boolean only_new_subscribers; - public boolean winners_are_visible; - public long stars; - public InputPeer boost_peer; - public ArrayList additional_peers = new ArrayList<>(); - public ArrayList countries_iso2 = new ArrayList<>(); - public String prize_description; - public long random_id; - public int until_date; - public String currency; - public long amount; - public int users; + public InputChannel channel; + public String q; + public int offset_date; + public int offset_id; + public int offset_topic; + public int limit; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - only_new_subscribers = (flags & 1) != 0; - winners_are_visible = (flags & 8) != 0; - stars = stream.readInt64(exception); - boost_peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InputPeer object = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - additional_peers.add(object); - } - } - if ((flags & 4) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - countries_iso2.add(stream.readString(exception)); - } - } - if ((flags & 16) != 0) { - prize_description = stream.readString(exception); - } - random_id = stream.readInt64(exception); - until_date = stream.readInt32(exception); - currency = stream.readString(exception); - amount = stream.readInt64(exception); - users = stream.readInt32(exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_forumTopics.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = only_new_subscribers ? (flags | 1) : (flags &~ 1); - flags = winners_are_visible ? (flags | 8) : (flags &~ 8); stream.writeInt32(flags); - stream.writeInt64(stars); - boost_peer.serializeToStream(stream); - if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = additional_peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - additional_peers.get(a).serializeToStream(stream); - } + channel.serializeToStream(stream); + if ((flags & 1) != 0) { + stream.writeString(q); } - if ((flags & 4) != 0) { - stream.writeInt32(0x1cb5c415); - int count = countries_iso2.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(countries_iso2.get(a)); + stream.writeInt32(offset_date); + stream.writeInt32(offset_id); + stream.writeInt32(offset_topic); + stream.writeInt32(limit); + } + } + + public static class TL_channels_getForumTopicsByID extends TLObject { + public static final int constructor = 0xb0831eb9; + + public InputChannel channel; + public ArrayList topics = new ArrayList<>(); + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_forumTopics.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + channel.serializeToStream(stream); + Vector.serializeInt(stream, topics); + } + } + + public static class TL_username extends TLObject { + public static final int constructor = 0xb4073647; + + public int flags; + public boolean editable; + public boolean active; + public String username; + + public static TL_username TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_username.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_username", constructor)); + } else { + return null; } } - if ((flags & 16) != 0) { - stream.writeString(prize_description); - } - stream.writeInt64(random_id); - stream.writeInt32(until_date); - stream.writeString(currency); - stream.writeInt64(amount); - stream.writeInt32(users); + TL_username result = new TL_username(); + result.readParams(stream, exception); + return result; } - } - public static class TL_inputStorePaymentStarsGift extends InputStorePaymentPurpose { - public static final int constructor = 0x1d741ef7; + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + editable = (flags & 1) != 0; + active = (flags & 2) != 0; + username = stream.readString(exception); + } - public InputUser user_id; - public long stars; - public String currency; - public long amount; + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = editable ? (flags | 1) : (flags &~ 1); + flags = active ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + stream.writeString(username); + } + } + public static class TL_channels_deleteTopicHistory extends TLObject { + public static final int constructor = 0x34435f2d; - public void readParams(AbstractSerializedData stream, boolean exception) { - user_id = InputUser.TLdeserialize(stream, stream.readInt32(exception), exception); - stars = stream.readInt64(exception); - currency = stream.readString(exception); - amount = stream.readInt64(exception); + public InputChannel channel; + public int top_msg_id; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_messages_affectedHistory.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - user_id.serializeToStream(stream); - stream.writeInt64(stars); - stream.writeString(currency); - stream.writeInt64(amount); + channel.serializeToStream(stream); + stream.writeInt32(top_msg_id); } } - public static class TL_inputInvoicePremiumGiftCode extends InputInvoice { - public static final int constructor = 0x98986c0d; + public static class TL_channels_setEmojiStickers extends TLObject { + public static final int constructor = 0x3cd930b7; - public InputStorePaymentPurpose purpose; - public TL_premiumGiftCodeOption option; + public InputChannel channel; + public InputStickerSet stickerset; - public void readParams(AbstractSerializedData stream, boolean exception) { - purpose = InputStorePaymentPurpose.TLdeserialize(stream, stream.readInt32(exception), exception); - option = TL_premiumGiftCodeOption.TLdeserialize(stream, stream.readInt32(exception), exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - purpose.serializeToStream(stream); - option.serializeToStream(stream); + channel.serializeToStream(stream); + stickerset.serializeToStream(stream); } } - public static class TL_inputInvoiceStars extends InputInvoice { - public static final int constructor = 0x65f00ce3; + public static class TL_channels_setBoostsToUnblockRestrictions extends TLObject { + public static final int constructor = 0xad399cee; - public InputStorePaymentPurpose purpose; + public InputChannel channel; + public int boosts; - public void readParams(AbstractSerializedData stream, boolean exception) { - purpose = InputStorePaymentPurpose.TLdeserialize(stream, stream.readInt32(exception), exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - purpose.serializeToStream(stream); + channel.serializeToStream(stream); + stream.writeInt32(boosts); } } - public static class TL_inputInvoiceChatInviteSubscription extends InputInvoice { - public static final int constructor = 0x34e793f1; + public static class TL_channels_reorderUsernames extends TLObject { + public static final int constructor = 0xb45ced1d; - public String hash; + public InputChannel channel; + public ArrayList order = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { - hash = stream.readString(exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(hash); + channel.serializeToStream(stream); + Vector.serializeString(stream, order); } } - public static class TL_inputInvoiceStarGift extends InputInvoice { - public static final int constructor = 0x25d8c1d8; + public static class TL_channels_toggleUsername extends TLObject { + public static final int constructor = 0x50f24105; - public int flags; - public boolean hide_name; - public InputPeer user_id; - public long gift_id; - public TL_textWithEntities message; + public InputChannel channel; + public String username; + public boolean active; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - hide_name = (flags & 1) != 0; - user_id = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); - gift_id = stream.readInt64(exception); - if ((flags & 2) != 0) { - message = TL_textWithEntities.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = hide_name ? flags | 1 : flags &~ 1; - stream.writeInt32(flags); - user_id.serializeToStream(stream); - stream.writeInt64(gift_id); - if ((flags & 2) != 0) { - message.serializeToStream(stream); - } + channel.serializeToStream(stream); + stream.writeString(username); + stream.writeBool(active); } } - public static class TL_messageMediaGiveawayResults extends MessageMedia { - public static final int constructor = 0xceaa3ea1; + public static class TL_channels_deactivateAllUsernames extends TLObject { + public static final int constructor = 0xa245dd3; - public boolean only_new_subscribers; - public boolean refunded; - public long channel_id; - public int additional_peers_count; - public int launch_msg_id; - public int winners_count; - public int unclaimed_count; - public ArrayList winners = new ArrayList<>(); - public int months; - public long stars; - public String prize_description; - public int until_date; + public InputChannel channel; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - only_new_subscribers = (flags & 1) != 0; - refunded = (flags & 4) != 0; - channel_id = stream.readInt64(exception); - if ((flags & 8) != 0) { - additional_peers_count = stream.readInt32(exception); - } - launch_msg_id = stream.readInt32(exception); - winners_count = stream.readInt32(exception); - unclaimed_count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - winners.add(stream.readInt64(exception)); - } - if ((flags & 16) != 0) { - months = stream.readInt32(exception); - } - if ((flags & 32) != 0) { - stars = stream.readInt64(exception); - } - if ((flags & 2) != 0) { - prize_description = stream.readString(exception); - } - until_date = stream.readInt32(exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = only_new_subscribers ? (flags | 1) : (flags &~ 1); - flags = refunded ? (flags | 4) : (flags &~ 4); - stream.writeInt32(flags); - stream.writeInt64(channel_id); - if ((flags & 8) != 0) { - stream.writeInt32(additional_peers_count); - } - stream.writeInt32(launch_msg_id); - stream.writeInt32(winners_count); - stream.writeInt32(unclaimed_count); - stream.writeInt32(0x1cb5c415); - int count = winners.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(winners.get(a)); - } - if ((flags & 16) != 0) { - stream.writeInt32(months); - } - if ((flags & 32) != 0) { - stream.writeInt64(stars); - } - if ((flags & 2) != 0) { - stream.writeString(prize_description); - } - stream.writeInt32(until_date); + channel.serializeToStream(stream); } } - public static class TL_messageMediaGiveawayResults_layer186 extends TL_messageMediaGiveawayResults { - public static final int constructor = 0xc6991068; + public static class TL_channels_reorderPinnedForumTopics extends TLObject { + public static final int constructor = 0x2950a18f; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - only_new_subscribers = (flags & 1) != 0; - refunded = (flags & 4) != 0; - channel_id = stream.readInt64(exception); - if ((flags & 8) != 0) { - additional_peers_count = stream.readInt32(exception); - } - launch_msg_id = stream.readInt32(exception); - winners_count = stream.readInt32(exception); - unclaimed_count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - winners.add(stream.readInt64(exception)); - } - months = stream.readInt32(exception); - if ((flags & 2) != 0) { - prize_description = stream.readString(exception); - } - until_date = stream.readInt32(exception); + public int flags; + public boolean force; + public InputChannel channel; + public ArrayList order = new ArrayList<>(); + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = only_new_subscribers ? (flags | 1) : (flags &~ 1); - flags = refunded ? (flags | 4) : (flags &~ 4); + flags = force ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); - stream.writeInt64(channel_id); - if ((flags & 8) != 0) { - stream.writeInt32(additional_peers_count); - } - stream.writeInt32(launch_msg_id); - stream.writeInt32(winners_count); - stream.writeInt32(unclaimed_count); - stream.writeInt32(0x1cb5c415); - int count = winners.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(winners.get(a)); - } - stream.writeInt32(months); - if ((flags & 2) != 0) { - stream.writeString(prize_description); - } - stream.writeInt32(until_date); + channel.serializeToStream(stream); + Vector.serializeInt(stream, order); } } - public static class TL_messageMediaGiveaway extends MessageMedia { - public static final int constructor = 0xaa073beb; + public static class TL_channels_toggleAntiSpam extends TLObject { + public static final int constructor = 0x68f3e4eb; - public boolean only_new_subscribers; - public boolean winners_are_visible; - public ArrayList channels = new ArrayList<>(); - public ArrayList countries_iso2 = new ArrayList<>(); - public String prize_description; - public int quantity; - public int months; - public long stars; - public int until_date; + public InputChannel channel; + public boolean enabled; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - only_new_subscribers = (flags & 1) != 0; - winners_are_visible = (flags & 4) != 0; - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - channels.add(stream.readInt64(exception)); - } - if ((flags & 2) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - countries_iso2.add(stream.readString(exception)); - } - } - if ((flags & 8) != 0) { - prize_description = stream.readString(exception); - } - quantity = stream.readInt32(exception); - if ((flags & 16) != 0) { - months = stream.readInt32(exception); - } - if ((flags & 32) != 0) { - stars = stream.readInt64(exception); - } - until_date = stream.readInt32(exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = only_new_subscribers ? (flags | 1) : (flags &~ 1); - flags = winners_are_visible ? (flags | 4) : (flags &~ 4); - stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = channels.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(channels.get(a)); - } - if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - count = countries_iso2.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(countries_iso2.get(a)); - } - } - if ((flags & 8) != 0) { - stream.writeString(prize_description); - } - stream.writeInt32(quantity); - if ((flags & 16) != 0) { - stream.writeInt32(months); - } - if ((flags & 32) != 0) { - stream.writeInt64(stars); - } - stream.writeInt32(until_date); + channel.serializeToStream(stream); + stream.writeBool(enabled); } } - public static class TL_messageMediaGiveaway_layer186 extends TL_messageMediaGiveaway { - public static final int constructor = 0xdaad85b0; + public static class TL_channels_reportAntiSpamFalsePositive extends TLObject { + public static final int constructor = 0xa850a693; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - only_new_subscribers = (flags & 1) != 0; - winners_are_visible = (flags & 4) != 0; - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - channels.add(stream.readInt64(exception)); - } - if ((flags & 2) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - countries_iso2.add(stream.readString(exception)); - } - } - if ((flags & 8) != 0) { - prize_description = stream.readString(exception); - } - quantity = stream.readInt32(exception); - months = stream.readInt32(exception); - until_date = stream.readInt32(exception); + public InputChannel channel; + public int msg_id; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + channel.serializeToStream(stream); + stream.writeInt32(msg_id); + } + } + + public static class TL_channels_toggleParticipantsHidden extends TLObject { + public static final int constructor = 0x6a6e7854; + + public InputChannel channel; + public boolean enabled; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = only_new_subscribers ? (flags | 1) : (flags &~ 1); - flags = winners_are_visible ? (flags | 4) : (flags &~ 4); - stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = channels.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(channels.get(a)); - } - if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - count = countries_iso2.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(countries_iso2.get(a)); - } - } - if ((flags & 8) != 0) { - stream.writeString(prize_description); - } - stream.writeInt32(quantity); - stream.writeInt32(months); - stream.writeInt32(until_date); + channel.serializeToStream(stream); + stream.writeBool(enabled); } } - public static class TL_messageMediaGiveaway_layer167 extends TL_messageMediaGiveaway { - public static final int constructor = 0x58260664; + public static class TL_messages_clickSponsoredMessage extends TLObject { + public static final int constructor = 0xf093465; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - only_new_subscribers = (flags & 1) != 0; - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - channels.add(stream.readInt64(exception)); - } - if ((flags & 2) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - countries_iso2.add(stream.readString(exception)); - } - } - quantity = stream.readInt32(exception); - months = stream.readInt32(exception); - until_date = stream.readInt32(exception); + public int flags; + public boolean media; + public boolean fullscreen; + public InputPeer peer; + public byte[] random_id; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = only_new_subscribers ? (flags | 1) : (flags &~ 1); + flags = media ? flags | 1 : flags &~ 1; + flags = fullscreen ? flags | 2 : flags &~ 2; stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = channels.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(channels.get(a)); - } - if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - count = countries_iso2.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(countries_iso2.get(a)); - } - } - stream.writeInt32(quantity); - stream.writeInt32(months); - stream.writeInt32(until_date); + peer.serializeToStream(stream); + stream.writeByteArray(random_id); } } - public static class TL_messageMediaPaidMedia extends MessageMedia { - public static final int constructor = 0xa8852491; + public static class TL_messages_setDefaultHistoryTTL extends TLObject { + public static final int constructor = 0x9eb51445; - public void readParams(AbstractSerializedData stream, boolean exception) { - stars_amount = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageExtendedMedia object = MessageExtendedMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) continue; - extended_media.add(object); - } + public int period; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(stars_amount); - stream.writeInt32(0x1cb5c415); - int count = extended_media.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - extended_media.get(a).serializeToStream(stream); - } + stream.writeInt32(period); } } - public static class TL_premiumGiftCodeOption extends TLObject { - public static final int constructor = 0x257e962b; + public static class TL_messages_getDefaultHistoryTTL extends TLObject { + public static final int constructor = 0x658b7188; - public int flags; - public int users; - public int months; - public String store_product; - public int store_quantity; - public String currency; - public long amount; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_defaultHistoryTTL.TLdeserialize(stream, constructor, exception); + } - public static TL_premiumGiftCodeOption TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_premiumGiftCodeOption.constructor != constructor) { + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_defaultHistoryTTL extends TLObject { + public static final int constructor = 0x43b46b20; + + public int period; + + public static TL_defaultHistoryTTL TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_defaultHistoryTTL.constructor != constructor) { if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_premiumGiftCodeOption", constructor)); + throw new RuntimeException(String.format("can't parse magic %x in TL_defaultHistoryTTL", constructor)); } else { return null; } } - TL_premiumGiftCodeOption result = new TL_premiumGiftCodeOption(); + TL_defaultHistoryTTL result = new TL_defaultHistoryTTL(); result.readParams(stream, exception); return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - users = stream.readInt32(exception); - months = stream.readInt32(exception); - if ((flags & 1) != 0) { - store_product = stream.readString(exception); - } - if ((flags & 2) != 0) { - store_quantity = stream.readInt32(exception); - } - currency = stream.readString(exception); - amount = stream.readInt64(exception); + public void readParams(InputSerializedData stream, boolean exception) { + period = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeInt32(users); - stream.writeInt32(months); - if ((flags & 1) != 0) { - stream.writeString(store_product); - } - if ((flags & 2) != 0) { - stream.writeInt32(store_quantity); - } - stream.writeString(currency); - stream.writeInt64(amount); + stream.writeInt32(period); } } - public static class TL_payments_getPremiumGiftCodeOptions extends TLObject { - public static final int constructor = 0x2757ba54; + public static class TL_messages_sendBotRequestedPeer extends TLObject { + public static final int constructor = 0x91b2d060; - public int flags; - public InputPeer boost_peer; + public InputPeer peer; + public int msg_id; + public int button_id; + public ArrayList requested_peers = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_premiumGiftCodeOption object = TL_premiumGiftCodeOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - boost_peer.serializeToStream(stream); - } + peer.serializeToStream(stream); + stream.writeInt32(msg_id); + stream.writeInt32(button_id); + Vector.serialize(stream, requested_peers); } } - public static class TL_payments_checkGiftCode extends TLObject { - public static final int constructor = 0x8e51b4c1; + public static class TL_contacts_exportContactToken extends TLObject { + public static final int constructor = 0xf8654027; - public String slug; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_exportedContactToken.TLdeserialize(stream, constructor, exception); + } - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_payments_checkedGiftCode.TLdeserialize(stream, constructor, exception); + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_contacts_importContactToken extends TLObject { + public static final int constructor = 0x13005788; + + public String token; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return User.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(slug); + stream.writeString(token); } } - public static class TL_payments_applyGiftCode extends TLObject { - public static final int constructor = 0xf6e26854; + public static class TL_messageActionSuggestProfilePhoto extends MessageAction { + public static final int constructor = 0x57de635e; - public String slug; + public void readParams(InputSerializedData stream, boolean exception) { + photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + photo.serializeToStream(stream); + } + } + + public static class TL_messageActionAttachMenuBotAllowed extends MessageAction { + public static final int constructor = 0xe7e75f97; + + public void readParams(InputSerializedData stream, boolean exception) { } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(slug); } } - public static class TL_payments_giveawayInfoResults extends payments_GiveawayInfo { - public static final int constructor = 0xe175e66f; + public static class TL_messageActionRequestedPeer_layer168 extends TL_messageActionRequestedPeer { + public static final int constructor = 0xfe77345d; - public int flags; - public boolean winner; - public boolean refunded; - public int start_date; - public String gift_code_slug; - public long stars_prize; - public int finish_date; - public int winners_count; - public int activated_count; + public TLRPC.Peer peer; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - winner = (flags & 1) != 0; - refunded = (flags & 2) != 0; - start_date = stream.readInt32(exception); - if ((flags & 8) != 0) { - gift_code_slug = stream.readString(exception); - } - if ((flags & 16) != 0) { - stars_prize = stream.readInt64(exception); - } - finish_date = stream.readInt32(exception); - winners_count = stream.readInt32(exception); - if ((flags & 4) != 0) { - activated_count = stream.readInt32(exception); + public void readParams(InputSerializedData stream, boolean exception) { + button_id = stream.readInt32(exception); + peer = TLRPC.Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if (peer == null) { + return; } + peers.add(peer); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = winner ? (flags | 1) : (flags &~ 1); - flags = refunded ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - stream.writeInt32(start_date); - if ((flags & 1) != 0) { - stream.writeString(gift_code_slug); - } - if ((flags & 1) != 0) { - stream.writeInt64(stars_prize); - } - stream.writeInt32(finish_date); - stream.writeInt32(winners_count); - if ((flags & 4) != 0) { - stream.writeInt32(activated_count); - } + stream.writeInt32(button_id); + peer.serializeToStream(stream); } } - public static class TL_payments_giveawayInfoResults_layer186 extends TL_payments_giveawayInfoResults { - public static final int constructor = 0xcd5570; + public static class TL_messageActionRequestedPeer extends MessageAction { + public static final int constructor = 0x31518e9b; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - winner = (flags & 1) != 0; - refunded = (flags & 2) != 0; - start_date = stream.readInt32(exception); - if ((flags & 1) != 0) { - gift_code_slug = stream.readString(exception); - } - finish_date = stream.readInt32(exception); - winners_count = stream.readInt32(exception); - activated_count = stream.readInt32(exception); + public int button_id; + public ArrayList peers = new ArrayList<>(); + + public void readParams(InputSerializedData stream, boolean exception) { + button_id = stream.readInt32(exception); + peers = Vector.deserialize(stream, Peer::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = winner ? (flags | 1) : (flags &~ 1); - flags = refunded ? (flags | 2) : (flags &~ 2); - stream.writeInt32(flags); - stream.writeInt32(start_date); - if ((flags & 1) != 0) { - stream.writeString(gift_code_slug); - } - stream.writeInt32(finish_date); - stream.writeInt32(winners_count); - stream.writeInt32(activated_count); + stream.writeInt32(button_id); + Vector.serialize(stream, peers); } } - public static class TL_payments_giveawayInfo extends payments_GiveawayInfo { - public static final int constructor = 0x4367daa0; + public static class TL_photos_uploadContactProfilePhoto extends TLObject { + public static final int constructor = 0xe14c4a71; public int flags; - public boolean participating; - public boolean preparing_results; - public int start_date; - public int joined_too_early_date; - public long admin_disallowed_chat_id; - public String disallowed_country; + public boolean suggest; + public boolean save; + public InputUser user_id; + public InputFile file; + public InputFile video; + public double video_start_ts; + public VideoSize video_emoji_markup; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - participating = (flags & 1) != 0; - preparing_results = (flags & 8) != 0; - start_date = stream.readInt32(exception); - if ((flags & 2) != 0) { - joined_too_early_date = stream.readInt32(exception); - } - if ((flags & 4) != 0) { - admin_disallowed_chat_id = stream.readInt64(exception); - } - if ((flags & 16) != 0) { - disallowed_country = stream.readString(exception); - } + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_photos_photo.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = participating ? (flags | 1) : (flags &~ 1); - flags = preparing_results ? (flags | 8) : (flags &~ 8); + flags = suggest ? (flags | 8) : (flags &~ 8); + flags = save ? (flags | 16) : (flags &~ 16); stream.writeInt32(flags); - stream.writeInt32(start_date); + user_id.serializeToStream(stream); + if ((flags & 1) != 0) { + file.serializeToStream(stream); + } if ((flags & 2) != 0) { - stream.writeInt32(joined_too_early_date); + video.serializeToStream(stream); } if ((flags & 4) != 0) { - stream.writeInt64(admin_disallowed_chat_id); + stream.writeDouble(video_start_ts); } - if ((flags & 16) != 0) { - stream.writeString(disallowed_country); + if ((flags & 32) != 0) { + video_emoji_markup.serializeToStream(stream); } } } - public static abstract class payments_GiveawayInfo extends TLObject { + public static abstract class EmojiList extends TLObject { - public static payments_GiveawayInfo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - payments_GiveawayInfo result = null; + public static EmojiList TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + EmojiList result = null; switch (constructor) { - case TL_payments_giveawayInfoResults.constructor: - result = new TL_payments_giveawayInfoResults(); - break; - case TL_payments_giveawayInfoResults_layer186.constructor: - result = new TL_payments_giveawayInfoResults_layer186(); + case 0x7a1e11d1: + result = new TL_emojiList(); break; - case TL_payments_giveawayInfo.constructor: - result = new TL_payments_giveawayInfo(); + case 0x481eadfa: + result = new TL_emojiListNotModified(); break; } if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in payments_GiveawayInfo", constructor)); + throw new RuntimeException(String.format("can't parse magic %x in EmojiList", constructor)); } if (result != null) { result.readParams(stream, exception); @@ -80273,1461 +65035,1662 @@ public static payments_GiveawayInfo TLdeserialize(AbstractSerializedData stream, } } - public static class TL_payments_getGiveawayInfo extends TLObject { - public static final int constructor = 0xf4239425; + public static class TL_emojiList extends EmojiList { + public static final int constructor = 0x7a1e11d1; - public InputPeer peer; - public int msg_id; + public long hash; + public ArrayList document_id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return payments_GiveawayInfo.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + hash = stream.readInt64(exception); + document_id = Vector.deserializeLong(stream, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(msg_id); + stream.writeInt64(hash); + Vector.serializeLong(stream, document_id); } } - public static class TL_payments_checkedGiftCode extends TLObject { - public static final int constructor = 0x284a1096; - public static final long NO_USER_ID = -1L; //custom + public static class TL_emojiListNotModified extends EmojiList { + public static final int constructor = 0x481eadfa; + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_channels_updateColor extends TLObject { + public static final int constructor = 0xd8aa3671; public int flags; - public boolean via_giveaway; - public Peer from_id; - public int giveaway_msg_id; - public long to_id = NO_USER_ID; - public int date; - public int months; - public int used_date; - public TL_stories.Boost boost; //custom - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); + public boolean for_profile; + public InputChannel channel; + public int color; + public long background_emoji_id; - public static TL_payments_checkedGiftCode TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_payments_checkedGiftCode.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_payments_checkedGiftCode", constructor)); - } else { - return null; - } - } - TL_payments_checkedGiftCode result = new TL_payments_checkedGiftCode(); - result.readParams(stream, exception); - return result; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - via_giveaway = (flags & 4) != 0; - if ((flags & 16) != 0) { - from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 8) != 0) { - giveaway_msg_id = stream.readInt32(exception); + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = for_profile ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + channel.serializeToStream(stream); + if ((flags & 4) != 0) { + stream.writeInt32(color); } if ((flags & 1) != 0) { - to_id = stream.readInt64(exception); - } - date = stream.readInt32(exception); - months = stream.readInt32(exception); - if ((flags & 2) != 0) { - used_date = stream.readInt32(exception); - } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); + stream.writeInt64(background_emoji_id); } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + } + } + + public static class TL_updateChannelViewForumAsMessages extends Update { + public static final int constructor = 0x7b68920; + + public long channel_id; + public boolean enabled; + + public void readParams(InputSerializedData stream, boolean exception) { + channel_id = stream.readInt64(exception); + enabled = stream.readBool(exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(channel_id); + stream.writeBool(enabled); + } + } + + public static class TL_updatePinnedSavedDialogs extends Update { + public static final int constructor = 0x686c85a6; + + public int flags; + public ArrayList order = new ArrayList<>(); + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + if ((flags & 1) != 0) { + order = Vector.deserialize(stream, DialogPeer::TLdeserialize, exception); } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + Vector.serialize(stream, order); } } + } + + public static class TL_updateQuickReplies extends Update { + public static final int constructor = 0xf9470ab2; + + public ArrayList quick_replies = new ArrayList<>(); + + public void readParams(InputSerializedData stream, boolean exception) { + quick_replies = Vector.deserialize(stream, TL_quickReply::TLdeserialize, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + Vector.serialize(stream, quick_replies); + } + } + + public static class TL_updateNewQuickReply extends Update { + public static final int constructor = 0xf53da717; + + public TL_quickReply quick_reply; + + public void readParams(InputSerializedData stream, boolean exception) { + quick_reply = TL_quickReply.TLdeserialize(stream, stream.readInt32(exception), exception); + } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = via_giveaway ? (flags | 4) : (flags & ~4); - stream.writeInt32(flags); - if ((flags & 16) != 0) { - from_id.serializeToStream(stream); - } - if ((flags & 8) != 0) { - stream.writeInt32(giveaway_msg_id); - } - if ((flags & 1) != 0) { - stream.writeInt64(to_id); - } - stream.writeInt32(date); - stream.writeInt32(months); - if ((flags & 2) != 0) { - stream.writeInt32(used_date); - } - stream.writeInt32(0x1cb5c415); - int count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + quick_reply.serializeToStream(stream); } } - public static class TL_payments_launchPrepaidGiveaway extends TLObject { - public static final int constructor = 0x5ff58f20; + public static class TL_updateDeleteQuickReply extends Update { + public static final int constructor = 0x53e6f1ec; - public InputPeer peer; - public long giveaway_id; - public InputStorePaymentPurpose purpose; + public int shortcut_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + shortcut_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt64(giveaway_id); - purpose.serializeToStream(stream); + stream.writeInt32(shortcut_id); } } - public static class TL_messageActionGiveawayLaunch extends MessageAction { - public static final int constructor = 0xa80f51e4; + public static class TL_updateQuickReplyMessage extends Update { + public static final int constructor = 0x3e050d0f; - public int flags; - public long stars; + public Message message; - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - if ((flags & 1) != 0) { - stars = stream.readInt64(exception); - } + public void readParams(InputSerializedData stream, boolean exception) { + message = Message.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - stream.writeInt64(stars); - } + message.serializeToStream(stream); } } - public static class TL_messageActionGiveawayLaunch_layer186 extends TL_messageActionGiveawayLaunch { - public static final int constructor = 0x332ba9ed; + public static class TL_updateDeleteQuickReplyMessages extends Update { + public static final int constructor = 0x566fe7cd; + + public int shortcut_id; + public ArrayList messages = new ArrayList<>(); + + public void readParams(InputSerializedData stream, boolean exception) { + shortcut_id = stream.readInt32(exception); + messages = Vector.deserializeInt(stream, exception); + } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + stream.writeInt32(shortcut_id); + Vector.serializeInt(stream, messages); } } - public static class TL_messageActionGiveawayResults extends MessageAction { - public static final int constructor = 0x87e2f155; + public static class TL_updateNewStoryReaction extends Update { + public static final int constructor = 0x1824e40b; - public int flags; - public boolean stars; - public int winners_count; - public int unclaimed_count; + public int story_id; + public Peer peer; + public Reaction reaction; - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - stars = (flags & 1) != 0; - winners_count = stream.readInt32(exception); - unclaimed_count = stream.readInt32(exception); + public void readParams(InputSerializedData stream, boolean exception) { + story_id = stream.readInt32(exception); + peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + reaction = Reaction.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = stars ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeInt32(winners_count); - stream.writeInt32(unclaimed_count); + stream.writeInt32(story_id); + peer.serializeToStream(stream); + reaction.serializeToStream(stream); } } - public static class TL_messageActionGiveawayResults_layer186 extends TL_messageActionGiveawayResults { - public static final int constructor = 0x2a9fadc5; + public static class TL_updateBroadcastRevenueTransactions extends Update { + public static final int constructor = 0xdfd961f5; - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - winners_count = stream.readInt32(exception); - unclaimed_count = stream.readInt32(exception); + public Peer peer; + public BroadcastRevenueBalances balances; + + public void readParams(InputSerializedData stream, boolean exception) { + peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + balances = BroadcastRevenueBalances.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(winners_count); - stream.writeInt32(unclaimed_count); + peer.serializeToStream(stream); + balances.serializeToStream(stream); } } - public static class TL_messageActionPrizeStars extends MessageAction { - public static final int constructor = 0xb00c47a2; + public static class TL_updateStarsBalance extends Update { + public static final int constructor = 0x4e80a379; - public int flags; - public boolean via_giveaway; - public boolean unclaimed; - public long stars; - public String transaction_id; - public Peer boost_peer; - public int giveaway_msg_id; + public TL_stars.StarsAmount balance; - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - unclaimed = (flags & 1) != 0; - stars = stream.readInt64(exception); - transaction_id = stream.readString(exception); - boost_peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - giveaway_msg_id = stream.readInt32(exception); + public void readParams(InputSerializedData stream, boolean exception) { + balance = TL_stars.StarsAmount.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = unclaimed ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeInt64(stars); - stream.writeString(transaction_id); - boost_peer.serializeToStream(stream); - stream.writeInt32(giveaway_msg_id); + balance.serializeToStream(stream); } } - public static class TL_messageActionStarGift_layer192 extends TL_messageActionStarGift { - public static final int constructor = 0x9bb3ef44; + public static class TL_updateStarsBalance_layer194 extends TL_updateStarsBalance { + public static final int constructor = 0xfb85198; - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - name_hidden = (flags & 1) != 0; - saved = (flags & 4) != 0; - converted = (flags & 8) != 0; - gift = TL_stars.StarGift.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 2) != 0) { - message = TL_textWithEntities.TLdeserialize(stream, stream.readInt32(exception), exception); - } - convert_stars = stream.readInt64(exception); + public long balance; + + public void readParams(InputSerializedData stream, boolean exception) { + balance = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = name_hidden ? (flags | 1) : (flags &~ 1); - flags = saved ? (flags | 4) : (flags &~ 4); - flags = converted ? (flags | 8) : (flags &~ 8); - stream.writeInt32(flags); - gift.serializeToStream(stream); - if ((flags & 2) != 0) { - message.serializeToStream(stream); - } - stream.writeInt64(convert_stars); + stream.writeInt64(balance); } } - public static class TL_messageActionStarGift extends MessageAction { - public static final int constructor = 0x8557637; + public static class TL_updateStarsRevenueStatus extends Update { + public static final int constructor = 0xa584b019; - public int flags; - public boolean name_hidden; - public boolean saved; - public boolean converted; - public TL_stars.StarGift gift; - public TL_textWithEntities message; - public long convert_stars; + public Peer peer; + public TL_starsRevenueStatus status; - public boolean forceIn; //custom + public void readParams(InputSerializedData stream, boolean exception) { + peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + status = TL_starsRevenueStatus.TLdeserialize(stream, stream.readInt32(exception), exception); + } - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - name_hidden = (flags & 1) != 0; - saved = (flags & 4) != 0; - converted = (flags & 8) != 0; - gift = TL_stars.StarGift.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 2) != 0) { - message = TL_textWithEntities.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 16) != 0) { - convert_stars = stream.readInt64(exception); - } + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + status.serializeToStream(stream); + } + } + + public static class TL_updateBotPurchasedPaidMedia extends Update { + public static final int constructor = 0x283bd312; + + public long user_id; + public String payload; + public int qts; + + public void readParams(InputSerializedData stream, boolean exception) { + user_id = stream.readInt64(exception); + payload = stream.readString(exception); + qts = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = name_hidden ? (flags | 1) : (flags &~ 1); - flags = saved ? (flags | 4) : (flags &~ 4); - flags = converted ? (flags | 8) : (flags &~ 8); - stream.writeInt32(flags); - gift.serializeToStream(stream); - if ((flags & 2) != 0) { - message.serializeToStream(stream); - } - if ((flags & 16) != 0) { - stream.writeInt64(convert_stars); - } + stream.writeInt64(user_id); + stream.writeString(payload); + stream.writeInt32(qts); } } - public static class TL_channels_updateEmojiStatus extends TLObject { - public static final int constructor = 0xf0d3e6a8; + public static class TL_updatePaidReactionPrivacy extends Update { + public static final int constructor = 0x51ca7aec; - public InputChannel channel; - public EmojiStatus emoji_status; + public boolean isPrivate; - @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + isPrivate = stream.readBool(exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - emoji_status.serializeToStream(stream); + stream.writeBool(isPrivate); } } - public static class TL_channels_getChannelRecommendations extends TLObject { - public static final int constructor = 0x25a71742; + public static class TL_updateBotSubscriptionExpire extends Update { + public static final int constructor = 0xa8ae3eb1; - public int flags; - public InputChannel channel; + public long user_id; + public String payload; + public int until_date; + public int qts; - @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_Chats.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + user_id = stream.readInt64(exception); + payload = stream.readString(exception); + until_date = stream.readInt32(exception); + qts = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - channel.serializeToStream(stream); - } + stream.writeInt64(user_id); + stream.writeString(payload); + stream.writeInt32(until_date); + stream.writeInt32(qts); } } - public static class TL_channels_toggleViewForumAsMessages extends TLObject { - public static final int constructor = 0x9738bb15; + public static class TL_updateStarGiftUpgraded extends Update { + public static final int constructor = 0x767cde44; - public InputChannel channel_id; - public boolean enabled; + public TL_stars.SavedStarGift gift; + public TL_stars.SavedStarGift to_gift; - @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + gift = TL_stars.SavedStarGift.TLdeserialize(stream, stream.readInt32(exception), exception); + to_gift = TL_stars.SavedStarGift.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel_id.serializeToStream(stream); - stream.writeBool(enabled); + gift.serializeToStream(stream); + to_gift.serializeToStream(stream); } } - public static class TL_peerColor extends TLObject { - public static final int constructor = 0xb54b5acf; + public static class TL_updateSavedDialogPinned extends Update { + public static final int constructor = 0xaeaf9e74; public int flags; - public int color; - public long background_emoji_id; + public boolean pinned; + public DialogPeer peer; - public static TL_peerColor TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_peerColor.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_peerColor", constructor)); - } else { - return null; - } - } - TL_peerColor result = new TL_peerColor(); - result.readParams(stream, exception); - return result; + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + pinned = (flags & 1) != 0; + peer = DialogPeer.TLdeserialize(stream, stream.readInt32(exception), exception); } - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = pinned ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + peer.serializeToStream(stream); + } + } + + public static class TL_updatePeerWallpaper extends Update { + public static final int constructor = 0xae3f101d; + + public int flags; + public boolean wallpaper_overridden; + public Peer peer; + public WallPaper wallpaper; + + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - color = (flags & 1) != 0 ? stream.readInt32(exception) : -1; - if ((flags & 2) != 0) { - background_emoji_id = stream.readInt64(exception); + wallpaper_overridden = (flags & 2) != 0; + peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 1) != 0) { + wallpaper = WallPaper.TLdeserialize(stream, stream.readInt32(exception), exception); } } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = wallpaper_overridden ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); + peer.serializeToStream(stream); if ((flags & 1) != 0) { - stream.writeInt32(color); - } - if ((flags & 2) != 0) { - stream.writeInt64(background_emoji_id); + wallpaper.serializeToStream(stream); } } } - public static class help_PeerColorSet extends TLObject { - public static help_PeerColorSet TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - help_PeerColorSet result = null; - switch (constructor) { - case TL_help_peerColorSet.constructor: - result = new TL_help_peerColorSet(); - break; - case TL_help_peerColorProfileSet.constructor: - result = new TL_help_peerColorProfileSet(); - break; + public static class TL_messages_setChatWallPaper extends TLObject { + public static final int constructor = 0x8ffacae1; + + public int flags; + public boolean for_both; + public boolean revert; + public InputPeer peer; + public InputWallPaper wallpaper; + public WallPaperSettings settings; + public int id; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = for_both ? (flags | 8) : (flags &~ 8); + flags = revert ? (flags | 16) : (flags &~ 16); + stream.writeInt32(flags); + peer.serializeToStream(stream); + if ((flags & 1) != 0) { + wallpaper.serializeToStream(stream); } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in help_PeerColorSet", constructor)); + if ((flags & 4) != 0) { + settings.serializeToStream(stream); } - if (result != null) { - result.readParams(stream, exception); + if ((flags & 2) != 0) { + stream.writeInt32(id); } - return result; } } - public static class TL_help_peerColorSet extends help_PeerColorSet { - public static final int constructor = 0x26219a58; + public static class TL_contacts_setBlocked extends TLObject { + public static final int constructor = 0x94c65c76; - public ArrayList colors = new ArrayList<>(); + public int flags; + public boolean my_stories_from; + public ArrayList id = new ArrayList<>(); + public int limit; - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - colors.add(stream.readInt32(exception)); - } + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = colors.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - stream.writeInt32(colors.get(i)); - } + flags = my_stories_from ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + Vector.serialize(stream, id); + stream.writeInt32(limit); } } - public static class TL_help_peerColorProfileSet extends help_PeerColorSet { - public static final int constructor = 0x767d61eb; - - public ArrayList palette_colors = new ArrayList<>(); - public ArrayList bg_colors = new ArrayList<>(); - public ArrayList story_colors = new ArrayList<>(); - - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - palette_colors.add(stream.readInt32(exception)); - } + public static class TL_editCloseFriends extends TLObject { + public static final int constructor = 0xba6705f0; - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - bg_colors.add(stream.readInt32(exception)); - } + public ArrayList id = new ArrayList<>(); - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - story_colors.add(stream.readInt32(exception)); - } + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = palette_colors.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - stream.writeInt32(palette_colors.get(i)); - } - stream.writeInt32(0x1cb5c415); - count = bg_colors.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - stream.writeInt32(bg_colors.get(i)); - } - stream.writeInt32(0x1cb5c415); - count = story_colors.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - stream.writeInt32(story_colors.get(i)); - } + Vector.serializeLong(stream, id); } } - public static class TL_help_peerColorOption extends TLObject { - public static final int constructor = 0xadec6ebe; + public static abstract class InputReplyTo extends TLObject { public int flags; - public boolean hidden; - public int color_id; - public help_PeerColorSet colors; - public help_PeerColorSet dark_colors; - public int channel_min_level; - public int group_min_level; + public int reply_to_msg_id; + public int top_msg_id; + public InputPeer reply_to_peer_id; + public String quote_text; + public ArrayList quote_entities = new ArrayList<>(); + public int quote_offset; - public static TL_help_peerColorOption TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_help_peerColorOption.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_help_peerColorOption", constructor)); - } else { - return null; - } + public InputPeer peer; + public int story_id; + + public static InputReplyTo TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + InputReplyTo result = null; + switch (constructor) { + case TL_inputReplyToMessage.constructor: + result = new TL_inputReplyToMessage(); + break; + case TL_inputReplyToMessage_layer166.constructor: + result = new TL_inputReplyToMessage_layer166(); + break; + case TL_inputReplyToStory.constructor: + result = new TL_inputReplyToStory(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in InputReplyTo", constructor)); + } + if (result != null) { + result.readParams(stream, exception); } - TL_help_peerColorOption result = new TL_help_peerColorOption(); - result.readParams(stream, exception); return result; } + } - public void readParams(AbstractSerializedData stream, boolean exception) { + public static class TL_inputReplyToMessage extends InputReplyTo { + public static final int constructor = 0x22c0f6d5; + + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - hidden = (flags & 1) != 0; - color_id = stream.readInt32(exception); + reply_to_msg_id = stream.readInt32(exception); + if ((flags & 1) != 0) { + top_msg_id = stream.readInt32(exception); + } if ((flags & 2) != 0) { - colors = help_PeerColorSet.TLdeserialize(stream, stream.readInt32(exception), exception); + reply_to_peer_id = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 4) != 0) { - dark_colors = help_PeerColorSet.TLdeserialize(stream, stream.readInt32(exception), exception); + quote_text = stream.readString(exception); + } + if ((flags & 8) != 0) { + quote_entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); + } + if ((flags & 16) != 0) { + quote_offset = stream.readInt32(exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeInt32(reply_to_msg_id); + if ((flags & 1) != 0) { + stream.writeInt32(top_msg_id); + } + if ((flags & 2) != 0) { + reply_to_peer_id.serializeToStream(stream); + } + if ((flags & 4) != 0) { + stream.writeString(quote_text); } if ((flags & 8) != 0) { - channel_min_level = stream.readInt32(exception); + Vector.serialize(stream, quote_entities); } if ((flags & 16) != 0) { - group_min_level = stream.readInt32(exception); + stream.writeInt32(quote_offset); } } + } - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - flags = hidden ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeInt32(color_id); + public static class TL_inputReplyToMessage_layer166 extends TL_inputReplyToMessage { + public static final int constructor = 0x73ec805; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + reply_to_msg_id = stream.readInt32(exception); + if ((flags & 1) != 0) { + top_msg_id = stream.readInt32(exception); + } if ((flags & 2) != 0) { - colors.serializeToStream(stream); + reply_to_peer_id = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 4) != 0) { - dark_colors.serializeToStream(stream); + quote_text = stream.readString(exception); } if ((flags & 8) != 0) { - stream.writeInt32(channel_min_level); - } - if ((flags & 16) != 0) { - stream.writeInt32(group_min_level); + quote_entities = Vector.deserialize(stream, MessageEntity::TLdeserialize, exception); } } - } - public static class help_PeerColors extends TLObject { - public static help_PeerColors TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - help_PeerColors result = null; - switch (constructor) { - case TL_help_peerColorsNotModified.constructor: - result = new TL_help_peerColorsNotModified(); - break; - case TL_help_peerColors.constructor: - result = new TL_help_peerColors(); - break; + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeInt32(reply_to_msg_id); + if ((flags & 1) != 0) { + stream.writeInt32(top_msg_id); } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in help_PeerColors", constructor)); + if ((flags & 2) != 0) { + reply_to_peer_id.serializeToStream(stream); } - if (result != null) { - result.readParams(stream, exception); + if ((flags & 4) != 0) { + stream.writeString(quote_text); + } + if ((flags & 8) != 0) { + Vector.serialize(stream, quote_entities); } - return result; } } - public static class TL_help_peerColorsNotModified extends help_PeerColors { - public static final int constructor = 0x2ba1f5ce; - - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public static class TL_inputReplyToStory extends InputReplyTo { + public static final int constructor = 0x5881323a; + public void readParams(InputSerializedData stream, boolean exception) { + peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); + story_id = stream.readInt32(exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeInt32(story_id); } } - public static class TL_help_peerColors extends help_PeerColors { - public static final int constructor = 0xf8ed08; + public static class TL_inputMediaStory extends InputMedia { + public static final int constructor = 0x89fdd778; - public int hash; - public ArrayList colors = new ArrayList<>(); + public InputPeer peer; + public int id; - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - hash = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - colors.add(TL_help_peerColorOption.TLdeserialize(stream, stream.readInt32(exception), exception)); - } + public void readParams(InputSerializedData stream, boolean exception) { + peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); + id = stream.readInt32(exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(hash); - stream.writeInt32(0x1cb5c415); - int count = colors.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - colors.get(i).serializeToStream(stream); - } + peer.serializeToStream(stream); + stream.writeInt32(id); } } - public static class TL_help_getPeerColors extends TLObject { - public static final int constructor = 0xda80f42f; - - public int hash; + public static class TL_messageMediaStory extends MessageMedia { + public static final int constructor = 0x68cb6283; - @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return help_PeerColors.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + via_mention = (flags & 2) != 0; + peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + id = stream.readInt32(exception); + if ((flags & 1) != 0) { + storyItem = TL_stories.StoryItem.TLdeserialize(stream, stream.readInt32(exception), exception); + } } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(hash); + flags = via_mention ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + peer.serializeToStream(stream); + stream.writeInt32(id); + if ((flags & 1) != 0) { + storyItem.serializeToStream(stream); + } } } - public static class TL_help_getPeerProfileColors extends TLObject { - public static final int constructor = 0xabcfa9fd; - - public int hash; + public static class TL_messageMediaStory_layer162 extends MessageMedia { + public static final int constructor = 0xcbb20d88; - @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return help_PeerColors.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + via_mention = (flags & 2) != 0; + user_id = stream.readInt64(exception); + id = stream.readInt32(exception); + if ((flags & 1) != 0) { + storyItem = TL_stories.StoryItem.TLdeserialize(stream, stream.readInt32(exception), exception); + } + peer = new TL_peerUser(); + peer.user_id = user_id; } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { + if (storyItem != null) { + flags |= 1; + } else { + flags &= ~1; + } stream.writeInt32(constructor); - stream.writeInt32(hash); + flags = via_mention ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + stream.writeInt64(peer.user_id); + stream.writeInt32(id); + if ((flags & 1) != 0) { + storyItem.serializeToStream(stream); + } } } - public static class TL_savedDialog extends TLObject { - public static final int constructor = 0xbd87cb6c; + public static class TL_messages_webPage extends TLObject { + public static final int constructor = 0xfd5e12bd; - public int flags; - public boolean pinned; - public Peer peer; - public int top_message; + public WebPage webpage; + public ArrayList chats; + public ArrayList users; - public static TL_savedDialog TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_savedDialog.constructor != constructor) { + public static TL_messages_webPage TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_messages_webPage.constructor != constructor) { if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_savedDialog", constructor)); + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_webPage", constructor)); } else { return null; } } - TL_savedDialog result = new TL_savedDialog(); + TL_messages_webPage result = new TL_messages_webPage(); result.readParams(stream, exception); return result; } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - pinned = (flags & 4) != 0; - peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - top_message = stream.readInt32(exception); + public void readParams(InputSerializedData stream, boolean exception) { + webpage = WebPage.TLdeserialize(stream, stream.readInt32(exception), exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = pinned ? (flags | 4) : (flags &~ 4); - stream.writeInt32(flags); - peer.serializeToStream(stream); - stream.writeInt32(top_message); + webpage.serializeToStream(stream); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } - public static class messages_SavedDialogs extends TLObject { - public static messages_SavedDialogs TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - messages_SavedDialogs result = null; - switch (constructor) { - case TL_messages_savedDialogs.constructor: - result = new TL_messages_savedDialogs(); - break; - case TL_messages_savedDialogsSlice.constructor: - result = new TL_messages_savedDialogsSlice(); - break; - case TL_messages_savedDialogsNotModified.constructor: - result = new TL_messages_savedDialogsNotModified(); - break; + public static class TL_messageActionGiftCode extends MessageAction { + public static final int constructor = 0x56d03994; + + public boolean via_giveaway; + public boolean unclaimed; + public Peer boost_peer; + public String slug; + public TL_textWithEntities message; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + via_giveaway = (flags & 1) != 0; + unclaimed = (flags & 4) != 0; + if ((flags & 2) != 0) { + boost_peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in messages_SavedDialogs", constructor)); + months = stream.readInt32(exception); + slug = stream.readString(exception); + if ((flags & 4) != 0) { + currency = stream.readString(exception); + amount = stream.readInt64(exception); } - if (result != null) { - result.readParams(stream, exception); + if ((flags & 8) != 0) { + cryptoCurrency = stream.readString(exception); + cryptoAmount = stream.readInt64(exception); + } + if ((flags & 16) != 0) { + message = TL_textWithEntities.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = via_giveaway ? (flags | 1) : (flags &~ 1); + flags = unclaimed ? (flags | 4) : (flags &~ 4); + stream.writeInt32(flags); + if ((flags & 2) != 0) { + boost_peer.serializeToStream(stream); + } + stream.writeInt32(months); + stream.writeString(slug); + if ((flags & 4) != 0) { + stream.writeString(currency); + stream.writeInt64(amount); + } + if ((flags & 8) != 0) { + stream.writeString(cryptoCurrency); + stream.writeInt64(cryptoAmount); + } + if ((flags & 16) != 0) { + message.serializeToStream(stream); } - return result; } } - public static class TL_messages_savedDialogs extends messages_SavedDialogs { - public static final int constructor = 0xf83ae221; + public static class TL_messageActionGiftCode_layer189 extends TL_messageActionGiftCode { + public static final int constructor = 0x678c2e09; - public ArrayList dialogs = new ArrayList<>(); - public ArrayList messages = new ArrayList<>(); - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); + public boolean via_giveaway; + public boolean unclaimed; + public Peer boost_peer; + public String slug; - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + via_giveaway = (flags & 1) != 0; + unclaimed = (flags & 4) != 0; + if ((flags & 2) != 0) { + boost_peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - dialogs.add(TL_savedDialog.TLdeserialize(stream, stream.readInt32(exception), exception)); + months = stream.readInt32(exception); + slug = stream.readString(exception); + if ((flags & 4) != 0) { + currency = stream.readString(exception); } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + if ((flags & 4) != 0) { + amount = stream.readInt64(exception); } - count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - messages.add(Message.TLdeserialize(stream, stream.readInt32(exception), exception)); + if ((flags & 8) != 0) { + cryptoCurrency = stream.readString(exception); } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + if ((flags & 8) != 0) { + cryptoAmount = stream.readInt64(exception); } - count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - chats.add(Chat.TLdeserialize(stream, stream.readInt32(exception), exception)); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = via_giveaway ? (flags | 1) : (flags &~ 1); + flags = unclaimed ? (flags | 4) : (flags &~ 4); + stream.writeInt32(flags); + if ((flags & 2) != 0) { + boost_peer.serializeToStream(stream); } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + stream.writeInt32(months); + stream.writeString(slug); + if ((flags & 4) != 0) { + stream.writeString(currency); } - count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - users.add(User.TLdeserialize(stream, stream.readInt32(exception), exception)); + if ((flags & 4) != 0) { + stream.writeInt64(amount); + } + if ((flags & 8) != 0) { + stream.writeString(cryptoCurrency); + } + if ((flags & 8) != 0) { + stream.writeInt64(cryptoAmount); } } + } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public static class TL_messageActionGiftCode_layer167 extends TL_messageActionGiftCode { + public static final int constructor = 0xd2cfdb0e; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + via_giveaway = (flags & 1) != 0; + unclaimed = (flags & 4) != 0; + if ((flags & 2) != 0) { + boost_peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + months = stream.readInt32(exception); + slug = stream.readString(exception); + } + + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = dialogs.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - dialogs.get(i).serializeToStream(stream); + flags = via_giveaway ? (flags | 1) : (flags &~ 1); + flags = unclaimed ? (flags | 4) : (flags &~ 4); + stream.writeInt32(flags); + if ((flags & 2) != 0) { + boost_peer.serializeToStream(stream); } - stream.writeInt32(0x1cb5c415); - count = messages.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - messages.get(i).serializeToStream(stream); + stream.writeInt32(months); + stream.writeString(slug); + } + } + + public static class TL_inputStorePaymentPremiumGiftCode extends InputStorePaymentPurpose { + public static final int constructor = 0xfb790393; + + public int flags; + public ArrayList users = new ArrayList<>(); + public InputPeer boost_peer; + public String currency; + public long amount; + public TL_textWithEntities message; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + users = Vector.deserialize(stream, InputUser::TLdeserialize, exception); + if ((flags & 1) != 0) { + boost_peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - users.get(i).serializeToStream(stream); + currency = stream.readString(exception); + amount = stream.readInt64(exception); + if ((flags & 2) != 0) { + message = TL_textWithEntities.TLdeserialize(stream, stream.readInt32(exception), exception); } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - chats.get(i).serializeToStream(stream); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + Vector.serialize(stream, users); + if ((flags & 1) != 0) { + boost_peer.serializeToStream(stream); + } + stream.writeString(currency); + stream.writeInt64(amount); + if ((flags & 2) != 0) { + message.serializeToStream(stream); } } } - public static class TL_messages_savedDialogsSlice extends messages_SavedDialogs { - public static final int constructor = 0x44ba9dd9; + public static class TL_inputStorePaymentPremiumGiveaway extends InputStorePaymentPurpose { + public static final int constructor = 0x160544ca; - public int count; - public ArrayList dialogs = new ArrayList<>(); - public ArrayList messages = new ArrayList<>(); - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); + public int flags; + public boolean only_new_subscribers; + public boolean winners_are_visible; + public InputPeer boost_peer; + public ArrayList additional_peers = new ArrayList<>(); + public ArrayList countries_iso2 = new ArrayList<>(); + public String prize_description; + public long random_id; + public int until_date; + public String currency; + public long amount; - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + only_new_subscribers = (flags & 1) != 0; + winners_are_visible = (flags & 8) != 0; + boost_peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 2) != 0) { + additional_peers = Vector.deserialize(stream, InputPeer::TLdeserialize, exception); } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - dialogs.add(TL_savedDialog.TLdeserialize(stream, stream.readInt32(exception), exception)); + if ((flags & 4) != 0) { + countries_iso2 = Vector.deserializeString(stream, exception); } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + if ((flags & 16) != 0) { + prize_description = stream.readString(exception); } - count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - messages.add(Message.TLdeserialize(stream, stream.readInt32(exception), exception)); + random_id = stream.readInt64(exception); + until_date = stream.readInt32(exception); + currency = stream.readString(exception); + amount = stream.readInt64(exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = only_new_subscribers ? (flags | 1) : (flags &~ 1); + flags = winners_are_visible ? (flags | 8) : (flags &~ 8); + stream.writeInt32(flags); + boost_peer.serializeToStream(stream); + if ((flags & 2) != 0) { + Vector.serialize(stream, additional_peers); } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + if ((flags & 4) != 0) { + Vector.serializeString(stream, countries_iso2); } - count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - chats.add(Chat.TLdeserialize(stream, stream.readInt32(exception), exception)); + if ((flags & 16) != 0) { + stream.writeString(prize_description); } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + stream.writeInt64(random_id); + stream.writeInt32(until_date); + stream.writeString(currency); + stream.writeInt64(amount); + } + } + + public static class TL_inputStorePaymentStarsTopup extends InputStorePaymentPurpose { + public static final int constructor = 0xdddd0f56; + + public long stars; + public String currency; + public long amount; + + public void readParams(InputSerializedData stream, boolean exception) { + stars = stream.readInt64(exception); + currency = stream.readString(exception); + amount = stream.readInt64(exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(stars); + stream.writeString(currency); + stream.writeInt64(amount); + } + } + + public static class TL_inputStorePaymentStarsGiveaway extends InputStorePaymentPurpose { + public static final int constructor = 0x751f08fa; + + public int flags; + public boolean only_new_subscribers; + public boolean winners_are_visible; + public long stars; + public InputPeer boost_peer; + public ArrayList additional_peers = new ArrayList<>(); + public ArrayList countries_iso2 = new ArrayList<>(); + public String prize_description; + public long random_id; + public int until_date; + public String currency; + public long amount; + public int users; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + only_new_subscribers = (flags & 1) != 0; + winners_are_visible = (flags & 8) != 0; + stars = stream.readInt64(exception); + boost_peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 2) != 0) { + additional_peers = Vector.deserialize(stream, InputPeer::TLdeserialize, exception); } - count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - users.add(User.TLdeserialize(stream, stream.readInt32(exception), exception)); + if ((flags & 4) != 0) { + countries_iso2 = Vector.deserializeString(stream, exception); + } + if ((flags & 16) != 0) { + prize_description = stream.readString(exception); } + random_id = stream.readInt64(exception); + until_date = stream.readInt32(exception); + currency = stream.readString(exception); + amount = stream.readInt64(exception); + users = stream.readInt32(exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = dialogs.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - dialogs.get(i).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = messages.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - messages.get(i).serializeToStream(stream); + flags = only_new_subscribers ? (flags | 1) : (flags &~ 1); + flags = winners_are_visible ? (flags | 8) : (flags &~ 8); + stream.writeInt32(flags); + stream.writeInt64(stars); + boost_peer.serializeToStream(stream); + if ((flags & 2) != 0) { + Vector.serialize(stream, additional_peers); } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - users.get(i).serializeToStream(stream); + if ((flags & 4) != 0) { + Vector.serializeString(stream, countries_iso2); } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - chats.get(i).serializeToStream(stream); + if ((flags & 16) != 0) { + stream.writeString(prize_description); } + stream.writeInt64(random_id); + stream.writeInt32(until_date); + stream.writeString(currency); + stream.writeInt64(amount); + stream.writeInt32(users); } } - public static class TL_messages_savedDialogsNotModified extends messages_SavedDialogs { - public static final int constructor = 0xc01f6fe8; + public static class TL_inputStorePaymentStarsGift extends InputStorePaymentPurpose { + public static final int constructor = 0x1d741ef7; - public int count; + public InputUser user_id; + public long stars; + public String currency; + public long amount; - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - count = stream.readInt32(exception); + public void readParams(InputSerializedData stream, boolean exception) { + user_id = InputUser.TLdeserialize(stream, stream.readInt32(exception), exception); + stars = stream.readInt64(exception); + currency = stream.readString(exception); + amount = stream.readInt64(exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(count); + user_id.serializeToStream(stream); + stream.writeInt64(stars); + stream.writeString(currency); + stream.writeInt64(amount); } } - public static class TL_messages_getPinnedSavedDialogs extends TLObject { - public static final int constructor = 0xd63d94e0; + public static class TL_inputInvoicePremiumGiftCode extends InputInvoice { + public static final int constructor = 0x98986c0d; - @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_SavedDialogs.TLdeserialize(stream, constructor, exception); + public InputStorePaymentPurpose purpose; + public TL_premiumGiftCodeOption option; + + public void readParams(InputSerializedData stream, boolean exception) { + purpose = InputStorePaymentPurpose.TLdeserialize(stream, stream.readInt32(exception), exception); + option = TL_premiumGiftCodeOption.TLdeserialize(stream, stream.readInt32(exception), exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + purpose.serializeToStream(stream); + option.serializeToStream(stream); } } - public static class TL_messages_getSavedDialogs extends TLObject { - public static final int constructor = 0x5381d21a; + public static class TL_inputInvoiceStars extends InputInvoice { + public static final int constructor = 0x65f00ce3; - public int flags; - public boolean exclude_pinned; - public int offset_date; - public int offset_id; - public InputPeer offset_peer; - public int limit; - public long hash; + public InputStorePaymentPurpose purpose; - @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_SavedDialogs.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + purpose = InputStorePaymentPurpose.TLdeserialize(stream, stream.readInt32(exception), exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = exclude_pinned ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeInt32(offset_date); - stream.writeInt32(offset_id); - offset_peer.serializeToStream(stream); - stream.writeInt32(limit); - stream.writeInt64(hash); + purpose.serializeToStream(stream); } } - public static class TL_messages_getSavedHistory extends TLObject { - public static final int constructor = 0x3d9a414d; + public static class TL_inputInvoiceChatInviteSubscription extends InputInvoice { + public static final int constructor = 0x34e793f1; - public InputPeer peer; - public int offset_id; - public int offset_date; - public int add_offset; - public int limit; - public int max_id; - public int min_id; - public long hash; + public String hash; - @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_Messages.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + hash = stream.readString(exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(offset_id); - stream.writeInt32(offset_date); - stream.writeInt32(add_offset); - stream.writeInt32(limit); - stream.writeInt32(max_id); - stream.writeInt32(min_id); - stream.writeInt64(hash); + stream.writeString(hash); } } - public static class TL_messages_toggleSavedDialogPin extends TLObject { - public static final int constructor = 0xac81bbde; + public static class TL_inputInvoiceStarGift extends InputInvoice { + public static final int constructor = 0xe8625e92; public int flags; - public boolean pinned; - public InputDialogPeer peer; + public boolean hide_name; + public boolean include_upgrade; + public InputPeer peer; + public long gift_id; + public TL_textWithEntities message; - @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + hide_name = (flags & 1) != 0; + include_upgrade = (flags & 4) != 0; + peer = InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); + gift_id = stream.readInt64(exception); + if ((flags & 2) != 0) { + message = TL_textWithEntities.TLdeserialize(stream, stream.readInt32(exception), exception); + } } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = pinned ? (flags | 1) : (flags &~ 1); + flags = hide_name ? flags | 1 : flags &~ 1; + flags = include_upgrade ? flags | 4 : flags &~ 4; stream.writeInt32(flags); peer.serializeToStream(stream); + stream.writeInt64(gift_id); + if ((flags & 2) != 0) { + message.serializeToStream(stream); + } } } - public static class TL_messages_reorderPinnedSavedDialogs extends TLObject { - public static final int constructor = 0x8b716587; + public static class TL_inputInvoiceStarGiftUpgrade extends InputInvoice { + public static final int constructor = 0x4d818d5d; public int flags; - public boolean force; - public ArrayList order = new ArrayList<>(); + public boolean keep_original_details; + public TL_stars.InputSavedStarGift stargift; - @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + keep_original_details = (flags & 1) != 0; + stargift = TL_stars.InputSavedStarGift.TLdeserialize(stream, stream.readInt32(exception), exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = force ? (flags | 1) : (flags &~ 1); + flags = keep_original_details ? flags | 1 : flags &~ 1; stream.writeInt32(flags); - stream.writeInt32(0x1cb5c415); - int count = order.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - order.get(i).serializeToStream(stream); - } + stargift.serializeToStream(stream); } } - public static class TL_messages_getSavedReactionTags extends TLObject { - public static final int constructor = 0x3637e05b; + public static class TL_inputInvoiceStarGiftTransfer extends InputInvoice { + public static final int constructor = 0x4a5f5bd9; - public int flags; - public InputPeer peer; - public long hash; + public TL_stars.InputSavedStarGift stargift; + public TLRPC.InputPeer to_id; - @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_SavedReactionTags.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + stargift = TL_stars.InputSavedStarGift.TLdeserialize(stream, stream.readInt32(exception), exception); + to_id = TLRPC.InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - peer.serializeToStream(stream); - } - stream.writeInt64(hash); + stargift.serializeToStream(stream); + to_id.serializeToStream(stream); } } - public static class TL_messages_updateSavedReactionTag extends TLObject { - public static final int constructor = 0x60297dec; + public static class TL_messageMediaGiveawayResults extends MessageMedia { + public static final int constructor = 0xceaa3ea1; - public int flags; - public Reaction reaction; - public String title; + public boolean only_new_subscribers; + public boolean refunded; + public long channel_id; + public int additional_peers_count; + public int launch_msg_id; + public int winners_count; + public int unclaimed_count; + public ArrayList winners = new ArrayList<>(); + public int months; + public long stars; + public String prize_description; + public int until_date; - @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + only_new_subscribers = (flags & 1) != 0; + refunded = (flags & 4) != 0; + channel_id = stream.readInt64(exception); + if ((flags & 8) != 0) { + additional_peers_count = stream.readInt32(exception); + } + launch_msg_id = stream.readInt32(exception); + winners_count = stream.readInt32(exception); + unclaimed_count = stream.readInt32(exception); + winners = Vector.deserializeLong(stream, exception); + if ((flags & 16) != 0) { + months = stream.readInt32(exception); + } + if ((flags & 32) != 0) { + stars = stream.readInt64(exception); + } + if ((flags & 2) != 0) { + prize_description = stream.readString(exception); + } + until_date = stream.readInt32(exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = only_new_subscribers ? (flags | 1) : (flags &~ 1); + flags = refunded ? (flags | 4) : (flags &~ 4); stream.writeInt32(flags); - reaction.serializeToStream(stream); - if ((flags & 1) != 0) { - stream.writeString(title); + stream.writeInt64(channel_id); + if ((flags & 8) != 0) { + stream.writeInt32(additional_peers_count); + } + stream.writeInt32(launch_msg_id); + stream.writeInt32(winners_count); + stream.writeInt32(unclaimed_count); + Vector.serializeLong(stream, winners); + if ((flags & 16) != 0) { + stream.writeInt32(months); + } + if ((flags & 32) != 0) { + stream.writeInt64(stars); + } + if ((flags & 2) != 0) { + stream.writeString(prize_description); } + stream.writeInt32(until_date); } } - public static class TL_messages_getOutboxReadDate extends TLObject { - public static final int constructor = 0x8c4bfe5d; - - public InputPeer peer; - public int msg_id; - + public static class TL_messageMediaGiveawayResults_layer186 extends TL_messageMediaGiveawayResults { + public static final int constructor = 0xc6991068; - @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_outboxReadDate.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + only_new_subscribers = (flags & 1) != 0; + refunded = (flags & 4) != 0; + channel_id = stream.readInt64(exception); + if ((flags & 8) != 0) { + additional_peers_count = stream.readInt32(exception); + } + launch_msg_id = stream.readInt32(exception); + winners_count = stream.readInt32(exception); + unclaimed_count = stream.readInt32(exception); + winners = Vector.deserializeLong(stream, exception); + months = stream.readInt32(exception); + if ((flags & 2) != 0) { + prize_description = stream.readString(exception); + } + until_date = stream.readInt32(exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(msg_id); + flags = only_new_subscribers ? (flags | 1) : (flags &~ 1); + flags = refunded ? (flags | 4) : (flags &~ 4); + stream.writeInt32(flags); + stream.writeInt64(channel_id); + if ((flags & 8) != 0) { + stream.writeInt32(additional_peers_count); + } + stream.writeInt32(launch_msg_id); + stream.writeInt32(winners_count); + stream.writeInt32(unclaimed_count); + Vector.serializeLong(stream, winners); + stream.writeInt32(months); + if ((flags & 2) != 0) { + stream.writeString(prize_description); + } + stream.writeInt32(until_date); } } - public static class TL_businessWeeklyOpen extends TLObject { - public static final int constructor = 0x120b1ab9; - - public int start_minute; - public int end_minute; + public static class TL_messageMediaGiveaway extends MessageMedia { + public static final int constructor = 0xaa073beb; - public static TL_businessWeeklyOpen TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (constructor != TL_businessWeeklyOpen.constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_businessWeeklyOpen", constructor)); - } - return null; - } - TL_businessWeeklyOpen result = new TL_businessWeeklyOpen(); - result.readParams(stream, exception); - return result; - } + public boolean only_new_subscribers; + public boolean winners_are_visible; + public ArrayList channels = new ArrayList<>(); + public ArrayList countries_iso2 = new ArrayList<>(); + public String prize_description; + public int quantity; + public int months; + public long stars; + public int until_date; - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - start_minute = stream.readInt32(exception); - end_minute = stream.readInt32(exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + only_new_subscribers = (flags & 1) != 0; + winners_are_visible = (flags & 4) != 0; + channels = Vector.deserializeLong(stream, exception); + if ((flags & 2) != 0) { + countries_iso2 = Vector.deserializeString(stream, exception); + } + if ((flags & 8) != 0) { + prize_description = stream.readString(exception); + } + quantity = stream.readInt32(exception); + if ((flags & 16) != 0) { + months = stream.readInt32(exception); + } + if ((flags & 32) != 0) { + stars = stream.readInt64(exception); + } + until_date = stream.readInt32(exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(start_minute); - stream.writeInt32(end_minute); + flags = only_new_subscribers ? (flags | 1) : (flags &~ 1); + flags = winners_are_visible ? (flags | 4) : (flags &~ 4); + stream.writeInt32(flags); + Vector.serializeLong(stream, channels); + if ((flags & 2) != 0) { + Vector.serializeString(stream, countries_iso2); + } + if ((flags & 8) != 0) { + stream.writeString(prize_description); + } + stream.writeInt32(quantity); + if ((flags & 16) != 0) { + stream.writeInt32(months); + } + if ((flags & 32) != 0) { + stream.writeInt64(stars); + } + stream.writeInt32(until_date); } } - - public static class TL_businessWorkHours extends TLObject { - public static final int constructor = 0x8c92b098; - - public int flags; - public boolean open_now; - public String timezone_id; - public ArrayList weekly_open = new ArrayList<>(); - public static TL_businessWorkHours TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (constructor != TL_businessWorkHours.constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_businessWorkHours", constructor)); - } - return null; + public static class TL_messageMediaGiveaway_layer186 extends TL_messageMediaGiveaway { + public static final int constructor = 0xdaad85b0; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + only_new_subscribers = (flags & 1) != 0; + winners_are_visible = (flags & 4) != 0; + channels = Vector.deserializeLong(stream, exception); + if ((flags & 2) != 0) { + countries_iso2 = Vector.deserializeString(stream, exception); } - TL_businessWorkHours result = new TL_businessWorkHours(); - result.readParams(stream, exception); - return result; + if ((flags & 8) != 0) { + prize_description = stream.readString(exception); + } + quantity = stream.readInt32(exception); + months = stream.readInt32(exception); + until_date = stream.readInt32(exception); } - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - open_now = (flags & 1) != 0; - timezone_id = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = only_new_subscribers ? (flags | 1) : (flags &~ 1); + flags = winners_are_visible ? (flags | 4) : (flags &~ 4); + stream.writeInt32(flags); + Vector.serializeLong(stream, channels); + if ((flags & 2) != 0) { + Vector.serializeString(stream, countries_iso2); } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - weekly_open.add(TL_businessWeeklyOpen.TLdeserialize(stream, stream.readInt32(exception), exception)); + if ((flags & 8) != 0) { + stream.writeString(prize_description); } + stream.writeInt32(quantity); + stream.writeInt32(months); + stream.writeInt32(until_date); } + } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public static class TL_messageMediaGiveaway_layer167 extends TL_messageMediaGiveaway { + public static final int constructor = 0x58260664; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + only_new_subscribers = (flags & 1) != 0; + channels = Vector.deserializeLong(stream, exception); + if ((flags & 2) != 0) { + countries_iso2 = Vector.deserializeString(stream, exception); + } + quantity = stream.readInt32(exception); + months = stream.readInt32(exception); + until_date = stream.readInt32(exception); + } + + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = open_now ? (flags | 1) : (flags &~ 1); + flags = only_new_subscribers ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); - stream.writeString(timezone_id); - stream.writeInt32(0x1cb5c415); - int count = weekly_open.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - weekly_open.get(i).serializeToStream(stream); + Vector.serializeLong(stream, channels); + if ((flags & 2) != 0) { + Vector.serializeString(stream, countries_iso2); } + stream.writeInt32(quantity); + stream.writeInt32(months); + stream.writeInt32(until_date); } } - - public static class TL_businessLocation extends TLObject { - public static final int constructor = 0xac5c1af7; + + public static class TL_messageMediaPaidMedia extends MessageMedia { + public static final int constructor = 0xa8852491; + + public void readParams(InputSerializedData stream, boolean exception) { + stars_amount = stream.readInt64(exception); + extended_media = Vector.deserialize(stream, MessageExtendedMedia::TLdeserialize, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(stars_amount); + Vector.serialize(stream, extended_media); + } + } + + public static class TL_premiumGiftCodeOption extends TLObject { + public static final int constructor = 0x257e962b; public int flags; - public GeoPoint geo_point; - public String address; + public int users; + public int months; + public String store_product; + public int store_quantity; + public String currency; + public long amount; - public static TL_businessLocation TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (constructor != TL_businessLocation.constructor) { + public static TL_premiumGiftCodeOption TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_premiumGiftCodeOption.constructor != constructor) { if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_businessLocation", constructor)); + throw new RuntimeException(String.format("can't parse magic %x in TL_premiumGiftCodeOption", constructor)); + } else { + return null; } - return null; } - TL_businessLocation result = new TL_businessLocation(); + TL_premiumGiftCodeOption result = new TL_premiumGiftCodeOption(); result.readParams(stream, exception); return result; } - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); + users = stream.readInt32(exception); + months = stream.readInt32(exception); if ((flags & 1) != 0) { - geo_point = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); + store_product = stream.readString(exception); } - address = stream.readString(exception); + if ((flags & 2) != 0) { + store_quantity = stream.readInt32(exception); + } + currency = stream.readString(exception); + amount = stream.readInt64(exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); + stream.writeInt32(users); + stream.writeInt32(months); if ((flags & 1) != 0) { - geo_point.serializeToStream(stream); + stream.writeString(store_product); } - stream.writeString(address); + if ((flags & 2) != 0) { + stream.writeInt32(store_quantity); + } + stream.writeString(currency); + stream.writeInt64(amount); } } - public static class TL_timezone extends TLObject { - public static final int constructor = 0xff9289f5; - - public String id; - public String name; - public int utc_offset; + public static class TL_payments_getPremiumGiftCodeOptions extends TLObject { + public static final int constructor = 0x2757ba54; - public static TL_timezone TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (constructor != TL_timezone.constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_timezone", constructor)); - } - return null; - } - TL_timezone result = new TL_timezone(); - result.readParams(stream, exception); - return result; - } + public int flags; + public InputPeer boost_peer; - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readString(exception); - name = stream.readString(exception); - utc_offset = stream.readInt32(exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, TL_premiumGiftCodeOption::TLdeserialize); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(id); - stream.writeString(name); - stream.writeInt32(utc_offset); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + boost_peer.serializeToStream(stream); + } } } - public static class help_timezonesList extends TLObject { + public static class TL_payments_checkGiftCode extends TLObject { + public static final int constructor = 0x8e51b4c1; - public ArrayList timezones = new ArrayList<>(); - public int hash; + public String slug; - public static help_timezonesList TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - help_timezonesList result = null; - switch (constructor) { - case TL_help_timezonesListNotModified.constructor: - result = new TL_help_timezonesListNotModified(); - break; - case TL_help_timezonesList.constructor: - result = new TL_help_timezonesList(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in help_timezonesList", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_payments_checkedGiftCode.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(slug); } } - public static class TL_help_timezonesListNotModified extends help_timezonesList { - public static final int constructor = 0x970708cc; + public static class TL_payments_applyGiftCode extends TLObject { + public static final int constructor = 0xf6e26854; - @Override - public void serializeToStream(AbstractSerializedData stream) { + public String slug; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + stream.writeString(slug); } } - public static class TL_help_timezonesList extends help_timezonesList { - public static final int constructor = 0x7b74ed71; + public static class TL_payments_giveawayInfoResults extends payments_GiveawayInfo { + public static final int constructor = 0xe175e66f; - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; + public int flags; + public boolean winner; + public boolean refunded; + public int start_date; + public String gift_code_slug; + public long stars_prize; + public int finish_date; + public int winners_count; + public int activated_count; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + winner = (flags & 1) != 0; + refunded = (flags & 2) != 0; + start_date = stream.readInt32(exception); + if ((flags & 8) != 0) { + gift_code_slug = stream.readString(exception); } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - timezones.add(TL_timezone.TLdeserialize(stream, stream.readInt32(exception), exception)); + if ((flags & 16) != 0) { + stars_prize = stream.readInt64(exception); } - } - - @Override - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - final int count = timezones.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - timezones.get(i).serializeToStream(stream); + finish_date = stream.readInt32(exception); + winners_count = stream.readInt32(exception); + if ((flags & 4) != 0) { + activated_count = stream.readInt32(exception); } - stream.writeInt32(hash); - } - } - - public static class TL_help_getTimezonesList extends TLObject { - public static final int constructor = 0x49b30240; - - public int hash; - - @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return help_timezonesList.TLdeserialize(stream, constructor, exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(hash); + flags = winner ? (flags | 1) : (flags &~ 1); + flags = refunded ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + stream.writeInt32(start_date); + if ((flags & 1) != 0) { + stream.writeString(gift_code_slug); + } + if ((flags & 1) != 0) { + stream.writeInt64(stars_prize); + } + stream.writeInt32(finish_date); + stream.writeInt32(winners_count); + if ((flags & 4) != 0) { + stream.writeInt32(activated_count); + } } } - - public static class TL_account_updateBusinessWorkHours extends TLObject { - public static final int constructor = 0x4b00e066; - public int flags; - public TL_businessWorkHours business_work_hours; + public static class TL_payments_giveawayInfoResults_layer186 extends TL_payments_giveawayInfoResults { + public static final int constructor = 0xcd5570; - @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + winner = (flags & 1) != 0; + refunded = (flags & 2) != 0; + start_date = stream.readInt32(exception); + if ((flags & 1) != 0) { + gift_code_slug = stream.readString(exception); + } + finish_date = stream.readInt32(exception); + winners_count = stream.readInt32(exception); + activated_count = stream.readInt32(exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = winner ? (flags | 1) : (flags &~ 1); + flags = refunded ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); + stream.writeInt32(start_date); if ((flags & 1) != 0) { - business_work_hours.serializeToStream(stream); + stream.writeString(gift_code_slug); } + stream.writeInt32(finish_date); + stream.writeInt32(winners_count); + stream.writeInt32(activated_count); } } - - public static class TL_account_updateBusinessLocation extends TLObject { - public static final int constructor = 0x9e6b131a; - + + public static class TL_payments_giveawayInfo extends payments_GiveawayInfo { + public static final int constructor = 0x4367daa0; + public int flags; - public InputGeoPoint geo_point; - public String address; + public boolean participating; + public boolean preparing_results; + public int start_date; + public int joined_too_early_date; + public long admin_disallowed_chat_id; + public String disallowed_country; - @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + participating = (flags & 1) != 0; + preparing_results = (flags & 8) != 0; + start_date = stream.readInt32(exception); + if ((flags & 2) != 0) { + joined_too_early_date = stream.readInt32(exception); + } + if ((flags & 4) != 0) { + admin_disallowed_chat_id = stream.readInt64(exception); + } + if ((flags & 16) != 0) { + disallowed_country = stream.readString(exception); + } } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = participating ? (flags | 1) : (flags &~ 1); + flags = preparing_results ? (flags | 8) : (flags &~ 8); stream.writeInt32(flags); + stream.writeInt32(start_date); if ((flags & 2) != 0) { - geo_point.serializeToStream(stream); + stream.writeInt32(joined_too_early_date); } - if ((flags & 1) != 0) { - stream.writeString(address); + if ((flags & 4) != 0) { + stream.writeInt64(admin_disallowed_chat_id); + } + if ((flags & 16) != 0) { + stream.writeString(disallowed_country); } } } - public static class InputQuickReplyShortcut extends TLObject { - public static InputQuickReplyShortcut TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - InputQuickReplyShortcut result = null; + public static abstract class payments_GiveawayInfo extends TLObject { + + public static payments_GiveawayInfo TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + payments_GiveawayInfo result = null; switch (constructor) { - case TL_inputQuickReplyShortcut.constructor: - result = new TL_inputQuickReplyShortcut(); + case TL_payments_giveawayInfoResults.constructor: + result = new TL_payments_giveawayInfoResults(); break; - case TL_inputQuickReplyShortcutId.constructor: - result = new TL_inputQuickReplyShortcutId(); + case TL_payments_giveawayInfoResults_layer186.constructor: + result = new TL_payments_giveawayInfoResults_layer186(); + break; + case TL_payments_giveawayInfo.constructor: + result = new TL_payments_giveawayInfo(); break; } if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in InputQuickReplyShortcut", constructor)); + throw new RuntimeException(String.format("can't parse magic %x in payments_GiveawayInfo", constructor)); } if (result != null) { result.readParams(stream, exception); @@ -81736,2072 +66699,1732 @@ public static InputQuickReplyShortcut TLdeserialize(AbstractSerializedData strea } } - public static class TL_inputQuickReplyShortcut extends InputQuickReplyShortcut { - public static final int constructor = 0x24596d41; + public static class TL_payments_getGiveawayInfo extends TLObject { + public static final int constructor = 0xf4239425; - public String shortcut; + public InputPeer peer; + public int msg_id; - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - shortcut = stream.readString(exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return payments_GiveawayInfo.TLdeserialize(stream, constructor, exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(shortcut); + peer.serializeToStream(stream); + stream.writeInt32(msg_id); } } - public static class TL_inputQuickReplyShortcutId extends InputQuickReplyShortcut { - public static final int constructor = 0x1190cf1; - - public int shortcut_id; - - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - shortcut_id = stream.readInt32(exception); - } - - @Override - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(shortcut_id); - } - } - - public static class TL_quickReply extends TLObject { - public static final int constructor = 0x697102b; + public static class TL_payments_checkedGiftCode extends TLObject { + public static final int constructor = 0x284a1096; + public static final long NO_USER_ID = -1L; //custom - public int shortcut_id; - public String shortcut; - public int top_message; - public int count; + public int flags; + public boolean via_giveaway; + public Peer from_id; + public int giveaway_msg_id; + public long to_id = NO_USER_ID; + public int date; + public int months; + public int used_date; + public TL_stories.Boost boost; //custom + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); - public static TL_quickReply TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (constructor != TL_quickReply.constructor) { + public static TL_payments_checkedGiftCode TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_payments_checkedGiftCode.constructor != constructor) { if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_quickReply", constructor)); + throw new RuntimeException(String.format("can't parse magic %x in TL_payments_checkedGiftCode", constructor)); + } else { + return null; } - return null; } - TL_quickReply result = new TL_quickReply(); + TL_payments_checkedGiftCode result = new TL_payments_checkedGiftCode(); result.readParams(stream, exception); return result; } - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - shortcut_id = stream.readInt32(exception); - shortcut = stream.readString(exception); - top_message = stream.readInt32(exception); - count = stream.readInt32(exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + via_giveaway = (flags & 4) != 0; + if ((flags & 16) != 0) { + from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 8) != 0) { + giveaway_msg_id = stream.readInt32(exception); + } + if ((flags & 1) != 0) { + to_id = stream.readInt64(exception); + } + date = stream.readInt32(exception); + months = stream.readInt32(exception); + if ((flags & 2) != 0) { + used_date = stream.readInt32(exception); + } + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(shortcut_id); - stream.writeString(shortcut); - stream.writeInt32(top_message); - stream.writeInt32(count); - } - } - - public static class messages_quickReplies extends TLObject { - public static messages_quickReplies TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - messages_quickReplies result = null; - switch (constructor) { - case TL_messages_quickReplies.constructor: - result = new TL_messages_quickReplies(); - break; - case TL_messages_quickRepliesNotModified.constructor: - result = new TL_messages_quickRepliesNotModified(); - break; + flags = via_giveaway ? (flags | 4) : (flags & ~4); + stream.writeInt32(flags); + if ((flags & 16) != 0) { + from_id.serializeToStream(stream); } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in messages_quickReplies", constructor)); + if ((flags & 8) != 0) { + stream.writeInt32(giveaway_msg_id); } - if (result != null) { - result.readParams(stream, exception); + if ((flags & 1) != 0) { + stream.writeInt64(to_id); } - return result; + stream.writeInt32(date); + stream.writeInt32(months); + if ((flags & 2) != 0) { + stream.writeInt32(used_date); + } + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } - public static class TL_messages_quickRepliesNotModified extends messages_quickReplies { - public static final int constructor = 0x5f91eb5b; + public static class TL_payments_launchPrepaidGiveaway extends TLObject { + public static final int constructor = 0x5ff58f20; - @Override - public void serializeToStream(AbstractSerializedData stream) { + public InputPeer peer; + public long giveaway_id; + public InputStorePaymentPurpose purpose; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeInt64(giveaway_id); + purpose.serializeToStream(stream); } } - public static class TL_messages_quickReplies extends messages_quickReplies { - public static final int constructor = 0xc68d6695; + public static class TL_messageActionGiveawayLaunch extends MessageAction { + public static final int constructor = 0xa80f51e4; - public ArrayList quick_replies = new ArrayList<>(); - public ArrayList messages = new ArrayList<>(); - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); + public int flags; + public long stars; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - quick_replies.add(TL_quickReply.TLdeserialize(stream, stream.readInt32(exception), exception)); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - messages.add(Message.TLdeserialize(stream, stream.readInt32(exception), exception)); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - chats.add(Chat.TLdeserialize(stream, stream.readInt32(exception), exception)); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - users.add(User.TLdeserialize(stream, stream.readInt32(exception), exception)); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + if ((flags & 1) != 0) { + stars = stream.readInt64(exception); } } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = quick_replies.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - quick_replies.get(i).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = messages.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - messages.get(i).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - chats.get(i).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - users.get(i).serializeToStream(stream); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + stream.writeInt64(stars); } } } - public static class TL_messages_getQuickReplies extends TLObject { - public static final int constructor = 0xd483f2a8; + public static class TL_messageActionGiveawayLaunch_layer186 extends TL_messageActionGiveawayLaunch { + public static final int constructor = 0x332ba9ed; - public long hash; + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_messageActionGiveawayResults extends MessageAction { + public static final int constructor = 0x87e2f155; + + public int flags; + public boolean stars; + public int winners_count; + public int unclaimed_count; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_quickReplies.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + stars = (flags & 1) != 0; + winners_count = stream.readInt32(exception); + unclaimed_count = stream.readInt32(exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(hash); + flags = stars ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeInt32(winners_count); + stream.writeInt32(unclaimed_count); } } - - public static class TL_messages_reorderQuickReplies extends TLObject { - public static final int constructor = 0x60331907; - public ArrayList order = new ArrayList<>(); + public static class TL_messageActionGiveawayResults_layer186 extends TL_messageActionGiveawayResults { + public static final int constructor = 0x2a9fadc5; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + winners_count = stream.readInt32(exception); + unclaimed_count = stream.readInt32(exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = order.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - stream.writeInt32(order.get(i)); - } + stream.writeInt32(winners_count); + stream.writeInt32(unclaimed_count); } } - - public static class TL_messages_checkQuickReplyShortcut extends TLObject { - public static final int constructor = 0xf1d0fbd3; - public String shortcut; + public static class TL_messageActionPrizeStars extends MessageAction { + public static final int constructor = 0xb00c47a2; + + public int flags; + public boolean via_giveaway; + public boolean unclaimed; + public long stars; + public String transaction_id; + public Peer boost_peer; + public int giveaway_msg_id; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + unclaimed = (flags & 1) != 0; + stars = stream.readInt64(exception); + transaction_id = stream.readString(exception); + boost_peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + giveaway_msg_id = stream.readInt32(exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(shortcut); + flags = unclaimed ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeInt64(stars); + stream.writeString(transaction_id); + boost_peer.serializeToStream(stream); + stream.writeInt32(giveaway_msg_id); } } - - public static class TL_messages_editQuickReplyShortcut extends TLObject { - public static final int constructor = 0x5c003cef; - public int shortcut_id; - public String shortcut; + public static class TL_messageActionStarGift_layer192 extends TL_messageActionStarGift { + public static final int constructor = 0x9bb3ef44; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + name_hidden = (flags & 1) != 0; + saved = (flags & 4) != 0; + converted = (flags & 8) != 0; + gift = TL_stars.StarGift.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 2) != 0) { + message = TL_textWithEntities.TLdeserialize(stream, stream.readInt32(exception), exception); + } + convert_stars = stream.readInt64(exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(shortcut_id); - stream.writeString(shortcut); + flags = name_hidden ? (flags | 1) : (flags &~ 1); + flags = saved ? (flags | 4) : (flags &~ 4); + flags = converted ? (flags | 8) : (flags &~ 8); + stream.writeInt32(flags); + gift.serializeToStream(stream); + if ((flags & 2) != 0) { + message.serializeToStream(stream); + } + stream.writeInt64(convert_stars); } } - - public static class TL_messages_getQuickReplyMessages extends TLObject { - public static final int constructor = 0x94a495c3; - public int flags; - public int shortcut_id; - public ArrayList id = new ArrayList<>(); - public long hash; + public static class TL_messageActionStarGift extends MessageAction { + public static final int constructor = 0x4717e8a4; + + public boolean name_hidden; + public boolean saved; + public boolean converted; + public boolean upgraded; + public boolean transferred; + public boolean can_upgrade; + public boolean refunded; + public TL_stars.StarGift gift; + public TL_textWithEntities message; + public long convert_stars; + public int upgrade_msg_id; + public long upgrade_stars; + public Peer from_id; + public long saved_id; + + public boolean forceIn; //custom @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return messages_Messages.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + name_hidden = (flags & 1) != 0; + saved = (flags & 4) != 0; + converted = (flags & 8) != 0; + upgraded = (flags & 32) != 0; + transferred = (flags & 64) != 0; + can_upgrade = (flags & 1024) != 0; + refunded = (flags & 512) != 0; + gift = TL_stars.StarGift.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 2) != 0) { + message = TL_textWithEntities.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 16) != 0) { + convert_stars = stream.readInt64(exception); + } + if ((flags & 32) != 0) { + upgrade_msg_id = stream.readInt32(exception); + } + if ((flags & 256) != 0) { + upgrade_stars = stream.readInt64(exception); + } + if ((flags & 2048) != 0) { + from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4096) != 0) { + peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + saved_id = stream.readInt64(exception); + } } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = name_hidden ? (flags | 1) : (flags &~ 1); + flags = saved ? (flags | 4) : (flags &~ 4); + flags = converted ? (flags | 8) : (flags &~ 8); + flags = upgraded ? (flags | 32) : (flags &~ 32); + flags = transferred ? (flags | 64) : (flags &~ 64); + flags = can_upgrade ? (flags | 1024) : (flags &~ 1024); + flags = refunded ? (flags | 512) : (flags &~ 512); stream.writeInt32(flags); - stream.writeInt32(shortcut_id); - if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - stream.writeInt32(id.get(i)); - } + gift.serializeToStream(stream); + if ((flags & 2) != 0) { + message.serializeToStream(stream); + } + if ((flags & 16) != 0) { + stream.writeInt64(convert_stars); + } + if ((flags & 32) != 0) { + stream.writeInt32(upgrade_msg_id); + } + if ((flags & 256) != 0) { + stream.writeInt64(upgrade_stars); + } + if ((flags & 2048) != 0) { + from_id.serializeToStream(stream); + } + if ((flags & 4096) != 0) { + peer.serializeToStream(stream); + stream.writeInt64(saved_id); } - stream.writeInt64(hash); } } - - public static class TL_messages_sendQuickReplyMessages extends TLObject { - public static final int constructor = 0x6c750de1; - public InputPeer peer; - public int shortcut_id; - public ArrayList id = new ArrayList<>(); - public ArrayList random_id = new ArrayList<>(); + public static class TL_messageActionStarGift_layer197 extends TL_messageActionStarGift { + public static final int constructor = 0xd8f4f0a7; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + name_hidden = (flags & 1) != 0; + saved = (flags & 4) != 0; + converted = (flags & 8) != 0; + upgraded = (flags & 32) != 0; + transferred = (flags & 64) != 0; + can_upgrade = (flags & 1024) != 0; + refunded = (flags & 512) != 0; + gift = TL_stars.StarGift.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 2) != 0) { + message = TL_textWithEntities.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 16) != 0) { + convert_stars = stream.readInt64(exception); + } + if ((flags & 32) != 0) { + upgrade_msg_id = stream.readInt32(exception); + } + if ((flags & 256) != 0) { + upgrade_stars = stream.readInt64(exception); + } } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeInt32(shortcut_id); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - stream.writeInt32(id.get(i)); + flags = name_hidden ? (flags | 1) : (flags &~ 1); + flags = saved ? (flags | 4) : (flags &~ 4); + flags = converted ? (flags | 8) : (flags &~ 8); + flags = upgraded ? (flags | 32) : (flags &~ 32); + flags = transferred ? (flags | 64) : (flags &~ 64); + flags = can_upgrade ? (flags | 1024) : (flags &~ 1024); + flags = refunded ? (flags | 512) : (flags &~ 512); + stream.writeInt32(flags); + gift.serializeToStream(stream); + if ((flags & 2) != 0) { + message.serializeToStream(stream); } - stream.writeInt32(0x1cb5c415); - count = random_id.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - stream.writeInt64(random_id.get(i)); + if ((flags & 16) != 0) { + stream.writeInt64(convert_stars); + } + if ((flags & 32) != 0) { + stream.writeInt32(upgrade_msg_id); + } + if ((flags & 256) != 0) { + stream.writeInt64(upgrade_stars); } } } - - public static class TL_messages_deleteQuickReplyMessages extends TLObject { - public static final int constructor = 0xe105e910; - public int shortcut_id; - public ArrayList id = new ArrayList<>(); + public static class TL_messageActionStarGift_layer195 extends TL_messageActionStarGift { + public static final int constructor = 0x8557637; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + name_hidden = (flags & 1) != 0; + saved = (flags & 4) != 0; + converted = (flags & 8) != 0; + gift = TL_stars.StarGift.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 2) != 0) { + message = TL_textWithEntities.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 16) != 0) { + convert_stars = stream.readInt64(exception); + } } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(shortcut_id); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - stream.writeInt32(id.get(i)); + flags = name_hidden ? (flags | 1) : (flags &~ 1); + flags = saved ? (flags | 4) : (flags &~ 4); + flags = converted ? (flags | 8) : (flags &~ 8); + stream.writeInt32(flags); + gift.serializeToStream(stream); + if ((flags & 2) != 0) { + message.serializeToStream(stream); + } + if ((flags & 16) != 0) { + stream.writeInt64(convert_stars); } } } - - public static class TL_messages_deleteQuickReplyShortcut extends TLObject { - public static final int constructor = 0x3cc04740; - public int shortcut_id; + public static class TL_messageActionStarGiftUnique extends MessageAction { + public static final int constructor = 0xacdfcb81; - @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); - } + public boolean upgrade; + public boolean transferred; + public boolean saved; + public boolean refunded; + public TL_stars.StarGift gift; + public int can_export_at; + public long transfer_stars; + public Peer from_id; + public Peer peer; + public long saved_id; @Override - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(shortcut_id); - } - } - - public static class BusinessAwayMessageSchedule extends TLObject { - public static BusinessAwayMessageSchedule TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - BusinessAwayMessageSchedule result = null; - switch (constructor) { - case TL_businessAwayMessageScheduleAlways.constructor: - result = new TL_businessAwayMessageScheduleAlways(); - break; - case TL_businessAwayMessageScheduleOutsideWorkHours.constructor: - result = new TL_businessAwayMessageScheduleOutsideWorkHours(); - break; - case TL_businessAwayMessageScheduleCustom.constructor: - result = new TL_businessAwayMessageScheduleCustom(); - break; + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + upgrade = (flags & 1) != 0; + transferred = (flags & 2) != 0; + saved = (flags & 4) != 0; + refunded = (flags & 32) != 0; + gift = TL_stars.StarGift.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 8) != 0) { + can_export_at = stream.readInt32(exception); } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in BusinessAwayMessageSchedule", constructor)); + if ((flags & 16) != 0) { + transfer_stars = stream.readInt64(exception); } - if (result != null) { - result.readParams(stream, exception); + if ((flags & 64) != 0) { + from_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 128) != 0) { + peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + saved_id = stream.readInt64(exception); } - return result; } - } - - public static class TL_businessAwayMessageScheduleAlways extends BusinessAwayMessageSchedule { - public static final int constructor = 0xc9b9e2b9; - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = upgrade ? (flags | 1) : (flags &~ 1); + flags = transferred ? (flags | 2) : (flags &~ 2); + flags = saved ? (flags | 4) : (flags &~ 4); + flags = refunded ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + gift.serializeToStream(stream); + if ((flags & 8) != 0) { + stream.writeInt32(can_export_at); + } + if ((flags & 16) != 0) { + stream.writeInt64(transfer_stars); + } + if ((flags & 64) != 0) { + from_id.serializeToStream(stream); + } + if ((flags & 128) != 0) { + peer.serializeToStream(stream); + stream.writeInt64(saved_id); + } } } - public static class TL_businessAwayMessageScheduleOutsideWorkHours extends BusinessAwayMessageSchedule { - public static final int constructor = 0xc3f2f501; - - @Override - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - } - } + public static class TL_messageActionStarGiftUnique_layer197 extends TL_messageActionStarGiftUnique { + public static final int constructor = 0x26077b99; - public static class TL_businessAwayMessageScheduleCustom extends BusinessAwayMessageSchedule { - public static final int constructor = 0xcc4d9ecc; - - public int start_date; - public int end_date; + public boolean upgrade; + public boolean transferred; + public boolean saved; + public boolean refunded; + public TL_stars.StarGift gift; + public int can_export_at; + public long transfer_stars; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - start_date = stream.readInt32(exception); - end_date = stream.readInt32(exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + upgrade = (flags & 1) != 0; + transferred = (flags & 2) != 0; + saved = (flags & 4) != 0; + refunded = (flags & 32) != 0; + gift = TL_stars.StarGift.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 8) != 0) { + can_export_at = stream.readInt32(exception); + } + if ((flags & 16) != 0) { + transfer_stars = stream.readInt64(exception); + } } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(start_date); - stream.writeInt32(end_date); + flags = upgrade ? (flags | 1) : (flags &~ 1); + flags = transferred ? (flags | 2) : (flags &~ 2); + flags = saved ? (flags | 4) : (flags &~ 4); + flags = refunded ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + gift.serializeToStream(stream); + if ((flags & 8) != 0) { + stream.writeInt32(can_export_at); + } + if ((flags & 16) != 0) { + stream.writeInt64(transfer_stars); + } } } - public static class TL_inputBusinessGreetingMessage extends TLObject { - public static final int constructor = 0x194cb3b; + public static class TL_channels_updateEmojiStatus extends TLObject { + public static final int constructor = 0xf0d3e6a8; - public int shortcut_id; - public TL_inputBusinessRecipients recipients; - public int no_activity_days; + public InputChannel channel; + public EmojiStatus emoji_status; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - shortcut_id = stream.readInt32(exception); - recipients = TL_inputBusinessRecipients.TLdeserialize(stream, stream.readInt32(exception), exception); - no_activity_days = stream.readInt32(exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(shortcut_id); - recipients.serializeToStream(stream); - stream.writeInt32(no_activity_days); + channel.serializeToStream(stream); + emoji_status.serializeToStream(stream); } } + public static class TL_channels_getChannelRecommendations extends TLObject { + public static final int constructor = 0x25a71742; - public static class TL_businessGreetingMessage extends TLObject { - public static final int constructor = 0xe519abab; - - public int shortcut_id; - public TL_businessRecipients recipients; - public int no_activity_days; - - public static TL_businessGreetingMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (constructor != TL_businessGreetingMessage.constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_businessGreetingMessage", constructor)); - } - return null; - } - TL_businessGreetingMessage result = new TL_businessGreetingMessage(); - result.readParams(stream, exception); - return result; - } + public int flags; + public InputChannel channel; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - shortcut_id = stream.readInt32(exception); - recipients = TL_businessRecipients.TLdeserialize(stream, stream.readInt32(exception), exception); - no_activity_days = stream.readInt32(exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_Chats.TLdeserialize(stream, constructor, exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(shortcut_id); - recipients.serializeToStream(stream); - stream.writeInt32(no_activity_days); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + channel.serializeToStream(stream); + } } } - public static class TL_inputBusinessAwayMessage extends TLObject { - public static final int constructor = 0x832175e0; + public static class TL_channels_toggleViewForumAsMessages extends TLObject { + public static final int constructor = 0x9738bb15; + + public InputChannel channel_id; + public boolean enabled; - public int flags; - public boolean offline_only; - public int shortcut_id; - public BusinessAwayMessageSchedule schedule; - public TL_inputBusinessRecipients recipients; - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - offline_only = (flags & 1) != 0; - shortcut_id = stream.readInt32(exception); - schedule = BusinessAwayMessageSchedule.TLdeserialize(stream, stream.readInt32(exception), exception); - recipients = TL_inputBusinessRecipients.TLdeserialize(stream, stream.readInt32(exception), exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = offline_only ? (flags | 1) : (flags & 1); - stream.writeInt32(flags); - stream.writeInt32(shortcut_id); - schedule.serializeToStream(stream); - recipients.serializeToStream(stream); + channel_id.serializeToStream(stream); + stream.writeBool(enabled); } } - public static class TL_businessAwayMessage extends TLObject { - public static final int constructor = 0xef156a5c; + public static class TL_peerColor extends TLObject { + public static final int constructor = 0xb54b5acf; public int flags; - public boolean offline_only; - public int shortcut_id; - public BusinessAwayMessageSchedule schedule; - public TL_businessRecipients recipients; + public int color; + public long background_emoji_id; - public static TL_businessAwayMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (constructor != TL_businessAwayMessage.constructor) { + public static TL_peerColor TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_peerColor.constructor != constructor) { if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_businessAwayMessage", constructor)); + throw new RuntimeException(String.format("can't parse magic %x in TL_peerColor", constructor)); + } else { + return null; } - return null; } - TL_businessAwayMessage result = new TL_businessAwayMessage(); + TL_peerColor result = new TL_peerColor(); result.readParams(stream, exception); return result; } - + @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - offline_only = (flags & 1) != 0; - shortcut_id = stream.readInt32(exception); - schedule = BusinessAwayMessageSchedule.TLdeserialize(stream, stream.readInt32(exception), exception); - recipients = TL_businessRecipients.TLdeserialize(stream, stream.readInt32(exception), exception); + color = (flags & 1) != 0 ? stream.readInt32(exception) : -1; + if ((flags & 2) != 0) { + background_emoji_id = stream.readInt64(exception); + } } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = offline_only ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); - stream.writeInt32(shortcut_id); - schedule.serializeToStream(stream); - recipients.serializeToStream(stream); + if ((flags & 1) != 0) { + stream.writeInt32(color); + } + if ((flags & 2) != 0) { + stream.writeInt64(background_emoji_id); + } + } + } + + public static class help_PeerColorSet extends TLObject { + public static help_PeerColorSet TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + help_PeerColorSet result = null; + switch (constructor) { + case TL_help_peerColorSet.constructor: + result = new TL_help_peerColorSet(); + break; + case TL_help_peerColorProfileSet.constructor: + result = new TL_help_peerColorProfileSet(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in help_PeerColorSet", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; } } - public static class TL_account_updateBusinessAwayMessage extends TLObject { - public static final int constructor = 0xa26a7fa5; + public static class TL_help_peerColorSet extends help_PeerColorSet { + public static final int constructor = 0x26219a58; - public int flags; - public TL_inputBusinessAwayMessage message; + public ArrayList colors = new ArrayList<>(); @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + colors = Vector.deserializeInt(stream, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - message.serializeToStream(stream); - } + Vector.serializeInt(stream, colors); } } - public static class TL_account_updateBusinessGreetingMessage extends TLObject { - public static final int constructor = 0x66cdafc4; + public static class TL_help_peerColorProfileSet extends help_PeerColorSet { + public static final int constructor = 0x767d61eb; - public int flags; - public TL_inputBusinessGreetingMessage message; + public ArrayList palette_colors = new ArrayList<>(); + public ArrayList bg_colors = new ArrayList<>(); + public ArrayList story_colors = new ArrayList<>(); @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + palette_colors = Vector.deserializeInt(stream, exception); + + bg_colors = Vector.deserializeInt(stream, exception); + + story_colors = Vector.deserializeInt(stream, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - message.serializeToStream(stream); - } + Vector.serializeInt(stream, palette_colors); + Vector.serializeInt(stream, bg_colors); + Vector.serializeInt(stream, story_colors); } } - public static class TL_inputBusinessBotRecipients extends TLObject { - public static final int constructor = 0xc4e5921e; + public static class TL_help_peerColorOption extends TLObject { + public static final int constructor = 0xadec6ebe; public int flags; - public boolean existing_chats; - public boolean new_chats; - public boolean contacts; - public boolean non_contacts; - public boolean exclude_selected; - public ArrayList users = new ArrayList<>(); - public ArrayList exclude_users = new ArrayList<>(); + public boolean hidden; + public int color_id; + public help_PeerColorSet colors; + public help_PeerColorSet dark_colors; + public int channel_min_level; + public int group_min_level; - public static TL_inputBusinessRecipients TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (constructor != TL_inputBusinessRecipients.constructor) { + public static TL_help_peerColorOption TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_help_peerColorOption.constructor != constructor) { if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_inputBusinessRecipients", constructor)); + throw new RuntimeException(String.format("can't parse magic %x in TL_help_peerColorOption", constructor)); + } else { + return null; } - return null; } - TL_inputBusinessRecipients result = new TL_inputBusinessRecipients(); + TL_help_peerColorOption result = new TL_help_peerColorOption(); result.readParams(stream, exception); return result; } - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - existing_chats = (flags & 1) != 0; - new_chats = (flags & 2) != 0; - contacts = (flags & 4) != 0; - non_contacts = (flags & 8) != 0; - exclude_selected = (flags & 32) != 0; - if ((flags & 16) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - users.add(InputUser.TLdeserialize(stream, stream.readInt32(exception), exception)); - } + hidden = (flags & 1) != 0; + color_id = stream.readInt32(exception); + if ((flags & 2) != 0) { + colors = help_PeerColorSet.TLdeserialize(stream, stream.readInt32(exception), exception); } - if ((flags & 64) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - exclude_users.add(InputUser.TLdeserialize(stream, stream.readInt32(exception), exception)); - } + if ((flags & 4) != 0) { + dark_colors = help_PeerColorSet.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 8) != 0) { + channel_min_level = stream.readInt32(exception); + } + if ((flags & 16) != 0) { + group_min_level = stream.readInt32(exception); } } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = existing_chats ? (flags | 1) : (flags &~ 1); - flags = new_chats ? (flags | 2) : (flags &~ 2); - flags = contacts ? (flags | 4) : (flags &~ 4); - flags = non_contacts ? (flags | 8) : (flags &~ 8); - flags = exclude_selected ? (flags | 32) : (flags &~ 32); + flags = hidden ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); - if ((flags & 16) != 0) { - stream.writeInt32(0x1cb5c415); - final int count = users.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - users.get(i).serializeToStream(stream); - } + stream.writeInt32(color_id); + if ((flags & 2) != 0) { + colors.serializeToStream(stream); } - if ((flags & 64) != 0) { - stream.writeInt32(0x1cb5c415); - final int count = exclude_users.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - exclude_users.get(i).serializeToStream(stream); - } + if ((flags & 4) != 0) { + dark_colors.serializeToStream(stream); + } + if ((flags & 8) != 0) { + stream.writeInt32(channel_min_level); + } + if ((flags & 16) != 0) { + stream.writeInt32(group_min_level); } } } - public static class TL_businessBotRecipients extends TLObject { - public static final int constructor = 0xb88cf373; - - public int flags; - public boolean existing_chats; - public boolean new_chats; - public boolean contacts; - public boolean non_contacts; - public boolean exclude_selected; - public ArrayList users = new ArrayList<>(); - public ArrayList exclude_users = new ArrayList<>(); - - public static TL_businessBotRecipients TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (constructor != TL_businessBotRecipients.constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_businessBotRecipients", constructor)); - } - return null; + public static class help_PeerColors extends TLObject { + public static help_PeerColors TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + help_PeerColors result = null; + switch (constructor) { + case TL_help_peerColorsNotModified.constructor: + result = new TL_help_peerColorsNotModified(); + break; + case TL_help_peerColors.constructor: + result = new TL_help_peerColors(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in help_PeerColors", constructor)); + } + if (result != null) { + result.readParams(stream, exception); } - TL_businessBotRecipients result = new TL_businessBotRecipients(); - result.readParams(stream, exception); return result; } + } + + public static class TL_help_peerColorsNotModified extends help_PeerColors { + public static final int constructor = 0x2ba1f5ce; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - existing_chats = (flags & 1) != 0; - new_chats = (flags & 2) != 0; - contacts = (flags & 4) != 0; - non_contacts = (flags & 8) != 0; - exclude_selected = (flags & 32) != 0; - if ((flags & 16) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - users.add(stream.readInt64(exception)); - } - } - if ((flags & 64) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - exclude_users.add(stream.readInt64(exception)); - } - } + public void readParams(InputSerializedData stream, boolean exception) { + } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = existing_chats ? (flags | 1) : (flags &~ 1); - flags = new_chats ? (flags | 2) : (flags &~ 2); - flags = contacts ? (flags | 4) : (flags &~ 4); - flags = non_contacts ? (flags | 8) : (flags &~ 8); - flags = exclude_selected ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - if ((flags & 16) != 0) { - stream.writeInt32(0x1cb5c415); - final int count = users.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - stream.writeInt64(users.get(i)); - } - } - if ((flags & 64) != 0) { - stream.writeInt32(0x1cb5c415); - final int count = exclude_users.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - stream.writeInt64(exclude_users.get(i)); - } - } } } - public static class TL_inputBusinessRecipients extends TLObject { - public static final int constructor = 0x6f8b32aa; - - public int flags; - public boolean existing_chats; - public boolean new_chats; - public boolean contacts; - public boolean non_contacts; - public boolean exclude_selected; - public ArrayList users = new ArrayList<>(); + public static class TL_help_peerColors extends help_PeerColors { + public static final int constructor = 0xf8ed08; - public static TL_inputBusinessRecipients TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (constructor != TL_inputBusinessRecipients.constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_inputBusinessRecipients", constructor)); - } - return null; - } - TL_inputBusinessRecipients result = new TL_inputBusinessRecipients(); - result.readParams(stream, exception); - return result; - } + public int hash; + public ArrayList colors = new ArrayList<>(); @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - existing_chats = (flags & 1) != 0; - new_chats = (flags & 2) != 0; - contacts = (flags & 4) != 0; - non_contacts = (flags & 8) != 0; - exclude_selected = (flags & 32) != 0; - if ((flags & 16) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - users.add(InputUser.TLdeserialize(stream, stream.readInt32(exception), exception)); - } - } + public void readParams(InputSerializedData stream, boolean exception) { + hash = stream.readInt32(exception); + colors = Vector.deserialize(stream, TL_help_peerColorOption::TLdeserialize, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = existing_chats ? (flags | 1) : (flags &~ 1); - flags = new_chats ? (flags | 2) : (flags &~ 2); - flags = contacts ? (flags | 4) : (flags &~ 4); - flags = non_contacts ? (flags | 8) : (flags &~ 8); - flags = exclude_selected ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - if ((flags & 16) != 0) { - stream.writeInt32(0x1cb5c415); - final int count = users.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - users.get(i).serializeToStream(stream); - } - } + stream.writeInt32(hash); + Vector.serialize(stream, colors); } } - public static class TL_businessRecipients extends TLObject { - public static final int constructor = 0x21108ff7; - - public int flags; - public boolean existing_chats; - public boolean new_chats; - public boolean contacts; - public boolean non_contacts; - public boolean exclude_selected; - public ArrayList users = new ArrayList<>(); + public static class TL_help_getPeerColors extends TLObject { + public static final int constructor = 0xda80f42f; - public static TL_businessRecipients TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (constructor != TL_businessRecipients.constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_businessRecipients", constructor)); - } - return null; - } - TL_businessRecipients result = new TL_businessRecipients(); - result.readParams(stream, exception); - return result; - } + public int hash; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - existing_chats = (flags & 1) != 0; - new_chats = (flags & 2) != 0; - contacts = (flags & 4) != 0; - non_contacts = (flags & 8) != 0; - exclude_selected = (flags & 32) != 0; - if ((flags & 16) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - users.add(stream.readInt64(exception)); - } - } + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return help_PeerColors.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = existing_chats ? (flags | 1) : (flags &~ 1); - flags = new_chats ? (flags | 2) : (flags &~ 2); - flags = contacts ? (flags | 4) : (flags &~ 4); - flags = non_contacts ? (flags | 8) : (flags &~ 8); - flags = exclude_selected ? (flags | 32) : (flags &~ 32); - stream.writeInt32(flags); - if ((flags & 16) != 0) { - stream.writeInt32(0x1cb5c415); - final int count = users.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - stream.writeInt64(users.get(i)); - } - } + stream.writeInt32(hash); } } - public static class TL_connectedBot extends TLObject { - public static final int constructor = 0xbd068601; - - public int flags; - public boolean can_reply; - public long bot_id; - public TL_businessBotRecipients recipients; + public static class TL_help_getPeerProfileColors extends TLObject { + public static final int constructor = 0xabcfa9fd; - public static TL_connectedBot TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (constructor != TL_connectedBot.constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_connectedBot", constructor)); - } - return null; - } - TL_connectedBot result = new TL_connectedBot(); - result.readParams(stream, exception); - return result; - } + public int hash; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - can_reply = (flags & 1) != 0; - bot_id = stream.readInt64(exception); - recipients = TL_businessBotRecipients.TLdeserialize(stream, stream.readInt32(exception), exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return help_PeerColors.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = can_reply ? (flags | 1) : (flags &~ 1); - stream.writeInt32(flags); - stream.writeInt64(bot_id); - recipients.serializeToStream(stream); + stream.writeInt32(hash); } } - public static class TL_account_connectedBots extends TLObject { - public static final int constructor = 0x17d7f87b; + public static class TL_savedDialog extends TLObject { + public static final int constructor = 0xbd87cb6c; - public ArrayList connected_bots = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); + public int flags; + public boolean pinned; + public Peer peer; + public int top_message; - public static TL_account_connectedBots TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (constructor != TL_account_connectedBots.constructor) { + public static TL_savedDialog TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_savedDialog.constructor != constructor) { if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_account_connectedBots", constructor)); + throw new RuntimeException(String.format("can't parse magic %x in TL_savedDialog", constructor)); + } else { + return null; } - return null; } - TL_account_connectedBots result = new TL_account_connectedBots(); + TL_savedDialog result = new TL_savedDialog(); result.readParams(stream, exception); return result; } - - @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - connected_bots.add(TL_connectedBot.TLdeserialize(stream, stream.readInt32(exception), exception)); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - users.add(User.TLdeserialize(stream, stream.readInt32(exception), exception)); - } - } - - @Override - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = connected_bots.size(); - stream.writeInt32(count); - for (int i = 0; i < connected_bots.size(); ++i) { - connected_bots.get(i).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int i = 0; i < users.size(); ++i) { - users.get(i).serializeToStream(stream); - } - } - } - public static class TL_account_updateConnectedBot extends TLObject { - public static final int constructor = 0x43d8521d; - - public int flags; - public boolean can_reply; - public boolean deleted; - public InputUser bot; - public TL_inputBusinessBotRecipients recipients; - @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + pinned = (flags & 4) != 0; + peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + top_message = stream.readInt32(exception); } - + @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = can_reply ? (flags | 1) : (flags &~ 1); - flags = deleted ? (flags | 2) : (flags &~ 2); + flags = pinned ? (flags | 4) : (flags &~ 4); stream.writeInt32(flags); - bot.serializeToStream(stream); - recipients.serializeToStream(stream); + peer.serializeToStream(stream); + stream.writeInt32(top_message); } } - public static class TL_account_getConnectedBots extends TLObject { - public static final int constructor = 0x4ea4c80f; - - @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_account_connectedBots.TLdeserialize(stream, constructor, exception); - } - - @Override - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); + public static class messages_SavedDialogs extends TLObject { + public static messages_SavedDialogs TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + messages_SavedDialogs result = null; + switch (constructor) { + case TL_messages_savedDialogs.constructor: + result = new TL_messages_savedDialogs(); + break; + case TL_messages_savedDialogsSlice.constructor: + result = new TL_messages_savedDialogsSlice(); + break; + case TL_messages_savedDialogsNotModified.constructor: + result = new TL_messages_savedDialogsNotModified(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in messages_SavedDialogs", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; } } - public static class TL_messages_toggleDialogFilterTags extends TLObject { - public static final int constructor = 0xfd2dda49; - - public boolean enabled; + public static class TL_messages_savedDialogs extends messages_SavedDialogs { + public static final int constructor = 0xf83ae221; + + public ArrayList dialogs = new ArrayList<>(); + public ArrayList messages = new ArrayList<>(); + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + dialogs = Vector.deserialize(stream, TL_savedDialog::TLdeserialize, exception); + messages = Vector.deserialize(stream, Message::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeBool(enabled); + Vector.serialize(stream, dialogs); + Vector.serialize(stream, messages); + Vector.serialize(stream, users); + Vector.serialize(stream, chats); } } - public static class Vector extends TLObject { - public static final int constructor = 0x1cb5c415; - public ArrayList objects = new ArrayList<>(); - } + public static class TL_messages_savedDialogsSlice extends messages_SavedDialogs { + public static final int constructor = 0x44ba9dd9; - public static class TL_account_toggleConnectedBotPaused extends TLObject { - public static final int constructor = 0x646E1097; - - public InputPeer peer; - public boolean paused; + public int count; + public ArrayList dialogs = new ArrayList<>(); + public ArrayList messages = new ArrayList<>(); + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + count = stream.readInt32(exception); + dialogs = Vector.deserialize(stream, TL_savedDialog::TLdeserialize, exception); + messages = Vector.deserialize(stream, Message::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); - stream.writeBool(paused); + stream.writeInt32(count); + Vector.serialize(stream, dialogs); + Vector.serialize(stream, messages); + Vector.serialize(stream, users); + Vector.serialize(stream, chats); } } - public static class TL_account_disablePeerConnectedBot extends TLObject { - public static final int constructor = 0x5e437ed9; + public static class TL_messages_savedDialogsNotModified extends messages_SavedDialogs { + public static final int constructor = 0xc01f6fe8; - public InputPeer peer; + public int count; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + count = stream.readInt32(exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - peer.serializeToStream(stream); + stream.writeInt32(count); } } - public static class TL_businessIntro extends TLObject { - public static final int constructor = 0x5a0a066d; - - public int flags; - public String title; - public String description; - public Document sticker; - - public static TL_businessIntro TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (constructor != TL_businessIntro.constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_businessIntro", constructor)); - } - return null; - } - TL_businessIntro result = new TL_businessIntro(); - result.readParams(stream, exception); - return result; - } + public static class TL_messages_getPinnedSavedDialogs extends TLObject { + public static final int constructor = 0xd63d94e0; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - title = stream.readString(exception); - description = stream.readString(exception); - if ((flags & 1) != 0) { - sticker = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_SavedDialogs.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeString(title); - stream.writeString(description); - if ((flags & 1) != 0) { - sticker.serializeToStream(stream); - } } } - public static class TL_inputBusinessIntro extends TLObject { - public static final int constructor = 0x9c469cd; + public static class TL_messages_getSavedDialogs extends TLObject { + public static final int constructor = 0x5381d21a; public int flags; - public String title; - public String description; - public InputDocument sticker; - - public static TL_inputBusinessIntro TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (constructor != TL_inputBusinessIntro.constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_inputBusinessIntro", constructor)); - } - return null; - } - TL_inputBusinessIntro result = new TL_inputBusinessIntro(); - result.readParams(stream, exception); - return result; - } + public boolean exclude_pinned; + public int offset_date; + public int offset_id; + public InputPeer offset_peer; + public int limit; + public long hash; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - title = stream.readString(exception); - description = stream.readString(exception); - if ((flags & 1) != 0) { - sticker = InputDocument.TLdeserialize(stream, stream.readInt32(exception), exception); - } + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_SavedDialogs.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = exclude_pinned ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); - stream.writeString(title); - stream.writeString(description); - if ((flags & 1) != 0) { - sticker.serializeToStream(stream); - } + stream.writeInt32(offset_date); + stream.writeInt32(offset_id); + offset_peer.serializeToStream(stream); + stream.writeInt32(limit); + stream.writeInt64(hash); } } - public static class TL_account_updateBusinessIntro extends TLObject { - public static final int constructor = 0xa614d034; + public static class TL_messages_getSavedHistory extends TLObject { + public static final int constructor = 0x3d9a414d; - public int flags; - public TL_inputBusinessIntro intro; + public InputPeer peer; + public int offset_id; + public int offset_date; + public int add_offset; + public int limit; + public int max_id; + public int min_id; + public long hash; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_Messages.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - if ((flags & 1) != 0) { - intro.serializeToStream(stream); - } + peer.serializeToStream(stream); + stream.writeInt32(offset_id); + stream.writeInt32(offset_date); + stream.writeInt32(add_offset); + stream.writeInt32(limit); + stream.writeInt32(max_id); + stream.writeInt32(min_id); + stream.writeInt64(hash); } } - - public static class TL_birthday extends TLObject { - public static final int constructor = 0x6c8e1e06; - - public int flags; - public int day; - public int month; - public int year; - public static TL_birthday TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (constructor != TL_birthday.constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_birthday", constructor)); - } - return null; - } - TL_birthday result = new TL_birthday(); - result.readParams(stream, exception); - return result; - } + public static class TL_messages_toggleSavedDialogPin extends TLObject { + public static final int constructor = 0xac81bbde; + + public int flags; + public boolean pinned; + public InputDialogPeer peer; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - day = stream.readInt32(exception); - month = stream.readInt32(exception); - if ((flags & 1) != 0) { - year = stream.readInt32(exception); - } + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = pinned ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); - stream.writeInt32(day); - stream.writeInt32(month); - if ((flags & 1) != 0) { - stream.writeInt32(year); - } + peer.serializeToStream(stream); } } - public static class TL_contactBirthday extends TLObject { - public static final int constructor = 0x1d998733; - - public long contact_id; - public TL_birthday birthday; + public static class TL_messages_reorderPinnedSavedDialogs extends TLObject { + public static final int constructor = 0x8b716587; - public static TL_contactBirthday TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (constructor != TL_contactBirthday.constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_contactBirthday", constructor)); - } - return null; - } - TL_contactBirthday result = new TL_contactBirthday(); - result.readParams(stream, exception); - return result; - } + public int flags; + public boolean force; + public ArrayList order = new ArrayList<>(); @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - contact_id = stream.readInt64(exception); - birthday = TL_birthday.TLdeserialize(stream, stream.readInt32(exception), exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt64(contact_id); - birthday.serializeToStream(stream); + flags = force ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + Vector.serialize(stream, order); } } - public static class TL_contacts_contactBirthdays extends TLObject { - public static final int constructor = 0x114ff30d; - - public ArrayList contacts = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); + public static class TL_messages_getSavedReactionTags extends TLObject { + public static final int constructor = 0x3637e05b; - public static TL_contacts_contactBirthdays TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (constructor != TL_contacts_contactBirthdays.constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_contacts_contactBirthdays", constructor)); - } - return null; - } - TL_contacts_contactBirthdays result = new TL_contacts_contactBirthdays(); - result.readParams(stream, exception); - return result; - } + public int flags; + public InputPeer peer; + public long hash; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - contacts.add(TL_contactBirthday.TLdeserialize(stream, stream.readInt32(exception), exception)); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - users.add(User.TLdeserialize(stream, stream.readInt32(exception), exception)); - } + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_SavedReactionTags.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = contacts.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - contacts.get(i).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - users.get(i).serializeToStream(stream); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + peer.serializeToStream(stream); } + stream.writeInt64(hash); } } - public static class TL_account_updateBirthday extends TLObject { - public static final int constructor = 0xcc6e0c11; + public static class TL_messages_updateSavedReactionTag extends TLObject { + public static final int constructor = 0x60297dec; public int flags; - public TL_birthday birthday; + public Reaction reaction; + public String title; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); + reaction.serializeToStream(stream); if ((flags & 1) != 0) { - birthday.serializeToStream(stream); + stream.writeString(title); } } } - public static class TL_account_getBirthdays extends TLObject { - public static final int constructor = 0xdaeda864; + public static class TL_messages_getOutboxReadDate extends TLObject { + public static final int constructor = 0x8c4bfe5d; - public int flags; - public TL_birthday birthday; + public InputPeer peer; + public int msg_id; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_contacts_contactBirthdays.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_outboxReadDate.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeInt32(msg_id); } } - - public static class TL_missingInvitee extends TLObject { - public static final int constructor = 0x628c9224; + + public static class TL_businessLocation extends TLObject { + public static final int constructor = 0xac5c1af7; public int flags; - public boolean premium_would_allow_invite; - public boolean premium_required_for_pm; - public long user_id; + public GeoPoint geo_point; + public String address; - public static TL_missingInvitee TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (constructor != TL_missingInvitee.constructor) { + public static TL_businessLocation TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (constructor != TL_businessLocation.constructor) { if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_missingInvitee", constructor)); + throw new RuntimeException(String.format("can't parse magic %x in TL_businessLocation", constructor)); } return null; } - TL_missingInvitee result = new TL_missingInvitee(); + TL_businessLocation result = new TL_businessLocation(); result.readParams(stream, exception); return result; } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - premium_would_allow_invite = (flags & 1) != 0; - premium_required_for_pm = (flags & 2) != 0; - user_id = stream.readInt64(exception); + if ((flags & 1) != 0) { + geo_point = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); + } + address = stream.readString(exception); } - @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = premium_would_allow_invite ? (flags | 1) : (flags &~ 1); - flags = premium_required_for_pm ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); - stream.writeInt64(user_id); + if ((flags & 1) != 0) { + geo_point.serializeToStream(stream); + } + stream.writeString(address); } } - public static class TL_messages_invitedUsers extends TLObject { - public static final int constructor = 0x7f5defa6; + public static class TL_timezone extends TLObject { + public static final int constructor = 0xff9289f5; - public Updates updates; - public ArrayList missing_invitees = new ArrayList<>(); + public String id; + public String name; + public int utc_offset; - public static TL_messages_invitedUsers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (constructor != TL_messages_invitedUsers.constructor) { + public static TL_timezone TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (constructor != TL_timezone.constructor) { if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messages_invitedUsers", constructor)); + throw new RuntimeException(String.format("can't parse magic %x in TL_timezone", constructor)); } return null; } - TL_messages_invitedUsers result = new TL_messages_invitedUsers(); + TL_timezone result = new TL_timezone(); result.readParams(stream, exception); return result; } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - updates = Updates.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_missingInvitee object = TL_missingInvitee.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - missing_invitees.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + id = stream.readString(exception); + name = stream.readString(exception); + utc_offset = stream.readInt32(exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - updates.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = missing_invitees.size(); - stream.writeInt32(count); + stream.writeString(id); + stream.writeString(name); + stream.writeInt32(utc_offset); } } - public static class TL_account_updatePersonalChannel extends TLObject { - public static final int constructor = 0xd94305e0; - - public InputChannel channel; + public static class help_timezonesList extends TLObject { - @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + public ArrayList timezones = new ArrayList<>(); + public int hash; + + public static help_timezonesList TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + help_timezonesList result = null; + switch (constructor) { + case TL_help_timezonesListNotModified.constructor: + result = new TL_help_timezonesListNotModified(); + break; + case TL_help_timezonesList.constructor: + result = new TL_help_timezonesList(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in help_timezonesList", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; } + } + + public static class TL_help_timezonesListNotModified extends help_timezonesList { + public static final int constructor = 0x970708cc; @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); } } - public static class TL_channels_restrictSponsoredMessages extends TLObject { - public static final int constructor = 0x9ae91519; - - public InputChannel channel; - public boolean restricted; + public static class TL_help_timezonesList extends help_timezonesList { + public static final int constructor = 0x7b74ed71; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Updates.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + timezones = Vector.deserialize(stream, TL_timezone::TLdeserialize, exception); + hash = stream.readInt32(exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - channel.serializeToStream(stream); - stream.writeBool(restricted); + Vector.serialize(stream, timezones); + stream.writeInt32(hash); } } - public static class TL_dataJSON extends TLObject { - public static final int constructor = 0x7d748d04; - - public String data; + public static class TL_help_getTimezonesList extends TLObject { + public static final int constructor = 0x49b30240; - public static TL_dataJSON TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_dataJSON.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_dataJSON", constructor)); - } else { - return null; - } - } - TL_dataJSON result = new TL_dataJSON(); - result.readParams(stream, exception); - return result; - } + public int hash; - public void readParams(AbstractSerializedData stream, boolean exception) { - data = stream.readString(exception); + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return help_timezonesList.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + @Override + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(data); + stream.writeInt32(hash); } } - public static class TL_inputBusinessChatLink extends TLObject { - public static final int constructor = 0x11679fa7; - - public int flags; - public String message; - public ArrayList entities = new ArrayList<>(); - public String title; - - public static TL_inputBusinessChatLink TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_inputBusinessChatLink.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_inputBusinessChatLink", constructor)); - } else { - return null; - } + public static class InputQuickReplyShortcut extends TLObject { + public static InputQuickReplyShortcut TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + InputQuickReplyShortcut result = null; + switch (constructor) { + case TL_inputQuickReplyShortcut.constructor: + result = new TL_inputQuickReplyShortcut(); + break; + case TL_inputQuickReplyShortcutId.constructor: + result = new TL_inputQuickReplyShortcutId(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in InputQuickReplyShortcut", constructor)); + } + if (result != null) { + result.readParams(stream, exception); } - TL_inputBusinessChatLink result = new TL_inputBusinessChatLink(); - result.readParams(stream, exception); return result; } + } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - message = stream.readString(exception); - if ((flags & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 2) != 0) { - title = stream.readString(exception); - } + public static class TL_inputQuickReplyShortcut extends InputQuickReplyShortcut { + public static final int constructor = 0x24596d41; + + public String shortcut; + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + shortcut = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + @Override + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeString(message); - if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 2) != 0) { - stream.writeString(title); - } + stream.writeString(shortcut); } } - public static class TL_businessChatLink extends TLObject { - public static final int constructor = 0xb4ae666f; - - public int flags; - public String link; - public String message; - public ArrayList entities = new ArrayList<>(); - public String title; - public int views; + public static class TL_inputQuickReplyShortcutId extends InputQuickReplyShortcut { + public static final int constructor = 0x1190cf1; - public static TL_businessChatLink TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_businessChatLink.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_businessChatLink", constructor)); - } else { - return null; - } - } - TL_businessChatLink result = new TL_businessChatLink(); - result.readParams(stream, exception); - return result; - } + public int shortcut_id; - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - link = stream.readString(exception); - message = stream.readString(exception); - if ((flags & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - if ((flags & 2) != 0) { - title = stream.readString(exception); - } - views = stream.readInt32(exception); + @Override + public void readParams(InputSerializedData stream, boolean exception) { + shortcut_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + @Override + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeString(link); - stream.writeString(message); - if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - if ((flags & 2) != 0) { - stream.writeString(title); - } - stream.writeInt32(views); + stream.writeInt32(shortcut_id); } } - public static class TL_account_businessChatLinks extends TLObject { - public static final int constructor = 0xec43a2d1; + public static class TL_quickReply extends TLObject { + public static final int constructor = 0x697102b; - public ArrayList links = new ArrayList<>(); - public ArrayList chats = new ArrayList<>(); - public ArrayList users = new ArrayList<>(); + public int shortcut_id; + public String shortcut; + public int top_message; + public int count; - public static TL_account_businessChatLinks TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_account_businessChatLinks.constructor != constructor) { + public static TL_quickReply TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (constructor != TL_quickReply.constructor) { if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_account_businessChatLinks", constructor)); - } else { - return null; + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_quickReply", constructor)); } + return null; } - TL_account_businessChatLinks result = new TL_account_businessChatLinks(); + TL_quickReply result = new TL_quickReply(); result.readParams(stream, exception); return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_businessChatLink object = TL_businessChatLink.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - links.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } + @Override + public void readParams(InputSerializedData stream, boolean exception) { + shortcut_id = stream.readInt32(exception); + shortcut = stream.readString(exception); + top_message = stream.readInt32(exception); count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } } - public void serializeToStream(AbstractSerializedData stream) { + @Override + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = links.size(); + stream.writeInt32(shortcut_id); + stream.writeString(shortcut); + stream.writeInt32(top_message); stream.writeInt32(count); - for (int a = 0; a < count; a++) { - links.get(a).serializeToStream(stream); + } + } + + public static class messages_quickReplies extends TLObject { + public static messages_quickReplies TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + messages_quickReplies result = null; + switch (constructor) { + case TL_messages_quickReplies.constructor: + result = new TL_messages_quickReplies(); + break; + case TL_messages_quickRepliesNotModified.constructor: + result = new TL_messages_quickRepliesNotModified(); + break; } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in messages_quickReplies", constructor)); } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); + if (result != null) { + result.readParams(stream, exception); } + return result; } } - public static class TL_account_resolvedBusinessChatLinks extends TLObject { - public static final int constructor = 0x9a23af21; + public static class TL_messages_quickRepliesNotModified extends messages_quickReplies { + public static final int constructor = 0x5f91eb5b; - public int flags; - public Peer peer; - public String message; - public ArrayList entities = new ArrayList<>(); + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_messages_quickReplies extends messages_quickReplies { + public static final int constructor = 0xc68d6695; + + public ArrayList quick_replies = new ArrayList<>(); + public ArrayList messages = new ArrayList<>(); public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_account_resolvedBusinessChatLinks TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_account_resolvedBusinessChatLinks.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_account_businessChatLinks", constructor)); - } else { - return null; - } - } - TL_account_resolvedBusinessChatLinks result = new TL_account_resolvedBusinessChatLinks(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - message = stream.readString(exception); - if ((flags & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } - } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + @Override + public void readParams(InputSerializedData stream, boolean exception) { + quick_replies = Vector.deserialize(stream, TL_quickReply::TLdeserialize, exception); + messages = Vector.deserialize(stream, Message::TLdeserialize, exception); + chats = Vector.deserialize(stream, Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + @Override + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - peer.serializeToStream(stream); - stream.writeString(message); - if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - stream.writeInt32(0x1cb5c415); - int count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, quick_replies); + Vector.serialize(stream, messages); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } - public static class TL_account_createBusinessChatLink extends TLObject { - public static final int constructor = 0x8851e68e; + public static class TL_messages_getQuickReplies extends TLObject { + public static final int constructor = 0xd483f2a8; - public TL_inputBusinessChatLink link; + public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_businessChatLink.TLdeserialize(stream, constructor, exception); + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_quickReplies.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + @Override + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - link.serializeToStream(stream); + stream.writeInt64(hash); } } - public static class TL_account_editBusinessChatLink extends TLObject { - public static final int constructor = 0x8c3410af; + public static class TL_messages_reorderQuickReplies extends TLObject { + public static final int constructor = 0x60331907; - public String slug; - public TL_inputBusinessChatLink link; + public ArrayList order = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_businessChatLink.TLdeserialize(stream, constructor, exception); + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + @Override + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(slug); - link.serializeToStream(stream); + Vector.serializeInt(stream, order); } } - public static class TL_account_deleteBusinessChatLink extends TLObject { - public static final int constructor = 0x60073674; + public static class TL_messages_checkQuickReplyShortcut extends TLObject { + public static final int constructor = 0xf1d0fbd3; - public String slug; + public String shortcut; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + @Override + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(slug); + stream.writeString(shortcut); } } - public static class TL_account_getBusinessChatLinks extends TLObject { - public static final int constructor = 0x6f70dde1; + public static class TL_messages_editQuickReplyShortcut extends TLObject { + public static final int constructor = 0x5c003cef; + + public int shortcut_id; + public String shortcut; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_account_businessChatLinks.TLdeserialize(stream, constructor, exception); + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + @Override + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + stream.writeInt32(shortcut_id); + stream.writeString(shortcut); } } - public static class TL_account_resolveBusinessChatLink extends TLObject { - public static final int constructor = 0x5492e5ee; + public static class TL_messages_getQuickReplyMessages extends TLObject { + public static final int constructor = 0x94a495c3; - public String slug; + public int flags; + public int shortcut_id; + public ArrayList id = new ArrayList<>(); + public long hash; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_account_resolvedBusinessChatLinks.TLdeserialize(stream, constructor, exception); + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return messages_Messages.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + @Override + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeString(slug); + stream.writeInt32(flags); + stream.writeInt32(shortcut_id); + if ((flags & 1) != 0) { + Vector.serializeInt(stream, id); + } + stream.writeInt64(hash); } } - public static class TL_account_toggleSponsoredMessages extends TLObject { - public static final int constructor = 0xb9d9a38d; + public static class TL_messages_sendQuickReplyMessages extends TLObject { + public static final int constructor = 0x6c750de1; - public boolean enabled; + public InputPeer peer; + public int shortcut_id; + public ArrayList id = new ArrayList<>(); + public ArrayList random_id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return Bool.TLdeserialize(stream, constructor, exception); + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + @Override + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeBool(enabled); + peer.serializeToStream(stream); + stream.writeInt32(shortcut_id); + Vector.serializeInt(stream, id); + Vector.serializeLong(stream, random_id); } } - public static class ReactionNotificationsFrom extends TLObject { - public static ReactionNotificationsFrom TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - ReactionNotificationsFrom result = null; - switch (constructor) { - case TL_reactionNotificationsFromContacts.constructor: - result = new TL_reactionNotificationsFromContacts(); - break; - case TL_reactionNotificationsFromAll.constructor: - result = new TL_reactionNotificationsFromAll(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in ReactionNotificationsFrom", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; + public static class TL_messages_deleteQuickReplyMessages extends TLObject { + public static final int constructor = 0xe105e910; + + public int shortcut_id; + public ArrayList id = new ArrayList<>(); + + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(shortcut_id); + Vector.serializeInt(stream, id); } } - public static class TL_reactionNotificationsFromContacts extends ReactionNotificationsFrom { - public static final int constructor = 0xbac3a61a; + public static class TL_messages_deleteQuickReplyShortcut extends TLObject { + public static final int constructor = 0x3cc04740; + + public int shortcut_id; - public void readParams(AbstractSerializedData stream, boolean exception) {} + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { + @Override + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + stream.writeInt32(shortcut_id); } } - public static class TL_reactionNotificationsFromAll extends ReactionNotificationsFrom { - public static final int constructor = 0x4b9e22a0; + public static class TL_messages_toggleDialogFilterTags extends TLObject { + public static final int constructor = 0xfd2dda49; + + public boolean enabled; - public void readParams(AbstractSerializedData stream, boolean exception) {} + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } - public void serializeToStream(AbstractSerializedData stream) { + @Override + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + stream.writeBool(enabled); } } - public static class TL_reactionsNotifySettings extends TLObject { - public static final int constructor = 0x56e34970; + public static class TL_missingInvitee extends TLObject { + public static final int constructor = 0x628c9224; public int flags; - public ReactionNotificationsFrom messages_notify_from; - public ReactionNotificationsFrom stories_notify_from; - public NotificationSound sound; - public boolean show_previews; + public boolean premium_would_allow_invite; + public boolean premium_required_for_pm; + public long user_id; - public static TL_reactionsNotifySettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_reactionsNotifySettings.constructor != constructor) { + public static TL_missingInvitee TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (constructor != TL_missingInvitee.constructor) { if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_reactionsNotifySettings", constructor)); - } else { - return null; + throw new RuntimeException(String.format("can't parse magic %x in TL_missingInvitee", constructor)); } + return null; } - TL_reactionsNotifySettings result = new TL_reactionsNotifySettings(); + TL_missingInvitee result = new TL_missingInvitee(); result.readParams(stream, exception); return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + @Override + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - if ((flags & 1) != 0) { - messages_notify_from = ReactionNotificationsFrom.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 2) != 0) { - stories_notify_from = ReactionNotificationsFrom.TLdeserialize(stream, stream.readInt32(exception), exception); - } - sound = NotificationSound.TLdeserialize(stream, stream.readInt32(exception), exception); - show_previews = stream.readBool(exception); + premium_would_allow_invite = (flags & 1) != 0; + premium_required_for_pm = (flags & 2) != 0; + user_id = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + @Override + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = premium_would_allow_invite ? (flags | 1) : (flags &~ 1); + flags = premium_required_for_pm ? (flags | 2) : (flags &~ 2); stream.writeInt32(flags); - if ((flags & 1) != 0) { - messages_notify_from.serializeToStream(stream); - } - if ((flags & 2) != 0) { - stories_notify_from.serializeToStream(stream); + stream.writeInt64(user_id); + } + } + + public static class TL_messages_invitedUsers extends TLObject { + public static final int constructor = 0x7f5defa6; + + public Updates updates; + public ArrayList missing_invitees = new ArrayList<>(); + + public static TL_messages_invitedUsers TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (constructor != TL_messages_invitedUsers.constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_messages_invitedUsers", constructor)); + } + return null; } - sound.serializeToStream(stream); - stream.writeBool(show_previews); + TL_messages_invitedUsers result = new TL_messages_invitedUsers(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + updates = Updates.TLdeserialize(stream, stream.readInt32(exception), exception); + missing_invitees = Vector.deserialize(stream, TL_missingInvitee::TLdeserialize, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + updates.serializeToStream(stream); + Vector.serialize(stream, missing_invitees); } } - public static class TL_account_getReactionsNotifySettings extends TLObject { - public static final int constructor = 0x6dd654c; + public static class TL_channels_restrictSponsoredMessages extends TLObject { + public static final int constructor = 0x9ae91519; + + public InputChannel channel; + public boolean restricted; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_reactionsNotifySettings.TLdeserialize(stream, constructor, exception); + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + @Override + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + channel.serializeToStream(stream); + stream.writeBool(restricted); } } - public static class TL_account_setReactionsNotifySettings extends TLObject { - public static final int constructor = 0x316ce548; + public static class TL_dataJSON extends TLObject { + public static final int constructor = 0x7d748d04; + + public String data; - public TL_reactionsNotifySettings settings; + public static TL_dataJSON TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_dataJSON.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_dataJSON", constructor)); + } else { + return null; + } + } + TL_dataJSON result = new TL_dataJSON(); + result.readParams(stream, exception); + return result; + } - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_reactionsNotifySettings.TLdeserialize(stream, constructor, exception); + public void readParams(InputSerializedData stream, boolean exception) { + data = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - settings.serializeToStream(stream); + stream.writeString(data); } } @@ -83811,18 +68434,16 @@ public static class TL_auth_reportMissingCode extends TLObject { public String phone_number; public String phone_code_hash; public String mnc; -// public String mcc; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(phone_number); stream.writeString(phone_code_hash); stream.writeString(mnc); -// stream.writeString(mcc); } } @@ -83834,7 +68455,7 @@ public static class BroadcastRevenueBalances extends TLObject { public long available_balance; public long overall_revenue; - public static BroadcastRevenueBalances TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static BroadcastRevenueBalances TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { BroadcastRevenueBalances result = null; switch (constructor) { case TL_broadcastRevenueBalances.constructor: @@ -83857,7 +68478,7 @@ public static BroadcastRevenueBalances TLdeserialize(AbstractSerializedData stre public static class TL_broadcastRevenueBalances extends BroadcastRevenueBalances { public static final int constructor = 0xc3ff71e7; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); withdrawal_enabled = (flags & 1) != 0; current_balance = stream.readInt64(exception); @@ -83865,7 +68486,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { overall_revenue = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = withdrawal_enabled ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -83878,14 +68499,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_broadcastRevenueBalances_layer186 extends TL_broadcastRevenueBalances { public static final int constructor = 0x8438f1c6; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { current_balance = stream.readInt64(exception); available_balance = stream.readInt64(exception); overall_revenue = stream.readInt64(exception); withdrawal_enabled = true; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(current_balance); stream.writeInt64(available_balance); @@ -83895,7 +68516,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_availableEffect extends TLObject { public static final int constructor = 0x93c3e27e; - + public int flags; public boolean premium_required; public long id; @@ -83904,7 +68525,7 @@ public static class TL_availableEffect extends TLObject { public long effect_sticker_id; public long effect_animation_id; - public static TL_availableEffect TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_availableEffect TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_availableEffect.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_availableEffect", constructor)); @@ -83917,7 +68538,7 @@ public static TL_availableEffect TLdeserialize(AbstractSerializedData stream, in return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); premium_required = (flags & 4) != 0; id = stream.readInt64(exception); @@ -83931,7 +68552,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = premium_required ? flags | 4 : flags &~ 4; stream.writeInt32(flags); @@ -83947,14 +68568,13 @@ public void serializeToStream(AbstractSerializedData stream) { } } - public static class messages_AvailableEffects extends TLObject { public int hash; public ArrayList effects = new ArrayList<>(); public ArrayList documents = new ArrayList<>(); - public static messages_AvailableEffects TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static messages_AvailableEffects TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { messages_AvailableEffects result = null; switch (constructor) { case TL_messages_availableEffectsNotModified.constructor: @@ -83977,64 +68597,28 @@ public static messages_AvailableEffects TLdeserialize(AbstractSerializedData str public static class TL_messages_availableEffectsNotModified extends messages_AvailableEffects { public static final int constructor = 0xd1ed9a5b; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } - + public static class TL_messages_availableEffects extends messages_AvailableEffects { public static final int constructor = 0xbddb616e; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { hash = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_availableEffect object = TL_availableEffect.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - effects.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Document object = Document.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - documents.add(object); - } + effects = Vector.deserialize(stream, TL_availableEffect::TLdeserialize, exception); + documents = Vector.deserialize(stream, Document::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(hash); - stream.writeInt32(0x1cb5c415); - stream.writeInt32(effects.size()); - for (TL_availableEffect effect : effects) { - effect.serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - stream.writeInt32(documents.size()); - for (Document document : documents) { - document.serializeToStream(stream); - } + Vector.serialize(stream, effects); + Vector.serialize(stream, documents); } } @@ -84047,7 +68631,7 @@ public static class TL_factCheck extends TLObject { public TL_textWithEntities text; public long hash; - public static TL_factCheck TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_factCheck TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_factCheck.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_factCheck", constructor)); @@ -84059,8 +68643,8 @@ public static TL_factCheck TLdeserialize(AbstractSerializedData stream, int cons result.readParams(stream, exception); return result; } - - public void readParams(AbstractSerializedData stream, boolean exception) { + + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); need_check = (flags & 1) != 0; if ((flags & 2) != 0) { @@ -84070,7 +68654,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { hash = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = need_check ? flags | 1 : flags &~ 1; stream.writeInt32(flags); @@ -84089,11 +68673,11 @@ public static class TL_editFactCheck extends TLObject { public int msg_id; public TL_textWithEntities text; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(msg_id); @@ -84107,11 +68691,11 @@ public static class TL_deleteFactCheck extends TLObject { public InputPeer peer; public int msg_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(msg_id); @@ -84124,28 +68708,14 @@ public static class TL_getFactCheck extends TLObject { public InputPeer peer; public ArrayList msg_id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - Vector vector = new Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_factCheck object = TL_factCheck.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, TL_factCheck::TLdeserialize); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = msg_id.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - stream.writeInt32(msg_id.get(i)); - } + Vector.serializeInt(stream, msg_id); } } @@ -84159,7 +68729,7 @@ public static class TL_starsRevenueStatus extends TLObject { public TL_stars.StarsAmount overall_revenue = new TL_stars.StarsAmount(); public int next_withdrawal_at; - public static TL_starsRevenueStatus TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_starsRevenueStatus TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_starsRevenueStatus.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_starsRevenueStatus", constructor)); @@ -84172,7 +68742,7 @@ public static TL_starsRevenueStatus TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); withdrawal_enabled = (flags & 1) != 0; current_balance = TL_stars.StarsAmount.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -84183,8 +68753,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = withdrawal_enabled ? flags | 1 : flags &~ 1; stream.writeInt32(flags); @@ -84204,7 +68773,7 @@ public static class TL_payments_starsRevenueStats extends TLObject { public TL_starsRevenueStatus status; public double usd_rate; - public static TL_payments_starsRevenueStats TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_payments_starsRevenueStats TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_payments_starsRevenueStats.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_payments_starsRevenueStats", constructor)); @@ -84217,13 +68786,13 @@ public static TL_payments_starsRevenueStats TLdeserialize(AbstractSerializedData return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { revenue_graph = TL_stats.StatsGraph.TLdeserialize(stream, stream.readInt32(exception), exception); status = TL_starsRevenueStatus.TLdeserialize(stream, stream.readInt32(exception), exception); usd_rate = stream.readDouble(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); revenue_graph.serializeToStream(stream); status.serializeToStream(stream); @@ -84236,7 +68805,7 @@ public static class TL_payments_starsRevenueWithdrawalUrl extends TLObject { public String url; - public static TL_payments_starsRevenueWithdrawalUrl TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_payments_starsRevenueWithdrawalUrl TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_payments_starsRevenueWithdrawalUrl.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_payments_starsRevenueWithdrawalUrl", constructor)); @@ -84249,11 +68818,11 @@ public static TL_payments_starsRevenueWithdrawalUrl TLdeserialize(AbstractSerial return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); } @@ -84264,7 +68833,7 @@ public static class TL_payments_starsRevenueAdsAccountUrl extends TLObject { public String url; - public static TL_payments_starsRevenueAdsAccountUrl TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_payments_starsRevenueAdsAccountUrl TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_payments_starsRevenueAdsAccountUrl.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_payments_starsRevenueWithdrawalUrl", constructor)); @@ -84277,11 +68846,11 @@ public static TL_payments_starsRevenueAdsAccountUrl TLdeserialize(AbstractSerial return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); } @@ -84294,11 +68863,11 @@ public static class TL_payments_getStarsRevenueStats extends TLObject { public boolean dark; public InputPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_payments_starsRevenueStats.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = dark ? flags | 1 : flags &~ 1; stream.writeInt32(flags); @@ -84313,11 +68882,11 @@ public static class TL_payments_getStarsRevenueWithdrawalUrl extends TLObject { public long stars; public InputCheckPasswordSRP password; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_payments_starsRevenueWithdrawalUrl.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt64(stars); @@ -84330,23 +68899,23 @@ public static class TL_payments_getStarsRevenueAdsAccountUrl extends TLObject { public InputPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_payments_starsRevenueAdsAccountUrl.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); } } - + public static class TL_paymentCharge extends TLObject { public static final int constructor = 0xea02c27e; - + public String id; public String provider_charge_id; - public static TL_paymentCharge TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_paymentCharge TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_paymentCharge.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_paymentCharge", constructor)); @@ -84360,29 +68929,29 @@ public static TL_paymentCharge TLdeserialize(AbstractSerializedData stream, int } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readString(exception); provider_charge_id = stream.readString(exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(id); stream.writeString(provider_charge_id); } } - + public static class TL_messages_preparedInlineMessage extends TLObject { public static final int constructor = 0xff57708d; - + public long query_id; public BotInlineResult result; public ArrayList peer_types = new ArrayList<>(); public int cache_time; public ArrayList users = new ArrayList<>(); - public static TL_messages_preparedInlineMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messages_preparedInlineMessage TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messages_preparedInlineMessage.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_messages_preparedInlineMessage", constructor)); @@ -84396,60 +68965,22 @@ public static TL_messages_preparedInlineMessage TLdeserialize(AbstractSerialized } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { query_id = stream.readInt64(exception); result = BotInlineResult.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - InlineQueryPeerType object = InlineQueryPeerType.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - peer_types.add(object); - } + peer_types = Vector.deserialize(stream, InlineQueryPeerType::TLdeserialize, exception); cache_time = stream.readInt32(exception); - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - User object = User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + users = Vector.deserialize(stream, User::TLdeserialize, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(query_id); result.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = peer_types.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - peer_types.get(a).serializeToStream(stream); - } + Vector.serialize(stream, peer_types); stream.writeInt32(cache_time); - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, users); } } @@ -84460,12 +68991,12 @@ public static class TL_messages_getPreparedInlineMessage extends TLObject { public String id; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_messages_preparedInlineMessage.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); bot.serializeToStream(stream); stream.writeString(id); @@ -84476,66 +69007,47 @@ public static class messages_FoundStickers extends TLObject { public int flags; public int next_offset; - - public static messages_FoundStickers TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - messages_FoundStickers result = null; + + public static messages_FoundStickers TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { switch (constructor) { case TL_messages_foundStickers.constructor: - result = new TL_messages_foundStickers(); - break; + return deserialize(new TL_messages_foundStickers(), stream, exception); case TL_messages_foundStickersNotModified.constructor: - result = new TL_messages_foundStickersNotModified(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in messages_FoundStickers", constructor)); - } - if (result != null) { - result.readParams(stream, exception); + return deserialize(new TL_messages_foundStickersNotModified(), stream, exception); + default: + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in messages_FoundStickers", constructor)); + } + return null; } - return result; } } public static class TL_messages_foundStickers extends messages_FoundStickers { public static final int constructor = 0x82c9e290; - + public long hash; public ArrayList stickers = new ArrayList<>(); @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { next_offset = stream.readInt32(exception); } hash = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - stickers.add(Document.TLdeserialize(stream, stream.readInt32(exception), exception)); - } + stickers = Vector.deserialize(stream, Document::TLdeserialize, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { stream.writeInt32(next_offset); } stream.writeInt64(hash); - stream.writeInt32(0x1cb5c415); - stream.writeInt32(stickers.size()); - for (int i = 0; i < stickers.size(); ++i) { - stickers.get(i).serializeToStream(stream); - } + Vector.serialize(stream, stickers); } } @@ -84543,7 +69055,7 @@ public static class TL_messages_foundStickersNotModified extends messages_FoundS public static final int constructor = 0x6010c534; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { next_offset = stream.readInt32(exception); @@ -84551,7 +69063,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -84559,10 +69071,10 @@ public void serializeToStream(AbstractSerializedData stream) { } } } - + public static class TL_messages_searchStickers extends TLObject { public static final int constructor = 0x29b1c66a; - + public int flags; public boolean emojis; public String q; @@ -84573,25 +69085,102 @@ public static class TL_messages_searchStickers extends TLObject { public long hash; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return messages_FoundStickers.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = emojis ? flags | 1 : flags &~ 1; stream.writeInt32(flags); stream.writeString(q); stream.writeString(emoticon); - stream.writeInt32(0x1cb5c415); - stream.writeInt32(lang_code.size()); - for (int i = 0; i < lang_code.size(); ++i) - stream.writeString(lang_code.get(i)); + Vector.serializeString(stream, lang_code); stream.writeInt32(offset); stream.writeInt32(limit); stream.writeInt64(hash); } } + public static class TL_reportMessagesDelivery extends TLObject { + public static final int constructor = 0x5a6d7395; + + public int flags; + public boolean push; + public InputPeer peer; + public ArrayList id = new ArrayList<>(); + + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Bool.TLdeserialize(stream, constructor, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = push ? flags | 1 : flags & ~1; + stream.writeInt32(flags); + peer.serializeToStream(stream); + Vector.serializeInt(stream, id); + } + } + + public static T deserialize(T object, InputSerializedData stream, boolean exception) { + object.readParams(stream, exception); + return object; + } + + public static class Users extends TLObject { + + public int count; + public ArrayList users = new ArrayList<>(); + + public static Users TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + switch (constructor) { + case TL_users.constructor: + return deserialize(new TL_users(), stream, exception); + case TL_usersSlice.constructor: + return deserialize(new TL_usersSlice(), stream, exception); + default: + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in Users", constructor)); + } + return null; + } + } + } + + public static class TL_users extends Users { + public static final int constructor = 0x62d706b8; + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + Vector.serialize(stream, users); + } + } + + public static class TL_usersSlice extends Users { + public static final int constructor = 0x315a4974; + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + count = stream.readInt32(exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(count); + Vector.serialize(stream, users); + } + } + } diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/Vector.java b/TMessagesProj/src/main/java/org/telegram/tgnet/Vector.java new file mode 100644 index 0000000000..d5e070054a --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/Vector.java @@ -0,0 +1,221 @@ +package org.telegram.tgnet; + +import android.icu.util.Output; + +import org.telegram.messenger.Utilities; +import org.telegram.ui.Components.Paint.Input; + +import java.util.ArrayList; + +public class Vector extends TLObject { + public static final int constructor = 0x1cb5c415; + + private final TLDeserializer itemDeserializer; + public final ArrayList objects = new ArrayList<>(); + + public Vector(TLDeserializer itemDeserializer) { + this.itemDeserializer = itemDeserializer; + } + + public static Vector TLDeserialize( + InputSerializedData stream, + int constructor, + boolean exception, + TLDeserializer deserializer + ) { + if (constructor != Vector.constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in Vector", constructor)); + } + return null; + } + + Vector vector = new Vector(deserializer); + vector.readParams(stream, exception); + return vector; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + final int size = stream.readInt32(exception); + for (int i = 0; i < size; ++i) { + objects.add(itemDeserializer.deserialize(stream, stream.readInt32(exception), exception)); + } + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + serialize(stream, objects); + } + + @FunctionalInterface + public interface TLDeserializer { + T deserialize(InputSerializedData stream, int constructor, boolean exception); + } + + + + public static class Int extends TLObject { + public int value; + + public Int(int x) { + this.value = x; + } + + public static Int TLDeserialize(InputSerializedData stream, int constructor, boolean exception) { + return new Int(constructor); + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + value = stream.readInt32(exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(value); + } + } + + public static Vector TLDeserializeInt(InputSerializedData stream, int constructor, boolean exception) { + if (constructor != Vector.constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in StarGift", constructor)); + } + return null; + } + + Vector vector = new Vector(Int::TLDeserialize); + vector.readParams(stream, exception); + return vector; + } + + public ArrayList toIntArray() { + ArrayList result = new ArrayList<>(); + for (T item : objects) { + if (item instanceof Int) { + result.add(((Int) item).value); + } + } + return result; + } + + + public static class Long extends TLObject { + public long value; + + public Long(int a, int b) { + this.value = ((long) a << 32) | (b & 0xFFFFFFFFL); + } + + public static Long TLDeserialize(InputSerializedData stream, int constructor, boolean exception) { + return new Long(constructor, stream.readInt32(exception)); + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + value = stream.readInt64(exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt64(value); + } + } + + public static Vector TLDeserializeLong(InputSerializedData stream, int constructor, boolean exception) { + if (constructor != Vector.constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in StarGift", constructor)); + } + return null; + } + + Vector vector = new Vector(Int::TLDeserialize); + vector.readParams(stream, exception); + return vector; + } + + public ArrayList toLongArray() { + ArrayList result = new ArrayList<>(); + for (T item : objects) { + if (item instanceof Vector.Long) { + result.add(((Vector.Long) item).value); + } + } + return result; + } + + + + + + public static void serialize(OutputSerializedData stream, final ArrayList objects) { + stream.writeInt32(constructor); + stream.writeInt32(objects.size()); + for (int i = 0; i < objects.size(); ++i) { + objects.get(i).serializeToStream(stream); + } + } + public static void serialize(OutputSerializedData stream, Utilities.Callback write, final ArrayList objects) { + stream.writeInt32(constructor); + stream.writeInt32(objects.size()); + for (int i = 0; i < objects.size(); ++i) { + write.run(objects.get(i)); + } + } + public static void serializeInt(OutputSerializedData stream, final ArrayList objects) { + serialize(stream, stream::writeInt32, objects); + } + public static void serializeLong(OutputSerializedData stream, final ArrayList objects) { + serialize(stream, stream::writeInt64, objects); + } + public static void serializeString(OutputSerializedData stream, final ArrayList objects) { + serialize(stream, stream::writeString, objects); + } + + public static ArrayList deserialize(InputSerializedData stream, Utilities.CallbackReturn read, boolean exception) { + final int magic = stream.readInt32(exception); + if (magic != Vector.constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in Vector", magic)); + } + return new ArrayList<>(); + } + final int size = stream.readInt32(exception); + final ArrayList result = new ArrayList<>(size); + for (int i = 0; i < size; ++i) { + result.add(read.run(exception)); + } + return result; + } + public static ArrayList deserializeInt(InputSerializedData stream, boolean exception) { + return deserialize(stream, stream::readInt32, exception); + } + public static ArrayList deserializeLong(InputSerializedData stream, boolean exception) { + return deserialize(stream, stream::readInt64, exception); + } + public static ArrayList deserializeString(InputSerializedData stream, boolean exception) { + return deserialize(stream, stream::readString, exception); + } + public static ArrayList deserialize(InputSerializedData stream, TLDeserializer deserializer, boolean exception) { + final int magic = stream.readInt32(exception); + if (magic != Vector.constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in Vector", magic)); + } + return new ArrayList<>(); + } + + final int size = stream.readInt32(exception); + final ArrayList result = new ArrayList<>(size); + for (int i = 0; i < size; ++i) { + T o = deserializer.deserialize(stream, stream.readInt32(exception), exception); + if (o != null) { + result.add(o); + } + } + + return result; + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_account.java b/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_account.java index 34f0b3b0e2..9621a3daf4 100644 --- a/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_account.java +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_account.java @@ -1,8 +1,13 @@ package org.telegram.tgnet.tl; import org.telegram.tgnet.AbstractSerializedData; +import org.telegram.tgnet.InputSerializedData; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; + +import java.util.ArrayList; public class TL_account { @@ -13,7 +18,7 @@ public static class contentSettings extends TLObject { public boolean sensitive_enabled; public boolean sensitive_can_change; - public static contentSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static contentSettings TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (contentSettings.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_account.contentSettings", constructor)); @@ -27,14 +32,14 @@ public static contentSettings TLdeserialize(AbstractSerializedData stream, int c } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); sensitive_enabled = (flags & 1) != 0; sensitive_can_change = (flags & 2) != 0; } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = sensitive_enabled ? (flags | 1) : (flags &~ 1); flags = sensitive_can_change ? (flags | 2) : (flags &~ 2); @@ -49,12 +54,12 @@ public static class setContentSettings extends TLObject { public boolean sensitive_enabled; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = sensitive_enabled ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -65,14 +70,3709 @@ public static class getContentSettings extends TLObject { public static final int constructor = 0x8b9b4dae; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return contentSettings.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class EmailVerified extends TLObject { + public static EmailVerified TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + EmailVerified result = null; + switch (constructor) { + case 0x2b96cd1b: + result = new TL_emailVerified(); + break; + case 0xe1bb0d61: + result = new TL_emailVerifiedLogin(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in account_EmailVerified", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } + + public static class TL_emailVerified extends EmailVerified { + public static final int constructor = 0x2b96cd1b; + + public String email; + + public void readParams(InputSerializedData stream, boolean exception) { + email = stream.readString(exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(email); + } + } + + public static class TL_emailVerifiedLogin extends EmailVerified { + public static final int constructor = 0xe1bb0d61; + + public String email; + public TLRPC.auth_SentCode sent_code; + + public void readParams(InputSerializedData stream, boolean exception) { + email = stream.readString(exception); + sent_code = TLRPC.auth_SentCode.TLdeserialize(stream, stream.readInt32(exception), exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(email); + sent_code.serializeToStream(stream); + } + } + + public static class passwordSettings extends TLObject { + public static final int constructor = 0x9a5c33e5; + + public int flags; + public String email; + public TLRPC.TL_secureSecretSettings secure_settings; + + public static passwordSettings TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (passwordSettings.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_account_passwordSettings", constructor)); + } else { + return null; + } + } + passwordSettings result = new passwordSettings(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + if ((flags & 1) != 0) { + email = stream.readString(exception); + } + if ((flags & 2) != 0) { + secure_settings = TLRPC.TL_secureSecretSettings.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + stream.writeString(email); + } + if ((flags & 2) != 0) { + secure_settings.serializeToStream(stream); + } + } + } + + public static class privacyRules extends TLObject { + public static final int constructor = 0x50a04e45; + + public ArrayList rules = new ArrayList<>(); + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + + public static privacyRules TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (privacyRules.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_account_privacyRules", constructor)); + } + return null; + } + privacyRules result = new privacyRules(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + rules = Vector.deserialize(stream, TLRPC.PrivacyRule::TLdeserialize, exception); + chats = Vector.deserialize(stream, TLRPC.Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + Vector.serialize(stream, rules); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); + } + } + + public static class EmojiStatuses extends TLObject { + + public long hash; + public ArrayList statuses = new ArrayList<>(); + + public static EmojiStatuses TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + EmojiStatuses result; + switch (constructor) { + case TL_emojiStatusesNotModified.constructor: + result = new TL_emojiStatusesNotModified(); + break; + case TL_emojiStatuses.constructor: + result = new TL_emojiStatuses(); + break; + default: + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in account_EmojiStatuses", constructor)); + } + return null; + } + result.readParams(stream, exception); + return result; + } + } + + public static class TL_emojiStatusesNotModified extends EmojiStatuses { + public static final int constructor = 0xd08ce645; + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_emojiStatuses extends EmojiStatuses { + public static final int constructor = 0x90c467d1; + + public void readParams(InputSerializedData stream, boolean exception) { + hash = stream.readInt64(exception); + statuses = Vector.deserialize(stream, TLRPC.EmojiStatus::TLdeserialize, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(hash); + Vector.serialize(stream, statuses); + } + } + + public static class Themes extends TLObject { + + public static Themes TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + Themes result; + switch (constructor) { + case TL_themes.constructor: + result = new TL_themes(); + break; + case TL_themesNotModified.constructor: + result = new TL_themesNotModified(); + break; + default: + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in account_Themes", constructor)); + } + return null; + } + result.readParams(stream, exception); + return result; + } + } + + public static class TL_themes extends Themes { + public static final int constructor = 0x9a3d8c6d; + + public long hash; + public ArrayList themes = new ArrayList<>(); + + public void readParams(InputSerializedData stream, boolean exception) { + hash = stream.readInt64(exception); + themes = Vector.deserialize(stream, TLRPC.TL_theme::TLdeserialize, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(hash); + Vector.serialize(stream, themes); + } + } + + public static class TL_themesNotModified extends Themes { + public static final int constructor = 0xf41eb622; + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class WallPapers extends TLObject { + public static WallPapers TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + WallPapers result = null; + switch (constructor) { + case 0x1c199183: + result = new TL_wallPapersNotModified(); + break; + case 0xcdc3858c: + result = new TL_wallPapers(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in account_WallPapers", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } + + public static class TL_wallPapersNotModified extends WallPapers { + public static final int constructor = 0x1c199183; + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_wallPapers extends WallPapers { + public static final int constructor = 0xcdc3858c; + + public long hash; + public ArrayList wallpapers = new ArrayList<>(); + + public void readParams(InputSerializedData stream, boolean exception) { + hash = stream.readInt64(exception); + wallpapers = Vector.deserialize(stream, TLRPC.WallPaper::TLdeserialize, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(hash); + Vector.serialize(stream, wallpapers); + } + } + + public static class Password extends TLObject { + + public int flags; + public boolean has_recovery; + public boolean has_secure_values; + public boolean has_password; + public TLRPC.PasswordKdfAlgo current_algo; + public byte[] srp_B; + public long srp_id; + public String hint; + public String email_unconfirmed_pattern; + public TLRPC.PasswordKdfAlgo new_algo; + public TLRPC.SecurePasswordKdfAlgo new_secure_algo; + public byte[] secure_random; + public int pending_reset_date; + public String login_email_pattern; + + public static Password TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + Password result = null; + switch (constructor) { + case 0x957b50fb: + result = new TL_password(); + break; + case 0x185b184f: + result = new TL_password_layer144(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in account_Password", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } + + public static class TL_password extends Password { + public static final int constructor = 0x957b50fb; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + has_recovery = (flags & 1) != 0; + has_secure_values = (flags & 2) != 0; + has_password = (flags & 4) != 0; + if ((flags & 4) != 0) { + current_algo = TLRPC.PasswordKdfAlgo.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4) != 0) { + srp_B = stream.readByteArray(exception); + } + if ((flags & 4) != 0) { + srp_id = stream.readInt64(exception); + } + if ((flags & 8) != 0) { + hint = stream.readString(exception); + } + if ((flags & 16) != 0) { + email_unconfirmed_pattern = stream.readString(exception); + } + new_algo = TLRPC.PasswordKdfAlgo.TLdeserialize(stream, stream.readInt32(exception), exception); + new_secure_algo = TLRPC.SecurePasswordKdfAlgo.TLdeserialize(stream, stream.readInt32(exception), exception); + secure_random = stream.readByteArray(exception); + if ((flags & 32) != 0) { + pending_reset_date = stream.readInt32(exception); + } + if ((flags & 64) != 0) { + login_email_pattern = stream.readString(exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = has_recovery ? (flags | 1) : (flags &~ 1); + flags = has_secure_values ? (flags | 2) : (flags &~ 2); + flags = has_password ? (flags | 4) : (flags &~ 4); + stream.writeInt32(flags); + if ((flags & 4) != 0) { + current_algo.serializeToStream(stream); + } + if ((flags & 4) != 0) { + stream.writeByteArray(srp_B); + } + if ((flags & 4) != 0) { + stream.writeInt64(srp_id); + } + if ((flags & 8) != 0) { + stream.writeString(hint); + } + if ((flags & 16) != 0) { + stream.writeString(email_unconfirmed_pattern); + } + new_algo.serializeToStream(stream); + new_secure_algo.serializeToStream(stream); + stream.writeByteArray(secure_random); + if ((flags & 32) != 0) { + stream.writeInt32(pending_reset_date); + } + if ((flags & 64) != 0) { + stream.writeString(login_email_pattern); + } + } + } + + public static class TL_password_layer144 extends Password { + public static final int constructor = 0x185b184f; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + has_recovery = (flags & 1) != 0; + has_secure_values = (flags & 2) != 0; + has_password = (flags & 4) != 0; + if ((flags & 4) != 0) { + current_algo = TLRPC.PasswordKdfAlgo.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4) != 0) { + srp_B = stream.readByteArray(exception); + } + if ((flags & 4) != 0) { + srp_id = stream.readInt64(exception); + } + if ((flags & 8) != 0) { + hint = stream.readString(exception); + } + if ((flags & 16) != 0) { + email_unconfirmed_pattern = stream.readString(exception); + } + new_algo = TLRPC.PasswordKdfAlgo.TLdeserialize(stream, stream.readInt32(exception), exception); + new_secure_algo = TLRPC.SecurePasswordKdfAlgo.TLdeserialize(stream, stream.readInt32(exception), exception); + secure_random = stream.readByteArray(exception); + if ((flags & 32) != 0) { + pending_reset_date = stream.readInt32(exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = has_recovery ? (flags | 1) : (flags &~ 1); + flags = has_secure_values ? (flags | 2) : (flags &~ 2); + flags = has_password ? (flags | 4) : (flags &~ 4); + stream.writeInt32(flags); + if ((flags & 4) != 0) { + current_algo.serializeToStream(stream); + } + if ((flags & 4) != 0) { + stream.writeByteArray(srp_B); + } + if ((flags & 4) != 0) { + stream.writeInt64(srp_id); + } + if ((flags & 8) != 0) { + stream.writeString(hint); + } + if ((flags & 16) != 0) { + stream.writeString(email_unconfirmed_pattern); + } + new_algo.serializeToStream(stream); + new_secure_algo.serializeToStream(stream); + stream.writeByteArray(secure_random); + if ((flags & 32) != 0) { + stream.writeInt32(pending_reset_date); + } + } + } + + public static class tmpPassword extends TLObject { + public static final int constructor = 0xdb64fd34; + + public byte[] tmp_password; + public int valid_until; + + public static tmpPassword TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (tmpPassword.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_account_tmpPassword", constructor)); + } else { + return null; + } + } + tmpPassword result = new tmpPassword(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + tmp_password = stream.readByteArray(exception); + valid_until = stream.readInt32(exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeByteArray(tmp_password); + stream.writeInt32(valid_until); + } + } + + public static class authorizationForm extends TLObject { + public static final int constructor = 0xad2e1cd8; + + public int flags; + public ArrayList required_types = new ArrayList<>(); + public ArrayList values = new ArrayList<>(); + public ArrayList errors = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + public String privacy_policy_url; + + public static authorizationForm TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (authorizationForm.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_account_authorizationForm", constructor)); + } else { + return null; + } + } + authorizationForm result = new authorizationForm(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + required_types = Vector.deserialize(stream, TLRPC.SecureRequiredType::TLdeserialize, exception); + values = Vector.deserialize(stream, TLRPC.TL_secureValue::TLdeserialize, exception); + errors = Vector.deserialize(stream, TLRPC.SecureValueError::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); + if ((flags & 1) != 0) { + privacy_policy_url = stream.readString(exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + Vector.serialize(stream, required_types); + Vector.serialize(stream, values); + Vector.serialize(stream, errors); + Vector.serialize(stream, users); + if ((flags & 1) != 0) { + stream.writeString(privacy_policy_url); + } + } + } + + public static class autoDownloadSettings extends TLObject { + public static final int constructor = 0x63cacf26; + + public TLRPC.TL_autoDownloadSettings low; + public TLRPC.TL_autoDownloadSettings medium; + public TLRPC.TL_autoDownloadSettings high; + + public static autoDownloadSettings TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (autoDownloadSettings.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_account_autoDownloadSettings", constructor)); + } else { + return null; + } + } + autoDownloadSettings result = new autoDownloadSettings(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + low = TLRPC.TL_autoDownloadSettings.TLdeserialize(stream, stream.readInt32(exception), exception); + medium = TLRPC.TL_autoDownloadSettings.TLdeserialize(stream, stream.readInt32(exception), exception); + high = TLRPC.TL_autoDownloadSettings.TLdeserialize(stream, stream.readInt32(exception), exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + low.serializeToStream(stream); + medium.serializeToStream(stream); + high.serializeToStream(stream); + } + } + + public static class sentEmailCode extends TLObject { + public static final int constructor = 0x811f854f; + + public String email_pattern; + public int length; + + public static sentEmailCode TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (sentEmailCode.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_account_sentEmailCode", constructor)); + } else { + return null; + } + } + sentEmailCode result = new sentEmailCode(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + email_pattern = stream.readString(exception); + length = stream.readInt32(exception); + } + + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + stream.writeString(email_pattern); + stream.writeInt32(length); } } + public static class webAuthorizations extends TLObject { + public static final int constructor = 0xed56c9fc; + + public ArrayList authorizations = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + + public static webAuthorizations TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (webAuthorizations.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_account_webAuthorizations", constructor)); + } + return null; + } + webAuthorizations result = new webAuthorizations(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + authorizations = Vector.deserialize(stream, TLRPC.TL_webAuthorization::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + Vector.serialize(stream, authorizations); + Vector.serialize(stream, users); + } + } + + public static class passwordInputSettings extends TLObject { + public static final int constructor = 0xc23727c9; + + public int flags; + public TLRPC.PasswordKdfAlgo new_algo; + public byte[] new_password_hash; + public String hint; + public String email; + public TLRPC.TL_secureSecretSettings new_secure_settings; + + public static passwordInputSettings TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (passwordInputSettings.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_account_passwordInputSettings", constructor)); + } else { + return null; + } + } + passwordInputSettings result = new passwordInputSettings(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + if ((flags & 1) != 0) { + new_algo = TLRPC.PasswordKdfAlgo.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 1) != 0) { + new_password_hash = stream.readByteArray(exception); + } + if ((flags & 1) != 0) { + hint = stream.readString(exception); + } + if ((flags & 2) != 0) { + email = stream.readString(exception); + } + if ((flags & 4) != 0) { + new_secure_settings = TLRPC.TL_secureSecretSettings.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + new_algo.serializeToStream(stream); + } + if ((flags & 1) != 0) { + stream.writeByteArray(new_password_hash); + } + if ((flags & 1) != 0) { + stream.writeString(hint); + } + if ((flags & 2) != 0) { + stream.writeString(email); + } + if ((flags & 4) != 0) { + new_secure_settings.serializeToStream(stream); + } + } + } + + public static class ResetPasswordResult extends TLObject { + + public static ResetPasswordResult TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + ResetPasswordResult result = null; + switch (constructor) { + case 0xe3779861: + result = new resetPasswordFailedWait(); + break; + case 0xe9effc7d: + result = new resetPasswordRequestedWait(); + break; + case 0xe926d63e: + result = new resetPasswordOk(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in account_ResetPasswordResult", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } + + public static class resetPasswordFailedWait extends ResetPasswordResult { + public static final int constructor = 0xe3779861; + + public int retry_date; + + public void readParams(InputSerializedData stream, boolean exception) { + retry_date = stream.readInt32(exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(retry_date); + } + } + + public static class resetPasswordRequestedWait extends ResetPasswordResult { + public static final int constructor = 0xe9effc7d; + + public int until_date; + + public void readParams(InputSerializedData stream, boolean exception) { + until_date = stream.readInt32(exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(until_date); + } + } + + public static class resetPasswordOk extends ResetPasswordResult { + public static final int constructor = 0xe926d63e; + + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class authorizations extends TLObject { + public static final int constructor = 0x4bff8ea0; + + public int authorization_ttl_days; + public ArrayList authorizations = new ArrayList<>(); + + public static TL_account.authorizations TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_account.authorizations.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_account_authorizations", constructor)); + } else { + return null; + } + } + TL_account.authorizations result = new authorizations(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + authorization_ttl_days = stream.readInt32(exception); + authorizations = Vector.deserialize(stream, TLRPC.TL_authorization::TLdeserialize, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(authorization_ttl_days); + Vector.serialize(stream, authorizations); + } + } + + public static class registerDevice extends TLObject { + public static final int constructor = 0xec86017a; + + public int flags; + public boolean no_muted; + public int token_type; + public String token; + public boolean app_sandbox; + public byte[] secret; + public ArrayList other_uids = new ArrayList<>(); + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = no_muted ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeInt32(token_type); + stream.writeString(token); + stream.writeBool(app_sandbox); + stream.writeByteArray(secret); + Vector.serializeLong(stream, other_uids); + } + } + + public static class unregisterDevice extends TLObject { + public static final int constructor = 0x6a0d3206; + + public int token_type; + public String token; + public ArrayList other_uids = new ArrayList<>(); + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(token_type); + stream.writeString(token); + Vector.serializeLong(stream, other_uids); + } + } + + public static class updateNotifySettings extends TLObject { + public static final int constructor = 0x84be5b93; + + public TLRPC.InputNotifyPeer peer; + public TLRPC.TL_inputPeerNotifySettings settings; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + settings.serializeToStream(stream); + } + } + + public static class getNotifySettings extends TLObject { + public static final int constructor = 0x12b3ad31; + + public TLRPC.InputNotifyPeer peer; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.PeerNotifySettings.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + } + } + + public static class resetNotifySettings extends TLObject { + public static final int constructor = 0xdb7e1747; + + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class updateProfile extends TLObject { + public static final int constructor = 0x78515775; + + public int flags; + public String first_name; + public String last_name; + public String about; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.User.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + stream.writeString(first_name); + } + if ((flags & 2) != 0) { + stream.writeString(last_name); + } + if ((flags & 4) != 0) { + stream.writeString(about); + } + } + } + + public static class updateStatus extends TLObject { + public static final int constructor = 0x6628562c; + + public boolean offline; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeBool(offline); + } + } + + public static class getWallPapers extends TLObject { + public static final int constructor = 0x7967d36; + + public long hash; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return WallPapers.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(hash); + } + } + + public static class reportPeer extends TLObject { + public static final int constructor = 0xc5ba3d86; + + public TLRPC.InputPeer peer; + public TLRPC.ReportReason reason; + public String message; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + reason.serializeToStream(stream); + stream.writeString(message); + } + } + + public static class resetPassword extends TLObject { + public static final int constructor = 0x9308ce1b; + + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return ResetPasswordResult.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class declinePasswordReset extends TLObject { + public static final int constructor = 0x4c9409f6; + + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class getChatThemes extends TLObject { + public static final int constructor = 0xd638de89; + + public long hash; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Themes.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(hash); + } + } + + public static class setAuthorizationTTL extends TLObject { + public static final int constructor = 0xbf899aa0; + + public int authorization_ttl_days; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(authorization_ttl_days); + } + } + + public static class changeAuthorizationSettings extends TLObject { + public static final int constructor = 0x40f48462; + + public int flags; + public boolean confirmed; + public long hash; + public boolean encrypted_requests_disabled; + public boolean call_requests_disabled; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = confirmed ? (flags | 8) : (flags &~ 8); + stream.writeInt32(flags); + stream.writeInt64(hash); + if ((flags & 1) != 0) { + stream.writeBool(encrypted_requests_disabled); + } + if ((flags & 2) != 0) { + stream.writeBool(call_requests_disabled); + } + } + } + + public static class checkUsername extends TLObject { + public static final int constructor = 0x2714d86c; + + public String username; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(username); + } + } + + public static class updateUsername extends TLObject { + public static final int constructor = 0x3e0bdd7c; + + public String username; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.User.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(username); + } + } + + public static class getPrivacy extends TLObject { + public static final int constructor = 0xdadbc950; + + public TLRPC.InputPrivacyKey key; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return privacyRules.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + key.serializeToStream(stream); + } + } + + public static class setPrivacy extends TLObject { + public static final int constructor = 0xc9f81ce8; + + public TLRPC.InputPrivacyKey key; + public ArrayList rules = new ArrayList<>(); + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return privacyRules.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + key.serializeToStream(stream); + Vector.serialize(stream, rules); + } + } + + public static class deleteAccount extends TLObject { + public static final int constructor = 0x418d4e0b; + + public String reason; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(reason); + } + } + + public static class getAccountTTL extends TLObject { + public static final int constructor = 0x8fc711d; + + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.TL_accountDaysTTL.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class setAccountTTL extends TLObject { + public static final int constructor = 0x2442485e; + + public TLRPC.TL_accountDaysTTL ttl; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + ttl.serializeToStream(stream); + } + } + + public static class sendChangePhoneCode extends TLObject { + public static final int constructor = 0x82574ae5; + + public String phone_number; + public TLRPC.TL_codeSettings settings; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.TL_auth_sentCode.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(phone_number); + settings.serializeToStream(stream); + } + } + + public static class changePhone extends TLObject { + public static final int constructor = 0x70c32edb; + + public String phone_number; + public String phone_code_hash; + public String phone_code; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.User.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(phone_number); + stream.writeString(phone_code_hash); + stream.writeString(phone_code); + } + } + + public static class getWebAuthorizations extends TLObject { + public static final int constructor = 0x182e6d6f; + + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return webAuthorizations.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class resetWebAuthorization extends TLObject { + public static final int constructor = 0x2d01b9ef; + + public long hash; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(hash); + } + } + + public static class resetWebAuthorizations extends TLObject { + public static final int constructor = 0x682d2594; + + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class getMultiWallPapers extends TLObject { + public static final int constructor = 0x65ad71dc; + + public ArrayList wallpapers = new ArrayList<>(); + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, TLRPC.WallPaper::TLdeserialize); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + Vector.serialize(stream, wallpapers); + } + } + + public static class getGlobalPrivacySettings extends TLObject { + public static final int constructor = 0xeb2b4cf6; + + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.TL_globalPrivacySettings.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class setGlobalPrivacySettings extends TLObject { + public static final int constructor = 0x1edaaac2; + + public TLRPC.TL_globalPrivacySettings settings; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.TL_globalPrivacySettings.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + settings.serializeToStream(stream); + } + } + + public static class reportProfilePhoto extends TLObject { + public static final int constructor = 0xfa8cc6f5; + + public TLRPC.InputPeer peer; + public TLRPC.InputPhoto photo_id; + public TLRPC.ReportReason reason; + public String message; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + photo_id.serializeToStream(stream); + reason.serializeToStream(stream); + stream.writeString(message); + } + } + + public static class getAllSecureValues extends TLObject { + public static final int constructor = 0xb288bc7d; + + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, TLRPC.TL_secureValue::TLdeserialize); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class getSecureValue extends TLObject { + public static final int constructor = 0x73665bc2; + + public ArrayList types = new ArrayList<>(); + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, TLRPC.TL_secureValue::TLdeserialize); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + Vector.serialize(stream, types); + } + } + + public static class saveSecureValue extends TLObject { + public static final int constructor = 0x899fe31d; + + public TLRPC.TL_inputSecureValue value; + public long secure_secret_id; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.TL_secureValue.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + value.serializeToStream(stream); + stream.writeInt64(secure_secret_id); + } + } + + public static class deleteSecureValue extends TLObject { + public static final int constructor = 0xb880bc4b; + + public ArrayList types = new ArrayList<>(); + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + Vector.serialize(stream, types); + } + } + + public static class getAuthorizationForm extends TLObject { + public static final int constructor = 0xa929597a; + + public long bot_id; + public String scope; + public String public_key; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return authorizationForm.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(bot_id); + stream.writeString(scope); + stream.writeString(public_key); + } + } + + public static class acceptAuthorization extends TLObject { + public static final int constructor = 0xf3ed4c73; + + public long bot_id; + public String scope; + public String public_key; + public ArrayList value_hashes = new ArrayList<>(); + public TLRPC.TL_secureCredentialsEncrypted credentials; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(bot_id); + stream.writeString(scope); + stream.writeString(public_key); + Vector.serialize(stream, value_hashes); + credentials.serializeToStream(stream); + } + } + + public static class sendVerifyPhoneCode extends TLObject { + public static final int constructor = 0xa5a356f9; + + public String phone_number; + public TLRPC.TL_codeSettings settings; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.TL_auth_sentCode.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(phone_number); + settings.serializeToStream(stream); + } + } + + public static class verifyPhone extends TLObject { + public static final int constructor = 0x4dd3a7f6; + + public String phone_number; + public String phone_code_hash; + public String phone_code; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(phone_number); + stream.writeString(phone_code_hash); + stream.writeString(phone_code); + } + } + + public static class sendVerifyEmailCode extends TLObject { + public static final int constructor = 0x98e037bb; + + public TLRPC.EmailVerifyPurpose purpose; + public String email; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return sentEmailCode.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + purpose.serializeToStream(stream); + stream.writeString(email); + } + } + + public static class verifyEmail extends TLObject { + public static final int constructor = 0x32da4cf; + + public TLRPC.EmailVerifyPurpose purpose; + public TLRPC.EmailVerification verification; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return EmailVerified.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + purpose.serializeToStream(stream); + verification.serializeToStream(stream); + } + } + + public static class confirmPasswordEmail extends TLObject { + public static final int constructor = 0x8fdf1920; + + public String code; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(code); + } + } + + public static class resendPasswordEmail extends TLObject { + public static final int constructor = 0x7a7f2a15; + + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class cancelPasswordEmail extends TLObject { + public static final int constructor = 0xc1cbd5b6; + + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class getContactSignUpNotification extends TLObject { + public static final int constructor = 0x9f07c728; + + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class setContactSignUpNotification extends TLObject { + public static final int constructor = 0xcff43f61; + + public boolean silent; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeBool(silent); + } + } + + public static class getNotifyExceptions extends TLObject { + public static final int constructor = 0x53577479; + + public int flags; + public boolean compare_sound; + public TLRPC.InputNotifyPeer peer; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Updates.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = compare_sound ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + peer.serializeToStream(stream); + } + } + } + + public static class getWallPaper extends TLObject { + public static final int constructor = 0xfc8ddbea; + + public TLRPC.InputWallPaper wallpaper; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.WallPaper.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + wallpaper.serializeToStream(stream); + } + } + + public static class uploadWallPaper extends TLObject { + public static final int constructor = 0xdd853661; + + public TLRPC.InputFile file; + public String mime_type; + public TLRPC.TL_wallPaperSettings settings; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.WallPaper.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + file.serializeToStream(stream); + stream.writeString(mime_type); + settings.serializeToStream(stream); + } + } + + public static class saveWallPaper extends TLObject { + public static final int constructor = 0x6c5a5b37; + + public TLRPC.InputWallPaper wallpaper; + public boolean unsave; + public TLRPC.TL_wallPaperSettings settings; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + wallpaper.serializeToStream(stream); + stream.writeBool(unsave); + settings.serializeToStream(stream); + } + } + + public static class installWallPaper extends TLObject { + public static final int constructor = 0xfeed5769; + + public TLRPC.InputWallPaper wallpaper; + public TLRPC.TL_wallPaperSettings settings; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + wallpaper.serializeToStream(stream); + settings.serializeToStream(stream); + } + } + + public static class resetWallPapers extends TLObject { + public static final int constructor = 0xbb3b9804; + + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class getAutoDownloadSettings extends TLObject { + public static final int constructor = 0x56da0b3f; + + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return autoDownloadSettings.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class saveAutoDownloadSettings extends TLObject { + public static final int constructor = 0x76f36233; + + public int flags; + public boolean low; + public boolean high; + public TLRPC.TL_autoDownloadSettings settings; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = low ? (flags | 1) : (flags &~ 1); + flags = high ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + settings.serializeToStream(stream); + } + } + + public static class uploadTheme extends TLObject { + public static final int constructor = 0x1c3db333; + + public int flags; + public TLRPC.InputFile file; + public TLRPC.InputFile thumb; + public String file_name; + public String mime_type; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Document.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + file.serializeToStream(stream); + if ((flags & 1) != 0) { + thumb.serializeToStream(stream); + } + stream.writeString(file_name); + stream.writeString(mime_type); + } + } + + public static class createTheme extends TLObject { + public static final int constructor = 0x8432c21f; + + public int flags; + public String slug; + public String title; + public TLRPC.InputDocument document; + public TLRPC.TL_inputThemeSettings settings; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Theme.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeString(slug); + stream.writeString(title); + if ((flags & 4) != 0) { + document.serializeToStream(stream); + } + if ((flags & 8) != 0) { + settings.serializeToStream(stream); + } + } + } + + public static class updateTheme extends TLObject { + public static final int constructor = 0x5cb367d5; + + public int flags; + public String format; + public TLRPC.InputTheme theme; + public String slug; + public String title; + public TLRPC.InputDocument document; + public TLRPC.TL_inputThemeSettings settings; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Theme.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeString(format); + theme.serializeToStream(stream); + if ((flags & 1) != 0) { + stream.writeString(slug); + } + if ((flags & 2) != 0) { + stream.writeString(title); + } + if ((flags & 4) != 0) { + document.serializeToStream(stream); + } + if ((flags & 8) != 0) { + settings.serializeToStream(stream); + } + } + } + + public static class saveTheme extends TLObject { + public static final int constructor = 0xf257106c; + + public TLRPC.InputTheme theme; + public boolean unsave; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + theme.serializeToStream(stream); + stream.writeBool(unsave); + } + } + + public static class installTheme extends TLObject { + public static final int constructor = 0x7ae43737; + + public int flags; + public boolean dark; + public String format; + public TLRPC.InputTheme theme; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = dark ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + if ((flags & 2) != 0) { + stream.writeString(format); + } + if ((flags & 2) != 0) { + theme.serializeToStream(stream); + } + } + } + + public static class getTheme extends TLObject { + public static final int constructor = 0x8d9d742b; + + public String format; + public TLRPC.InputTheme theme; + public long document_id; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Theme.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(format); + theme.serializeToStream(stream); + stream.writeInt64(document_id); + } + } + + public static class getThemes extends TLObject { + public static final int constructor = 0x7206e458; + + public String format; + public long hash; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Themes.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(format); + stream.writeInt64(hash); + } + } + + public static class updateEmojiStatus extends TLObject { + public static final int constructor = 0xfbd3de6b; + + public TLRPC.EmojiStatus emoji_status; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + emoji_status.serializeToStream(stream); + } + } + + public static class getDefaultBackgroundEmojis extends TLObject { + public static final int constructor = 0xa60ab9ce; + + public long hash; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.EmojiList.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(hash); + } + } + + public static class getChannelDefaultEmojiStatuses extends TLObject { + public static final int constructor = 0x7727a7d5; + + public long hash; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return EmojiStatuses.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(hash); + } + } + + public static class getDefaultEmojiStatuses extends TLObject { + public static final int constructor = 0xd6753386; + + public long hash; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return EmojiStatuses.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(hash); + } + } + + public static class getRecentEmojiStatuses extends TLObject { + public static final int constructor = 0xf578105; + + public long hash; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return EmojiStatuses.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(hash); + } + } + + public static class clearRecentEmojiStatuses extends TLObject { + public static final int constructor = 0x18201aae; + + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class updateDeviceLocked extends TLObject { + public static final int constructor = 0x38df3532; + + public int period; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(period); + } + } + + public static class webPagePreview extends TLObject { + public static final int constructor = 0xb53e8b21; + + public TLRPC.MessageMedia media; + public ArrayList users = new ArrayList<>(); + + public static webPagePreview TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (webPagePreview.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in webPagePreview", constructor)); + } else { + return null; + } + } + webPagePreview result = new webPagePreview(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + media = TLRPC.MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + media.serializeToStream(stream); + Vector.serialize(stream, users); + } + } + + public static class getWebPagePreview extends TLObject { + public static final int constructor = 0x570d6f6f; + + public int flags; + public String message; + public ArrayList entities = new ArrayList<>(); + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return webPagePreview.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeString(message); + if ((flags & 8) != 0) { + Vector.serialize(stream, entities); + } + } + } + + public static class getAuthorizations extends TLObject { + public static final int constructor = 0xe320c158; + + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return authorizations.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class resetAuthorization extends TLObject { + public static final int constructor = 0xdf77f3bc; + + public long hash; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(hash); + } + } + + public static class getPassword extends TLObject { + public static final int constructor = 0x548a30f5; + + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_password.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class getPasswordSettings extends TLObject { + public static final int constructor = 0x9cd4eaf9; + + public TLRPC.InputCheckPasswordSRP password; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return passwordSettings.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + password.serializeToStream(stream); + } + } + + public static class updatePasswordSettings extends TLObject { + public static final int constructor = 0xa59b102f; + + public TLRPC.InputCheckPasswordSRP password; + public passwordInputSettings new_settings; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + password.serializeToStream(stream); + new_settings.serializeToStream(stream); + } + } + + public static class sendConfirmPhoneCode extends TLObject { + public static final int constructor = 0x1b3faa88; + + public String hash; + public TLRPC.TL_codeSettings settings; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.TL_auth_sentCode.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(hash); + settings.serializeToStream(stream); + } + } + + public static class confirmPhone extends TLObject { + public static final int constructor = 0x5f2178c3; + + public String phone_code_hash; + public String phone_code; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(phone_code_hash); + stream.writeString(phone_code); + } + } + + public static class getTmpPassword extends TLObject { + public static final int constructor = 0x449e0b51; + + public TLRPC.InputCheckPasswordSRP password; + public int period; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return tmpPassword.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + password.serializeToStream(stream); + stream.writeInt32(period); + } + } + + public static class SavedRingtones extends TLObject { + + public static SavedRingtones TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + SavedRingtones result = null; + switch (constructor) { + case 0xfbf6e8b1: + result = new TL_savedRingtonesNotModified(); + break; + case 0xc1e92cc5: + result = new TL_savedRingtones(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in account_SavedRingtones", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } + + public static class TL_savedRingtonesNotModified extends SavedRingtones { + public static final int constructor = 0xfbf6e8b1; + + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_savedRingtones extends SavedRingtones { + public static final int constructor = 0xc1e92cc5; + + public long hash; + public ArrayList ringtones = new ArrayList<>(); + + public void readParams(InputSerializedData stream, boolean exception) { + hash = stream.readInt64(exception); + ringtones = Vector.deserialize(stream, TLRPC.Document::TLdeserialize, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(hash); + Vector.serialize(stream, ringtones); + } + } + + public static class uploadRingtone extends TLObject { + public static final int constructor = 0x831a83a2; + + public TLRPC.InputFile file; + public String file_name; + public String mime_type; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Document.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + file.serializeToStream(stream); + stream.writeString(file_name); + stream.writeString(mime_type); + } + } + + public static class getSavedRingtones extends TLObject { + public static final int constructor = 0xe1902288; + + public long hash; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return SavedRingtones.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(hash); + } + } + + public static class saveRingtone extends TLObject { + public static final int constructor = 0x3dea5b03; + + public TLRPC.InputDocument id; + public boolean unsave; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return SavedRingtone.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + id.serializeToStream(stream); + stream.writeBool(unsave); + } + } + + public static class reorderUsernames extends TLObject { + public static final int constructor = 0xef500eab; + + public ArrayList order = new ArrayList<>(); + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + Vector.serializeString(stream, order); + } + } + + public static class toggleUsername extends TLObject { + public static final int constructor = 0x58d6b376; + + public String username; + public boolean active; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(username); + stream.writeBool(active); + } + } + + public static class SavedRingtone extends TLObject { + + public static SavedRingtone TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + SavedRingtone result = null; + switch (constructor) { + case 0x1f307eb7: + result = new TL_savedRingtoneConverted(); + break; + case 0xb7263f6d: + result = new TL_savedRingtone(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in account_SavedRingtone", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } + + public static class TL_savedRingtoneConverted extends SavedRingtone { + public static final int constructor = 0x1f307eb7; + + public TLRPC.Document document; + + public void readParams(InputSerializedData stream, boolean exception) { + document = TLRPC.Document.TLdeserialize(stream, stream.readInt32(exception), exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + document.serializeToStream(stream); + } + } + + public static class TL_savedRingtone extends SavedRingtone { + public static final int constructor = 0xb7263f6d; + + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class getDefaultProfilePhotoEmojis extends TLObject { + public static final int constructor = 0xe2750328; + + public long hash; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.EmojiList.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(hash); + } + } + + public static class getDefaultGroupPhotoEmojis extends TLObject { + public static final int constructor = 0x915860ae; + + public long hash; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.EmojiList.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(hash); + } + } + + public static class getChannelRestrictedStatusEmojis extends TLObject { + public static final int constructor = 0x35a9e0d5; + + public long hash; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.EmojiList.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(hash); + } + } + + public static class updateColor extends TLObject { + public static final int constructor = 0x7cefa15d; + + public int flags; + public boolean for_profile; + public int color; + public long background_emoji_id; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = for_profile ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + if ((flags & 4) != 0) { + stream.writeInt32(color); + } + if ((flags & 1) != 0) { + stream.writeInt64(background_emoji_id); + } + } + } + + public static class TL_businessWeeklyOpen extends TLObject { + public static final int constructor = 0x120b1ab9; + + public int start_minute; + public int end_minute; + + public static TL_businessWeeklyOpen TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (constructor != TL_businessWeeklyOpen.constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_businessWeeklyOpen", constructor)); + } + return null; + } + TL_businessWeeklyOpen result = new TL_businessWeeklyOpen(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + start_minute = stream.readInt32(exception); + end_minute = stream.readInt32(exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(start_minute); + stream.writeInt32(end_minute); + } + } + + public static class TL_businessWorkHours extends TLObject { + public static final int constructor = 0x8c92b098; + + public int flags; + public boolean open_now; + public String timezone_id; + public ArrayList weekly_open = new ArrayList<>(); + + public static TL_businessWorkHours TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (constructor != TL_businessWorkHours.constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_businessWorkHours", constructor)); + } + return null; + } + TL_businessWorkHours result = new TL_businessWorkHours(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + open_now = (flags & 1) != 0; + timezone_id = stream.readString(exception); + weekly_open = Vector.deserialize(stream, TL_businessWeeklyOpen::TLdeserialize, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = open_now ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeString(timezone_id); + Vector.serialize(stream, weekly_open); + } + } + + public static class updateBusinessWorkHours extends TLObject { + public static final int constructor = 0x4b00e066; + + public int flags; + public TL_businessWorkHours business_work_hours; + + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + business_work_hours.serializeToStream(stream); + } + } + } + + public static class updateBusinessLocation extends TLObject { + public static final int constructor = 0x9e6b131a; + + public int flags; + public TLRPC.InputGeoPoint geo_point; + public String address; + + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 2) != 0) { + geo_point.serializeToStream(stream); + } + if ((flags & 1) != 0) { + stream.writeString(address); + } + } + } + + public static class BusinessAwayMessageSchedule extends TLObject { + public static BusinessAwayMessageSchedule TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + BusinessAwayMessageSchedule result = null; + switch (constructor) { + case TL_businessAwayMessageScheduleAlways.constructor: + result = new TL_businessAwayMessageScheduleAlways(); + break; + case TL_businessAwayMessageScheduleOutsideWorkHours.constructor: + result = new TL_businessAwayMessageScheduleOutsideWorkHours(); + break; + case TL_businessAwayMessageScheduleCustom.constructor: + result = new TL_businessAwayMessageScheduleCustom(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in BusinessAwayMessageSchedule", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } + + public static class TL_businessAwayMessageScheduleAlways extends BusinessAwayMessageSchedule { + public static final int constructor = 0xc9b9e2b9; + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_businessAwayMessageScheduleOutsideWorkHours extends BusinessAwayMessageSchedule { + public static final int constructor = 0xc3f2f501; + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_businessAwayMessageScheduleCustom extends BusinessAwayMessageSchedule { + public static final int constructor = 0xcc4d9ecc; + + public int start_date; + public int end_date; + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + start_date = stream.readInt32(exception); + end_date = stream.readInt32(exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(start_date); + stream.writeInt32(end_date); + } + } + + public static class TL_inputBusinessGreetingMessage extends TLObject { + public static final int constructor = 0x194cb3b; + + public int shortcut_id; + public TL_inputBusinessRecipients recipients; + public int no_activity_days; + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + shortcut_id = stream.readInt32(exception); + recipients = TL_inputBusinessRecipients.TLdeserialize(stream, stream.readInt32(exception), exception); + no_activity_days = stream.readInt32(exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(shortcut_id); + recipients.serializeToStream(stream); + stream.writeInt32(no_activity_days); + } + } + + public static class TL_businessGreetingMessage extends TLObject { + public static final int constructor = 0xe519abab; + + public int shortcut_id; + public TL_businessRecipients recipients; + public int no_activity_days; + + public static TL_businessGreetingMessage TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (constructor != TL_businessGreetingMessage.constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_businessGreetingMessage", constructor)); + } + return null; + } + TL_businessGreetingMessage result = new TL_businessGreetingMessage(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + shortcut_id = stream.readInt32(exception); + recipients = TL_businessRecipients.TLdeserialize(stream, stream.readInt32(exception), exception); + no_activity_days = stream.readInt32(exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(shortcut_id); + recipients.serializeToStream(stream); + stream.writeInt32(no_activity_days); + } + } + + public static class TL_inputBusinessAwayMessage extends TLObject { + public static final int constructor = 0x832175e0; + + public int flags; + public boolean offline_only; + public int shortcut_id; + public BusinessAwayMessageSchedule schedule; + public TL_inputBusinessRecipients recipients; + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + offline_only = (flags & 1) != 0; + shortcut_id = stream.readInt32(exception); + schedule = BusinessAwayMessageSchedule.TLdeserialize(stream, stream.readInt32(exception), exception); + recipients = TL_inputBusinessRecipients.TLdeserialize(stream, stream.readInt32(exception), exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = offline_only ? (flags | 1) : (flags & 1); + stream.writeInt32(flags); + stream.writeInt32(shortcut_id); + schedule.serializeToStream(stream); + recipients.serializeToStream(stream); + } + } + + public static class TL_businessAwayMessage extends TLObject { + public static final int constructor = 0xef156a5c; + + public int flags; + public boolean offline_only; + public int shortcut_id; + public BusinessAwayMessageSchedule schedule; + public TL_businessRecipients recipients; + + public static TL_businessAwayMessage TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (constructor != TL_businessAwayMessage.constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_businessAwayMessage", constructor)); + } + return null; + } + TL_businessAwayMessage result = new TL_businessAwayMessage(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + offline_only = (flags & 1) != 0; + shortcut_id = stream.readInt32(exception); + schedule = BusinessAwayMessageSchedule.TLdeserialize(stream, stream.readInt32(exception), exception); + recipients = TL_businessRecipients.TLdeserialize(stream, stream.readInt32(exception), exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = offline_only ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeInt32(shortcut_id); + schedule.serializeToStream(stream); + recipients.serializeToStream(stream); + } + } + + public static class updateBusinessAwayMessage extends TLObject { + public static final int constructor = 0xa26a7fa5; + + public int flags; + public TL_inputBusinessAwayMessage message; + + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + message.serializeToStream(stream); + } + } + } + + public static class updateBusinessGreetingMessage extends TLObject { + public static final int constructor = 0x66cdafc4; + + public int flags; + public TL_inputBusinessGreetingMessage message; + + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + message.serializeToStream(stream); + } + } + } + + public static class TL_inputBusinessBotRecipients extends TLObject { + public static final int constructor = 0xc4e5921e; + + public int flags; + public boolean existing_chats; + public boolean new_chats; + public boolean contacts; + public boolean non_contacts; + public boolean exclude_selected; + public ArrayList users = new ArrayList<>(); + public ArrayList exclude_users = new ArrayList<>(); + + public static TL_inputBusinessRecipients TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (constructor != TL_inputBusinessRecipients.constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_inputBusinessRecipients", constructor)); + } + return null; + } + TL_inputBusinessRecipients result = new TL_inputBusinessRecipients(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + existing_chats = (flags & 1) != 0; + new_chats = (flags & 2) != 0; + contacts = (flags & 4) != 0; + non_contacts = (flags & 8) != 0; + exclude_selected = (flags & 32) != 0; + if ((flags & 16) != 0) { + users = Vector.deserialize(stream, TLRPC.InputUser::TLdeserialize, exception); + } + if ((flags & 64) != 0) { + exclude_users = Vector.deserialize(stream, TLRPC.InputUser::TLdeserialize, exception); + } + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = existing_chats ? (flags | 1) : (flags &~ 1); + flags = new_chats ? (flags | 2) : (flags &~ 2); + flags = contacts ? (flags | 4) : (flags &~ 4); + flags = non_contacts ? (flags | 8) : (flags &~ 8); + flags = exclude_selected ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + if ((flags & 16) != 0) { + Vector.serialize(stream, users); + } + if ((flags & 64) != 0) { + Vector.serialize(stream, exclude_users); + } + } + } + + public static class TL_businessBotRecipients extends TLObject { + public static final int constructor = 0xb88cf373; + + public int flags; + public boolean existing_chats; + public boolean new_chats; + public boolean contacts; + public boolean non_contacts; + public boolean exclude_selected; + public ArrayList users = new ArrayList<>(); + public ArrayList exclude_users = new ArrayList<>(); + + public static TL_businessBotRecipients TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (constructor != TL_businessBotRecipients.constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_businessBotRecipients", constructor)); + } + return null; + } + TL_businessBotRecipients result = new TL_businessBotRecipients(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + existing_chats = (flags & 1) != 0; + new_chats = (flags & 2) != 0; + contacts = (flags & 4) != 0; + non_contacts = (flags & 8) != 0; + exclude_selected = (flags & 32) != 0; + if ((flags & 16) != 0) { + users = Vector.deserializeLong(stream, exception); + } + if ((flags & 64) != 0) { + exclude_users = Vector.deserializeLong(stream, exception); + } + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = existing_chats ? (flags | 1) : (flags &~ 1); + flags = new_chats ? (flags | 2) : (flags &~ 2); + flags = contacts ? (flags | 4) : (flags &~ 4); + flags = non_contacts ? (flags | 8) : (flags &~ 8); + flags = exclude_selected ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + if ((flags & 16) != 0) { + Vector.serializeLong(stream, users); + } + if ((flags & 64) != 0) { + Vector.serializeLong(stream, exclude_users); + } + } + } + + public static class TL_inputBusinessRecipients extends TLObject { + public static final int constructor = 0x6f8b32aa; + + public int flags; + public boolean existing_chats; + public boolean new_chats; + public boolean contacts; + public boolean non_contacts; + public boolean exclude_selected; + public ArrayList users = new ArrayList<>(); + + public static TL_inputBusinessRecipients TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (constructor != TL_inputBusinessRecipients.constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_inputBusinessRecipients", constructor)); + } + return null; + } + TL_inputBusinessRecipients result = new TL_inputBusinessRecipients(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + existing_chats = (flags & 1) != 0; + new_chats = (flags & 2) != 0; + contacts = (flags & 4) != 0; + non_contacts = (flags & 8) != 0; + exclude_selected = (flags & 32) != 0; + if ((flags & 16) != 0) { + users = Vector.deserialize(stream, TLRPC.InputUser::TLdeserialize, exception); + } + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = existing_chats ? (flags | 1) : (flags &~ 1); + flags = new_chats ? (flags | 2) : (flags &~ 2); + flags = contacts ? (flags | 4) : (flags &~ 4); + flags = non_contacts ? (flags | 8) : (flags &~ 8); + flags = exclude_selected ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + if ((flags & 16) != 0) { + Vector.serialize(stream, users); + } + } + } + + public static class TL_businessRecipients extends TLObject { + public static final int constructor = 0x21108ff7; + + public int flags; + public boolean existing_chats; + public boolean new_chats; + public boolean contacts; + public boolean non_contacts; + public boolean exclude_selected; + public ArrayList users = new ArrayList<>(); + + public static TL_businessRecipients TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (constructor != TL_businessRecipients.constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_businessRecipients", constructor)); + } + return null; + } + TL_businessRecipients result = new TL_businessRecipients(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + existing_chats = (flags & 1) != 0; + new_chats = (flags & 2) != 0; + contacts = (flags & 4) != 0; + non_contacts = (flags & 8) != 0; + exclude_selected = (flags & 32) != 0; + if ((flags & 16) != 0) { + users = Vector.deserializeLong(stream, exception); + } + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = existing_chats ? (flags | 1) : (flags &~ 1); + flags = new_chats ? (flags | 2) : (flags &~ 2); + flags = contacts ? (flags | 4) : (flags &~ 4); + flags = non_contacts ? (flags | 8) : (flags &~ 8); + flags = exclude_selected ? (flags | 32) : (flags &~ 32); + stream.writeInt32(flags); + if ((flags & 16) != 0) { + Vector.serializeLong(stream, users); + } + } + } + + public static class TL_connectedBot extends TLObject { + public static final int constructor = 0xbd068601; + + public int flags; + public boolean can_reply; + public long bot_id; + public TL_businessBotRecipients recipients; + + public static TL_connectedBot TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (constructor != TL_connectedBot.constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_connectedBot", constructor)); + } + return null; + } + TL_connectedBot result = new TL_connectedBot(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + can_reply = (flags & 1) != 0; + bot_id = stream.readInt64(exception); + recipients = TL_businessBotRecipients.TLdeserialize(stream, stream.readInt32(exception), exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = can_reply ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + stream.writeInt64(bot_id); + recipients.serializeToStream(stream); + } + } + + public static class connectedBots extends TLObject { + public static final int constructor = 0x17d7f87b; + + public ArrayList connected_bots = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + + public static connectedBots TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (constructor != connectedBots.constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_account_connectedBots", constructor)); + } + return null; + } + connectedBots result = new connectedBots(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + connected_bots = Vector.deserialize(stream, TL_connectedBot::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + Vector.serialize(stream, connected_bots); + Vector.serialize(stream, users); + } + } + + public static class updateConnectedBot extends TLObject { + public static final int constructor = 0x43d8521d; + + public int flags; + public boolean can_reply; + public boolean deleted; + public TLRPC.InputUser bot; + public TL_inputBusinessBotRecipients recipients; + + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Updates.TLdeserialize(stream, constructor, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = can_reply ? (flags | 1) : (flags &~ 1); + flags = deleted ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + bot.serializeToStream(stream); + recipients.serializeToStream(stream); + } + } + + public static class getConnectedBots extends TLObject { + public static final int constructor = 0x4ea4c80f; + + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return connectedBots.TLdeserialize(stream, constructor, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class toggleConnectedBotPaused extends TLObject { + public static final int constructor = 0x646E1097; + + public TLRPC.InputPeer peer; + public boolean paused; + + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeBool(paused); + } + } + + public static class disablePeerConnectedBot extends TLObject { + public static final int constructor = 0x5e437ed9; + + public TLRPC.InputPeer peer; + + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + } + } + + public static class TL_birthday extends TLObject { + public static final int constructor = 0x6c8e1e06; + + public int flags; + public int day; + public int month; + public int year; + + public static TL_birthday TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (constructor != TL_birthday.constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_birthday", constructor)); + } + return null; + } + TL_birthday result = new TL_birthday(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + day = stream.readInt32(exception); + month = stream.readInt32(exception); + if ((flags & 1) != 0) { + year = stream.readInt32(exception); + } + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeInt32(day); + stream.writeInt32(month); + if ((flags & 1) != 0) { + stream.writeInt32(year); + } + } + } + + public static class TL_contactBirthday extends TLObject { + public static final int constructor = 0x1d998733; + + public long contact_id; + public TL_birthday birthday; + + public static TL_contactBirthday TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (constructor != TL_contactBirthday.constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_contactBirthday", constructor)); + } + return null; + } + TL_contactBirthday result = new TL_contactBirthday(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + contact_id = stream.readInt64(exception); + birthday = TL_birthday.TLdeserialize(stream, stream.readInt32(exception), exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(contact_id); + birthday.serializeToStream(stream); + } + } + + public static class contactBirthdays extends TLObject { + public static final int constructor = 0x114ff30d; + + public ArrayList contacts = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + + public static contactBirthdays TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (constructor != contactBirthdays.constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_contacts_contactBirthdays", constructor)); + } + return null; + } + contactBirthdays result = new contactBirthdays(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + contacts = Vector.deserialize(stream, TL_contactBirthday::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + Vector.serialize(stream, contacts); + Vector.serialize(stream, users); + } + } + + public static class updateBirthday extends TLObject { + public static final int constructor = 0xcc6e0c11; + + public int flags; + public TL_birthday birthday; + + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + birthday.serializeToStream(stream); + } + } + } + + public static class getBirthdays extends TLObject { + public static final int constructor = 0xdaeda864; + + public int flags; + public TL_birthday birthday; + + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return contactBirthdays.TLdeserialize(stream, constructor, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_inputBusinessChatLink extends TLObject { + public static final int constructor = 0x11679fa7; + + public int flags; + public String message; + public ArrayList entities = new ArrayList<>(); + public String title; + + public static TL_inputBusinessChatLink TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_inputBusinessChatLink.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_inputBusinessChatLink", constructor)); + } else { + return null; + } + } + TL_inputBusinessChatLink result = new TL_inputBusinessChatLink(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + message = stream.readString(exception); + if ((flags & 1) != 0) { + entities = Vector.deserialize(stream, TLRPC.MessageEntity::TLdeserialize, exception); + } + if ((flags & 2) != 0) { + title = stream.readString(exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeString(message); + if ((flags & 1) != 0) { + Vector.serialize(stream, entities); + } + if ((flags & 2) != 0) { + stream.writeString(title); + } + } + } + + public static class TL_businessChatLink extends TLObject { + public static final int constructor = 0xb4ae666f; + + public int flags; + public String link; + public String message; + public ArrayList entities = new ArrayList<>(); + public String title; + public int views; + + public static TL_businessChatLink TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_businessChatLink.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_businessChatLink", constructor)); + } else { + return null; + } + } + TL_businessChatLink result = new TL_businessChatLink(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + link = stream.readString(exception); + message = stream.readString(exception); + if ((flags & 1) != 0) { + entities = Vector.deserialize(stream, TLRPC.MessageEntity::TLdeserialize, exception); + } + if ((flags & 2) != 0) { + title = stream.readString(exception); + } + views = stream.readInt32(exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeString(link); + stream.writeString(message); + if ((flags & 1) != 0) { + Vector.serialize(stream, entities); + } + if ((flags & 2) != 0) { + stream.writeString(title); + } + stream.writeInt32(views); + } + } + + public static class businessChatLinks extends TLObject { + public static final int constructor = 0xec43a2d1; + + public ArrayList links = new ArrayList<>(); + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + + public static businessChatLinks TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (businessChatLinks.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_account_businessChatLinks", constructor)); + } else { + return null; + } + } + businessChatLinks result = new businessChatLinks(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + links = Vector.deserialize(stream, TL_businessChatLink::TLdeserialize, exception); + chats = Vector.deserialize(stream, TLRPC.Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + Vector.serialize(stream, links); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); + } + } + + public static class resolvedBusinessChatLinks extends TLObject { + public static final int constructor = 0x9a23af21; + + public int flags; + public TLRPC.Peer peer; + public String message; + public ArrayList entities = new ArrayList<>(); + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + + public static resolvedBusinessChatLinks TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (resolvedBusinessChatLinks.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_account_businessChatLinks", constructor)); + } else { + return null; + } + } + resolvedBusinessChatLinks result = new resolvedBusinessChatLinks(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + peer = TLRPC.Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + message = stream.readString(exception); + if ((flags & 1) != 0) { + entities = Vector.deserialize(stream, TLRPC.MessageEntity::TLdeserialize, exception); + } + chats = Vector.deserialize(stream, TLRPC.Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + peer.serializeToStream(stream); + stream.writeString(message); + if ((flags & 1) != 0) { + Vector.serialize(stream, entities); + } + Vector.serialize(stream, chats); + Vector.serialize(stream, users); + } + } + + public static class createBusinessChatLink extends TLObject { + public static final int constructor = 0x8851e68e; + + public TL_inputBusinessChatLink link; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_businessChatLink.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + link.serializeToStream(stream); + } + } + + public static class editBusinessChatLink extends TLObject { + public static final int constructor = 0x8c3410af; + + public String slug; + public TL_inputBusinessChatLink link; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_businessChatLink.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(slug); + link.serializeToStream(stream); + } + } + + public static class deleteBusinessChatLink extends TLObject { + public static final int constructor = 0x60073674; + + public String slug; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(slug); + } + } + + public static class getBusinessChatLinks extends TLObject { + public static final int constructor = 0x6f70dde1; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return businessChatLinks.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class resolveBusinessChatLink extends TLObject { + public static final int constructor = 0x5492e5ee; + + public String slug; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return resolvedBusinessChatLinks.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(slug); + } + } + + public static class toggleSponsoredMessages extends TLObject { + public static final int constructor = 0xb9d9a38d; + + public boolean enabled; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeBool(enabled); + } + } + + public static class TL_businessIntro extends TLObject { + public static final int constructor = 0x5a0a066d; + + public int flags; + public String title; + public String description; + public TLRPC.Document sticker; + + public static TL_businessIntro TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (constructor != TL_businessIntro.constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_businessIntro", constructor)); + } + return null; + } + TL_businessIntro result = new TL_businessIntro(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + title = stream.readString(exception); + description = stream.readString(exception); + if ((flags & 1) != 0) { + sticker = TLRPC.Document.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeString(title); + stream.writeString(description); + if ((flags & 1) != 0) { + sticker.serializeToStream(stream); + } + } + } + + public static class TL_inputBusinessIntro extends TLObject { + public static final int constructor = 0x9c469cd; + + public int flags; + public String title; + public String description; + public TLRPC.InputDocument sticker; + + public static TL_inputBusinessIntro TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (constructor != TL_inputBusinessIntro.constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_inputBusinessIntro", constructor)); + } + return null; + } + TL_inputBusinessIntro result = new TL_inputBusinessIntro(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + title = stream.readString(exception); + description = stream.readString(exception); + if ((flags & 1) != 0) { + sticker = TLRPC.InputDocument.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeString(title); + stream.writeString(description); + if ((flags & 1) != 0) { + sticker.serializeToStream(stream); + } + } + } + + public static class updateBusinessIntro extends TLObject { + public static final int constructor = 0xa614d034; + + public int flags; + public TL_inputBusinessIntro intro; + + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + intro.serializeToStream(stream); + } + } + } + + public static class updatePersonalChannel extends TLObject { + public static final int constructor = 0xd94305e0; + + public TLRPC.InputChannel channel; + + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + channel.serializeToStream(stream); + } + } + + public static class ReactionNotificationsFrom extends TLObject { + public static ReactionNotificationsFrom TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + ReactionNotificationsFrom result = null; + switch (constructor) { + case TL_account.TL_reactionNotificationsFromContacts.constructor: + result = new TL_account.TL_reactionNotificationsFromContacts(); + break; + case TL_account.TL_reactionNotificationsFromAll.constructor: + result = new TL_account.TL_reactionNotificationsFromAll(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in ReactionNotificationsFrom", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } + + public static class TL_reactionNotificationsFromContacts extends ReactionNotificationsFrom { + public static final int constructor = 0xbac3a61a; + + public void readParams(InputSerializedData stream, boolean exception) {} + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_reactionNotificationsFromAll extends ReactionNotificationsFrom { + public static final int constructor = 0x4b9e22a0; + + public void readParams(InputSerializedData stream, boolean exception) {} + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class TL_reactionsNotifySettings extends TLObject { + public static final int constructor = 0x56e34970; + + public int flags; + public ReactionNotificationsFrom messages_notify_from; + public ReactionNotificationsFrom stories_notify_from; + public TLRPC.NotificationSound sound; + public boolean show_previews; + + public static TL_reactionsNotifySettings TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_reactionsNotifySettings.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_reactionsNotifySettings", constructor)); + } else { + return null; + } + } + TL_reactionsNotifySettings result = new TL_reactionsNotifySettings(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + if ((flags & 1) != 0) { + messages_notify_from = ReactionNotificationsFrom.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 2) != 0) { + stories_notify_from = ReactionNotificationsFrom.TLdeserialize(stream, stream.readInt32(exception), exception); + } + sound = TLRPC.NotificationSound.TLdeserialize(stream, stream.readInt32(exception), exception); + show_previews = stream.readBool(exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + messages_notify_from.serializeToStream(stream); + } + if ((flags & 2) != 0) { + stories_notify_from.serializeToStream(stream); + } + sound.serializeToStream(stream); + stream.writeBool(show_previews); + } + } + + public static class getReactionsNotifySettings extends TLObject { + public static final int constructor = 0x6dd654c; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_reactionsNotifySettings.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class setReactionsNotifySettings extends TLObject { + public static final int constructor = 0x316ce548; + + public TL_reactionsNotifySettings settings; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_reactionsNotifySettings.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + settings.serializeToStream(stream); + } + } } diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_bots.java b/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_bots.java index 3fb079c718..dc5a2c0429 100644 --- a/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_bots.java +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_bots.java @@ -4,8 +4,11 @@ import org.telegram.messenger.SvgHelper; import org.telegram.tgnet.AbstractSerializedData; +import org.telegram.tgnet.InputSerializedData; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import java.util.ArrayList; @@ -17,7 +20,7 @@ public static class botPreviewMedia extends TLObject { public int date; public TLRPC.MessageMedia media; - public static botPreviewMedia TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static botPreviewMedia TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (botPreviewMedia.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in botPreviewMedia", constructor)); @@ -31,13 +34,13 @@ public static botPreviewMedia TLdeserialize(AbstractSerializedData stream, int c } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { date = stream.readInt32(exception); media = TLRPC.MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(date); media.serializeToStream(stream); @@ -52,12 +55,12 @@ public static class addPreviewMedia extends TLObject { public TLRPC.InputMedia media; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return botPreviewMedia.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); bot.serializeToStream(stream); stream.writeString(lang_code); @@ -75,12 +78,12 @@ public static class editPreviewMedia extends TLObject { public TLRPC.InputMedia new_media; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return botPreviewMedia.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); bot.serializeToStream(stream); stream.writeString(lang_code); @@ -97,21 +100,16 @@ public static class deletePreviewMedia extends TLObject { public ArrayList media = new ArrayList<>(); @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); bot.serializeToStream(stream); stream.writeString(lang_code); - stream.writeInt32(0x1cb5c415); - int count = media.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - media.get(a).serializeToStream(stream); - } + Vector.serialize(stream, media); } } @@ -123,21 +121,16 @@ public static class reorderPreviewMedias extends TLObject { public ArrayList order = new ArrayList<>(); @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); bot.serializeToStream(stream); stream.writeString(lang_code); - stream.writeInt32(0x1cb5c415); - int count = order.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - order.get(a).serializeToStream(stream); - } + Vector.serialize(stream, order); } } @@ -147,17 +140,12 @@ public static class getPreviewMedias extends TLObject { public TLRPC.InputUser bot; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - TLRPC.Vector vector = new TLRPC.Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - vector.objects.add(botPreviewMedia.TLdeserialize(stream, stream.readInt32(exception), exception)); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, botPreviewMedia::TLdeserialize); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); bot.serializeToStream(stream); } @@ -170,12 +158,12 @@ public static class getPreviewInfo extends TLObject { public String lang_code = ""; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return previewInfo.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); bot.serializeToStream(stream); stream.writeString(lang_code); @@ -188,7 +176,7 @@ public static class previewInfo extends TLObject { public ArrayList media = new ArrayList<>(); public ArrayList lang_codes = new ArrayList<>(); - public static previewInfo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static previewInfo TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (previewInfo.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in previewInfo", constructor)); @@ -202,50 +190,16 @@ public static previewInfo TLdeserialize(AbstractSerializedData stream, int const } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - botPreviewMedia object = botPreviewMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - media.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - lang_codes.add(stream.readString(exception)); - } + public void readParams(InputSerializedData stream, boolean exception) { + media = Vector.deserialize(stream, botPreviewMedia::TLdeserialize, exception); + lang_codes = Vector.deserializeString(stream, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = media.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - media.get(i).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = lang_codes.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - stream.writeString(lang_codes.get(i)); - } + Vector.serialize(stream, media); + Vector.serializeString(stream, lang_codes); } } @@ -259,11 +213,11 @@ public static class setBotInfo extends TLObject { public String about; public String description; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 4) != 0) { @@ -289,11 +243,11 @@ public static class getBotInfo extends TLObject { public TLRPC.InputUser bot; public String lang_code; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return BotInfo.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -309,19 +263,14 @@ public static class reorderUsernames extends TLObject { public TLRPC.InputUser bot; public ArrayList order = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); bot.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = order.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeString(order.get(a)); - } + Vector.serializeString(stream, order); } } @@ -332,11 +281,11 @@ public static class toggleUsername extends TLObject { public String username; public boolean active; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); bot.serializeToStream(stream); stream.writeString(username); @@ -356,8 +305,9 @@ public static abstract class BotInfo extends TLObject { public boolean has_preview_medias; public String privacy_policy_url; public botAppSettings app_settings; + public botVerifierSettings verifier_settings; - public static BotInfo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static BotInfo TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { BotInfo result = null; switch (constructor) { case TL_botInfo_layer140.constructor: @@ -381,6 +331,9 @@ public static BotInfo TLdeserialize(AbstractSerializedData stream, int construct case TL_botInfo_layer192.constructor: result = new TL_botInfo_layer192(); break; + case TL_botInfo_layer195.constructor: + result = new TL_botInfo_layer195(); + break; case TL_botInfo.constructor: result = new TL_botInfo(); break; @@ -399,7 +352,7 @@ public static class TL_botInfoEmpty_layer48 extends TL_botInfo { public static final int constructor = 0xbb2e37ce; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -408,36 +361,17 @@ public static class TL_botInfo_layer131 extends TL_botInfo { public static final int constructor = 0x98e81d3a; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt32(exception); description = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.TL_botCommand object = TLRPC.TL_botCommand.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - commands.add(object); - } + commands = Vector.deserialize(stream, TLRPC.TL_botCommand::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) user_id); stream.writeString(description); - stream.writeInt32(0x1cb5c415); - int count = commands.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - commands.get(a).serializeToStream(stream); - } + Vector.serialize(stream, commands); } } @@ -445,40 +379,21 @@ public static class TL_botInfo_layer48 extends TL_botInfo { public static final int constructor = 0x9cf585d; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt32(exception); version = stream.readInt32(exception); stream.readString(exception); description = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.TL_botCommand object = TLRPC.TL_botCommand.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - commands.add(object); - } + commands = Vector.deserialize(stream, TLRPC.TL_botCommand::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32((int) user_id); stream.writeInt32(version); stream.writeString(""); stream.writeString(description); - stream.writeInt32(0x1cb5c415); - int count = commands.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - commands.get(a).serializeToStream(stream); - } + Vector.serialize(stream, commands); } } @@ -486,44 +401,93 @@ public static class TL_botInfo_layer139 extends BotInfo { public static final int constructor = 0x1b74b335; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); description = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.TL_botCommand object = TLRPC.TL_botCommand.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - commands.add(object); - } + commands = Vector.deserialize(stream, TLRPC.TL_botCommand::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); stream.writeString(description); - stream.writeInt32(0x1cb5c415); - int count = commands.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - commands.get(a).serializeToStream(stream); - } + Vector.serialize(stream, commands); } } public static class TL_botInfo extends BotInfo { - public static final int constructor = 0x36607333; + public static final int constructor = 0x4d8a0299; + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + has_preview_medias = (flags & 64) != 0; + if ((flags & 1) != 0) { + user_id = stream.readInt64(exception); + } + if ((flags & 2) != 0) { + description = stream.readString(exception); + } + if ((flags & 16) != 0) { + description_photo = TLRPC.Photo.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 32) != 0) { + description_document = TLRPC.Document.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 4) != 0) { + commands = Vector.deserialize(stream, TLRPC.TL_botCommand::TLdeserialize, exception); + } + if ((flags & 8) != 0) { + menu_button = BotMenuButton.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 128) != 0) { + privacy_policy_url = stream.readString(exception); + } + if ((flags & 256) != 0) { + app_settings = botAppSettings.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 512) != 0) { + verifier_settings = botVerifierSettings.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = has_preview_medias ? flags | 64 : flags &~ 64; + stream.writeInt32(flags); + if ((flags & 1) != 0) { + stream.writeInt64(user_id); + } + if ((flags & 2) != 0) { + stream.writeString(description); + } + if ((flags & 16) != 0) { + description_photo.serializeToStream(stream); + } + if ((flags & 32) != 0) { + description_document.serializeToStream(stream); + } + if ((flags & 4) != 0) { + Vector.serialize(stream, commands); + } + if ((flags & 8) != 0) { + menu_button.serializeToStream(stream); + } + if ((flags & 128) != 0) { + stream.writeString(privacy_policy_url); + } + if ((flags & 256) != 0) { + app_settings.serializeToStream(stream); + } + if ((flags & 512) != 0) { + verifier_settings.serializeToStream(stream); + } + } + } + + public static class TL_botInfo_layer195 extends TL_botInfo { + public static final int constructor = 0x36607333; + + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); has_preview_medias = (flags & 64) != 0; if ((flags & 1) != 0) { @@ -539,21 +503,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { description_document = TLRPC.Document.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 4) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.TL_botCommand object = TLRPC.TL_botCommand.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - commands.add(object); - } + commands = Vector.deserialize(stream, TLRPC.TL_botCommand::TLdeserialize, exception); } if ((flags & 8) != 0) { menu_button = BotMenuButton.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -566,7 +516,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = has_preview_medias ? flags | 64 : flags &~ 64; stream.writeInt32(flags); @@ -583,12 +533,7 @@ public void serializeToStream(AbstractSerializedData stream) { description_document.serializeToStream(stream); } if ((flags & 4) != 0) { - stream.writeInt32(0x1cb5c415); - int count = commands.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - commands.get(a).serializeToStream(stream); - } + Vector.serialize(stream, commands); } if ((flags & 8) != 0) { menu_button.serializeToStream(stream); @@ -606,7 +551,7 @@ public static class TL_botInfo_layer192 extends TL_botInfo { public static final int constructor = 0x82437e74; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); has_preview_medias = (flags & 64) != 0; if ((flags & 1) != 0) { @@ -622,21 +567,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { description_document = TLRPC.Document.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 4) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.TL_botCommand object = TLRPC.TL_botCommand.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - commands.add(object); - } + commands = Vector.deserialize(stream, TLRPC.TL_botCommand::TLdeserialize, exception); } if ((flags & 8) != 0) { menu_button = BotMenuButton.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -646,7 +577,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = has_preview_medias ? flags | 64 : flags &~ 64; stream.writeInt32(flags); @@ -663,12 +594,7 @@ public void serializeToStream(AbstractSerializedData stream) { description_document.serializeToStream(stream); } if ((flags & 4) != 0) { - stream.writeInt32(0x1cb5c415); - int count = commands.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - commands.get(a).serializeToStream(stream); - } + Vector.serialize(stream, commands); } if ((flags & 8) != 0) { menu_button.serializeToStream(stream); @@ -683,7 +609,7 @@ public static class TL_botInfo_layer185 extends TL_botInfo { public static final int constructor = 0x8f300b57; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); has_preview_medias = (flags & 64) != 0; if ((flags & 1) != 0) { @@ -699,28 +625,14 @@ public void readParams(AbstractSerializedData stream, boolean exception) { description_document = TLRPC.Document.TLdeserialize(stream, stream.readInt32(exception), exception); } if ((flags & 4) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.TL_botCommand object = TLRPC.TL_botCommand.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - commands.add(object); - } + commands = Vector.deserialize(stream, TLRPC.TL_botCommand::TLdeserialize, exception); } if ((flags & 8) != 0) { menu_button = BotMenuButton.TLdeserialize(stream, stream.readInt32(exception), exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = has_preview_medias ? flags | 64 : flags &~ 64; stream.writeInt32(flags); @@ -737,12 +649,7 @@ public void serializeToStream(AbstractSerializedData stream) { description_document.serializeToStream(stream); } if ((flags & 4) != 0) { - stream.writeInt32(0x1cb5c415); - int count = commands.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - commands.get(a).serializeToStream(stream); - } + Vector.serialize(stream, commands); } if ((flags & 8) != 0) { menu_button.serializeToStream(stream); @@ -754,44 +661,25 @@ public static class TL_botInfo_layer140 extends TL_botInfo { public static final int constructor = 0xe4169b5d; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); description = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.TL_botCommand object = TLRPC.TL_botCommand.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - commands.add(object); - } + commands = Vector.deserialize(stream, TLRPC.TL_botCommand::TLdeserialize, exception); menu_button = BotMenuButton.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); stream.writeString(description); - stream.writeInt32(0x1cb5c415); - int count = commands.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - commands.get(a).serializeToStream(stream); - } + Vector.serialize(stream, commands); menu_button.serializeToStream(stream); } } public static abstract class BotMenuButton extends TLObject { - public static BotMenuButton TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static BotMenuButton TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { BotMenuButton result = null; switch (constructor) { case 0xc7b57ce6: @@ -820,12 +708,12 @@ public static class TL_botMenuButton extends BotMenuButton { public String text; public String url; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { text = stream.readString(exception); url = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(text); stream.writeString(url); @@ -836,7 +724,7 @@ public static class TL_botMenuButtonDefault extends BotMenuButton { public static final int constructor = 0x7533a588; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -845,7 +733,7 @@ public static class TL_botMenuButtonCommands extends BotMenuButton { public static final int constructor = 0x4258c205; - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -856,12 +744,12 @@ public static class TL_updateBotMenuButton extends TLRPC.Update { public long bot_id; public BotMenuButton button; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { bot_id = stream.readInt64(exception); button = BotMenuButton.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(bot_id); button.serializeToStream(stream); @@ -874,11 +762,11 @@ public static class setBotMenuButton extends TLObject { public TLRPC.InputUser user_id; public BotMenuButton button; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); user_id.serializeToStream(stream); button.serializeToStream(stream); @@ -890,11 +778,11 @@ public static class getBotMenuButton extends TLObject { public TLRPC.InputUser user_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return BotMenuButton.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); user_id.serializeToStream(stream); } @@ -905,11 +793,11 @@ public static class canSendMessage extends TLObject { public TLRPC.InputUser bot; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); bot.serializeToStream(stream); } @@ -920,11 +808,11 @@ public static class allowSendMessage extends TLObject { public TLRPC.InputUser bot; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); bot.serializeToStream(stream); } @@ -937,11 +825,11 @@ public static class invokeWebViewCustomMethod extends TLObject { public String custom_method; public TLRPC.TL_dataJSON params; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.TL_dataJSON.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); bot.serializeToStream(stream); stream.writeString(custom_method); @@ -956,12 +844,12 @@ public static class getPopularAppBots extends TLObject { public int limit; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return popularAppBots.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(offset); stream.writeInt32(limit); @@ -975,7 +863,7 @@ public static class popularAppBots extends TLObject { public String next_offset; public ArrayList users = new ArrayList<>(); - public static popularAppBots TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static popularAppBots TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (popularAppBots.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_bots_popularAppBots", constructor)); @@ -988,40 +876,21 @@ public static popularAppBots TLdeserialize(AbstractSerializedData stream, int co return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { next_offset = stream.readString(exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.User object = TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { stream.writeString(next_offset); } - stream.writeInt32(0x1cb5c415); - int count = users.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - users.get(i).serializeToStream(stream); - } + Vector.serialize(stream, users); } } @@ -1036,7 +905,7 @@ public static class botAppSettings extends TLObject { public int header_color; public int header_dark_color; - public static botAppSettings TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static botAppSettings TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (botAppSettings.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in botAppSettings", constructor)); @@ -1050,7 +919,7 @@ public static botAppSettings TLdeserialize(AbstractSerializedData stream, int co } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { placeholder_path = stream.readByteArray(exception); @@ -1071,7 +940,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -1099,12 +968,12 @@ public static class toggleUserEmojiStatusPermission extends TLObject { public boolean enabled; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); bot.serializeToStream(stream); stream.writeBool(enabled); @@ -1119,12 +988,12 @@ public static class checkDownloadFileParams extends TLObject { public String url; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); bot.serializeToStream(stream); stream.writeString(file_name); @@ -1141,12 +1010,12 @@ public static class updateStarRefProgram extends TLObject { public int duration_months; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_payments.starRefProgram.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); bot.serializeToStream(stream); @@ -1161,18 +1030,141 @@ public static class getAdminedBots extends TLObject { public static final int constructor = 0xb0711d83; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - TLRPC.Vector vector = new TLRPC.Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - vector.objects.add(TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception)); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, TLRPC.User::TLdeserialize); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class botVerifierSettings extends TLObject { + public static final int constructor = 0xb0cd6617; + + public int flags; + public boolean can_modify_custom_description; + public long icon; + public String company; + public String custom_description; + + public static botVerifierSettings TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (botVerifierSettings.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_bots.botVerifierSettings", constructor)); + } else { + return null; + } + } + botVerifierSettings result = new botVerifierSettings(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + can_modify_custom_description = (flags & 2) != 0; + icon = stream.readInt64(exception); + company = stream.readString(exception); + if ((flags & 1) != 0) { + custom_description = stream.readString(exception); } - return vector; } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = can_modify_custom_description ? flags | 2 : flags &~ 2; + stream.writeInt32(flags); + stream.writeString(company); + if ((flags & 1) != 0) { + stream.writeString(custom_description); + } + } + } + + public static class botVerification extends TLObject { + public static final int constructor = 0xf93cd45c; + + public long bot_id; + public long icon; + public String description; + + public static botVerification TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (botVerification.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_bots.botVerification", constructor)); + } else { + return null; + } + } + botVerification result = new botVerification(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + bot_id = stream.readInt64(exception); + icon = stream.readInt64(exception); + description = stream.readString(exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(bot_id); + stream.writeInt64(icon); + stream.writeString(description); + } + } + + public static class setCustomVerification extends TLObject { + public static final int constructor = 0x8b89dfbd; + + public int flags; + public boolean enabled; + public TLRPC.InputUser bot; + public TLRPC.InputPeer peer; + public String custom_description; + + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = enabled ? flags | 2 : flags &~ 2; + stream.writeInt32(flags); + if ((flags & 1) != 0) { + bot.serializeToStream(stream); + } + peer.serializeToStream(stream); + if ((flags & 4) != 0) { + stream.writeString(custom_description); + } + } + + } + + public static class getBotRecommendations extends TLObject { + public static final int constructor = 0xa1b70815; + + public TLRPC.InputUser bot; + + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Users.TLdeserialize(stream, constructor, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + bot.serializeToStream(stream); } } diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_chatlists.java b/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_chatlists.java index 4c76f6d964..01bee31e5d 100644 --- a/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_chatlists.java +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_chatlists.java @@ -1,8 +1,11 @@ package org.telegram.tgnet.tl; import org.telegram.tgnet.AbstractSerializedData; +import org.telegram.tgnet.InputSerializedData; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import java.util.ArrayList; @@ -12,7 +15,7 @@ public static class TL_inputChatlistDialogFilter extends TLObject { public int filter_id; - public static TL_inputChatlistDialogFilter TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_inputChatlistDialogFilter TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_inputChatlistDialogFilter.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_inputChatlistDialogFilter", constructor)); @@ -25,11 +28,11 @@ public static TL_inputChatlistDialogFilter TLdeserialize(AbstractSerializedData return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { filter_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(filter_id); } @@ -41,7 +44,7 @@ public static class TL_chatlists_exportedChatlistInvite extends TLObject { public TLRPC.DialogFilter filter; public TL_exportedChatlistInvite invite; - public static TL_chatlists_exportedChatlistInvite TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_chatlists_exportedChatlistInvite TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_chatlists_exportedChatlistInvite.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_chatlists_exportedChatlistInvite", constructor)); @@ -54,12 +57,12 @@ public static TL_chatlists_exportedChatlistInvite TLdeserialize(AbstractSerializ return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { filter = TLRPC.DialogFilter.TLdeserialize(stream, stream.readInt32(exception), exception); invite = TL_exportedChatlistInvite.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); filter.serializeToStream(stream); invite.serializeToStream(stream); @@ -75,7 +78,7 @@ public static class TL_exportedChatlistInvite extends TLObject { public String url; public ArrayList peers = new ArrayList<>(); - public static TL_exportedChatlistInvite TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_exportedChatlistInvite TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_exportedChatlistInvite.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_exportedChatlistInvite", constructor)); @@ -88,40 +91,21 @@ public static TL_exportedChatlistInvite TLdeserialize(AbstractSerializedData str return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); revoked = (flags & 1) != 0; title = stream.readString(exception); url = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.Peer object = TLRPC.Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - peers.add(object); - } + peers = Vector.deserialize(stream, TLRPC.Peer::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = revoked ? (flags | 1) : (flags & ~1); stream.writeInt32(flags); stream.writeString(title); stream.writeString(url); - stream.writeInt32(0x1cb5c415); - int count = peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - peers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, peers); } } @@ -132,7 +116,7 @@ public static class TL_chatlists_exportedInvites extends TLObject { public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_chatlists_exportedInvites TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_chatlists_exportedInvites TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_chatlists_exportedInvites.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_chatlists_exportedInvites", constructor)); @@ -145,88 +129,34 @@ public static TL_chatlists_exportedInvites TLdeserialize(AbstractSerializedData return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_exportedChatlistInvite object = TL_exportedChatlistInvite.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - invites.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.Chat object = TLRPC.Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.User object = TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + invites = Vector.deserialize(stream, TL_exportedChatlistInvite::TLdeserialize, exception); + chats = Vector.deserialize(stream, TLRPC.Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = invites.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - invites.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, invites); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } public static abstract class chatlist_ChatlistInvite extends TLObject { - public static chatlist_ChatlistInvite TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static chatlist_ChatlistInvite TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { chatlist_ChatlistInvite result = null; switch (constructor) { - case 0xfa87f659: + case TL_chatlists_chatlistInviteAlready.constructor: result = new TL_chatlists_chatlistInviteAlready(); break; - case 0x1dcd839d: + case TL_chatlists_chatlistInvite.constructor: result = new TL_chatlists_chatlistInvite(); break; + case TL_chatlists_chatlistInvite_layer195.constructor: + result = new TL_chatlists_chatlistInvite_layer195(); + break; } if (result == null && exception) { throw new RuntimeException(String.format("can't parse magic %x in chatlist_ChatlistInvite", constructor)); @@ -247,182 +177,85 @@ public static class TL_chatlists_chatlistInviteAlready extends chatlist_Chatlist public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { filter_id = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.Peer object = TLRPC.Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - missing_peers.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.Peer object = TLRPC.Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - already_peers.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.Chat object = TLRPC.Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.User object = TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + missing_peers = Vector.deserialize(stream, TLRPC.Peer::TLdeserialize, exception); + already_peers = Vector.deserialize(stream, TLRPC.Peer::TLdeserialize, exception); + chats = Vector.deserialize(stream, TLRPC.Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(filter_id); - stream.writeInt32(0x1cb5c415); - int count = missing_peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - missing_peers.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, missing_peers); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } public static class TL_chatlists_chatlistInvite extends chatlist_ChatlistInvite { - public static final int constructor = 0x1dcd839d; + public static final int constructor = 0xf10ece2f; public int flags; - public String title; + public boolean title_noanimate; + public TLRPC.TL_textWithEntities title = new TLRPC.TL_textWithEntities(); public String emoticon; public ArrayList peers = new ArrayList<>(); public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); - title = stream.readString(exception); + title_noanimate = (flags & 2) != 0; + title = TLRPC.TL_textWithEntities.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 1) > 0) { emoticon = stream.readString(exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.Peer object = TLRPC.Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - peers.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.Chat object = TLRPC.Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.User object = TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + peers = Vector.deserialize(stream, TLRPC.Peer::TLdeserialize, exception); + chats = Vector.deserialize(stream, TLRPC.Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); + flags = title_noanimate ? (flags | 2) : (flags & ~2); stream.writeInt32(flags); - stream.writeString(title); + title.serializeToStream(stream); if ((flags & 1) > 0) { stream.writeString(emoticon); } - stream.writeInt32(0x1cb5c415); - int count = peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - peers.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); + Vector.serialize(stream, peers); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); + } + } + + public static class TL_chatlists_chatlistInvite_layer195 extends TL_chatlists_chatlistInvite { + public static final int constructor = 0x1dcd839d; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + title = new TLRPC.TL_textWithEntities(); + title.text = stream.readString(exception); + if ((flags & 1) > 0) { + emoticon = stream.readString(exception); } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); + peers = Vector.deserialize(stream, TLRPC.Peer::TLdeserialize, exception); + chats = Vector.deserialize(stream, TLRPC.Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + title.serializeToStream(stream); + if ((flags & 1) > 0) { + stream.writeString(emoticon); } + Vector.serialize(stream, peers); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } @@ -433,7 +266,7 @@ public static class TL_chatlists_chatlistUpdates extends TLObject { public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_chatlists_chatlistUpdates TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_chatlists_chatlistUpdates TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_chatlists_chatlistUpdates.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_chatlists_chatlistUpdates", constructor)); @@ -446,74 +279,17 @@ public static TL_chatlists_chatlistUpdates TLdeserialize(AbstractSerializedData return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.Peer object = TLRPC.Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - missing_peers.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.Chat object = TLRPC.Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.User object = TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + missing_peers = Vector.deserialize(stream, TLRPC.Peer::TLdeserialize, exception); + chats = Vector.deserialize(stream, TLRPC.Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = missing_peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - missing_peers.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, missing_peers); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } @@ -524,20 +300,15 @@ public static class TL_chatlists_exportChatlistInvite extends TLObject { public String title; public ArrayList peers = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_chatlists_exportedChatlistInvite.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); chatlist.serializeToStream(stream); stream.writeString(title); - stream.writeInt32(0x1cb5c415); - int count = peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - peers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, peers); } } @@ -547,11 +318,11 @@ public static class TL_chatlists_deleteExportedInvite extends TLObject { public TL_inputChatlistDialogFilter chatlist; public String slug; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); chatlist.serializeToStream(stream); stream.writeString(slug); @@ -568,11 +339,11 @@ public static class TL_chatlists_editExportedInvite extends TLObject { public String title; public ArrayList peers = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_exportedChatlistInvite.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = revoked ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -582,12 +353,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeString(title); } if ((flags & 4) != 0) { - stream.writeInt32(0x1cb5c415); - int count = peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - peers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, peers); } } } @@ -597,11 +363,11 @@ public static class TL_chatlists_getExportedInvites extends TLObject { public TL_inputChatlistDialogFilter chatlist; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_chatlists_exportedInvites.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); chatlist.serializeToStream(stream); } @@ -612,11 +378,11 @@ public static class TL_chatlists_checkChatlistInvite extends TLObject { public String slug; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return chatlist_ChatlistInvite.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(slug); } @@ -628,19 +394,14 @@ public static class TL_chatlists_joinChatlistInvite extends TLObject { public String slug; public ArrayList peers = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(slug); - stream.writeInt32(0x1cb5c415); - int count = peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - peers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, peers); } } @@ -649,11 +410,11 @@ public static class TL_chatlists_getChatlistUpdates extends TLObject { public TL_inputChatlistDialogFilter chatlist; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_chatlists_chatlistUpdates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); chatlist.serializeToStream(stream); } @@ -665,19 +426,14 @@ public static class TL_chatlists_joinChatlistUpdates extends TLObject { public TL_inputChatlistDialogFilter chatlist; public ArrayList peers = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); chatlist.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - peers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, peers); } } @@ -686,11 +442,11 @@ public static class TL_chatlists_hideChatlistUpdates extends TLObject { public TL_inputChatlistDialogFilter chatlist; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); chatlist.serializeToStream(stream); } @@ -701,20 +457,11 @@ public static class TL_chatlists_getLeaveChatlistSuggestions extends TLObject { public TL_inputChatlistDialogFilter chatlist; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - TLRPC.Vector vector = new TLRPC.Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TLRPC.Peer object = TLRPC.Peer.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, TLRPC.Peer::TLdeserialize); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); chatlist.serializeToStream(stream); } @@ -726,19 +473,14 @@ public static class TL_chatlists_leaveChatlist extends TLObject { public TL_inputChatlistDialogFilter chatlist; public ArrayList peers = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); chatlist.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = peers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - peers.get(a).serializeToStream(stream); - } + Vector.serialize(stream, peers); } } } diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_fragment.java b/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_fragment.java index 8bbc3b9cf1..0e8b690b34 100644 --- a/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_fragment.java +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_fragment.java @@ -1,13 +1,15 @@ package org.telegram.tgnet.tl; import org.telegram.tgnet.AbstractSerializedData; +import org.telegram.tgnet.InputSerializedData; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; public class TL_fragment { public static class InputCollectible extends TLObject { - public static InputCollectible TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static InputCollectible TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputCollectible result = null; switch (constructor) { case TL_inputCollectibleUsername.constructor: @@ -33,13 +35,13 @@ public static class TL_inputCollectibleUsername extends InputCollectible { public String username; @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(username); } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { username = stream.readString(exception); } } @@ -50,13 +52,13 @@ public static class TL_inputCollectiblePhone extends InputCollectible { public String phone; @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(phone); } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { phone = stream.readString(exception); } } @@ -71,7 +73,7 @@ public static class TL_collectibleInfo extends TLObject { public long crypto_amount; public String url; - public static TL_collectibleInfo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_collectibleInfo TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_collectibleInfo.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_collectibleInfo", constructor)); @@ -85,7 +87,7 @@ public static TL_collectibleInfo TLdeserialize(AbstractSerializedData stream, in } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(purchase_date); stream.writeString(currency); @@ -96,7 +98,7 @@ public void serializeToStream(AbstractSerializedData stream) { } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { purchase_date = stream.readInt32(exception); currency = stream.readString(exception); amount = stream.readInt64(exception); @@ -112,12 +114,12 @@ public static class TL_getCollectibleInfo extends TLObject { public InputCollectible collectible; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_collectibleInfo.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); collectible.serializeToStream(stream); } diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_payments.java b/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_payments.java index 0f14ebbb82..7097b9044e 100644 --- a/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_payments.java +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_payments.java @@ -1,8 +1,11 @@ package org.telegram.tgnet.tl; import org.telegram.tgnet.AbstractSerializedData; +import org.telegram.tgnet.InputSerializedData; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import java.util.ArrayList; @@ -21,7 +24,7 @@ public static class connectedBotStarRef extends TLObject { public long participants; public long revenue; - public static connectedBotStarRef TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static connectedBotStarRef TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (connectedBotStarRef.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_payments.connectedBotStarRef", constructor)); @@ -35,7 +38,7 @@ public static connectedBotStarRef TLdeserialize(AbstractSerializedData stream, i } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); revoked = (flags & 2) != 0; url = stream.readString(exception); @@ -50,7 +53,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = revoked ? flags | 2 : flags &~ 2; stream.writeInt32(flags); @@ -73,7 +76,7 @@ public static class connectedStarRefBots extends TLObject { public ArrayList connected_bots = new ArrayList<>(); public ArrayList users = new ArrayList(); - public static connectedStarRefBots TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static connectedStarRefBots TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (connectedStarRefBots.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_payments.connectedStarRefBots", constructor)); @@ -87,48 +90,18 @@ public static connectedStarRefBots TLdeserialize(AbstractSerializedData stream, } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - connected_bots.add(connectedBotStarRef.TLdeserialize(stream, stream.readInt32(exception), exception)); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - users.add(TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception)); - } + connected_bots = Vector.deserialize(stream, connectedBotStarRef::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = connected_bots.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - connected_bots.get(i).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - users.get(i).serializeToStream(stream); - } + Vector.serialize(stream, connected_bots); + Vector.serialize(stream, users); } } @@ -141,7 +114,7 @@ public static class suggestedStarRefBots extends TLObject { public ArrayList users = new ArrayList<>(); public String next_offset; - public static suggestedStarRefBots TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static suggestedStarRefBots TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (suggestedStarRefBots.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_payments.suggestedStarRefBots", constructor)); @@ -155,52 +128,22 @@ public static suggestedStarRefBots TLdeserialize(AbstractSerializedData stream, } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - suggested_bots.add(starRefProgram.TLdeserialize(stream, stream.readInt32(exception), exception)); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - users.add(TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception)); - } + suggested_bots = Vector.deserialize(stream, starRefProgram::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); if ((flags & 1) != 0) { next_offset = stream.readString(exception); } } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = suggested_bots.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - suggested_bots.get(i).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - users.get(i).serializeToStream(stream); - } + Vector.serialize(stream, suggested_bots); + Vector.serialize(stream, users); if ((flags & 1) != 0) { stream.writeString(next_offset); } @@ -217,7 +160,7 @@ public static class starRefProgram extends TLObject { public int end_date; public TL_stars.StarsAmount daily_revenue_per_user = new TL_stars.StarsAmount(0); - public static starRefProgram TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static starRefProgram TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (starRefProgram.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_payments.starRefProgram", constructor)); @@ -231,7 +174,7 @@ public static starRefProgram TLdeserialize(AbstractSerializedData stream, int co } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); bot_id = stream.readInt64(exception); commission_permille = stream.readInt32(exception); @@ -247,7 +190,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(bot_id); @@ -271,12 +214,12 @@ public static class connectStarRefBot extends TLObject { public TLRPC.InputUser bot; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return connectedStarRefBots.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); bot.serializeToStream(stream); @@ -294,12 +237,12 @@ public static class getSuggestedStarRefBots extends TLObject { public int limit; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return suggestedStarRefBots.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = order_by_revenue ? flags | 1 : flags &~ 1; flags = order_by_date ? flags | 2 : flags &~ 2; @@ -320,12 +263,12 @@ public static class getConnectedStarRefBots extends TLObject { public int limit; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return connectedStarRefBots.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); peer.serializeToStream(stream); @@ -345,12 +288,12 @@ public static class getConnectedStarRefBot extends TLObject { public TLRPC.InputUser bot; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return connectedStarRefBots.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); bot.serializeToStream(stream); @@ -366,12 +309,12 @@ public static class editConnectedStarRefBot extends TLObject { public String link; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return connectedStarRefBots.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = revoked ? flags | 1 : flags &~ 1; stream.writeInt32(flags); diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_phone.java b/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_phone.java new file mode 100644 index 0000000000..83513e0538 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_phone.java @@ -0,0 +1,1475 @@ +package org.telegram.tgnet.tl; + +import org.telegram.tgnet.InputSerializedData; +import org.telegram.tgnet.OutputSerializedData; +import org.telegram.tgnet.TLObject; +import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; + +import java.util.ArrayList; + +public class TL_phone { + + public static class joinAsPeers extends TLObject { + public static final int constructor = 0xafe5623f; + + public ArrayList peers = new ArrayList<>(); + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + + public static joinAsPeers TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (joinAsPeers.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_phone_joinAsPeers", constructor)); + } else { + return null; + } + } + joinAsPeers result = new joinAsPeers(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + peers = Vector.deserialize(stream, TLRPC.Peer::TLdeserialize, exception); + chats = Vector.deserialize(stream, TLRPC.Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + Vector.serialize(stream, peers); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); + } + } + + public static class groupCall extends TLObject { + public static final int constructor = 0x9e727aad; + + public TLRPC.GroupCall call; + public ArrayList participants = new ArrayList<>(); + public String participants_next_offset; + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + + public static groupCall TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (groupCall.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_phone_groupCall", constructor)); + } else { + return null; + } + } + groupCall result = new groupCall(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + call = TLRPC.GroupCall.TLdeserialize(stream, stream.readInt32(exception), exception); + participants = Vector.deserialize(stream, TLRPC.TL_groupCallParticipant::TLdeserialize, exception); + participants_next_offset = stream.readString(exception); + chats = Vector.deserialize(stream, TLRPC.Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + call.serializeToStream(stream); + Vector.serialize(stream, participants); + stream.writeString(participants_next_offset); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); + } + } + + public static abstract class PhoneCall extends TLObject { + + public int flags; + public boolean p2p_allowed; + public long id; + public long access_hash; + public int date; + public long admin_id; + public long participant_id; + public byte[] g_a_or_b; + public long key_fingerprint; + public PhoneCallProtocol protocol; + public ArrayList connections = new ArrayList<>(); + public int start_date; + public boolean need_rating; + public boolean need_debug; + public boolean video; + public TLRPC.PhoneCallDiscardReason reason; + public int duration; + public byte[] g_a_hash; + public byte[] g_b; + public int receive_date; + public TLRPC.TL_dataJSON custom_parameters; + public TLRPC.TL_inputGroupCall conference_call; + + public static PhoneCall TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + PhoneCall result = null; + switch (constructor) { + case phoneCallRequested.constructor: + result = new phoneCallRequested(); + break; + case phoneCallRequested_layer195.constructor: + result = new phoneCallRequested_layer195(); + break; + case TL_phoneCall.constructor: + result = new TL_phoneCall(); + break; + case TL_phoneCall_layer195.constructor: + result = new TL_phoneCall_layer195(); + break; + case TL_phoneCall_layer176.constructor: + result = new TL_phoneCall_layer176(); + break; + case TL_phoneCallEmpty.constructor: + result = new TL_phoneCallEmpty(); + break; + case TL_phoneCallAccepted.constructor: + result = new TL_phoneCallAccepted(); + break; + case TL_phoneCallWaiting.constructor: + result = new TL_phoneCallWaiting(); + break; + case TL_phoneCallWaiting_layer195.constructor: + result = new TL_phoneCallWaiting_layer195(); + break; + case TL_phoneCallDiscarded_layer195.constructor: + result = new TL_phoneCallDiscarded_layer195(); + break; + case TL_phoneCallDiscarded.constructor: + result = new TL_phoneCallDiscarded(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in PhoneCall", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } + + public static class phoneCallRequested extends PhoneCall { + public static final int constructor = 0x45361c63; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + video = (flags & 64) != 0; + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + date = stream.readInt32(exception); + admin_id = stream.readInt64(exception); + participant_id = stream.readInt64(exception); + g_a_hash = stream.readByteArray(exception); + protocol = PhoneCallProtocol.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 256) != 0) { + conference_call = TLRPC.TL_inputGroupCall.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = video ? (flags | 64) : (flags &~ 64); + stream.writeInt32(flags); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32(date); + stream.writeInt64(admin_id); + stream.writeInt64(participant_id); + stream.writeByteArray(g_a_hash); + protocol.serializeToStream(stream); + if ((flags & 256) != 0) { + conference_call.serializeToStream(stream); + } + } + } + + public static class phoneCallRequested_layer195 extends phoneCallRequested { + public static final int constructor = 0x14b0ed0c; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + video = (flags & 64) != 0; + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + date = stream.readInt32(exception); + admin_id = stream.readInt64(exception); + participant_id = stream.readInt64(exception); + g_a_hash = stream.readByteArray(exception); + protocol = PhoneCallProtocol.TLdeserialize(stream, stream.readInt32(exception), exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = video ? (flags | 64) : (flags &~ 64); + stream.writeInt32(flags); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32(date); + stream.writeInt64(admin_id); + stream.writeInt64(participant_id); + stream.writeByteArray(g_a_hash); + protocol.serializeToStream(stream); + } + } + + public static class TL_phoneCall extends PhoneCall { + public static final int constructor = 0x3ba5940c; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + p2p_allowed = (flags & 32) != 0; + video = (flags & 64) != 0; + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + date = stream.readInt32(exception); + admin_id = stream.readInt64(exception); + participant_id = stream.readInt64(exception); + g_a_or_b = stream.readByteArray(exception); + key_fingerprint = stream.readInt64(exception); + protocol = PhoneCallProtocol.TLdeserialize(stream, stream.readInt32(exception), exception); + connections = Vector.deserialize(stream, TLRPC.PhoneConnection::TLdeserialize, exception); + start_date = stream.readInt32(exception); + if ((flags & 128) != 0) { + custom_parameters = TLRPC.TL_dataJSON.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 256) != 0) { + conference_call = TLRPC.TL_inputGroupCall.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = p2p_allowed ? (flags | 32) : (flags &~ 32); + flags = video ? (flags | 64) : (flags &~ 64); + stream.writeInt32(flags); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32(date); + stream.writeInt64(admin_id); + stream.writeInt64(participant_id); + stream.writeByteArray(g_a_or_b); + stream.writeInt64(key_fingerprint); + protocol.serializeToStream(stream); + Vector.serialize(stream, connections); + stream.writeInt32(start_date); + if ((flags & 128) != 0) { + custom_parameters.serializeToStream(stream); + } + if ((flags & 256) != 0) { + conference_call.serializeToStream(stream); + } + } + } + + public static class TL_phoneCall_layer195 extends TL_phoneCall { + public static final int constructor = 0x30535af5; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + p2p_allowed = (flags & 32) != 0; + video = (flags & 64) != 0; + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + date = stream.readInt32(exception); + admin_id = stream.readInt64(exception); + participant_id = stream.readInt64(exception); + g_a_or_b = stream.readByteArray(exception); + key_fingerprint = stream.readInt64(exception); + protocol = PhoneCallProtocol.TLdeserialize(stream, stream.readInt32(exception), exception); + connections = Vector.deserialize(stream, TLRPC.PhoneConnection::TLdeserialize, exception); + start_date = stream.readInt32(exception); + if ((flags & 128) != 0) { + custom_parameters = TLRPC.TL_dataJSON.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = p2p_allowed ? (flags | 32) : (flags &~ 32); + flags = video ? (flags | 64) : (flags &~ 64); + stream.writeInt32(flags); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32(date); + stream.writeInt64(admin_id); + stream.writeInt64(participant_id); + stream.writeByteArray(g_a_or_b); + stream.writeInt64(key_fingerprint); + protocol.serializeToStream(stream); + Vector.serialize(stream, connections); + stream.writeInt32(start_date); + if ((flags & 128) != 0) { + custom_parameters.serializeToStream(stream); + } + } + } + + public static class TL_phoneCall_layer176 extends TL_phoneCall { + public static final int constructor = 0x967f7c67; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + p2p_allowed = (flags & 32) != 0; + video = (flags & 64) != 0; + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + date = stream.readInt32(exception); + admin_id = stream.readInt64(exception); + participant_id = stream.readInt64(exception); + g_a_or_b = stream.readByteArray(exception); + key_fingerprint = stream.readInt64(exception); + protocol = PhoneCallProtocol.TLdeserialize(stream, stream.readInt32(exception), exception); + connections = Vector.deserialize(stream, TLRPC.PhoneConnection::TLdeserialize, exception); + start_date = stream.readInt32(exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = p2p_allowed ? (flags | 32) : (flags &~ 32); + flags = video ? (flags | 64) : (flags &~ 64); + stream.writeInt32(flags); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32(date); + stream.writeInt64(admin_id); + stream.writeInt64(participant_id); + stream.writeByteArray(g_a_or_b); + stream.writeInt64(key_fingerprint); + protocol.serializeToStream(stream); + Vector.serialize(stream, connections); + stream.writeInt32(start_date); + } + } + + public static class TL_phoneCallEmpty extends PhoneCall { + public static final int constructor = 0x5366c915; + + public void readParams(InputSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + } + } + + public static class TL_phoneCallAccepted extends PhoneCall { + public static final int constructor = 0x22fd7181; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + video = (flags & 64) != 0; + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + date = stream.readInt32(exception); + admin_id = stream.readInt64(exception); + participant_id = stream.readInt64(exception); + g_b = stream.readByteArray(exception); + protocol = PhoneCallProtocol.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 256) != 0) { + conference_call = TLRPC.TL_inputGroupCall.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = video ? (flags | 64) : (flags &~ 64); + stream.writeInt32(flags); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32(date); + stream.writeInt64(admin_id); + stream.writeInt64(participant_id); + stream.writeByteArray(g_b); + protocol.serializeToStream(stream); + if ((flags & 256) != 0) { + conference_call.serializeToStream(stream); + } + } + } + + public static class TL_phoneCallAccepted_layer195 extends TL_phoneCallAccepted { + public static final int constructor = 0x3660c311; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + video = (flags & 64) != 0; + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + date = stream.readInt32(exception); + admin_id = stream.readInt64(exception); + participant_id = stream.readInt64(exception); + g_b = stream.readByteArray(exception); + protocol = PhoneCallProtocol.TLdeserialize(stream, stream.readInt32(exception), exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = video ? (flags | 64) : (flags &~ 64); + stream.writeInt32(flags); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32(date); + stream.writeInt64(admin_id); + stream.writeInt64(participant_id); + stream.writeByteArray(g_b); + protocol.serializeToStream(stream); + } + } + + public static class TL_phoneCallWaiting extends PhoneCall { + public static final int constructor = 0xeed42858; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + video = (flags & 64) != 0; + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + date = stream.readInt32(exception); + admin_id = stream.readInt64(exception); + participant_id = stream.readInt64(exception); + protocol = PhoneCallProtocol.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 1) != 0) { + receive_date = stream.readInt32(exception); + } + if ((flags & 256) != 0) { + conference_call = TLRPC.TL_inputGroupCall.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = video ? (flags | 64) : (flags &~ 64); + stream.writeInt32(flags); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32(date); + stream.writeInt64(admin_id); + stream.writeInt64(participant_id); + protocol.serializeToStream(stream); + if ((flags & 1) != 0) { + stream.writeInt32(receive_date); + } + if ((flags & 256) != 0) { + conference_call.serializeToStream(stream); + } + } + } + + public static class TL_phoneCallWaiting_layer195 extends TL_phoneCallWaiting { + public static final int constructor = 0xc5226f17; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + video = (flags & 64) != 0; + id = stream.readInt64(exception); + access_hash = stream.readInt64(exception); + date = stream.readInt32(exception); + admin_id = stream.readInt64(exception); + participant_id = stream.readInt64(exception); + protocol = PhoneCallProtocol.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 1) != 0) { + receive_date = stream.readInt32(exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = video ? (flags | 64) : (flags &~ 64); + stream.writeInt32(flags); + stream.writeInt64(id); + stream.writeInt64(access_hash); + stream.writeInt32(date); + stream.writeInt64(admin_id); + stream.writeInt64(participant_id); + protocol.serializeToStream(stream); + if ((flags & 1) != 0) { + stream.writeInt32(receive_date); + } + } + } + + public static class TL_phoneCallDiscarded extends PhoneCall { + public static final int constructor = 0xf9d25503; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + need_rating = (flags & 4) != 0; + need_debug = (flags & 8) != 0; + video = (flags & 64) != 0; + id = stream.readInt64(exception); + if ((flags & 1) != 0) { + reason = TLRPC.PhoneCallDiscardReason.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 2) != 0) { + duration = stream.readInt32(exception); + } + if ((flags & 256) != 0) { + conference_call = TLRPC.TL_inputGroupCall.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = need_rating ? (flags | 4) : (flags &~ 4); + flags = need_debug ? (flags | 8) : (flags &~ 8); + flags = video ? (flags | 64) : (flags &~ 64); + stream.writeInt32(flags); + stream.writeInt64(id); + if ((flags & 1) != 0) { + reason.serializeToStream(stream); + } + if ((flags & 2) != 0) { + stream.writeInt32(duration); + } + if ((flags & 256) != 0) { + conference_call.serializeToStream(stream); + } + } + } + + public static class TL_phoneCallDiscarded_layer195 extends TL_phoneCallDiscarded { + public static final int constructor = 0x50ca4de1; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + need_rating = (flags & 4) != 0; + need_debug = (flags & 8) != 0; + video = (flags & 64) != 0; + id = stream.readInt64(exception); + if ((flags & 1) != 0) { + reason = TLRPC.PhoneCallDiscardReason.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 2) != 0) { + duration = stream.readInt32(exception); + } + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = need_rating ? (flags | 4) : (flags &~ 4); + flags = need_debug ? (flags | 8) : (flags &~ 8); + flags = video ? (flags | 64) : (flags &~ 64); + stream.writeInt32(flags); + stream.writeInt64(id); + if ((flags & 1) != 0) { + reason.serializeToStream(stream); + } + if ((flags & 2) != 0) { + stream.writeInt32(duration); + } + } + } + + public static class groupCallStreamRtmpUrl extends TLObject { + public static final int constructor = 0x2dbf3432; + + public String url; + public String key; + + public static groupCallStreamRtmpUrl TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (groupCallStreamRtmpUrl.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_phone_groupCallStreamRtmpUrl", constructor)); + } else { + return null; + } + } + groupCallStreamRtmpUrl result = new groupCallStreamRtmpUrl(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + url = stream.readString(exception); + key = stream.readString(exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(url); + stream.writeString(key); + } + } + + public static class TL_phone_phoneCall extends TLObject { + public static final int constructor = 0xec82e140; + + public PhoneCall phone_call; + public ArrayList users = new ArrayList<>(); + + public static TL_phone_phoneCall TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_phone_phoneCall.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_phone_phoneCall", constructor)); + } else { + return null; + } + } + TL_phone_phoneCall result = new TL_phone_phoneCall(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + phone_call = PhoneCall.TLdeserialize(stream, stream.readInt32(exception), exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + phone_call.serializeToStream(stream); + Vector.serialize(stream, users); + } + } + + public static class groupParticipants extends TLObject { + public static final int constructor = 0xf47751b6; + + public int count; + public ArrayList participants = new ArrayList<>(); + public String next_offset; + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + public int version; + + public static groupParticipants TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (groupParticipants.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_phone_groupParticipants", constructor)); + } else { + return null; + } + } + groupParticipants result = new groupParticipants(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + count = stream.readInt32(exception); + participants = Vector.deserialize(stream, TLRPC.TL_groupCallParticipant::TLdeserialize, exception); + next_offset = stream.readString(exception); + chats = Vector.deserialize(stream, TLRPC.Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); + version = stream.readInt32(exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(count); + Vector.serialize(stream, participants); + stream.writeString(next_offset); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); + stream.writeInt32(version); + } + } + + public static class exportedGroupCallInvite extends TLObject { + public static final int constructor = 0x204bd158; + + public String link; + + public static exportedGroupCallInvite TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (exportedGroupCallInvite.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_phone_exportedGroupCallInvite", constructor)); + } else { + return null; + } + } + exportedGroupCallInvite result = new exportedGroupCallInvite(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + link = stream.readString(exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(link); + } + } + + public static class getCallConfig extends TLObject { + public static final int constructor = 0x55451fa9; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.TL_dataJSON.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + } + } + + public static class requestCall extends TLObject { + public static final int constructor = 0xa6c4600c; + + public int flags; + public boolean video; + public TLRPC.InputUser user_id; + public TLRPC.TL_inputGroupCall conference_call; + public int random_id; + public byte[] g_a_hash; + public TL_phoneCallProtocol protocol; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_phone_phoneCall.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = video ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + user_id.serializeToStream(stream); + if ((flags & 2) != 0) { + conference_call.serializeToStream(stream); + } + stream.writeInt32(random_id); + stream.writeByteArray(g_a_hash); + protocol.serializeToStream(stream); + } + } + + public static class acceptCall extends TLObject { + public static final int constructor = 0x3bd2b4a0; + + public TLRPC.TL_inputPhoneCall peer; + public byte[] g_b; + public TL_phoneCallProtocol protocol; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_phone_phoneCall.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeByteArray(g_b); + protocol.serializeToStream(stream); + } + } + + public static class confirmCall extends TLObject { + public static final int constructor = 0x2efe1722; + + public TLRPC.TL_inputPhoneCall peer; + public byte[] g_a; + public long key_fingerprint; + public TL_phoneCallProtocol protocol; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_phone_phoneCall.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeByteArray(g_a); + stream.writeInt64(key_fingerprint); + protocol.serializeToStream(stream); + } + } + + public static class receivedCall extends TLObject { + public static final int constructor = 0x17d54f61; + + public TLRPC.TL_inputPhoneCall peer; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + } + } + + public static class discardCall extends TLObject { + public static final int constructor = 0xb2cbc1c0; + + public int flags; + public boolean video; + public TLRPC.TL_inputPhoneCall peer; + public int duration; + public TLRPC.PhoneCallDiscardReason reason; + public long connection_id; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Updates.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = video ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + peer.serializeToStream(stream); + stream.writeInt32(duration); + reason.serializeToStream(stream); + stream.writeInt64(connection_id); + } + } + + public static class setCallRating extends TLObject { + public static final int constructor = 0x59ead627; + + public int flags; + public boolean user_initiative; + public TLRPC.TL_inputPhoneCall peer; + public int rating; + public String comment; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Updates.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = user_initiative ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + peer.serializeToStream(stream); + stream.writeInt32(rating); + stream.writeString(comment); + } + } + + public static class saveCallDebug extends TLObject { + public static final int constructor = 0x277add7e; + + public TLRPC.TL_inputPhoneCall peer; + public TLRPC.TL_dataJSON debug; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + debug.serializeToStream(stream); + } + } + + public static class sendSignalingData extends TLObject { + public static final int constructor = 0xff7a9383; + + public TLRPC.TL_inputPhoneCall peer; + public byte[] data; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeByteArray(data); + } + } + + public static class createGroupCall extends TLObject { + public static final int constructor = 0x48cdc6d8; + + public int flags; + public TLRPC.InputPeer peer; + public int random_id; + public String title; + public int schedule_date; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Updates.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + peer.serializeToStream(stream); + stream.writeInt32(random_id); + if ((flags & 1) != 0) { + stream.writeString(title); + } + if ((flags & 2) != 0) { + stream.writeInt32(schedule_date); + } + } + } + + public static class joinGroupCall extends TLObject { + public static final int constructor = 0xb132ff7b; + + public int flags; + public boolean muted; + public boolean video_stopped; + public TLRPC.TL_inputGroupCall call; + public TLRPC.InputPeer join_as; + public String invite_hash; + public TLRPC.TL_dataJSON params; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Updates.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = muted ? (flags | 1) : (flags &~ 1); + flags = video_stopped ? (flags | 4) : (flags &~ 4); + stream.writeInt32(flags); + call.serializeToStream(stream); + join_as.serializeToStream(stream); + if ((flags & 2) != 0) { + stream.writeString(invite_hash); + } + params.serializeToStream(stream); + } + } + + public static class leaveGroupCall extends TLObject { + public static final int constructor = 0x500377f9; + + public TLRPC.TL_inputGroupCall call; + public int source; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Updates.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + call.serializeToStream(stream); + stream.writeInt32(source); + } + } + + public static class inviteToGroupCall extends TLObject { + public static final int constructor = 0x7b393160; + + public TLRPC.TL_inputGroupCall call; + public ArrayList users = new ArrayList<>(); + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Updates.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + call.serializeToStream(stream); + Vector.serialize(stream, users); + } + } + + public static class discardGroupCall extends TLObject { + public static final int constructor = 0x7a777135; + + public TLRPC.TL_inputGroupCall call; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Updates.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + call.serializeToStream(stream); + } + } + + public static class toggleGroupCallSettings extends TLObject { + public static final int constructor = 0x74bbb43d; + + public int flags; + public boolean reset_invite_hash; + public TLRPC.TL_inputGroupCall call; + public boolean join_muted; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Updates.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = reset_invite_hash ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + call.serializeToStream(stream); + if ((flags & 1) != 0) { + stream.writeBool(join_muted); + } + } + } + + public static class getGroupCall extends TLObject { + public static final int constructor = 0x41845db; + + public TLRPC.TL_inputGroupCall call; + public int limit; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return groupCall.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + call.serializeToStream(stream); + stream.writeInt32(limit); + } + } + + public static class getGroupParticipants extends TLObject { + public static final int constructor = 0xc558d8ab; + + public TLRPC.TL_inputGroupCall call; + public ArrayList ids = new ArrayList<>(); + public ArrayList sources = new ArrayList<>(); + public String offset; + public int limit; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return groupParticipants.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + call.serializeToStream(stream); + Vector.serialize(stream, ids); + Vector.serializeInt(stream, sources); + stream.writeString(offset); + stream.writeInt32(limit); + } + } + + public static class checkGroupCall extends TLObject { + public static final int constructor = 0xb59cf977; + + public TLRPC.TL_inputGroupCall call; + public ArrayList sources = new ArrayList<>(); + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserializeInt(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + call.serializeToStream(stream); + Vector.serializeInt(stream, sources); + } + } + + public static class toggleGroupCallRecord extends TLObject { + public static final int constructor = 0xf128c708; + + public int flags; + public boolean start; + public boolean video; + public TLRPC.TL_inputGroupCall call; + public String title; + public boolean video_portrait; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Updates.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = start ? (flags | 1) : (flags &~ 1); + flags = video ? (flags | 4) : (flags &~ 4); + stream.writeInt32(flags); + call.serializeToStream(stream); + if ((flags & 2) != 0) { + stream.writeString(title); + } + if ((flags & 4) != 0) { + stream.writeBool(video_portrait); + } + } + } + + public static class editGroupCallParticipant extends TLObject { + public static final int constructor = 0xa5273abf; + + public int flags; + public TLRPC.TL_inputGroupCall call; + public TLRPC.InputPeer participant; + public boolean muted; + public int volume; + public boolean raise_hand; + public boolean video_stopped; + public boolean video_paused; + public boolean presentation_paused; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Updates.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + call.serializeToStream(stream); + participant.serializeToStream(stream); + if ((flags & 1) != 0) { + stream.writeBool(muted); + } + if ((flags & 2) != 0) { + stream.writeInt32(volume); + } + if ((flags & 4) != 0) { + stream.writeBool(raise_hand); + } + if ((flags & 8) != 0) { + stream.writeBool(video_stopped); + } + if ((flags & 16) != 0) { + stream.writeBool(video_paused); + } + if ((flags & 32) != 0) { + stream.writeBool(presentation_paused); + } + } + } + + public static class editGroupCallTitle extends TLObject { + public static final int constructor = 0x1ca6ac0a; + + public TLRPC.TL_inputGroupCall call; + public String title; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Updates.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + call.serializeToStream(stream); + stream.writeString(title); + } + } + + public static class getGroupCallJoinAs extends TLObject { + public static final int constructor = 0xef7c213a; + + public TLRPC.InputPeer peer; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return joinAsPeers.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + } + } + + public static class exportGroupCallInvite extends TLObject { + public static final int constructor = 0xe6aa647f; + + public int flags; + public boolean can_self_unmute; + public TLRPC.TL_inputGroupCall call; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return exportedGroupCallInvite.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = can_self_unmute ? (flags | 1) : (flags &~ 1); + stream.writeInt32(flags); + call.serializeToStream(stream); + } + } + + public static class toggleGroupCallStartSubscription extends TLObject { + public static final int constructor = 0x219c34e6; + + public TLRPC.TL_inputGroupCall call; + public boolean subscribed; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Updates.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + call.serializeToStream(stream); + stream.writeBool(subscribed); + } + } + + public static class startScheduledGroupCall extends TLObject { + public static final int constructor = 0x5680e342; + + public TLRPC.TL_inputGroupCall call; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Updates.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + call.serializeToStream(stream); + } + } + + public static class saveDefaultGroupCallJoinAs extends TLObject { + public static final int constructor = 0x575e1f8c; + + public TLRPC.InputPeer peer; + public TLRPC.InputPeer join_as; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + join_as.serializeToStream(stream); + } + } + + public static class joinGroupCallPresentation extends TLObject { + public static final int constructor = 0xcbea6bc4; + + public TLRPC.TL_inputGroupCall call; + public TLRPC.TL_dataJSON params; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Updates.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + call.serializeToStream(stream); + params.serializeToStream(stream); + } + } + + public static class TL_groupCallStreamChannel extends TLObject { + public static final int constructor = 0x80eb48af; + + public int channel; + public int scale; + public long last_timestamp_ms; + + public static TL_groupCallStreamChannel TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_groupCallStreamChannel.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_groupCallStreamChannel", constructor)); + } else { + return null; + } + } + TL_groupCallStreamChannel result = new TL_groupCallStreamChannel(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + channel = stream.readInt32(exception); + scale = stream.readInt32(exception); + last_timestamp_ms = stream.readInt64(exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(channel); + stream.writeInt32(scale); + stream.writeInt64(last_timestamp_ms); + } + } + + public static class groupCallStreamChannels extends TLObject { + public static final int constructor = 0xd0e482b2; + + public ArrayList channels = new ArrayList<>(); + + public static groupCallStreamChannels TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (groupCallStreamChannels.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_phone_groupCallStreamChannels", constructor)); + } else { + return null; + } + } + groupCallStreamChannels result = new groupCallStreamChannels(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + channels = Vector.deserialize(stream, TL_groupCallStreamChannel::TLdeserialize, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + Vector.serialize(stream, channels); + } + } + + public static class leaveGroupCallPresentation extends TLObject { + public static final int constructor = 0x1c50d144; + + public TLRPC.TL_inputGroupCall call; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Updates.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + call.serializeToStream(stream); + } + } + + public static class getGroupCallStreamChannels extends TLObject { + public static final int constructor = 0x1ab21940; + + public TLRPC.TL_inputGroupCall call; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return groupCallStreamChannels.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + call.serializeToStream(stream); + } + } + + public static class getGroupCallStreamRtmpUrl extends TLObject { + public static final int constructor = 0xdeb3abbf; + + public TLRPC.InputPeer peer; + public boolean revoke; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return groupCallStreamRtmpUrl.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeBool(revoke); + } + } + + public static abstract class PhoneCallProtocol extends TLObject { + public int flags; + public boolean udp_p2p; + public boolean udp_reflector; + public int min_layer; + public int max_layer; + public ArrayList library_versions = new ArrayList<>(); + + public static PhoneCallProtocol TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + PhoneCallProtocol result = null; + switch (constructor) { + case 0xfc878fc8: + result = new TL_phoneCallProtocol(); + break; + case 0xa2bb35cb: + result = new TL_phoneCallProtocol_layer110(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in PhoneCallProtocol", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } + + public static class TL_phoneCallProtocol extends PhoneCallProtocol { + public static final int constructor = 0xfc878fc8; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + udp_p2p = (flags & 1) != 0; + udp_reflector = (flags & 2) != 0; + min_layer = stream.readInt32(exception); + max_layer = stream.readInt32(exception); + library_versions = Vector.deserializeString(stream, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = udp_p2p ? (flags | 1) : (flags &~ 1); + flags = udp_reflector ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + stream.writeInt32(min_layer); + stream.writeInt32(max_layer); + Vector.serializeString(stream, library_versions); + } + } + + public static class TL_phoneCallProtocol_layer110 extends TL_phoneCallProtocol { + public static final int constructor = 0xa2bb35cb; + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + udp_p2p = (flags & 1) != 0; + udp_reflector = (flags & 2) != 0; + min_layer = stream.readInt32(exception); + max_layer = stream.readInt32(exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = udp_p2p ? (flags | 1) : (flags &~ 1); + flags = udp_reflector ? (flags | 2) : (flags &~ 2); + stream.writeInt32(flags); + stream.writeInt32(min_layer); + stream.writeInt32(max_layer); + } + } + + public static class saveCallLog extends TLObject { + public static final int constructor = 0x41248786; + + public TLRPC.TL_inputPhoneCall peer; + public TLRPC.InputFile file; + + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + file.serializeToStream(stream); + } + } + + public static class createConferenceCall extends TLObject { + public static final int constructor = 0xdfc909ab; + + public TLRPC.TL_inputGroupCall peer; + public long key_fingerprint; + + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return PhoneCall.TLdeserialize(stream, constructor, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeInt64(key_fingerprint); + } + } + +} diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_stars.java b/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_stars.java index 4c08dd4f98..136dfdedd8 100644 --- a/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_stars.java +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_stars.java @@ -1,8 +1,12 @@ package org.telegram.tgnet.tl; -import org.telegram.tgnet.AbstractSerializedData; +import androidx.annotation.Nullable; + +import org.telegram.tgnet.InputSerializedData; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import java.util.ArrayList; @@ -14,6 +18,7 @@ public static class StarGift extends TLObject { public boolean limited; public boolean sold_out; public boolean birthday; + public boolean can_upgrade; public long id; public TLRPC.Document sticker; public long stars; @@ -22,16 +27,38 @@ public static class StarGift extends TLObject { public long convert_stars; public int first_sale_date; public int last_sale_date; + public long upgrade_stars; - public static StarGift TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public String title; + public String slug; + public int num; + public TLRPC.Peer owner_id; + public String owner_name; + public String owner_address; + public ArrayList attributes = new ArrayList<>(); + public int availability_issued; + + public static StarGift TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { StarGift result = null; switch (constructor) { case TL_starGift.constructor: result = new TL_starGift(); break; + case TL_starGiftUnique.constructor: + result = new TL_starGiftUnique(); + break; + case TL_starGiftUnique_layer197.constructor: + result = new TL_starGiftUnique_layer197(); + break; + case TL_starGiftUnique_layer196.constructor: + result = new TL_starGiftUnique_layer196(); + break; case TL_starGift_layer190.constructor: result = new TL_starGift_layer190(); break; + case TL_starGift_layer195.constructor: + result = new TL_starGift_layer195(); + break; } if (result == null && exception) { throw new RuntimeException(String.format("can't parse magic %x in StarGift", constructor)); @@ -42,13 +69,195 @@ public static StarGift TLdeserialize(AbstractSerializedData stream, int construc return result; } + @Nullable + public TLRPC.Document getDocument() { + if (sticker != null) { + return sticker; + } + for (TL_stars.StarGiftAttribute attr : attributes) { + if (attr instanceof TL_stars.starGiftAttributeModel) { + return ((starGiftAttributeModel) attr).document; + } + } + return null; + } + } + + public static class TL_starGiftUnique extends StarGift { + public static final int constructor = 0xf2fe7e4a; + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + id = stream.readInt64(exception); + title = stream.readString(exception); + slug = stream.readString(exception); + num = stream.readInt32(exception); + if ((flags & 1) != 0) { + owner_id = TLRPC.Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 2) != 0) { + owner_name = stream.readString(exception); + } + if ((flags & 4) != 0) { + owner_address = stream.readString(exception); + } + attributes = Vector.deserialize(stream, StarGiftAttribute::TLdeserialize, exception); + availability_issued = stream.readInt32(exception); + availability_total = stream.readInt32(exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeInt64(id); + stream.writeString(title); + stream.writeString(slug); + stream.writeInt32(num); + if ((flags & 1) != 0) { + owner_id.serializeToStream(stream); + } + if ((flags & 2) != 0) { + stream.writeString(owner_name); + } + if ((flags & 4) != 0) { + stream.writeString(owner_address); + } + Vector.serialize(stream, attributes); + stream.writeInt32(availability_issued); + stream.writeInt32(availability_total); + } + } + + public static class TL_starGiftUnique_layer197 extends TL_starGiftUnique { + public static final int constructor = 0x3482f322; + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + id = stream.readInt64(exception); + title = stream.readString(exception); + slug = stream.readString(exception); + num = stream.readInt32(exception); + if ((flags & 1) != 0) { + owner_id = new TLRPC.TL_peerUser(); + owner_id.user_id = stream.readInt64(exception); + } + if ((flags & 2) != 0) { + owner_name = stream.readString(exception); + } + attributes = Vector.deserialize(stream, StarGiftAttribute::TLdeserialize, exception); + availability_issued = stream.readInt32(exception); + availability_total = stream.readInt32(exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeInt64(id); + stream.writeString(title); + stream.writeString(slug); + stream.writeInt32(num); + if ((flags & 1) != 0) { + stream.writeInt64(owner_id.user_id); + } + if ((flags & 2) != 0) { + stream.writeString(owner_name); + } + Vector.serialize(stream, attributes); + stream.writeInt32(availability_issued); + stream.writeInt32(availability_total); + } + } + + public static class TL_starGiftUnique_layer196 extends TL_starGiftUnique { + public static final int constructor = 0x6a1407cd; + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + id = stream.readInt64(exception); + title = stream.readString(exception); + num = stream.readInt32(exception); + owner_id = new TLRPC.TL_peerUser(); + owner_id.user_id = stream.readInt64(exception); + attributes = Vector.deserialize(stream, StarGiftAttribute::TLdeserialize, exception); + availability_issued = stream.readInt32(exception); + availability_total = stream.readInt32(exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(id); + stream.writeString(title); + stream.writeInt32(num); + stream.writeInt64(owner_id.user_id); + Vector.serialize(stream, attributes); + stream.writeInt32(availability_issued); + stream.writeInt32(availability_total); + } } public static class TL_starGift extends StarGift { + public static final int constructor = 0x2cc73c8; + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = limited ? flags | 1 : flags &~ 1; + flags = sold_out ? flags | 2 : flags &~ 2; + flags = birthday ? flags | 4 : flags &~ 4; + flags = can_upgrade ? flags | 8 : flags &~ 8; + stream.writeInt32(flags); + stream.writeInt64(id); + sticker.serializeToStream(stream); + stream.writeInt64(stars); + if ((flags & 1) != 0) { + stream.writeInt32(availability_remains); + stream.writeInt32(availability_total); + } + stream.writeInt64(convert_stars); + if ((flags & 2) != 0) { + stream.writeInt32(first_sale_date); + stream.writeInt32(last_sale_date); + } + if ((flags & 8) != 0) { + stream.writeInt64(upgrade_stars); + } + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + limited = (flags & 1) != 0; + sold_out = (flags & 2) != 0; + birthday = (flags & 4) != 0; + can_upgrade = (flags & 8) != 0; + id = stream.readInt64(exception); + sticker = TLRPC.Document.TLdeserialize(stream, stream.readInt32(exception), exception); + stars = stream.readInt64(exception); + if ((flags & 1) != 0) { + availability_remains = stream.readInt32(exception); + availability_total = stream.readInt32(exception); + } + convert_stars = stream.readInt64(exception); + if ((flags & 2) != 0) { + first_sale_date = stream.readInt32(exception); + last_sale_date = stream.readInt32(exception); + } + if ((flags & 8) != 0) { + upgrade_stars = stream.readInt64(exception); + } + } + } + + public static class TL_starGift_layer195 extends TL_starGift { public static final int constructor = 0x49c577cd; @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = limited ? flags | 1 : flags &~ 1; flags = sold_out ? flags | 2 : flags &~ 2; @@ -69,7 +278,7 @@ public void serializeToStream(AbstractSerializedData stream) { } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); limited = (flags & 1) != 0; sold_out = (flags & 2) != 0; @@ -93,7 +302,7 @@ public static class TL_starGift_layer190 extends TL_starGift { public static final int constructor = 0xaea174ee; @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = limited ? flags | 1 : flags &~ 1; stream.writeInt32(flags); @@ -108,7 +317,7 @@ public void serializeToStream(AbstractSerializedData stream) { } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); limited = (flags & 1) != 0; id = stream.readInt64(exception); @@ -124,7 +333,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } public static class StarGifts extends TLObject { - public static StarGifts TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static StarGifts TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { StarGifts result = null; switch (constructor) { case TL_starGifts.constructor: @@ -150,47 +359,28 @@ public static class TL_starGifts extends StarGifts { public ArrayList gifts = new ArrayList<>(); @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(hash); - stream.writeInt32(0x1cb5c415); - int count = gifts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - gifts.get(a).serializeToStream(stream); - } + Vector.serialize(stream, gifts); } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { hash = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - StarGift gift = StarGift.TLdeserialize(stream, stream.readInt32(exception), exception); - if (gift == null) { - return; - } - gifts.add(gift); - } + gifts = Vector.deserialize(stream, StarGift::TLdeserialize, exception); } } public static class TL_starGiftsNotModified extends StarGifts { public static final int constructor = 0xa388a368; @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } @Override - public void readParams(AbstractSerializedData stream, boolean exception) {} + public void readParams(InputSerializedData stream, boolean exception) {} } public static class getStarGifts extends TLObject { @@ -199,277 +389,230 @@ public static class getStarGifts extends TLObject { public int hash; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return StarGifts.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(hash); } } - public static class getUserStarGifts extends TLObject { - public static final int constructor = 0x5e72c7e1; + public static class getSavedStarGifts extends TLObject { + public static final int constructor = 0x23830de9; - public TLRPC.InputUser user_id; + public int flags; + public boolean exclude_unsaved; + public boolean exclude_saved; + public boolean exclude_unlimited; + public boolean exclude_limited; + public boolean exclude_unique; + public boolean sort_by_value; + public TLRPC.InputPeer peer; public String offset; public int limit; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TL_userStarGifts.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_payments_savedStarGifts.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - user_id.serializeToStream(stream); + flags = exclude_unsaved ? flags | 1 : flags &~ 1; + flags = exclude_saved ? flags | 2 : flags &~ 2; + flags = exclude_unlimited ? flags | 4 : flags &~ 4; + flags = exclude_limited ? flags | 8 : flags &~ 8; + flags = exclude_unique ? flags | 16 : flags &~ 16; + flags = sort_by_value ? flags | 32 : flags &~ 32; + stream.writeInt32(flags); + peer.serializeToStream(stream); stream.writeString(offset); stream.writeInt32(limit); } } - public static class TL_userStarGifts extends TLObject { - public static final int constructor = 0x6b65b517; - - public int flags; - public int count; - public ArrayList gifts = new ArrayList<>(); - public String next_offset; - public ArrayList users = new ArrayList<>(); + public static class getSavedStarGift extends TLObject { + public static final int constructor = 0xb455a106; - public static TL_userStarGifts TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - TL_userStarGifts result = null; - switch (constructor) { - case TL_userStarGifts.constructor: - result = new TL_userStarGifts(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_userStarGifts", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; - } + public ArrayList stargift = new ArrayList<>(); @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - UserStarGift gift = UserStarGift.TLdeserialize(stream, stream.readInt32(exception), exception); - if (gift == null) { - return; - } - gifts.add(gift); - } - if ((flags & 1) != 0) { - next_offset = stream.readString(exception); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.User user = TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (user == null) { - return; - } - users.add(user); - } + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_payments_savedStarGifts.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(flags); - stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - stream.writeInt32(gifts.size()); - for (int a = 0; a < gifts.size(); a++) { - gifts.get(a).serializeToStream(stream); - } - if ((flags & 1) != 0) { - stream.writeString(next_offset); - } - stream.writeInt32(0x1cb5c415); - stream.writeInt32(users.size()); - for (int a = 0; a < users.size(); a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, stargift); } } - public static class UserStarGift extends TLObject { + public static class saveStarGift extends TLObject { + public static final int constructor = 0x2a2a697c; public int flags; - public boolean name_hidden; - public boolean unsaved; - public long from_id; - public int date; - public TL_stars.StarGift gift; - public TLRPC.TL_textWithEntities message; - public int msg_id; - public long convert_stars; + public boolean unsave; + public InputSavedStarGift stargift; - public static UserStarGift TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - UserStarGift result = null; - switch (constructor) { - case TL_userStarGift.constructor: - result = new TL_userStarGift(); - break; - } - if (result == null && exception) { - throw new RuntimeException(String.format("can't parse magic %x in UserStarGift", constructor)); - } - if (result != null) { - result.readParams(stream, exception); - } - return result; + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } - } - public static class TL_userStarGift extends UserStarGift { - public static final int constructor = 0xeea49a6e; @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = name_hidden ? flags | 1 : flags &~ 1; - flags = unsaved ? flags | 32 : flags &~ 32; + flags = unsave ? flags | 1 : flags &~ 1; stream.writeInt32(flags); - if ((flags & 2) != 0) { - stream.writeInt64(from_id); - } - stream.writeInt32(date); - gift.serializeToStream(stream); - if ((flags & 4) != 0) { - message.serializeToStream(stream); - } - if ((flags & 8) != 0) { - stream.writeInt32(msg_id); - } - if ((flags & 16) != 0) { - stream.writeInt64(convert_stars); - } + stargift.serializeToStream(stream); } + } + + public static class convertStarGift extends TLObject { + public static final int constructor = 0x74bf076b; + + public InputSavedStarGift stargift; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - name_hidden = (flags & 1) != 0; - unsaved = (flags & 32) != 0; - if ((flags & 2) != 0) { - from_id = stream.readInt64(exception); - } - date = stream.readInt32(exception); - gift = TL_stars.StarGift.TLdeserialize(stream, stream.readInt32(exception), exception); - if ((flags & 4) != 0) { - message = TLRPC.TL_textWithEntities.TLdeserialize(stream, stream.readInt32(exception), exception); - } - if ((flags & 8) != 0) { - msg_id = stream.readInt32(exception); - } - if ((flags & 16) != 0) { - convert_stars = stream.readInt64(exception); - } + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stargift.serializeToStream(stream); } } - public static class saveStarGift extends TLObject { - public static final int constructor = 0x87acf08e; + public static class upgradeStarGift extends TLObject { + public static final int constructor = 0xaed6e4f5; public int flags; - public boolean unsave; - public TLRPC.InputUser user_id; - public int msg_id; + public boolean keep_original_details; + public InputSavedStarGift stargift; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Updates.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - flags = unsave ? flags | 1 : flags &~ 1; + flags = keep_original_details ? flags | 1 : flags &~ 1; stream.writeInt32(flags); - user_id.serializeToStream(stream); - stream.writeInt32(msg_id); + stargift.serializeToStream(stream); } } - public static class convertStarGift extends TLObject { - public static final int constructor = 0x421e027; + public static class transferStarGift extends TLObject { + public static final int constructor = 0x7f18176a; - public TLRPC.InputUser user_id; - public int msg_id; + public InputSavedStarGift stargift; + public TLRPC.InputPeer to_id; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Updates.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - user_id.serializeToStream(stream); - stream.writeInt32(msg_id); + stargift.serializeToStream(stream); + to_id.serializeToStream(stream); } } - public static class TL_starsTopupOption extends TLObject { - public static final int constructor = 0xbd915c0; + public static class starGiftUpgradePreview extends TLObject { + public static final int constructor = 0x167bd90b; - public int flags; - public boolean extended; - public long stars; - public String store_product; - public String currency; - public long amount; - public boolean loadingStorePrice; //custom - public boolean missingStorePrice; //custom + public ArrayList sample_attributes = new ArrayList<>(); - public static TL_starsTopupOption TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_starsTopupOption.constructor != constructor) { + public static starGiftUpgradePreview TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (starGiftUpgradePreview.constructor != constructor) { if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_starsTopupOption", constructor)); - } else { - return null; + throw new RuntimeException(String.format("can't parse magic %x in starGiftUpgradePreview", constructor)); } + return null; } - TL_starsTopupOption result = new TL_starsTopupOption(); + starGiftUpgradePreview result = new starGiftUpgradePreview(); result.readParams(stream, exception); return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { - flags = stream.readInt32(exception); - extended = (flags & 2) != 0; - stars = stream.readInt64(exception); - if ((flags & 1) != 0) { - store_product = stream.readString(exception); - } - currency = stream.readString(exception); + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + Vector.serialize(stream, sample_attributes); + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + sample_attributes = Vector.deserialize(stream, StarGiftAttribute::TLdeserialize, exception); + } + } + + public static class getStarGiftUpgradePreview extends TLObject { + public static final int constructor = 0x9c9abcb1; + + public long gift_id; + + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return starGiftUpgradePreview.TLdeserialize(stream, constructor, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt64(gift_id); + } + } + + public static class TL_starsTopupOption extends TLObject { + public static final int constructor = 0xbd915c0; + + public int flags; + public boolean extended; + public long stars; + public String store_product; + public String currency; + public long amount; + public boolean loadingStorePrice; //custom + public boolean missingStorePrice; //custom + + public static TL_starsTopupOption TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_starsTopupOption.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_starsTopupOption", constructor)); + } else { + return null; + } + } + TL_starsTopupOption result = new TL_starsTopupOption(); + result.readParams(stream, exception); + return result; + } + + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + extended = (flags & 2) != 0; + stars = stream.readInt64(exception); + if ((flags & 1) != 0) { + store_product = stream.readString(exception); + } + currency = stream.readString(exception); amount = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = extended ? flags | 2 : flags &~ 2; stream.writeInt32(flags); @@ -494,7 +637,7 @@ public static class TL_starsGiftOption extends TLObject { public boolean loadingStorePrice; //custom public boolean missingStorePrice; //custom - public static TL_starsGiftOption TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_starsGiftOption TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_starsGiftOption.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_starsGiftOption", constructor)); @@ -507,7 +650,7 @@ public static TL_starsGiftOption TLdeserialize(AbstractSerializedData stream, in return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); extended = (flags & 2) != 0; stars = stream.readInt64(exception); @@ -518,7 +661,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { amount = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = extended ? flags | 2 : flags &~ 2; stream.writeInt32(flags); @@ -539,7 +682,7 @@ public static class TL_starsGiveawayWinnersOption extends TLObject { public int users; public long per_user_stars; - public static TL_starsGiveawayWinnersOption TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_starsGiveawayWinnersOption TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_starsGiveawayWinnersOption.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_starsGiveawayWinnersOption", constructor)); @@ -552,14 +695,14 @@ public static TL_starsGiveawayWinnersOption TLdeserialize(AbstractSerializedData return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); isDefault = (flags & 1) != 0; users = stream.readInt32(exception); per_user_stars = stream.readInt64(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = isDefault ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -584,7 +727,7 @@ public static class TL_starsGiveawayOption extends TLObject { public boolean loadingStorePrice; //custom public boolean missingStorePrice; //custom - public static TL_starsGiveawayOption TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_starsGiveawayOption TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_starsGiveawayOption.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_starsGiveawayOption", constructor)); @@ -597,7 +740,7 @@ public static TL_starsGiveawayOption TLdeserialize(AbstractSerializedData stream return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); extended = (flags & 1) != 0; isDefault = (flags & 2) != 0; @@ -608,24 +751,10 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } currency = stream.readString(exception); amount = stream.readInt64(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_starsGiveawayWinnersOption object = TL_starsGiveawayWinnersOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - winners.add(object); - } + winners = Vector.deserialize(stream, TL_starsGiveawayWinnersOption::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = extended ? (flags | 1) : (flags &~ 1); flags = isDefault ? (flags | 2) : (flags &~ 2); @@ -637,12 +766,7 @@ public void serializeToStream(AbstractSerializedData stream) { } stream.writeString(currency); stream.writeInt64(amount); - stream.writeInt32(0x1cb5c415); - int count = winners.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - winners.get(i).serializeToStream(stream); - } + Vector.serialize(stream, winners); } } @@ -650,7 +774,7 @@ public static class StarsTransactionPeer extends TLObject { public TLRPC.Peer peer; - public static StarsTransactionPeer TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static StarsTransactionPeer TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { StarsTransactionPeer result = null; switch (constructor) { case TL_starsTransactionPeer.constructor: @@ -691,11 +815,11 @@ public static StarsTransactionPeer TLdeserialize(AbstractSerializedData stream, public static class TL_starsTransactionPeer extends StarsTransactionPeer { public static final int constructor = 0xd80da15d; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = TLRPC.Peer.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); } @@ -704,9 +828,9 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_starsTransactionPeerAppStore extends StarsTransactionPeer { public static final int constructor = 0xb457b375; - public void readParams(AbstractSerializedData stream, boolean exception) {} + public void readParams(InputSerializedData stream, boolean exception) {} - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -714,9 +838,9 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_starsTransactionPeerPlayMarket extends StarsTransactionPeer { public static final int constructor = 0x7b560a0b; - public void readParams(AbstractSerializedData stream, boolean exception) {} + public void readParams(InputSerializedData stream, boolean exception) {} - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -724,9 +848,9 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_starsTransactionPeerFragment extends StarsTransactionPeer { public static final int constructor = 0xe92fd902; - public void readParams(AbstractSerializedData stream, boolean exception) {} + public void readParams(InputSerializedData stream, boolean exception) {} - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -734,9 +858,9 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_starsTransactionPeerPremiumBot extends StarsTransactionPeer { public static final int constructor = 0x250dbaf8; - public void readParams(AbstractSerializedData stream, boolean exception) {} + public void readParams(InputSerializedData stream, boolean exception) {} - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -744,9 +868,9 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_starsTransactionPeerUnsupported extends StarsTransactionPeer { public static final int constructor = 0x95f2bfe4; - public void readParams(AbstractSerializedData stream, boolean exception) {} + public void readParams(InputSerializedData stream, boolean exception) {} - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -754,9 +878,9 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_starsTransactionPeerAds extends StarsTransactionPeer { public static final int constructor = 0x60682812; - public void readParams(AbstractSerializedData stream, boolean exception) {} + public void readParams(InputSerializedData stream, boolean exception) {} - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -764,9 +888,9 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_starsTransactionPeerAPI extends StarsTransactionPeer { public static final int constructor = 0xf9677aad; - public void readParams(AbstractSerializedData stream, boolean exception) {} + public void readParams(InputSerializedData stream, boolean exception) {} - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -779,6 +903,7 @@ public static class StarsTransaction extends TLObject { public boolean failed; public boolean gift; public boolean reaction; + public boolean stargift_upgrade; public boolean subscription; public boolean floodskip; public String id; @@ -804,7 +929,7 @@ public static class StarsTransaction extends TLObject { public TLRPC.Peer sent_by; //custom public TLRPC.Peer received_by; //custom - public static StarsTransaction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static StarsTransaction TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { StarsTransaction result = null; switch (constructor) { case TL_starsTransaction_layer181.constructor: @@ -846,7 +971,7 @@ public static StarsTransaction TLdeserialize(AbstractSerializedData stream, int public static class TL_starsTransaction_layer181 extends StarsTransaction { public static final int constructor = 0xcc7079b2; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); refund = (flags & 8) != 0; id = stream.readString(exception); @@ -864,7 +989,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = refund ? flags | 8 : flags &~ 8; stream.writeInt32(flags); @@ -886,7 +1011,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_starsTransaction_layer182 extends TL_starsTransaction { public static final int constructor = 0xaa00c898; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); refund = (flags & 8) != 0; pending = (flags & 16) != 0; @@ -910,7 +1035,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = refund ? flags | 8 : flags &~ 8; flags = pending ? flags | 16 : flags &~ 16; @@ -941,7 +1066,7 @@ public static class StarsAmount extends TLObject { public long amount; public int nanos; - public static StarsAmount TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static StarsAmount TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (StarsAmount.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in StarsAmount", constructor)); @@ -960,13 +1085,13 @@ public StarsAmount(long stars) { this.nanos = 0; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { amount = stream.readInt64(exception); nanos = stream.readInt32(exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(amount); stream.writeInt32(nanos); @@ -981,13 +1106,14 @@ public boolean equals(TL_stars.StarsAmount amount) { public static class TL_starsTransaction extends StarsTransaction { public static final int constructor = 0x64dfc926; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); refund = (flags & 8) != 0; pending = (flags & 16) != 0; failed = (flags & 64) != 0; gift = (flags & 1024) != 0; reaction = (flags & 2048) != 0; + stargift_upgrade = (flags & 262144) != 0; subscription = (flags & 4096) != 0; floodskip = (flags & 32768) != 0; id = stream.readString(exception); @@ -1014,21 +1140,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { msg_id = stream.readInt32(exception); } if ((flags & 512) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.MessageMedia object = TLRPC.MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - extended_media.add(object); - } + extended_media = Vector.deserialize(stream, TLRPC.MessageMedia::TLdeserialize, exception); } if ((flags & 4096) != 0) { subscription_period = stream.readInt32(exception); @@ -1051,7 +1163,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = refund ? flags | 8 : flags &~ 8; flags = pending ? flags | 16 : flags &~ 16; @@ -1060,6 +1172,7 @@ public void serializeToStream(AbstractSerializedData stream) { flags = reaction ? flags | 2048 : flags &~ 2048; flags = subscription ? flags | 4096 : flags &~ 4096; flags = floodskip ? flags | 32768 : flags &~ 32768; + flags = stargift_upgrade ? flags | 262144 : flags &~ 262144; stream.writeInt32(flags); stars.serializeToStream(stream); stream.writeInt32(date); @@ -1084,12 +1197,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(msg_id); } if ((flags & 512) != 0) { - stream.writeInt32(0x1cb5c415); - int count = extended_media.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - extended_media.get(i).serializeToStream(stream); - } + Vector.serialize(stream, extended_media); } if ((flags & 4096) != 0) { stream.writeInt32(subscription_period); @@ -1116,7 +1224,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_starsTransaction_layer194 extends TL_starsTransaction { public static final int constructor = 0x35d4f276; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); refund = (flags & 8) != 0; pending = (flags & 16) != 0; @@ -1149,21 +1257,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { msg_id = stream.readInt32(exception); } if ((flags & 512) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.MessageMedia object = TLRPC.MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - extended_media.add(object); - } + extended_media = Vector.deserialize(stream, TLRPC.MessageMedia::TLdeserialize, exception); } if ((flags & 4096) != 0) { subscription_period = stream.readInt32(exception); @@ -1179,7 +1273,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = refund ? flags | 8 : flags &~ 8; flags = pending ? flags | 16 : flags &~ 16; @@ -1212,12 +1306,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(msg_id); } if ((flags & 512) != 0) { - stream.writeInt32(0x1cb5c415); - int count = extended_media.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - extended_media.get(i).serializeToStream(stream); - } + Vector.serialize(stream, extended_media); } if ((flags & 4096) != 0) { stream.writeInt32(subscription_period); @@ -1237,7 +1326,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_starsTransaction_layer191 extends TL_starsTransaction { public static final int constructor = 0xa9ee4c2; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); refund = (flags & 8) != 0; pending = (flags & 16) != 0; @@ -1269,21 +1358,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { msg_id = stream.readInt32(exception); } if ((flags & 512) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.MessageMedia object = TLRPC.MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - extended_media.add(object); - } + extended_media = Vector.deserialize(stream, TLRPC.MessageMedia::TLdeserialize, exception); } if ((flags & 4096) != 0) { subscription_period = stream.readInt32(exception); @@ -1296,7 +1371,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = refund ? flags | 8 : flags &~ 8; flags = pending ? flags | 16 : flags &~ 16; @@ -1328,12 +1403,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(msg_id); } if ((flags & 512) != 0) { - stream.writeInt32(0x1cb5c415); - int count = extended_media.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - extended_media.get(i).serializeToStream(stream); - } + Vector.serialize(stream, extended_media); } if ((flags & 4096) != 0) { stream.writeInt32(subscription_period); @@ -1350,7 +1420,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_starsTransaction_layer188 extends TL_starsTransaction { public static final int constructor = 0xee7522d5; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); refund = (flags & 8) != 0; pending = (flags & 16) != 0; @@ -1382,21 +1452,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { msg_id = stream.readInt32(exception); } if ((flags & 512) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.MessageMedia object = TLRPC.MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - extended_media.add(object); - } + extended_media = Vector.deserialize(stream, TLRPC.MessageMedia::TLdeserialize, exception); } if ((flags & 4096) != 0) { subscription_period = stream.readInt32(exception); @@ -1406,7 +1462,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = refund ? flags | 8 : flags &~ 8; flags = pending ? flags | 16 : flags &~ 16; @@ -1438,12 +1494,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(msg_id); } if ((flags & 512) != 0) { - stream.writeInt32(0x1cb5c415); - int count = extended_media.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - extended_media.get(i).serializeToStream(stream); - } + Vector.serialize(stream, extended_media); } if ((flags & 4096) != 0) { stream.writeInt32(subscription_period); @@ -1457,7 +1508,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_starsTransaction_layer186 extends TL_starsTransaction { public static final int constructor = 0x433aeb2b; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); refund = (flags & 8) != 0; pending = (flags & 16) != 0; @@ -1489,28 +1540,14 @@ public void readParams(AbstractSerializedData stream, boolean exception) { msg_id = stream.readInt32(exception); } if ((flags & 512) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.MessageMedia object = TLRPC.MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - extended_media.add(object); - } + extended_media = Vector.deserialize(stream, TLRPC.MessageMedia::TLdeserialize, exception); } if ((flags & 4096) != 0) { subscription_period = stream.readInt32(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = refund ? flags | 8 : flags &~ 8; flags = pending ? flags | 16 : flags &~ 16; @@ -1542,12 +1579,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(msg_id); } if ((flags & 512) != 0) { - stream.writeInt32(0x1cb5c415); - int count = extended_media.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - extended_media.get(i).serializeToStream(stream); - } + Vector.serialize(stream, extended_media); } if ((flags & 4096) != 0) { stream.writeInt32(subscription_period); @@ -1558,7 +1590,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_starsTransaction_layer185 extends TL_starsTransaction { public static final int constructor = 0x2db5418f; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); refund = (flags & 8) != 0; pending = (flags & 16) != 0; @@ -1588,25 +1620,11 @@ public void readParams(AbstractSerializedData stream, boolean exception) { msg_id = stream.readInt32(exception); } if ((flags & 512) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.MessageMedia object = TLRPC.MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - extended_media.add(object); - } + extended_media = Vector.deserialize(stream, TLRPC.MessageMedia::TLdeserialize, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = refund ? flags | 8 : flags &~ 8; flags = pending ? flags | 16 : flags &~ 16; @@ -1636,12 +1654,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(msg_id); } if ((flags & 512) != 0) { - stream.writeInt32(0x1cb5c415); - int count = extended_media.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - extended_media.get(i).serializeToStream(stream); - } + Vector.serialize(stream, extended_media); } } } @@ -1658,7 +1671,7 @@ public static class StarsStatus extends TLObject { public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static StarsStatus TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static StarsStatus TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { StarsStatus result = null; switch (constructor) { case TL_payments_starsStatus_layer194.constructor: @@ -1681,25 +1694,11 @@ public static StarsStatus TLdeserialize(AbstractSerializedData stream, int const public static class TL_payments_starsStatus extends StarsStatus { public static final int constructor = 0x6c9ce8ed; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); balance = StarsAmount.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - StarsSubscription object = StarsSubscription.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - subscriptions.add(object); - } + subscriptions = Vector.deserialize(stream, StarsSubscription::TLdeserialize, exception); } if ((flags & 4) != 0) { subscriptions_next_offset = stream.readString(exception); @@ -1708,68 +1707,21 @@ public void readParams(AbstractSerializedData stream, boolean exception) { subscriptions_missing_balance = stream.readInt64(exception); } if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - StarsTransaction object = StarsTransaction.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - history.add(object); - } + history = Vector.deserialize(stream, StarsTransaction::TLdeserialize, exception); } if ((flags & 1) != 0) { next_offset = stream.readString(exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.Chat object = TLRPC.Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.User object = TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + chats = Vector.deserialize(stream, TLRPC.Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); balance.serializeToStream(stream); if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = subscriptions.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - subscriptions.get(i).serializeToStream(stream); - } + Vector.serialize(stream, subscriptions); } if ((flags & 4) != 0) { stream.writeString(subscriptions_next_offset); @@ -1777,27 +1729,14 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 16) != 0) { stream.writeInt64(subscriptions_missing_balance); } - stream.writeInt32(0x1cb5c415); - int count = history.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - history.get(i).serializeToStream(stream); + if ((flags & 8) != 0) { + Vector.serialize(stream, history); } if ((flags & 1) != 0) { stream.writeString(next_offset); } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - chats.get(i).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - users.get(i).serializeToStream(stream); - } + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } @@ -1805,25 +1744,11 @@ public static class TL_payments_starsStatus_layer194 extends TL_payments_starsSt public static final int constructor = 0xbbfa316c; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); balance = new StarsAmount(stream.readInt64(exception)); if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - StarsSubscription object = StarsSubscription.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - subscriptions.add(object); - } + subscriptions = Vector.deserialize(stream, StarsSubscription::TLdeserialize, exception); } if ((flags & 4) != 0) { subscriptions_next_offset = stream.readString(exception); @@ -1832,68 +1757,21 @@ public void readParams(AbstractSerializedData stream, boolean exception) { subscriptions_missing_balance = stream.readInt64(exception); } if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - StarsTransaction object = StarsTransaction.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - history.add(object); - } + history = Vector.deserialize(stream, StarsTransaction::TLdeserialize, exception); } if ((flags & 1) != 0) { next_offset = stream.readString(exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.Chat object = TLRPC.Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.User object = TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + chats = Vector.deserialize(stream, TLRPC.Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(balance.amount); if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = subscriptions.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - subscriptions.get(i).serializeToStream(stream); - } + Vector.serialize(stream, subscriptions); } if ((flags & 4) != 0) { stream.writeString(subscriptions_next_offset); @@ -1901,47 +1779,25 @@ public void serializeToStream(AbstractSerializedData stream) { if ((flags & 16) != 0) { stream.writeInt64(subscriptions_missing_balance); } - stream.writeInt32(0x1cb5c415); - int count = history.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - history.get(i).serializeToStream(stream); + if ((flags & 8) != 0) { + Vector.serialize(stream, history); } if ((flags & 1) != 0) { stream.writeString(next_offset); } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - chats.get(i).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - users.get(i).serializeToStream(stream); - } + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } public static class TL_payments_getStarsTopupOptions extends TLObject { public static final int constructor = 0xc00ec7d3; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - TLRPC.Vector vector = new TLRPC.Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_starsTopupOption object = TL_starsTopupOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, TL_starsTopupOption::TLdeserialize); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -1952,20 +1808,11 @@ public static class TL_payments_getStarsGiftOptions extends TLObject { public int flags; public TLRPC.InputUser user_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - TLRPC.Vector vector = new TLRPC.Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_starsGiftOption object = TL_starsGiftOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, TL_starsGiftOption::TLdeserialize); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -1977,20 +1824,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_payments_getStarsGiveawayOptions extends TLObject { public static final int constructor = 0xbd1efd3e; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - TLRPC.Vector vector = new TLRPC.Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - TL_starsGiveawayOption object = TL_starsGiveawayOption.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return vector; - } - vector.objects.add(object); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserialize(stream, constructor, exception, TL_starsGiveawayOption::TLdeserialize); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -2000,11 +1838,11 @@ public static class TL_payments_getStarsStatus extends TLObject { public TLRPC.InputPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return StarsStatus.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); } @@ -2019,11 +1857,11 @@ public static class TL_payments_getStarsTransactions extends TLObject { public TLRPC.InputPeer peer; public String offset; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return StarsStatus.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = inbound ? flags | 1 : flags &~ 1; flags = outbound ? flags | 2 : flags &~ 2; @@ -2039,11 +1877,11 @@ public static class TL_payments_sendStarsForm extends TLObject { public long form_id; public TLRPC.InputInvoice invoice; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.TL_payments_paymentResult.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(form_id); invoice.serializeToStream(stream); @@ -2066,7 +1904,7 @@ public static class StarsSubscription extends TLObject { public TLRPC.WebDocument photo; public String invoice_slug; - public static StarsSubscription TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static StarsSubscription TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { StarsSubscription result = null; switch (constructor) { case TL_starsSubscription.constructor: @@ -2094,7 +1932,7 @@ public static class TL_starsSubscription extends StarsSubscription { public static final int constructor = 0x2e6eab1a; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); canceled = (flags & 1) != 0; can_refulfill = (flags & 2) != 0; @@ -2119,7 +1957,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = canceled ? (flags | 1) : (flags &~ 1); flags = can_refulfill ? (flags | 2) : (flags &~ 2); @@ -2149,7 +1987,7 @@ public static class TL_starsSubscription_layer193 extends StarsSubscription { public static final int constructor = 0x538ecf18; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); canceled = (flags & 1) != 0; can_refulfill = (flags & 2) != 0; @@ -2164,7 +2002,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = canceled ? (flags | 1) : (flags &~ 1); flags = can_refulfill ? (flags | 2) : (flags &~ 2); @@ -2184,7 +2022,7 @@ public static class TL_starsSubscription_old extends TL_starsSubscription { public static final int constructor = 0xd073f1e6; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); canceled = (flags & 1) != 0; can_refulfill = (flags & 2) != 0; @@ -2196,7 +2034,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = canceled ? (flags | 1) : (flags &~ 1); flags = can_refulfill ? (flags | 2) : (flags &~ 2); @@ -2215,7 +2053,7 @@ public static class TL_starsSubscriptionPricing extends TLObject { public int period; public long amount; - public static TL_starsSubscriptionPricing TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_starsSubscriptionPricing TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_starsSubscriptionPricing.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_starsSubscriptionPricing", constructor)); @@ -2229,13 +2067,13 @@ public static TL_starsSubscriptionPricing TLdeserialize(AbstractSerializedData s } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { period = stream.readInt32(exception); amount = stream.readInt64(exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(period); stream.writeInt64(amount); @@ -2250,11 +2088,11 @@ public static class TL_getStarsSubscriptions extends TLObject { public TLRPC.InputPeer peer; public String offset; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return StarsStatus.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = missing_balance ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -2271,11 +2109,11 @@ public static class TL_changeStarsSubscription extends TLObject { public String subscription_id; public Boolean canceled; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = (canceled != null) ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -2293,14 +2131,523 @@ public static class TL_fulfillStarsSubscription extends TLObject { public TLRPC.InputPeer peer; public String subscription_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeString(subscription_id); } } + + public static class StarGiftAttribute extends TLObject { + + public String name; + public int rarity_permille; + + public static StarGiftAttribute TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + StarGiftAttribute result = null; + switch (constructor) { + case starGiftAttributeModel.constructor: + result = new starGiftAttributeModel(); + break; + case starGiftAttributePattern.constructor: + result = new starGiftAttributePattern(); + break; + case starGiftAttributeBackdrop.constructor: + result = new starGiftAttributeBackdrop(); + break; + case starGiftAttributeOriginalDetails.constructor: + result = new starGiftAttributeOriginalDetails(); + break; + case starGiftAttributeOriginalDetails_layer197.constructor: + result = new starGiftAttributeOriginalDetails_layer197(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in StarGiftAttribute", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } + + public static class starGiftAttributeModel extends StarGiftAttribute { + public static final int constructor = 0x39d99013; + + public TLRPC.Document document; + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(name); + document.serializeToStream(stream); + stream.writeInt32(rarity_permille); + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + name = stream.readString(exception); + document = TLRPC.Document.TLdeserialize(stream, stream.readInt32(exception), exception); + rarity_permille = stream.readInt32(exception); + } + } + public static class starGiftAttributePattern extends StarGiftAttribute { + public static final int constructor = 0x13acff19; + + public TLRPC.Document document; + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(name); + document.serializeToStream(stream); + stream.writeInt32(rarity_permille); + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + name = stream.readString(exception); + document = TLRPC.Document.TLdeserialize(stream, stream.readInt32(exception), exception); + rarity_permille = stream.readInt32(exception); + } + } + public static class starGiftAttributeBackdrop extends StarGiftAttribute { + public static final int constructor = 0x94271762; + + public int center_color; + public int edge_color; + public int pattern_color; + public int text_color; + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(name); + stream.writeInt32(center_color); + stream.writeInt32(edge_color); + stream.writeInt32(pattern_color); + stream.writeInt32(text_color); + stream.writeInt32(rarity_permille); + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + name = stream.readString(exception); + center_color = stream.readInt32(exception); + edge_color = stream.readInt32(exception); + pattern_color = stream.readInt32(exception); + text_color = stream.readInt32(exception); + rarity_permille = stream.readInt32(exception); + } + } + public static class starGiftAttributeOriginalDetails extends StarGiftAttribute { + public static final int constructor = 0xe0bff26c; + + public int flags; + public TLRPC.Peer sender_id; + public TLRPC.Peer recipient_id; + public int date; + public TLRPC.TL_textWithEntities message; + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + sender_id.serializeToStream(stream); + } + recipient_id.serializeToStream(stream); + stream.writeInt32(date); + if ((flags & 2) != 0) { + message.serializeToStream(stream); + } + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + if ((flags & 1) != 0) { + sender_id = TLRPC.Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + recipient_id = TLRPC.Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + date = stream.readInt32(exception); + if ((flags & 2) != 0) { + message = TLRPC.TL_textWithEntities.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } + } + public static class starGiftAttributeOriginalDetails_layer197 extends starGiftAttributeOriginalDetails { + public static final int constructor = 0xc02c4f4b; + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + if ((flags & 1) != 0) { + stream.writeInt64(sender_id.user_id); + } + stream.writeInt64(recipient_id.user_id); + stream.writeInt32(date); + if ((flags & 2) != 0) { + message.serializeToStream(stream); + } + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + if ((flags & 1) != 0) { + recipient_id = new TLRPC.TL_peerUser(); + recipient_id.user_id = stream.readInt64(exception); + } + recipient_id = new TLRPC.TL_peerUser(); + recipient_id.user_id = stream.readInt64(exception); + date = stream.readInt32(exception); + if ((flags & 2) != 0) { + message = TLRPC.TL_textWithEntities.TLdeserialize(stream, stream.readInt32(exception), exception); + } + } + } + + public static final class TL_payments_uniqueStarGift extends TLObject { + public static final int constructor = 0xcaa2f60b; + + public StarGift gift; + public ArrayList users = new ArrayList<>(); + + public static TL_payments_uniqueStarGift TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_payments_uniqueStarGift.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_payments_uniqueStarGift", constructor)); + } else { + return null; + } + } + TL_payments_uniqueStarGift result = new TL_payments_uniqueStarGift(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + gift = StarGift.TLdeserialize(stream, stream.readInt32(exception), exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + gift.serializeToStream(stream); + Vector.serialize(stream, users); + } + } + + public static final class getUniqueStarGift extends TLObject { + public static final int constructor = 0xa1974d72; + + public String slug; + + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TL_payments_uniqueStarGift.TLdeserialize(stream, constructor, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(slug); + } + } + + public static final class SavedStarGift extends TLObject { + public static final int constructor = 0x6056dba5; + + public int flags; + public boolean name_hidden; + public boolean unsaved; + public boolean refunded; + public boolean can_upgrade; + public TLRPC.Peer from_id; + public int date; + public StarGift gift; + public TLRPC.TL_textWithEntities message; + public int msg_id; + public long saved_id; + public long convert_stars; + public long upgrade_stars; + public int can_export_at; + public long transfer_stars; + + public static SavedStarGift TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (SavedStarGift.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in savedStarGift", constructor)); + } else { + return null; + } + } + SavedStarGift result = new SavedStarGift(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + name_hidden = (flags & 1) != 0; + unsaved = (flags & 32) != 0; + refunded = (flags & 512) != 0; + can_upgrade = (flags & 1024) != 0; + if ((flags & 2) != 0) { + from_id = TLRPC.Peer.TLdeserialize(stream, stream.readInt32(exception), exception); + } + date = stream.readInt32(exception); + gift = StarGift.TLdeserialize(stream, stream.readInt32(exception), exception); + if ((flags & 4) != 0) { + message = TLRPC.TL_textWithEntities.TLdeserialize(stream, stream.readInt32(exception), exception); + } + if ((flags & 8) != 0) { + msg_id = stream.readInt32(exception); + } + if ((flags & 2048) != 0) { + saved_id = stream.readInt64(exception); + } + if ((flags & 16) != 0) { + convert_stars = stream.readInt64(exception); + } + if ((flags & 64) != 0) { + upgrade_stars = stream.readInt64(exception); + } + if ((flags & 128) != 0) { + can_export_at = stream.readInt32(exception); + } + if ((flags & 256) != 0) { + transfer_stars = stream.readInt64(exception); + } + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = name_hidden ? flags | 1 : flags &~ 1; + flags = unsaved ? flags | 32 : flags &~ 32; + flags = refunded ? flags | 512 : flags &~ 512; + flags = can_upgrade ? flags | 1024 : flags &~ 1024; + stream.writeInt32(flags); + if ((flags & 2) != 0) { + from_id.serializeToStream(stream); + } + stream.writeInt32(date); + gift.serializeToStream(stream); + if ((flags & 4) != 0) { + message.serializeToStream(stream); + } + if ((flags & 8) != 0) { + stream.writeInt32(msg_id); + } + if ((flags & 2048) != 0) { + stream.writeInt64(saved_id); + } + if ((flags & 16) != 0) { + stream.writeInt64(convert_stars); + } + if ((flags & 64) != 0) { + stream.writeInt64(upgrade_stars); + } + if ((flags & 128) != 0) { + stream.writeInt32(can_export_at); + } + if ((flags & 256) != 0) { + stream.writeInt64(transfer_stars); + } + } + } + + public static final class TL_payments_savedStarGifts extends TLObject { + public static final int constructor = 0x95f389b1; + + public int flags; + public int count; + public boolean chat_notifications_enabled; + public ArrayList gifts = new ArrayList<>(); + public String next_offset; + public ArrayList chats = new ArrayList<>(); + public ArrayList users = new ArrayList<>(); + + public static TL_payments_savedStarGifts TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (TL_payments_savedStarGifts.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in TL_payments_savedStarGifts", constructor)); + } else { + return null; + } + } + TL_payments_savedStarGifts result = new TL_payments_savedStarGifts(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + flags = stream.readInt32(exception); + count = stream.readInt32(exception); + if ((flags & 2) != 0) { + chat_notifications_enabled = stream.readBool(exception); + } + gifts = Vector.deserialize(stream, SavedStarGift::TLdeserialize, exception); + if ((flags & 1) != 0) { + next_offset = stream.readString(exception); + } + chats = Vector.deserialize(stream, TLRPC.Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(flags); + stream.writeInt32(count); + if ((flags & 2) != 0) { + stream.writeBool(chat_notifications_enabled); + } + Vector.serialize(stream, gifts); + if ((flags & 1) != 0) { + stream.writeString(next_offset); + } + Vector.serialize(stream, chats); + Vector.serialize(stream, users); + } + } + + public static class InputSavedStarGift extends TLObject { + public static InputSavedStarGift TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + InputSavedStarGift result = null; + switch (constructor) { + case TL_inputSavedStarGiftUser.constructor: + result = new TL_inputSavedStarGiftUser(); + break; + case TL_inputSavedStarGiftChat.constructor: + result = new TL_inputSavedStarGiftChat(); + break; + } + if (result == null && exception) { + throw new RuntimeException(String.format("can't parse magic %x in InputSavedStarGift", constructor)); + } + if (result != null) { + result.readParams(stream, exception); + } + return result; + } + } + + public static final class TL_inputSavedStarGiftUser extends InputSavedStarGift { + public static final int constructor = 0x69279795; + + public int msg_id; + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeInt32(msg_id); + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + msg_id = stream.readInt32(exception); + } + } + + public static final class TL_inputSavedStarGiftChat extends InputSavedStarGift { + public static final int constructor = 0xf101aa7f; + + public TLRPC.InputPeer peer; + public long saved_id; + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + peer.serializeToStream(stream); + stream.writeInt64(saved_id); + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + peer = TLRPC.InputPeer.TLdeserialize(stream, stream.readInt32(exception), exception); + saved_id = stream.readInt64(exception); + } + } + + public static final class toggleChatStarGiftNotifications extends TLObject { + public static final int constructor = 0x60eaefa1; + + public int flags; + public boolean enabled; + public TLRPC.InputPeer peer; + + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return TLRPC.Bool.TLdeserialize(stream, constructor, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + flags = enabled ? flags | 1 : flags &~ 1; + stream.writeInt32(flags); + peer.serializeToStream(stream); + } + } + + public static final class starGiftWithdrawalUrl extends TLObject { + public static final int constructor = 0x84aa3a9c; + + public String url; + + public static starGiftWithdrawalUrl TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { + if (starGiftWithdrawalUrl.constructor != constructor) { + if (exception) { + throw new RuntimeException(String.format("can't parse magic %x in starGiftWithdrawalUrl", constructor)); + } + return null; + } + starGiftWithdrawalUrl result = new starGiftWithdrawalUrl(); + result.readParams(stream, exception); + return result; + } + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + url = stream.readString(exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stream.writeString(url); + } + } + + public static final class getStarGiftWithdrawalUrl extends TLObject { + public static final int constructor = 0xd06e93a8; + + public InputSavedStarGift stargift; + public TLRPC.InputCheckPasswordSRP password; + + @Override + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return starGiftWithdrawalUrl.TLdeserialize(stream, constructor, exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + stargift.serializeToStream(stream); + password.serializeToStream(stream); + } + } } diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_stats.java b/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_stats.java index c2665c73fb..b26a50d03d 100644 --- a/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_stats.java +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_stats.java @@ -1,8 +1,11 @@ package org.telegram.tgnet.tl; import org.telegram.tgnet.AbstractSerializedData; +import org.telegram.tgnet.InputSerializedData; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import java.util.ArrayList; @@ -27,7 +30,7 @@ public static class TL_megagroupStats extends TLObject { public ArrayList top_inviters = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_megagroupStats TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_megagroupStats TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_megagroupStats.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_stats_megagroupStats", constructor)); @@ -40,7 +43,7 @@ public static TL_megagroupStats TLdeserialize(AbstractSerializedData stream, int return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { period = TL_statsDateRangeDays.TLdeserialize(stream, stream.readInt32(exception), exception); members = TL_statsAbsValueAndPrev.TLdeserialize(stream, stream.readInt32(exception), exception); messages = TL_statsAbsValueAndPrev.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -54,69 +57,13 @@ public void readParams(AbstractSerializedData stream, boolean exception) { actions_graph = StatsGraph.TLdeserialize(stream, stream.readInt32(exception), exception); top_hours_graph = StatsGraph.TLdeserialize(stream, stream.readInt32(exception), exception); weekdays_graph = StatsGraph.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_statsGroupTopPoster object = TL_statsGroupTopPoster.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - top_posters.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_statsGroupTopAdmin object = TL_statsGroupTopAdmin.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - top_admins.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_statsGroupTopInviter object = TL_statsGroupTopInviter.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - top_inviters.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.User object = TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + top_posters = Vector.deserialize(stream, TL_statsGroupTopPoster::TLdeserialize, exception); + top_admins = Vector.deserialize(stream, TL_statsGroupTopAdmin::TLdeserialize, exception); + top_inviters = Vector.deserialize(stream, TL_statsGroupTopInviter::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); period.serializeToStream(stream); members.serializeToStream(stream); @@ -131,30 +78,10 @@ public void serializeToStream(AbstractSerializedData stream) { actions_graph.serializeToStream(stream); top_hours_graph.serializeToStream(stream); weekdays_graph.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = top_posters.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - top_posters.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = top_admins.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - top_admins.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = top_inviters.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - top_inviters.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, top_posters); + Vector.serialize(stream, top_admins); + Vector.serialize(stream, top_inviters); + Vector.serialize(stream, users); } } @@ -162,7 +89,7 @@ public static abstract class StatsGraph extends TLObject { public float rate; // custom - public static StatsGraph TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static StatsGraph TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { StatsGraph result = null; switch (constructor) { case TL_statsGraph.constructor: @@ -192,7 +119,7 @@ public static class TL_statsGraph extends StatsGraph { public TLRPC.TL_dataJSON json; public String zoom_token; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); json = TLRPC.TL_dataJSON.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 1) != 0) { @@ -200,7 +127,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); json.serializeToStream(stream); @@ -215,11 +142,11 @@ public static class TL_statsGraphAsync extends StatsGraph { public String token; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { token = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(token); } @@ -230,11 +157,11 @@ public static class TL_statsGraphError extends StatsGraph { public String error; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { error = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(error); } @@ -242,7 +169,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static abstract class PostInteractionCounters extends TLObject { - public static PostInteractionCounters TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static PostInteractionCounters TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { PostInteractionCounters result = null; switch (constructor) { case TL_postInteractionCountersStory.constructor: @@ -270,14 +197,14 @@ public static class TL_postInteractionCountersStory extends PostInteractionCount public int forwards; public int reactions; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { story_id = stream.readInt32(exception); views = stream.readInt32(exception); forwards = stream.readInt32(exception); reactions = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(story_id); stream.writeInt32(views); @@ -294,14 +221,14 @@ public static class TL_postInteractionCountersMessage extends PostInteractionCou public int forwards; public int reactions; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { msg_id = stream.readInt32(exception); views = stream.readInt32(exception); forwards = stream.readInt32(exception); reactions = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(msg_id); stream.writeInt32(views); @@ -316,7 +243,7 @@ public static class TL_messageStats extends TLObject { public StatsGraph views_graph; public StatsGraph reactions_by_emotion_graph; - public static TL_messageStats TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_messageStats TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_messageStats.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_stats_messageStats", constructor)); @@ -329,12 +256,12 @@ public static TL_messageStats TLdeserialize(AbstractSerializedData stream, int c return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { views_graph = StatsGraph.TLdeserialize(stream, stream.readInt32(exception), exception); reactions_by_emotion_graph = StatsGraph.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); views_graph.serializeToStream(stream); reactions_by_emotion_graph.serializeToStream(stream); @@ -348,7 +275,7 @@ public static class TL_statsGroupTopPoster extends TLObject { public int messages; public int avg_chars; - public static TL_statsGroupTopPoster TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_statsGroupTopPoster TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_statsGroupTopPoster.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_statsGroupTopPoster", constructor)); @@ -361,13 +288,13 @@ public static TL_statsGroupTopPoster TLdeserialize(AbstractSerializedData stream return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); messages = stream.readInt32(exception); avg_chars = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); stream.writeInt32(messages); @@ -381,7 +308,7 @@ public static class TL_statsDateRangeDays extends TLObject { public int min_date; public int max_date; - public static TL_statsDateRangeDays TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_statsDateRangeDays TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_statsDateRangeDays.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_statsDateRangeDays", constructor)); @@ -394,12 +321,12 @@ public static TL_statsDateRangeDays TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { min_date = stream.readInt32(exception); max_date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(min_date); stream.writeInt32(max_date); @@ -432,7 +359,7 @@ public static class TL_broadcastStats extends TLObject { public StatsGraph story_reactions_by_emotion_graph; public ArrayList recent_posts_interactions = new ArrayList<>(); - public static TL_broadcastStats TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_broadcastStats TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_broadcastStats.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_stats_broadcastStats", constructor)); @@ -445,7 +372,7 @@ public static TL_broadcastStats TLdeserialize(AbstractSerializedData stream, int return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { period = TL_statsDateRangeDays.TLdeserialize(stream, stream.readInt32(exception), exception); followers = TL_statsAbsValueAndPrev.TLdeserialize(stream, stream.readInt32(exception), exception); views_per_post = TL_statsAbsValueAndPrev.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -467,24 +394,10 @@ public void readParams(AbstractSerializedData stream, boolean exception) { reactions_by_emotion_graph = StatsGraph.TLdeserialize(stream, stream.readInt32(exception), exception); story_interactions_graph = StatsGraph.TLdeserialize(stream, stream.readInt32(exception), exception); story_reactions_by_emotion_graph = StatsGraph.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PostInteractionCounters object = PostInteractionCounters.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - recent_posts_interactions.add(object); - } + recent_posts_interactions = Vector.deserialize(stream, PostInteractionCounters::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); period.serializeToStream(stream); followers.serializeToStream(stream); @@ -507,12 +420,7 @@ public void serializeToStream(AbstractSerializedData stream) { reactions_by_emotion_graph.serializeToStream(stream); story_interactions_graph.serializeToStream(stream); story_reactions_by_emotion_graph.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = recent_posts_interactions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - recent_posts_interactions.get(a).serializeToStream(stream); - } + Vector.serialize(stream, recent_posts_interactions); } } @@ -523,11 +431,11 @@ public static class TL_getBroadcastStats extends TLObject { public boolean dark; public TLRPC.InputChannel channel; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_broadcastStats.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = dark ? (flags | 1) : (flags & ~1); stream.writeInt32(flags); @@ -542,11 +450,11 @@ public static class TL_loadAsyncGraph extends TLObject { public String token; public long x; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return StatsGraph.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(token); @@ -563,11 +471,11 @@ public static class TL_getMegagroupStats extends TLObject { public boolean dark; public TLRPC.InputChannel channel; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_megagroupStats.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = dark ? (flags | 1) : (flags & ~1); stream.writeInt32(flags); @@ -583,11 +491,11 @@ public static class TL_getMessagePublicForwards extends TLObject { public String offset; public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_publicForwards.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); channel.serializeToStream(stream); stream.writeInt32(msg_id); @@ -604,11 +512,11 @@ public static class TL_getMessageStats extends TLObject { public TLRPC.InputChannel channel; public int msg_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_messageStats.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = dark ? (flags | 1) : (flags & ~1); stream.writeInt32(flags); @@ -625,11 +533,11 @@ public static class TL_getStoryPublicForwards extends TLObject { public String offset; public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_publicForwards.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(id); @@ -648,7 +556,7 @@ public static class TL_publicForwards extends TLObject { public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_publicForwards TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_publicForwards TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_publicForwards.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_stats_publicForwards", constructor)); @@ -661,90 +569,33 @@ public static TL_publicForwards TLdeserialize(AbstractSerializedData stream, int return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PublicForward object = PublicForward.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - forwards.add(object); - } + forwards = Vector.deserialize(stream, PublicForward::TLdeserialize, exception); if ((flags & 1) != 0) { next_offset = stream.readString(exception); } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.Chat object = TLRPC.Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.User object = TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + chats = Vector.deserialize(stream, TLRPC.Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = forwards.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - forwards.get(a).serializeToStream(stream); - } + Vector.serialize(stream, forwards); if ((flags & 1) != 0) { stream.writeString(next_offset); } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } public static abstract class PublicForward extends TLObject { - public static PublicForward TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static PublicForward TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { PublicForward result = null; switch (constructor) { case TL_stats.TL_publicForwardMessage.constructor: @@ -769,11 +620,11 @@ public static class TL_publicForwardMessage extends PublicForward { public TLRPC.Message message; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { message = TLRPC.Message.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); message.serializeToStream(stream); } @@ -787,7 +638,7 @@ public static class TL_broadcastRevenueStats extends TLObject { public TLRPC.BroadcastRevenueBalances balances; public double usd_rate; - public static TL_broadcastRevenueStats TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_broadcastRevenueStats TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_broadcastRevenueStats.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_stats_broadcastRevenueStats", constructor)); @@ -802,7 +653,7 @@ public static TL_broadcastRevenueStats TLdeserialize(AbstractSerializedData stre @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { top_hours_graph = StatsGraph.TLdeserialize(stream, stream.readInt32(exception), exception); revenue_graph = StatsGraph.TLdeserialize(stream, stream.readInt32(exception), exception); balances = TLRPC.BroadcastRevenueBalances.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -810,7 +661,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); top_hours_graph.serializeToStream(stream); revenue_graph.serializeToStream(stream); @@ -824,7 +675,7 @@ public static class TL_broadcastRevenueWithdrawalUrl extends TLObject { public String url; - public static TL_broadcastRevenueWithdrawalUrl TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_broadcastRevenueWithdrawalUrl TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_broadcastRevenueWithdrawalUrl.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_stats_broadcastRevenueWithdrawalUrl", constructor)); @@ -838,19 +689,19 @@ public static TL_broadcastRevenueWithdrawalUrl TLdeserialize(AbstractSerializedD } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { url = stream.readString(exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(url); } } public static class BroadcastRevenueTransaction extends TLObject { - public static BroadcastRevenueTransaction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static BroadcastRevenueTransaction TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { BroadcastRevenueTransaction result = null; switch (constructor) { case TL_broadcastRevenueTransactionProceeds.constructor: @@ -881,14 +732,14 @@ public static class TL_broadcastRevenueTransactionProceeds extends BroadcastReve public int to_date; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { amount = stream.readInt64(exception); from_date = stream.readInt32(exception); to_date = stream.readInt32(exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(amount); stream.writeInt32(from_date); @@ -909,7 +760,7 @@ public static class TL_broadcastRevenueTransactionWithdrawal extends BroadcastRe public String transaction_url; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); pending = (flags & 1) != 0; failed = (flags & 4) != 0; @@ -923,7 +774,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = pending ? (flags | 1) : (flags & ~1); flags = failed ? (flags | 1) : (flags & ~1); @@ -945,14 +796,14 @@ public static class TL_broadcastRevenueTransactionRefund extends BroadcastRevenu public String provider; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { amount = stream.readInt64(exception); from_date = stream.readInt32(exception); provider = stream.readString(exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(amount); stream.writeInt32(from_date); @@ -966,7 +817,7 @@ public static class TL_broadcastRevenueTransactions extends TLObject { public int count; public ArrayList transactions = new ArrayList<>(); - public static TL_broadcastRevenueTransactions TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_broadcastRevenueTransactions TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_broadcastRevenueTransactions.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_stats_broadcastRevenueTransactions", constructor)); @@ -980,31 +831,16 @@ public static TL_broadcastRevenueTransactions TLdeserialize(AbstractSerializedDa } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { - this.count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int i = 0; i < count; ++i) { - transactions.add(BroadcastRevenueTransaction.TLdeserialize(stream, stream.readInt32(exception), exception)); - } + public void readParams(InputSerializedData stream, boolean exception) { + count = stream.readInt32(exception); + transactions = Vector.deserialize(stream, BroadcastRevenueTransaction::TLdeserialize, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(this.count); - stream.writeInt32(0x1cb5c415); - int count = transactions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - transactions.get(a).serializeToStream(stream); - } + Vector.serialize(stream, transactions); } } @@ -1016,12 +852,12 @@ public static class TL_getBroadcastRevenueStats extends TLObject { public TLRPC.InputPeer peer; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_broadcastRevenueStats.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = dark ? (flags | 1) : (flags & ~1); stream.writeInt32(flags); @@ -1036,12 +872,12 @@ public static class TL_getBroadcastRevenueWithdrawalUrl extends TLObject { public TLRPC.InputCheckPasswordSRP password; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_broadcastRevenueWithdrawalUrl.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); password.serializeToStream(stream); @@ -1056,12 +892,12 @@ public static class TL_getBroadcastRevenueTransactions extends TLObject { public int limit; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_broadcastRevenueTransactions.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(offset); @@ -1075,7 +911,7 @@ public static class TL_statsAbsValueAndPrev extends TLObject { public double current; public double previous; - public static TL_statsAbsValueAndPrev TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_statsAbsValueAndPrev TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_statsAbsValueAndPrev.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_statsAbsValueAndPrev", constructor)); @@ -1088,12 +924,12 @@ public static TL_statsAbsValueAndPrev TLdeserialize(AbstractSerializedData strea return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { current = stream.readDouble(exception); previous = stream.readDouble(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeDouble(current); stream.writeDouble(previous); @@ -1108,7 +944,7 @@ public static class TL_statsGroupTopAdmin extends TLObject { public int kicked; public int banned; - public static TL_statsGroupTopAdmin TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_statsGroupTopAdmin TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_statsGroupTopAdmin.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_statsGroupTopAdmin", constructor)); @@ -1121,14 +957,14 @@ public static TL_statsGroupTopAdmin TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); deleted = stream.readInt32(exception); kicked = stream.readInt32(exception); banned = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); stream.writeInt32(deleted); @@ -1143,7 +979,7 @@ public static class TL_statsGroupTopInviter extends TLObject { public long user_id; public int invitations; - public static TL_statsGroupTopInviter TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_statsGroupTopInviter TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_statsGroupTopInviter.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_statsGroupTopInviter", constructor)); @@ -1156,12 +992,12 @@ public static TL_statsGroupTopInviter TLdeserialize(AbstractSerializedData strea return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); invitations = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); stream.writeInt32(invitations); @@ -1174,7 +1010,7 @@ public static class TL_statsPercentValue extends TLObject { public double part; public double total; - public static TL_statsPercentValue TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_statsPercentValue TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_statsPercentValue.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_statsPercentValue", constructor)); @@ -1187,12 +1023,12 @@ public static TL_statsPercentValue TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { part = stream.readDouble(exception); total = stream.readDouble(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeDouble(part); stream.writeDouble(total); diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_stories.java b/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_stories.java index fa5e8953f0..b3030baf3b 100644 --- a/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_stories.java +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_stories.java @@ -3,9 +3,11 @@ import androidx.annotation.NonNull; import org.telegram.messenger.DialogObject; -import org.telegram.tgnet.AbstractSerializedData; +import org.telegram.tgnet.InputSerializedData; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import org.telegram.tgnet.tl.TL_stats.TL_statsPercentValue; import org.telegram.ui.Stories.recorder.StoryPrivacyBottomSheet; @@ -18,7 +20,7 @@ public static class TL_stories_storyViews extends TLObject { public ArrayList views = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_stories_storyViews TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_stories_storyViews TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_stories_storyViews.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_stories_storyViews", constructor)); @@ -31,53 +33,15 @@ public static TL_stories_storyViews TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - StoryViews object = StoryViews.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - views.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.User object = TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + views = Vector.deserialize(stream, StoryViews::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = views.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - views.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, views); + Vector.serialize(stream, users); } } @@ -93,7 +57,7 @@ public static class StoryView extends TLObject { public TLRPC.Peer peer_id; public StoryItem story; - public static StoryView TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static StoryView TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { StoryView result = null; switch (constructor) { case TL_storyView.constructor: @@ -119,7 +83,7 @@ public static StoryView TLdeserialize(AbstractSerializedData stream, int constru public static class TL_storyView extends StoryView { public static final int constructor = 0xb0bdeac5; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blocked = (flags & 1) != 0; blocked_my_stories_from = (flags & 2) != 0; @@ -130,7 +94,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blocked ? (flags | 1) : (flags &~ 1); flags = blocked_my_stories_from ? (flags | 2) : (flags &~ 2); @@ -146,14 +110,14 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_storyViewPublicForward extends StoryView { public static final int constructor = 0x9083670b; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blocked = (flags & 1) != 0; blocked_my_stories_from = (flags & 2) != 0; message = TLRPC.Message.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blocked ? (flags | 1) : (flags &~ 1); flags = blocked_my_stories_from ? (flags | 2) : (flags &~ 2); @@ -165,7 +129,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_storyViewPublicRepost extends StoryView { public static final int constructor = 0xbd74cf49; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); blocked = (flags & 1) != 0; blocked_my_stories_from = (flags & 2) != 0; @@ -173,7 +137,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { story = StoryItem.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = blocked ? (flags | 1) : (flags &~ 1); flags = blocked_my_stories_from ? (flags | 2) : (flags &~ 2); @@ -191,7 +155,7 @@ public static abstract class PeerStories extends TLObject { public ArrayList stories = new ArrayList<>(); public boolean checkedExpired; //custom - public static PeerStories TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static PeerStories TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { PeerStories result = null; switch (constructor) { case 0x9a35e999: @@ -214,49 +178,30 @@ public static PeerStories TLdeserialize(AbstractSerializedData stream, int const public static class TL_peerStories extends PeerStories { public static final int constructor = 0x9a35e999; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); peer = TLRPC.Peer.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 1) != 0) { max_read_id = stream.readInt32(exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - StoryItem object = StoryItem.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - stories.add(object); - } + stories = Vector.deserialize(stream, StoryItem::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); peer.serializeToStream(stream); if ((flags & 1) != 0) { stream.writeInt32(max_read_id); } - stream.writeInt32(0x1cb5c415); - int count = stories.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stories.get(a).serializeToStream(stream); - } + Vector.serialize(stream, stories); } } public static class TL_peerStories_layer162 extends TL_peerStories { public static final int constructor = 0x8611a200; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); long user_id = stream.readInt64(exception); peer = new TLRPC.TL_peerUser(); @@ -264,36 +209,17 @@ public void readParams(AbstractSerializedData stream, boolean exception) { if ((flags & 1) != 0) { max_read_id = stream.readInt32(exception); } - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - StoryItem object = StoryItem.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - stories.add(object); - } + stories = Vector.deserialize(stream, StoryItem::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt64(peer.user_id); if ((flags & 1) != 0) { stream.writeInt32(max_read_id); } - stream.writeInt32(0x1cb5c415); - int count = stories.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stories.get(a).serializeToStream(stream); - } + Vector.serialize(stream, stories); } } @@ -304,7 +230,7 @@ public static class TL_stories_peerStories extends TLObject { public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_stories_peerStories TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_stories_peerStories TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_stories_peerStories.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_stories_peerStories", constructor)); @@ -317,61 +243,23 @@ public static TL_stories_peerStories TLdeserialize(AbstractSerializedData stream return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { stories = PeerStories.TLdeserialize(stream, stream.readInt32(exception), exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.Chat object = TLRPC.Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.User object = TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + chats = Vector.deserialize(stream, TLRPC.Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stories.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } public static abstract class stories_AllStories extends TLObject { - public static stories_AllStories TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static stories_AllStories TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { stories_AllStories result = null; switch (constructor) { case 0x1158fe3e: @@ -398,13 +286,13 @@ public static class TL_stories_allStoriesNotModified extends stories_AllStories public String state; public TL_storiesStealthMode stealth_mode; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); state = stream.readString(exception); stealth_mode = TL_storiesStealthMode.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(state); @@ -424,83 +312,26 @@ public static class TL_stories_allStories extends stories_AllStories { public ArrayList users = new ArrayList<>(); public TL_storiesStealthMode stealth_mode; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); has_more = (flags & 1) != 0; count = stream.readInt32(exception); state = stream.readString(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PeerStories object = PeerStories.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - peer_stories.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.Chat object = TLRPC.Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.User object = TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + peer_stories = Vector.deserialize(stream, PeerStories::TLdeserialize, exception); + chats = Vector.deserialize(stream, TLRPC.Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); stealth_mode = TL_storiesStealthMode.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = has_more ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); stream.writeInt32(count); stream.writeString(state); - stream.writeInt32(0x1cb5c415); - int count = peer_stories.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - peer_stories.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, peer_stories); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); stealth_mode.serializeToStream(stream); } } @@ -510,11 +341,11 @@ public static class TL_stories_canSendStory extends TLObject { public TLRPC.InputPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); } @@ -538,11 +369,11 @@ public static class TL_stories_sendStory extends TLObject { public TLRPC.InputPeer fwd_from_id; public int fwd_from_story; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = pinned ? (flags | 4) : (flags &~ 4); flags = noforwards ? (flags | 16) : (flags &~ 16); @@ -551,30 +382,15 @@ public void serializeToStream(AbstractSerializedData stream) { peer.serializeToStream(stream); media.serializeToStream(stream); if ((flags & 32) != 0) { - stream.writeInt32(0x1cb5c415); - int count = media_areas.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - media_areas.get(a).serializeToStream(stream); - } + Vector.serialize(stream, media_areas); } if ((flags & 1) != 0) { stream.writeString(caption); } if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } - } - stream.writeInt32(0x1cb5c415); - int count = privacy_rules.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - privacy_rules.get(a).serializeToStream(stream); + Vector.serialize(stream, entities); } + Vector.serialize(stream, privacy_rules); stream.writeInt64(random_id); if ((flags & 8) != 0) { stream.writeInt32(period); @@ -594,52 +410,32 @@ public static class TL_stories_deleteStories extends TLObject { public TLRPC.InputPeer peer; public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - TLRPC.Vector vector = new TLRPC.Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - vector.objects.add(stream.readInt32(exception)); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserializeInt(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } + Vector.serializeInt(stream, id); } } - public static class TL_stories_togglePinned extends TLObject { + public static class togglePinned extends TLObject { public static final int constructor = 0x9a75a1ef; public TLRPC.InputPeer peer; public ArrayList id = new ArrayList<>(); public boolean pinned; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - TLRPC.Vector vector = new TLRPC.Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - vector.objects.add(stream.readInt32(exception)); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserializeInt(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } + Vector.serializeInt(stream, id); stream.writeBool(pinned); } } @@ -656,11 +452,11 @@ public static class TL_stories_editStory extends TLObject { public ArrayList entities = new ArrayList<>(); public ArrayList privacy_rules = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); peer.serializeToStream(stream); @@ -669,31 +465,16 @@ public void serializeToStream(AbstractSerializedData stream) { media.serializeToStream(stream); } if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = media_areas.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - media_areas.get(a).serializeToStream(stream); - } + Vector.serialize(stream, media_areas); } if ((flags & 2) != 0) { stream.writeString(caption); } if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } if ((flags & 4) != 0) { - stream.writeInt32(0x1cb5c415); - int count = privacy_rules.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - privacy_rules.get(a).serializeToStream(stream); - } + Vector.serialize(stream, privacy_rules); } } } @@ -706,11 +487,11 @@ public static class TL_stories_getAllStories extends TLObject { public boolean next; public String state; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return stories_AllStories.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = next ? (flags | 2) : (flags &~ 2); flags = include_hidden ? (flags | 4) : (flags &~ 4); @@ -727,11 +508,11 @@ public static class TL_stories_togglePeerStoriesHidden extends TLObject { public TLRPC.InputPeer peer; public boolean hidden; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeBool(hidden); @@ -748,7 +529,7 @@ public static class TL_stories_stories extends TLObject { public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_stories_stories TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_stories_stories TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_stories_stories.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_stories_stories", constructor)); @@ -761,99 +542,27 @@ public static TL_stories_stories TLdeserialize(AbstractSerializedData stream, in return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - StoryItem object = StoryItem.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - stories.add(object); - } + stories = Vector.deserialize(stream, StoryItem::TLdeserialize, exception); if ((flags & 1) != 0) { - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - pinned_to_top.add(stream.readInt32(exception)); - } - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.Chat object = TLRPC.Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.User object = TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); + pinned_to_top = Vector.deserializeInt(stream, exception); } + chats = Vector.deserialize(stream, TLRPC.Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = stories.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stories.get(a).serializeToStream(stream); - } + Vector.serialize(stream, stories); if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - count = pinned_to_top.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(pinned_to_top.get(a)); - } - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); + Vector.serializeInt(stream, pinned_to_top); } + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } @@ -862,11 +571,11 @@ public static class TL_stories_getPeerStories extends TLObject { public TLRPC.InputPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_stories_peerStories.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); } @@ -878,12 +587,12 @@ public static class TL_updateStory extends TLRPC.Update { public TLRPC.Peer peer; public StoryItem story; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = TLRPC.Peer.TLdeserialize(stream, stream.readInt32(exception), exception); story = StoryItem.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); story.serializeToStream(stream); @@ -897,11 +606,11 @@ public static class TL_stories_getPinnedStories extends TLObject { public int offset_id; public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_stories_stories.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(offset_id); @@ -916,11 +625,11 @@ public static class TL_stories_getStoriesArchive extends TLObject { public int offset_id; public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_stories_stories.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(offset_id); @@ -934,12 +643,12 @@ public static class TL_updateReadStories extends TLRPC.Update { public TLRPC.Peer peer; public int max_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = TLRPC.Peer.TLdeserialize(stream, stream.readInt32(exception), exception); max_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(max_id); @@ -958,7 +667,7 @@ public static class StoryViewsList extends TLObject { public ArrayList users = new ArrayList<>(); public String next_offset = ""; - public static StoryViewsList TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static StoryViewsList TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { StoryViewsList result = null; switch (constructor) { case TL_storyViewsList.constructor: @@ -981,87 +690,30 @@ public static StoryViewsList TLdeserialize(AbstractSerializedData stream, int co public static class TL_storyViewsList extends StoryViewsList { public static final int constructor = 0x59d78fc5; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); count = stream.readInt32(exception); views_count = stream.readInt32(exception); forwards_count = stream.readInt32(exception); reactions_count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - StoryView object = StoryView.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - views.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.Chat object = TLRPC.Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.User object = TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + views = Vector.deserialize(stream, StoryView::TLdeserialize, exception); + chats = Vector.deserialize(stream, TLRPC.Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); if ((flags & 1) != 0) { next_offset = stream.readString(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32(count); stream.writeInt32(views_count); stream.writeInt32(forwards_count); stream.writeInt32(reactions_count); - stream.writeInt32(0x1cb5c415); - int count = views.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - views.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, views); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); if ((flags & 1) != 0) { stream.writeString(next_offset); } @@ -1072,62 +724,24 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_storyViewsList_layer167 extends StoryViewsList { public static final int constructor = 0x46e9b9ec; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); count = stream.readInt32(exception); reactions_count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - StoryView object = StoryView.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - views.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.User object = TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + views = Vector.deserialize(stream, StoryView::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); if ((flags & 1) != 0) { next_offset = stream.readString(exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32(count); stream.writeInt32(reactions_count); - stream.writeInt32(0x1cb5c415); - int count = views.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - views.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, views); + Vector.serialize(stream, users); if ((flags & 1) != 0) { stream.writeString(next_offset); } @@ -1140,16 +754,11 @@ public static class TL_stories_readStories extends TLObject { public TLRPC.InputPeer peer; public int max_id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - TLRPC.Vector vector = new TLRPC.Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - vector.objects.add(stream.readInt32(exception)); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserializeInt(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(max_id); @@ -1162,19 +771,14 @@ public static class TL_stories_incrementStoryViews extends TLObject { public TLRPC.InputPeer peer; public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } + Vector.serializeInt(stream, id); } } @@ -1191,11 +795,11 @@ public static class TL_stories_getStoryViewsList extends TLObject { public String offset; public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return StoryViewsList.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = just_contacts ? (flags | 1) : (flags &~ 1); flags = reactions_first ? (flags | 4) : (flags &~ 4); @@ -1217,19 +821,14 @@ public static class TL_stories_getStoriesByID extends TLObject { public TLRPC.InputPeer peer; public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_stories_stories.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } + Vector.serializeInt(stream, id); } } @@ -1239,7 +838,7 @@ public static class TL_foundStory extends TLObject { public TLRPC.Peer peer; public StoryItem storyItem; - public static TL_foundStory TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_foundStory TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_foundStory.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_foundStory", constructor)); @@ -1253,12 +852,12 @@ public static TL_foundStory TLdeserialize(AbstractSerializedData stream, int con } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = TLRPC.Peer.TLdeserialize(stream, stream.readInt32(exception), exception); storyItem = StoryItem.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); storyItem.serializeToStream(stream); @@ -1275,7 +874,7 @@ public static class TL_foundStories extends TLObject { public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_foundStories TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_foundStories TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_foundStories.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_foundStories", constructor)); @@ -1289,85 +888,28 @@ public static TL_foundStories TLdeserialize(AbstractSerializedData stream, int c } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); this.count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_foundStory object = TL_foundStory.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - stories.add(object); - } + stories = Vector.deserialize(stream, TL_foundStory::TLdeserialize, exception); if ((flags & 1) != 0) { next_offset = stream.readString(exception); } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.Chat object = TLRPC.Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.User object = TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + chats = Vector.deserialize(stream, TLRPC.Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32(this.count); - stream.writeInt32(0x1cb5c415); - int count = stories.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stories.get(a).serializeToStream(stream); - } + Vector.serialize(stream, stories); if ((flags & 1) != 0) { stream.writeString(next_offset); } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } @@ -1382,12 +924,12 @@ public static class TL_stories_searchPosts extends TLObject { public int limit; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_foundStories.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -1410,19 +952,14 @@ public static class TL_stories_getStoriesViews extends TLObject { public TLRPC.InputPeer peer; public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_stories_storyViews.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } + Vector.serializeInt(stream, id); } } @@ -1431,7 +968,7 @@ public static class TL_exportedStoryLink extends TLObject { public String link; - public static TL_exportedStoryLink TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_exportedStoryLink TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_exportedStoryLink.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_exportedStoryLink", constructor)); @@ -1444,11 +981,11 @@ public static TL_exportedStoryLink TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { link = stream.readString(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(link); } @@ -1460,11 +997,11 @@ public static class TL_stories_exportStoryLink extends TLObject { public TLRPC.InputPeer peer; public int id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_exportedStoryLink.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); stream.writeInt32(id); @@ -1479,19 +1016,14 @@ public static class TL_stories_report extends TLObject { public byte[] option; public String message; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.ReportResult.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } + Vector.serialize(stream, stream::writeInt32, id); stream.writeByteArray(option); stream.writeString(message); } @@ -1501,11 +1033,11 @@ public static class TL_stories_getAllReadPeerStories extends TLObject { public static final int constructor = 0x9b5ae7f9; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -1515,23 +1047,13 @@ public static class TL_stories_getPeerMaxIDs extends TLObject { public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { - TLRPC.Vector vector = new TLRPC.Vector(); - int size = stream.readInt32(exception); - for (int a = 0; a < size; a++) { - vector.objects.add(stream.readInt32(exception)); - } - return vector; + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { + return Vector.TLDeserializeInt(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - id.get(a).serializeToStream(stream); - } + Vector.serialize(stream, id); } } @@ -1540,11 +1062,11 @@ public static class TL_updateStoriesStealthMode extends TLRPC.Update { public TL_storiesStealthMode stealth_mode; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { stealth_mode = TL_storiesStealthMode.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stealth_mode.serializeToStream(stream); } @@ -1557,7 +1079,7 @@ public static class TL_storiesStealthMode extends TLObject { public int active_until_date; public int cooldown_until_date; - public static TL_storiesStealthMode TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_storiesStealthMode TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_storiesStealthMode.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_storiesStealthMode", constructor)); @@ -1570,7 +1092,7 @@ public static TL_storiesStealthMode TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); if ((flags & 1) != 0) { active_until_date = stream.readInt32(exception); @@ -1580,7 +1102,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { @@ -1599,11 +1121,11 @@ public static class TL_stories_activateStealthMode extends TLObject { public boolean past; public boolean future; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = past ? (flags | 1) : (flags &~ 1); flags = future ? (flags | 2) : (flags &~ 2); @@ -1620,11 +1142,11 @@ public static class TL_stories_sendReaction extends TLObject { public int story_id; public TLRPC.Reaction reaction; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Updates.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = add_to_recent ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -1637,11 +1159,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_stories_getChatsToSend extends TLObject { public static final int constructor = 0xa56a8b60; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.TL_messages_chats.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -1656,7 +1178,7 @@ public static class TL_myBoost extends TLObject { public int expires; public int cooldown_until_date; - public static TL_myBoost TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_myBoost TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_myBoost.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_myBoost", constructor)); @@ -1669,7 +1191,7 @@ public static TL_myBoost TLdeserialize(AbstractSerializedData stream, int constr return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); slot = stream.readInt32(exception); if ((flags & 1) != 0) { @@ -1682,7 +1204,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32(slot); @@ -1704,7 +1226,7 @@ public static class TL_premium_myBoosts extends TLObject { public ArrayList chats = new ArrayList<>(); public ArrayList users = new ArrayList<>(); - public static TL_premium_myBoosts TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_premium_myBoosts TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_premium_myBoosts.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_premium_myBoosts", constructor)); @@ -1717,74 +1239,17 @@ public static TL_premium_myBoosts TLdeserialize(AbstractSerializedData stream, i return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TL_myBoost object = TL_myBoost.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - my_boosts.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.Chat object = TLRPC.Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.User object = TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + public void readParams(InputSerializedData stream, boolean exception) { + my_boosts = Vector.deserialize(stream, TL_myBoost::TLdeserialize, exception); + chats = Vector.deserialize(stream, TLRPC.Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); - stream.writeInt32(0x1cb5c415); - int count = my_boosts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - my_boosts.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - chats.get(a).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, my_boosts); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); } } @@ -1792,11 +1257,11 @@ public static class TL_premium_getMyBoosts extends TLObject { public static int constructor = 0xbe77b4a; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_premium_myBoosts.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -1816,7 +1281,7 @@ public static class TL_premium_boostsStatus extends TLObject { public ArrayList prepaid_giveaways = new ArrayList<>(); public ArrayList my_boost_slots = new ArrayList<>(); - public static TL_premium_boostsStatus TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_premium_boostsStatus TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_premium_boostsStatus.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_premium_boostsStatus", constructor)); @@ -1829,7 +1294,7 @@ public static TL_premium_boostsStatus TLdeserialize(AbstractSerializedData strea return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); my_boost = (flags & 4) != 0; level = stream.readInt32(exception); @@ -1846,38 +1311,14 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } boost_url = stream.readString(exception); if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - PrepaidGiveaway object = PrepaidGiveaway.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - prepaid_giveaways.add(object); - } + prepaid_giveaways = Vector.deserialize(stream, PrepaidGiveaway::TLdeserialize, exception); } if ((flags & 4) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - my_boost_slots.add(stream.readInt32(exception)); - } + my_boost_slots = Vector.deserializeInt(stream, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = my_boost ? (flags | 4) : (flags &~ 4); stream.writeInt32(flags); @@ -1895,20 +1336,10 @@ public void serializeToStream(AbstractSerializedData stream) { } stream.writeString(boost_url); if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = prepaid_giveaways.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - prepaid_giveaways.get(a).serializeToStream(stream); - } + Vector.serialize(stream, prepaid_giveaways); } if ((flags & 4) != 0) { - stream.writeInt32(0x1cb5c415); - int count = my_boost_slots.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(my_boost_slots.get(a)); - } + Vector.serializeInt(stream, my_boost_slots); } } } @@ -1918,11 +1349,11 @@ public static class TL_premium_getBoostsStatus extends TLObject { public TLRPC.InputPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_premium_boostsStatus.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); } @@ -1935,20 +1366,15 @@ public static class TL_premium_applyBoost extends TLObject { public ArrayList slots = new ArrayList<>(); public TLRPC.InputPeer peer; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_premium_myBoosts.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = slots.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(slots.get(a)); - } + Vector.serializeInt(stream, slots); } peer.serializeToStream(stream); } @@ -1971,7 +1397,7 @@ public static class Boost extends TLObject { public int multiplier; public long stars; - public static Boost TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static Boost TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { Boost result = null; switch (constructor) { case TL_boost.constructor: @@ -1994,7 +1420,7 @@ public static Boost TLdeserialize(AbstractSerializedData stream, int constructor public static class TL_boost extends Boost { public static final int constructor = 0x4b3e14d6; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); gift = (flags & 2) != 0; giveaway = (flags & 4) != 0; @@ -2019,7 +1445,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = gift ? (flags | 2) : (flags &~ 2); flags = giveaway ? (flags | 4) : (flags &~ 4); @@ -2049,7 +1475,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_boost_layer186 extends TL_boost { public static final int constructor = 0x2a1c8c71; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); gift = (flags & 2) != 0; giveaway = (flags & 4) != 0; @@ -2071,7 +1497,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = gift ? (flags | 2) : (flags &~ 2); flags = giveaway ? (flags | 4) : (flags &~ 4); @@ -2104,7 +1530,7 @@ public static class TL_premium_boostsList extends TLObject { public String next_offset; public ArrayList users = new ArrayList<>(); - public static TL_premium_boostsList TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_premium_boostsList TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_premium_boostsList.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_premium_boostsList", constructor)); @@ -2117,63 +1543,25 @@ public static TL_premium_boostsList TLdeserialize(AbstractSerializedData stream, return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - Boost object = Boost.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - boosts.add(object); - } + boosts = Vector.deserialize(stream, Boost::TLdeserialize, exception); if ((flags & 1) != 0) { next_offset = stream.readString(exception); } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.User object = TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = boosts.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - boosts.get(a).serializeToStream(stream); - } + Vector.serialize(stream, boosts); if ((flags & 1) != 0) { stream.writeString(next_offset); } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - users.get(a).serializeToStream(stream); - } + Vector.serialize(stream, users); } } @@ -2186,11 +1574,11 @@ public static class TL_premium_getBoostsList extends TLObject { public String offset; public int limit; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_premium_boostsList.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = gifts ? (flags | 1) : (flags &~ 1); stream.writeInt32(flags); @@ -2238,7 +1626,7 @@ public static abstract class StoryItem extends TLObject { public TLRPC.TL_textWithEntities translatedText; //custom public StoryPrivacyBottomSheet.StoryPrivacy parsedPrivacy; //custom - public static StoryItem TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static StoryItem TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { StoryItem result = null; switch (constructor) { case TL_storyItem.constructor: @@ -2280,7 +1668,7 @@ public static abstract class StoryViews extends TLObject { public int forwards_count; public ArrayList reactions = new ArrayList<>(); - public static StoryViews TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static StoryViews TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { StoryViews result = null; switch (constructor) { case 0xd36760cf: @@ -2292,7 +1680,6 @@ public static StoryViews TLdeserialize(AbstractSerializedData stream, int constr case 0x8d595cd6: result = new TL_storyViews(); break; - } if (result == null && exception) { throw new RuntimeException(String.format("can't parse magic %x in StoryViews", constructor)); @@ -2307,35 +1694,20 @@ public static StoryViews TLdeserialize(AbstractSerializedData stream, int constr public static class TL_storyViews_layer160 extends StoryViews { public static final int constructor = 0xd36760cf; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); views_count = stream.readInt32(exception); if ((flags & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - recent_viewers.add(stream.readInt64(exception)); - } + recent_viewers = Vector.deserializeLong(stream, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32(views_count); if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = recent_viewers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(recent_viewers.get(a)); - } + Vector.serializeLong(stream, recent_viewers); } } } @@ -2343,37 +1715,22 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_storyViews_layer161 extends StoryViews { public static final int constructor = 0xc64c0b97; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); views_count = stream.readInt32(exception); reactions_count = stream.readInt32(exception); if ((flags & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - recent_viewers.add(stream.readInt64(exception)); - } + recent_viewers = Vector.deserializeLong(stream, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32(views_count); stream.writeInt32(reactions_count); if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = recent_viewers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(recent_viewers.get(a)); - } + Vector.serializeLong(stream, recent_viewers); } } } @@ -2381,7 +1738,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_storyViews extends StoryViews { public static final int constructor = 0x8d595cd6; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); has_viewers = (flags & 2) != 0; views_count = stream.readInt32(exception); @@ -2389,41 +1746,17 @@ public void readParams(AbstractSerializedData stream, boolean exception) { forwards_count = stream.readInt32(exception); } if ((flags & 8) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.ReactionCount object = TLRPC.ReactionCount.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - reactions.add(object); - } + reactions = Vector.deserialize(stream, TLRPC.ReactionCount::TLdeserialize, exception); } if ((flags & 16) != 0) { reactions_count = stream.readInt32(exception); } if ((flags & 1) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - recent_viewers.add(stream.readInt64(exception)); - } + recent_viewers = Vector.deserializeLong(stream, exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = has_viewers ? (flags | 2) : (flags & ~2); stream.writeInt32(flags); @@ -2432,23 +1765,13 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeInt32(forwards_count); } if ((flags & 8) != 0) { - stream.writeInt32(0x1cb5c415); - int count = reactions.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - reactions.get(a).serializeToStream(stream); - } + Vector.serialize(stream, reactions); } if ((flags & 16) != 0) { stream.writeInt32(reactions_count); } if ((flags & 1) != 0) { - stream.writeInt32(0x1cb5c415); - int count = recent_viewers.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt64(recent_viewers.get(a)); - } + Vector.serializeLong(stream, recent_viewers); } } } @@ -2459,12 +1782,12 @@ public static class TL_publicForwardStory extends TL_stats.PublicForward { public TLRPC.Peer peer; public StoryItem story; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer = TLRPC.Peer.TLdeserialize(stream, stream.readInt32(exception), exception); story = StoryItem.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); story.serializeToStream(stream); @@ -2479,7 +1802,7 @@ public static class StoryFwdHeader extends TLObject { public String from_name; public int story_id; - public static StoryFwdHeader TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static StoryFwdHeader TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { StoryFwdHeader result = null; switch (constructor) { case TL_storyFwdHeader.constructor: @@ -2500,7 +1823,7 @@ public static class TL_storyFwdHeader extends StoryFwdHeader { public static final int constructor = 0xb826e150; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); modified = (flags & 8) != 0; if ((flags & 1) != 0) { @@ -2515,7 +1838,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = modified ? (flags | 8) : (flags &~ 8); stream.writeInt32(flags); @@ -2534,7 +1857,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_storyItem extends StoryItem { public static final int constructor = 0x79b26a24; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); pinned = (flags & 32) != 0; isPublic = (flags & 128) != 0; @@ -2558,56 +1881,14 @@ public void readParams(AbstractSerializedData stream, boolean exception) { caption = stream.readString(exception); } if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.MessageEntity object = TLRPC.MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, TLRPC.MessageEntity::TLdeserialize, exception); } media = TLRPC.MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 16384) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MediaArea object = MediaArea.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - media_areas.add(object); - } + media_areas = Vector.deserialize(stream, MediaArea::TLdeserialize, exception); } if ((flags & 4) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.PrivacyRule object = TLRPC.PrivacyRule.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - privacy.add(object); - } + privacy = Vector.deserialize(stream, TLRPC.PrivacyRule::TLdeserialize, exception); } if ((flags & 8) != 0) { views = StoryViews.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -2617,7 +1898,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = pinned ? (flags | 32) : (flags &~ 32); flags = isPublic ? (flags | 128) : (flags &~ 128); @@ -2642,29 +1923,14 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeString(caption); } if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } media.serializeToStream(stream); if ((flags & 16384) != 0) { - stream.writeInt32(0x1cb5c415); - int count = media_areas.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - media_areas.get(a).serializeToStream(stream); - } + Vector.serialize(stream, media_areas); } if ((flags & 4) != 0) { - stream.writeInt32(0x1cb5c415); - int count = privacy.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - privacy.get(a).serializeToStream(stream); - } + Vector.serialize(stream, privacy); } if ((flags & 8) != 0) { views.serializeToStream(stream); @@ -2678,7 +1944,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_storyItem_layer174 extends TL_storyItem { public static final int constructor = 0xaf6365a1; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); pinned = (flags & 32) != 0; isPublic = (flags & 128) != 0; @@ -2699,56 +1965,14 @@ public void readParams(AbstractSerializedData stream, boolean exception) { caption = stream.readString(exception); } if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.MessageEntity object = TLRPC.MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, TLRPC.MessageEntity::TLdeserialize, exception); } media = TLRPC.MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 16384) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MediaArea object = MediaArea.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - media_areas.add(object); - } + media_areas = Vector.deserialize(stream, MediaArea::TLdeserialize, exception); } if ((flags & 4) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.PrivacyRule object = TLRPC.PrivacyRule.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - privacy.add(object); - } + privacy = Vector.deserialize(stream, TLRPC.PrivacyRule::TLdeserialize, exception); } if ((flags & 8) != 0) { views = StoryViews.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -2758,7 +1982,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = pinned ? (flags | 32) : (flags &~ 32); flags = isPublic ? (flags | 128) : (flags &~ 128); @@ -2780,29 +2004,14 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeString(caption); } if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } media.serializeToStream(stream); if ((flags & 16384) != 0) { - stream.writeInt32(0x1cb5c415); - int count = media_areas.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - media_areas.get(a).serializeToStream(stream); - } + Vector.serialize(stream, media_areas); } if ((flags & 4) != 0) { - stream.writeInt32(0x1cb5c415); - int count = privacy.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - privacy.get(a).serializeToStream(stream); - } + Vector.serialize(stream, privacy); } if ((flags & 8) != 0) { views.serializeToStream(stream); @@ -2816,7 +2025,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_storyItem_layer166 extends TL_storyItem { public static final int constructor = 0x44c457ce; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); pinned = (flags & 32) != 0; isPublic = (flags & 128) != 0; @@ -2834,56 +2043,14 @@ public void readParams(AbstractSerializedData stream, boolean exception) { caption = stream.readString(exception); } if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.MessageEntity object = TLRPC.MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, TLRPC.MessageEntity::TLdeserialize, exception); } media = TLRPC.MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 16384) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - MediaArea object = MediaArea.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - media_areas.add(object); - } + media_areas = Vector.deserialize(stream, MediaArea::TLdeserialize, exception); } if ((flags & 4) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.PrivacyRule object = TLRPC.PrivacyRule.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - privacy.add(object); - } + privacy = Vector.deserialize(stream, TLRPC.PrivacyRule::TLdeserialize, exception); } if ((flags & 8) != 0) { views = StoryViews.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -2893,7 +2060,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = pinned ? (flags | 32) : (flags &~ 32); flags = isPublic ? (flags | 128) : (flags &~ 128); @@ -2912,29 +2079,14 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeString(caption); } if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } media.serializeToStream(stream); if ((flags & 16384) != 0) { - stream.writeInt32(0x1cb5c415); - int count = media_areas.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - media_areas.get(a).serializeToStream(stream); - } + Vector.serialize(stream, media_areas); } if ((flags & 4) != 0) { - stream.writeInt32(0x1cb5c415); - int count = privacy.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - privacy.get(a).serializeToStream(stream); - } + Vector.serialize(stream, privacy); } if ((flags & 8) != 0) { views.serializeToStream(stream); @@ -2948,7 +2100,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_storyItem_layer160 extends TL_storyItem { public static final int constructor = 0x562aa637; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); pinned = (flags & 32) != 0; isPublic = (flags & 128) != 0; @@ -2965,46 +2117,18 @@ public void readParams(AbstractSerializedData stream, boolean exception) { caption = stream.readString(exception); } if ((flags & 2) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.MessageEntity object = TLRPC.MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - entities.add(object); - } + entities = Vector.deserialize(stream, TLRPC.MessageEntity::TLdeserialize, exception); } media = TLRPC.MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception); if ((flags & 4) != 0) { - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.PrivacyRule object = TLRPC.PrivacyRule.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - privacy.add(object); - } + privacy = Vector.deserialize(stream, TLRPC.PrivacyRule::TLdeserialize, exception); } if ((flags & 8) != 0) { views = StoryViews.TLdeserialize(stream, stream.readInt32(exception), exception); } } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = pinned ? (flags | 32) : (flags &~ 32); flags = isPublic ? (flags | 128) : (flags &~ 128); @@ -3022,21 +2146,11 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeString(caption); } if ((flags & 2) != 0) { - stream.writeInt32(0x1cb5c415); - int count = entities.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - entities.get(a).serializeToStream(stream); - } + Vector.serialize(stream, entities); } media.serializeToStream(stream); if ((flags & 4) != 0) { - stream.writeInt32(0x1cb5c415); - int count = privacy.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - privacy.get(a).serializeToStream(stream); - } + Vector.serialize(stream, privacy); } if ((flags & 8) != 0) { views.serializeToStream(stream); @@ -3047,11 +2161,11 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_storyItemDeleted extends StoryItem { public static final int constructor = 0x51e6ee4f; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(id); } @@ -3060,7 +2174,7 @@ public void serializeToStream(AbstractSerializedData stream) { public static class TL_storyItemSkipped extends StoryItem { public static final int constructor = 0xffadc913; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); close_friends = (flags & 256) != 0; id = stream.readInt32(exception); @@ -3068,7 +2182,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { expire_date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = close_friends ? (flags | 256) : (flags &~ 256); stream.writeInt32(flags); @@ -3088,7 +2202,7 @@ public static class MediaAreaCoordinates extends TLObject { public double rotation; public double radius; - public static MediaAreaCoordinates TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static MediaAreaCoordinates TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { MediaAreaCoordinates result = null; switch (constructor) { case TL_mediaAreaCoordinates.constructor: @@ -3112,7 +2226,7 @@ public static class TL_mediaAreaCoordinates extends MediaAreaCoordinates { public static final int constructor = 0xcfc9e002; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); x = stream.readDouble(exception); y = stream.readDouble(exception); @@ -3125,7 +2239,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeDouble(x); @@ -3143,7 +2257,7 @@ public static class TL_mediaAreaCoordinates_layer181 extends MediaAreaCoordinate public static final int constructor = 0x3d1ea4e; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { x = stream.readDouble(exception); y = stream.readDouble(exception); w = stream.readDouble(exception); @@ -3152,7 +2266,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeDouble(x); stream.writeDouble(y); @@ -3169,12 +2283,15 @@ public static class MediaArea extends TLObject { public boolean dark; public boolean flipped; - public static MediaArea TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static MediaArea TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { MediaArea result = null; switch (constructor) { case TL_mediaAreaUrl.constructor: result = new TL_mediaAreaUrl(); break; + case TL_mediaAreaStarGift.constructor: + result = new TL_mediaAreaStarGift(); + break; case TL_mediaAreaVenue.constructor: result = new TL_mediaAreaVenue(); break; @@ -3219,7 +2336,7 @@ public static MediaArea TLdeserialize(AbstractSerializedData stream, int constru public static class TL_mediaAreaSuggestedReaction extends MediaArea { public static final int constructor = 0x14455871; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); dark = (flags & 1) != 0; flipped = (flags & 2) != 0; @@ -3227,7 +2344,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { reaction = TLRPC.Reaction.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = dark ? (flags | 1) : (flags &~ 1); flags = flipped ? (flags | 2) : (flags &~ 2); @@ -3243,13 +2360,13 @@ public static class TL_mediaAreaChannelPost extends MediaArea { public long channel_id; public int msg_id; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { coordinates = MediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception); channel_id = stream.readInt64(exception); msg_id = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); coordinates.serializeToStream(stream); stream.writeInt64(channel_id); @@ -3268,7 +2385,7 @@ public static class TL_mediaAreaVenue extends MediaArea { public String venue_type; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { coordinates = MediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception); geo = TLRPC.GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); title = stream.readString(exception); @@ -3279,7 +2396,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); coordinates.serializeToStream(stream); geo.serializeToStream(stream); @@ -3298,19 +2415,38 @@ public static class TL_mediaAreaUrl extends MediaArea { public String url; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { coordinates = MediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception); url = stream.readString(exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); coordinates.serializeToStream(stream); stream.writeString(url); } } + public static class TL_mediaAreaStarGift extends MediaArea { + public static final int constructor = 0x5787686d; + + public String slug; + + @Override + public void readParams(InputSerializedData stream, boolean exception) { + coordinates = MediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception); + slug = stream.readString(exception); + } + + @Override + public void serializeToStream(OutputSerializedData stream) { + stream.writeInt32(constructor); + coordinates.serializeToStream(stream); + stream.writeString(slug); + } + } + public static class TL_mediaAreaWeather2 extends MediaArea { public static final int constructor = 0x855f223e; @@ -3318,7 +2454,7 @@ public static class TL_mediaAreaWeather2 extends MediaArea { public int temperature_c; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); dark = (flags & 1) != 0; coordinates = MediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -3327,7 +2463,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = dark ? flags | 1 : flags &~ 1; stream.writeInt32(flags); @@ -3345,7 +2481,7 @@ public static class TL_mediaAreaWeather extends MediaArea { public int color; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { coordinates = MediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception); emoji = stream.readString(exception); temperature_c = stream.readDouble(exception); @@ -3353,7 +2489,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); coordinates.serializeToStream(stream); stream.writeString(emoji); @@ -3369,7 +2505,7 @@ public static class TL_mediaAreaWeatherOld extends MediaArea { public double temperature_c; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); dark = (flags & 1) != 0; coordinates = MediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -3378,7 +2514,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = dark ? flags | 1 : flags &~ 1; stream.writeInt32(flags); @@ -3395,14 +2531,14 @@ public static class TL_inputMediaAreaVenue extends MediaArea { public String result_id; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { coordinates = MediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception); query_id = stream.readInt64(exception); result_id = stream.readString(exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); coordinates.serializeToStream(stream); stream.writeInt64(query_id); @@ -3417,14 +2553,14 @@ public static class TL_inputMediaAreaChannelPost extends MediaArea { public int msg_id; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { coordinates = MediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception); channel = TLRPC.InputChannel.TLdeserialize(stream, stream.readInt32(exception), exception); msg_id = stream.readInt32(exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); coordinates.serializeToStream(stream); channel.serializeToStream(stream); @@ -3447,7 +2583,7 @@ public String toString() { return "geo{country=" + country_iso2 + ", " + (state != null ? "state=" + state + ", " : "") + (city != null ? "city=" + city + ", " : "") + (street != null ? "street=" + street : "") + "}"; } - public static TL_geoPointAddress TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_geoPointAddress TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_geoPointAddress.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_geoPointAddress", constructor)); @@ -3461,7 +2597,7 @@ public static TL_geoPointAddress TLdeserialize(AbstractSerializedData stream, in } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); country_iso2 = stream.readString(exception); if ((flags & 1) != 0) { @@ -3476,7 +2612,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(country_iso2); @@ -3499,7 +2635,7 @@ public static class TL_mediaAreaGeoPoint extends MediaArea { public TL_geoPointAddress address; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); coordinates = MediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception); geo = TLRPC.GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -3509,7 +2645,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); coordinates.serializeToStream(stream); @@ -3524,13 +2660,13 @@ public static class TL_mediaAreaGeoPoint_layer181 extends TL_mediaAreaGeoPoint { public static final int constructor = 0xdf8b3b22; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { coordinates = MediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception); geo = TLRPC.GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); coordinates.serializeToStream(stream); geo.serializeToStream(stream); @@ -3544,7 +2680,7 @@ public static class PrepaidGiveaway extends TLObject { public int date; public int boosts; - public static PrepaidGiveaway TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static PrepaidGiveaway TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { PrepaidGiveaway result = null; switch (constructor) { case TL_prepaidGiveaway.constructor: @@ -3569,7 +2705,7 @@ public static class TL_prepaidStarsGiveaway extends PrepaidGiveaway { public long stars; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); stars = stream.readInt64(exception); quantity = stream.readInt32(exception); @@ -3577,7 +2713,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt64(stars); @@ -3592,14 +2728,14 @@ public static class TL_prepaidGiveaway extends PrepaidGiveaway { public int months; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); months = stream.readInt32(exception); quantity = stream.readInt32(exception); date = stream.readInt32(exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(id); stream.writeInt32(months); @@ -3614,7 +2750,7 @@ public static class TL_stats_storyStats extends TLObject { public TL_stats.StatsGraph views_graph; public TL_stats.StatsGraph reactions_by_emotion_graph; - public static TL_stats_storyStats TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_stats_storyStats TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_stats_storyStats.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_stats_storyStats", constructor)); @@ -3627,12 +2763,12 @@ public static TL_stats_storyStats TLdeserialize(AbstractSerializedData stream, i return result; } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { views_graph = TL_stats.StatsGraph.TLdeserialize(stream, stream.readInt32(exception), exception); reactions_by_emotion_graph = TL_stats.StatsGraph.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); views_graph.serializeToStream(stream); reactions_by_emotion_graph.serializeToStream(stream); @@ -3647,11 +2783,11 @@ public static class TL_stats_getStoryStats extends TLObject { public TLRPC.InputPeer peer; public int id; - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_stats_storyStats.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = dark ? (flags | 1) : (flags & ~1); stream.writeInt32(flags); @@ -3666,7 +2802,7 @@ public static class StoryReaction extends TLObject { public StoryItem story; public TLRPC.Message message; - public static StoryReaction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static StoryReaction TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { StoryReaction result = null; switch (constructor) { case TL_storyReaction.constructor: @@ -3693,12 +2829,12 @@ public static class TL_storyReactionPublicForward extends StoryReaction { public final static int constructor = 0xbbab2643; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { message = TLRPC.Message.TLdeserialize(stream, stream.readInt32(exception), exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); message.serializeToStream(stream); } @@ -3708,7 +2844,7 @@ public static class TL_storyReactionPublicRepost extends StoryReaction { public final static int constructor = 0xcfcd0f13; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer_id = TLRPC.Peer.TLdeserialize(stream, stream.readInt32(exception), exception); story = StoryItem.TLdeserialize(stream, stream.readInt32(exception), exception); if (story != null) { @@ -3717,7 +2853,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer_id.serializeToStream(stream); story.serializeToStream(stream); @@ -3731,14 +2867,14 @@ public static class TL_storyReaction extends StoryReaction { public TLRPC.Reaction reaction; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { peer_id = TLRPC.Peer.TLdeserialize(stream, stream.readInt32(exception), exception); date = stream.readInt32(exception); reaction = TLRPC.Reaction.TLdeserialize(stream, stream.readInt32(exception), exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer_id.serializeToStream(stream); stream.writeInt32(date); @@ -3756,7 +2892,7 @@ public static class TL_storyReactionsList extends TLObject { public ArrayList users = new ArrayList<>(); public String next_offset; - public static TL_storyReactionsList TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static TL_storyReactionsList TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (TL_storyReactionsList.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in TL_storyReactionsList", constructor)); @@ -3770,82 +2906,25 @@ public static TL_storyReactionsList TLdeserialize(AbstractSerializedData stream, } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeInt32(count); - stream.writeInt32(0x1cb5c415); - int count = reactions.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - reactions.get(i).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = chats.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - chats.get(i).serializeToStream(stream); - } - stream.writeInt32(0x1cb5c415); - count = users.size(); - stream.writeInt32(count); - for (int i = 0; i < count; ++i) { - users.get(i).serializeToStream(stream); - } + Vector.serialize(stream, reactions); + Vector.serialize(stream, chats); + Vector.serialize(stream, users); if ((flags & 1) != 0) { stream.writeString(next_offset); } } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); count = stream.readInt32(exception); - int magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - int count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - StoryReaction object = StoryReaction.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - reactions.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.Chat object = TLRPC.Chat.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - chats.add(object); - } - magic = stream.readInt32(exception); - if (magic != 0x1cb5c415) { - if (exception) { - throw new RuntimeException(String.format("wrong Vector magic, got %x", magic)); - } - return; - } - count = stream.readInt32(exception); - for (int a = 0; a < count; a++) { - TLRPC.User object = TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception); - if (object == null) { - return; - } - users.add(object); - } + reactions = Vector.deserialize(stream, StoryReaction::TLdeserialize, exception); + chats = Vector.deserialize(stream, TLRPC.Chat::TLdeserialize, exception); + users = Vector.deserialize(stream, TLRPC.User::TLdeserialize, exception); if ((flags & 1) != 0) { next_offset = stream.readString(exception); } @@ -3864,12 +2943,12 @@ public static class TL_getStoryReactionsList extends TLObject { public int limit; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TL_storyReactionsList.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = forwards_first ? (flags | 4) : (flags &~ 4); stream.writeInt32(flags); @@ -3891,19 +2970,14 @@ public static class TL_togglePinnedToTop extends TLObject { public TLRPC.InputPeer peer; public ArrayList id = new ArrayList<>(); - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); peer.serializeToStream(stream); - stream.writeInt32(0x1cb5c415); - int count = id.size(); - stream.writeInt32(count); - for (int a = 0; a < count; a++) { - stream.writeInt32(id.get(a)); - } + Vector.serializeInt(stream, id); } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBar.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBar.java index 04f87e69da..041b66ebeb 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBar.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBar.java @@ -79,7 +79,7 @@ public boolean canOpenMenu() { public ImageView backButtonImageView; private BackupImageView avatarSearchImageView; private Drawable backButtonDrawable; - private SimpleTextView[] titleTextView = new SimpleTextView[2]; + private final SimpleTextView[] titleTextView = new SimpleTextView[2]; private SimpleTextView subtitleTextView; private SimpleTextView additionalSubtitleTextView; private View actionModeTop; @@ -420,6 +420,7 @@ private void createTitleTextView(int i) { } else { titleTextView[i].setTextColor(getThemedColor(Theme.key_actionBarDefaultTitle)); } + titleTextView[i].setEmojiColor(titleTextView[i].getTextColor()); titleTextView[i].setTypeface(AndroidUtilities.bold()); titleTextView[i].setDrawablePadding(dp(4)); titleTextView[i].setPadding(0, dp(8), 0, dp(8)); @@ -474,8 +475,10 @@ public void setTitleColor(int color) { } titleColorToSet = color; titleTextView[0].setTextColor(color); + titleTextView[0].setEmojiColor(color); if (titleTextView[1] != null) { titleTextView[1].setTextColor(color); + titleTextView[1].setEmojiColor(color); } } @@ -522,6 +525,15 @@ public SimpleTextView getTitleTextView() { return titleTextView[0]; } + public Paint.FontMetricsInt getTitleFontMetricsInt() { + if (titleTextView[0] == null) { + TextPaint paint = new TextPaint(Paint.ANTI_ALIAS_FLAG); + paint.setTextSize(dp(!AndroidUtilities.isTablet() && getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? 18 : 20)); + return paint.getFontMetricsInt(); + } + return titleTextView[0].getPaint().getFontMetricsInt(); + } + public SimpleTextView getTitleTextView2() { return titleTextView[1]; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java index cf2473033c..9d7d5577c9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java @@ -2023,7 +2023,9 @@ public void onAnimationEnd(Animator animation) { } }); animatorSet.start(); - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignore) {} fragment.setInPreviewMode(false); fragment.setInMenuMode(false); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenuSubItem.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenuSubItem.java index 11e13af6c4..10c50dc476 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenuSubItem.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenuSubItem.java @@ -22,6 +22,7 @@ import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.LocaleController; +import org.telegram.ui.Components.AnimatedEmojiSpan; import org.telegram.ui.Components.AnimatedTextView; import org.telegram.ui.Components.CheckBox2; import org.telegram.ui.Components.CubicBezierInterpolator; @@ -30,7 +31,7 @@ public class ActionBarMenuSubItem extends FrameLayout { - public TextView textView; + public AnimatedEmojiSpan.TextViewEmojis textView; public TextView subtextView; public RLottieImageView imageView; public boolean checkViewLeft; @@ -84,7 +85,7 @@ public ActionBarMenuSubItem(Context context, int needCheck, boolean top, boolean imageView.setColorFilter(new PorterDuffColorFilter(iconColor, PorterDuff.Mode.MULTIPLY)); addView(imageView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 40, Gravity.CENTER_VERTICAL | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT))); - textView = new TextView(context); + textView = new AnimatedEmojiSpan.TextViewEmojis(context); textView.setLines(1); textView.setSingleLine(true); textView.setGravity(Gravity.LEFT); @@ -110,6 +111,10 @@ public ActionBarMenuSubItem(Context context, int needCheck, boolean top, boolean } } + public void setEmojiCacheType(int cacheType) { + textView.setCacheType(cacheType); + } + @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, View.MeasureSpec.makeMeasureSpec(dp(itemHeight), View.MeasureSpec.EXACTLY)); @@ -312,7 +317,7 @@ public void setSubtext(CharSequence text) { subtextView.setText(text); } - public TextView getTextView() { + public AnimatedEmojiSpan.TextViewEmojis getTextView() { return textView; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarPopupWindow.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarPopupWindow.java index 663acc42e0..03f60d80c5 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarPopupWindow.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarPopupWindow.java @@ -114,7 +114,7 @@ public static class ActionBarPopupWindowLayout extends FrameLayout { private HashMap positions = new HashMap<>(); private int gapStartY = -1000000; private int gapEndY = -1000000; - private Rect bgPaddings = new Rect(); + private final Rect bgPaddings = new Rect(); private onSizeChangedListener onSizeChangedListener; private float reactionsEnterProgress = 1f; @@ -133,6 +133,10 @@ public static class ActionBarPopupWindowLayout extends FrameLayout { public int subtractBackgroundHeight; Rect rect; + public Rect getPadding() { + return bgPaddings; + } + public ActionBarPopupWindowLayout(Context context) { this(context, null); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/AlertDialog.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/AlertDialog.java index a3e32529c7..bc04d16829 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/AlertDialog.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/AlertDialog.java @@ -63,6 +63,7 @@ import org.telegram.messenger.R; import org.telegram.messenger.SharedConfig; import org.telegram.messenger.Utilities; +import org.telegram.messenger.browser.Browser; import org.telegram.ui.Components.AnimatedEmojiDrawable; import org.telegram.ui.Components.AnimatedFloat; import org.telegram.ui.Components.AttachableDrawable; @@ -144,17 +145,21 @@ public class AlertDialog extends Dialog implements Drawable.Callback, Notificati private boolean notDrawBackgroundOnTopView; private RLottieImageView topImageView; private CharSequence positiveButtonText; - private OnClickListener positiveButtonListener; + private OnButtonClickListener positiveButtonListener; private CharSequence negativeButtonText; - private OnClickListener negativeButtonListener; + private OnButtonClickListener negativeButtonListener; private CharSequence neutralButtonText; - private OnClickListener neutralButtonListener; + private OnButtonClickListener neutralButtonListener; protected ViewGroup buttonsLayout; private LineProgressView lineProgressView; private TextView lineProgressViewPercent; - private OnClickListener onBackButtonListener; + private OnButtonClickListener onBackButtonListener; private int[] containerViewLocation = new int[2]; + public interface OnButtonClickListener { + void onClick(AlertDialog dialog, int which); + } + private boolean checkFocusable = true; private Drawable shadowDrawable; @@ -960,7 +965,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { } }; } - if(bottomView != null) { + if (bottomView != null) { buttonsLayout.setPadding(AndroidUtilities.dp(16), 0, AndroidUtilities.dp(16), AndroidUtilities.dp(4)); buttonsLayout.setTranslationY(-AndroidUtilities.dp(6)); } else { @@ -972,7 +977,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { } if (positiveButtonText != null) { - TextView textView = new TextView(getContext()) { + TextViewWithLoading textView = new TextViewWithLoading(getContext()) { @Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); @@ -991,9 +996,7 @@ public void setTextColor(int color) { textView.setTextColor(getThemedColor(dialogButtonColorKey)); textView.setGravity(Gravity.CENTER); textView.setTypeface(AndroidUtilities.bold()); -// textView.setLines(1); -// textView.setSingleLine(true); //TODO - textView.setText(positiveButtonText.toString()); + textView.setText(positiveButtonText); textView.setBackgroundDrawable(Theme.getRoundRectSelectorDrawable(AndroidUtilities.dp(6), getThemedColor(dialogButtonColorKey))); textView.setPadding(AndroidUtilities.dp(12), 0, AndroidUtilities.dp(12), 0); if (verticalButtons) { @@ -1002,6 +1005,7 @@ public void setTextColor(int color) { buttonsLayout.addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 36, Gravity.TOP | Gravity.RIGHT)); } textView.setOnClickListener(v -> { + if (textView.isLoading()) return; if (positiveButtonListener != null) { positiveButtonListener.onClick(AlertDialog.this, Dialog.BUTTON_POSITIVE); } @@ -1012,7 +1016,7 @@ public void setTextColor(int color) { } if (negativeButtonText != null) { - TextView textView = new TextView(getContext()) { + TextViewWithLoading textView = new TextViewWithLoading(getContext()) { @Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); @@ -1042,6 +1046,7 @@ public void setTextColor(int color) { buttonsLayout.addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 36, Gravity.TOP | Gravity.RIGHT)); } textView.setOnClickListener(v -> { + if (textView.isLoading()) return; if (negativeButtonListener != null) { negativeButtonListener.onClick(AlertDialog.this, Dialog.BUTTON_NEGATIVE); } @@ -1052,7 +1057,7 @@ public void setTextColor(int color) { } if (neutralButtonText != null) { - TextView textView = new TextView(getContext()) { + TextViewWithLoading textView = new TextViewWithLoading(getContext()) { @Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); @@ -1082,6 +1087,7 @@ public void setTextColor(int color) { buttonsLayout.addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 36, Gravity.TOP | Gravity.LEFT)); } textView.setOnClickListener(v -> { + if (textView.isLoading()) return; if (neutralButtonListener != null) { neutralButtonListener.onClick(AlertDialog.this, Dialog.BUTTON_NEGATIVE); } @@ -1175,6 +1181,22 @@ public void setTextColor(int color) { return containerView; } + @NonNull + public Browser.Progress makeButtonLoading(int type) { + final View button = getButton(type); + dismissDialogByButtons = false; + return new Browser.Progress(() -> { + if (button instanceof TextViewWithLoading) { + ((TextViewWithLoading) button).setLoading(true, true); + } + }, () -> { + if (button instanceof TextViewWithLoading) { + ((TextViewWithLoading) button).setLoading(false, true); + } + dismiss(); + }); + } + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -1428,17 +1450,17 @@ public void setSecondTitle(CharSequence text) { secondTitle = text; } - public void setPositiveButton(CharSequence text, final OnClickListener listener) { + public void setPositiveButton(CharSequence text, final OnButtonClickListener listener) { positiveButtonText = text; positiveButtonListener = listener; } - public void setNegativeButton(CharSequence text, final OnClickListener listener) { + public void setNegativeButton(CharSequence text, final OnButtonClickListener listener) { negativeButtonText = text; negativeButtonListener = listener; } - public void setNeutralButton(CharSequence text, final OnClickListener listener) { + public void setNeutralButton(CharSequence text, final OnButtonClickListener listener) { neutralButtonText = text; neutralButtonListener = listener; } @@ -1472,7 +1494,7 @@ public void setMessageTextViewClickable(boolean value) { messageTextViewClickable = value; } - public void setButton(int type, CharSequence text, final OnClickListener listener) { + public void setButton(int type, CharSequence text, final OnButtonClickListener listener) { switch (type) { case BUTTON_NEUTRAL: neutralButtonText = text; @@ -1522,7 +1544,7 @@ public void setOnCancelListener(OnCancelListener listener) { super.setOnCancelListener(listener); } - public void setPositiveButtonListener(final OnClickListener listener) { + public void setPositiveButtonListener(final OnButtonClickListener listener) { positiveButtonListener = listener; } @@ -1679,25 +1701,25 @@ public Builder setMessage(CharSequence message) { return this; } - public Builder setPositiveButton(CharSequence text, final OnClickListener listener) { + public Builder setPositiveButton(CharSequence text, final OnButtonClickListener listener) { alertDialog.positiveButtonText = text; alertDialog.positiveButtonListener = listener; return this; } - public Builder setNegativeButton(CharSequence text, final OnClickListener listener) { + public Builder setNegativeButton(CharSequence text, final OnButtonClickListener listener) { alertDialog.negativeButtonText = text; alertDialog.negativeButtonListener = listener; return this; } - public Builder setNeutralButton(CharSequence text, final OnClickListener listener) { + public Builder setNeutralButton(CharSequence text, final OnButtonClickListener listener) { alertDialog.neutralButtonText = text; alertDialog.neutralButtonListener = listener; return this; } - public Builder setOnBackButtonListener(final OnClickListener listener) { + public Builder setOnBackButtonListener(final OnButtonClickListener listener) { alertDialog.onBackButtonListener = listener; return this; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheet.java index 63f636647c..09d96c89b4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheet.java @@ -8,6 +8,8 @@ package org.telegram.ui.ActionBar; +import static org.telegram.messenger.AndroidUtilities.dp; + import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; @@ -67,6 +69,7 @@ import org.telegram.messenger.Utilities; import org.telegram.messenger.camera.CameraView; import org.telegram.tgnet.TLRPC; +import org.telegram.ui.Components.AnimatedEmojiSpan; import org.telegram.ui.Components.AnimationProperties; import org.telegram.ui.Components.Bulletin; import org.telegram.ui.Components.CubicBezierInterpolator; @@ -89,8 +92,10 @@ public class BottomSheet extends Dialog implements BaseFragment.AttachedSheet { public boolean drawDoubleNavigationBar; public boolean scrollNavBar; public boolean occupyNavigationBar; + public boolean occupyNavigationBarWithoutKeyboard; protected boolean waitingKeyboard; public FrameLayout topBulletinContainer; + protected int navigationBarHeight; protected boolean useSmoothKeyboard; @@ -319,6 +324,7 @@ private void checkDismiss(float velX, float velY) { dismiss(); allowCustomAnimation = allowOld; } else { + maybeStartTracking = false; currentAnimation = new AnimatorSet(); ValueAnimator invalidateContainer = ValueAnimator.ofFloat(0, 1); invalidateContainer.addUpdateListener(a -> { @@ -351,6 +357,7 @@ private void cancelCurrentAnimation() { currentAnimation.cancel(); currentAnimation = null; } + onSwipeStarts(); } private float y = 0f; @@ -523,7 +530,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (rect.bottom != 0 && rect.top != 0) { int usableViewHeight = (int) (rootView.getHeight() - (rect.top != 0 ? AndroidUtilities.statusBarHeight * (1f - hideSystemVerticalInsetsProgress) : 0) - AndroidUtilities.getViewInset(rootView) * (1f - hideSystemVerticalInsetsProgress)); keyboardHeight = Math.max(0, usableViewHeight - (rect.bottom - rect.top)); - if (keyboardHeight < AndroidUtilities.dp(20)) { + if (keyboardHeight < dp(20)) { keyboardHeight = 0; } else { lastKeyboardHeight = keyboardHeight; @@ -535,7 +542,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (oldKeyboardHeight != keyboardHeight) { keyboardChanged = true; } - keyboardVisible = keyboardHeight > AndroidUtilities.dp(20); + keyboardVisible = keyboardHeight > dp(20); if (lastInsets != null && Build.VERSION.SDK_INT >= 21) { bottomInset = lastInsets.getSystemWindowInsetBottom(); leftInset = lastInsets.getSystemWindowInsetLeft(); @@ -546,17 +553,21 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (keyboardVisible && rect.bottom != 0 && rect.top != 0) { bottomInset -= keyboardHeight; } - if (!drawNavigationBar && !occupyNavigationBar) { + if (!drawNavigationBar && !occupyNavigationBar && !occupyNavigationBarWithoutKeyboard) { containerHeight -= getBottomInset(); } } setMeasuredDimension(width, containerHeight); + navigationBarHeight = 0; if (lastInsets != null && Build.VERSION.SDK_INT >= 21 && !occupyNavigationBar) { int inset = (int) (lastInsets.getSystemWindowInsetBottom() * (1f - hideSystemVerticalInsetsProgress)); if (Build.VERSION.SDK_INT >= 29) { inset += getAdditionalMandatoryOffsets(); } - height -= inset; + if (!occupyNavigationBarWithoutKeyboard || inset > AndroidUtilities.navigationBarHeight + dp(10)) { + height -= inset; + } + navigationBarHeight = Math.min(inset, AndroidUtilities.navigationBarHeight); } if (lastInsets != null && Build.VERSION.SDK_INT >= 21) { width -= getRightInset() + getLeftInset(); @@ -854,7 +865,7 @@ public void drawNavigationBar(Canvas canvas, float alpha) { } protected int getBottomSheetWidth(boolean isPortrait, int width,int height) { - return isPortrait ? width : (int) Math.max(width * 0.8f, Math.min(AndroidUtilities.dp(480), width)); + return isPortrait ? width : (int) Math.max(width * 0.8f, Math.min(dp(480), width)); } protected boolean shouldOverlayCameraViewOverNavBar() { @@ -916,7 +927,7 @@ public boolean canDismiss() { public static class BottomSheetCell extends FrameLayout { private final Theme.ResourcesProvider resourcesProvider; - private TextView textView; + private AnimatedEmojiSpan.TextViewEmojis textView; private ImageView imageView; private ImageView imageView2; int currentType; @@ -945,7 +956,7 @@ public BottomSheetCell(Context context, int type, Theme.ResourcesProvider resour imageView2.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_radioBackgroundChecked, resourcesProvider), PorterDuff.Mode.SRC_IN)); addView(imageView2, LayoutHelper.createFrame(56, 48, Gravity.CENTER_VERTICAL | (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT))); - textView = new TextView(context); + textView = new AnimatedEmojiSpan.TextViewEmojis(context); textView.setLines(1); textView.setSingleLine(true); textView.setGravity(Gravity.CENTER_HORIZONTAL); @@ -976,7 +987,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (currentType == 0) { widthMeasureSpec = MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY); } - super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(height), MeasureSpec.EXACTLY)); + super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(dp(height), MeasureSpec.EXACTLY)); } public void setTextColor(int color) { @@ -1009,15 +1020,15 @@ public void setTextAndIcon(CharSequence text, int icon, Drawable drawable, boole } imageView.setVisibility(VISIBLE); if (bigTitle) { - textView.setPadding(AndroidUtilities.dp(LocaleController.isRTL ? 21 : 72), 0, AndroidUtilities.dp(LocaleController.isRTL ? 72 : 21), 0); - imageView.setPadding(LocaleController.isRTL ? 0 : AndroidUtilities.dp(5), 0, LocaleController.isRTL ? AndroidUtilities.dp(5) : 5, 0); + textView.setPadding(dp(LocaleController.isRTL ? 21 : 72), 0, dp(LocaleController.isRTL ? 72 : 21), 0); + imageView.setPadding(LocaleController.isRTL ? 0 : dp(5), 0, LocaleController.isRTL ? dp(5) : 5, 0); } else { - textView.setPadding(AndroidUtilities.dp(LocaleController.isRTL ? 16 : 72), 0, AndroidUtilities.dp(LocaleController.isRTL ? 72 : 16), 0); + textView.setPadding(dp(LocaleController.isRTL ? 16 : 72), 0, dp(LocaleController.isRTL ? 72 : 16), 0); imageView.setPadding(0, 0, 0, 0); } } else { imageView.setVisibility(INVISIBLE); - textView.setPadding(AndroidUtilities.dp(bigTitle ? 21 : 16), 0, AndroidUtilities.dp(bigTitle ? 21 : 16), 0); + textView.setPadding(dp(bigTitle ? 21 : 16), 0, dp(bigTitle ? 21 : 16), 0); } } @@ -1030,7 +1041,7 @@ public boolean isChecked() { return checked; } - public TextView getTextView() { + public AnimatedEmojiSpan.TextViewEmojis getTextView() { return textView; } @@ -1125,6 +1136,8 @@ protected void onDetachedFromWindow() { Bulletin.removeDelegate(this); } }; + container.setClipChildren(false); + container.setClipToPadding(false); container.setBackground(backDrawable); focusable = needFocus; if (Build.VERSION.SDK_INT >= 21) { @@ -1232,7 +1245,7 @@ public void setTranslationY(float translationY) { } }; containerView.setBackgroundDrawable(shadowDrawable); - containerView.setPadding(backgroundPaddingLeft, (applyTopPadding ? AndroidUtilities.dp(8) : 0) + backgroundPaddingTop - 1, backgroundPaddingLeft, (applyBottomPadding ? AndroidUtilities.dp(8) : 0)); + containerView.setPadding(backgroundPaddingLeft, (applyTopPadding ? dp(8) : 0) + backgroundPaddingTop - 1, backgroundPaddingLeft, (applyBottomPadding ? dp(8) : 0)); } containerView.setVisibility(View.INVISIBLE); container.addView(containerView, 0, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM)); @@ -1257,7 +1270,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { View child = containerView.getChildAt(i); if (child instanceof BottomSheetCell) { ((ViewGroup.MarginLayoutParams) child.getLayoutParams()).topMargin = topOffset; - topOffset += AndroidUtilities.dp(48); + topOffset += dp(48); } } } @@ -1270,11 +1283,11 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { titleView.setTextColor(getThemedColor(Theme.key_dialogTextBlack)); titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); titleView.setTypeface(AndroidUtilities.bold()); - titleView.setPadding(AndroidUtilities.dp(21), AndroidUtilities.dp(multipleLinesTitle ? 14 : 6), AndroidUtilities.dp(21), AndroidUtilities.dp(8)); + titleView.setPadding(dp(21), dp(multipleLinesTitle ? 14 : 6), dp(21), dp(8)); } else { titleView.setTextColor(getThemedColor(Theme.key_dialogTextGray2)); titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); - titleView.setPadding(AndroidUtilities.dp(16), AndroidUtilities.dp(multipleLinesTitle ? 8 : 0), AndroidUtilities.dp(16), AndroidUtilities.dp(8)); + titleView.setPadding(dp(16), dp(multipleLinesTitle ? 8 : 0), dp(16), dp(8)); } if (multipleLinesTitle) { titleView.setSingleLine(false); @@ -1301,7 +1314,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { container.setClipToPadding(false); container.setClipChildren(false); containerView.addView(customView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, customViewGravity, 0, topOffset, 0, 0)); - ((ViewGroup.MarginLayoutParams) customView.getLayoutParams()).topMargin = -backgroundPaddingTop + AndroidUtilities.dp(topOffset); + ((ViewGroup.MarginLayoutParams) customView.getLayoutParams()).topMargin = -backgroundPaddingTop + dp(topOffset); } else { containerView.addView(customView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, customViewGravity, 0, topOffset, 0, 0)); } @@ -1562,11 +1575,11 @@ private void startOpenAnimation() { container.setLayerType(View.LAYER_TYPE_HARDWARE, null); } if (transitionFromRight) { - containerView.setTranslationX(AndroidUtilities.dp(48)); + containerView.setTranslationX(dp(48)); containerView.setAlpha(0); containerView.setTranslationY(0); } else { - containerView.setTranslationY(getContainerViewHeight() + keyboardHeight + AndroidUtilities.dp(10) + (scrollNavBar ? Math.max(0, Math.min(AndroidUtilities.navigationBarHeight, getBottomInset())) : 0)); + containerView.setTranslationY(getContainerViewHeight() + keyboardHeight + dp(10) + (scrollNavBar ? Math.max(0, Math.min(AndroidUtilities.navigationBarHeight, getBottomInset())) : 0)); } currentSheetAnimationType = 1; if (navigationBarAnimation != null) { @@ -1710,7 +1723,7 @@ public void dismissWithButtonClick(final int item) { currentSheetAnimationType = 2; currentSheetAnimation = new AnimatorSet(); currentSheetAnimation.playTogether( - ObjectAnimator.ofFloat(containerView, View.TRANSLATION_Y, getContainerViewHeight() + keyboardHeight + AndroidUtilities.dp(10) + (scrollNavBar ? Math.max(0, Math.min(AndroidUtilities.navigationBarHeight, getBottomInset())) : 0)), + ObjectAnimator.ofFloat(containerView, View.TRANSLATION_Y, getContainerViewHeight() + keyboardHeight + dp(10) + (scrollNavBar ? Math.max(0, Math.min(AndroidUtilities.navigationBarHeight, getBottomInset())) : 0)), ObjectAnimator.ofInt(backDrawable, AnimationProperties.COLOR_DRAWABLE_ALPHA, 0) ); currentSheetAnimation.setDuration(cellType == Builder.CELL_TYPE_CALL ? 330 : 180); @@ -1847,10 +1860,10 @@ public void dismiss() { ArrayList animators = new ArrayList<>(); if (containerView != null) { if (transitionFromRight) { - animators.add(ObjectAnimator.ofFloat(containerView, View.TRANSLATION_X, AndroidUtilities.dp(48))); + animators.add(ObjectAnimator.ofFloat(containerView, View.TRANSLATION_X, dp(48))); animators.add(ObjectAnimator.ofFloat(containerView, View.ALPHA, 0)); } else { - animators.add(ObjectAnimator.ofFloat(containerView, View.TRANSLATION_Y, getContainerViewHeight() + (forceKeyboardOnDismiss ? lastKeyboardHeight : keyboardHeight) + AndroidUtilities.dp(10) + (scrollNavBar ? Math.max(0, Math.min(AndroidUtilities.navigationBarHeight, getBottomInset())) : 0))); + animators.add(ObjectAnimator.ofFloat(containerView, View.TRANSLATION_Y, getContainerViewHeight() + (forceKeyboardOnDismiss ? lastKeyboardHeight : keyboardHeight) + dp(10) + (scrollNavBar ? Math.max(0, Math.min(AndroidUtilities.navigationBarHeight, getBottomInset())) : 0))); } } animators.add(ObjectAnimator.ofInt(backDrawable, AnimationProperties.COLOR_DRAWABLE_ALPHA, 0)); @@ -1943,7 +1956,7 @@ public int getNavigationBarColor(int color) { } else if (transitionFromRight) { t = containerView.getAlpha(); } else { - final float fullHeight = getContainerViewHeight() + keyboardHeight + AndroidUtilities.dp(10) + (scrollNavBar ? Math.max(0, Math.min(AndroidUtilities.navigationBarHeight, getBottomInset())) : 0); + final float fullHeight = getContainerViewHeight() + keyboardHeight + dp(10) + (scrollNavBar ? Math.max(0, Math.min(AndroidUtilities.navigationBarHeight, getBottomInset())) : 0); t = Utilities.clamp01(1f - containerView.getTranslationY() / fullHeight); } return ColorUtils.blendARGB(color, navBarColor, t); @@ -2284,4 +2297,9 @@ public void onBackPressed() { } } + public Theme.ResourcesProvider getResourcesProvider() { + return resourcesProvider; + } + + protected void onSwipeStarts() {} } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/MenuDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/MenuDrawable.java index 18fa3a60d8..6f4cef7c7c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/MenuDrawable.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/MenuDrawable.java @@ -8,6 +8,9 @@ package org.telegram.ui.ActionBar; +import static org.telegram.messenger.AndroidUtilities.dp; +import static org.telegram.messenger.AndroidUtilities.dpf2; + import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.Paint; @@ -22,8 +25,8 @@ public class MenuDrawable extends Drawable { - private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); - private Paint backPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); + private final Paint backPaint = new Paint(Paint.ANTI_ALIAS_FLAG); private boolean reverseAngle; private long lastFrameTime; private boolean animationInProgress; @@ -61,7 +64,7 @@ public MenuDrawable() { public MenuDrawable(int type) { super(); - paint.setStrokeWidth(AndroidUtilities.dp(2)); + paint.setStrokeWidth(dp(2)); backPaint.setStrokeWidth(AndroidUtilities.density * 1.66f); backPaint.setStrokeCap(Paint.Cap.ROUND); backPaint.setStyle(Paint.Style.STROKE); @@ -144,7 +147,7 @@ public void draw(Canvas canvas) { canvas.save(); - canvas.translate(getIntrinsicWidth() / 2 - AndroidUtilities.dp(9) - AndroidUtilities.dp(1) * currentRotation, getIntrinsicHeight() / 2); + canvas.translate(getIntrinsicWidth() / 2 - dp(9) - dp(1) * currentRotation, getIntrinsicHeight() / 2); float endYDiff; float endXDiff; float startYDiff; @@ -156,55 +159,55 @@ public void draw(Canvas canvas) { float diffMiddle = 0; if (type == TYPE_DEFAULT) { if (previousType != TYPE_DEFAULT) { - diffUp = AndroidUtilities.dp(9) * (1.0f - typeAnimationProgress); - diffMiddle = AndroidUtilities.dp(7) * (1.0f - typeAnimationProgress); + diffUp = dp(9) * (1.0f - typeAnimationProgress); + diffMiddle = dp(7) * (1.0f - typeAnimationProgress); } } else { if (previousType == TYPE_DEFAULT) { - diffUp = AndroidUtilities.dp(9) * typeAnimationProgress * (1.0f - currentRotation); - diffMiddle = AndroidUtilities.dp(7) * typeAnimationProgress * (1.0f - currentRotation); + diffUp = dp(9) * typeAnimationProgress * (1.0f - currentRotation); + diffMiddle = dp(7) * typeAnimationProgress * (1.0f - currentRotation); } else { - diffUp = AndroidUtilities.dp(9) * (1.0f - currentRotation); - diffMiddle = AndroidUtilities.dp(7) * (1.0f - currentRotation); + diffUp = dp(9) * (1.0f - currentRotation); + diffMiddle = dp(7) * (1.0f - currentRotation); } } if (rotateToBack) { - canvas.rotate(currentRotation * (reverseAngle ? -180 : 180), AndroidUtilities.dp(9), 0); + canvas.rotate(currentRotation * (reverseAngle ? -180 : 180), dp(9), 0); paint.setColor(color1); paint.setAlpha(alpha); - canvas.drawLine((roundCap ? AndroidUtilities.dp(.5f) * currentRotation + (paint.getStrokeWidth() / 2f) * (1f - currentRotation) : 0), 0, AndroidUtilities.dp(18) - AndroidUtilities.dp(3.0f) * currentRotation - diffMiddle - (roundCap ? (paint.getStrokeWidth() / 2f) * (1f - currentRotation) : 0), 0, paint); - endYDiff = AndroidUtilities.dp(5) * (1 - Math.abs(currentRotation)) - AndroidUtilities.dp(0.5f) * Math.abs(currentRotation); - endXDiff = AndroidUtilities.dp(18) - AndroidUtilities.dp(2.5f) * Math.abs(currentRotation); - startYDiff = AndroidUtilities.dp(5) + AndroidUtilities.dp(2.0f) * Math.abs(currentRotation); - startXDiff = AndroidUtilities.dp(7.5f) * Math.abs(currentRotation); + canvas.drawLine((roundCap ? dp(.5f) * currentRotation + (paint.getStrokeWidth() / 2f) * (1f - currentRotation) : 0), 0, dp(18) - dp(3.0f) * currentRotation - diffMiddle - (roundCap ? (paint.getStrokeWidth() / 2f) * (1f - currentRotation) : 0), 0, paint); + endYDiff = dp(5) * (1 - Math.abs(currentRotation)) - dp(0.5f) * Math.abs(currentRotation); + endXDiff = dp(18) - dp(2.5f) * Math.abs(currentRotation); + startYDiff = dp(5) + dp(2.0f) * Math.abs(currentRotation); + startXDiff = dp(7.5f) * Math.abs(currentRotation); if (roundCap) { startXDiff += (paint.getStrokeWidth() / 2f) * (1f - currentRotation); - endYDiff += AndroidUtilities.dp(.5f) * currentRotation; - endXDiff -= AndroidUtilities.dp(.5f) * currentRotation + (paint.getStrokeWidth() / 2f) * (1f - currentRotation); - startYDiff -= AndroidUtilities.dp(.75f) * currentRotation; - endYDiff += AndroidUtilities.dp(.25f) * currentRotation; + endYDiff += dp(.5f) * currentRotation; + endXDiff -= dp(.5f) * currentRotation + (paint.getStrokeWidth() / 2f) * (1f - currentRotation); + startYDiff -= dp(.25f) * currentRotation; + endYDiff += dp(.25f) * currentRotation; } } else { - canvas.rotate(currentRotation * (reverseAngle ? -225 : 135), AndroidUtilities.dp(9), 0); + canvas.rotate(currentRotation * (reverseAngle ? -225 : 135), dp(9), 0); if (miniIcon) { paint.setColor(color1); paint.setAlpha(alpha); - canvas.drawLine(AndroidUtilities.dpf2(2) * (1 - Math.abs(currentRotation)) + AndroidUtilities.dp(1) * currentRotation, 0, AndroidUtilities.dpf2(16) * (1f - currentRotation) + AndroidUtilities.dp(17) * currentRotation - diffMiddle, 0, paint); - endYDiff = AndroidUtilities.dpf2(5) * (1 - Math.abs(currentRotation)) - AndroidUtilities.dpf2(0.5f) * Math.abs(currentRotation); - endXDiff = AndroidUtilities.dpf2(16) * (1 - Math.abs(currentRotation)) + (AndroidUtilities.dpf2(9)) * Math.abs(currentRotation); - startYDiff = AndroidUtilities.dpf2(5) + AndroidUtilities.dpf2(3.0f) * Math.abs(currentRotation); - startXDiff = AndroidUtilities.dpf2(2) + AndroidUtilities.dpf2(7) * Math.abs(currentRotation); + canvas.drawLine(dpf2(2) * (1 - Math.abs(currentRotation)) + dp(1) * currentRotation, 0, dpf2(16) * (1f - currentRotation) + dp(17) * currentRotation - diffMiddle, 0, paint); + endYDiff = dpf2(5) * (1 - Math.abs(currentRotation)) - dpf2(0.5f) * Math.abs(currentRotation); + endXDiff = dpf2(16) * (1 - Math.abs(currentRotation)) + (dpf2(9)) * Math.abs(currentRotation); + startYDiff = dpf2(5) + dpf2(3.0f) * Math.abs(currentRotation); + startXDiff = dpf2(2) + dpf2(7) * Math.abs(currentRotation); } else { int color2 = Theme.getColor(Theme.key_actionBarActionModeDefaultIcon); int backColor2 = Theme.getColor(Theme.key_actionBarActionModeDefault); backColor1 = AndroidUtilities.getOffsetColor(backColor1, backColor2, currentRotation, 1.0f); paint.setColor(AndroidUtilities.getOffsetColor(color1, color2, currentRotation, 1.0f)); paint.setAlpha(alpha); - canvas.drawLine(AndroidUtilities.dp(1) * currentRotation, 0, AndroidUtilities.dp(18) - AndroidUtilities.dp(1) * currentRotation - diffMiddle, 0, paint); - endYDiff = AndroidUtilities.dp(5) * (1 - Math.abs(currentRotation)) - AndroidUtilities.dp(0.5f) * Math.abs(currentRotation); - endXDiff = AndroidUtilities.dp(18) - AndroidUtilities.dp(9) * Math.abs(currentRotation); - startYDiff = AndroidUtilities.dp(5) + AndroidUtilities.dp(3.0f) * Math.abs(currentRotation); - startXDiff = AndroidUtilities.dp(9) * Math.abs(currentRotation); + canvas.drawLine(dp(1) * currentRotation, 0, dp(18) - dp(1) * currentRotation - diffMiddle, 0, paint); + endYDiff = dp(5) * (1 - Math.abs(currentRotation)) - dp(0.5f) * Math.abs(currentRotation); + endXDiff = dp(18) - dp(9) * Math.abs(currentRotation); + startYDiff = dp(5) + dp(3) * Math.abs(currentRotation); + startXDiff = dp(9) * Math.abs(currentRotation); } } if (miniIcon) { @@ -215,8 +218,8 @@ public void draw(Canvas canvas) { canvas.drawLine(startXDiff, startYDiff, endXDiff, endYDiff, paint); } if (type != TYPE_DEFAULT && currentRotation != 1.0f || previousType != TYPE_DEFAULT && typeAnimationProgress != 1.0f) { - float cx = AndroidUtilities.dp(9 + 8); - float cy = -AndroidUtilities.dp(4.5f); + float cx = dp(9 + 8); + float cy = -dp(4.5f); float rad = AndroidUtilities.density * 5.5f; canvas.scale(1.0f - currentRotation, 1.0f - currentRotation, cx, cy); if (type == TYPE_DEFAULT) { @@ -232,18 +235,18 @@ public void draw(Canvas canvas) { } else { backPaint.setAlpha(alpha); } - canvas.drawLine(cx, cy - AndroidUtilities.dp(2), cx, cy, backPaint); - canvas.drawPoint(cx, cy + AndroidUtilities.dp(2.5f), backPaint); + canvas.drawLine(cx, cy - dp(2), cx, cy, backPaint); + canvas.drawPoint(cx, cy + dp(2.5f), backPaint); } if (type == TYPE_UDPATE_DOWNLOADING || previousType == TYPE_UDPATE_DOWNLOADING) { - backPaint.setStrokeWidth(AndroidUtilities.dp(2)); + backPaint.setStrokeWidth(dp(2)); if (previousType == TYPE_UDPATE_DOWNLOADING) { backPaint.setAlpha((int) (alpha * (1.0f - typeAnimationProgress))); } else { backPaint.setAlpha(alpha); } float arcRad = Math.max(4, 360 * animatedDownloadProgress); - rect.set(cx - AndroidUtilities.dp(3), cy - AndroidUtilities.dp(3), cx + AndroidUtilities.dp(3), cy + AndroidUtilities.dp(3)); + rect.set(cx - dp(3), cy - dp(3), cx + dp(3), cy + dp(3)); canvas.drawArc(rect, downloadRadOffset, arcRad, false, backPaint); downloadRadOffset += 360 * dt / 2500.0f; @@ -303,12 +306,12 @@ public int getOpacity() { @Override public int getIntrinsicWidth() { - return AndroidUtilities.dp(24); + return dp(24); } @Override public int getIntrinsicHeight() { - return AndroidUtilities.dp(24); + return dp(24); } public void setIconColor(int iconColor) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/SimpleTextView.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/SimpleTextView.java index 902bff228c..e2ed9a4cec 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/SimpleTextView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/SimpleTextView.java @@ -8,12 +8,16 @@ package org.telegram.ui.ActionBar; +import static org.telegram.messenger.AndroidUtilities.dp; + import android.content.Context; import android.graphics.Canvas; +import android.graphics.ColorFilter; import android.graphics.LinearGradient; import android.graphics.Paint; import android.graphics.Path; import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; import android.graphics.PorterDuffXfermode; import android.graphics.Rect; import android.graphics.Region; @@ -50,6 +54,7 @@ public class SimpleTextView extends View implements Drawable.Callback { + private float layoutX, layoutY; private Layout layout; private Layout firstLineLayout; private Layout fullLayout; @@ -67,7 +72,7 @@ public class SimpleTextView extends View implements Drawable.Callback { private int replacingDrawableTextIndex; private float replacingDrawableTextOffset; private float rightDrawableScale = 1.0f; - private int drawablePadding = AndroidUtilities.dp(4); + private int drawablePadding = dp(4); private int leftDrawableTopPadding; private int rightDrawableTopPadding; private boolean buildFullLayout; @@ -96,7 +101,7 @@ public class SimpleTextView extends View implements Drawable.Callback { public int rightDrawableY; private boolean wasLayout; - private boolean rightDrawableOutside; + private boolean leftDrawableOutside, rightDrawableOutside; private boolean rightDrawableInside; private boolean ellipsizeByGradient, ellipsizeByGradientLeft; private Boolean forceEllipsizeByGradientLeft; @@ -128,10 +133,16 @@ public class SimpleTextView extends View implements Drawable.Callback { private float touchDownX, touchDownY; private AnimatedEmojiSpan.EmojiGroupedSpans emojiStack; + private int emojiCacheType = AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES; + private ColorFilter emojiStackColorFilter; private boolean attachedToWindow; private Layout.Alignment mAlignment = Layout.Alignment.ALIGN_NORMAL; + public void setEmojiColor(int color) { + emojiStackColorFilter = new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN); + } + public SimpleTextView(Context context) { super(context); textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); @@ -148,11 +159,33 @@ public void setLinkTextColor(int color) { invalidate(); } + public Layout getLayout() { + return layout; + } + + public float getLayoutX() { + return layoutX; + } + + public float getLayoutY() { + return layoutY; + } + @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); attachedToWindow = true; - emojiStack = AnimatedEmojiSpan.update(AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, this, emojiStack, layout); + emojiStack = AnimatedEmojiSpan.update(emojiCacheType, this, emojiStack, layout); + } + + public void setEmojiCacheType(int cacheType) { + if (cacheType != emojiCacheType) { + AnimatedEmojiSpan.release(this, emojiStack); + emojiCacheType = cacheType; + if (attachedToWindow) { + emojiStack = AnimatedEmojiSpan.update(emojiCacheType, this, emojiStack, layout); + } + } } @Override @@ -164,7 +197,7 @@ protected void onDetachedFromWindow() { } public void setTextSize(int sizeInDp) { - int newSize = AndroidUtilities.dp(sizeInDp); + int newSize = dp(sizeInDp); if (newSize == textPaint.getTextSize()) { return; } @@ -226,11 +259,11 @@ public void setWidthWrapContent(boolean value) { private void updateFadePaints() { if ((fadePaint == null || fadePaintBack == null) && scrollNonFitText) { fadePaint = new Paint(); - fadePaint.setShader(new LinearGradient(0, 0, AndroidUtilities.dp(6), 0, new int[]{0xffffffff, 0}, new float[]{0f, 1f}, Shader.TileMode.CLAMP)); + fadePaint.setShader(new LinearGradient(0, 0, dp(6), 0, new int[]{0xffffffff, 0}, new float[]{0f, 1f}, Shader.TileMode.CLAMP)); fadePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT)); fadePaintBack = new Paint(); - fadePaintBack.setShader(new LinearGradient(0, 0, AndroidUtilities.dp(6), 0, new int[]{0, 0xffffffff}, new float[]{0f, 1f}, Shader.TileMode.CLAMP)); + fadePaintBack.setShader(new LinearGradient(0, 0, dp(6), 0, new int[]{0, 0xffffffff}, new float[]{0f, 1f}, Shader.TileMode.CLAMP)); fadePaintBack.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT)); } boolean ellipsizeLeft; @@ -240,15 +273,15 @@ private void updateFadePaints() { ellipsizeLeft = false; // ellipsizeLeft = getAlignment() == Layout.Alignment.ALIGN_NORMAL && LocaleController.isRTL || getAlignment() == Layout.Alignment.ALIGN_OPPOSITE && !LocaleController.isRTL; } - if ((fadeEllpsizePaint == null || fadeEllpsizePaintWidth != AndroidUtilities.dp(ellipsizeByGradientWidthDp) || ellipsizeByGradientLeft != ellipsizeLeft) && ellipsizeByGradient) { + if ((fadeEllpsizePaint == null || fadeEllpsizePaintWidth != dp(ellipsizeByGradientWidthDp) || ellipsizeByGradientLeft != ellipsizeLeft) && ellipsizeByGradient) { if (fadeEllpsizePaint == null) { fadeEllpsizePaint = new Paint(); } ellipsizeByGradientLeft = ellipsizeLeft; if (ellipsizeByGradientLeft) { - fadeEllpsizePaint.setShader(new LinearGradient(0, 0, fadeEllpsizePaintWidth = AndroidUtilities.dp(ellipsizeByGradientWidthDp), 0, new int[]{0xffffffff, 0}, new float[]{0f, 1f}, Shader.TileMode.CLAMP)); + fadeEllpsizePaint.setShader(new LinearGradient(0, 0, fadeEllpsizePaintWidth = dp(ellipsizeByGradientWidthDp), 0, new int[]{0xffffffff, 0}, new float[]{0f, 1f}, Shader.TileMode.CLAMP)); } else { - fadeEllpsizePaint.setShader(new LinearGradient(0, 0, fadeEllpsizePaintWidth = AndroidUtilities.dp(ellipsizeByGradientWidthDp), 0, new int[]{0, 0xffffffff}, new float[]{0f, 1f}, Shader.TileMode.CLAMP)); + fadeEllpsizePaint.setShader(new LinearGradient(0, 0, fadeEllpsizePaintWidth = dp(ellipsizeByGradientWidthDp), 0, new int[]{0, 0xffffffff}, new float[]{0f, 1f}, Shader.TileMode.CLAMP)); } fadeEllpsizePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT)); } @@ -291,7 +324,7 @@ private void calcOffset(int width) { return; } if (layout.getLineCount() > 0) { - textWidth = (int) Math.ceil(layout.getLineWidth(0)); + textWidth = (int) Math.max(Math.ceil(layout.getLineWidth(0)), Math.ceil(layout.getLineRight(0))); if (fullLayout != null) { textHeight = fullLayout.getLineBottom(fullLayout.getLineCount() - 1); } else if (maxLines > 1 && layout.getLineCount() > 0) { @@ -315,7 +348,7 @@ private void calcOffset(int width) { offsetX = width - textWidth; } } else { - offsetX = -AndroidUtilities.dp(8); + offsetX = -dp(8); } offsetX += getPaddingLeft(); int rightDrawableWidth = 0; @@ -347,7 +380,9 @@ protected boolean createLayout(int width) { rightDrawableHidden = false; if (text != null) { try { - if (leftDrawable != null) { + int leftDrawableWidth = 0; + if (leftDrawable != null && !leftDrawableOutside) { + leftDrawableWidth += leftDrawable.getIntrinsicWidth() + drawablePadding; width -= leftDrawable.getIntrinsicWidth(); width -= drawablePadding; } @@ -402,16 +437,16 @@ protected boolean createLayout(int width) { } else { part = "…"; } - firstLineLayout = new StaticLayout(string, 0, string.length(), textPaint, scrollNonFitText ? AndroidUtilities.dp(2000) : width + AndroidUtilities.dp(8), getAlignment(), 1.0f, 0.0f, false); - layout = new StaticLayout(substr, 0, substr.length(), textPaint, scrollNonFitText ? AndroidUtilities.dp(2000) : width + AndroidUtilities.dp(8), getAlignment(), 1.0f, 0.0f, false); + firstLineLayout = new StaticLayout(string, 0, string.length(), textPaint, scrollNonFitText ? dp(2000) : width + dp(8), getAlignment(), 1.0f, 0.0f, false); + layout = new StaticLayout(substr, 0, substr.length(), textPaint, scrollNonFitText ? dp(2000) : width + dp(8), getAlignment(), 1.0f, 0.0f, false); if (layout.getLineLeft(0) != 0) { part = "\u200F" + part; } - partLayout = new StaticLayout(part, 0, part.length(), textPaint, scrollNonFitText ? AndroidUtilities.dp(2000) : width + AndroidUtilities.dp(8), getAlignment(), 1.0f, 0.0f, false); - fullLayout = StaticLayoutEx.createStaticLayout(full, textPaint, width + AndroidUtilities.dp(8) + fullLayoutAdditionalWidth, getAlignment(), 1.0f, 0.0f, false, TextUtils.TruncateAt.END, width + fullLayoutAdditionalWidth, fullTextMaxLines, false); + partLayout = new StaticLayout(part, 0, part.length(), textPaint, scrollNonFitText ? dp(2000) : width + dp(8), getAlignment(), 1.0f, 0.0f, false); + fullLayout = StaticLayoutEx.createStaticLayout(full, textPaint, width + dp(8) + fullLayoutAdditionalWidth, getAlignment(), 1.0f, 0.0f, false, TextUtils.TruncateAt.END, width + fullLayoutAdditionalWidth, fullTextMaxLines, false); } } else { - layout = new StaticLayout(string, 0, string.length(), textPaint, scrollNonFitText || ellipsizeByGradient ? AndroidUtilities.dp(2000) : width + AndroidUtilities.dp(8), getAlignment(), 1.0f, 0.0f, false); + layout = new StaticLayout(string, 0, string.length(), textPaint, scrollNonFitText || ellipsizeByGradient ? dp(2000) : width + dp(8), getAlignment(), 1.0f, 0.0f, false); fullLayout = null; partLayout = null; firstLineLayout = null; @@ -429,7 +464,7 @@ protected boolean createLayout(int width) { calcOffset(width); return false; }*/ - layout = new StaticLayout(string, 0, string.length(), textPaint, scrollNonFitText || ellipsizeByGradient ? AndroidUtilities.dp(2000) : width + AndroidUtilities.dp(8), getAlignment(), 1.0f, 0.0f, false); + layout = new StaticLayout(string, 0, string.length(), textPaint, scrollNonFitText || ellipsizeByGradient ? dp(2000) : width + dp(8), getAlignment(), 1.0f, 0.0f, false); } spoilersPool.addAll(spoilers); @@ -448,7 +483,7 @@ protected boolean createLayout(int width) { } AnimatedEmojiSpan.release(this, emojiStack); if (attachedToWindow) { - emojiStack = AnimatedEmojiSpan.update(AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, this, emojiStack, layout); + emojiStack = AnimatedEmojiSpan.update(emojiCacheType, this, emojiStack, layout); } invalidate(); return true; @@ -472,7 +507,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { scrollingOffset = 0; currentScrollDelay = SCROLL_DELAY_MS; } - createLayout(width - getPaddingLeft() - getPaddingRight() - minusWidth - (rightDrawableOutside && rightDrawable != null ? rightDrawable.getIntrinsicWidth() + drawablePadding : 0) - (rightDrawableOutside && rightDrawable2 != null ? rightDrawable2.getIntrinsicWidth() + drawablePadding : 0)); + createLayout(width - getPaddingLeft() - getPaddingRight() - minusWidth - (leftDrawableOutside && leftDrawable != null ? leftDrawable.getIntrinsicWidth() + drawablePadding : 0) - (rightDrawableOutside && rightDrawable != null ? rightDrawable.getIntrinsicWidth() + drawablePadding : 0) - (rightDrawableOutside && rightDrawable2 != null ? rightDrawable2.getIntrinsicWidth() + drawablePadding : 0)); int finalHeight; if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.EXACTLY) { @@ -482,7 +517,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { } if (widthWrapContent) { // textWidth = (int) Math.ceil(layout.getLineWidth(0)); - width = Math.min(width, getPaddingLeft() + textWidth + getPaddingRight() + minusWidth + (rightDrawableOutside && rightDrawable != null ? rightDrawable.getIntrinsicWidth() + drawablePadding : 0) + (rightDrawableOutside && rightDrawable2 != null ? rightDrawable2.getIntrinsicWidth() + drawablePadding : 0)); + width = Math.min(width, getPaddingLeft() + textWidth + getPaddingRight() + minusWidth + (leftDrawableOutside && leftDrawable != null ? leftDrawable.getIntrinsicWidth() + drawablePadding : 0) + (rightDrawableOutside && rightDrawable != null ? rightDrawable.getIntrinsicWidth() + drawablePadding : 0) + (rightDrawableOutside && rightDrawable2 != null ? rightDrawable2.getIntrinsicWidth() + drawablePadding : 0)); } setMeasuredDimension(width, finalHeight); @@ -749,7 +784,7 @@ public void setRightPadding(int padding) { paddingRight = padding; int width = getMaxTextWidth() - getPaddingLeft() - getPaddingRight() - minusWidth; - if (leftDrawable != null) { + if (leftDrawable != null && !leftDrawableOutside) { width -= leftDrawable.getIntrinsicWidth(); width -= drawablePadding; } @@ -790,6 +825,8 @@ public void setRightPadding(int padding) { protected void onDraw(Canvas canvas) { super.onDraw(canvas); int textOffsetX = 0; + layoutX = 0; + layoutY = 0; boolean fade = scrollNonFitText && (textDoesNotFit || scrollingOffset != 0); int restore = Integer.MIN_VALUE; @@ -798,7 +835,7 @@ protected void onDraw(Canvas canvas) { } totalWidth = textWidth; - if (leftDrawable != null) { + if (leftDrawable != null && !leftDrawableOutside) { int x = (int) -scrollingOffset; if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) == Gravity.CENTER_HORIZONTAL) { x += offsetX; @@ -815,6 +852,8 @@ protected void onDraw(Canvas canvas) { textOffsetX += drawablePadding + leftDrawable.getIntrinsicWidth(); } totalWidth += drawablePadding + leftDrawable.getIntrinsicWidth(); + } else if (leftDrawableOutside && leftDrawable != null) { + textOffsetX += drawablePadding + leftDrawable.getIntrinsicWidth(); } if (replacedDrawable != null && replacedText != null) { int x = (int) (-scrollingOffset + replacingDrawableTextOffset); @@ -878,10 +917,10 @@ protected void onDraw(Canvas canvas) { rightDrawable2.draw(canvas); totalWidth += drawablePadding + dw; } - int nextScrollX = totalWidth + AndroidUtilities.dp(DIST_BETWEEN_SCROLLING_TEXT); + int nextScrollX = totalWidth + dp(DIST_BETWEEN_SCROLLING_TEXT); if (scrollingOffset != 0) { - if (leftDrawable != null) { + if (leftDrawable != null && !leftDrawableOutside) { int x = (int) -scrollingOffset + nextScrollX; int y; if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.CENTER_VERTICAL) { @@ -903,6 +942,8 @@ protected void onDraw(Canvas canvas) { y = getPaddingTop() + (textHeight - dh) / 2 + rightDrawableTopPadding; } rightDrawable.setBounds(x, y, x + dw, y + dh); + rightDrawableX = x + (dw >> 1); + rightDrawableY = y + (dh >> 1); rightDrawable.draw(canvas); } if (rightDrawable2 != null && !rightDrawableOutside) { @@ -924,9 +965,9 @@ protected void onDraw(Canvas canvas) { } if (layout != null) { - if (rightDrawableOutside || ellipsizeByGradient || paddingRight > 0) { + if (leftDrawableOutside || rightDrawableOutside || ellipsizeByGradient || paddingRight > 0) { canvas.save(); - canvas.clipRect(0, 0, getMaxTextWidth() - paddingRight - AndroidUtilities.dp(rightDrawable != null && !(rightDrawable instanceof AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable) && rightDrawableOutside ? 2 : 0), getMeasuredHeight()); + canvas.clipRect(textOffsetX, 0, getMaxTextWidth() - paddingRight - dp(rightDrawable != null && !(rightDrawable instanceof AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable) && rightDrawableOutside ? 2 : 0), getMeasuredHeight()); } Emoji.emojiDrawingUseAlpha = usaAlphaForEmoji; if (wrapBackgroundDrawable != null) { @@ -939,9 +980,8 @@ protected void onDraw(Canvas canvas) { if (offsetX + textOffsetX != 0 || offsetY != 0 || scrollingOffset != 0) { canvas.save(); canvas.translate(offsetX + textOffsetX - scrollingOffset, offsetY); - if (scrollingOffset != 0) { - //canvas.clipRect(0, 0, getMeasuredWidth(), getMeasuredHeight()); - } + layoutX += offsetX + textOffsetX - scrollingOffset; + layoutY += offsetY; } drawLayout(canvas); if (partLayout != null && fullAlpha < 1.0f) { @@ -950,7 +990,7 @@ protected void onDraw(Canvas canvas) { canvas.save(); float partOffset = 0; if (partLayout.getText().length() == 1) { - partOffset = fullTextMaxLines == 1 ? AndroidUtilities.dp(0.5f) : AndroidUtilities.dp(4); + partOffset = fullTextMaxLines == 1 ? dp(0.5f) : dp(4); } if (layout.getLineLeft(0) != 0) { canvas.translate(-layout.getLineWidth(0) + partOffset, 0); @@ -1019,31 +1059,31 @@ protected void onDraw(Canvas canvas) { totalWidth += drawablePadding + dw; } if (fade) { - if (scrollingOffset < AndroidUtilities.dp(10)) { - fadePaint.setAlpha((int) (255 * (scrollingOffset / AndroidUtilities.dp(10)))); - } else if (scrollingOffset > totalWidth + AndroidUtilities.dp(DIST_BETWEEN_SCROLLING_TEXT) - AndroidUtilities.dp(10)) { - float dist = scrollingOffset - (totalWidth + AndroidUtilities.dp(DIST_BETWEEN_SCROLLING_TEXT) - AndroidUtilities.dp(10)); - fadePaint.setAlpha((int) (255 * (1.0f - dist / AndroidUtilities.dp(10)))); + if (scrollingOffset < dp(10)) { + fadePaint.setAlpha((int) (255 * (scrollingOffset / dp(10)))); + } else if (scrollingOffset > totalWidth + dp(DIST_BETWEEN_SCROLLING_TEXT) - dp(10)) { + float dist = scrollingOffset - (totalWidth + dp(DIST_BETWEEN_SCROLLING_TEXT) - dp(10)); + fadePaint.setAlpha((int) (255 * (1.0f - dist / dp(10)))); } else { fadePaint.setAlpha(255); } - canvas.drawRect(0, 0, AndroidUtilities.dp(6), getMeasuredHeight(), fadePaint); + canvas.drawRect(textOffsetX, 0, textOffsetX + dp(6), getMeasuredHeight(), fadePaint); canvas.save(); - canvas.translate(getMaxTextWidth() - paddingRight - AndroidUtilities.dp(6), 0); - canvas.drawRect(0, 0, AndroidUtilities.dp(6), getMeasuredHeight(), fadePaintBack); + canvas.translate(getMaxTextWidth() - paddingRight - dp(6), 0); + canvas.drawRect(0, 0, 0 + dp(6), getMeasuredHeight(), fadePaintBack); canvas.restore(); } else if (ellipsizeByGradient && textDoesNotFit && fadeEllpsizePaint != null) { canvas.save(); updateFadePaints(); if (!ellipsizeByGradientLeft) { - canvas.translate(getMaxTextWidth() - paddingRight - fadeEllpsizePaintWidth - AndroidUtilities.dp(rightDrawable != null && !(rightDrawable instanceof AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable) && rightDrawableOutside ? +2 : 0), 0); + canvas.translate(getMaxTextWidth() - paddingRight - fadeEllpsizePaintWidth - dp(rightDrawable != null && !(rightDrawable instanceof AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable) && rightDrawableOutside ? +2 : 0), 0); } - canvas.drawRect(0, 0, fadeEllpsizePaintWidth, getMeasuredHeight(), fadeEllpsizePaint); + canvas.drawRect(textOffsetX, 0, fadeEllpsizePaintWidth, getMeasuredHeight(), fadeEllpsizePaint); canvas.restore(); } updateScrollAnimation(); Emoji.emojiDrawingUseAlpha = true; - if (rightDrawableOutside || ellipsizeByGradient || paddingRight > 0) { + if (leftDrawableOutside || rightDrawableOutside || ellipsizeByGradient || paddingRight > 0) { canvas.restore(); } } @@ -1051,6 +1091,19 @@ protected void onDraw(Canvas canvas) { canvas.restoreToCount(restore); } + if (leftDrawable != null && leftDrawableOutside) { + int x = 0; + int dw = (int) (leftDrawable.getIntrinsicWidth()); + int dh = (int) (leftDrawable.getIntrinsicHeight()); + int y; + if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.CENTER_VERTICAL) { + y = (getMeasuredHeight() - dh) / 2 + leftDrawableTopPadding; + } else { + y = getPaddingTop() + (textHeight - dh) / 2 + leftDrawableTopPadding; + } + leftDrawable.setBounds(x, y, x + dw, y + dh); + leftDrawable.draw(canvas); + } if (rightDrawable != null && rightDrawableOutside) { int x = Math.min(textOffsetX + textWidth + drawablePadding + (scrollingOffset == 0 ? -nextScrollX : (int) -scrollingOffset) + nextScrollX, getMaxTextWidth() - paddingRight + drawablePadding); int dw = (int) (rightDrawable.getIntrinsicWidth() * rightDrawableScale); @@ -1103,6 +1156,7 @@ private void drawLayout(Canvas canvas) { if (fullAlpha > 0 && fullLayoutLeftOffset != 0) { canvas.save(); canvas.translate(-fullLayoutLeftOffset * fullAlpha + fullLayoutLeftCharactersOffset * fullAlpha, 0); + layoutX += -fullLayoutLeftOffset * fullAlpha + fullLayoutLeftCharactersOffset * fullAlpha; canvas.save(); clipOutSpoilers(canvas); @@ -1112,7 +1166,7 @@ private void drawLayout(Canvas canvas) { layout.draw(canvas); canvas.restore(); - AnimatedEmojiSpan.drawAnimatedEmojis(canvas, layout, emojiStack, 0, null, 0, 0, 0, 1f); + AnimatedEmojiSpan.drawAnimatedEmojis(canvas, layout, emojiStack, 0, null, 0, 0, 0, 1f, emojiStackColorFilter); drawSpoilers(canvas); canvas.restore(); } else { @@ -1124,7 +1178,7 @@ private void drawLayout(Canvas canvas) { layout.draw(canvas); canvas.restore(); - AnimatedEmojiSpan.drawAnimatedEmojis(canvas, layout, emojiStack, 0, null, 0, 0, 0, 1f); + AnimatedEmojiSpan.drawAnimatedEmojis(canvas, layout, emojiStack, 0, null, 0, 0, 0, 1f, emojiStackColorFilter); drawSpoilers(canvas); } } @@ -1155,17 +1209,17 @@ private void updateScrollAnimation() { if (currentScrollDelay > 0) { currentScrollDelay -= dt; } else { - int totalDistance = totalWidth + AndroidUtilities.dp(DIST_BETWEEN_SCROLLING_TEXT); + int totalDistance = totalWidth + dp(DIST_BETWEEN_SCROLLING_TEXT); float pixelsPerSecond; - if (scrollingOffset < AndroidUtilities.dp(SCROLL_SLOWDOWN_PX)) { - pixelsPerSecond = PIXELS_PER_SECOND_SLOW + (PIXELS_PER_SECOND - PIXELS_PER_SECOND_SLOW) * (scrollingOffset / AndroidUtilities.dp(SCROLL_SLOWDOWN_PX)); - } else if (scrollingOffset >= totalDistance - AndroidUtilities.dp(SCROLL_SLOWDOWN_PX)) { - float dist = scrollingOffset - (totalDistance - AndroidUtilities.dp(SCROLL_SLOWDOWN_PX)); - pixelsPerSecond = PIXELS_PER_SECOND - (PIXELS_PER_SECOND - PIXELS_PER_SECOND_SLOW) * (dist / AndroidUtilities.dp(SCROLL_SLOWDOWN_PX)); + if (scrollingOffset < dp(SCROLL_SLOWDOWN_PX)) { + pixelsPerSecond = PIXELS_PER_SECOND_SLOW + (PIXELS_PER_SECOND - PIXELS_PER_SECOND_SLOW) * (scrollingOffset / dp(SCROLL_SLOWDOWN_PX)); + } else if (scrollingOffset >= totalDistance - dp(SCROLL_SLOWDOWN_PX)) { + float dist = scrollingOffset - (totalDistance - dp(SCROLL_SLOWDOWN_PX)); + pixelsPerSecond = PIXELS_PER_SECOND - (PIXELS_PER_SECOND - PIXELS_PER_SECOND_SLOW) * (dist / dp(SCROLL_SLOWDOWN_PX)); } else { pixelsPerSecond = PIXELS_PER_SECOND; } - scrollingOffset += dt / 1000.0f * AndroidUtilities.dp(pixelsPerSecond); + scrollingOffset += dt / 1000.0f * dp(pixelsPerSecond); lastUpdateTime = newUpdateTime; if (scrollingOffset > totalDistance) { scrollingOffset = 0; @@ -1225,6 +1279,10 @@ public void setRightDrawableOutside(boolean outside) { rightDrawableOutside = outside; } + public void setLeftDrawableOutside(boolean outside) { + leftDrawableOutside = outside; + } + // right drawable is ellipsized with text public void setRightDrawableInside(boolean inside) { rightDrawableInside = inside; @@ -1242,7 +1300,7 @@ public void setRightDrawableOnClick(OnClickListener onClickListener) { @Override public boolean onTouchEvent(MotionEvent event) { if (rightDrawableOnClickListener != null && rightDrawable != null) { - AndroidUtilities.rectTmp.set(rightDrawableX - AndroidUtilities.dp(16), rightDrawableY - AndroidUtilities.dp(16), rightDrawableX + AndroidUtilities.dp(16), rightDrawableY + AndroidUtilities.dp(16)); + AndroidUtilities.rectTmp.set(rightDrawableX - dp(16), rightDrawableY - dp(16), rightDrawableX + dp(16), rightDrawableY + dp(16)); if (event.getAction() == MotionEvent.ACTION_DOWN && AndroidUtilities.rectTmp.contains((int) event.getX(), (int) event.getY())) { maybeClick = true; touchDownX = event.getX(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/TextViewWithLoading.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/TextViewWithLoading.java new file mode 100644 index 0000000000..bc112d0ce5 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/TextViewWithLoading.java @@ -0,0 +1,75 @@ +package org.telegram.ui.ActionBar; + +import static org.telegram.messenger.AndroidUtilities.dp; + +import android.content.Context; +import android.graphics.Canvas; +import android.widget.TextView; + +import org.telegram.ui.Components.AnimatedFloat; +import org.telegram.ui.Components.CircularProgressDrawable; +import org.telegram.ui.Components.CubicBezierInterpolator; + +public class TextViewWithLoading extends TextView { + + private boolean loading = false; + private final AnimatedFloat animatedLoading = new AnimatedFloat(this, 320, CubicBezierInterpolator.EASE_OUT_QUINT); + private CircularProgressDrawable spinner; + + public TextViewWithLoading(Context context) { + super(context); + + spinner = new CircularProgressDrawable(); + } + + @Override + public void setTextColor(int color) { + super.setTextColor(color); + spinner.setColor(color); + } + + public void setLoading(boolean loading, boolean animated) { + if (this.loading == loading) { + return; + } + this.loading = loading; + invalidate(); + if (!animated) { + animatedLoading.force(loading); + } + } + + public boolean isLoading() { + return loading; + } + + @Override + protected void onDraw(Canvas canvas) { + final float loading = animatedLoading.set(this.loading); + + if (loading < 1) { + if (loading <= 0) { + canvas.save(); + } else { + canvas.saveLayerAlpha(0, 0, getWidth(), getHeight(), (int) (0xFF * (1.0f - loading)), Canvas.ALL_SAVE_FLAG); + } + canvas.translate(0, dp(6) * loading); + super.onDraw(canvas); + canvas.restore(); + } + + if (loading > 0) { + int cx = getWidth() / 2, cy = getHeight() / 2; + cx -= (int) (dp(6) * (1.0f - loading)); + spinner.setAlpha((int) (0xFF * loading)); + spinner.setBounds( + cx - spinner.getIntrinsicWidth() / 2, cy - spinner.getIntrinsicWidth() / 2, + cx + spinner.getIntrinsicWidth() / 2, cy + spinner.getIntrinsicHeight() / 2 + ); + spinner.draw(canvas); + invalidate(); + } + + } + +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java index 2ecb011e28..1254a8399f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java @@ -86,7 +86,6 @@ import org.telegram.messenger.FileLog; import org.telegram.messenger.ImageLocation; import org.telegram.messenger.LiteMode; -import org.telegram.messenger.LocaleController; import org.telegram.messenger.MediaController; import org.telegram.messenger.MediaDataController; import org.telegram.messenger.MessageObject; @@ -101,6 +100,8 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.BlurSettingsBottomSheet; import org.telegram.ui.Cells.BaseCell; import org.telegram.ui.ChatActivity; @@ -1148,15 +1149,15 @@ private PatternsLoader(ArrayList accents) { if (slugs == null) { return; } - TLRPC.TL_account_getMultiWallPapers req = new TLRPC.TL_account_getMultiWallPapers(); + TL_account.getMultiWallPapers req = new TL_account.getMultiWallPapers(); for (int a = 0, N = slugs.size(); a < N; a++) { TLRPC.TL_inputWallPaperSlug slug = new TLRPC.TL_inputWallPaperSlug(); slug.slug = slugs.get(a); req.wallpapers.add(slug); } ConnectionsManager.getInstance(account).sendRequest(req, (response, error) -> { - if (response instanceof TLRPC.Vector) { - TLRPC.Vector res = (TLRPC.Vector) response; + if (response instanceof Vector) { + Vector res = (Vector) response; ArrayList createdAccents = null; for (int b = 0, N2 = res.objects.size(); b < N2; b++) { TLRPC.WallPaper object = (TLRPC.WallPaper) res.objects.get(b); @@ -2932,7 +2933,7 @@ public void didReceivedNotification(int id, int account, Object... args) { patternIntensity = themeInfo.patternIntensity; newPathToWallpaper = themeInfo.pathToWallpaper; - TLRPC.TL_account_getWallPaper req = new TLRPC.TL_account_getWallPaper(); + TL_account.getWallPaper req = new TL_account.getWallPaper(); TLRPC.TL_inputWallPaperSlug inputWallPaperSlug = new TLRPC.TL_inputWallPaperSlug(); inputWallPaperSlug.slug = themeInfo.slug; req.wallpaper = inputWallPaperSlug; @@ -3202,6 +3203,7 @@ public void run() { public static Paint chat_radialProgress2Paint; public static Paint chat_radialProgressPausedPaint; public static Paint chat_radialProgressPausedSeekbarPaint; + public static Paint chat_videoProgressPaint; public static TextPaint chat_msgTextPaint; public static TextPaint chat_msgTextCodePaint; @@ -4125,6 +4127,8 @@ public void run() { public static final int key_chat_inReactionButtonText = colorsCount++; public static final int key_chat_inReactionButtonTextSelected = colorsCount++; public static final int key_chat_outReactionButtonTextSelected = colorsCount++; + public static final int key_chat_reactionServiceButtonBackgroundSelected = colorsCount++; + public static final int key_chat_reactionServiceButtonTextSelected = colorsCount++; public static final int key_reactionStarSelector = colorsCount++; public static final int key_premiumGradient0 = colorsCount++; @@ -4173,6 +4177,10 @@ public void run() { public static final int key_iv_ab_progress = colorsCount++; public static final int key_iv_navigationBackground = colorsCount++; + public static final int key_share_linkText = colorsCount++; + public static final int key_share_linkBackground = colorsCount++; + public static final int key_share_icon = colorsCount++; + public static final String key_drawable_botInline = "drawableBotInline"; public static final String key_drawable_botLink = "drawableBotLink"; public static final String key_drawable_botWebView = "drawableBotWebView"; @@ -4405,6 +4413,8 @@ public void run() { fallbackKeys.put(key_chat_inReactionButtonBackground, key_chat_inLoader); fallbackKeys.put(key_chat_outReactionButtonBackground, key_chat_outLoader); + fallbackKeys.put(key_chat_reactionServiceButtonBackgroundSelected, key_chat_outBubble); + fallbackKeys.put(key_chat_reactionServiceButtonTextSelected, key_chat_messageTextOut); fallbackKeys.put(key_chat_inReactionButtonText, key_chat_inPreviewInstantText); fallbackKeys.put(key_chat_outReactionButtonText, key_chat_outPreviewInstantText); fallbackKeys.put(key_chat_inReactionButtonTextSelected, key_windowBackgroundWhite); @@ -4437,6 +4447,10 @@ public void run() { fallbackKeys.put(key_table_background, key_graySection); fallbackKeys.put(key_table_border, key_divider); + fallbackKeys.put(key_share_icon, key_windowBackgroundWhiteBlackText); + fallbackKeys.put(key_share_linkBackground, key_windowBackgroundGray); + fallbackKeys.put(key_share_linkText, key_windowBackgroundWhiteBlackText); + for (int i = 0; i < keys_avatar_background.length; i++) { themeAccentExclusionKeys.add(keys_avatar_background[i]); } @@ -7477,7 +7491,7 @@ public static void checkCurrentRemoteTheme(boolean force) { } loadingCurrentTheme++; - TLRPC.TL_account_getTheme req = new TLRPC.TL_account_getTheme(); + TL_account.getTheme req = new TL_account.getTheme(); req.document_id = info.document.id; req.format = "android"; TLRPC.TL_inputTheme inputTheme = new TLRPC.TL_inputTheme(); @@ -7532,7 +7546,7 @@ public static void loadRemoteThemes(final int currentAccount, boolean force) { return; } loadingRemoteThemes[currentAccount] = true; - TLRPC.TL_account_getThemes req = new TLRPC.TL_account_getThemes(); + TL_account.getThemes req = new TL_account.getThemes(); req.format = "android"; if (!MediaDataController.getInstance(currentAccount).defaultEmojiThemes.isEmpty()) { req.hash = remoteThemesHash[currentAccount]; @@ -7542,8 +7556,8 @@ public static void loadRemoteThemes(final int currentAccount, boolean force) { } ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { loadingRemoteThemes[currentAccount] = false; - if (response instanceof TLRPC.TL_account_themes) { - TLRPC.TL_account_themes res = (TLRPC.TL_account_themes) response; + if (response instanceof TL_account.TL_themes) { + TL_account.TL_themes res = (TL_account.TL_themes) response; remoteThemesHash[currentAccount] = res.hash; lastLoadingThemesTime[currentAccount] = (int) (System.currentTimeMillis() / 1000); ArrayList emojiPreviewThemes = new ArrayList<>(); @@ -8684,6 +8698,7 @@ public static void createCommonChatResources() { chat_composeBackgroundPaint = new Paint(); chat_radialProgressPausedPaint = new Paint(Paint.ANTI_ALIAS_FLAG); chat_radialProgressPausedSeekbarPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + chat_videoProgressPaint = new Paint(Paint.ANTI_ALIAS_FLAG); chat_messageBackgroundSelectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG); chat_actionBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG | Paint.DITHER_FLAG); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ThemeColors.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ThemeColors.java index 63ea6c0b41..eb28831935 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ThemeColors.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ThemeColors.java @@ -63,12 +63,15 @@ public static int[] createDefaultColors() { defaultColors[key_dialogEmptyText] = 0xff8c9094; defaultColors[key_dialogSwipeRemove] = 0xffe56555; defaultColors[key_dialogReactionMentionBackground] = 0xffF05459; - defaultColors[key_dialogCardShadow] = 0x30999999; + defaultColors[key_dialogCardShadow] = 0x17000000; defaultColors[key_dialogGiftsBackground] = 0xffF5F6F7; defaultColors[key_dialogGiftsTabText] = 0xFF56595C; defaultColors[key_bot_loadingIcon] = 0xFFF2F2F2; defaultColors[key_gift_ribbon] = 0xFF46A4F2; defaultColors[key_gift_ribbon_soldout] = 0xffcc4747; + defaultColors[key_share_icon] = 0xFF6E7275; + defaultColors[key_share_linkText] = 0xFF222222; + defaultColors[key_share_linkBackground] = 0x0F000000; defaultColors[key_windowBackgroundWhite] = 0xffffffff; defaultColors[key_windowBackgroundUnchecked] = 0xff9da7b1; @@ -148,21 +151,21 @@ public static int[] createDefaultColors() { defaultColors[key_avatar_backgroundArchived] = 0xffB8C2CC; defaultColors[key_avatar_backgroundArchivedHidden] = 0xff66bffa; defaultColors[key_avatar_backgroundRed] = 0xffFF845E; + defaultColors[key_avatar_background2Red] = 0xffD45246; defaultColors[key_avatar_backgroundOrange] = 0xffFEBB5B; + defaultColors[key_avatar_background2Orange] = 0xffF68136; defaultColors[key_avatar_backgroundViolet] = 0xffB694F9; + defaultColors[key_avatar_background2Violet] = 0xff6C61DF; defaultColors[key_avatar_backgroundGreen] = 0xff9AD164; + defaultColors[key_avatar_background2Green] = 0xff46BA43; defaultColors[key_avatar_backgroundCyan] = 0xff5BCBE3; + defaultColors[key_avatar_background2Cyan] = 0xff359AD4; defaultColors[key_avatar_backgroundBlue] = 0xff5CAFFA; + defaultColors[key_avatar_background2Blue] = 0xff408ACF; defaultColors[key_avatar_backgroundPink] = 0xffFF8AAC; + defaultColors[key_avatar_background2Pink] = 0xffD95574; defaultColors[key_avatar_backgroundGray] = 0xffA1ABB5; - defaultColors[key_avatar_background2Red] = 0xffD45246; - defaultColors[key_avatar_background2Orange] = 0xffF68136; - defaultColors[key_avatar_background2Violet] = 0xff6C61DF; - defaultColors[key_avatar_background2Green] = 0xff46BA43; - defaultColors[key_avatar_background2Cyan] = 0xff359AD4; - defaultColors[key_avatar_background2Blue] = 0xff408ACF; - defaultColors[key_avatar_background2Pink] = 0xffD95574; defaultColors[key_avatar_backgroundInProfileBlue] = 0xff5085b1; defaultColors[key_avatar_backgroundActionBarBlue] = 0xff598fba; @@ -754,6 +757,8 @@ public static int[] createDefaultColors() { defaultColors[key_chat_outReactionButtonText] = 0xff55ab4f; defaultColors[key_chat_inReactionButtonTextSelected] = 0xffffffff; defaultColors[key_chat_outReactionButtonTextSelected] = 0xffffffff; + defaultColors[key_chat_reactionServiceButtonBackgroundSelected] = 0xffffffff; + defaultColors[key_chat_reactionServiceButtonTextSelected] = 0xFF000000; defaultColors[key_premiumGradient0] = 0xff4ACD43; defaultColors[key_premiumGradient1] = 0xff55A5FF; @@ -1520,6 +1525,8 @@ public static SparseArray createColorKeysMap() { colorKeysMap.put(key_chat_inReactionButtonText, "chat_inReactionButtonText"); colorKeysMap.put(key_chat_inReactionButtonTextSelected, "chat_inReactionButtonTextSelected"); colorKeysMap.put(key_chat_outReactionButtonTextSelected, "chat_outReactionButtonTextSelected"); + colorKeysMap.put(key_chat_reactionServiceButtonBackgroundSelected, "chat_reactionServiceButtonBackgroundSelected"); + colorKeysMap.put(key_chat_reactionServiceButtonTextSelected, "chat_reactionServiceButtonTextSelected"); colorKeysMap.put(key_premiumGradient0, "premiumGradient0"); colorKeysMap.put(key_premiumGradient1, "premiumGradient1"); colorKeysMap.put(key_premiumGradient2, "premiumGradient2"); @@ -1564,6 +1571,10 @@ public static SparseArray createColorKeysMap() { colorKeysMap.put(key_dialogCardShadow, "dialogCardShadow"); colorKeysMap.put(key_dialogGiftsBackground, "dialogGiftsBackground"); colorKeysMap.put(key_dialogGiftsTabText, "dialogGiftsTabText"); + colorKeysMap.put(key_share_icon, "share_icon"); + colorKeysMap.put(key_share_linkText, "share_linkText"); + colorKeysMap.put(key_share_linkBackground, "share_linkBackground"); + return colorKeysMap; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DialogsSearchAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DialogsSearchAdapter.java index 40cca6a120..fc19baa583 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DialogsSearchAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DialogsSearchAdapter.java @@ -15,9 +15,14 @@ import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.TextUtils; +import android.util.Pair; +import android.util.TypedValue; +import android.view.Gravity; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; +import android.widget.LinearLayout; +import android.widget.TextView; import androidx.collection.LongSparseArray; import androidx.recyclerview.widget.DefaultItemAnimator; @@ -52,8 +57,13 @@ import org.telegram.ui.Cells.ProfileSearchCell; import org.telegram.ui.Cells.TextCell; import org.telegram.ui.Cells.TopicSearchCell; +import org.telegram.ui.Components.BackupImageView; +import org.telegram.ui.Components.ColoredImageSpan; import org.telegram.ui.Components.FlickerLoadingView; import org.telegram.ui.Components.ForegroundColorSpanThemable; +import org.telegram.ui.Components.ItemOptions; +import org.telegram.ui.Components.LayoutHelper; +import org.telegram.ui.Components.RLottieDrawable; import org.telegram.ui.Components.RecyclerListView; import org.telegram.ui.DialogsActivity; import org.telegram.ui.FilteredSearchView; @@ -61,21 +71,47 @@ import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.concurrent.ConcurrentHashMap; public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter { public final static int VIEW_TYPE_PROFILE_CELL = 0; public final static int VIEW_TYPE_GRAY_SECTION = 1; - public final int VIEW_TYPE_DIALOG_CELL = 2; - public final int VIEW_TYPE_TOPIC_CELL = 3; - public final int VIEW_TYPE_LOADING = 4; - public final int VIEW_TYPE_HASHTAG_CELL = 5; - public final int VIEW_TYPE_CATEGORY_LIST = 6; - public final int VIEW_TYPE_ADD_BY_PHONE = 7; - public final int VIEW_TYPE_INVITE_CONTACT_CELL = 8; - public final int VIEW_TYPE_PUBLIC_POST = 9; - private Context mContext; + public final static int VIEW_TYPE_DIALOG_CELL = 2; + public final static int VIEW_TYPE_TOPIC_CELL = 3; + public final static int VIEW_TYPE_LOADING = 4; + public final static int VIEW_TYPE_HASHTAG_CELL = 5; + public final static int VIEW_TYPE_CATEGORY_LIST = 6; + public final static int VIEW_TYPE_ADD_BY_PHONE = 7; + public final static int VIEW_TYPE_INVITE_CONTACT_CELL = 8; + public final static int VIEW_TYPE_PUBLIC_POST = 9; + public final static int VIEW_TYPE_EMPTY_RESULT = 10; + + public static enum Filter { + All(0, R.string.SearchMessagesFilterAll, R.string.SearchMessagesFilterAllFrom), + Private(8, R.string.SearchMessagesFilterPrivate, R.string.SearchMessagesFilterPrivateFrom), + Groups(4, R.string.SearchMessagesFilterGroup, R.string.SearchMessagesFilterGroupFrom), + Channels(2, R.string.SearchMessagesFilterChannels, R.string.SearchMessagesFilterChannelsFrom); + + public final int flags; + public final int strResId; + public final int strFromResId; + + Filter(int flags, int strResId, int strFromResId) { + this.flags = flags; + this.strResId = strResId; + this.strFromResId = strFromResId; + } + } + + private Filter currentMessagesFilter = Filter.All; + private boolean forceLoadingMessages; + public void resetFilter() { + currentMessagesFilter = Filter.All; + } + + private final Context mContext; private Runnable searchRunnable; private Runnable searchRunnable2; private int searchHashtagRequest = -1; @@ -103,6 +139,7 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter { private boolean localMessagesSearchEndReached; public int localMessagesLoadingRow = -1; private String lastMessagesSearchString; + private int lastMessagesSearchFilterFlags; private String currentMessagesQuery; private int nextSearchRate; private int lastSearchId; @@ -486,6 +523,7 @@ private void searchMessagesInternal(final String query, int searchId) { searchForumResultMessages.clear(); lastReqId = 0; lastMessagesSearchString = null; + lastMessagesSearchFilterFlags = 0; searchWas = false; notifyDataSetChanged(); return; @@ -504,12 +542,18 @@ private void searchMessagesInternal(final String query, int searchId) { } final TLRPC.TL_messages_searchGlobal req = new TLRPC.TL_messages_searchGlobal(); + req.broadcasts_only = (currentMessagesFilter.flags & 2) != 0; + req.groups_only = (currentMessagesFilter.flags & 4) != 0; + req.users_only = (currentMessagesFilter.flags & 8) != 0; req.limit = 20; req.q = query; req.filter = new TLRPC.TL_inputMessagesFilterEmpty(); req.flags |= 1; req.folder_id = folderId; - if (query.equals(lastMessagesSearchString) && !searchResultMessages.isEmpty() && lastMessagesSearchId == lastSearchId) { + if (!query.equals(lastMessagesSearchString)) { + forceLoadingMessages = false; + } + if (query.equals(lastMessagesSearchString) && lastMessagesSearchFilterFlags == currentMessagesFilter.flags && !searchResultMessages.isEmpty() && lastMessagesSearchId == lastSearchId) { MessageObject lastMessage = searchResultMessages.get(searchResultMessages.size() - 1); req.offset_id = lastMessage.getId(); req.offset_rate = nextSearchRate; @@ -521,6 +565,7 @@ private void searchMessagesInternal(final String query, int searchId) { req.offset_peer = new TLRPC.TL_inputPeerEmpty(); } lastMessagesSearchString = query; + lastMessagesSearchFilterFlags = currentMessagesFilter.flags; lastReqId++; final int currentReqId = lastReqId; reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { @@ -544,7 +589,20 @@ private void searchMessagesInternal(final String query, int searchId) { messageObject.setQuery(query); } } - AndroidUtilities.runOnUIThread(() -> { + HashSet> dialogIdsToGetMaxRead = new HashSet<>(); + if (error == null) { + TLRPC.messages_Messages res = (TLRPC.messages_Messages) response; + for (int a = 0; a < res.messages.size(); a++) { + TLRPC.Message message = res.messages.get(a); + long dialog_id = MessageObject.getDialogId(message); + ConcurrentHashMap read_max = message.out ? MessagesController.getInstance(currentAccount).dialogs_read_outbox_max : MessagesController.getInstance(currentAccount).dialogs_read_inbox_max; + Integer value = read_max.get(dialog_id); + if (value == null) { + dialogIdsToGetMaxRead.add(new Pair<>(message.out, dialog_id)); + } + } + } + Runnable done = () -> { if (currentReqId == lastReqId && (searchId <= 0 || searchId == lastSearchId)) { waitingResponseCount--; if (error == null) { @@ -582,11 +640,9 @@ private void searchMessagesInternal(final String query, int searchId) { long dialog_id = MessageObject.getDialogId(message); ConcurrentHashMap read_max = message.out ? MessagesController.getInstance(currentAccount).dialogs_read_outbox_max : MessagesController.getInstance(currentAccount).dialogs_read_inbox_max; Integer value = read_max.get(dialog_id); - if (value == null) { - value = MessagesStorage.getInstance(currentAccount).getDialogReadMax(message.out, dialog_id); - read_max.put(dialog_id, value); + if (value != null) { + message.unread = value < message.id; } - message.unread = value < message.id; } searchWas = true; messagesSearchEndReached = res.messages.size() != 20; @@ -606,19 +662,38 @@ private void searchMessagesInternal(final String query, int searchId) { } globalSearchCollapsed = true; phoneCollapsed = true; + forceLoadingMessages = false; + if (messagesEmptyLayout != null) { + messagesEmptyLayout.setQuery(lastMessagesSearchString); + } notifyDataSetChanged(); } } reqId = 0; - }); + }; + if (dialogIdsToGetMaxRead.isEmpty()) { + AndroidUtilities.runOnUIThread(done); + } else { + MessagesStorage.getInstance(currentAccount).getStorageQueue().postRunnable(() -> { + MessagesController messagesController = MessagesController.getInstance(currentAccount); + for (Pair p : dialogIdsToGetMaxRead) { + final boolean out = p.first; + final long did = p.second; + ConcurrentHashMap read_max = out ? messagesController.dialogs_read_outbox_max : messagesController.dialogs_read_inbox_max; + final int dialog_read_max = MessagesStorage.getInstance(currentAccount).getDialogReadMaxSync(out, did); + read_max.put(did, dialog_read_max); + } + AndroidUtilities.runOnUIThread(done); + }); + } }, ConnectionsManager.RequestFlagFailOnServerErrors); } public boolean hasRecentSearch() { - return resentSearchAvailable() && getRecentItemsCount() > 0; + return recentSearchAvailable() && getRecentItemsCount() > 0; } - private boolean resentSearchAvailable() { + private boolean recentSearchAvailable() { return ( dialogsType != DialogsActivity.DIALOGS_TYPE_ADD_USERS_TO && dialogsType != DialogsActivity.DIALOGS_TYPE_USERS_ONLY && @@ -968,7 +1043,7 @@ private void updateSearchResults(final ArrayList result, final ArrayList } } - if (resentSearchAvailable() && !(obj instanceof TLRPC.EncryptedChat)) { + if (recentSearchAvailable() && !(obj instanceof TLRPC.EncryptedChat)) { boolean foundInRecent = false; if (delegate != null && delegate.getSearchForumDialogId() == dialogId) { foundInRecent = true; @@ -1297,6 +1372,9 @@ public int getItemCount() { localMessagesLoadingRow = count; } int messagesCount = searchResultMessages.size(); + if ((currentMessagesFilter != Filter.All || forceLoadingMessages) && searchResultMessages.isEmpty()) { + messagesCount = forceLoadingMessages ? 3 : 1; + } if (!searchForumResultMessages.isEmpty() && !localMessagesSearchEndReached) { messagesCount = 0; } @@ -1470,6 +1548,9 @@ public boolean isGlobalSearch(int i) { } i -= localMessagesCount; int messagesCount = searchResultMessages.isEmpty() ? 0 : searchResultMessages.size() + 1; + if ((currentMessagesFilter != Filter.All || forceLoadingMessages) && searchResultMessages.isEmpty()) { + messagesCount = forceLoadingMessages ? 4 : 2; + } if (i > 0 && i < messagesCount) { return false; } @@ -1484,9 +1565,11 @@ public long getItemId(int i) { @Override public boolean isEnabled(RecyclerView.ViewHolder holder) { int type = holder.getItemViewType(); - return type != 1 && type != 4; + return type != 1 && type != 4 && type != VIEW_TYPE_EMPTY_RESULT; } + private EmptyLayout messagesEmptyLayout; + @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view; @@ -1565,6 +1648,17 @@ public boolean supportsPredictiveItemAnimations() { case VIEW_TYPE_INVITE_CONTACT_CELL: view = new ProfileSearchCell(mContext); break; + case VIEW_TYPE_EMPTY_RESULT: + view = messagesEmptyLayout = new EmptyLayout(mContext, resourcesProvider, () -> { + currentMessagesFilter = Filter.All; + searchResultMessages.clear(); + if (messagesSectionPosition >= 0 && messagesSectionPosition < getItemCount()) { + notifyItemChanged(messagesSectionPosition); + } + loadMoreSearchMessages(); + }); + messagesEmptyLayout.setQuery(lastMessagesSearchString); + break; case VIEW_TYPE_ADD_BY_PHONE: default: view = new TextCell(mContext, 16, false); @@ -1582,6 +1676,8 @@ private boolean hasHints() { return !searchWas && !MediaDataController.getInstance(currentAccount).hints.isEmpty() && (dialogsType != DialogsActivity.DIALOGS_TYPE_START_ATTACH_BOT || dialogsActivity.allowUsers); } + private int messagesSectionPosition = -1; + @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { @@ -1702,7 +1798,7 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { } cell.setChecked(false, false); boolean savedMessages = false; - if (user != null && user.id == selfUserId) { + if (user != null && user.id == selfUserId && dialogsType != DialogsActivity.DIALOGS_TYPE_BOT_SELECT_VERIFY) { name = LocaleController.getString(R.string.SavedMessages); username = null; savedMessages = true; @@ -1755,6 +1851,7 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { } position -= 1 + publicPosts.size(); } + ArrayList globalSearch = searchAdapterHelper.getGlobalSearch(); if (isRecentSearchDisplayed() || !searchTopics.isEmpty() || !searchContacts.isEmpty() || !publicPosts.isEmpty()) { int offset = hasHints() ? 1 : 0; if (position < offset) { @@ -1775,14 +1872,13 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { }); } return; - } else if (position == getRecentItemsCount() + (searchTopics.isEmpty() ? 0 : searchTopics.size() + 1) + (searchContacts.isEmpty() ? 0 : searchContacts.size() + 1)) { + } else if (position == getRecentItemsCount() + (searchTopics.isEmpty() ? 0 : searchTopics.size() + 1) + (searchContacts.isEmpty() ? 0 : searchContacts.size() + 1) && !searchResult.isEmpty()) { cell.setText(LocaleController.getString(R.string.SearchAllChatsShort)); return; } else { position -= getRecentItemsCount(); } } - ArrayList globalSearch = searchAdapterHelper.getGlobalSearch(); int localCount = searchResult.size(); int localServerCount = searchAdapterHelper.getLocalServerSearch().size(); int phoneCount = searchAdapterHelper.getPhoneSearch().size(); @@ -1795,9 +1891,13 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { } int localMessagesCount = searchForumResultMessages.isEmpty() ? 0 : searchForumResultMessages.size() + 1; int messagesCount = searchResultMessages.isEmpty() ? 0 : searchResultMessages.size() + 1; + if ((currentMessagesFilter != Filter.All || forceLoadingMessages) && searchResultMessages.isEmpty()) { + messagesCount = forceLoadingMessages ? 4 : 2; + } String title = null; boolean showMore = false; Runnable onClick = null; + CharSequence customRightText = null; if (!searchTopics.isEmpty()) { if (position == 0) { title = LocaleController.getString(R.string.Topics); @@ -1843,6 +1943,7 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { itemAnimator.setRemoveDelay(disableRemoveAnimation ? 270 : 0); } globalSearchCollapsed = !globalSearchCollapsed; + cell.setRightTextMargin(16); cell.setRightText(globalSearchCollapsed ? LocaleController.getString(R.string.ShowMore) : LocaleController.getString(R.string.ShowLess), globalSearchCollapsed); showMoreHeader = null; View parent = (View) cell.getParent(); @@ -1888,8 +1989,31 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { } } else if (delegate != null && localMessagesCount > 0 && position - globalCount <= 1) { TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-delegate.getSearchForumDialogId()); - title = LocaleController.formatString("SearchMessagesIn", R.string.SearchMessagesIn, (chat == null ? "null" : chat.title)); + title = LocaleController.formatString(R.string.SearchMessagesIn, (chat == null ? "null" : chat.title)); } else { + messagesSectionPosition = position; + customRightText = getFilterFromString(currentMessagesFilter); + onClick = () -> { + ItemOptions o = ItemOptions.makeOptions(dialogsActivity, cell); + for (Filter f : Filter.values()) { + final boolean isCurrent = f.flags == currentMessagesFilter.flags; + o.addChecked(isCurrent, LocaleController.getString(f.strResId), () -> { + if (isCurrent) return; + cell.setRightText(getFilterFromString(currentMessagesFilter = f)); + cell.setRightTextMargin(6); + searchResultMessages.clear(); + forceLoadingMessages = true; + notifyDataSetChanged(); + loadMoreSearchMessages(); + }); + } + o + .setGravity(Gravity.RIGHT) + .setOnTopOfScrim() + .setDrawScrim(false) + .setDimAlpha(0) + .show(); + }; title = LocaleController.getString(R.string.SearchMessages); } } @@ -1897,9 +2021,14 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (onClick == null) { cell.setText(title); + } else if (customRightText != null) { + final Runnable finalOnClick = onClick; + cell.setText(title, customRightText, e -> finalOnClick.run()); + cell.setRightTextMargin(6); } else { final Runnable finalOnClick = onClick; cell.setText(title, showMore ? LocaleController.getString(R.string.ShowMore) : LocaleController.getString(R.string.ShowLess), e -> finalOnClick.run()); + cell.setRightTextMargin(16); } } break; @@ -1952,6 +2081,17 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { } } + private ColoredImageSpan filterArrowsIcon; + private CharSequence getFilterFromString(Filter filter) { + SpannableStringBuilder sb = new SpannableStringBuilder(LocaleController.getString(filter.strFromResId)); + sb.append("v"); +// if (filterArrowsIcon == null) { + filterArrowsIcon = new ColoredImageSpan(R.drawable.arrows_select); +// } + sb.setSpan(filterArrowsIcon, sb.length() - 1, sb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + return sb; + } + boolean globalSearchCollapsed = true; boolean phoneCollapsed = true; @@ -2014,6 +2154,9 @@ public int getItemViewType(int i) { globalCount = 4; } int messagesCount = searchResultMessages.isEmpty() ? 0 : searchResultMessages.size() + 1; + if ((currentMessagesFilter != Filter.All || forceLoadingMessages) && searchResultMessages.isEmpty()) { + messagesCount = forceLoadingMessages ? 4 : 2; + } if (!searchForumResultMessages.isEmpty() && !localMessagesSearchEndReached) { messagesCount = 0; } @@ -2063,6 +2206,10 @@ public int getItemViewType(int i) { if (i >= 0 && i < messagesCount) { if (i == 0) { return VIEW_TYPE_GRAY_SECTION; + } else if (forceLoadingMessages && searchResultMessages.isEmpty()) { + return VIEW_TYPE_LOADING; + } else if (currentMessagesFilter != Filter.All && searchResultMessages.isEmpty()) { + return VIEW_TYPE_EMPTY_RESULT; } else { return VIEW_TYPE_DIALOG_CELL; } @@ -2157,4 +2304,48 @@ protected void openPublicPosts() { protected void openBotApp(TLRPC.User bot) { } + + private static class EmptyLayout extends LinearLayout { + + private TextView textView; + public EmptyLayout(Context context, Theme.ResourcesProvider resourcesProvider, Runnable onClickAll) { + super(context); + + setOrientation(LinearLayout.VERTICAL); + + BackupImageView imageView = new BackupImageView(context); + imageView.setImageDrawable(new RLottieDrawable(R.raw.utyan_empty, "utyan_empty", dp(120), dp(120))); + addView(imageView, LayoutHelper.createLinear(120, 120, Gravity.CENTER_HORIZONTAL, 0, 27, 0, 0)); + + TextView titleView = new TextView(context); + titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 17); + titleView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText, resourcesProvider)); + titleView.setTypeface(AndroidUtilities.bold()); + titleView.setText(LocaleController.getString(R.string.SearchMessagesFilterEmptyTitle)); + titleView.setGravity(Gravity.CENTER); + addView(titleView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 0, 8, 0, 9)); + + textView = new TextView(context); + textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText, resourcesProvider)); + textView.setText(LocaleController.formatString(R.string.SearchMessagesFilterEmptyText, "")); + textView.setGravity(Gravity.CENTER); + addView(textView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 0, 0, 0, 14)); + + TextView button = new TextView(context); + button.setPadding(dp(12), dp(4), dp(12), dp(4)); + button.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + button.setText(LocaleController.getString(R.string.SearchMessagesFilterEmptySearchAll)); + button.setTextColor(Theme.getColor(Theme.key_featuredStickers_addButton, resourcesProvider)); + button.setBackground(Theme.createSimpleSelectorRoundRectDrawable(6, 0, Theme.multAlpha(Theme.getColor(Theme.key_featuredStickers_addButton, resourcesProvider), .15f))); + button.setOnClickListener(v -> onClickAll.run()); + addView(button, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 0, 0, 0, 38)); + } + + public void setQuery(String query) { + textView.setText(LocaleController.formatString(R.string.SearchMessagesFilterEmptyText, query)); + + } + + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ArchiveSettingsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ArchiveSettingsActivity.java index 0f9a41fa62..de4c3abcd2 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ArchiveSettingsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ArchiveSettingsActivity.java @@ -15,23 +15,19 @@ import org.telegram.messenger.BotWebViewVibrationEffect; import org.telegram.messenger.LocaleController; import org.telegram.messenger.NotificationCenter; -import org.telegram.messenger.NotificationsController; import org.telegram.messenger.R; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Cells.HeaderCell; import org.telegram.ui.Cells.TextCheckCell; import org.telegram.ui.Cells.TextInfoPrivacyCell; -import org.telegram.ui.Cells.TextSettingsCell; import org.telegram.ui.Components.Bulletin; -import org.telegram.ui.Components.BulletinFactory; import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.ListView.AdapterWithDiffUtils; -import org.telegram.ui.Components.Premium.PremiumFeatureBottomSheet; -import org.telegram.ui.Components.Premium.PremiumPreviewBottomSheet; import org.telegram.ui.Components.RecyclerListView; import java.util.ArrayList; @@ -270,7 +266,7 @@ public void onFragmentDestroy() { super.onFragmentDestroy(); if (changed) { - TLRPC.TL_account_setGlobalPrivacySettings req = new TLRPC.TL_account_setGlobalPrivacySettings(); + TL_account.setGlobalPrivacySettings req = new TL_account.setGlobalPrivacySettings(); req.settings = settings; getConnectionsManager().sendRequest(req, (response, error) -> {}); changed = false; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java index ffbaf80eaa..4eb4a1b60b 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java @@ -114,7 +114,6 @@ import androidx.viewpager.widget.ViewPager; import com.google.android.exoplayer2.ui.AspectRatioFrameLayout; -import com.google.android.exoplayer2.util.Log; import org.json.JSONObject; import org.telegram.messenger.AndroidUtilities; @@ -1249,7 +1248,9 @@ public void run() { if (checkingForLongPress && windowView != null) { checkingForLongPress = false; if (pressedLink != null) { - windowView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + windowView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} showCopyPopup(pressedLink.getSpan().getUrl()); pressedLink = null; pressedLinkOwnerLayout = null; @@ -1263,10 +1264,14 @@ public void run() { textSelectionHelper.trySelect(pressedLinkOwnerView); } if (textSelectionHelper.isInSelectionMode()) { - windowView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + windowView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} } } else if (pressedLinkOwnerLayout != null && pressedLinkOwnerView != null) { - windowView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + windowView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} int[] location = new int[2]; pressedLinkOwnerView.getLocationInWindow(location); @@ -8446,15 +8451,20 @@ public void onHideCustomView() { webView.setWebViewClient(new WebViewClient() { @Override public boolean onRenderProcessGone(WebView view, RenderProcessGoneDetail detail) { - if (LaunchActivity.instance != null && LaunchActivity.instance.isFinishing()) { + try { + if (LaunchActivity.instance != null && LaunchActivity.instance.isFinishing()) { + return true; + } + new AlertDialog.Builder(getContext(), null) + .setTitle(getString(R.string.ChromeCrashTitle)) + .setMessage(AndroidUtilities.replaceSingleTag(getString(R.string.ChromeCrashMessage), () -> Browser.openUrl(getContext(), "https://play.google.com/store/apps/details?id=com.google.android.webview"))) + .setPositiveButton(getString(R.string.OK), null) + .show(); return true; + } catch (Exception e) { + FileLog.e(e); + return false; } - new AlertDialog.Builder(getContext(), null) - .setTitle(getString(R.string.ChromeCrashTitle)) - .setMessage(AndroidUtilities.replaceSingleTag(getString(R.string.ChromeCrashMessage), () -> Browser.openUrl(getContext(), "https://play.google.com/store/apps/details?id=com.google.android.webview"))) - .setPositiveButton(getString(R.string.OK), null) - .show(); - return true; } @Override @@ -12668,7 +12678,7 @@ public PageBlocksPhotoViewerProvider(List pageBlocks) { } @Override - public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { + public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview, boolean closing) { if (index < 0 || index >= pageBlocks.size()) { return null; } @@ -13281,6 +13291,7 @@ public String getSubtitle() { try { try { Uri uri2 = Uri.parse(url); + if (uri2.getHost() == null) uri2 = uri; String hostname = Browser.IDN_toUnicode(uri2.getHost()); String[] levels = hostname.split("\\."); if (levels.length > 2 && actionBar != null && HintView2.measureCorrectly(hostname, actionBar.titlePaint) > AndroidUtilities.displaySize.x - dp(3 * 54)) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/AvatarSpan.java b/TMessagesProj/src/main/java/org/telegram/ui/AvatarSpan.java index 3e36da1e9c..efe328fe1d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/AvatarSpan.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/AvatarSpan.java @@ -16,6 +16,7 @@ import org.telegram.messenger.ImageReceiver; import org.telegram.messenger.MessagesController; +import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Components.AvatarDrawable; @@ -109,6 +110,11 @@ public void setUser(TLRPC.User user) { imageReceiver.setForUserOrChat(user, avatarDrawable); } + public void setObject(TLObject obj) { + avatarDrawable.setInfo(currentAccount, obj); + imageReceiver.setForUserOrChat(obj, avatarDrawable); + } + public void setName(String name) { avatarDrawable.setInfo(0, name, null, null, null, null); imageReceiver.setForUserOrChat(null, avatarDrawable); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/BubbleActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/BubbleActivity.java index c817ac042b..69ababe710 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/BubbleActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/BubbleActivity.java @@ -38,11 +38,13 @@ public class BubbleActivity extends BasePermissionsActivity implements INavigationLayout.INavigationLayoutDelegate { + public static BubbleActivity instance; + private boolean finished; private ArrayList mainFragmentsStack = new ArrayList<>(); private PasscodeView passcodeView; - private INavigationLayout actionBarLayout; + public INavigationLayout actionBarLayout; protected DrawerLayoutContainer drawerLayoutContainer; private Intent passcodeSaveIntent; @@ -105,6 +107,7 @@ protected void onCreate(Bundle savedInstanceState) { actionBarLayout.removeAllFragments(); handleIntent(getIntent(), false, savedInstanceState != null, false, UserConfig.selectedAccount, 0); + instance = this; } private void showPasscodeActivity() { @@ -196,6 +199,7 @@ private void onFinish() { lockRunnable = null; } finished = true; + instance = null; } public void presentFragment(BaseFragment fragment) { @@ -215,6 +219,7 @@ protected void onPause() { if (passcodeView != null) { passcodeView.onPause(); } + instance = null; } @Override @@ -225,6 +230,7 @@ protected void onDestroy() { AccountInstance.getInstance(currentAccount).getConnectionsManager().setAppPaused(false, false); } onFinish(); + instance = null; } @Override @@ -265,6 +271,7 @@ protected void onResume() { actionBarLayout.dismissDialogs(); passcodeView.onResume(); } + instance = this; } private void onPasscodePause() { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Business/AwayMessagesActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/Business/AwayMessagesActivity.java index 9affeed8ea..3c3dd97ceb 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Business/AwayMessagesActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Business/AwayMessagesActivity.java @@ -15,8 +15,8 @@ import org.telegram.messenger.LocaleController; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; -import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenuItem; import org.telegram.ui.ActionBar.AlertDialog; @@ -109,16 +109,16 @@ private void setValue() { if (recipientsHelper != null) { recipientsHelper.setValue(currentValue == null ? null : currentValue.recipients); } - if (currentValue != null && currentValue.schedule instanceof TLRPC.TL_businessAwayMessageScheduleCustom) { + if (currentValue != null && currentValue.schedule instanceof TL_account.TL_businessAwayMessageScheduleCustom) { schedule = currentValueScheduleType = SCHEDULE_CUSTOM; - scheduleCustomStart = currentScheduleCustomStart = ((TLRPC.TL_businessAwayMessageScheduleCustom) currentValue.schedule).start_date; - scheduleCustomEnd =currentScheduleCustomEnd = ((TLRPC.TL_businessAwayMessageScheduleCustom) currentValue.schedule).end_date; + scheduleCustomStart = currentScheduleCustomStart = ((TL_account.TL_businessAwayMessageScheduleCustom) currentValue.schedule).start_date; + scheduleCustomEnd =currentScheduleCustomEnd = ((TL_account.TL_businessAwayMessageScheduleCustom) currentValue.schedule).end_date; } else { scheduleCustomStart = getConnectionsManager().getCurrentTime(); scheduleCustomEnd = getConnectionsManager().getCurrentTime() + 60 * 60 * 24; - if (currentValue != null && currentValue.schedule instanceof TLRPC.TL_businessAwayMessageScheduleAlways) { + if (currentValue != null && currentValue.schedule instanceof TL_account.TL_businessAwayMessageScheduleAlways) { schedule = currentValueScheduleType = SCHEDULE_ALWAYS; - } else if (currentValue != null && currentValue.schedule instanceof TLRPC.TL_businessAwayMessageScheduleOutsideWorkHours) { + } else if (currentValue != null && currentValue.schedule instanceof TL_account.TL_businessAwayMessageScheduleOutsideWorkHours) { schedule = currentValueScheduleType = SCHEDULE_OUTSIDE_HOURS; } else { schedule = currentValueScheduleType = SCHEDULE_ALWAYS; @@ -193,18 +193,18 @@ private void processDone() { doneButtonDrawable.animateToProgress(1f); TLRPC.UserFull userFull = getMessagesController().getUserFull(getUserConfig().getClientUserId()); - TLRPC.TL_account_updateBusinessAwayMessage req = new TLRPC.TL_account_updateBusinessAwayMessage(); + TL_account.updateBusinessAwayMessage req = new TL_account.updateBusinessAwayMessage(); if (enabled) { - req.message = new TLRPC.TL_inputBusinessAwayMessage(); + req.message = new TL_account.TL_inputBusinessAwayMessage(); req.message.offline_only = offline_only; req.message.shortcut_id = reply.id; req.message.recipients = recipientsHelper.getInputValue(); if (schedule == SCHEDULE_ALWAYS) { - req.message.schedule = new TLRPC.TL_businessAwayMessageScheduleAlways(); + req.message.schedule = new TL_account.TL_businessAwayMessageScheduleAlways(); } else if (schedule == SCHEDULE_OUTSIDE_HOURS) { - req.message.schedule = new TLRPC.TL_businessAwayMessageScheduleOutsideWorkHours(); + req.message.schedule = new TL_account.TL_businessAwayMessageScheduleOutsideWorkHours(); } else if (schedule == SCHEDULE_CUSTOM) { - TLRPC.TL_businessAwayMessageScheduleCustom custom = new TLRPC.TL_businessAwayMessageScheduleCustom(); + TL_account.TL_businessAwayMessageScheduleCustom custom = new TL_account.TL_businessAwayMessageScheduleCustom(); custom.start_date = scheduleCustomStart; custom.end_date = scheduleCustomEnd; req.message.schedule = custom; @@ -213,7 +213,7 @@ private void processDone() { if (userFull != null) { userFull.flags2 |= 8; - userFull.business_away_message = new TLRPC.TL_businessAwayMessage(); + userFull.business_away_message = new TL_account.TL_businessAwayMessage(); userFull.business_away_message.offline_only = offline_only; userFull.business_away_message.shortcut_id = reply.id; userFull.business_away_message.recipients = recipientsHelper.getValue(); @@ -258,7 +258,7 @@ public boolean onBackPressed() { return super.onBackPressed(); } - public TLRPC.TL_businessAwayMessage currentValue; + public TL_account.TL_businessAwayMessage currentValue; public int currentValueScheduleType; public boolean enabled; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessBotButton.java b/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessBotButton.java index 9fdaa2d715..a6c472bbd0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessBotButton.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessBotButton.java @@ -20,6 +20,7 @@ import org.telegram.messenger.browser.Browser; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.ChatActivity; import org.telegram.ui.Components.AnimatedTextView; @@ -110,7 +111,7 @@ public BusinessBotButton(Context context, ChatActivity chatActivity, Theme.Resou .putInt("dialog_botflags" + dialogId, flags) .apply(); - TLRPC.TL_account_toggleConnectedBotPaused req = new TLRPC.TL_account_toggleConnectedBotPaused(); + TL_account.toggleConnectedBotPaused req = new TL_account.toggleConnectedBotPaused(); req.peer = MessagesController.getInstance(currentAccount).getInputPeer(dialogId); req.paused = paused; ConnectionsManager.getInstance(currentAccount).sendRequest(req, null); @@ -133,7 +134,7 @@ public BusinessBotButton(Context context, ChatActivity chatActivity, Theme.Resou menuView.setOnClickListener(e -> { ItemOptions itemOptions = ItemOptions.makeOptions(chatActivity.getLayoutContainer(), resourcesProvider, menuView); itemOptions.add(R.drawable.msg_cancel, LocaleController.getString(R.string.BizBotRemove), true, () -> { - TLRPC.TL_account_disablePeerConnectedBot req = new TLRPC.TL_account_disablePeerConnectedBot(); + TL_account.disablePeerConnectedBot req = new TL_account.disablePeerConnectedBot(); req.peer = MessagesController.getInstance(currentAccount).getInputPeer(dialogId); ConnectionsManager.getInstance(currentAccount).sendRequest(req, null); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessChatbotController.java b/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessChatbotController.java index 6a4f14e9b0..492c265cd1 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessChatbotController.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessChatbotController.java @@ -5,7 +5,7 @@ import org.telegram.messenger.UserConfig; import org.telegram.messenger.Utilities; import org.telegram.tgnet.ConnectionsManager; -import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import java.util.ArrayList; @@ -37,18 +37,18 @@ private BusinessChatbotController(int account) { } private long lastTime; - private TLRPC.TL_account_connectedBots value; - private ArrayList> callbacks = new ArrayList<>(); + private TL_account.connectedBots value; + private ArrayList> callbacks = new ArrayList<>(); private boolean loading, loaded; - public void load(Utilities.Callback callback) { + public void load(Utilities.Callback callback) { callbacks.add(callback); if (loading) return; if (System.currentTimeMillis() - lastTime > 1000 * 60 || !loaded) { loading = true; - ConnectionsManager.getInstance(currentAccount).sendRequest(new TLRPC.TL_account_getConnectedBots(), (res, err) -> AndroidUtilities.runOnUIThread(() -> { + ConnectionsManager.getInstance(currentAccount).sendRequest(new TL_account.getConnectedBots(), (res, err) -> AndroidUtilities.runOnUIThread(() -> { loading = false; - value = res instanceof TLRPC.TL_account_connectedBots ? (TLRPC.TL_account_connectedBots) res : null; + value = res instanceof TL_account.connectedBots ? (TL_account.connectedBots) res : null; if (value != null) { MessagesController.getInstance(currentAccount).putUsers(value.users, false); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessIntroActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessIntroActivity.java index e11ceb970e..4ec3a2cdc0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessIntroActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessIntroActivity.java @@ -28,6 +28,7 @@ import org.telegram.messenger.R; import org.telegram.messenger.Utilities; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenuItem; import org.telegram.ui.ActionBar.AlertDialog; @@ -433,10 +434,10 @@ private void processDone() { doneButtonDrawable.animateToProgress(1f); TLRPC.UserFull userFull = getMessagesController().getUserFull(getUserConfig().getClientUserId()); - TLRPC.TL_account_updateBusinessIntro req = new TLRPC.TL_account_updateBusinessIntro(); + TL_account.updateBusinessIntro req = new TL_account.updateBusinessIntro(); if (!isEmpty()) { req.flags |= 1; - req.intro = new TLRPC.TL_inputBusinessIntro(); + req.intro = new TL_account.TL_inputBusinessIntro(); req.intro.title = titleEdit.getText().toString(); req.intro.description = messageEdit.getText().toString(); if (!stickerRandom && (sticker != null || inputSticker != null)) { @@ -450,7 +451,7 @@ private void processDone() { if (userFull != null) { userFull.flags2 |= 16; - userFull.business_intro = new TLRPC.TL_businessIntro(); + userFull.business_intro = new TL_account.TL_businessIntro(); userFull.business_intro.title = req.intro.title; userFull.business_intro.description = req.intro.description; if (!stickerRandom && sticker != null) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessLinksActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessLinksActivity.java index 34bec4b989..8e0360979c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessLinksActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessLinksActivity.java @@ -46,6 +46,7 @@ import org.telegram.messenger.UserConfig; import org.telegram.messenger.UserObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.AlertDialogDecor; import org.telegram.ui.ActionBar.BaseFragment; @@ -70,7 +71,6 @@ import org.telegram.ui.PrivacyControlActivity; import java.util.ArrayList; -import java.util.Objects; public class BusinessLinksActivity extends UniversalFragment implements NotificationCenter.NotificationCenterDelegate { @@ -78,7 +78,7 @@ public class BusinessLinksActivity extends UniversalFragment implements Notifica private static AlertDialog currentDialog; - public static void openRenameAlert(Context context, int currentAccount, TLRPC.TL_businessChatLink link, Theme.ResourcesProvider resourcesProvider, boolean forceNotAdaptive) { + public static void openRenameAlert(Context context, int currentAccount, TL_account.TL_businessChatLink link, Theme.ResourcesProvider resourcesProvider, boolean forceNotAdaptive) { BaseFragment fragment = LaunchActivity.getLastFragment(); Activity activity = AndroidUtilities.findActivity(context); View currentFocus = activity != null ? activity.getCurrentFocus() : null; @@ -322,7 +322,7 @@ protected void fillItems(ArrayList items, UniversalAdapter adapter) { if (BusinessLinksController.getInstance(currentAccount).canAddNew()) { items.add(UItem.asButton(BUTTON_ADD, R.drawable.menu_link_create, getString(R.string.BusinessLinksAdd)).accent()); } - for (TLRPC.TL_businessChatLink businessLink : BusinessLinksController.getInstance(currentAccount).links) { + for (TL_account.TL_businessChatLink businessLink : BusinessLinksController.getInstance(currentAccount).links) { UItem item = UItem.asBusinessChatLink(new BusinessLinkWrapper(businessLink)); items.add(item); } @@ -377,7 +377,7 @@ protected void onClick(UItem item, View view, int position, float x, float y) { @Override protected boolean onLongClick(UItem item, View view, int position, float x, float y) { if (item.viewType == UniversalAdapter.VIEW_TYPE_BUSINESS_LINK && item.object instanceof BusinessLinkWrapper) { - TLRPC.TL_businessChatLink link = ((BusinessLinkWrapper) item.object).link; + TL_account.TL_businessChatLink link = ((BusinessLinkWrapper) item.object).link; ItemOptions options = ItemOptions.makeOptions(this, view); options.add(R.drawable.msg_copy, getString(R.string.Copy), () -> { @@ -422,22 +422,22 @@ public void didReceivedNotification(int id, int account, Object... args) { listView.adapter.update(true); } } else if (id == NotificationCenter.businessLinkCreated) { - TLRPC.TL_businessChatLink link = (TLRPC.TL_businessChatLink) args[0]; + TL_account.TL_businessChatLink link = (TL_account.TL_businessChatLink) args[0]; Bundle activityArgs = new Bundle(); activityArgs.putInt("chatMode", ChatActivity.MODE_EDIT_BUSINESS_LINK); activityArgs.putString("business_link", link.link); ChatActivity chatActivity = new ChatActivity(activityArgs); presentFragment(chatActivity); } else if (id == NotificationCenter.needDeleteBusinessLink) { - TLRPC.TL_businessChatLink link = (TLRPC.TL_businessChatLink) args[0]; + TL_account.TL_businessChatLink link = (TL_account.TL_businessChatLink) args[0]; BusinessLinksController.getInstance(currentAccount).deleteLinkUndoable(this, link.link); } } public static class BusinessLinkWrapper { - TLRPC.TL_businessChatLink link; + TL_account.TL_businessChatLink link; - public BusinessLinkWrapper(TLRPC.TL_businessChatLink link) { + public BusinessLinkWrapper(TL_account.TL_businessChatLink link) { this.link = link; } @@ -466,7 +466,7 @@ public static class BusinessLinkView extends FrameLayout { private boolean needDivider; - private TLRPC.TL_businessChatLink businessLink; + private TL_account.TL_businessChatLink businessLink; public BusinessLinkView(Context context, Theme.ResourcesProvider resourcesProvider) { super(context); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessLinksController.java b/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessLinksController.java index 973ccac524..498befdd56 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessLinksController.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessLinksController.java @@ -16,6 +16,7 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.NativeByteBuffer; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.Components.BulletinFactory; @@ -47,7 +48,7 @@ public static BusinessLinksController getInstance(int num) { public final int currentAccount; - public final ArrayList links = new ArrayList<>(); + public final ArrayList links = new ArrayList<>(); private boolean loading = false; private boolean loaded = false; @@ -85,7 +86,7 @@ private void load(boolean fromCache, boolean forceReload) { if (fromCache) { MessagesStorage storage = MessagesStorage.getInstance(currentAccount); storage.getStorageQueue().postRunnable(() -> { - final ArrayList result = new ArrayList<>(); + final ArrayList result = new ArrayList<>(); final ArrayList users = new ArrayList<>(); final ArrayList chats = new ArrayList<>(); @@ -95,7 +96,7 @@ private void load(boolean fromCache, boolean forceReload) { cursor = db.queryFinalized("SELECT data FROM business_links ORDER BY order_value ASC"); while (cursor.next()) { NativeByteBuffer data = cursor.byteBufferValue(0); - TLRPC.TL_businessChatLink link = TLRPC.TL_businessChatLink.TLdeserialize(data, data.readInt32(false), false); + TL_account.TL_businessChatLink link = TL_account.TL_businessChatLink.TLdeserialize(data, data.readInt32(false), false); result.add(link); } cursor.dispose(); @@ -103,7 +104,7 @@ private void load(boolean fromCache, boolean forceReload) { final ArrayList usersToLoad = new ArrayList<>(); final ArrayList chatsToLoad = new ArrayList<>(); for (int i = 0; i < result.size(); ++i) { - TLRPC.TL_businessChatLink link = result.get(i); + TL_account.TL_businessChatLink link = result.get(i); if (!link.entities.isEmpty()) { for (int a = 0; a < link.entities.size(); a++) { TLRPC.MessageEntity entity = link.entities.get(a); @@ -141,10 +142,10 @@ private void load(boolean fromCache, boolean forceReload) { }); }); } else { - TLRPC.TL_account_getBusinessChatLinks req = new TLRPC.TL_account_getBusinessChatLinks(); + TL_account.getBusinessChatLinks req = new TL_account.getBusinessChatLinks(); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { - if (res instanceof TLRPC.TL_account_businessChatLinks) { - TLRPC.TL_account_businessChatLinks businessChatLinks = (TLRPC.TL_account_businessChatLinks) res; + if (res instanceof TL_account.businessChatLinks) { + TL_account.businessChatLinks businessChatLinks = (TL_account.businessChatLinks) res; links.clear(); links.addAll(businessChatLinks.links); @@ -167,13 +168,13 @@ private void load(boolean fromCache, boolean forceReload) { } public void createEmptyLink() { - TLRPC.TL_account_createBusinessChatLink req = new TLRPC.TL_account_createBusinessChatLink(); - req.link = new TLRPC.TL_inputBusinessChatLink(); + TL_account.createBusinessChatLink req = new TL_account.createBusinessChatLink(); + req.link = new TL_account.TL_inputBusinessChatLink(); req.link.message = ""; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { - if (res instanceof TLRPC.TL_businessChatLink) { - TLRPC.TL_businessChatLink businessChatLink = (TLRPC.TL_businessChatLink) res; + if (res instanceof TL_account.TL_businessChatLink) { + TL_account.TL_businessChatLink businessChatLink = (TL_account.TL_businessChatLink) res; links.add(businessChatLink); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.businessLinksUpdated); @@ -185,7 +186,7 @@ public void createEmptyLink() { } public void deleteLinkUndoable(BaseFragment fragment, String slug) { - TLRPC.TL_businessChatLink link = findLink(slug); + TL_account.TL_businessChatLink link = findLink(slug); if (link != null) { int index = links.indexOf(link); links.remove(link); @@ -197,7 +198,7 @@ public void deleteLinkUndoable(BaseFragment fragment, String slug) { NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.businessLinksUpdated); }, () -> { - TLRPC.TL_account_deleteBusinessChatLink req = new TLRPC.TL_account_deleteBusinessChatLink(); + TL_account.deleteBusinessChatLink req = new TL_account.deleteBusinessChatLink(); req.slug = slug; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { @@ -216,12 +217,12 @@ public void deleteLinkUndoable(BaseFragment fragment, String slug) { } public void editLinkMessage(String slug, String message, ArrayList entities, Runnable onDone) { - TLRPC.TL_businessChatLink link = findLink(slug); + TL_account.TL_businessChatLink link = findLink(slug); if (link == null) { return; } - TLRPC.TL_inputBusinessChatLink inputLink = new TLRPC.TL_inputBusinessChatLink(); + TL_account.TL_inputBusinessChatLink inputLink = new TL_account.TL_inputBusinessChatLink(); inputLink.message = message; inputLink.entities = entities; inputLink.title = link.title; @@ -230,12 +231,12 @@ public void editLinkMessage(String slug, String message, ArrayList linksCopy = new ArrayList<>(links); + ArrayList linksCopy = new ArrayList<>(links); MessagesStorage storage = MessagesStorage.getInstance(currentAccount); storage.getStorageQueue().postRunnable(() -> { @@ -254,7 +255,7 @@ private void saveToCache() { db.executeFast("DELETE FROM business_links").stepThis().dispose(); state = db.executeFast("REPLACE INTO business_links VALUES(?, ?)"); for (int i = 0; i < linksCopy.size(); i++) { - TLRPC.TL_businessChatLink link = linksCopy.get(i); + TL_account.TL_businessChatLink link = linksCopy.get(i); NativeByteBuffer data = new NativeByteBuffer(link.getObjectSize()); link.serializeToStream(data); state.requery(); @@ -272,8 +273,8 @@ private void saveToCache() { }); } - private void editLink(TLRPC.TL_businessChatLink link, TLRPC.TL_inputBusinessChatLink inputLink, Runnable onDone) { - TLRPC.TL_account_editBusinessChatLink req = new TLRPC.TL_account_editBusinessChatLink(); + private void editLink(TL_account.TL_businessChatLink link, TL_account.TL_inputBusinessChatLink inputLink, Runnable onDone) { + TL_account.editBusinessChatLink req = new TL_account.editBusinessChatLink(); req.slug = link.link; if (!inputLink.entities.isEmpty()) { @@ -285,8 +286,8 @@ private void editLink(TLRPC.TL_businessChatLink link, TLRPC.TL_inputBusinessChat req.link = inputLink; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { - if (res instanceof TLRPC.TL_businessChatLink) { - TLRPC.TL_businessChatLink updatedLink = (TLRPC.TL_businessChatLink) res; + if (res instanceof TL_account.TL_businessChatLink) { + TL_account.TL_businessChatLink updatedLink = (TL_account.TL_businessChatLink) res; int index = links.indexOf(link); if (index != -1) { links.set(index, updatedLink); @@ -302,9 +303,9 @@ private void editLink(TLRPC.TL_businessChatLink link, TLRPC.TL_inputBusinessChat })); } - public TLRPC.TL_businessChatLink findLink(String slug) { + public TL_account.TL_businessChatLink findLink(String slug) { for (int i = 0; i < links.size(); i++) { - TLRPC.TL_businessChatLink chatLink = links.get(i); + TL_account.TL_businessChatLink chatLink = links.get(i); if (TextUtils.equals(chatLink.link, slug) || TextUtils.equals(chatLink.link, "https://" + slug) || TextUtils.equals(chatLink.link, "https://t.me/m/" + slug) || diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessLinksEmptyView.java b/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessLinksEmptyView.java index 5315bd1694..4d11f368ff 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessLinksEmptyView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessLinksEmptyView.java @@ -17,7 +17,7 @@ import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.LocaleController; import org.telegram.messenger.R; -import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Components.BulletinFactory; @@ -30,7 +30,7 @@ public class BusinessLinksEmptyView extends LinearLayout { private TextView descriptionView; private TextView linkView; - public BusinessLinksEmptyView(Context context, BaseFragment fragment, TLRPC.TL_businessChatLink businessLink, Theme.ResourcesProvider resourcesProvider) { + public BusinessLinksEmptyView(Context context, BaseFragment fragment, TL_account.TL_businessChatLink businessLink, Theme.ResourcesProvider resourcesProvider) { super(context); setOrientation(VERTICAL); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessRecipientsHelper.java b/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessRecipientsHelper.java index b41fbf755f..0faf53a522 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessRecipientsHelper.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Business/BusinessRecipientsHelper.java @@ -3,8 +3,6 @@ import static org.telegram.messenger.LocaleController.formatString; import static org.telegram.messenger.LocaleController.getString; -import android.text.TextUtils; - import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.BotWebViewVibrationEffect; import org.telegram.messenger.FileLog; @@ -13,6 +11,7 @@ import org.telegram.messenger.R; import org.telegram.messenger.UserConfig; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.Components.UItem; @@ -49,7 +48,7 @@ public int getFlags() { } - private TLRPC.TL_businessBotRecipients currentValue; + private TL_account.TL_businessBotRecipients currentValue; public boolean hasChanges() { if (currentValue == null) return true; if (currentValue.exclude_selected != exclude) return true; @@ -72,10 +71,10 @@ public boolean hasChanges() { return false; } - public void setValue(TLRPC.TL_businessRecipients recipients) { + public void setValue(TL_account.TL_businessRecipients recipients) { this.bot = false; if (recipients != null) { - currentValue = new TLRPC.TL_businessBotRecipients(); + currentValue = new TL_account.TL_businessBotRecipients(); currentValue.flags = recipients.flags; currentValue.existing_chats = recipients.existing_chats; currentValue.new_chats = recipients.new_chats; @@ -111,7 +110,7 @@ public void setValue(TLRPC.TL_businessRecipients recipients) { } } - public void setValue(TLRPC.TL_businessBotRecipients recipients) { + public void setValue(TL_account.TL_businessBotRecipients recipients) { this.bot = true; currentValue = recipients; if (currentValue == null) { @@ -139,8 +138,8 @@ public void setValue(TLRPC.TL_businessBotRecipients recipients) { } } - public TLRPC.TL_businessRecipients getValue() { - TLRPC.TL_businessRecipients value = new TLRPC.TL_businessRecipients(); + public TL_account.TL_businessRecipients getValue() { + TL_account.TL_businessRecipients value = new TL_account.TL_businessRecipients(); final int flags = getFlags(); value.flags = flags &~ (32 | 16); value.existing_chats = (flags & PRIVATE_FLAG_EXISTING_CHATS) != 0; @@ -166,8 +165,8 @@ public TLRPC.TL_businessRecipients getValue() { return value; } - public TLRPC.TL_businessBotRecipients getBotValue() { - TLRPC.TL_businessBotRecipients value = new TLRPC.TL_businessBotRecipients(); + public TL_account.TL_businessBotRecipients getBotValue() { + TL_account.TL_businessBotRecipients value = new TL_account.TL_businessBotRecipients(); final int flags = getFlags(); value.flags = flags &~ (32 | 16); value.existing_chats = (flags & PRIVATE_FLAG_EXISTING_CHATS) != 0; @@ -207,8 +206,8 @@ public TLRPC.TL_businessBotRecipients getBotValue() { return value; } - public TLRPC.TL_inputBusinessRecipients getInputValue() { - TLRPC.TL_inputBusinessRecipients value = new TLRPC.TL_inputBusinessRecipients(); + public TL_account.TL_inputBusinessRecipients getInputValue() { + TL_account.TL_inputBusinessRecipients value = new TL_account.TL_inputBusinessRecipients(); final int flags = getFlags(); value.flags = flags &~ (32 | 16); value.existing_chats = (flags & PRIVATE_FLAG_EXISTING_CHATS) != 0; @@ -234,8 +233,8 @@ public TLRPC.TL_inputBusinessRecipients getInputValue() { return value; } - public TLRPC.TL_inputBusinessBotRecipients getBotInputValue() { - TLRPC.TL_inputBusinessBotRecipients value = new TLRPC.TL_inputBusinessBotRecipients(); + public TL_account.TL_inputBusinessBotRecipients getBotInputValue() { + TL_account.TL_inputBusinessBotRecipients value = new TL_account.TL_inputBusinessBotRecipients(); final int flags = getFlags(); value.flags = flags &~ (32 | 16); value.existing_chats = (flags & PRIVATE_FLAG_EXISTING_CHATS) != 0; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Business/ChatAttachAlertQuickRepliesLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Business/ChatAttachAlertQuickRepliesLayout.java index dace795aae..56e3e24df9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Business/ChatAttachAlertQuickRepliesLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Business/ChatAttachAlertQuickRepliesLayout.java @@ -101,7 +101,7 @@ public UserCell(Context context, Theme.ResourcesProvider resourcesProvider) { nameTextView = new SimpleTextView(context) { @Override public boolean setText(CharSequence value, boolean force) { - value = Emoji.replaceEmoji(value, getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false); + value = Emoji.replaceEmoji(value, getPaint().getFontMetricsInt(), false); return super.setText(value, force); } }; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Business/ChatbotsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/Business/ChatbotsActivity.java index 7ebb06f1f6..11dc002cc6 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Business/ChatbotsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Business/ChatbotsActivity.java @@ -7,13 +7,10 @@ import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.drawable.Drawable; -import android.media.Image; import android.text.Editable; import android.text.InputType; -import android.text.SpannableString; import android.text.SpannableStringBuilder; import android.text.Spanned; -import android.text.SpannedString; import android.text.TextUtils; import android.text.TextWatcher; import android.util.LongSparseArray; @@ -26,27 +23,20 @@ import android.widget.LinearLayout; import android.widget.TextView; -import org.checkerframework.checker.guieffect.qual.UI; import org.telegram.messenger.AndroidUtilities; -import org.telegram.messenger.BotWebViewVibrationEffect; import org.telegram.messenger.LocaleController; -import org.telegram.messenger.MessagesController; import org.telegram.messenger.R; -import org.telegram.messenger.UserObject; import org.telegram.messenger.browser.Browser; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenuItem; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Adapters.SearchAdapterHelper; -import org.telegram.ui.Cells.DialogRadioCell; -import org.telegram.ui.Cells.RadioCell; import org.telegram.ui.Cells.TextCheckCell; -import org.telegram.ui.ChangeUsernameActivity; -import org.telegram.ui.Components.Bulletin; import org.telegram.ui.Components.BulletinFactory; import org.telegram.ui.Components.CircularProgressDrawable; import org.telegram.ui.Components.ColoredImageSpan; @@ -57,7 +47,6 @@ import org.telegram.ui.Components.UItem; import org.telegram.ui.Components.UniversalAdapter; import org.telegram.ui.Components.UniversalRecyclerView; -import org.telegram.ui.LaunchActivity; import java.util.ArrayList; @@ -269,8 +258,8 @@ private void scheduleSearch() { } }; - public TLRPC.TL_account_connectedBots currentValue; - public TLRPC.TL_connectedBot currentBot; + public TL_account.connectedBots currentValue; + public TL_account.TL_connectedBot currentBot; public boolean exclude; public boolean allowReply = true; @@ -391,15 +380,15 @@ private void processDone() { ArrayList requests = new ArrayList<>(); if (currentBot != null && (selectedBot == null || currentBot.bot_id != selectedBot.id)) { - TLRPC.TL_account_updateConnectedBot req = new TLRPC.TL_account_updateConnectedBot(); + TL_account.updateConnectedBot req = new TL_account.updateConnectedBot(); req.deleted = true; req.bot = getMessagesController().getInputUser(currentBot.bot_id); - req.recipients = new TLRPC.TL_inputBusinessBotRecipients(); + req.recipients = new TL_account.TL_inputBusinessBotRecipients(); requests.add(req); } if (selectedBot != null) { - TLRPC.TL_account_updateConnectedBot req = new TLRPC.TL_account_updateConnectedBot(); + TL_account.updateConnectedBot req = new TL_account.updateConnectedBot(); req.deleted = false; req.can_reply = allowReply; req.bot = getMessagesController().getInputUser(selectedBot); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Business/GreetMessagesActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/Business/GreetMessagesActivity.java index 2a067de949..87a991695f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Business/GreetMessagesActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Business/GreetMessagesActivity.java @@ -7,7 +7,6 @@ import android.graphics.PorterDuffColorFilter; import android.graphics.drawable.Drawable; import android.os.Bundle; -import android.text.TextUtils; import android.view.View; import android.widget.FrameLayout; @@ -17,6 +16,7 @@ import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenuItem; import org.telegram.ui.ActionBar.AlertDialog; @@ -176,9 +176,9 @@ private void processDone() { doneButtonDrawable.animateToProgress(1f); TLRPC.UserFull userFull = getMessagesController().getUserFull(getUserConfig().getClientUserId()); - TLRPC.TL_account_updateBusinessGreetingMessage req = new TLRPC.TL_account_updateBusinessGreetingMessage(); + TL_account.updateBusinessGreetingMessage req = new TL_account.updateBusinessGreetingMessage(); if (enabled) { - req.message = new TLRPC.TL_inputBusinessGreetingMessage(); + req.message = new TL_account.TL_inputBusinessGreetingMessage(); req.message.shortcut_id = reply.id; req.message.recipients = recipientsHelper.getInputValue(); req.message.no_activity_days = inactivityDays; @@ -186,7 +186,7 @@ private void processDone() { if (userFull != null) { userFull.flags2 |= 4; - userFull.business_greeting_message = new TLRPC.TL_businessGreetingMessage(); + userFull.business_greeting_message = new TL_account.TL_businessGreetingMessage(); userFull.business_greeting_message.shortcut_id = reply.id; userFull.business_greeting_message.recipients = recipientsHelper.getValue(); userFull.business_greeting_message.no_activity_days = inactivityDays; @@ -231,7 +231,7 @@ public boolean onBackPressed() { } - public TLRPC.TL_businessGreetingMessage currentValue; + public TL_account.TL_businessGreetingMessage currentValue; public boolean enabled; public boolean exclude; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Business/LocationActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/Business/LocationActivity.java index aeb57f5f8a..e5f301d3cd 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Business/LocationActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Business/LocationActivity.java @@ -3,7 +3,6 @@ import static org.telegram.messenger.AndroidUtilities.dp; import static org.telegram.messenger.LocaleController.getString; -import android.app.Activity; import android.content.Context; import android.graphics.Canvas; import android.graphics.PorterDuff; @@ -21,15 +20,11 @@ import android.view.Gravity; import android.view.MotionEvent; import android.view.View; -import android.view.inputmethod.EditorInfo; import android.widget.FrameLayout; -import android.widget.LinearLayout; import androidx.annotation.NonNull; -import org.checkerframework.checker.units.qual.A; import org.telegram.messenger.AndroidUtilities; -import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.BotWebViewVibrationEffect; import org.telegram.messenger.DocumentObject; import org.telegram.messenger.FileLog; @@ -39,23 +34,20 @@ import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; import org.telegram.messenger.SvgHelper; -import org.telegram.messenger.UserConfig; import org.telegram.messenger.Utilities; import org.telegram.messenger.WebFile; import org.telegram.tgnet.TLRPC; -import org.telegram.tgnet.tl.TL_stories; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenuItem; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.Theme; -import org.telegram.ui.ChatActivity; import org.telegram.ui.Components.AnimatedColor; import org.telegram.ui.Components.AnimatedTextView; import org.telegram.ui.Components.AvatarDrawable; import org.telegram.ui.Components.BackupImageView; import org.telegram.ui.Components.BulletinFactory; -import org.telegram.ui.Components.ChatAttachAlert; import org.telegram.ui.Components.ChatAttachAlertLocationLayout; import org.telegram.ui.Components.CircularProgressDrawable; import org.telegram.ui.Components.ClipRoundedDrawable; @@ -63,12 +55,9 @@ import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.EditTextBoldCursor; import org.telegram.ui.Components.LayoutHelper; -import org.telegram.ui.Components.LoadingDrawable; -import org.telegram.ui.Components.Paint.Views.LocationView; import org.telegram.ui.Components.UItem; import org.telegram.ui.Components.UniversalAdapter; import org.telegram.ui.Components.UniversalRecyclerView; -import org.telegram.ui.Stories.recorder.PaintView; import java.util.ArrayList; import java.util.List; @@ -398,7 +387,7 @@ private void processDone() { doneButtonDrawable.animateToProgress(1f); TLRPC.UserFull userFull = getMessagesController().getUserFull(getUserConfig().getClientUserId()); - TLRPC.TL_account_updateBusinessLocation req = new TLRPC.TL_account_updateBusinessLocation(); + TL_account.updateBusinessLocation req = new TL_account.updateBusinessLocation(); if (!empty) { if (geo != null) { req.flags |= 2; @@ -496,7 +485,7 @@ private void onClick(UItem item, View view, int position, float x, float y) { builder.setPositiveButton(LocaleController.getString(R.string.Remove), (di, w) -> { doneButtonDrawable.animateToProgress(1f); TLRPC.UserFull userFull = getMessagesController().getUserFull(getUserConfig().getClientUserId()); - TLRPC.TL_account_updateBusinessLocation req = new TLRPC.TL_account_updateBusinessLocation(); + TL_account.updateBusinessLocation req = new TL_account.updateBusinessLocation(); if (userFull != null) { userFull.business_location = null; userFull.flags2 &=~ 2; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Business/OpeningHoursActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/Business/OpeningHoursActivity.java index 86101089f5..c163fa99bc 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Business/OpeningHoursActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Business/OpeningHoursActivity.java @@ -14,45 +14,33 @@ import androidx.annotation.NonNull; -import org.checkerframework.checker.units.qual.A; import org.telegram.messenger.AndroidUtilities; -import org.telegram.messenger.BotWebViewVibrationEffect; import org.telegram.messenger.LocaleController; -import org.telegram.messenger.MessagesController; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; import org.telegram.messenger.UserObject; -import org.telegram.messenger.Utilities; -import org.telegram.tgnet.AbstractSerializedData; -import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenuItem; -import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; -import org.telegram.ui.ActionBar.BottomSheet; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Cells.NotificationsCheckCell; import org.telegram.ui.Cells.TextCell; import org.telegram.ui.Cells.TextCheckCell; -import org.telegram.ui.Components.AlertsCreator; -import org.telegram.ui.Components.BottomSheetWithRecyclerListView; import org.telegram.ui.Components.BulletinFactory; import org.telegram.ui.Components.CircularProgressDrawable; import org.telegram.ui.Components.CrossfadeDrawable; import org.telegram.ui.Components.LayoutHelper; -import org.telegram.ui.Components.RecyclerListView; import org.telegram.ui.Components.UItem; import org.telegram.ui.Components.UniversalAdapter; import org.telegram.ui.Components.UniversalRecyclerView; import java.time.DayOfWeek; -import java.time.ZoneId; import java.time.format.TextStyle; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; -import java.util.TimeZone; public class OpeningHoursActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate { @@ -200,8 +188,8 @@ private void setValue() { valueSet = true; } - public static ArrayList adaptWeeklyOpen(ArrayList hours, int utc_offset) { - ArrayList array = new ArrayList<>(hours); + public static ArrayList adaptWeeklyOpen(ArrayList hours, int utc_offset) { + ArrayList array = new ArrayList<>(hours); // // join together weeklies // Collections.sort(array, (a, b) -> a.start_minute - b.start_minute); @@ -219,10 +207,10 @@ public static ArrayList adaptWeeklyOpen(ArrayList array2 = new ArrayList<>(array.size()); + ArrayList array2 = new ArrayList<>(array.size()); for (int i = 0; i < array.size(); ++i) { - TLRPC.TL_businessWeeklyOpen weekly = array.get(i); - TLRPC.TL_businessWeeklyOpen newWeekly = new TLRPC.TL_businessWeeklyOpen(); + TL_account.TL_businessWeeklyOpen weekly = array.get(i); + TL_account.TL_businessWeeklyOpen newWeekly = new TL_account.TL_businessWeeklyOpen(); if (utc_offset != 0) { int start = weekly.start_minute % (24 * 60); @@ -246,7 +234,7 @@ public static ArrayList adaptWeeklyOpen(ArrayList adaptWeeklyOpen(ArrayList adaptWeeklyOpen(ArrayList[] getDaysHours(ArrayList hours) { + public static ArrayList[] getDaysHours(ArrayList hours) { ArrayList[] days = new ArrayList[7]; for (int i = 0; i < days.length; ++i) { days[i] = new ArrayList<>(); } for (int i = 0; i < hours.size(); ++i) { - TLRPC.TL_businessWeeklyOpen period = hours.get(i); + TL_account.TL_businessWeeklyOpen period = hours.get(i); int day = (int) (period.start_minute / (24 * 60)) % 7; int start = period.start_minute % (24 * 60); int end = start + (period.end_minute - period.start_minute); @@ -288,7 +276,7 @@ public static ArrayList[] getDaysHours(ArrayList= m) { m = period.end_minute + 1; } @@ -324,14 +312,14 @@ public static ArrayList[] getDaysHours(ArrayList fromDaysHours(ArrayList[] days) { - ArrayList hours = new ArrayList<>(); + public static ArrayList fromDaysHours(ArrayList[] days) { + ArrayList hours = new ArrayList<>(); if (days != null) { for (int i = 0; i < days.length; ++i) { if (days[i] != null) { for (int j = 0; j < days[i].size(); ++j) { Period period = days[i].get(j); - TLRPC.TL_businessWeeklyOpen weekly = new TLRPC.TL_businessWeeklyOpen(); + TL_account.TL_businessWeeklyOpen weekly = new TL_account.TL_businessWeeklyOpen(); weekly.start_minute = i * (24 * 60) + period.start; weekly.end_minute = i * (24 * 60) + period.end; hours.add(weekly); @@ -342,7 +330,7 @@ public static ArrayList fromDaysHours(ArrayList[] days = OpeningHoursActivity.getDaysHours(business_work_hours.weekly_open); StringBuilder sb = new StringBuilder(); @@ -390,10 +378,10 @@ private void processDone() { doneButtonDrawable.animateToProgress(1f); TLRPC.UserFull userFull = getMessagesController().getUserFull(getUserConfig().getClientUserId()); - TLRPC.TL_account_updateBusinessWorkHours req = new TLRPC.TL_account_updateBusinessWorkHours(); - ArrayList periods = fromDaysHours(value); + TL_account.updateBusinessWorkHours req = new TL_account.updateBusinessWorkHours(); + ArrayList periods = fromDaysHours(value); if (enabled && !periods.isEmpty()) { - TLRPC.TL_businessWorkHours business_work_hours = new TLRPC.TL_businessWorkHours(); + TL_account.TL_businessWorkHours business_work_hours = new TL_account.TL_businessWorkHours(); business_work_hours.timezone_id = timezoneId; business_work_hours.weekly_open.addAll(periods); @@ -476,11 +464,11 @@ public static String timeToString(int time, boolean includeNextDay) { } } - public static boolean is24x7(TLRPC.TL_businessWorkHours hours) { + public static boolean is24x7(TL_account.TL_businessWorkHours hours) { if (hours == null || hours.weekly_open.isEmpty()) return false; int last = 0; for (int i = 0; i < hours.weekly_open.size(); ++i) { - TLRPC.TL_businessWeeklyOpen period = hours.weekly_open.get(i); + TL_account.TL_businessWeeklyOpen period = hours.weekly_open.get(i); if (period.start_minute > last + 1) return false; last = period.end_minute; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Business/ProfileHoursCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Business/ProfileHoursCell.java index e95133cd2f..162b24f74c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Business/ProfileHoursCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Business/ProfileHoursCell.java @@ -1,7 +1,6 @@ package org.telegram.ui.Business; import static org.telegram.messenger.AndroidUtilities.dp; -import static org.telegram.messenger.AndroidUtilities.dpf2; import static org.telegram.messenger.LocaleController.formatPluralString; import static org.telegram.messenger.LocaleController.formatString; import static org.telegram.messenger.LocaleController.getString; @@ -11,7 +10,6 @@ import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; -import android.text.StaticLayout; import android.util.TypedValue; import android.view.Gravity; import android.view.MotionEvent; @@ -22,27 +20,20 @@ import android.widget.LinearLayout; import android.widget.TextView; -import com.google.android.exoplayer2.source.dash.manifest.Period; - -import org.checkerframework.checker.units.qual.A; import org.telegram.messenger.LocaleController; import org.telegram.messenger.R; import org.telegram.messenger.UserConfig; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.Theme; -import org.telegram.ui.Components.AnimatedTextView; import org.telegram.ui.Components.ClickableAnimatedTextView; import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.LayoutHelper; import java.time.DayOfWeek; -import java.time.Instant; -import java.time.ZoneId; import java.time.format.TextStyle; import java.util.ArrayList; import java.util.Calendar; -import java.util.Map; -import java.util.TimeZone; public class ProfileHoursCell extends LinearLayout { @@ -187,7 +178,7 @@ public void setOnTimezoneSwitchClick(View.OnClickListener onClickListener) { private boolean firstAfterAttach = true; private boolean needDivider; private boolean expanded; - public void set(TLRPC.TL_businessWorkHours value, boolean expanded, boolean showInMyTimezone, boolean divider) { + public void set(TL_account.TL_businessWorkHours value, boolean expanded, boolean showInMyTimezone, boolean divider) { this.expanded = expanded; this.needDivider = divider; @@ -238,18 +229,18 @@ public void set(TLRPC.TL_businessWorkHours value, boolean expanded, boolean show } firstAfterAttach = false; - ArrayList weekly_open = new ArrayList<>(value.weekly_open); + ArrayList weekly_open = new ArrayList<>(value.weekly_open); ArrayList[] localDays = OpeningHoursActivity.getDaysHours(weekly_open); int nowWeekday = (7 + calendar.get(Calendar.DAY_OF_WEEK) - 2) % 7; int nowHours = calendar.get(Calendar.HOUR_OF_DAY); int nowMinutes = calendar.get(Calendar.MINUTE); - ArrayList adapted_weekly_open = OpeningHoursActivity.adaptWeeklyOpen(value.weekly_open, utcOffset); + ArrayList adapted_weekly_open = OpeningHoursActivity.adaptWeeklyOpen(value.weekly_open, utcOffset); boolean open_now = false; int nowPeriodTime = nowMinutes + nowHours * 60 + nowWeekday * (24 * 60); for (int i = 0; i < adapted_weekly_open.size(); ++i) { - TLRPC.TL_businessWeeklyOpen weeklyPeriod = adapted_weekly_open.get(i); + TL_account.TL_businessWeeklyOpen weeklyPeriod = adapted_weekly_open.get(i); if ( nowPeriodTime >= weeklyPeriod.start_minute && nowPeriodTime <= weeklyPeriod.end_minute || nowPeriodTime + (7 * 24 * 60) >= weeklyPeriod.start_minute && nowPeriodTime + (7 * 24 * 60) <= weeklyPeriod.end_minute || @@ -288,7 +279,7 @@ public void set(TLRPC.TL_businessWorkHours value, boolean expanded, boolean show if (i == 0 && !open_now && k == 1) { int opensPeriodTime = -1; for (int j = 0; j < adapted_weekly_open.size(); ++j) { - TLRPC.TL_businessWeeklyOpen weekly = adapted_weekly_open.get(j); + TL_account.TL_businessWeeklyOpen weekly = adapted_weekly_open.get(j); if (nowPeriodTime < weekly.start_minute) { opensPeriodTime = weekly.start_minute; break; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Business/QuickRepliesController.java b/TMessagesProj/src/main/java/org/telegram/ui/Business/QuickRepliesController.java index cac974fcd2..59fa2bdd5e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Business/QuickRepliesController.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Business/QuickRepliesController.java @@ -18,8 +18,8 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.NativeByteBuffer; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ChatActivity; -import org.telegram.ui.Components.ChatActivityInterface; import java.util.ArrayList; import java.util.Collections; @@ -464,7 +464,7 @@ public void deleteReplies(ArrayList ids) { })); if (GREETING.equals(reply.name)) { - ConnectionsManager.getInstance(currentAccount).sendRequest(new TLRPC.TL_account_updateBusinessGreetingMessage(), null); + ConnectionsManager.getInstance(currentAccount).sendRequest(new TL_account.updateBusinessGreetingMessage(), null); TLRPC.UserFull userInfo = MessagesController.getInstance(currentAccount).getUserFull(UserConfig.getInstance(currentAccount).getClientUserId()); if (userInfo != null) { userInfo.flags2 &=~ 4; @@ -472,7 +472,7 @@ public void deleteReplies(ArrayList ids) { MessagesStorage.getInstance(currentAccount).updateUserInfo(userInfo, true); } } else if (AWAY.equals(reply.name)) { - ConnectionsManager.getInstance(currentAccount).sendRequest(new TLRPC.TL_account_updateBusinessAwayMessage(), null); + ConnectionsManager.getInstance(currentAccount).sendRequest(new TL_account.updateBusinessAwayMessage(), null); TLRPC.UserFull userInfo = MessagesController.getInstance(currentAccount).getUserFull(UserConfig.getInstance(currentAccount).getClientUserId()); if (userInfo != null) { userInfo.flags2 &=~ 8; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java index f47891111e..d32a6b91da 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/CacheControlActivity.java @@ -1775,9 +1775,9 @@ public void setData(boolean hasCache, float percent, float usedPercent) { ); if (hasCache) { if (percent < 0.01f) { - subtitle[1].setText(LocaleController.formatString("StorageUsageTelegramLess", R.string.StorageUsageTelegramLess, formatPercent(percent))); + subtitle[1].setText(LocaleController.formatString(R.string.StorageUsageTelegramLess, formatPercent(percent))); } else { - subtitle[1].setText(LocaleController.formatString("StorageUsageTelegram", R.string.StorageUsageTelegram, formatPercent(percent))); + subtitle[1].setText(LocaleController.formatString(R.string.StorageUsageTelegram, formatPercent(percent))); } switchSubtitle(1); } else { @@ -2892,7 +2892,7 @@ public void setTextValueColor(int color) { } public void setText(CharSequence text, boolean divider) { - text = Emoji.replaceEmoji(text, textView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(16), false); + text = Emoji.replaceEmoji(text, textView.getPaint().getFontMetricsInt(), false); textView.setText(text); valueTextView.setVisibility(INVISIBLE); needDivider = divider; @@ -2904,7 +2904,7 @@ public void setTextAndValue(CharSequence text, CharSequence value, boolean divid } public void setTextAndValue(CharSequence text, CharSequence value, boolean animated, boolean divider) { - text = Emoji.replaceEmoji(text, textView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(16), false); + text = Emoji.replaceEmoji(text, textView.getPaint().getFontMetricsInt(), false); textView.setText(text); if (value != null) { valueTextView.setText(value, animated); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/CachedMediaLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/CachedMediaLayout.java index 2935158b27..a3d1903c30 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/CachedMediaLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/CachedMediaLayout.java @@ -972,7 +972,7 @@ public void setRecyclerListView(RecyclerListView recyclerListView) { } @Override - public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { + public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview, boolean closing) { SharedPhotoVideoCell2 cell = getCellForIndex(index); if (cell != null) { int[] coords = new int[2]; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/CalendarActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/CalendarActivity.java index 897c4b349b..6c42591f54 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/CalendarActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/CalendarActivity.java @@ -907,7 +907,9 @@ public void onLongPress(MotionEvent e) { PeriodDay periodDay = getDayAtCoord(e.getX(), e.getY()); if (periodDay != null) { - performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} Bundle bundle = new Bundle(); if (dialogId > 0) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/CameraScanActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/CameraScanActivity.java index 521c766b75..78765869aa 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/CameraScanActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/CameraScanActivity.java @@ -1019,7 +1019,7 @@ public void destroy(boolean async, final Runnable beforeDestroyRunnable) { backgroundHandlerThread.quitSafely(); } - private Runnable requestShot = new Runnable() { + private final Runnable requestShot = new Runnable() { @Override public void run() { if (cameraView != null && !recognized && cameraView.getCameraSession() != null) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/AboutLinkCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/AboutLinkCell.java index e7355b07f8..b8c3ec9bb9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/AboutLinkCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/AboutLinkCell.java @@ -364,7 +364,7 @@ public void setTextAndValue(String text, String value, boolean parseLinks) { } stringBuilder = new SpannableStringBuilder(oldText); MessageObject.addLinks(false, stringBuilder, false, false, !parseLinks); - Emoji.replaceEmoji(stringBuilder, Theme.profile_aboutTextPaint.getFontMetricsInt(), AndroidUtilities.dp(20), false); + Emoji.replaceEmoji(stringBuilder, Theme.profile_aboutTextPaint.getFontMetricsInt(), false); if (lastMaxWidth <= 0) { lastMaxWidth = AndroidUtilities.displaySize.x - AndroidUtilities.dp(23 + 23); } @@ -403,27 +403,29 @@ public void run() { final Layout layout = pressedLinkLayout; final float yOffset = pressedLinkYOffset; - ClickableSpan pressedLinkFinal = (ClickableSpan) pressedLink.getSpan(); - BottomSheet.Builder builder = new BottomSheet.Builder(parentFragment.getParentActivity()); - builder.setTitle(url); - builder.setItems(new CharSequence[]{LocaleController.getString(R.string.Open), LocaleController.getString(R.string.Copy)}, (dialog, which) -> { - if (which == 0) { - onLinkClick(pressedLinkFinal, layout, yOffset); - } else if (which == 1) { - AndroidUtilities.addToClipboard(url); - if (AndroidUtilities.shouldShowClipboardToast()) { - if (url.startsWith("@")) { - BulletinFactory.of(parentFragment).createSimpleBulletin(R.raw.copy, LocaleController.getString(R.string.UsernameCopied)).show(); - } else if (url.startsWith("#") || url.startsWith("$")) { - BulletinFactory.of(parentFragment).createSimpleBulletin(R.raw.copy, LocaleController.getString(R.string.HashtagCopied)).show(); - } else { - BulletinFactory.of(parentFragment).createSimpleBulletin(R.raw.copy, LocaleController.getString(R.string.LinkCopied)).show(); + if (getContext() != null) { + ClickableSpan pressedLinkFinal = (ClickableSpan) pressedLink.getSpan(); + BottomSheet.Builder builder = new BottomSheet.Builder(getContext()); + builder.setTitle(url); + builder.setItems(new CharSequence[]{LocaleController.getString(R.string.Open), LocaleController.getString(R.string.Copy)}, (dialog, which) -> { + if (which == 0) { + onLinkClick(pressedLinkFinal, layout, yOffset); + } else if (which == 1) { + AndroidUtilities.addToClipboard(url); + if (AndroidUtilities.shouldShowClipboardToast()) { + if (url.startsWith("@")) { + BulletinFactory.of(parentFragment).createSimpleBulletin(R.raw.copy, LocaleController.getString(R.string.UsernameCopied)).show(); + } else if (url.startsWith("#") || url.startsWith("$")) { + BulletinFactory.of(parentFragment).createSimpleBulletin(R.raw.copy, LocaleController.getString(R.string.HashtagCopied)).show(); + } else { + BulletinFactory.of(parentFragment).createSimpleBulletin(R.raw.copy, LocaleController.getString(R.string.LinkCopied)).show(); + } } } - } - }); - builder.setOnPreDismissListener(di -> resetPressedLink()); - builder.show(); + }); + builder.setOnPreDismissListener(di -> resetPressedLink()); + builder.show(); + } pressedLink = null; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/BaseCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/BaseCell.java index 70aa9ee8d8..127ac8d841 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/BaseCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/BaseCell.java @@ -52,7 +52,9 @@ public void run() { if (checkingForLongPress && getParent() != null && currentPressCount == pressCount) { checkingForLongPress = false; if (onLongPress()) { - performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignore) {} MotionEvent event = MotionEvent.obtain(0, 0, MotionEvent.ACTION_CANCEL, 0, 0, 0); onTouchEvent(event); event.recycle(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/BotHelpCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/BotHelpCell.java index 6be21edde6..b5dee78334 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/BotHelpCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/BotHelpCell.java @@ -179,7 +179,7 @@ public void setText(boolean bot, String text, TLObject imageOrAnimation, TL_bots if (bot) { stringBuilder.setSpan(new TypefaceSpan(AndroidUtilities.bold()), 0, help.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } - Emoji.replaceEmoji(stringBuilder, Theme.chat_msgTextPaint.getFontMetricsInt(), AndroidUtilities.dp(20), false); + Emoji.replaceEmoji(stringBuilder, Theme.chat_msgTextPaint.getFontMetricsInt(), false); try { textLayout = new StaticLayout(stringBuilder, Theme.chat_msgTextPaint, maxWidth - (isPhotoVisible ? AndroidUtilities.dp(5) : 0), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); width = 0; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChannelRecommendationsCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChannelRecommendationsCell.java index 2493c00460..a3a320f87f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChannelRecommendationsCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChannelRecommendationsCell.java @@ -32,6 +32,7 @@ import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ChatObject; +import org.telegram.messenger.DialogObject; import org.telegram.messenger.Emoji; import org.telegram.messenger.FileLog; import org.telegram.messenger.ImageReceiver; @@ -40,7 +41,9 @@ import org.telegram.messenger.MessagesController; import org.telegram.messenger.R; import org.telegram.messenger.UserConfig; +import org.telegram.messenger.UserObject; import org.telegram.messenger.Utilities; +import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Components.AnimatedFloat; @@ -126,18 +129,15 @@ public void setMessageObject(MessageObject messageObject) { cell.totalHeight = dp(4 + 3.33f + 3.33f + 4) + serviceTextHeight; - if (headerText == null) { - headerText = new Text(getString(R.string.SimilarChannels), 14, AndroidUtilities.bold()).hackClipBounds(); - } - for (int i = 0; i < channels.size(); ++i) { channels.get(i).detach(); } channels.clear(); MessagesController.ChannelRecommendations rec = MessagesController.getInstance(currentAccount).getChannelRecommendations(-dialogId); - ArrayList chats = rec == null || rec.chats == null ? new ArrayList<>() : new ArrayList<>(rec.chats); + ArrayList chats = rec == null || rec.chats == null ? new ArrayList<>() : new ArrayList<>(rec.chats); for (int i = 0; i < chats.size(); ++i) { - if (!ChatObject.isNotInChat(chats.get(i))) { + final TLObject obj = chats.get(i); + if (obj instanceof TLRPC.Chat && !ChatObject.isNotInChat((TLRPC.Chat) obj)) { chats.remove(i); i--; } @@ -153,7 +153,7 @@ public void setMessageObject(MessageObject messageObject) { channels.add(new ChannelBlock(currentAccount, cell, chats.get(i))); } if (count < chats.size()) { - TLRPC.Chat[] _chats = new TLRPC.Chat[3]; + TLObject[] _chats = new TLObject[3]; _chats[0] = count >= 0 && count < chats.size() ? chats.get(count) : null; _chats[1] = count >= 0 && count + 1 < chats.size() ? chats.get(count + 1) : null; _chats[2] = count >= 0 && count + 2 < chats.size() ? chats.get(count + 2) : null; @@ -161,6 +161,10 @@ public void setMessageObject(MessageObject messageObject) { } } + if (headerText == null) { + headerText = new Text(getString(dialogId > 0 ? R.string.SimilarBots : R.string.SimilarChannels), 14, AndroidUtilities.bold()).hackClipBounds(); + } + if (isExpanded()) { cell.totalHeight += dp(6 + 134 + 4); backgroundPaint.setColor(cell.getThemedColor(Theme.key_chat_inBubble)); @@ -426,9 +430,9 @@ private static class ChannelBlock { private boolean subscribersColorSet; public final ButtonBounce bounce; - public final TLRPC.Chat chat; + public final TLObject chat; - public ChannelBlock(int currentAccount, ChatMessageCell cell, TLRPC.Chat[] chats, int moreCount) { + public ChannelBlock(int currentAccount, ChatMessageCell cell, TLObject[] chats, int moreCount) { this.cell = cell; this.chat = chats[0]; this.bounce = new ButtonBounce(cell) { @@ -486,13 +490,26 @@ public int getOpacity() { subscribersStrokePaint.setStyle(Paint.Style.STROKE); isLock = true; subscribersDrawable = isPremium ? null : cell.getContext().getResources().getDrawable(R.drawable.mini_switch_lock).mutate(); - if (chat == null || chat.participants_count <= 1) { + if (getSubscribersCount(chat) == null) { subscribersText = null; } else { subscribersText = new Text("+" + moreCount, 9.33f, AndroidUtilities.bold()); } } + private String getSubscribersCount(TLObject obj) { + if (obj instanceof TLRPC.Chat) { + final TLRPC.Chat chat = (TLRPC.Chat) obj; + if (chat.participants_count <= 1) return null; + return LocaleController.formatShortNumber(chat.participants_count, null); + } else if (obj instanceof TLRPC.User) { + final TLRPC.User user = (TLRPC.User) obj; + if (user.bot_active_users <= 1) return null; + return LocaleController.formatShortNumber(user.bot_active_users, null); + } + return null; + } + private void checkNameText(int width) { if (nameText != null && nameText.getWidth() == width) return; @@ -508,7 +525,7 @@ private void checkNameText(int width) { } } - public ChannelBlock(int currentAccount, ChatMessageCell cell, TLRPC.Chat chat) { + public ChannelBlock(int currentAccount, ChatMessageCell cell, TLObject chat) { this.cell = cell; this.chat = chat; this.bounce = new ButtonBounce(cell) { @@ -531,7 +548,14 @@ public void invalidate() { avatarImageReceiver[0].setForUserOrChat(chat, avatarDrawable[0]); nameTextPaint.setTextSize(dp(11)); - CharSequence title = chat != null ? chat.title : ""; + CharSequence title; + if (chat instanceof TLRPC.Chat) { + title = ((TLRPC.Chat) chat).title; + } else if (chat instanceof TLRPC.User) { + title = UserObject.getUserName((TLRPC.User) chat); + } else { + title = ""; + } try { title = Emoji.replaceEmoji(title, nameTextPaint.getFontMetricsInt(), false); } catch (Exception ignore) {} @@ -540,10 +564,10 @@ public void invalidate() { subscribersStrokePaint.setStyle(Paint.Style.STROKE); isLock = false; subscribersDrawable = cell.getContext().getResources().getDrawable(R.drawable.mini_reply_user).mutate(); - if (chat == null || chat.participants_count <= 1) { + if (getSubscribersCount(chat) == null) { subscribersText = null; } else { - subscribersText = new Text(chat != null ? LocaleController.formatShortNumber(chat.participants_count, null) : "", 9.33f, AndroidUtilities.bold()); + subscribersText = new Text(getSubscribersCount(chat), 9.33f, AndroidUtilities.bold()); } } @@ -838,7 +862,7 @@ public void didClickClose() { } } - public void didClickChannel(TLRPC.Chat chat, boolean longPress) { + public void didClickChannel(TLObject chat, boolean longPress) { if (cell.getDelegate() != null) { cell.getDelegate().didPressChannelRecommendation(cell, chat, longPress); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatActionCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatActionCell.java index 10cdc5ff85..65bcd691c3 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatActionCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatActionCell.java @@ -43,6 +43,7 @@ import android.text.style.ClickableSpan; import android.text.style.URLSpan; import android.util.TypedValue; +import android.view.Gravity; import android.view.HapticFeedbackConstants; import android.view.MotionEvent; import android.view.SoundEffectConstants; @@ -53,7 +54,6 @@ import androidx.annotation.NonNull; import androidx.core.graphics.ColorUtils; -import org.checkerframework.checker.units.qual.A; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.BuildVars; @@ -79,6 +79,7 @@ import org.telegram.messenger.UserObject; import org.telegram.messenger.Utilities; import org.telegram.messenger.browser.Browser; +import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; import org.telegram.tgnet.tl.TL_stories; @@ -93,6 +94,7 @@ import org.telegram.ui.Components.AnimatedFloat; import org.telegram.ui.Components.AvatarDrawable; import org.telegram.ui.Components.ButtonBounce; +import org.telegram.ui.Components.ColoredImageSpan; import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.Forum.ForumUtilities; import org.telegram.ui.Components.ImageUpdater; @@ -102,6 +104,7 @@ import org.telegram.ui.Components.RLottieDrawable; import org.telegram.ui.Components.RadialProgress2; import org.telegram.ui.Components.RadialProgressView; +import org.telegram.ui.Components.Reactions.ReactionsLayoutInBubble; import org.telegram.ui.Components.RecyclerListView; import org.telegram.ui.Components.ScaleStateListAnimator; import org.telegram.ui.Components.Text; @@ -113,6 +116,8 @@ import org.telegram.ui.LaunchActivity; import org.telegram.ui.PhotoViewer; import org.telegram.ui.ProfileActivity; +import org.telegram.ui.Stars.StarGiftSheet; +import org.telegram.ui.Stars.StarGiftUniqueActionLayout; import org.telegram.ui.Stars.StarsIntroActivity; import org.telegram.ui.Stories.StoriesUtilities; import org.telegram.ui.Stories.UploadingDotsSpannable; @@ -211,6 +216,9 @@ default void didPressBotButton(MessageObject messageObject, TLRPC.KeyboardButton default void didPressReplyMessage(ChatActionCell cell, int id) { } + default void didPressReaction(ChatActionCell cell, TLRPC.ReactionCount reaction, boolean longpress, float x, float y) { + } + default void needOpenInviteLink(TLRPC.TL_chatInviteExported invite) { } @@ -287,6 +295,10 @@ public interface ThemeDelegate extends Theme.ResourcesProvider { private boolean hasReplyMessage; + public final ReactionsLayoutInBubble reactionsLayoutInBubble = new ReactionsLayoutInBubble(this); + public float starGiftLayoutX, starGiftLayoutY; + public final StarGiftUniqueActionLayout starGiftLayout; + private MessageObject currentMessageObject; private int customDate; private CharSequence customText; @@ -384,8 +396,7 @@ public void detach() { try { performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} if (getContext() instanceof LaunchActivity) { ((LaunchActivity) getContext()).getFireworksOverlay().start(); @@ -395,7 +406,7 @@ public void detach() { delegate.needShowEffectOverlay(ChatActionCell.this, giftSticker, giftEffectAnimation); } } - } else { + } else if (drawable.getCurrentFrame() < 1) { drawable.stop(); drawable.setCurrentFrame(drawable.getFramesCount() - 1, false); } @@ -429,6 +440,8 @@ public ChatActionCell(Context context, boolean canDrawInParent, Theme.ResourcesP avatarDrawable = new AvatarDrawable(); TAG = DownloadController.getInstance(currentAccount).generateObserverTag(); + starGiftLayout = new StarGiftUniqueActionLayout(currentAccount, this, resourcesProvider); + giftTitlePaint.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, getResources().getDisplayMetrics())); giftSubtitlePaint.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 15, getResources().getDisplayMetrics())); giftTextPaint.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 15, getResources().getDisplayMetrics())); @@ -458,6 +471,10 @@ public void setDelegate(ChatActionCellDelegate delegate) { this.delegate = delegate; } + public ChatActionCellDelegate getDelegate() { + return delegate; + } + public void setCustomDate(int date, boolean scheduled, boolean inLayout) { if (customDate == date || customDate / 3600 == date / 3600) { return; @@ -522,6 +539,9 @@ public void setMessageObject(MessageObject messageObject, boolean force) { } accessibilityText = null; boolean messageIdChanged = currentMessageObject == null || currentMessageObject.stableId != messageObject.stableId; + if (currentMessageObject != null) { + messageObject.playedGiftAnimation = currentMessageObject.playedGiftAnimation; + } currentMessageObject = messageObject; messageObject.forceUpdate = false; hasReplyMessage = messageObject.replyMessageObject != null; @@ -533,6 +553,17 @@ public void setMessageObject(MessageObject messageObject, boolean force) { giftPremiumText = null; giftPremiumTextUncollapsed = false; } + if (messageIdChanged || messageObject.reactionsChanged) { + messageObject.reactionsChanged = false; + final boolean isTag = messageObject.messageOwner != null && messageObject.messageOwner.reactions != null && messageObject.messageOwner.reactions.reactions_as_tags; + if (messageObject.shouldDrawReactions()) { + final boolean isSmall = !messageObject.shouldDrawReactionsInLayout(); + reactionsLayoutInBubble.setMessage(messageObject, isSmall, isTag, themeDelegate); + } else { + reactionsLayoutInBubble.setMessage(null, false, false, themeDelegate); + } + } + starGiftLayout.set(messageObject, !messageIdChanged); imageReceiver.setAutoRepeatCount(0); imageReceiver.clearDecorators(); if (messageObject.type != MessageObject.TYPE_ACTION_WALLPAPER) { @@ -669,6 +700,12 @@ public void setMessageObject(MessageObject messageObject, boolean force) { if (action.gift != null) { document = action.gift.sticker; } + } else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGiftUnique && ((TLRPC.TL_messageActionStarGiftUnique) messageObject.messageOwner.action).refunded) { + parentObject = messageObject; + final TLRPC.TL_messageActionStarGiftUnique action = (TLRPC.TL_messageActionStarGiftUnique) messageObject.messageOwner.action; + if (action.gift != null) { + document = action.gift.getDocument(); + } } else { packName = UserConfig.getInstance(currentAccount).premiumGiftsStickerPack; if (packName == null) { @@ -818,7 +855,7 @@ public void setMessageObject(MessageObject messageObject, boolean force) { imageReceiver.setDelegate(null); imageReceiver.setImageBitmap((Bitmap) null); } - rippleView.setVisibility(isButtonLayout(messageObject) ? VISIBLE : GONE); + rippleView.setVisibility(isButtonLayout(messageObject) && !starGiftLayout.has() ? VISIBLE : GONE); ForumUtilities.applyTopicToMessage(messageObject); requestLayout(); } @@ -881,6 +918,7 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) { @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); + attachedToWindow = false; DownloadController.getInstance(currentAccount).removeLoadingFileObserver(this); imageReceiver.onDetachedFromWindow(); setStarsPaused(true); @@ -894,11 +932,21 @@ protected void onDetachedFromWindow() { NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.starGiftsLoaded); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.diceStickersDidLoad); avatarStoryParams.onDetachFromWindow(); + + transitionParams.onDetach(); + starGiftLayout.detach(); + reactionsLayoutInBubble.onDetachFromWindow(); + } + + private boolean attachedToWindow; + public boolean isCellAttachedToWindow() { + return attachedToWindow; } @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); + attachedToWindow = true; imageReceiver.onAttachedToWindow(); setStarsPaused(false); @@ -913,6 +961,8 @@ protected void onAttachedToWindow() { if (currentMessageObject != null && currentMessageObject.type == MessageObject.TYPE_SUGGEST_PHOTO) { setMessageObject(currentMessageObject, true); } + starGiftLayout.attach(); + reactionsLayoutInBubble.onAttachToWindow(); } private void setStarsPaused(boolean paused) { @@ -937,6 +987,15 @@ public boolean onTouchEvent(MotionEvent event) { if (messageObject == null) { return super.onTouchEvent(event); } + + if (starGiftLayout.has() && starGiftLayout.onTouchEvent(starGiftLayoutX, starGiftLayoutY, event)) { + return true; + } + + if (reactionsLayoutInBubble.checkTouchEvent(event)) { + return true; + } + float x = lastTouchX = event.getX(); float y = lastTouchY = event.getY(); @@ -1217,7 +1276,14 @@ private void openStarsGiftTransaction() { } else if (currentMessageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGift) { final TLRPC.TL_messageActionStarGift action = (TLRPC.TL_messageActionStarGift) currentMessageObject.messageOwner.action; if (action.forceIn) return; - StarsIntroActivity.showActionGiftSheet(getContext(), currentAccount, currentMessageObject.getDialogId(), currentMessageObject.isOutOwner(), currentMessageObject.messageOwner.date, currentMessageObject.getId(), action, themeDelegate); +// StarsIntroActivity.showActionGiftSheet(getContext(), currentAccount, currentMessageObject.getDialogId(), currentMessageObject.isOutOwner(), currentMessageObject.messageOwner.date, currentMessageObject.getId(), action, themeDelegate); + new StarGiftSheet(getContext(), currentAccount, currentMessageObject.getDialogId(), themeDelegate) + .set(currentMessageObject) + .show(); + } else if (currentMessageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGiftUnique) { + new StarGiftSheet(getContext(), currentAccount, currentMessageObject.getDialogId(), themeDelegate) + .set(currentMessageObject) + .show(); } } @@ -1295,24 +1361,26 @@ private void createLayout(CharSequence text, int width) { textHeight = 0; textWidth = 0; - try { - int linesCount = textLayout.getLineCount(); - for (int a = 0; a < linesCount; a++) { - float lineWidth; - try { - lineWidth = textLayout.getLineWidth(a); - if (lineWidth > maxWidth) { - lineWidth = maxWidth; + if (currentMessageObject == null || !currentMessageObject.isRepostPreview) { + try { + int linesCount = textLayout.getLineCount(); + for (int a = 0; a < linesCount; a++) { + float lineWidth; + try { + lineWidth = textLayout.getLineWidth(a); + if (lineWidth > maxWidth) { + lineWidth = maxWidth; + } + textHeight = (int) Math.max(textHeight, Math.ceil(textLayout.getLineBottom(a))); + } catch (Exception e) { + FileLog.e(e); + return; } - textHeight = (int) Math.max(textHeight, Math.ceil(textLayout.getLineBottom(a))); - } catch (Exception e) { - FileLog.e(e); - return; + textWidth = (int) Math.max(textWidth, Math.ceil(lineWidth)); } - textWidth = (int) Math.max(textWidth, Math.ceil(lineWidth)); + } catch (Exception e) { + FileLog.e(e); } - } catch (Exception e) { - FileLog.e(e); } textX = (width - textWidth) / 2; textY = dp(7); @@ -1361,7 +1429,16 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { } int exactlyHeight = 0; - if (isButtonLayout(messageObject)) { + if (starGiftLayout.has()) { + if (!starGiftLayout.repost) { + exactlyHeight += textY + textHeight + dp(4 + 6 + 6); + } + exactlyHeight += (int) starGiftLayout.getHeight() + dp(4 + 4); + if (!reactionsLayoutInBubble.isEmpty) { + reactionsLayoutInBubble.totalHeight = reactionsLayoutInBubble.height + dp(8); + exactlyHeight += reactionsLayoutInBubble.totalHeight; + } + } else if (isButtonLayout(messageObject)) { boolean isGiftChannel = isGiftChannel(messageObject); int imageSize = getImageSize(messageObject); float y; @@ -1449,17 +1526,26 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { backgroundRectHeight += dp(16); exactlyHeight += backgroundRectHeight; exactlyHeight += dp(6); + if (!reactionsLayoutInBubble.isEmpty) { + reactionsLayoutInBubble.totalHeight = reactionsLayoutInBubble.height + dp(8); + exactlyHeight += reactionsLayoutInBubble.totalHeight; + } } } - if (messageObject != null && (isNewStyleButtonLayout())) { + if (!reactionsLayoutInBubble.isEmpty) { + reactionsLayoutInBubble.totalHeight = reactionsLayoutInBubble.height + dp(8); + additionalHeight += reactionsLayoutInBubble.totalHeight; + } + if (messageObject != null && isNewStyleButtonLayout()) { setMeasuredDimension(width, exactlyHeight); } else { setMeasuredDimension(width, textHeight + additionalHeight + dp(14)); } + reactionsLayoutInBubble.y = getMeasuredHeight() - reactionsLayoutInBubble.totalHeight; } private boolean isNewStyleButtonLayout() { - return currentMessageObject.type == MessageObject.TYPE_SUGGEST_PHOTO || currentMessageObject.type == MessageObject.TYPE_ACTION_WALLPAPER || currentMessageObject.isStoryMention(); + return starGiftLayout.has() || currentMessageObject.type == MessageObject.TYPE_SUGGEST_PHOTO || currentMessageObject.type == MessageObject.TYPE_ACTION_WALLPAPER || currentMessageObject.isStoryMention(); } private int getImageSize(MessageObject messageObject) { @@ -1470,6 +1556,8 @@ private int getImageSize(MessageObject messageObject) { return imageSize; } + private ColoredImageSpan upgradeIconSpan; + private void buildLayout() { CharSequence text = null; MessageObject messageObject = currentMessageObject; @@ -1477,11 +1565,11 @@ private void buildLayout() { if (messageObject.isExpiredStory()) { long dialogId = messageObject.messageOwner.media.user_id; if (dialogId != UserConfig.getInstance(currentAccount).getClientUserId()) { - text = StoriesUtilities.createExpiredStoryString(true, "ExpiredStoryMention", R.string.ExpiredStoryMention); + text = StoriesUtilities.createExpiredStoryString(true, R.string.ExpiredStoryMention); } else { - text = StoriesUtilities.createExpiredStoryString(true, "ExpiredStoryMentioned", R.string.ExpiredStoryMentioned, MessagesController.getInstance(currentAccount).getUser(messageObject.getDialogId()).first_name); + text = StoriesUtilities.createExpiredStoryString(true, R.string.ExpiredStoryMentioned, MessagesController.getInstance(currentAccount).getUser(messageObject.getDialogId()).first_name); } - } else if (delegate.getTopicId() == 0 && MessageObject.isTopicActionMessage(messageObject)) { + } else if (delegate != null && delegate.getTopicId() == 0 && MessageObject.isTopicActionMessage(messageObject)) { TLRPC.TL_forumTopic topic = MessagesController.getInstance(currentAccount).getTopicsController().findTopic(-messageObject.getDialogId(), MessageObject.getTopicId(currentAccount, messageObject.messageOwner, true)); text = ForumUtilities.createActionTextWithTopic(topic, messageObject); } @@ -1507,6 +1595,9 @@ private void buildLayout() { } else { text = customText; } + if (currentMessageObject != null && currentMessageObject.isRepostPreview) { + text = ""; + } createLayout(text, previousWidth); if (messageObject != null) { if (messageObject.type == MessageObject.TYPE_ACTION_PHOTO) { @@ -1523,57 +1614,133 @@ private void buildLayout() { null, AndroidUtilities.replaceTags(currentMessageObject.isOutOwner() ? formatString(R.string.ActionGiftStarsSubtitle, UserObject.getForcedFirstName(user)) : getString(R.string.ActionGiftStarsSubtitleYou)), false, getString(R.string.ActionGiftStarsView), - null, giftRectSize, + 11, null, giftRectSize, true ); - } else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGift) { - final TLRPC.TL_messageActionStarGift action = (TLRPC.TL_messageActionStarGift) messageObject.messageOwner.action; - stars = action.convert_stars; - final long userId = messageObject.getFromChatId(); + } else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGiftUnique && ((TLRPC.TL_messageActionStarGiftUnique) messageObject.messageOwner.action).refunded) { + final long selfId = UserConfig.getInstance(currentAccount).getClientUserId(); + final TLRPC.TL_messageActionStarGiftUnique action = (TLRPC.TL_messageActionStarGiftUnique) messageObject.messageOwner.action; + final long fromId = messageObject.isOutOwner() == !action.upgrade ? selfId : messageObject.getDialogId(); + final TLRPC.User fromUser = MessagesController.getInstance(currentAccount).getUser(fromId); final SpannableStringBuilder sb = new SpannableStringBuilder(); - final TLRPC.User userReceiver = MessagesController.getInstance(currentAccount).getUser(userId); sb.append(LocaleController.getString(R.string.Gift2ActionTitle)).append(" "); - if (userReceiver != null && userReceiver.photo != null) { + if (fromUser != null && fromUser.photo != null) { sb.append("a "); final AvatarSpan avatarSpan = new AvatarSpan(this, currentAccount, 18); - avatarSpan.setUser(userReceiver); + avatarSpan.setUser(fromUser); sb.setSpan(avatarSpan, sb.length() - 2, sb.length() - 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } - sb.append(UserObject.getForcedFirstName(userReceiver)); + sb.append(UserObject.getForcedFirstName(fromUser)); + createGiftPremiumLayouts( + sb, + null, + getString(R.string.Gift2ActionUpgradeRefundedText), + false, + getString(R.string.ActionGiftStarsView), + 12, getString(R.string.Gift2UniqueRibbon), + giftRectSize, + true + ); + } else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGift) { + final TLRPC.TL_messageActionStarGift action = (TLRPC.TL_messageActionStarGift) messageObject.messageOwner.action; + stars = action.convert_stars; + final long selfId = UserConfig.getInstance(currentAccount).getClientUserId(); + final boolean isForChannel = action.peer != null; + final boolean self = messageObject.getDialogId() == selfId && !isForChannel; + long fromId = messageObject.getFromChatId(); + if (action.from_id != null) { + fromId = DialogObject.getPeerDialogId(action.from_id); + } + final SpannableStringBuilder sb = new SpannableStringBuilder(); + final TLObject sender = MessagesController.getInstance(currentAccount).getUserOrChat(fromId); + final boolean freeUpgrade = action.can_upgrade && !action.converted && action.upgrade_stars > 0 && !action.upgraded; + if (self) { + sb.append(getString(R.string.Gift2ActionSelfTitle)); + } else { + sb.append(LocaleController.getString(R.string.Gift2ActionTitle)).append(" "); + if (DialogObject.hasPhoto(sender)) { + sb.append("a "); + final AvatarSpan avatarSpan = new AvatarSpan(this, currentAccount, 18); + avatarSpan.setObject(sender); + sb.setSpan(avatarSpan, sb.length() - 2, sb.length() - 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + } + sb.append(DialogObject.getShortName(sender)); + } + final int within = MessagesController.getInstance(currentAccount).stargiftsConvertPeriodMax - (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - messageObject.messageOwner.date); + final boolean canConvert = (messageObject.isOutOwner() && !self || !action.converted) && action.convert_stars > 0 && within > 0 && !action.refunded; CharSequence title; - if (action.message != null && !TextUtils.isEmpty(action.message.text)) { + if (action.refunded) { + title = getString(R.string.Gift2ActionConvertRefundedText); + } else if (action.message != null && !TextUtils.isEmpty(action.message.text)) { title = new SpannableStringBuilder(action.message.text); giftTextPaint.setTextSize(dp(13)); MessageObject.addEntitiesToText(title, action.message.entities, false, false, true, true); title = Emoji.replaceEmoji(title, giftTextPaint.getFontMetricsInt(), false, null); title = MessageObject.replaceAnimatedEmoji(title, action.message.entities, giftTextPaint.getFontMetricsInt()); + } else if (isForChannel) { + if (action.converted) { + title = formatPluralStringComma("Gift2ActionConvertedInfo", (int) stars); + } else if (canConvert && stars > 0) { + title = AndroidUtilities.replaceTags(formatPluralStringComma("Gift2ActionInfoChannel", (int) stars)); + } else { + title = AndroidUtilities.replaceTags(getString(R.string.Gift2ActionInfoChannelNoConvert)); + } + } else if (self) { + if (action.converted && stars > 0) { + title = formatPluralStringComma("Gift2ActionConvertedInfo", (int) stars); + } else if (action.can_upgrade) { + title = AndroidUtilities.replaceTags(getString(R.string.Gift2ActionSelfInfoUpgrade)); + } else { + title = AndroidUtilities.replaceTags(getString(R.string.Gift2ActionSelfInfoNoConvert)); + } + } else if (freeUpgrade) { + title = AndroidUtilities.replaceTags(messageObject.isOutOwner() ? formatString(R.string.Gift2ActionUpgradeOut, UserObject.getForcedFirstName(user)) : getString(R.string.Gift2ActionUpgrade)); } else if (messageObject.isOutOwner()) { - title = AndroidUtilities.replaceTags(formatPluralStringComma("Gift2ActionOutInfo", (int) stars, UserObject.getForcedFirstName(user))); + if (canConvert && stars > 0) { + title = AndroidUtilities.replaceTags(formatPluralStringComma("Gift2ActionOutInfo", (int) stars, UserObject.getForcedFirstName(user))); + } else if (action.can_upgrade) { + title = AndroidUtilities.replaceTags(formatString(R.string.Gift2ActionOutInfoUpgrade, UserObject.getForcedFirstName(user))); + } else { + title = AndroidUtilities.replaceTags(formatString(R.string.Gift2ActionOutInfoNoConvert, UserObject.getForcedFirstName(user))); + } } else { if (action.converted) { title = formatPluralStringComma("Gift2ActionConvertedInfo", (int) stars); } else if (action.saved) { - if (action.convert_stars <= 0) { + if (!canConvert) { title = getString(R.string.Gift2ActionBotSavedInfo); } else { title = getString(R.string.Gift2ActionSavedInfo); } - } else if (action.convert_stars <= 0) { + } else if (!canConvert) { title = getString(R.string.Gift2ActionBotInfo); } else { - title = formatPluralStringComma("Gift2ActionInfo", (int) stars); + title = AndroidUtilities.replaceTags(formatPluralStringComma("Gift2ActionInfo", (int) stars)); } } CharSequence ribbon = null; if (action.gift != null && action.gift.limited) { ribbon = LocaleController.formatString(R.string.Gift2Limited1OfRibbon, action.gift.availability_total > 1500 ? AndroidUtilities.formatWholeNumber(action.gift.availability_total, 0) : action.gift.availability_total); } + CharSequence buttonText = getString(R.string.ActionGiftStarsView); + if (!messageObject.isOutOwner() || action.forceIn || freeUpgrade) { + if (!messageObject.isOutOwner() && freeUpgrade) { + SpannableStringBuilder ssb = new SpannableStringBuilder(); + ssb.append("^ "); + ColoredImageSpan span = new ColoredImageSpan(R.drawable.gift_unpack); + span.setScale(.8f, .8f); + ssb.setSpan(span, 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + ssb.append(LocaleController.getString(R.string.Gift2Unpack)); + buttonText = ssb; + } + } createGiftPremiumLayouts( sb, null, title, - false, messageObject.isOutOwner() && !action.forceIn ? null : getString(R.string.ActionGiftStarsView), - ribbon, + false, + buttonText, + 11, ribbon, giftRectSize, true ); @@ -1583,8 +1750,8 @@ false, getString(R.string.ActionGiftStarsView), getString(R.string.ActionStarGiveawayPrizeTitle), null, currentMessageObject.messageText, - false, getString(R.string.ActionGiftStarsView), - null, + false, getString(R.string.ActionGiftStarsView), + 11, null, giftRectSize, true ); @@ -1612,7 +1779,7 @@ false, getString(R.string.ActionGiftStarsView), messageText = LocaleController.getString(R.string.ActionGiftPremiumText); } String actionName = getString(isGiftCode() && !isSelfGiftCode() ? R.string.GiftPremiumUseGiftBtn : R.string.ActionGiftPremiumView); - createGiftPremiumLayouts(formatPluralStringComma("ActionGiftPremiumTitle2", messageObject.messageOwner.action.months), null, messageText, true, actionName, null, giftRectSize, false); + createGiftPremiumLayouts(formatPluralStringComma("ActionGiftPremiumTitle2", messageObject.messageOwner.action.months), null, messageText, true, actionName, 11, null, giftRectSize, false); } else if (messageObject.type == MessageObject.TYPE_SUGGEST_PHOTO) { TLRPC.TL_messageActionSuggestProfilePhoto actionSuggestProfilePhoto = (TLRPC.TL_messageActionSuggestProfilePhoto) messageObject.messageOwner.action; String description; @@ -1638,7 +1805,7 @@ false, getString(R.string.ActionGiftStarsView), } else { action = getString(R.string.ViewPhotoAction); } - createGiftPremiumLayouts(null, null, description, false, action, null, giftRectSize, true); + createGiftPremiumLayouts(null, null, description, false, action, 11, null, giftRectSize, true); textLayout = null; textHeight = 0; textY = 0; @@ -1659,7 +1826,7 @@ false, getString(R.string.ActionGiftStarsView), description = messageObject.messageText; action = getString(R.string.ViewWallpaperAction); } - createGiftPremiumLayouts(null, null, description, false, action, null, giftRectSize, actionClickableAsImage); + createGiftPremiumLayouts(null, null, description, false, action, 11, null, giftRectSize, actionClickableAsImage); textLayout = null; textHeight = 0; textY = 0; @@ -1676,12 +1843,14 @@ false, getString(R.string.ActionGiftStarsView), } action = getString(R.string.StoryMentionedAction); - createGiftPremiumLayouts(null, null, description, false, action, null, giftRectSize, true); + createGiftPremiumLayouts(null, null, description, false, action, 11, null, giftRectSize, true); textLayout = null; textHeight = 0; textY = 0; } } + reactionsLayoutInBubble.x = dp(12); + reactionsLayoutInBubble.measure(previousWidth - dp(24), Gravity.CENTER_HORIZONTAL); } private void createGiftPremiumChannelLayouts() { @@ -1738,7 +1907,7 @@ private void createGiftPremiumChannelLayouts() { giftPremiumButtonWidth = measureLayoutWidth(giftPremiumButtonLayout); } - private void createGiftPremiumLayouts(CharSequence title, CharSequence subtitle, CharSequence text, boolean allowCollapsing, CharSequence button, CharSequence ribbon, int width, boolean buttonClickableAsImage) { + private void createGiftPremiumLayouts(CharSequence title, CharSequence subtitle, CharSequence text, boolean allowCollapsing, CharSequence button, int ribbonTextDp, CharSequence ribbon, int width, boolean buttonClickableAsImage) { width -= dp(16); if (currentMessageObject != null && currentMessageObject.type == MessageObject.TYPE_GIFT_STARS) { width -= dp(16); @@ -1822,9 +1991,9 @@ private void createGiftPremiumLayouts(CharSequence title, CharSequence subtitle, } if (giftRibbonPath == null) { giftRibbonPath = new Path(); - GiftSheet.Ribbon.fillRibbonPath(giftRibbonPath, 1.35f); + GiftSheet.RibbonDrawable.fillRibbonPath(giftRibbonPath, 1.35f); } - giftRibbonText = new Text(ribbon, 11, AndroidUtilities.bold()); + giftRibbonText = new Text(ribbon, ribbonTextDp, AndroidUtilities.bold()); giftRibbonText.ellipsize(dp(62)); } else { giftRibbonPath = null; @@ -1856,7 +2025,7 @@ protected void onDraw(Canvas canvas) { MessageObject messageObject = currentMessageObject; final float expanded = giftPremiumTextExpandedAnimated.set(!giftPremiumTextCollapsed); int imageSize = stickerSize; - if (isButtonLayout(messageObject)) { + if (!starGiftLayout.has() && isButtonLayout(messageObject)) { stickerSize = giftRectSize - dp(106); if (isNewStyleButtonLayout()) { imageSize = getImageSize(messageObject); @@ -1874,8 +2043,7 @@ protected void onDraw(Canvas canvas) { imageSize = (int) (stickerSize * (AndroidUtilities.isTablet() ? 1.0f : 1.2f)); imageReceiver.setImageCoords((previousWidth - imageSize) / 2f, textY + textHeight + giftRectSize * 0.075f - dp(22), imageSize, imageSize); } else if (messageObject.isStarGiftAction()) { - imageSize = (int) (stickerSize * 1.1f); - imageReceiver.setImageCoords((previousWidth - imageSize) / 2f, textY + textHeight + giftRectSize * 0.075f - dp(0), imageSize, imageSize); + imageReceiver.setImageCoords((previousWidth - imageSize) / 2f, textY + textHeight + giftRectSize * 0.075f + dp(2), imageSize, imageSize); } else if (messageObject.type == MessageObject.TYPE_GIFT_STARS) { imageSize = (int) (stickerSize * 1.1f); if (messageObject.messageOwner != null && !(messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGift)) { @@ -1905,7 +2073,15 @@ protected void onDraw(Canvas canvas) { drawBackground(canvas, false); - if (isButtonLayout(messageObject) || (messageObject != null && messageObject.type == MessageObject.TYPE_ACTION_PHOTO)) { + if (starGiftLayout.has()) { + canvas.save(); + canvas.translate(starGiftLayoutX = (getWidth() - starGiftLayout.getWidth()) / 2.0f, starGiftLayoutY = starGiftLayout.repost ? dp(4) : textY + textHeight + dp(4 + 6 + 6)); + starGiftLayout.draw(canvas); + if (delegate == null || delegate.canDrawOutboundsContent()) { + starGiftLayout.drawOutbounds(canvas); + } + canvas.restore(); + } else if (isButtonLayout(messageObject) || (messageObject != null && messageObject.type == MessageObject.TYPE_ACTION_PHOTO)) { if (wallpaperPreviewDrawable != null) { canvas.save(); canvas.translate(imageReceiver.getImageX(), imageReceiver.getImageY()); @@ -1984,7 +2160,7 @@ protected void onDraw(Canvas canvas) { canvas.restore(); } - if (isButtonLayout(messageObject)) { + if (!starGiftLayout.has() && isButtonLayout(messageObject)) { canvas.save(); float x = (previousWidth - giftRectSize) / 2f + dp(8); float y; @@ -2192,7 +2368,6 @@ protected void onDraw(Canvas canvas) { } canvas.restore(); } else { - //TODO optimize invalidate(); } } @@ -2297,6 +2472,10 @@ protected void onDraw(Canvas canvas) { canvas.restore(); } } + + drawReactions(canvas, false, null); + + transitionParams.recordDrawingState(); } @Override @@ -2503,21 +2682,37 @@ public void drawBackground(Canvas canvas, boolean fromParent) { backgroundPaint.setAlpha((int) (oldAlpha * (isFloating() ? .75f : 1f))); darkenBackgroundPaint.setAlpha((int) (oldAlpha2 * (isFloating() ? .75f : 1f))); } - canvas.drawPath(backgroundPath, backgroundPaint); - if (hasGradientService()) { - canvas.drawPath(backgroundPath, darkenBackgroundPaint); - } - if (dimAmount > 0) { - int wasAlpha = dimPaint.getAlpha(); - if (fromParent) { - dimPaint.setAlpha((int) (wasAlpha * getAlpha())); + if (currentMessageObject == null || !currentMessageObject.isRepostPreview) { + canvas.drawPath(backgroundPath, backgroundPaint); + if (hasGradientService()) { + canvas.drawPath(backgroundPath, darkenBackgroundPaint); + } + if (dimAmount > 0) { + int wasAlpha = dimPaint.getAlpha(); + if (fromParent) { + dimPaint.setAlpha((int) (wasAlpha * getAlpha())); + } + canvas.drawPath(backgroundPath, dimPaint); + dimPaint.setAlpha(wasAlpha); } - canvas.drawPath(backgroundPath, dimPaint); - dimPaint.setAlpha(wasAlpha); } MessageObject messageObject = currentMessageObject; - if (isButtonLayout(messageObject)) { + if (starGiftLayout.has()) { + float w = starGiftLayout.getWidth() + dp(4 + 4); + float x = (getWidth() - w) / 2f; + float y = starGiftLayout.repost ? 0 : textY + textHeight + dp(12); + AndroidUtilities.rectTmp.set(x, y, x + w, y + starGiftLayout.getHeight() + dp(4 + 4)); + if (backgroundRect == null) { + backgroundRect = new RectF(); + } + backgroundRect.set(AndroidUtilities.rectTmp); + canvas.drawRoundRect(backgroundRect, dp(16), dp(16), backgroundPaint); + + if (hasGradientService()) { + canvas.drawRoundRect(backgroundRect, dp(16), dp(16), darkenBackgroundPaint); + } + } else if (isButtonLayout(messageObject)) { float x = (getWidth() - giftRectSize) / 2f; float y = textY + textHeight; if (isNewStyleButtonLayout()) { @@ -2547,8 +2742,65 @@ public void drawBackground(Canvas canvas, boolean fromParent) { } } + public void drawReactions(Canvas canvas, boolean fromParent, Integer only) { + if (canDrawInParent) { + if (hasGradientService() && !fromParent) { + return; + } + if (!hasGradientService() && fromParent) { + return; + } + } + drawReactionsLayout(canvas, fromParent, only); + } + + public void drawReactionsLayout(Canvas canvas, boolean fromParent, Integer only) { + final float alpha = fromParent ? getAlpha() : 1.0f; + if (themeDelegate != null) { + themeDelegate.applyServiceShaderMatrix(getMeasuredWidth(), backgroundHeight, viewTranslationX, viewTop + dp(4)); + } else { + Theme.applyServiceShaderMatrix(getMeasuredWidth(), backgroundHeight, viewTranslationX, viewTop + dp(4)); + } + if (currentMessageObject != null && currentMessageObject.shouldDrawReactions() && (!reactionsLayoutInBubble.isSmall || transitionParams.animateChange && reactionsLayoutInBubble.animateHeight)) { + reactionsLayoutInBubble.drawServiceShaderBackground = 1.0f; + if (alpha < 1) { + canvas.saveLayerAlpha(0, 0, getWidth(), getHeight(), (int) (0xFF * alpha), Canvas.ALL_SAVE_FLAG); + } + reactionsLayoutInBubble.draw(canvas, transitionParams.animateChange ? transitionParams.animateChangeProgress : 1f, only); + if (alpha < 1) { + canvas.restore(); + } + } + } + + public void drawReactionsLayoutOverlay(Canvas canvas, boolean fromParent) { + final float alpha = fromParent ? getAlpha() : 1.0f; + if (themeDelegate != null) { + themeDelegate.applyServiceShaderMatrix(getMeasuredWidth(), backgroundHeight, viewTranslationX, viewTop + dp(4)); + } else { + Theme.applyServiceShaderMatrix(getMeasuredWidth(), backgroundHeight, viewTranslationX, viewTop + dp(4)); + } + if (currentMessageObject != null && currentMessageObject.shouldDrawReactions() && (!reactionsLayoutInBubble.isSmall || transitionParams.animateChange && reactionsLayoutInBubble.animateHeight)) { + reactionsLayoutInBubble.drawServiceShaderBackground = 1.0f; + if (alpha < 1) { + canvas.saveLayerAlpha(0, 0, getWidth(), getHeight(), (int) (0xFF * alpha), Canvas.ALL_SAVE_FLAG); + } + reactionsLayoutInBubble.drawOverlay(canvas, transitionParams.animateChange ? transitionParams.animateChangeProgress : 1f); + if (alpha < 1) { + canvas.restore(); + } + } + } + @Override public int getBoundsLeft() { + if (starGiftLayout.has()) { + final int giftLayoutLeft = (int) (getWidth() - (starGiftLayout.getWidth() + dp(8))) / 2; + if (starGiftLayout.repost) { + return giftLayoutLeft; + } + return Math.min(backgroundLeft, giftLayoutLeft); + } if (isButtonLayout(currentMessageObject)) { return (getWidth() - giftRectSize) / 2; } @@ -2561,6 +2813,13 @@ public int getBoundsLeft() { @Override public int getBoundsRight() { + if (starGiftLayout.has()) { + final int giftLayoutRight = (int) (getWidth() + (starGiftLayout.getWidth() + dp(8))) / 2; + if (starGiftLayout.repost) { + return giftLayoutRight; + } + return Math.max(backgroundRight, giftLayoutRight); + } if (isButtonLayout(currentMessageObject)) { return (getWidth() + giftRectSize) / 2; } @@ -2672,6 +2931,13 @@ public void drawOutboundsContent(Canvas canvas) { canvas.translate(textXLeft, textY); AnimatedEmojiSpan.drawAnimatedEmojis(canvas, textLayout, animatedEmojiStack, 0, spoilers, 0, 0, 0, 1f, textLayout != null ? getAdaptiveEmojiColorFilter(textLayout.getPaint().getColor()) : null); canvas.restore(); + + if (starGiftLayout.has()) { + canvas.save(); + canvas.translate((getWidth() - starGiftLayout.getWidth()) / 2.0f, starGiftLayout.repost ? dp(4) : textY + textHeight + dp(4 + 6 + 6)); + starGiftLayout.drawOutbounds(canvas); + canvas.restore(); + } } private boolean isButtonLayout(MessageObject messageObject) { @@ -2682,12 +2948,43 @@ private boolean isGiftChannel(MessageObject messageObject) { return messageObject != null && messageObject.type == MessageObject.TYPE_GIFT_PREMIUM_CHANNEL; } + private boolean invalidatesParent; + public void setInvalidatesParent(boolean value) { + invalidatesParent = value; + } + + private Runnable invalidateListener; + public void setInvalidateListener(Runnable listener) { + invalidateListener = listener; + } + @Override public void invalidate() { super.invalidate(); if (invalidateWithParent != null) { invalidateWithParent.invalidate(); } + if (invalidateListener != null) { + invalidateListener.run(); + } + if (invalidatesParent && getParent() != null) { + View parent = (View) getParent(); + if (parent.getParent() != null) { + parent.invalidate(); + parent = (View) parent.getParent(); + parent.invalidate(); + } + } + } + + public void invalidateOutbounds() { + if (delegate == null || !delegate.canDrawOutboundsContent()) { + if (getParent() instanceof View) { + ((View) getParent()).invalidate(); + } + } else { + super.invalidate(); + } } @Override @@ -2696,6 +2993,14 @@ public void invalidate(Rect dirty) { if (invalidateWithParent != null) { invalidateWithParent.invalidate(); } + if (invalidatesParent && getParent() != null) { + View parent = (View) getParent(); + if (parent.getParent() != null) { + parent.invalidate(); + parent = (View) parent.getParent(); + parent.invalidate(); + } + } } @Override @@ -2704,6 +3009,14 @@ public void invalidate(int l, int t, int r, int b) { if (invalidateWithParent != null) { invalidateWithParent.invalidate(); } + if (invalidatesParent && getParent() != null) { + View parent = (View) getParent(); + if (parent.getParent() != null) { + parent.invalidate(); + parent = (View) parent.getParent(); + parent.invalidate(); + } + } } @Override @@ -2727,4 +3040,98 @@ private ColorFilter getAdaptiveEmojiColorFilter(int color) { public int measuredWidth() { return getMeasuredWidth(); } + + public ReactionsLayoutInBubble.ReactionButton getReactionButton(ReactionsLayoutInBubble.VisibleReaction visibleReaction) { + return reactionsLayoutInBubble.getReactionButton(visibleReaction); + } + + public final TransitionParams transitionParams = new TransitionParams(); + public class TransitionParams { + + public boolean wasDraw; + + public boolean animateChange; + public float animateChangeProgress = 1f; + + public void recordDrawingState() { + wasDraw = true; + reactionsLayoutInBubble.recordDrawingState(); + } + + public boolean animateChange() { + if (!wasDraw) { + return false; + } + boolean changed = false; + if (reactionsLayoutInBubble.animateChange()) { + changed = true; + } + return changed; + } + + public void onDetach() { + wasDraw = false; + } + + public boolean supportChangeAnimation() { + return true; + } + + public void resetAnimation() { + animateChange = false; + animateChangeProgress = 1f; + } + } + + public TransitionParams getTransitionParams() { + return transitionParams; + } + + + public void setScrimReaction(Integer scrimViewReaction) { + reactionsLayoutInBubble.setScrimReaction(scrimViewReaction); + } + + public void drawScrimReaction(Canvas canvas, Integer scrimViewReaction, float progress, boolean direction) { + if (!reactionsLayoutInBubble.isSmall) { + if (themeDelegate != null) { + themeDelegate.applyServiceShaderMatrix(getMeasuredWidth(), backgroundHeight, viewTranslationX, viewTop + dp(4)); + } else { + Theme.applyServiceShaderMatrix(getMeasuredWidth(), backgroundHeight, viewTranslationX, viewTop + dp(4)); + } + reactionsLayoutInBubble.setScrimProgress(progress, direction); + reactionsLayoutInBubble.draw(canvas, transitionParams.animateChangeProgress, scrimViewReaction); + } + } + + public void drawScrimReactionPreview(View view, Canvas canvas, int offset, Integer scrimViewReaction, float progress) { + if (!reactionsLayoutInBubble.isSmall) { + if (themeDelegate != null) { + themeDelegate.applyServiceShaderMatrix(getMeasuredWidth(), backgroundHeight, viewTranslationX, viewTop + dp(4)); + } else { + Theme.applyServiceShaderMatrix(getMeasuredWidth(), backgroundHeight, viewTranslationX, viewTop + dp(4)); + } + reactionsLayoutInBubble.setScrimProgress(progress); + reactionsLayoutInBubble.drawPreview(view, canvas, offset, scrimViewReaction); + } + } + + public boolean checkUnreadReactions(float clipTop, int clipBottom) { + if (!reactionsLayoutInBubble.hasUnreadReactions) { + return false; + } + float y = getY() + reactionsLayoutInBubble.y; + if (y > clipTop && y + reactionsLayoutInBubble.height - AndroidUtilities.dp(16) < clipBottom) { + return true; + } + return false; + } + + public void markReactionsAsRead() { + reactionsLayoutInBubble.hasUnreadReactions = false; + if (currentMessageObject == null) { + return; + } + currentMessageObject.markReactionsAsRead(); + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java index 2c5ab2ee76..d088ce0169 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java @@ -11,6 +11,7 @@ import static org.telegram.messenger.AndroidUtilities.dp; import static org.telegram.messenger.AndroidUtilities.dpf2; import static org.telegram.messenger.AndroidUtilities.lerp; +import static org.telegram.messenger.LocaleController.formatString; import static org.telegram.messenger.LocaleController.getString; import android.animation.Animator; @@ -124,10 +125,10 @@ import org.telegram.messenger.WebFile; import org.telegram.messenger.browser.Browser; import org.telegram.messenger.video.OldVideoPlayerRewinder; -import org.telegram.messenger.video.VideoPlayerRewinder; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_stars; import org.telegram.tgnet.tl.TL_stories; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.AvatarSpan; @@ -188,13 +189,14 @@ import org.telegram.ui.Components.URLSpanNoUnderline; import org.telegram.ui.Components.VectorAvatarThumbDrawable; import org.telegram.ui.Components.VideoForwardDrawable; -import org.telegram.ui.Components.VideoPlayer; import org.telegram.ui.Components.spoilers.SpoilerEffect; import org.telegram.ui.Components.spoilers.SpoilerEffect2; import org.telegram.ui.GradientClip; import org.telegram.ui.PhotoViewer; import org.telegram.ui.PinchToZoomHelper; import org.telegram.ui.SecretMediaViewer; +import org.telegram.ui.Stars.StarGiftPatterns; +import org.telegram.ui.Stars.StarGiftSheet; import org.telegram.ui.Stars.StarsController; import org.telegram.ui.Stars.StarsIntroActivity; import org.telegram.ui.Stories.StoriesUtilities; @@ -304,13 +306,13 @@ public void setAvatar(MessageObject messageObject) { currentPhoto = null; } if (currentChat.signature_profiles && messageObject.getDialogId() != UserObject.REPLY_BOT) { - long did = DialogObject.getPeerDialogId(messageObject.messageOwner.from_id); + final long did = DialogObject.getPeerDialogId(messageObject.messageOwner.from_id); if (did >= 0) { - TLRPC.User user = MessagesController.getInstance(messageObject.currentAccount).getUser(did); + final TLRPC.User user = MessagesController.getInstance(messageObject.currentAccount).getUser(did); avatarDrawable.setInfo(currentAccount, user); avatarImage.setForUserOrChat(user, avatarDrawable); } else { - TLRPC.Chat chat = MessagesController.getInstance(messageObject.currentAccount).getChat(-did); + final TLRPC.Chat chat = MessagesController.getInstance(messageObject.currentAccount).getChat(-did); avatarDrawable.setInfo(currentAccount, chat); avatarImage.setForUserOrChat(chat, avatarDrawable); } @@ -475,7 +477,7 @@ default boolean isReplyOrSelf() { default void didPressExtendedMediaPreview(ChatMessageCell cell, TLRPC.KeyboardButton button) { } - default void didPressUserStatus(ChatMessageCell cell, TLRPC.User user, TLRPC.Document document) { + default void didPressUserStatus(ChatMessageCell cell, TLRPC.User user, TLRPC.Document document, String giftSlug) { } @@ -533,7 +535,7 @@ default void didPressCodeCopy(ChatMessageCell cell, MessageObject.TextLayoutBloc } - default void didPressChannelRecommendation(ChatMessageCell cell, TLRPC.Chat chat, boolean longPress) { + default void didPressChannelRecommendation(ChatMessageCell cell, TLObject chat, boolean longPress) { } @@ -1435,6 +1437,11 @@ class LoadingDrawableLocation { private SpoilerEffect2 mediaSpoilerEffect2; private Integer mediaSpoilerEffect2Index; +// private Drawable startsAtDrawable; +// private Text startsAtText, startsAtTextShorter; + private Path photoImageClipPath; + private float[] photoImageClipPathRadii; + private float unlockAlpha = 1f; private float unlockX; private float unlockY; @@ -1458,7 +1465,10 @@ class LoadingDrawableLocation { private TLRPC.FileLocation currentPhoto; private String currentNameString; private Object currentNameStatus; + private long currentNameBotVerificationId; + private String nameStatusSlug; public AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable currentNameStatusDrawable; + public AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable currentNameEmojiStatusDrawable; private TLRPC.User currentForwardUser; private TLRPC.User currentViaBotUser; @@ -1906,7 +1916,7 @@ private boolean checkNameStatusMotionEvent(MotionEvent event) { if (currentNameStatusDrawable.getDrawable() instanceof AnimatedEmojiDrawable) { document = ((AnimatedEmojiDrawable) currentNameStatusDrawable.getDrawable()).getDocument(); } - delegate.didPressUserStatus(this, currentUser, document); + delegate.didPressUserStatus(this, currentUser, document, nameStatusSlug); invalidateOutbounds(); } } @@ -2598,7 +2608,7 @@ private boolean checkLinkPreviewMotionEvent(MotionEvent event) { } else { MediaController.getInstance().pauseMessage(currentMessageObject); } - } else if (drawInstantView || currentMessageObject != null && currentMessageObject.currentEvent != null && currentMessageObject.currentEvent.action instanceof TLRPC.TL_channelAdminLogEventActionEditMessage) { + } else if (drawInstantView || currentMessageObject != null && currentMessageObject.currentEvent != null && currentMessageObject.currentEvent.action instanceof TLRPC.TL_channelAdminLogEventActionEditMessage || currentMessageObject != null && MessageObject.getMedia(currentMessageObject) != null && MessageObject.getMedia(currentMessageObject).webpage != null && !TextUtils.isEmpty(MessageObject.getMedia(currentMessageObject).webpage.url) && "t.me".equalsIgnoreCase(AndroidUtilities.getHostAuthority(MessageObject.getMedia(currentMessageObject).webpage.url))) { if (delegate != null) { delegate.didPressInstantButton(this, drawInstantViewType); } @@ -3422,7 +3432,9 @@ private boolean checkRoundSeekbar(MotionEvent event) { float p = a / 360f; if (Math.abs(currentMessageObject.audioProgress - p) > 0.9f) { if (roundSeekbarOutAlpha == 0) { - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} } roundSeekbarOutAlpha = 1f; roundSeekbarOutProgress = currentMessageObject.audioProgress; @@ -5253,6 +5265,9 @@ protected void onDetachedFromWindow() { if (currentNameStatusDrawable != null) { currentNameStatusDrawable.detach(); } + if (currentNameEmojiStatusDrawable != null) { + currentNameEmojiStatusDrawable.detach(); + } if (mediaSpoilerEffect2 != null) { mediaSpoilerEffect2.detach(this); @@ -5342,6 +5357,9 @@ protected void onAttachedToWindow() { if (currentNameStatusDrawable != null) { currentNameStatusDrawable.attach(); } + if (currentNameEmojiStatusDrawable != null) { + currentNameEmojiStatusDrawable.attach(); + } if (mediaSpoilerEffect2 != null) { if (mediaSpoilerEffect2.destroyed) { mediaSpoilerEffect2 = makeSpoilerEffect(); @@ -6097,6 +6115,7 @@ private void setMessageContent(MessageObject messageObject, MessageObject.Groupe TL_stories.StoryItem storyItem = null; TLRPC.ThemeSettings androidThemeSettings = null; ArrayList stickers = null; + TL_stars.StarGift stargift = null; boolean stickersTextColor = false; if (messageObject.isGiveawayOrGiveawayResults()) { hasLinkPreview = true; @@ -6149,6 +6168,20 @@ private void setMessageContent(MessageObject messageObject, MessageObject.Groupe } else { drawInstantViewType = 13; } + } else if ("telegram_nft".equals(webpageType)) { + for (int b = 0, N2 = webpage.attributes.size(); b < N2; b++) { + final TLRPC.WebPageAttribute attribute_ = webpage.attributes.get(b); + if (!(attribute_ instanceof TLRPC.TL_webPageAttributeUniqueStarGift)) { + continue; + } + final TLRPC.TL_webPageAttributeUniqueStarGift attribute = (TLRPC.TL_webPageAttributeUniqueStarGift) attribute_; + if (attribute.gift instanceof TL_stars.TL_starGiftUnique) { + drawInstantView = true; + drawInstantViewType = 26; + stargift = attribute.gift; + } + break; + } } else if ("telegram_megagroup".equals(webpageType)) { drawInstantView = true; drawInstantViewType = 2; @@ -6577,6 +6610,9 @@ private void setMessageContent(MessageObject messageObject, MessageObject.Groupe } else if ("telegram_theme".equals(webpageType)) { site_name = getString("ColorTheme", R.string.ColorTheme); } + if (stargift != null) { + description = null; + } int additinalWidth = AndroidUtilities.dp(20); if (hasInvoicePreview) { @@ -6673,7 +6709,7 @@ private void setMessageContent(MessageObject messageObject, MessageObject.Groupe int restLines = 0; CharSequence titleCs = title; try { - titleCs = Emoji.replaceEmoji(title, Theme.chat_replyNamePaint.getFontMetricsInt(), AndroidUtilities.dp(14), false); + titleCs = Emoji.replaceEmoji(title, Theme.chat_replyNamePaint.getFontMetricsInt(), false); } catch (Exception ignore) { } int maxLines = 4; @@ -6720,7 +6756,7 @@ private void setMessageContent(MessageObject messageObject, MessageObject.Groupe totalHeight += AndroidUtilities.dp(2); } try { - author = Emoji.replaceEmoji(author, Theme.chat_replyNamePaint.getFontMetricsInt(), AndroidUtilities.dp(14), false); + author = Emoji.replaceEmoji(author, Theme.chat_replyNamePaint.getFontMetricsInt(), false); } catch (Exception ignore) { } if (restLinesCount == 3 && (!isSmallImage || description == null)) { @@ -7067,7 +7103,26 @@ private void setMessageContent(MessageObject messageObject, MessageObject.Groupe } if (documentAttachType != DOCUMENT_ATTACH_TYPE_MUSIC && documentAttachType != DOCUMENT_ATTACH_TYPE_AUDIO && documentAttachType != DOCUMENT_ATTACH_TYPE_DOCUMENT) { - if (currentPhotoObject != null || currentPhotoLocation != null || webDocument != null || documentAttachType == DOCUMENT_ATTACH_TYPE_WALLPAPER || documentAttachType == DOCUMENT_ATTACH_TYPE_THEME || (drawInstantViewType == 23 || drawInstantViewType == 24) && stickers != null && !stickers.isEmpty()) { + if (stargift != null) { + final int size = dp(220); + drawImageButton = false; + drawPhotoImage = true; + if (linkPreviewHeight != 0) { + linkPreviewHeight += dp(2); + totalHeight += dp(2); + } + totalHeight += size + dp(12); + linkPreviewHeight += size; + maxChildWidth = Math.max(maxChildWidth, size + additinalWidth); + photoImage.setImageCoords(0, 0, size, size); + currentPhotoFilter = "220_220"; + currentPhotoFilterThumb = "220_220_b"; + photoImage.setImageBitmap(new StarGiftSheet.StarGiftDrawableIcon(this, stargift, 220, 1.0f).setRounding(dp(4)).setPatternsType(StarGiftPatterns.TYPE_LINK_PREVIEW)); + if (blurredPhotoImage.getBitmap() != null) { + blurredPhotoImage.getBitmap().recycle(); + blurredPhotoImage.setImageBitmap((Bitmap) null); + } + } else if (currentPhotoObject != null || currentPhotoLocation != null || webDocument != null || documentAttachType == DOCUMENT_ATTACH_TYPE_WALLPAPER || documentAttachType == DOCUMENT_ATTACH_TYPE_THEME || (drawInstantViewType == 23 || drawInstantViewType == 24) && stickers != null && !stickers.isEmpty()) { drawImageButton = photo != null && !smallImage || type != null && (type.equals("photo") || type.equals("document") && documentAttachType != DOCUMENT_ATTACH_TYPE_STICKER || type.equals("gif") || documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO || documentAttachType == DOCUMENT_ATTACH_TYPE_WALLPAPER); if (isSmallImage) { drawImageButton = false; @@ -7437,35 +7492,35 @@ private void setMessageContent(MessageObject messageObject, MessageObject.Groupe if (messageObject.isOutOwner()) { if (isMissed) { if (call.video) { - text = getString("CallMessageVideoOutgoingMissed", R.string.CallMessageVideoOutgoingMissed); + text = getString(R.string.CallMessageVideoOutgoingMissed); } else { - text = getString("CallMessageOutgoingMissed", R.string.CallMessageOutgoingMissed); + text = getString(R.string.CallMessageOutgoingMissed); } } else { if (call.video) { - text = getString("CallMessageVideoOutgoing", R.string.CallMessageVideoOutgoing); + text = getString(R.string.CallMessageVideoOutgoing); } else { - text = getString("CallMessageOutgoing", R.string.CallMessageOutgoing); + text = getString(R.string.CallMessageOutgoing); } } } else { if (isMissed) { if (call.video) { - text = getString("CallMessageVideoIncomingMissed", R.string.CallMessageVideoIncomingMissed); + text = getString(R.string.CallMessageVideoIncomingMissed); } else { - text = getString("CallMessageIncomingMissed", R.string.CallMessageIncomingMissed); + text = getString(R.string.CallMessageIncomingMissed); } } else if (call.reason instanceof TLRPC.TL_phoneCallDiscardReasonBusy) { if (call.video) { - text = getString("CallMessageVideoIncomingDeclined", R.string.CallMessageVideoIncomingDeclined); + text = getString(R.string.CallMessageVideoIncomingDeclined); } else { - text = getString("CallMessageIncomingDeclined", R.string.CallMessageIncomingDeclined); + text = getString(R.string.CallMessageIncomingDeclined); } } else { if (call.video) { - text = getString("CallMessageVideoIncoming", R.string.CallMessageVideoIncoming); + text = getString(R.string.CallMessageVideoIncoming); } else { - text = getString("CallMessageIncoming", R.string.CallMessageIncoming); + text = getString(R.string.CallMessageIncoming); } } } @@ -7482,6 +7537,17 @@ private void setMessageContent(MessageObject messageObject, MessageObject.Groupe if (drawPinnedTop) { namesOffset -= AndroidUtilities.dp(1); } + if (!reactionsLayoutInBubble.isSmall) { + if (!reactionsLayoutInBubble.isEmpty) { + reactionsLayoutInBubble.measure(backgroundWidth - AndroidUtilities.dp(32), Gravity.LEFT); + reactionsLayoutInBubble.totalHeight = reactionsLayoutInBubble.height; + if (backgroundWidth - AndroidUtilities.dp(32) - reactionsLayoutInBubble.lastLineX < timeWidth) { + reactionsLayoutInBubble.totalHeight += AndroidUtilities.dp(12); + reactionsLayoutInBubble.positionOffsetY += -AndroidUtilities.dp(12); + } + totalHeight += dp(6) + reactionsLayoutInBubble.totalHeight; + } + } } else if (messageObject.type == MessageObject.TYPE_CONTACT) { drawContact = true; @@ -7697,7 +7763,7 @@ private void setMessageContent(MessageObject messageObject, MessageObject.Groupe messageObject.checkedVotes.clear(); } CharSequence questionText = new SpannableStringBuilder(media.poll.question.text); - questionText = Emoji.replaceEmoji(questionText, Theme.chat_audioTitlePaint.getFontMetricsInt(), AndroidUtilities.dp(16), false); + questionText = Emoji.replaceEmoji(questionText, Theme.chat_audioTitlePaint.getFontMetricsInt(), false); if (media.poll.question.entities != null) { questionText = MessageObject.replaceAnimatedEmoji(questionText, media.poll.question.entities, Theme.chat_audioTitlePaint.getFontMetricsInt(), true); MessageObject.addEntitiesToText(questionText, media.poll.question.entities, currentMessageObject.isOutOwner(), false, false, false); @@ -7808,7 +7874,9 @@ private void setMessageContent(MessageObject messageObject, MessageObject.Groupe int maxVote = 0; if (!animatePollAnswer && pollVoteInProgress && vibrateOnPollVote) { - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} } animatePollAnswerAlpha = animatePollAnswer = attachedToWindow && (pollVoteInProgress || pollUnvoteInProgress); ArrayList previousPollButtons = null; @@ -7845,7 +7913,7 @@ private void setMessageContent(MessageObject messageObject, MessageObject.Groupe for (int a = 0, N = media.poll.answers.size(); a < N; a++) { TLRPC.PollAnswer pollAnswer = media.poll.answers.get(a); CharSequence answerText = new SpannableStringBuilder(pollAnswer.text.text); - answerText = Emoji.replaceEmoji(answerText, Theme.chat_audioTitlePaint.getFontMetricsInt(), AndroidUtilities.dp(16), false); + answerText = Emoji.replaceEmoji(answerText, Theme.chat_audioTitlePaint.getFontMetricsInt(), false); if (pollAnswer.text.entities != null) { answerText = MessageObject.replaceAnimatedEmoji(answerText, pollAnswer.text.entities, Theme.chat_audioPerformerPaint.getFontMetricsInt(), true); MessageObject.addEntitiesToText(answerText, pollAnswer.text.entities, currentMessageObject.isOutOwner(), false, false, false); @@ -9168,16 +9236,18 @@ private void setMessageContent(MessageObject messageObject, MessageObject.Groupe photoImage.setAllowStartAnimation(true); photoImage.startAnimation(); TLRPC.Document document = messageObject.getDocument(); - if (messageObject.hasVideoQualities()) { - VideoPlayer.VideoUri uri = VideoPlayer.getQualityForThumb(messageObject.videoQualities); - if (uri != null) { - document = uri.document; - } + if (messageObject.hasVideoQualities() && messageObject.thumbQuality != null) { + document = messageObject.thumbQuality.document; } if (currentMessageObject.videoEditedInfo != null && currentMessageObject.videoEditedInfo.canAutoPlaySourceVideo() && document != null) { photoImage.setImage(ImageLocation.getForPath(currentMessageObject.videoEditedInfo.originalPath), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForDocument(currentPhotoObjectThumb, document), currentPhotoFilterThumb, currentPhotoObjectThumbStripped, document.size, null, messageObject, 0); photoImage.setMediaStartEndTime(currentMessageObject.videoEditedInfo.startTime / 1000, currentMessageObject.videoEditedInfo.endTime / 1000); + } else if (messageObject.cachedQuality != null) { + if (!messageIdChanged && !dataChanged) { + photoImage.setCrossfadeWithOldImage(true); + } + photoImage.setImage(ImageLocation.getForPath(messageObject.cachedQuality.uri.getPath()), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoFilter, ImageLocation.getForDocument(currentPhotoObjectThumb, document), currentPhotoFilterThumb, currentPhotoObjectThumbStripped, messageObject.getDocument().size, null, messageObject, 0); } else if (document != null) { if (!messageIdChanged && !dataChanged) { photoImage.setCrossfadeWithOldImage(true); @@ -9641,7 +9711,7 @@ private void setMessageContent(MessageObject messageObject, MessageObject.Groupe span.setScale(.9f, .9f); ((SpannableStringBuilder) buttonText).setSpan(span, 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } - buttonText = Emoji.replaceEmoji(buttonText, botButtonPaint.getFontMetricsInt(), AndroidUtilities.dp(15), false); + buttonText = Emoji.replaceEmoji(buttonText, botButtonPaint.getFontMetricsInt(), false); if (oldButton != null && oldButton.title != null && TextUtils.equals(oldButton.title.getText(), buttonText)) { botButton.title = oldButton.title; } else { @@ -9809,6 +9879,19 @@ private void setMessageContent(MessageObject messageObject, MessageObject.Groupe stickerSetIcons = null; } prevCaptionLayout = null; + +// final int timestamp = currentMessageObject.getVideoStartsTimestamp(); +// if (timestamp >= 0) { +// startsAtText = new Text(formatString(R.string.VideoStartsAt, AndroidUtilities.formatShortDuration(timestamp)), 12); +// startsAtTextShorter = new Text(AndroidUtilities.formatShortDuration(timestamp), 12); +// if (startsAtDrawable == null) { +// startsAtDrawable = getContext().getResources().getDrawable(R.drawable.video_starts_at).mutate(); +// } +// } else { +// startsAtText = null; +// startsAtTextShorter = null; +// startsAtDrawable = null; +// } } if (messageIdChanged) { currentUrl = null; @@ -11269,6 +11352,8 @@ private void createInstantViewButton() { str = getString(R.string.OpenStickerSet); } else if (drawInstantViewType == 24) { str = getString(R.string.OpenEmojiSet); + } else if (drawInstantViewType == 26) { + str = getString(R.string.OpenUniqueGift); } else { str = getString(R.string.InstantView); } @@ -12150,6 +12235,9 @@ public void drawContent(Canvas canvas, boolean preview) { if (isRoundVideo && currentMessageObject.isVoiceTranscriptionOpen() && pipFloat > 0) { canvas.restore(); } + if (!isRoundVideo) { + drawVideoTimestamps(canvas, getThemedColor(currentMessageObject.isOutOwner() ? Theme.key_chat_outReplyLine : Theme.key_chat_inReplyLine)); + } boolean drawTimeOld = drawTime; boolean groupPhotoVisible = photoImage.getVisible(); drawTime = groupPhotoVisible || currentMessageObject.shouldDrawReactionsInLayout() && currentMessageObject.hasReactions(); @@ -13055,8 +13143,8 @@ public void drawLinkPreview(Canvas canvas, float alpha) { linkLine.setEmojiAlpha(drawInstantViewType == 23 || drawInstantViewType == 24 ? 0.5f : 1f); final boolean drawPhotoImageBeforeBefore = currentMessageObject.isSponsored() && !isSmallImage; - final boolean drawPhotoImageBefore = !drawPhotoImageBeforeBefore && drawInstantView && (drawInstantViewType != 9 && drawInstantViewType != 2 && drawInstantViewType != 13 && drawInstantViewType != 11 && drawInstantViewType != 25 && drawInstantViewType != 1 && drawInstantViewType != 18 && drawInstantViewType != 22) || drawInstantViewType == 6 && imageBackgroundColor != 0; - final boolean drawPhotoImageAfter = !drawPhotoImageBeforeBefore && (!drawInstantView || drawInstantViewType == 9 || drawInstantViewType == 2 || drawInstantViewType == 11 || drawInstantViewType == 25 || drawInstantViewType == 13 || drawInstantViewType == 1 || drawInstantViewType == 18 || drawInstantViewType == 22 || drawInstantViewType == INSTANT_BUTTON_TYPE_PROFILE || isSmallImage); + final boolean drawPhotoImageBefore = !drawPhotoImageBeforeBefore && drawInstantView && (drawInstantViewType != 26 && drawInstantViewType != 9 && drawInstantViewType != 2 && drawInstantViewType != 13 && drawInstantViewType != 11 && drawInstantViewType != 25 && drawInstantViewType != 1 && drawInstantViewType != 18 && drawInstantViewType != 22) || drawInstantViewType == 6 && imageBackgroundColor != 0; + final boolean drawPhotoImageAfter = !drawPhotoImageBeforeBefore && (!drawInstantView || drawInstantViewType == 9 || drawInstantViewType == 2 || drawInstantViewType == 11 || drawInstantViewType == 25 || drawInstantViewType == 13 || drawInstantViewType == 1 || drawInstantViewType == 18 || drawInstantViewType == 22 || drawInstantViewType == INSTANT_BUTTON_TYPE_PROFILE || isSmallImage || drawInstantViewType == 26); boolean restore = false; boolean drawInstantButtonInside = false; @@ -13554,6 +13642,7 @@ public void drawLinkPreview(Canvas canvas, float alpha) { videoInfoLayout.draw(canvas); canvas.restore(); } + drawVideoTimestamps(canvas, linkLine.getColor()); giveawayMessageCell.draw(canvas, namesOffset, linkX, resourcesProvider); giveawayResultsMessageCell.draw(canvas, namesOffset, linkX, resourcesProvider); @@ -15568,6 +15657,7 @@ public void onSuccessDownload(String fileName) { updateButtonState(false, true, false); updateWaveform(); } else { + currentMessageObject.updateQualitiesCached(true); if (drawVideoImageButton) { videoRadialProgress.setProgress(1, true); } else { @@ -15581,7 +15671,11 @@ public void onSuccessDownload(String fileName) { autoPlayingMedia = true; } else if (!isSmallImage && !currentMessageObject.isHiddenSensitive() && SharedConfig.isAutoplayVideo() && !currentMessageObject.isRepostPreview && documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO && (currentPosition == null || (currentPosition.flags & MessageObject.POSITION_FLAG_LEFT) != 0 && (currentPosition.flags & MessageObject.POSITION_FLAG_RIGHT) != 0)) { animatingNoSound = 2; - photoImage.setImage(ImageLocation.getForDocument(documentAttach), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoObject instanceof TLRPC.TL_photoStrippedSize || currentPhotoObject != null && "s".equals(currentPhotoObject.type) ? currentPhotoFilterThumb : currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, currentPhotoObjectThumbStripped, documentAttach.size, null, currentMessageObject, 0); + if (currentMessageObject.cachedQuality != null) { + photoImage.setImage(ImageLocation.getForPath(currentMessageObject.cachedQuality.uri.getPath()), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoObject instanceof TLRPC.TL_photoStrippedSize || currentPhotoObject != null && "s".equals(currentPhotoObject.type) ? currentPhotoFilterThumb : currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, currentPhotoObjectThumbStripped, documentAttach.size, null, currentMessageObject, 0); + } else { + photoImage.setImage(ImageLocation.getForDocument(documentAttach), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoObject instanceof TLRPC.TL_photoStrippedSize || currentPhotoObject != null && "s".equals(currentPhotoObject.type) ? currentPhotoFilterThumb : currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, currentPhotoObjectThumbStripped, documentAttach.size, null, currentMessageObject, 0); + } if (!PhotoViewer.isPlayingMessage(currentMessageObject)) { photoImage.setAllowStartAnimation(true); photoImage.startAnimation(); @@ -15590,7 +15684,11 @@ public void onSuccessDownload(String fileName) { } autoPlayingMedia = true; } else if (documentAttachType == DOCUMENT_ATTACH_TYPE_GIF) { - photoImage.setImage(ImageLocation.getForDocument(documentAttach), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoObject instanceof TLRPC.TL_photoStrippedSize || currentPhotoObject != null && "s".equals(currentPhotoObject.type) ? currentPhotoFilterThumb : currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, currentPhotoObjectThumbStripped, documentAttach.size, null, currentMessageObject, 0); + if (currentMessageObject.cachedQuality != null) { + photoImage.setImage(ImageLocation.getForPath(currentMessageObject.cachedQuality.uri.getPath()), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoObject instanceof TLRPC.TL_photoStrippedSize || currentPhotoObject != null && "s".equals(currentPhotoObject.type) ? currentPhotoFilterThumb : currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, currentPhotoObjectThumbStripped, documentAttach.size, null, currentMessageObject, 0); + } else { + photoImage.setImage(ImageLocation.getForDocument(documentAttach), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(currentPhotoObject, photoParentObject), currentPhotoObject instanceof TLRPC.TL_photoStrippedSize || currentPhotoObject != null && "s".equals(currentPhotoObject.type) ? currentPhotoFilterThumb : currentPhotoFilter, ImageLocation.getForObject(currentPhotoObjectThumb, photoParentObject), currentPhotoFilterThumb, currentPhotoObjectThumbStripped, documentAttach.size, null, currentMessageObject, 0); + } if (!currentMessageObject.isHiddenSensitive() && SharedConfig.isAutoplayGifs() && !currentMessageObject.isRepostPreview) { photoImage.setAllowStartAnimation(true); photoImage.startAnimation(); @@ -16042,7 +16140,7 @@ private void measureTime(MessageObject messageObject) { widthForSign -= AndroidUtilities.dp(96); } } - signString = Emoji.replaceEmoji(signString, Theme.chat_timePaint.getFontMetricsInt(), AndroidUtilities.dp(10), false); + signString = Emoji.replaceEmoji(signString, Theme.chat_timePaint.getFontMetricsInt(), false); int width = (int) Math.ceil(Theme.chat_timePaint.measureText(signString, 0, signString.length())); signWidth = Math.min(width, widthForSign); if (width > widthForSign) { @@ -16236,10 +16334,10 @@ private void setMessageObjectInternal(MessageObject messageObject) { if (isMegagroup && currentChat != null && messageObject.messageOwner.post_author != null && currentChat.id == -currentMessageObject.getFromChatId()) { adminString = new SpannableStringBuilder(messageObject.messageOwner.post_author.replace("\n", "")); } else if (isMegagroup && currentChat != null && currentMessageObject.isForwardedChannelPost()) { - adminString = new SpannableStringBuilder(getString("DiscussChannel", R.string.DiscussChannel)); + adminString = new SpannableStringBuilder(getString(R.string.DiscussChannel)); } else if ((currentUser != null || currentChat != null) && !currentMessageObject.isOutOwner() && !currentMessageObject.isAnyKindOfSticker() && currentMessageObject.type != MessageObject.TYPE_ROUND_VIDEO && delegate != null && (adminLabel = delegate.getAdminRank(currentUser != null ? currentUser.id : currentChat.id)) != null) { if (adminLabel.length() == 0) { - adminLabel = getString("ChatAdmin", R.string.ChatAdmin); + adminLabel = getString(R.string.ChatAdmin); } adminString = new SpannableStringBuilder(adminLabel); } @@ -16266,18 +16364,21 @@ private void setMessageObjectInternal(MessageObject messageObject) { } currentNameStatus = null; + nameStatusSlug = null; + currentNameBotVerificationId = 0; if (messageObject.customName != null) { currentNameString = messageObject.customName; } else if (needAuthorName) { currentNameString = getAuthorName(); currentNameStatus = getAuthorStatus(); + currentNameBotVerificationId = getAuthorBotVerificationId(); } else { currentNameString = ""; } int additionalWidth = AndroidUtilities.dp(currentMessageObject.isSponsored() ? -24 : 0); CharSequence nameStringFinal = AndroidUtilities.removeDiacritics(currentNameString.replace('\n', ' ').replace('\u200F', ' ')); try { - nameStringFinal = Emoji.replaceEmoji(nameStringFinal, Theme.chat_namePaint.getFontMetricsInt(), AndroidUtilities.dp(14), false); + nameStringFinal = Emoji.replaceEmoji(nameStringFinal, Theme.chat_namePaint.getFontMetricsInt(), false); } catch (Exception ignore) {} nameStringFinal = TextUtils.ellipsize(nameStringFinal, Theme.chat_namePaint, nameWidth + additionalWidth - (viaBot ? viaWidth : 0), TextUtils.TruncateAt.END); if (viaBot) { @@ -16327,6 +16428,9 @@ private void setMessageObjectInternal(MessageObject messageObject) { if (currentNameStatus != null) { nameWidth += AndroidUtilities.dp(4 + 12 + 4); } + if (currentNameBotVerificationId != 0) { + nameWidth += AndroidUtilities.dp(4 + 12 + 4); + } nameWidth -= additionalWidth; if (adminString != null) { adminLayout = new StaticLayout(adminString, Theme.chat_adminPaint, adminWidth + AndroidUtilities.dp(2), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); @@ -16339,18 +16443,33 @@ private void setMessageObjectInternal(MessageObject messageObject) { } catch (Exception e) { FileLog.e(e); } - if (currentNameStatusDrawable == null) { - currentNameStatusDrawable = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(this, true, AndroidUtilities.dp(20)); + if (currentNameStatusDrawable == null && currentNameStatus != null) { + currentNameStatusDrawable = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(this, true, dp(20)); if (attachedToWindow) { currentNameStatusDrawable.attach(); } } - if (currentNameStatus == null) { - currentNameStatusDrawable.set((Drawable) null, false); - } else if (currentNameStatus instanceof Long) { - currentNameStatusDrawable.set((long) currentNameStatus, false); - } else if (currentNameStatus instanceof Drawable) { - currentNameStatusDrawable.set((Drawable) currentNameStatus, false); + if (currentNameStatusDrawable != null) { + if (currentNameStatus == null) { + currentNameStatusDrawable.set((Drawable) null, false); + } else if (currentNameStatus instanceof Long) { + currentNameStatusDrawable.set((long) currentNameStatus, false); + } else if (currentNameStatus instanceof Drawable) { + currentNameStatusDrawable.set((Drawable) currentNameStatus, false); + } + } + if (currentNameEmojiStatusDrawable == null && currentNameBotVerificationId != 0) { + currentNameEmojiStatusDrawable = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(this, true, dp(18)); + if (attachedToWindow) { + currentNameEmojiStatusDrawable.attach(); + } + } + if (currentNameEmojiStatusDrawable != null) { + if (currentNameBotVerificationId == 0) { + currentNameEmojiStatusDrawable.set((Drawable) null, false); + } else { + currentNameEmojiStatusDrawable.set(currentNameBotVerificationId, false); + } } if (currentNameString.length() == 0) { currentNameString = null; @@ -16459,7 +16578,7 @@ private void setMessageObjectInternal(MessageObject messageObject) { lastLine = stringBuilder; } try { - lastLine = Emoji.replaceEmoji(lastLine, Theme.chat_forwardNamePaint.getFontMetricsInt(), AndroidUtilities.dp(14), false); + lastLine = Emoji.replaceEmoji(lastLine, Theme.chat_forwardNamePaint.getFontMetricsInt(), false); } catch (Exception ignore) { } lastLine = TextUtils.ellipsize(lastLine, Theme.chat_forwardNamePaint, forwardedNameWidth, TextUtils.TruncateAt.END); @@ -16724,7 +16843,7 @@ protected void onClick() { String mess = messageObject.messageOwner.reply_to.quote_text; mess = mess.replace('\n', ' '); stringFinalText = new SpannableStringBuilder(mess); - stringFinalText = Emoji.replaceEmoji(stringFinalText, textPaint.getFontMetricsInt(), AndroidUtilities.dp(14), false); + stringFinalText = Emoji.replaceEmoji(stringFinalText, textPaint.getFontMetricsInt(), false); if (messageObject.messageOwner.reply_to.quote_entities != null) { stringFinalText = MessageObject.replaceAnimatedEmoji(stringFinalText, messageObject.messageOwner.reply_to.quote_entities, textPaint.getFontMetricsInt(), true); MessageObject.addEntitiesToText(stringFinalText, messageObject.messageOwner.reply_to.quote_entities, currentMessageObject.isOutOwner(), false, false, false); @@ -16734,10 +16853,10 @@ protected void onClick() { } else if (messageObject.replyMessageObject != null && messageObject.replyMessageObject.messageTextForReply != null) { stringFinalText = messageObject.replyMessageObject.messageTextForReply; } else if (MessageObject.getMedia(messageObject.replyMessageObject) instanceof TLRPC.TL_messageMediaGame) { - stringFinalText = Emoji.replaceEmoji(MessageObject.getMedia(messageObject.replyMessageObject).game.title, textPaint.getFontMetricsInt(), AndroidUtilities.dp(14), false); + stringFinalText = Emoji.replaceEmoji(MessageObject.getMedia(messageObject.replyMessageObject).game.title, textPaint.getFontMetricsInt(), false); stringFinalText = TextUtils.ellipsize(stringFinalText, textPaint, maxWidth, TextUtils.TruncateAt.END); } else if (MessageObject.getMedia(messageObject.replyMessageObject) instanceof TLRPC.TL_messageMediaInvoice) { - stringFinalText = Emoji.replaceEmoji(MessageObject.getMedia(messageObject.replyMessageObject).title, textPaint.getFontMetricsInt(), AndroidUtilities.dp(14), false); + stringFinalText = Emoji.replaceEmoji(MessageObject.getMedia(messageObject.replyMessageObject).title, textPaint.getFontMetricsInt(), false); stringFinalText = TextUtils.ellipsize(stringFinalText, textPaint, maxWidth, TextUtils.TruncateAt.END); } else if (messageObject.replyMessageObject != null && !TextUtils.isEmpty(messageObject.replyMessageObject.caption)) { String mess = messageObject.replyMessageObject.caption.toString(); @@ -16745,7 +16864,7 @@ protected void onClick() { mess = mess.substring(0, 150); } mess = mess.replace('\n', ' '); - stringFinalText = Emoji.replaceEmoji(mess, textPaint.getFontMetricsInt(), AndroidUtilities.dp(14), true); + stringFinalText = Emoji.replaceEmoji(mess, textPaint.getFontMetricsInt(), true); if (messageObject.replyMessageObject.messageOwner != null) { stringFinalText = MessageObject.replaceAnimatedEmoji(stringFinalText, messageObject.replyMessageObject.messageOwner.entities, textPaint.getFontMetricsInt(), true); } @@ -16765,7 +16884,7 @@ protected void onClick() { mess = AndroidUtilities.removeSpans(mess, QuoteSpan.class); mess = AndroidUtilities.removeSpans(mess, QuoteSpan.QuoteStyleSpan.class); mess = AndroidUtilities.replaceNewLines(mess); - stringFinalText = Emoji.replaceEmoji(mess, textPaint.getFontMetricsInt(), AndroidUtilities.dp(14), true); + stringFinalText = Emoji.replaceEmoji(mess, textPaint.getFontMetricsInt(), true); if (messageObject.replyMessageObject.messageOwner != null) { stringFinalText = MessageObject.replaceAnimatedEmoji(stringFinalText, messageObject.replyMessageObject.messageOwner.entities, textPaint.getFontMetricsInt(), true); } @@ -16830,7 +16949,7 @@ protected void onClick() { } CharSequence stringFinalName = name; try { - stringFinalName = Emoji.replaceEmoji(stringFinalName, Theme.chat_replyNamePaint.getFontMetricsInt(), AndroidUtilities.dp(14), false); + stringFinalName = Emoji.replaceEmoji(stringFinalName, Theme.chat_replyNamePaint.getFontMetricsInt(), false); } catch (Exception ignore) {} if (isReplyQuote) { maxWidth -= AndroidUtilities.dp(24); @@ -17014,14 +17133,54 @@ private Object getAuthorStatus() { if (currentUser != null) { Long emojiStatusId = UserObject.getEmojiStatusDocumentId(currentUser); if (emojiStatusId != null) { + if (currentUser.emoji_status instanceof TLRPC.TL_emojiStatusCollectible) { + nameStatusSlug = ((TLRPC.TL_emojiStatusCollectible) currentUser.emoji_status).slug; + } return emojiStatusId; } else if (currentUser.premium) { return ContextCompat.getDrawable(ApplicationLoader.applicationContext, R.drawable.msg_premium_liststar).mutate(); } + } else if (currentChat != null) { + if (currentMessageObject != null && (currentMessageObject.getDialogId() != UserObject.REPLY_BOT) && currentChat.signature_profiles) { + long did = DialogObject.getPeerDialogId(currentMessageObject.messageOwner.from_id); + if (did >= 0) { + TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(did); + if (user != null && user.emoji_status instanceof TLRPC.TL_emojiStatusCollectible) { + nameStatusSlug = ((TLRPC.TL_emojiStatusCollectible) user.emoji_status).slug; + } + return UserObject.getEmojiStatusDocumentId(user); + } else { + TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-did); + if (chat != null) { + if (chat.emoji_status instanceof TLRPC.TL_emojiStatusCollectible) { + nameStatusSlug = ((TLRPC.TL_emojiStatusCollectible) chat.emoji_status).slug; + } + return DialogObject.getEmojiStatusDocumentId(chat.emoji_status); + } + } + } } return null; } + private long getAuthorBotVerificationId() { + if (currentUser != null) { + return DialogObject.getBotVerificationIcon(currentUser); + } else if (currentChat != null) { + if (currentMessageObject != null && (currentMessageObject.getDialogId() != UserObject.REPLY_BOT) && currentChat.signature_profiles) { + long did = DialogObject.getPeerDialogId(currentMessageObject.messageOwner.from_id); + if (did >= 0) { + TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(did); + if (user != null) return DialogObject.getBotVerificationIcon(user); + } else { + TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-did); + if (chat != null) return DialogObject.getBotVerificationIcon(chat); + } + } + } + return 0; + } + private String getForwardedMessageText(MessageObject messageObject) { if (hasPsaHint) { String forwardedString = getString("PsaMessage_" + messageObject.messageOwner.fwd_from.psa_type); @@ -18085,23 +18244,29 @@ public void drawOutboundsContent(Canvas canvas) { invalidateOutbounds(); } - if (currentNameStatusDrawable != null && drawNameLayout && nameLayout != null && (currentPosition == null || currentPosition.minX == 0 && currentPosition.minY == 0) && !(currentMessageObject.deleted && !drawingToBitmap && currentMessagesGroup != null && currentMessagesGroup.messages.size() >= 1)) { + if ((currentNameStatusDrawable != null || currentNameEmojiStatusDrawable != null) && drawNameLayout && nameLayout != null && (currentPosition == null || currentPosition.minX == 0 && currentPosition.minY == 0) && !(currentMessageObject.deleted && !drawingToBitmap && currentMessagesGroup != null && currentMessagesGroup.messages.size() >= 1)) { int color; float nameX, nameY; if (currentMessageObject.shouldDrawWithoutBackground()) { color = getThemedColor(Theme.key_chat_stickerNameText); if (currentMessageObject.isOutOwner()) { - nameX = AndroidUtilities.dp(28); + nameX = dp(28); } else { - nameX = backgroundDrawableLeft + transitionParams.deltaLeft + backgroundDrawableRight + AndroidUtilities.dp(22); + nameX = backgroundDrawableLeft + transitionParams.deltaLeft + backgroundDrawableRight + dp(22); } - nameY = layoutHeight - AndroidUtilities.dp(38); + if (currentNameBotVerificationId != 0) { + nameX += dp(20); + } + nameY = layoutHeight - dp(38); nameX -= nameOffsetX; } else { if (mediaBackground || currentMessageObject.isOutOwner()) { - nameX = backgroundDrawableLeft + transitionParams.deltaLeft + AndroidUtilities.dp(11) + getExtraTextX(); + nameX = backgroundDrawableLeft + transitionParams.deltaLeft + dp(11) + getExtraTextX(); } else { - nameX = backgroundDrawableLeft + transitionParams.deltaLeft + AndroidUtilities.dp(!mediaBackground && drawPinnedBottom ? 11 : 17) + getExtraTextX(); + nameX = backgroundDrawableLeft + transitionParams.deltaLeft + dp(!mediaBackground && drawPinnedBottom ? 11 : 17) + getExtraTextX(); + } + if (currentNameBotVerificationId != 0) { + nameX += dp(20); } if (currentMessageObject.isOutOwner() && ChatObject.isChannel(currentChat)) { if (currentBackgroundDrawable != null && currentBackgroundDrawable.hasGradient()) { @@ -18155,14 +18320,26 @@ public void drawOutboundsContent(Canvas canvas) { } else { nx = nameX; } - currentNameStatusDrawable.setBounds( - (int) (Math.abs(nx) + (viaNameWidth > 0 ? viaNameWidth - dp(4 + 28) : nameLayoutWidth) + AndroidUtilities.dp(2)), - (int) (nameY + nameLayout.getHeight() / 2 - AndroidUtilities.dp(10)), - (int) (Math.abs(nx) + (viaNameWidth > 0 ? viaNameWidth - dp(4 + 28) : nameLayoutWidth) + AndroidUtilities.dp(22)), - (int) (nameY + nameLayout.getHeight() / 2 + AndroidUtilities.dp(10)) - ); - currentNameStatusDrawable.setColor(ColorUtils.setAlphaComponent(color, 115)); - currentNameStatusDrawable.draw(canvas); + if (currentNameEmojiStatusDrawable != null) { + currentNameEmojiStatusDrawable.setBounds( + (int) (Math.abs(nx) - dp(20)), + (int) (nameY + nameLayout.getHeight() / 2 - dp(9)), + (int) (Math.abs(nx) - dp(2)), + (int) (nameY + nameLayout.getHeight() / 2 + dp(9)) + ); + currentNameEmojiStatusDrawable.setColor(ColorUtils.setAlphaComponent(color, 115)); + currentNameEmojiStatusDrawable.draw(canvas); + } + if (currentNameStatusDrawable != null) { + currentNameStatusDrawable.setBounds( + (int) (Math.abs(nx) + (viaNameWidth > 0 ? viaNameWidth - dp(4 + 28) : nameLayoutWidth) + dp(2)), + (int) (nameY + nameLayout.getHeight() / 2 - dp(10)), + (int) (Math.abs(nx) + (viaNameWidth > 0 ? viaNameWidth - dp(4 + 28) : nameLayoutWidth) + dp(22)), + (int) (nameY + nameLayout.getHeight() / 2 + dp(10)) + ); + currentNameStatusDrawable.setColor(ColorUtils.setAlphaComponent(color, 115)); + currentNameStatusDrawable.draw(canvas); + } } if (drawTopic && topicButton != null && (currentPosition == null || currentPosition.minY == 0 && currentPosition.minX == 0)) { @@ -18733,7 +18910,10 @@ public void drawNamesLayout(Canvas canvas, float alpha) { if (currentMessageObject.isOutOwner()) { nameX = AndroidUtilities.dp(28); } else { - nameX = backgroundDrawableLeft + transitionParams.deltaLeft + backgroundDrawableRight + AndroidUtilities.dp(22); + nameX = backgroundDrawableLeft + transitionParams.deltaLeft + backgroundDrawableRight + dp(22); + } + if (currentNameBotVerificationId != 0) { + nameX += dp(20); } nameY = layoutHeight - AndroidUtilities.dp(38); float alphaProgress = currentMessageObject.isOut() && (checkBoxVisible || checkBoxAnimationInProgress) ? (1.0f - checkBoxAnimationProgress) : 1.0f; @@ -18768,6 +18948,9 @@ public void drawNamesLayout(Canvas canvas, float alpha) { } else { nameX = backgroundDrawableLeft + transitionParams.deltaLeft + AndroidUtilities.dp(!mediaBackground && drawPinnedBottom ? 11 : 17) - nameOffsetX + getExtraTextX(); } + if (currentNameBotVerificationId != 0) { + nameX += dp(20); + } if (currentMessageObject.isOutOwner() && ChatObject.isChannel(currentChat)) { if (currentBackgroundDrawable != null && currentBackgroundDrawable.hasGradient()) { Theme.chat_namePaint.setColor(getThemedColor(Theme.key_chat_messageTextOut)); @@ -24901,4 +25084,55 @@ public int getWidthForButtons() { } return widthForButtons; } + + public void drawVideoTimestamps(Canvas canvas, int color) { + if (currentMessageObject == null || controlsAlpha <= 0 || !photoImage.getVisible()) return; + float progress; + if (!currentMessageObject.openedInViewer && currentMessageObject.getVideoStartsTimestamp() != -1) { + progress = currentMessageObject.getVideoStartsTimestamp() / (float) currentMessageObject.getDuration(); + } else { + progress = currentMessageObject.getVideoSavedProgress(); + } + progress = Utilities.clamp01(progress); +// if (startsAtText != null && controlsAlpha > 0 && photoImage.getVisible()) { +// final int w = dp(28) + (int) startsAtText.getCurrentWidth(), h = dp(17); +// final float left = photoImage.getImageX() + dp(5), bottom = photoImage.getImageY2() - dp(5); +// rect.set(left, bottom - h, left + w, bottom); +// int oldAlpha = timeBackgroundPaint.getAlpha(); +// timeBackgroundPaint.setAlpha((int) (oldAlpha * controlsAlpha)); +// canvas.drawRoundRect(rect, dp(9), dp(9), timeBackgroundPaint); +// timeBackgroundPaint.setAlpha(oldAlpha); +// startsAtDrawable.setBounds((int) left + dp(6.33f), (int) bottom - h / 2 - startsAtDrawable.getIntrinsicHeight() / 2, (int) left + dp(6.33f) + startsAtDrawable.getIntrinsicWidth(), (int) bottom - h / 2 + startsAtDrawable.getIntrinsicHeight() / 2); +// startsAtDrawable.setAlpha((int) (0xFF * controlsAlpha)); +// startsAtDrawable.draw(canvas); +// startsAtText.draw(canvas, left + dp(22.66f), bottom - h / 2, 0xFFFFFFFF, controlsAlpha); +// } else + if (progress > 0) { + final int[] r = photoImage.getRoundRadius(); + canvas.save(); + if (r[0] <= 0 && r[1] <= 0 && r[2] <= 0 && r[3] <= 0) { + canvas.clipRect(photoImage.getImageX(), photoImage.getImageY(), photoImage.getImageX2(), photoImage.getImageY2()); + } else { + if (photoImageClipPath == null) { + photoImageClipPath = new Path(); + photoImageClipPathRadii = new float[8]; + } + photoImageClipPathRadii[0] = photoImageClipPathRadii[1] = Math.max(0, r[0]); + photoImageClipPathRadii[2] = photoImageClipPathRadii[3] = Math.max(0, r[1]); + photoImageClipPathRadii[4] = photoImageClipPathRadii[5] = Math.max(0, r[2]); + photoImageClipPathRadii[6] = photoImageClipPathRadii[7] = Math.max(0, r[3]); + photoImageClipPath.rewind(); + photoImageClipPath.addRoundRect(photoImage.getImageX(), photoImage.getImageY(), photoImage.getImageX2(), photoImage.getImageY2(), photoImageClipPathRadii, Path.Direction.CW); + canvas.clipPath(photoImageClipPath); + } + + Theme.chat_videoProgressPaint.setColor(Theme.multAlpha(Color.WHITE, .35f * controlsAlpha)); + canvas.drawRect(photoImage.getImageX(), photoImage.getImageY2() - dp(3), photoImage.getImageX2(), photoImage.getImageY2(), Theme.chat_videoProgressPaint); + Theme.chat_videoProgressPaint.setColor(Theme.multAlpha(color, controlsAlpha)); + AndroidUtilities.rectTmp.set(photoImage.getImageX() - dp(2), photoImage.getImageY2() - dp(3), photoImage.getImageX() + photoImage.getImageWidth() * progress, photoImage.getImageY2()); + canvas.drawRoundRect(AndroidUtilities.rectTmp, dp(2), dp(2), Theme.chat_videoProgressPaint); + + canvas.restore(); + } + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ContextLinkCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ContextLinkCell.java index 485629e604..57662d4782 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ContextLinkCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ContextLinkCell.java @@ -47,11 +47,9 @@ import org.telegram.messenger.Utilities; import org.telegram.messenger.WebFile; import org.telegram.tgnet.TLRPC; -import org.telegram.ui.Components.AnimatedFloat; import org.telegram.ui.Components.AnimationProperties; import org.telegram.ui.Components.ButtonBounce; import org.telegram.ui.Components.CheckBox2; -import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.LetterDrawable; import org.telegram.ui.ActionBar.Theme; @@ -208,7 +206,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (inlineResult.title != null) { try { int width = (int) Math.ceil(Theme.chat_contextResult_titleTextPaint.measureText(inlineResult.title)); - CharSequence titleFinal = TextUtils.ellipsize(Emoji.replaceEmoji(inlineResult.title.replace('\n', ' '), Theme.chat_contextResult_titleTextPaint.getFontMetricsInt(), AndroidUtilities.dp(15), false), Theme.chat_contextResult_titleTextPaint, Math.min(width, maxWidth), TextUtils.TruncateAt.END); + CharSequence titleFinal = TextUtils.ellipsize(Emoji.replaceEmoji(inlineResult.title.replace('\n', ' '), Theme.chat_contextResult_titleTextPaint.getFontMetricsInt(), false), Theme.chat_contextResult_titleTextPaint, Math.min(width, maxWidth), TextUtils.TruncateAt.END); titleLayout = new StaticLayout(titleFinal, Theme.chat_contextResult_titleTextPaint, maxWidth + AndroidUtilities.dp(4), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); } catch (Exception e) { FileLog.e(e); @@ -218,7 +216,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (inlineResult.description != null) { try { - descriptionLayout = ChatMessageCell.generateStaticLayout(Emoji.replaceEmoji(inlineResult.description, Theme.chat_contextResult_descriptionTextPaint.getFontMetricsInt(), AndroidUtilities.dp(13), false), Theme.chat_contextResult_descriptionTextPaint, maxWidth, maxWidth, 0, 3); + descriptionLayout = ChatMessageCell.generateStaticLayout(Emoji.replaceEmoji(inlineResult.description, Theme.chat_contextResult_descriptionTextPaint.getFontMetricsInt(), false), Theme.chat_contextResult_descriptionTextPaint, maxWidth, maxWidth, 0, 3); if (descriptionLayout.getLineCount() > 0) { linkY = descriptionY + descriptionLayout.getLineBottom(descriptionLayout.getLineCount() - 1) + AndroidUtilities.dp(1); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java index 217f716b5b..dc83ad25e0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java @@ -32,6 +32,7 @@ import android.os.Bundle; import android.text.Layout; import android.text.Spannable; +import android.text.SpannableString; import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.StaticLayout; @@ -206,7 +207,7 @@ public void onLongPress() { }; private Path thumbPath; - private SpoilerEffect thumbSpoiler = new SpoilerEffect(); + private SpoilerEffect thumbSpoiler; private boolean drawForwardIcon, drawGiftIcon; private boolean visibleOnScreen = true; private boolean updateLayout; @@ -547,8 +548,10 @@ public boolean isBlocked() { private StaticLayout mentionLayout; private boolean drawVerified; + private boolean drawBotVerified; private boolean drawPremium; - private AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable emojiStatus; + private final AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable emojiStatus; + private final AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable botVerification; private int drawScam; @@ -615,6 +618,7 @@ public DialogCell(DialogsActivity fragment, Context context, boolean needCheck, currentAccount = account; emojiStatus = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(this, dp(22)); + botVerification = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(this, dp(17)); avatarImage.setAllowLoadingOnAttachedOnly(true); } @@ -642,7 +646,7 @@ public void setDialog(TLRPC.Dialog dialog, int type, int folder) { dialogsType = type; showPremiumBlocked(dialogsType == DialogsActivity.DIALOGS_TYPE_FORWARD); if (tags == null) { - tags = new DialogCellTags(); + tags = new DialogCellTags(this); } folderId = folder; messageId = 0; @@ -775,6 +779,9 @@ protected void onDetachedFromWindow() { if (emojiStatus != null) { emojiStatus.detach(); } + if (botVerification != null) { + botVerification.detach(); + } AnimatedEmojiSpan.release(this, animatedEmojiStack); AnimatedEmojiSpan.release(this, animatedEmojiStack2); AnimatedEmojiSpan.release(this, animatedEmojiStack3); @@ -798,6 +805,9 @@ protected void onAttachedToWindow() { if (emojiStatus != null) { emojiStatus.attach(); } + if (botVerification != null) { + botVerification.attach(); + } } public void resetPinnedArchiveState() { @@ -814,6 +824,9 @@ public void resetPinnedArchiveState() { if (emojiStatus != null && attachedToWindow) { emojiStatus.attach(); } + if (botVerification != null && attachedToWindow) { + botVerification.attach(); + } } @Override @@ -960,7 +973,7 @@ private CharSequence formatArchivedDialogNames() { if (UserObject.isDeleted(currentUser)) { title = LocaleController.getString(R.string.HiddenName); } else { - title = AndroidUtilities.removeDiacritics(ContactsController.formatName(currentUser.first_name, currentUser.last_name).replace('\n', ' ')); + title = AndroidUtilities.escape(ContactsController.formatName(currentUser.first_name, currentUser.last_name).replace('\n', ' ')); } } else { continue; @@ -986,7 +999,7 @@ private CharSequence formatArchivedDialogNames() { } builder.append(LocaleController.formatPluralString("Stories", totalCount)); } - return Emoji.replaceEmoji(builder, Theme.dialogs_messagePaint[paintIndex].getFontMetricsInt(), dp(17), false); + return Emoji.replaceEmoji(builder, Theme.dialogs_messagePaint[paintIndex].getFontMetricsInt(), false); } public boolean hasTags() { @@ -1053,6 +1066,7 @@ public void buildLayout() { drawNameLock = false; drawVerified = false; + drawBotVerified = false; drawPremium = false; drawForwardIcon = false; drawGiftIcon = false; @@ -1166,7 +1180,7 @@ public void buildLayout() { stringBuilder = formatInternal(messageFormatType, mess.replace('\n', ' '), messageNameString); } } - messageString = Emoji.replaceEmoji(stringBuilder, Theme.dialogs_messagePaint[paintIndex].getFontMetricsInt(), dp(20), false); + messageString = Emoji.replaceEmoji(stringBuilder, Theme.dialogs_messagePaint[paintIndex].getFontMetricsInt(), false); } else { messageString = customDialog.message; if (customDialog.isMedia) { @@ -1243,7 +1257,9 @@ public void buildLayout() { } } else { if (currentDialogFolderId == 0) { + long dialogBotVerificationIcon = 0; if (chat != null) { + dialogBotVerificationIcon = DialogObject.getBotVerificationIcon(chat); if (chat.scam) { drawScam = 1; Theme.dialogs_scamDrawable.checkText(); @@ -1255,10 +1271,13 @@ public void buildLayout() { nameLayoutEllipsizeByGradient = true; emojiStatus.center = LocaleController.isRTL; emojiStatus.set(DialogObject.getEmojiStatusDocumentId(chat.emoji_status), false); + emojiStatus.setParticles(DialogObject.isEmojiStatusCollectible(chat.emoji_status), false); } else { drawVerified = !forbidVerified && chat.verified; + drawBotVerified = !forbidVerified && chat.bot_verification_icon != 0; } } else if (user != null) { + dialogBotVerificationIcon = DialogObject.getBotVerificationIcon(user); if (user.scam) { drawScam = 1; Theme.dialogs_scamDrawable.checkText(); @@ -1266,7 +1285,8 @@ public void buildLayout() { drawScam = 2; Theme.dialogs_fakeDrawable.checkText(); } else { - drawVerified =!forbidVerified && user.verified; + drawVerified = !forbidVerified && user.verified; + drawBotVerified = !forbidVerified && !UserObject.isUserSelf(user) && user.bot_verification_icon != 0; } drawPremium = MessagesController.getInstance(currentAccount).isPremiumUser(user) && UserConfig.getInstance(currentAccount).clientUserId != user.id && user.id != 0; if (drawPremium) { @@ -1275,12 +1295,17 @@ public void buildLayout() { if (emojiStatusId != null) { nameLayoutEllipsizeByGradient = true; emojiStatus.set(emojiStatusId, false); + emojiStatus.setParticles(DialogObject.isEmojiStatusCollectible(user.emoji_status), false); } else { nameLayoutEllipsizeByGradient = true; emojiStatus.set(PremiumGradient.getInstance().premiumStarDrawableMini, false); + emojiStatus.setParticles(false, false); } } } + if (dialogBotVerificationIcon != 0 && drawBotVerified) { + botVerification.set(dialogBotVerificationIcon, false); + } } } @@ -1315,7 +1340,7 @@ public void buildLayout() { draftVoice = false; needEmoji = true; updateMessageThumbs(); - messageNameString = AndroidUtilities.removeDiacritics(getMessageNameString()); + messageNameString = AndroidUtilities.escape(getMessageNameString()); messageString = formatTopicsNames(); String restrictionReason = message != null ? MessagesController.getInstance(message.currentAccount).getRestrictionReason(message.messageOwner.restriction_reason) : null; buttonString = message != null ? getMessageStringFormatted(messageFormatType, restrictionReason, messageNameString, true) : ""; @@ -1375,7 +1400,7 @@ public void buildLayout() { } else { mess = ""; } - Spannable messSpan = new SpannableStringBuilder(mess); + Spannable messSpan = new SpannableString(mess); if (draftMessage != null) { MediaDataController.addTextStyleRuns(draftMessage, messSpan, TextStyleSpan.FLAG_STYLE_SPOILER | TextStyleSpan.FLAG_STYLE_STRIKE); if (draftMessage != null && draftMessage.entities != null) { @@ -1389,7 +1414,7 @@ public void buildLayout() { if (!useForceThreeLines && !SharedConfig.useThreeLinesLayout || hasTags()) { stringBuilder.setSpan(new ForegroundColorSpanThemable(Theme.key_chats_draft, resourcesProvider), 0, messageNameString.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } - messageString = Emoji.replaceEmoji(stringBuilder, Theme.dialogs_messagePaint[paintIndex].getFontMetricsInt(), dp(20), false); + messageString = Emoji.replaceEmoji(stringBuilder, Theme.dialogs_messagePaint[paintIndex].getFontMetricsInt(), false); } } else { if (clearingDialog) { @@ -1513,7 +1538,7 @@ public void buildLayout() { updateMessageThumbs(); String triedMessageName = null; if (!isSavedDialog && user != null && user.self && !message.isOutOwner()) { - triedMessageName = AndroidUtilities.removeDiacritics(getMessageNameString()); + triedMessageName = AndroidUtilities.escape(getMessageNameString()); } if ( isSavedDialog && user != null && !user.self && message != null && message.isOutOwner() || @@ -1521,7 +1546,7 @@ public void buildLayout() { chat != null && chat.id > 0 && (fromChat == null || fromChat.id != chat.id) && (!ChatObject.isChannel(chat) || ChatObject.isMegagroup(chat)) && !ForumUtilities.isTopicCreateMessage(message) || user != null && user.id == UserObject.VERIFY && message != null && message.getForwardedFromId() != null ) { - messageNameString = AndroidUtilities.removeDiacritics(triedMessageName != null ? triedMessageName : getMessageNameString()); + messageNameString = AndroidUtilities.escape(triedMessageName != null ? triedMessageName : getMessageNameString()); if (chat != null && chat.forum && !isTopic && !useFromUserAsAvatar) { CharSequence topicName = MessagesController.getInstance(currentAccount).getTopicsController().getTopicIconName(chat, message, currentMessagePaint); if (!TextUtils.isEmpty(topicName)) { @@ -1546,7 +1571,7 @@ public void buildLayout() { FileLog.e(e); } } - messageString = Emoji.replaceEmoji(stringBuilder, Theme.dialogs_messagePaint[paintIndex].getFontMetricsInt(), dp(20), false); + messageString = Emoji.replaceEmoji(stringBuilder, Theme.dialogs_messagePaint[paintIndex].getFontMetricsInt(), false); if (message.hasHighlightedWords()) { CharSequence messageH = AndroidUtilities.highlightText(messageString, message.highlightedWords, resourcesProvider); if (messageH != null) { @@ -1622,7 +1647,7 @@ public void buildLayout() { } messageString = new SpannableStringBuilder(emoji).append(text); } else { - SpannableStringBuilder msgBuilder = new SpannableStringBuilder(message.caption); + SpannableString msgBuilder = new SpannableString(message.caption); if (message != null && message.messageOwner != null) { if (message != null) { message.spoilLoginCode(); @@ -1663,7 +1688,7 @@ public void buildLayout() { } else if (message.messageOwner.media instanceof TLRPC.TL_messageMediaPoll) { TLRPC.TL_messageMediaPoll mediaPoll = (TLRPC.TL_messageMediaPoll) message.messageOwner.media; if (mediaPoll.poll.question != null && mediaPoll.poll.question.entities != null) { - SpannableStringBuilder questionText = new SpannableStringBuilder(mediaPoll.poll.question.text); + SpannableString questionText = new SpannableString(mediaPoll.poll.question.text); MediaDataController.addTextStyleRuns(mediaPoll.poll.question.entities, mediaPoll.poll.question.text, questionText); MediaDataController.addAnimatedEmojiSpans(mediaPoll.poll.question.entities, questionText, Theme.dialogs_messagePaint[paintIndex].getFontMetricsInt()); messageString = new SpannableStringBuilder("\uD83D\uDCCA ").append(questionText); @@ -1703,7 +1728,7 @@ public void buildLayout() { messageString = AndroidUtilities.ellipsizeCenterEnd(messageString, message.highlightedWords.get(0), w, currentMessagePaint, 130); } } else { - SpannableStringBuilder stringBuilder = new SpannableStringBuilder(msgText); + SpannableString stringBuilder = new SpannableString(msgText); if (message != null) { message.spoilLoginCode(); } @@ -1748,7 +1773,7 @@ public void buildLayout() { SpannableStringBuilder builder = (SpannableStringBuilder) messageString; builder.insert(0, " "); builder.setSpan(new FixedWidthSpan(dp((thumbSize + 2) * thumbsCount - 2 + 5)), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - Emoji.replaceEmoji(builder, Theme.dialogs_messagePaint[paintIndex].getFontMetricsInt(), dp(17), false); + Emoji.replaceEmoji(builder, Theme.dialogs_messagePaint[paintIndex].getFontMetricsInt(), false); if (message.hasHighlightedWords()) { CharSequence s = AndroidUtilities.highlightText(builder, message.highlightedWords, resourcesProvider); if (s != null) { @@ -1774,7 +1799,7 @@ public void buildLayout() { } } - if (!drawForwardIcon && message != null && message.messageOwner != null && message.messageOwner.action instanceof TLRPC.TL_messageActionStarGift) { + if (!drawForwardIcon && !isFolderCell() && !isForumCell() && !isDialogFolder() && message != null && message.messageOwner != null && message.messageOwner.action instanceof TLRPC.TL_messageActionStarGift) { drawGiftIcon = true; SpannableStringBuilder builder = new SpannableStringBuilder(messageString); builder.insert(0, "d "); @@ -1919,9 +1944,9 @@ public void buildLayout() { topicIconInName = new Drawable[1]; } topicIconInName[0] = null; - nameString = showTopicIconInName ? ForumUtilities.getTopicSpannedName(forumTopic, Theme.dialogs_namePaint[paintIndex], topicIconInName, false) : AndroidUtilities.removeDiacritics(forumTopic.title); + nameString = showTopicIconInName ? ForumUtilities.getTopicSpannedName(forumTopic, Theme.dialogs_namePaint[paintIndex], topicIconInName, false) : AndroidUtilities.escape(forumTopic.title); } else { - nameString = AndroidUtilities.removeDiacritics(chat.title); + nameString = AndroidUtilities.escape(chat.title); } } else if (user != null) { if (UserObject.isReplyUser(user)) { @@ -1940,7 +1965,7 @@ public void buildLayout() { nameString = LocaleController.getString(R.string.SavedMessages); } } else { - nameString = AndroidUtilities.removeDiacritics(UserObject.getUserName(user)); + nameString = AndroidUtilities.escape(UserObject.getUserName(user)); } } if (nameString != null && nameString.length() == 0) { @@ -2064,7 +2089,7 @@ public void buildLayout() { if (!twoLinesForName) { nameStringFinal = TextUtils.ellipsize(nameStringFinal, Theme.dialogs_namePaint[paintIndex], ellipsizeWidth, TextUtils.TruncateAt.END); } - nameStringFinal = Emoji.replaceEmoji(nameStringFinal, Theme.dialogs_namePaint[paintIndex].getFontMetricsInt(), dp(20), false); + nameStringFinal = Emoji.replaceEmoji(nameStringFinal, Theme.dialogs_namePaint[paintIndex].getFontMetricsInt(), false); if (message != null && message.hasHighlightedWords()) { CharSequence s = AndroidUtilities.highlightText(nameStringFinal, message.highlightedWords, resourcesProvider); if (s != null) { @@ -2235,7 +2260,7 @@ public void buildLayout() { messageNameLeft += w; } } - } else if (allowBotOpenButton && UserObject.isBot(user) && user.bot_has_main_app) { + } else if (allowBotOpenButton && !isFolderCell() && !isForumCell() && !isDialogFolder() && UserObject.isBot(user) && user.bot_has_main_app) { setOpenBotButton(true); int buttonWidth = (int) (dp(2 * 13) + openButtonText.getCurrentWidth()), p = dp(13); messageWidth -= buttonWidth; @@ -2284,7 +2309,7 @@ public void buildLayout() { } else { mess = AndroidUtilities.replaceTwoNewLinesToOne(mess); } - messageString = Emoji.replaceEmoji(mess, Theme.dialogs_messagePaint[paintIndex].getFontMetricsInt(), dp(17), false); + messageString = Emoji.replaceEmoji(mess, Theme.dialogs_messagePaint[paintIndex].getFontMetricsInt(), false); if (message != null) { CharSequence s = AndroidUtilities.highlightText(messageString, message.highlightedWords, resourcesProvider); if (s != null) { @@ -2341,7 +2366,7 @@ public void buildLayout() { try { buttonCreated = false; if (!TextUtils.isEmpty(buttonString)) { - buttonString = Emoji.replaceEmoji(buttonString, currentMessagePaint.getFontMetricsInt(), dp(17), false); + buttonString = Emoji.replaceEmoji(buttonString, currentMessagePaint.getFontMetricsInt(), false); CharSequence buttonStringFinal = TextUtils.ellipsize(buttonString, currentMessagePaint, messageWidth - dp(26), TextUtils.TruncateAt.END); buttonLayout = new StaticLayout(buttonStringFinal, currentMessagePaint, messageWidth - dp(20), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); spoilersPool2.addAll(spoilers2); @@ -2424,6 +2449,9 @@ public void buildLayout() { left = nameLayout.getLineLeft(0); widthpx = Math.ceil(nameLayout.getLineWidth(0)); nameLeft += dp(12); + if (drawBotVerified) { + nameLeft += dp(21); + } if (nameLayoutEllipsizeByGradient) { widthpx = Math.min(nameWidth, widthpx); } @@ -2518,6 +2546,9 @@ public void buildLayout() { nameLeft -= (nameWidth - widthpx); } } + if (drawBotVerified) { + nameLeft += dp(21); + } if ((dialogMuted || true) || drawUnmute || drawVerified || drawPremium || drawScam != 0) { nameMuteLeft = (int) (nameLeft + left + dp(6)); } @@ -2932,15 +2963,19 @@ public boolean update(int mask, boolean animated) { } } if ((mask & MessagesController.UPDATE_MASK_EMOJI_STATUS) != 0) { + long dialogBotVerificationIcon = 0; if (user != null) { user = MessagesController.getInstance(currentAccount).getUser(user.id); if (user != null && DialogObject.getEmojiStatusDocumentId(user.emoji_status) != 0) { nameLayoutEllipsizeByGradient = true; emojiStatus.set(DialogObject.getEmojiStatusDocumentId(user.emoji_status), animated); + emojiStatus.setParticles(DialogObject.isEmojiStatusCollectible(user.emoji_status), animated); } else { nameLayoutEllipsizeByGradient = true; emojiStatus.set(PremiumGradient.getInstance().premiumStarDrawableMini, animated); + emojiStatus.setParticles(false, animated); } + dialogBotVerificationIcon = DialogObject.getBotVerificationIcon(user); invalidate = true; } if (chat != null) { @@ -2948,12 +2983,26 @@ public boolean update(int mask, boolean animated) { if (chat != null && DialogObject.getEmojiStatusDocumentId(chat.emoji_status) != 0) { nameLayoutEllipsizeByGradient = true; emojiStatus.set(DialogObject.getEmojiStatusDocumentId(chat.emoji_status), animated); + emojiStatus.setParticles(DialogObject.isEmojiStatusCollectible(chat.emoji_status), animated); } else { nameLayoutEllipsizeByGradient = true; emojiStatus.set(PremiumGradient.getInstance().premiumStarDrawableMini, animated); + emojiStatus.setParticles(false, animated); } + dialogBotVerificationIcon = DialogObject.getBotVerificationIcon(chat); invalidate = true; } + if (dialogBotVerificationIcon != 0) { + if (!drawBotVerified) { + continueUpdate = true; + } + botVerification.set(dialogBotVerificationIcon, animated); + } else { + if (drawBotVerified) { + continueUpdate = true; + } + botVerification.set((Drawable) null, animated); + } } if (isDialogCell || isTopic) { if ((mask & MessagesController.UPDATE_MASK_USER_PRINT) != 0) { @@ -3867,6 +3916,22 @@ protected void onDraw(Canvas canvas) { lastStatusDrawableParams = (this.drawClock ? 1 : 0) + (this.drawCheck1 ? 2 : 0) + (this.drawCheck2 ? 4 : 0); } + if (drawBotVerified) { + int y = dp(useForceThreeLines || SharedConfig.useThreeLinesLayout ? 12.5f : 15.5f); + if ((!(useForceThreeLines || SharedConfig.useThreeLinesLayout) || isForumCell()) && hasTags()) { + y -= dp(9); + } + if (botVerification != null) { + botVerification.setBounds( + nameLeft - dp(17 + 2), + y + dp(-1), + nameLeft - dp(2), + y + dp(17 - 1) + ); + botVerification.setColor(Theme.getColor(Theme.key_chats_verifiedBackground, resourcesProvider)); + botVerification.draw(canvas); + } + } boolean drawMuted = drawUnmute || dialogMuted; if (dialogsType != 2 && (drawMuted || dialogMutedProgress > 0) && !drawVerified && drawScam == 0 && !drawPremium) { if (drawMuted && dialogMutedProgress != 1f) { @@ -4072,6 +4137,9 @@ protected void onDraw(Canvas canvas) { canvas.clipPath(thumbPath); int sColor = Color.WHITE; + if (thumbSpoiler == null) { + thumbSpoiler = new SpoilerEffect(); + } thumbSpoiler.setColor(ColorUtils.setAlphaComponent(sColor, (int) (Color.alpha(sColor) * 0.325f))); thumbSpoiler.setBounds((int) thumbImage[i].getImageX(), (int) thumbImage[i].getImageY(), (int) thumbImage[i].getImageX2(), (int) thumbImage[i].getImageY2()); thumbSpoiler.draw(canvas); @@ -5037,13 +5105,16 @@ private void setThumb(int index, MessageObject message) { } } - TLRPC.PhotoSize smallThumb = FileLoader.getClosestPhotoSizeWithSize(photoThumbs, 40); + TLRPC.PhotoSize smallThumb = FileLoader.getStrippedPhotoSize(photoThumbs); + if (smallThumb == null) { + smallThumb = FileLoader.getClosestPhotoSizeWithSize(photoThumbs, 40); + } TLRPC.PhotoSize bigThumb = FileLoader.getClosestPhotoSizeWithSize(photoThumbs, AndroidUtilities.getPhotoSize(), false, null, true); if (smallThumb == bigThumb) { bigThumb = null; } TLRPC.PhotoSize selectedThumb = bigThumb; - if (selectedThumb == null || DownloadController.getInstance(currentAccount).canDownloadMedia(message.messageOwner) == 0) { + if (selectedThumb == null || !DownloadController.getInstance(currentAccount).canDownloadMedia(message)) { selectedThumb = smallThumb; } @@ -5075,13 +5146,16 @@ private void setThumb(int index, TLRPC.MessageMedia media) { photoThumbs = media.document.thumbs; } - TLRPC.PhotoSize smallThumb = FileLoader.getClosestPhotoSizeWithSize(photoThumbs, 40); + TLRPC.PhotoSize smallThumb = FileLoader.getStrippedPhotoSize(photoThumbs); + if (smallThumb == null) { + smallThumb = FileLoader.getClosestPhotoSizeWithSize(photoThumbs, 40); + } TLRPC.PhotoSize bigThumb = FileLoader.getClosestPhotoSizeWithSize(photoThumbs, AndroidUtilities.getPhotoSize(), false, null, true); if (smallThumb == bigThumb) { bigThumb = null; } TLRPC.PhotoSize selectedThumb = bigThumb; - if (selectedThumb == null || DownloadController.getInstance(currentAccount).canDownloadMedia(message.messageOwner, media) == 0) { + if (selectedThumb == null || !DownloadController.getInstance(currentAccount).canDownloadMedia(DownloadController.AUTODOWNLOAD_TYPE_PHOTO, (long) selectedThumb.size)) { selectedThumb = smallThumb; } @@ -5156,14 +5230,14 @@ public String getMessageNameString() { if (currentDialogId == selfId) { if (fromUser != null) { - return AndroidUtilities.removeDiacritics(UserObject.getFirstName(fromUser).replace("\n", "")); + return AndroidUtilities.escape(UserObject.getFirstName(fromUser).replace("\n", "")); } else if (fromChat != null) { - return AndroidUtilities.removeDiacritics(fromChat.title.replace("\n", "")); + return AndroidUtilities.escape(fromChat.title.replace("\n", "")); } return null; } else if (currentDialogId == UserObject.VERIFY && message != null && message.messageOwner != null && message.messageOwner.fwd_from != null) { if (message.messageOwner.fwd_from.from_name != null) { - return AndroidUtilities.removeDiacritics(message.messageOwner.fwd_from.from_name); + return AndroidUtilities.escape(message.messageOwner.fwd_from.from_name); } else { long did = DialogObject.getPeerDialogId(message.messageOwner.fwd_from.from_id); if (DialogObject.isUserDialog(did)) { @@ -5177,21 +5251,21 @@ public String getMessageNameString() { } else if (message.isOutOwner() && fromUser != null) { return LocaleController.getString(R.string.FromYou); } else if (!isSavedDialog && message != null && message.messageOwner != null && message.messageOwner.from_id instanceof TLRPC.TL_peerUser && (user = MessagesController.getInstance(currentAccount).getUser(message.messageOwner.from_id.user_id)) != null) { - return AndroidUtilities.removeDiacritics(UserObject.getFirstName(user).replace("\n", "")); + return AndroidUtilities.escape(UserObject.getFirstName(user).replace("\n", "")); } else if (message != null && message.messageOwner != null && message.messageOwner.fwd_from != null && message.messageOwner.fwd_from.from_name != null) { - return AndroidUtilities.removeDiacritics(message.messageOwner.fwd_from.from_name); + return AndroidUtilities.escape(message.messageOwner.fwd_from.from_name); } else if (fromUser != null) { if (useForceThreeLines || SharedConfig.useThreeLinesLayout) { if (UserObject.isDeleted(fromUser)) { return LocaleController.getString(R.string.HiddenName); } else { - return AndroidUtilities.removeDiacritics(ContactsController.formatName(fromUser.first_name, fromUser.last_name).replace("\n", "")); + return AndroidUtilities.escape(ContactsController.formatName(fromUser.first_name, fromUser.last_name).replace("\n", "")); } } else { - return AndroidUtilities.removeDiacritics(UserObject.getFirstName(fromUser).replace("\n", "")); + return AndroidUtilities.escape(UserObject.getFirstName(fromUser).replace("\n", "")); } } else if (fromChat != null && fromChat.title != null) { - return AndroidUtilities.removeDiacritics(fromChat.title.replace("\n", "")); + return AndroidUtilities.escape(fromChat.title.replace("\n", "")); } else { return "DELETED"; } @@ -5260,7 +5334,7 @@ public SpannableStringBuilder getMessageStringFormatted(int messageFormatType, S if (mess.length() > 150) { mess = mess.subSequence(0, 150); } - SpannableStringBuilder msgBuilder = new SpannableStringBuilder(mess); + SpannableString msgBuilder = new SpannableString(mess); if (message != null) { message.spoilLoginCode(); } @@ -5282,7 +5356,7 @@ public SpannableStringBuilder getMessageStringFormatted(int messageFormatType, S TLRPC.TL_messageMediaPoll mediaPoll = (TLRPC.TL_messageMediaPoll) message.messageOwner.media; if (Build.VERSION.SDK_INT >= 18) { if (mediaPoll.poll.question != null && mediaPoll.poll.question.entities != null) { - SpannableStringBuilder questionText = new SpannableStringBuilder(mediaPoll.poll.question.text.replace('\n', ' ')); + SpannableString questionText = new SpannableString(mediaPoll.poll.question.text.replace('\n', ' ')); MediaDataController.addTextStyleRuns(mediaPoll.poll.question.entities, mediaPoll.poll.question.text, questionText); MediaDataController.addAnimatedEmojiSpans(mediaPoll.poll.question.entities, questionText, Theme.dialogs_messagePaint[paintIndex].getFontMetricsInt()); innerMessage = new SpannableStringBuilder("\uD83D\uDCCA \u2068").append(questionText).append("\u2069"); @@ -5291,7 +5365,7 @@ public SpannableStringBuilder getMessageStringFormatted(int messageFormatType, S } } else { if (mediaPoll.poll.question != null && mediaPoll.poll.question.entities != null) { - SpannableStringBuilder questionText = new SpannableStringBuilder(mediaPoll.poll.question.text.replace('\n', ' ')); + SpannableString questionText = new SpannableString(mediaPoll.poll.question.text.replace('\n', ' ')); MediaDataController.addTextStyleRuns(mediaPoll.poll.question.entities, mediaPoll.poll.question.text, questionText); MediaDataController.addAnimatedEmojiSpans(mediaPoll.poll.question.entities, questionText, Theme.dialogs_messagePaint[paintIndex].getFontMetricsInt()); innerMessage = new SpannableStringBuilder("\uD83D\uDCCA ").append(questionText); @@ -5371,7 +5445,7 @@ public SpannableStringBuilder getMessageStringFormatted(int messageFormatType, S } mess = AndroidUtilities.replaceNewLines(mess); } - mess = new SpannableStringBuilder(mess); + mess = new SpannableString(mess); if (message != null) { message.spoilLoginCode(); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogsHintCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogsHintCell.java index e8fd6b9a34..8351c74818 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogsHintCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogsHintCell.java @@ -21,10 +21,12 @@ import org.telegram.messenger.LocaleController; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; +import org.telegram.messenger.UserConfig; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Components.AnimatedEmojiSpan; import org.telegram.ui.Components.AvatarsImageView; +import org.telegram.ui.Components.BackupImageView; import org.telegram.ui.Components.BlurredFrameLayout; import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.SizeNotifierFrameLayout; @@ -32,12 +34,14 @@ import java.util.ArrayList; public class DialogsHintCell extends BlurredFrameLayout { + private final LinearLayout parentView; private final LinearLayout contentView; public final AnimatedEmojiSpan.TextViewEmojis titleView; private final TextView messageView; private final ImageView chevronView; private final ImageView closeView; + public final BackupImageView imageView; private final AvatarsImageView avatarsImageView; public DialogsHintCell(@NonNull Context context, SizeNotifierFrameLayout parentFrameLayout) { @@ -51,6 +55,9 @@ public DialogsHintCell(@NonNull Context context, SizeNotifierFrameLayout parentF avatarsImageView.setVisibility(View.GONE); avatarsImageView.setCount(0); + imageView = new BackupImageView(context); + imageView.setVisibility(View.GONE); + contentView = new LinearLayout(context); contentView.setOrientation(LinearLayout.VERTICAL); contentView.setPadding(LocaleController.isRTL ? dp(24) : 0, 0, LocaleController.isRTL ? 0 : dp(24), 0); @@ -81,8 +88,10 @@ public DialogsHintCell(@NonNull Context context, SizeNotifierFrameLayout parentF parentView.setOrientation(LinearLayout.HORIZONTAL); if (LocaleController.isRTL) { parentView.addView(contentView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.CENTER_VERTICAL, 7, 0, 7, 0)); - parentView.addView(avatarsImageView, LayoutHelper.createFrame(0, LayoutHelper.MATCH_PARENT, Gravity.CENTER_VERTICAL, 2, 0, 0, 0)); + parentView.addView(avatarsImageView, LayoutHelper.createFrame(0, LayoutHelper.MATCH_PARENT, Gravity.CENTER_VERTICAL, 2, 0, 8, 0)); + parentView.addView(imageView, LayoutHelper.createFrame(36, 36, Gravity.CENTER_VERTICAL | Gravity.RIGHT, 2, 1, 0, 0)); } else { + parentView.addView(imageView, LayoutHelper.createFrame(36, 36, Gravity.CENTER_VERTICAL | Gravity.LEFT, 0, 1, 2, 0)); parentView.addView(avatarsImageView, LayoutHelper.createFrame(0, LayoutHelper.MATCH_PARENT, Gravity.CENTER_VERTICAL, 0, 0, 2, 0)); parentView.addView(contentView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.CENTER_VERTICAL, 7, 0, 7, 0)); } @@ -136,6 +145,17 @@ public void setAvatars(int currentAccount, ArrayList users) { avatarsImageView.commitTransition(false); } + public void clear() { + setCompact(false); + setAvatars(UserConfig.selectedAccount, null); + imageView.setVisibility(View.GONE); + imageView.clearImage(); + } + + public void showImage() { + imageView.setVisibility(View.VISIBLE); + } + public void setText(CharSequence title, CharSequence subtitle) { titleView.setText(title); titleView.setCompoundDrawables(null, null, null, null); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerProfileCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerProfileCell.java index 06e6c271fc..c50995b2ae 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerProfileCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerProfileCell.java @@ -37,6 +37,7 @@ import org.telegram.PhoneFormat.PhoneFormat; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ApplicationLoader; +import org.telegram.messenger.DialogObject; import org.telegram.messenger.Emoji; import org.telegram.messenger.FileLog; import org.telegram.messenger.ImageLocation; @@ -81,6 +82,7 @@ public class DrawerProfileCell extends FrameLayout implements NotificationCenter private RLottieImageView darkThemeView; private static RLottieDrawable sunDrawable; private boolean updateRightDrawable = true; + private Long statusGiftId; private AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable status; private AnimatedStatusView animatedStatus; @@ -685,16 +687,22 @@ public void setUser(TLRPC.User user, boolean accounts) { setArrowState(false); CharSequence text = UserObject.getUserName(user); try { - text = Emoji.replaceEmoji(text, nameTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(22), false); + text = Emoji.replaceEmoji(text, nameTextView.getPaint().getFontMetricsInt(), false); } catch (Exception ignore) {} drawPremium = false;//user.premium; nameTextView.setText(text); + statusGiftId = null; Long emojiStatusId = UserObject.getEmojiStatusDocumentId(user); if (emojiStatusId != null) { + final boolean isCollectible = user.emoji_status instanceof TLRPC.TL_emojiStatusCollectible; animatedStatus.animate().alpha(1).setDuration(200).start(); nameTextView.setDrawablePadding(AndroidUtilities.dp(4)); status.set(emojiStatusId, true); + if (isCollectible) { + statusGiftId = ((TLRPC.TL_emojiStatusCollectible) user.emoji_status).collectible_id; + } + status.setParticles(isCollectible, true); } else if (user.premium) { animatedStatus.animate().alpha(1).setDuration(200).start(); nameTextView.setDrawablePadding(AndroidUtilities.dp(4)); @@ -703,10 +711,12 @@ public void setUser(TLRPC.User user, boolean accounts) { } premiumStar.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_menuPhoneCats), PorterDuff.Mode.MULTIPLY)); status.set(premiumStar, true); + status.setParticles(false, true); } else { animatedStatus.animateChange(null); animatedStatus.animate().alpha(0).setDuration(200).start(); status.set((Drawable) null, true); + status.setParticles(false, true); } animatedStatus.setColor(Theme.getColor(Theme.isCurrentThemeDark() ? Theme.key_chats_verifiedBackground : Theme.key_chats_menuPhoneCats)); status.setColor(Theme.getColor(Theme.isCurrentThemeDark() ? Theme.key_chats_verifiedBackground : Theme.key_chats_menuPhoneCats)); @@ -773,6 +783,10 @@ public AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable getEmojiStatusDrawable() return status; } + public Long getEmojiStatusGiftId() { + return statusGiftId; + } + public View getEmojiStatusDrawableParent() { return nameTextView; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerUserCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerUserCell.java index 75d063b64d..e45d1dddf8 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerUserCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerUserCell.java @@ -8,6 +8,8 @@ package org.telegram.ui.Cells; +import static org.telegram.messenger.AndroidUtilities.dp; + import android.content.Context; import android.graphics.Canvas; import android.graphics.RectF; @@ -18,6 +20,7 @@ import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ContactsController; +import org.telegram.messenger.DialogObject; import org.telegram.messenger.Emoji; import org.telegram.messenger.MessagesController; import org.telegram.messenger.MessagesStorage; @@ -25,6 +28,7 @@ import org.telegram.messenger.NotificationsController; import org.telegram.messenger.UserConfig; import org.telegram.messenger.UserObject; +import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.SimpleTextView; import org.telegram.ui.ActionBar.Theme; @@ -37,27 +41,28 @@ public class DrawerUserCell extends FrameLayout implements NotificationCenter.NotificationCenterDelegate { - private SimpleTextView textView; - private BackupImageView imageView; - private AvatarDrawable avatarDrawable; - private GroupCreateCheckBox checkBox; - private AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable status; + private final SimpleTextView textView; + private final BackupImageView imageView; + private final AvatarDrawable avatarDrawable; + private final GroupCreateCheckBox checkBox; + private final AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable botVerification; + private final AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable status; private int accountNumber; - private RectF rect = new RectF(); + private final RectF rect = new RectF(); public DrawerUserCell(Context context) { super(context); avatarDrawable = new AvatarDrawable(); - avatarDrawable.setTextSize(AndroidUtilities.dp(20)); + avatarDrawable.setTextSize(dp(20)); imageView = new BackupImageView(context); - imageView.setRoundRadius(AndroidUtilities.dp(18)); + imageView.setRoundRadius(dp(18)); addView(imageView, LayoutHelper.createFrame(36, 36, Gravity.LEFT | Gravity.TOP, 14, 6, 0, 0)); textView = new SimpleTextView(context); - textView.setPadding(0, AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4)); + textView.setPadding(0, dp(4), 0, dp(4)); textView.setTextColor(Theme.getColor(Theme.key_chats_menuItemText)); textView.setTextSize(15); textView.setTypeface(AndroidUtilities.bold()); @@ -66,13 +71,14 @@ public DrawerUserCell(Context context) { textView.setEllipsizeByGradient(24); addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 72, 0, 14, 0)); - status = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(textView, AndroidUtilities.dp(20)); + botVerification = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(textView, dp(18)); + status = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(textView, dp(20)); textView.setRightDrawable(status); checkBox = new GroupCreateCheckBox(context); checkBox.setChecked(true, false); checkBox.setCheckScale(0.9f); - checkBox.setInnerRadDiff(AndroidUtilities.dp(1.5f)); + checkBox.setInnerRadDiff(dp(1.5f)); checkBox.setColorKeysOverrides(Theme.key_chats_unreadCounterText, Theme.key_chats_unreadCounter, Theme.key_chats_menuBackground); addView(checkBox, LayoutHelper.createFrame(18, 18, Gravity.LEFT | Gravity.TOP, 37, 27, 0, 0)); @@ -81,7 +87,7 @@ public DrawerUserCell(Context context) { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(48), MeasureSpec.EXACTLY)); + super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(dp(48), MeasureSpec.EXACTLY)); } @Override @@ -89,6 +95,7 @@ protected void onAttachedToWindow() { super.onAttachedToWindow(); textView.setTextColor(Theme.getColor(Theme.key_chats_menuItemText)); status.attach(); + botVerification.attach(); for (int i = 0; i < UserConfig.MAX_ACCOUNT_COUNT; i++){ NotificationCenter.getInstance(i).addObserver(this, NotificationCenter.currentUserPremiumStatusChanged); NotificationCenter.getInstance(i).addObserver(this, NotificationCenter.updateInterfaces); @@ -100,6 +107,7 @@ protected void onAttachedToWindow() { protected void onDetachedFromWindow() { super.onDetachedFromWindow(); status.detach(); + botVerification.detach(); for (int i = 0; i < UserConfig.MAX_ACCOUNT_COUNT; i++){ NotificationCenter.getInstance(i).removeObserver(this, NotificationCenter.currentUserPremiumStatusChanged); NotificationCenter.getInstance(i).removeObserver(this, NotificationCenter.updateInterfaces); @@ -131,29 +139,41 @@ public void didReceivedNotification(int id, int account, Object... args) { public void setAccount(int account) { accountNumber = account; - TLRPC.User user = UserConfig.getInstance(accountNumber).getCurrentUser(); + final TLRPC.User user = UserConfig.getInstance(accountNumber).getCurrentUser(); if (user == null) { return; } avatarDrawable.setInfo(account, user); CharSequence text = ContactsController.formatName(user.first_name, user.last_name); try { - text = Emoji.replaceEmoji(text, textView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false); + text = Emoji.replaceEmoji(text, textView.getPaint().getFontMetricsInt(), false); } catch (Exception ignore) {} textView.setText(text); - Long emojiStatusId = UserObject.getEmojiStatusDocumentId(user); + final Long emojiStatusId = UserObject.getEmojiStatusDocumentId(user); if (emojiStatusId != null) { - textView.setDrawablePadding(AndroidUtilities.dp(4)); + textView.setDrawablePadding(dp(4)); status.set(emojiStatusId, true); + status.setParticles(DialogObject.isEmojiStatusCollectible(user.emoji_status), true); textView.setRightDrawableOutside(true); } else if (MessagesController.getInstance(account).isPremiumUser(user)) { - textView.setDrawablePadding(AndroidUtilities.dp(6)); + textView.setDrawablePadding(dp(6)); status.set(PremiumGradient.getInstance().premiumStarDrawableMini, true); + status.setParticles(false, true); textView.setRightDrawableOutside(true); } else { status.set((Drawable) null, true); + status.setParticles(false, true); textView.setRightDrawableOutside(false); } + final long botVerificationId = DialogObject.getBotVerificationIcon(user); + if (botVerificationId == 0 || ConnectionsManager.getInstance(account).isTestBackend() != ConnectionsManager.getInstance(UserConfig.selectedAccount).isTestBackend()) { + botVerification.set((Drawable) null, false); + textView.setLeftDrawable(null); + } else { + botVerification.set(botVerificationId, false); + botVerification.setColor(Theme.getColor(Theme.key_featuredStickers_addButton)); + textView.setLeftDrawable(botVerification); + } status.setColor(Theme.getColor(Theme.key_chats_verifiedBackground)); imageView.getImageReceiver().setCurrentAccount(account); imageView.setForUserOrChat(user, avatarDrawable); @@ -170,25 +190,25 @@ protected void onDraw(Canvas canvas) { textView.setRightPadding(0); return; } - int counter = MessagesStorage.getInstance(accountNumber).getMainUnreadCount(); + final int counter = MessagesStorage.getInstance(accountNumber).getMainUnreadCount(); if (counter <= 0) { textView.setRightPadding(0); return; } - String text = String.format("%d", counter); - int countTop = AndroidUtilities.dp(12.5f); - int textWidth = (int) Math.ceil(Theme.dialogs_countTextPaint.measureText(text)); - int countWidth = Math.max(AndroidUtilities.dp(10), textWidth); - int countLeft = getMeasuredWidth() - countWidth - AndroidUtilities.dp(25); + final String text = String.format("%d", counter); + final int countTop = dp(12.5f); + final int textWidth = (int) Math.ceil(Theme.dialogs_countTextPaint.measureText(text)); + final int countWidth = Math.max(dp(10), textWidth); + final int countLeft = getMeasuredWidth() - countWidth - dp(25); - int x = countLeft - AndroidUtilities.dp(5.5f); - rect.set(x, countTop, x + countWidth + AndroidUtilities.dp(14), countTop + AndroidUtilities.dp(23)); + final int x = countLeft - dp(5.5f); + rect.set(x, countTop, x + countWidth + dp(14), countTop + dp(23)); canvas.drawRoundRect(rect, 11.5f * AndroidUtilities.density, 11.5f * AndroidUtilities.density, Theme.dialogs_countPaint); - canvas.drawText(text, rect.left + (rect.width() - textWidth) / 2, countTop + AndroidUtilities.dp(16), Theme.dialogs_countTextPaint); + canvas.drawText(text, rect.left + (rect.width() - textWidth) / 2, countTop + dp(16), Theme.dialogs_countTextPaint); - textView.setRightPadding(countWidth + AndroidUtilities.dp(14 + 12)); + textView.setRightPadding(countWidth + dp(14 + 12)); } @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/EditEmojiTextCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/EditEmojiTextCell.java index 28c91c69cd..5210d54d68 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/EditEmojiTextCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/EditEmojiTextCell.java @@ -32,6 +32,7 @@ import org.telegram.messenger.R; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Components.AnimatedColor; +import org.telegram.ui.Components.AnimatedEmojiDrawable; import org.telegram.ui.Components.AnimatedTextView; import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.EditTextCaption; @@ -54,6 +55,8 @@ public class EditEmojiTextCell extends FrameLayout { public boolean autofocused; private boolean focused; + private boolean allowEntities = true; + final AnimatedColor limitColor; private int limitCount; final AnimatedTextView.AnimatedTextDrawable limit = new AnimatedTextView.AnimatedTextDrawable(false, true, true); { @@ -107,6 +110,19 @@ public EditEmojiTextCell(Context context, SizeNotifierFrameLayout parent, String this(context, parent, hint, multiline, -1, style, null); } + public int emojiCacheType() { + return AnimatedEmojiDrawable.getCacheTypeForEnterView(); + } + + public void setEmojiViewCacheType(int cacheType) { + editTextEmoji.setEmojiViewCacheType(cacheType); + } + + public EditEmojiTextCell setAllowEntities(boolean allow) { + allowEntities = allow; + return this; + } + public EditEmojiTextCell( Context context, SizeNotifierFrameLayout parent, @@ -136,7 +152,8 @@ protected void onDraw(Canvas canvas) { limit.setTextColor(limitColor.set(Theme.getColor(limitCount <= 0 ? Theme.key_text_RedRegular : Theme.key_dialogSearchHint, resourceProvider))); } int h = Math.min(dp(48), getHeight()); - limit.setBounds(getScrollX(), getHeight() - h, getScrollX() + getWidth() - dp(12), getHeight()); + final float ty = multiline ? 0 : -dp(1); + limit.setBounds(getScrollX(), ty + getHeight() - h, getScrollX() + getWidth() - dp(12 + (!multiline ? 44 : 0)), ty + getHeight()); limit.draw(canvas); } @@ -156,7 +173,6 @@ protected void extendActionMode(ActionMode actionMode, Menu menu) { stringBuilder = new SpannableStringBuilder(getString(R.string.Italic)); stringBuilder.setSpan(new TypefaceSpan(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM_ITALIC)), 0, stringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); menu.add(R.id.menu_groupbolditalic, R.id.menu_italic, order++, stringBuilder); -// menu.add(R.id.menu_groupbolditalic, R.id.menu_link, order++, getString(R.string.CreateLink)); stringBuilder = new SpannableStringBuilder(LocaleController.getString(R.string.Strike)); TextStyleSpan.TextStyleRun run = new TextStyleSpan.TextStyleRun(); run.flags |= TextStyleSpan.FLAG_STYLE_STRIKE; @@ -164,6 +180,16 @@ protected void extendActionMode(ActionMode actionMode, Menu menu) { menu.add(R.id.menu_groupbolditalic, R.id.menu_strike, order++, stringBuilder); menu.add(R.id.menu_groupbolditalic, R.id.menu_regular, order++, getString(R.string.Regular)); } + + @Override + protected boolean allowEntities() { + return allowEntities && super.allowEntities(); + } + + @Override + public int emojiCacheType() { + return EditEmojiTextCell.this.emojiCacheType(); + } }; final EditTextCaption editText = editTextEmoji.getEditText(); editText.setDelegate(new EditTextCaption.EditTextCaptionDelegate() { @@ -284,4 +310,9 @@ protected void onDraw(Canvas canvas) { ); } } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), heightMeasureSpec); + } } \ No newline at end of file diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/GraySectionCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/GraySectionCell.java index 16dd9e3ba3..951e147d2e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/GraySectionCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/GraySectionCell.java @@ -8,6 +8,8 @@ package org.telegram.ui.Cells; +import static org.telegram.messenger.AndroidUtilities.dp; + import android.content.Context; import android.util.TypedValue; import android.view.Gravity; @@ -33,6 +35,7 @@ public class GraySectionCell extends FrameLayout implements Theme.Colorable { private AnimatedEmojiSpan.TextViewEmojis textView; private AnimatedTextView rightTextView; + private FrameLayout.LayoutParams rightTextViewLayoutParams; private final Theme.ResourcesProvider resourcesProvider; private int layerHeight = 32; @@ -59,12 +62,12 @@ public CharSequence getAccessibilityClassName() { return Button.class.getName(); } }; - rightTextView.setPadding(AndroidUtilities.dp(2), 0, AndroidUtilities.dp(2), 0); + rightTextView.setPadding(dp(2), 0, dp(2), 0); rightTextView.setAnimationProperties(.9f, 0, 420, CubicBezierInterpolator.EASE_OUT_QUINT); - rightTextView.setTextSize(AndroidUtilities.dp(14)); + rightTextView.setTextSize(dp(14)); rightTextView.setTextColor(getThemedColor(Theme.key_graySectionText)); rightTextView.setGravity(LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT); - addView(rightTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, 16, 0, 16, 0)); + addView(rightTextView, rightTextViewLayoutParams = LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, 16, 0, 16, 0)); ViewCompat.setAccessibilityHeading(this, true); } @@ -79,7 +82,7 @@ public void updateColors() { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure( MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), - MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(layerHeight), MeasureSpec.EXACTLY)); + MeasureSpec.makeMeasureSpec(dp(layerHeight), MeasureSpec.EXACTLY)); } public void setLayerHeight(int dp){ @@ -110,10 +113,16 @@ public void setText(CharSequence left, CharSequence right, OnClickListener onCli rightTextView.setVisibility(VISIBLE); } - public void setRightText(String right) { + public void setRightText(CharSequence right) { setRightText(right, true); } + public void setRightTextMargin(int marginDp) { + rightTextViewLayoutParams.leftMargin = dp(marginDp); + rightTextViewLayoutParams.rightMargin = dp(marginDp); + rightTextView.setLayoutParams(rightTextViewLayoutParams); + } + public void setRightText(CharSequence right, boolean moveDown) { rightTextView.setText(right, true, moveDown); rightTextView.setVisibility(VISIBLE); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/GroupCallUserCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/GroupCallUserCell.java index ed0cf2363e..b23e9463c5 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/GroupCallUserCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/GroupCallUserCell.java @@ -66,7 +66,8 @@ public class GroupCallUserCell extends FrameLayout { private RLottieDrawable muteDrawable; private RLottieDrawable shakeHandDrawable; - public AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable rightDrawable; + public final AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable leftDrawable; + public final AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable rightDrawable; private Drawable verifiedDrawable; private Drawable premiumDrawable; @@ -295,6 +296,7 @@ protected void onDraw(Canvas canvas) { nameTextView.setDrawablePadding(AndroidUtilities.dp(6)); nameTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP); addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 20, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 54 : 67, 10, LocaleController.isRTL ? 67 : 54, 0)); + leftDrawable = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(nameTextView, AndroidUtilities.dp(20), AnimatedEmojiDrawable.CACHE_TYPE_ALERT_EMOJI_STATUS); rightDrawable = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(nameTextView, AndroidUtilities.dp(20), AnimatedEmojiDrawable.CACHE_TYPE_ALERT_EMOJI_STATUS); speakingDrawable = context.getResources().getDrawable(R.drawable.voice_volume_mini); @@ -436,6 +438,9 @@ protected void onDetachedFromWindow() { if (rightDrawable != null) { rightDrawable.detach(); } + if (leftDrawable != null) { + leftDrawable.detach(); + } } public boolean isSelfUser() { @@ -466,12 +471,14 @@ public void setData(AccountInstance account, TLRPC.TL_groupCallParticipant group participant = groupCallParticipant; long id = MessageObject.getPeerId(participant.peer); + long botVerificationIcon = 0; if (id > 0) { currentUser = accountInstance.getMessagesController().getUser(id); currentChat = null; avatarDrawable.setInfo(accountInstance.getCurrentAccount(), currentUser); nameTextView.setText(UserObject.getUserName(currentUser)); + botVerificationIcon = DialogObject.getBotVerificationIcon(currentUser); if (currentUser != null && currentUser.verified) { rightDrawable.set(verifiedDrawable = (verifiedDrawable == null ? new VerifiedDrawable(getContext()) : verifiedDrawable), animated); } else if (currentUser != null && DialogObject.getEmojiStatusDocumentId(currentUser.emoji_status) != 0) { @@ -509,6 +516,7 @@ public void draw(@NonNull Canvas canvas) { currentUser = null; avatarDrawable.setInfo(accountInstance.getCurrentAccount(), currentChat); + botVerificationIcon = DialogObject.getBotVerificationIcon(currentChat); if (currentChat != null) { nameTextView.setText(currentChat.title); if (currentChat.verified) { @@ -529,6 +537,14 @@ public void draw(@NonNull Canvas canvas) { } } } + if (botVerificationIcon != 0) { + leftDrawable.set(botVerificationIcon, animated); + nameTextView.setLeftDrawable(leftDrawable); + leftDrawable.setColor(Theme.getColor(Theme.key_premiumGradient1)); + } else { + leftDrawable.set((Drawable) null, animated); + nameTextView.setLeftDrawable(null); + } applyParticipantChanges(animated); } @@ -544,6 +560,9 @@ protected void onAttachedToWindow() { if (rightDrawable != null) { rightDrawable.attach(); } + if (leftDrawable != null) { + leftDrawable.attach(); + } } public TLRPC.TL_groupCallParticipant getParticipant() { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/GroupCreateUserCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/GroupCreateUserCell.java index 3829fff55e..d993411878 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/GroupCreateUserCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/GroupCreateUserCell.java @@ -30,7 +30,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import org.checkerframework.checker.units.qual.A; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ChatObject; import org.telegram.messenger.Emoji; @@ -145,7 +144,7 @@ public GroupCreateUserCell(Context context, int checkBoxType, int pad, boolean s nameTextView = new SimpleTextView(context) { @Override public boolean setText(CharSequence value, boolean force) { - value = Emoji.replaceEmoji(value, getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false); + value = Emoji.replaceEmoji(value, getPaint().getFontMetricsInt(), false); return super.setText(value, force); } }; @@ -198,6 +197,7 @@ public void setPremium() { nameTextView.setText(LocaleController.getString(R.string.PrivacyPremium)); statusTextView.setTag(Theme.key_windowBackgroundWhiteGrayText); statusTextView.setTextColor(Theme.getColor(forceDarkTheme ? Theme.key_voipgroup_lastSeenText : Theme.key_windowBackgroundWhiteGrayText, resourcesProvider)); + statusTextView.setEmojiColor(statusTextView.getTextColor()); statusTextView.setText(LocaleController.getString(R.string.PrivacyPremiumText)); } @@ -208,6 +208,7 @@ public void setMiniapps() { nameTextView.setText(LocaleController.getString(R.string.PrivacyMiniapps)); statusTextView.setTag(Theme.key_windowBackgroundWhiteGrayText); statusTextView.setTextColor(Theme.getColor(forceDarkTheme ? Theme.key_voipgroup_lastSeenText : Theme.key_windowBackgroundWhiteGrayText, resourcesProvider)); + statusTextView.setEmojiColor(statusTextView.getTextColor()); statusTextView.setText(LocaleController.getString(R.string.PrivacyMiniappsText)); } @@ -466,6 +467,7 @@ public void update(int mask) { statusTextView.setText(LocaleController.formatUserStatus(currentAccount, currentUser)); } } + statusTextView.setEmojiColor(statusTextView.getTextColor()); } avatarImageView.setForUserOrChat(currentUser, avatarDrawable); @@ -505,6 +507,7 @@ public void update(int mask) { if (currentStatus == null) { statusTextView.setTag(Theme.key_windowBackgroundWhiteGrayText); statusTextView.setTextColor(Theme.getColor(forceDarkTheme ? Theme.key_voipgroup_lastSeenText : Theme.key_windowBackgroundWhiteGrayText)); + statusTextView.setEmojiColor(statusTextView.getTextColor()); if (currentChat.participants_count != 0) { if (ChatObject.isChannel(currentChat) && !currentChat.megagroup) { statusTextView.setText(LocaleController.formatPluralString("Subscribers", currentChat.participants_count)); @@ -537,6 +540,7 @@ public void update(int mask) { statusTextView.setText(currentStatus, true); statusTextView.setTag(Theme.key_windowBackgroundWhiteGrayText); statusTextView.setTextColor(Theme.getColor(forceDarkTheme ? Theme.key_voipgroup_lastSeenText : Theme.key_windowBackgroundWhiteGrayText, resourcesProvider)); + statusTextView.setEmojiColor(statusTextView.getTextColor()); } updatePremiumBlocked(false); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/HintDialogCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/HintDialogCell.java index f0a54875c8..d9235fdfa6 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/HintDialogCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/HintDialogCell.java @@ -83,7 +83,7 @@ public HintDialogCell(Context context, boolean drawCheckbox, Theme.ResourcesProv nameTextView = new TextView(context) { @Override public void setText(CharSequence text, BufferType type) { - text = Emoji.replaceEmoji(text, getPaint().getFontMetricsInt(), AndroidUtilities.dp(10), false); + text = Emoji.replaceEmoji(text, getPaint().getFontMetricsInt(), false); super.setText(text, type); } }; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ManageChatUserCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ManageChatUserCell.java index 760d3ebb87..37b100918e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ManageChatUserCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ManageChatUserCell.java @@ -272,7 +272,7 @@ public void update(int mask) { nameTextView.setText(currentName); } else { lastName = newName == null ? UserObject.getUserName(currentUser) : newName; - nameTextView.setText(Emoji.replaceEmoji(lastName, nameTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(15), false)); + nameTextView.setText(Emoji.replaceEmoji(lastName, nameTextView.getPaint().getFontMetricsInt(), false)); } if (currentStatus != null) { statusTextView.setTextColor(statusColor); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/MentionCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/MentionCell.java index 0b0535e2e1..2be5d39b83 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/MentionCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/MentionCell.java @@ -21,7 +21,6 @@ import org.telegram.messenger.ChatObject; import org.telegram.messenger.Emoji; import org.telegram.messenger.MediaDataController; -import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.UserConfig; import org.telegram.messenger.UserObject; import org.telegram.tgnet.TLRPC; @@ -241,7 +240,7 @@ public void setBotCommand(String command, String help, TLRPC.User user) { } usernameTextView.setVisibility(VISIBLE); nameTextView.setText(command); - usernameTextView.setText(Emoji.replaceEmoji(help, usernameTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false)); + usernameTextView.setText(Emoji.replaceEmoji(help, usernameTextView.getPaint().getFontMetricsInt(), false)); } public void setIsDarkTheme(boolean isDarkTheme) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ProfileSearchCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ProfileSearchCell.java index 755b80ee94..95d40595a6 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ProfileSearchCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ProfileSearchCell.java @@ -9,6 +9,7 @@ package org.telegram.ui.Cells; import static org.telegram.messenger.AndroidUtilities.dp; +import static org.telegram.messenger.LocaleController.getString; import android.content.Context; import android.graphics.Canvas; @@ -118,6 +119,7 @@ public class ProfileSearchCell extends BaseCell implements NotificationCenter.No private int statusLeft; private StaticLayout statusLayout; + private AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable botVerificationDrawable; private AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable statusDrawable; public StoriesUtilities.AvatarStoryParams avatarStoryParams = new StoriesUtilities.AvatarStoryParams(false); @@ -143,6 +145,9 @@ public ProfileSearchCell(Context context, Theme.ResourcesProvider resourcesProvi checkBox.setDrawBackgroundAsArc(3); addView(checkBox); + botVerificationDrawable = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(this, dp(20)); + botVerificationDrawable.setCallback(this); + statusDrawable = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(this, dp(20)); statusDrawable.setCallback(this); } @@ -169,7 +174,7 @@ public ProfileSearchCell useCustomPaints() { @Override protected boolean verifyDrawable(@NonNull Drawable who) { - return statusDrawable == who || super.verifyDrawable(who); + return statusDrawable == who || botVerificationDrawable == who || super.verifyDrawable(who); } public void setData(Object object, TLRPC.EncryptedChat ec, CharSequence n, CharSequence s, boolean needCount, boolean saved) { @@ -209,9 +214,9 @@ public void setData(Object object, TLRPC.EncryptedChat ec, CharSequence n, CharS public void setOpenBotButton(boolean show) { if (openBot == show) return; if (openButtonText == null) { - openButtonText = new Text(LocaleController.getString(R.string.BotOpen), 14, AndroidUtilities.bold()); + openButtonText = new Text(getString(R.string.BotOpen), 14, AndroidUtilities.bold()); } - int buttonWidth = show ? dp(14 + 14) + (int) openButtonText.getCurrentWidth() + dp(15 + 15) : 0; + final int buttonWidth = show ? (int) openButtonText.getCurrentWidth() + dp(15 + 15) : 0; setPadding(LocaleController.isRTL ? buttonWidth : 0, 0, LocaleController.isRTL ? 0 : buttonWidth, 0); openBot = show; openButtonBounce.setPressed(false); @@ -227,16 +232,16 @@ public void setException(NotificationsSettingsActivity.NotificationException exc delta -= ConnectionsManager.getInstance(currentAccount).getCurrentTime(); if (delta <= 0) { if (custom) { - text = LocaleController.getString(R.string.NotificationsCustom); + text = getString(R.string.NotificationsCustom); } else { - text = LocaleController.getString(R.string.NotificationsUnmuted); + text = getString(R.string.NotificationsUnmuted); } } else if (delta < 60 * 60) { - text = LocaleController.formatString("WillUnmuteIn", R.string.WillUnmuteIn, LocaleController.formatPluralString("Minutes", delta / 60)); + text = LocaleController.formatString(R.string.WillUnmuteIn, LocaleController.formatPluralString("Minutes", delta / 60)); } else if (delta < 60 * 60 * 24) { - text = LocaleController.formatString("WillUnmuteIn", R.string.WillUnmuteIn, LocaleController.formatPluralString("Hours", (int) Math.ceil(delta / 60.0f / 60))); + text = LocaleController.formatString(R.string.WillUnmuteIn, LocaleController.formatPluralString("Hours", (int) Math.ceil(delta / 60.0f / 60))); } else if (delta < 60 * 60 * 24 * 365) { - text = LocaleController.formatString("WillUnmuteIn", R.string.WillUnmuteIn, LocaleController.formatPluralString("Days", (int) Math.ceil(delta / 60.0f / 60 / 24))); + text = LocaleController.formatString(R.string.WillUnmuteIn, LocaleController.formatPluralString("Days", (int) Math.ceil(delta / 60.0f / 60 / 24))); } else { text = null; } @@ -251,13 +256,13 @@ public void setException(NotificationsSettingsActivity.NotificationException exc enabled = false; } if (enabled && custom) { - text = LocaleController.getString(R.string.NotificationsCustom); + text = getString(R.string.NotificationsCustom); } else { - text = enabled ? LocaleController.getString(R.string.NotificationsUnmuted) : LocaleController.getString(R.string.NotificationsMuted); + text = enabled ? getString(R.string.NotificationsUnmuted) : getString(R.string.NotificationsMuted); } } if (text == null) { - text = LocaleController.getString(R.string.NotificationsOff); + text = getString(R.string.NotificationsOff); } if (DialogObject.isEncryptedDialog(exception.did)) { @@ -290,6 +295,7 @@ protected void onDetachedFromWindow() { NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.userIsPremiumBlockedUpadted); } statusDrawable.detach(); + botVerificationDrawable.detach(); } @Override @@ -301,6 +307,7 @@ protected void onAttachedToWindow() { NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.userIsPremiumBlockedUpadted); } statusDrawable.attach(); + botVerificationDrawable.attach(); } @Override @@ -432,7 +439,7 @@ public void buildLayout() { if (user != null && user.phone != null && user.phone.length() != 0) { nameString = PhoneFormat.getInstance().format("+" + user.phone); } else { - nameString = LocaleController.getString(R.string.HiddenName); + nameString = getString(R.string.HiddenName); } } if (customPaints) { @@ -463,9 +470,9 @@ public void buildLayout() { nameWidth -= dp(6) + Theme.dialogs_lockDrawable.getIntrinsicWidth(); } if (contact != null) { - int w = (int) (Theme.dialogs_countTextPaint.measureText(LocaleController.getString(R.string.Invite)) + 1); + int w = (int) (Theme.dialogs_countTextPaint.measureText(getString(R.string.Invite)) + 1); - actionLayout = new StaticLayout(LocaleController.getString(R.string.Invite), Theme.dialogs_countTextPaint, w, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); + actionLayout = new StaticLayout(getString(R.string.Invite), Theme.dialogs_countTextPaint, w, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); if (!LocaleController.isRTL) { actionLeft = getMeasuredWidth() - w - dp(19) - dp(16); } else { @@ -506,12 +513,27 @@ public void buildLayout() { countLayout = null; } + if (!botVerificationDrawable.isEmpty()) { + if (LocaleController.isRTL) { + nameWidth -= botVerificationDrawable.getIntrinsicWidth(); + } else { + nameLeft += botVerificationDrawable.getIntrinsicWidth(); + } + } + if (!statusDrawable.isEmpty()) { + if (LocaleController.isRTL) { + nameLeft += statusDrawable.getIntrinsicWidth(); + } else { + nameWidth -= statusDrawable.getIntrinsicWidth(); + } + } + if (nameWidth < 0) { nameWidth = 0; } CharSequence nameStringFinal = TextUtils.ellipsize(nameString, currentNamePaint, nameWidth - dp(12), TextUtils.TruncateAt.END); if (nameStringFinal != null) { - nameStringFinal = Emoji.replaceEmoji(nameStringFinal, currentNamePaint.getFontMetricsInt(), dp(20), false); + nameStringFinal = Emoji.replaceEmoji(nameStringFinal, currentNamePaint.getFontMetricsInt(), false); } nameLayout = new StaticLayout(nameStringFinal, currentNamePaint, nameWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); @@ -522,15 +544,15 @@ public void buildLayout() { statusString = subLabel; } else if (user != null) { if (MessagesController.isSupportUser(user)) { - statusString = LocaleController.getString(R.string.SupportStatus); + statusString = getString(R.string.SupportStatus); } else if (user.bot && user.bot_active_users != 0) { statusString = LocaleController.formatPluralStringSpaced("BotUsersShort", user.bot_active_users); } else if (user.bot) { - statusString = LocaleController.getString(R.string.Bot); + statusString = getString(R.string.Bot); } else if (user.id == UserObject.VERIFY) { - statusString = LocaleController.getString(R.string.VerifyCodesNotifications); + statusString = getString(R.string.VerifyCodesNotifications); } else if (UserObject.isService(user.id)) { - statusString = LocaleController.getString(R.string.ServiceNotifications); + statusString = getString(R.string.ServiceNotifications); } else { if (isOnline == null) { isOnline = new boolean[1]; @@ -542,7 +564,7 @@ public void buildLayout() { } if (user != null && (user.id == UserConfig.getInstance(currentAccount).getClientUserId() || user.status != null && user.status.expires > ConnectionsManager.getInstance(currentAccount).getCurrentTime())) { currentStatusPaint = Theme.dialogs_onlinePaint; - statusString = LocaleController.getString(R.string.Online); + statusString = getString(R.string.Online); } } } @@ -556,9 +578,9 @@ public void buildLayout() { statusString = LocaleController.formatPluralStringComma("Subscribers", chat.participants_count); } else { if (!ChatObject.isPublic(chat)) { - statusString = LocaleController.getString(R.string.ChannelPrivate).toLowerCase(); + statusString = getString(R.string.ChannelPrivate).toLowerCase(); } else { - statusString = LocaleController.getString(R.string.ChannelPublic).toLowerCase(); + statusString = getString(R.string.ChannelPublic).toLowerCase(); } } } else { @@ -566,11 +588,11 @@ public void buildLayout() { statusString = LocaleController.formatPluralStringComma("Members", chat.participants_count); } else { if (chat.has_geo) { - statusString = LocaleController.getString(R.string.MegaLocation); + statusString = getString(R.string.MegaLocation); } else if (!ChatObject.isPublic(chat)) { - statusString = LocaleController.getString(R.string.MegaPrivate).toLowerCase(); + statusString = getString(R.string.MegaPrivate).toLowerCase(); } else { - statusString = LocaleController.getString(R.string.MegaPublic).toLowerCase(); + statusString = getString(R.string.MegaPublic).toLowerCase(); } } } @@ -672,6 +694,18 @@ public void updateStatus(boolean verified, TLRPC.User user, TLRPC.Chat chat, boo statusDrawable.set((Drawable) null, animated); statusDrawable.setColor(Theme.getColor(Theme.key_chats_verifiedBackground, resourcesProvider)); } + long botVerificationIcon = 0; + if (user != null) { + botVerificationIcon = DialogObject.getBotVerificationIcon(user); + } else if (chat != null) { + botVerificationIcon = DialogObject.getBotVerificationIcon(chat); + } + if (botVerificationIcon == 0) { + botVerificationDrawable.set((Drawable) null, animated); + } else { + botVerificationDrawable.set(botVerificationIcon, animated); + } + botVerificationDrawable.setColor(Theme.getColor(Theme.key_chats_verifiedBackground, resourcesProvider)); } private boolean rectangularAvatar; @@ -811,12 +845,25 @@ protected void onDraw(Canvas canvas) { } if (nameLayout != null) { + int x; + if (LocaleController.isRTL) { + x = (int) (nameLeft + nameLayout.getLineRight(0) + dp(6)); + } else { + if (nameLayout.getLineLeft(0) == 0) { + x = nameLeft - dp(3) - botVerificationDrawable.getIntrinsicWidth(); + } else { + float w = nameLayout.getLineWidth(0); + x = (int) (nameLeft + nameWidth - Math.ceil(w) - dp(3) - botVerificationDrawable.getIntrinsicWidth()); + } + } + setDrawableBounds(botVerificationDrawable, x, nameTop + (nameLayout.getHeight() - botVerificationDrawable.getIntrinsicHeight()) / 2f); + botVerificationDrawable.draw(canvas); + canvas.save(); canvas.translate(nameLeft, nameTop); nameLayout.draw(canvas); canvas.restore(); - int x; if (LocaleController.isRTL) { if (nameLayout.getLineLeft(0) == 0) { x = nameLeft - dp(3) - statusDrawable.getIntrinsicWidth(); @@ -839,7 +886,7 @@ protected void onDraw(Canvas canvas) { } if (countLayout != null) { - int x = countLeft - dp(5.5f); + final int x = countLeft - dp(5.5f); rect.set(x, countTop, x + countWidth + dp(11), countTop + dp(23)); canvas.drawRoundRect(rect, 11.5f * AndroidUtilities.density, 11.5f * AndroidUtilities.density, MessagesController.getInstance(currentAccount).isDialogMuted(dialog_id, 0) ? Theme.dialogs_countGrayPaint : Theme.dialogs_countPaint); canvas.save(); @@ -873,8 +920,8 @@ protected void onDraw(Canvas canvas) { final float lockT = premiumBlockedT.set(premiumBlocked); if (lockT > 0) { - float top = avatarImage.getCenterY() + dp(14); - float left = avatarImage.getCenterX() + dp(16); + final float top = avatarImage.getCenterY() + dp(14); + final float left = avatarImage.getCenterX() + dp(16); canvas.save(); Theme.dialogs_onlineCirclePaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhite, resourcesProvider)); @@ -927,7 +974,7 @@ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { builder.append(nameLayout.getText()); } if (drawCheck) { - builder.append(", ").append(LocaleController.getString(R.string.AccDescrVerified)).append("\n"); + builder.append(", ").append(getString(R.string.AccDescrVerified)).append("\n"); } if (statusLayout != null) { if (builder.length() > 0) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ReactedUserHolderView.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ReactedUserHolderView.java index 5190ca948a..bd1400cb40 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ReactedUserHolderView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ReactedUserHolderView.java @@ -126,7 +126,7 @@ public boolean onTouchEvent(MotionEvent event) { titleView = new SimpleTextView(context) { @Override public boolean setText(CharSequence value) { - value = Emoji.replaceEmoji(value, getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false); + value = Emoji.replaceEmoji(value, getPaint().getFontMetricsInt(), false); return super.setText(value); } }; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SessionCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SessionCell.java index 1142af15f8..dcd0a8c600 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SessionCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SessionCell.java @@ -380,7 +380,11 @@ public static CombinedDrawable createDrawable(int sz, TLRPC.TL_authorization ses Drawable iconDrawable = ContextCompat.getDrawable(ApplicationLoader.applicationContext, iconId).mutate(); iconDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_avatar_text), PorterDuff.Mode.SRC_IN)); Drawable bgDrawable = new CircleGradientDrawable(dp(sz), colorKey == -1 ? 0xFF000000 : Theme.getColor(colorKey), colorKey2 == -1 ? 0xFF000000 : Theme.getColor(colorKey2)); - return new CombinedDrawable(bgDrawable, iconDrawable); + CombinedDrawable drawable = new CombinedDrawable(bgDrawable, iconDrawable); + if (platform != null && platform.contains("fragment")) { + drawable.setIconSize((int) (iconDrawable.getIntrinsicWidth() / 44.0f * sz), (int) (iconDrawable.getIntrinsicHeight() / 44.0f * sz)); + } + return drawable; } public static class CircleGradientDrawable extends Drawable { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ShareDialogCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ShareDialogCell.java index 39376a22c3..5fd2505974 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ShareDialogCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ShareDialogCell.java @@ -10,7 +10,6 @@ import static org.telegram.messenger.AndroidUtilities.dp; -import android.app.Notification; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; @@ -68,13 +67,7 @@ public class ShareDialogCell extends FrameLayout implements NotificationCenter.N private final TextView nameTextView; private final SimpleTextView topicTextView; private final CheckBox2 checkBox; - private final AvatarDrawable avatarDrawable = new AvatarDrawable() { - @Override - public void invalidateSelf() { - super.invalidateSelf(); - imageView.invalidate(); - } - }; + private final AvatarDrawable avatarDrawable; private RepostStoryDrawable repostStoryDrawable; private TLRPC.User user; private final int currentType; @@ -89,7 +82,6 @@ public void invalidateSelf() { public final Theme.ResourcesProvider resourcesProvider; public static final int TYPE_SHARE = 0; - public static final int TYPE_CALL = 1; public static final int TYPE_CREATE = 2; private final AnimatedFloat premiumBlockedT = new AnimatedFloat(this, 0, 350, CubicBezierInterpolator.EASE_OUT_QUINT); @@ -107,6 +99,14 @@ public ShareDialogCell(Context context, int type, Theme.ResourcesProvider resour super(context); this.resourcesProvider = resourcesProvider; + avatarDrawable = new AvatarDrawable(resourcesProvider) { + @Override + public void invalidateSelf() { + super.invalidateSelf(); + imageView.invalidate(); + } + }; + setWillNotDraw(false); currentType = type; @@ -121,12 +121,12 @@ public ShareDialogCell(Context context, int type, Theme.ResourcesProvider resour nameTextView = new TextView(context) { @Override public void setText(CharSequence text, BufferType type) { - text = Emoji.replaceEmoji(text, getPaint().getFontMetricsInt(), dp(10), false); + text = Emoji.replaceEmoji(text, getPaint().getFontMetricsInt(), false); super.setText(text, type); } }; NotificationCenter.listenEmojiLoading(nameTextView); - nameTextView.setTextColor(getThemedColor(premiumBlocked ? Theme.key_windowBackgroundWhiteGrayText5 : currentType == TYPE_CALL ? Theme.key_voipgroup_nameText : Theme.key_dialogTextBlack)); + nameTextView.setTextColor(getThemedColor(premiumBlocked ? Theme.key_windowBackgroundWhiteGrayText5 : Theme.key_dialogTextBlack)); nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12); nameTextView.setMaxLines(2); nameTextView.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL); @@ -135,7 +135,7 @@ public void setText(CharSequence text, BufferType type) { addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 6, currentType == TYPE_CREATE ? 58 : 66, 6, 0)); topicTextView = new SimpleTextView(context); - topicTextView.setTextColor(getThemedColor(type == TYPE_CALL ? Theme.key_voipgroup_nameText : Theme.key_dialogTextBlack)); + topicTextView.setTextColor(getThemedColor(Theme.key_dialogTextBlack)); topicTextView.setTextSize(12); topicTextView.setMaxLines(2); topicTextView.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL); @@ -143,7 +143,7 @@ public void setText(CharSequence text, BufferType type) { addView(topicTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 6, currentType == TYPE_CREATE ? 58 : 66, 6, 0)); checkBox = new CheckBox2(context, 21, resourcesProvider); - checkBox.setColor(Theme.key_dialogRoundCheckBox, type == TYPE_CALL ? Theme.key_voipgroup_inviteMembersBackground : Theme.key_dialogBackground, Theme.key_dialogRoundCheckBoxCheck); + checkBox.setColor(Theme.key_dialogRoundCheckBox, Theme.key_dialogBackground, Theme.key_dialogRoundCheckBoxCheck); checkBox.setDrawUnchecked(false); checkBox.setDrawBackgroundAsArc(4); checkBox.setProgressDelegate(progress -> { @@ -174,7 +174,7 @@ public void didReceivedNotification(int id, int account, Object... args) { if (id == NotificationCenter.userIsPremiumBlockedUpadted) { final boolean wasPremiumBlocked = premiumBlocked; premiumBlocked = user != null && MessagesController.getInstance(currentAccount).isUserPremiumBlocked(user.id); - nameTextView.setTextColor(getThemedColor(premiumBlocked ? Theme.key_windowBackgroundWhiteGrayText5 : currentType == TYPE_CALL ? Theme.key_voipgroup_nameText : Theme.key_dialogTextBlack)); + nameTextView.setTextColor(getThemedColor(premiumBlocked ? Theme.key_windowBackgroundWhiteGrayText5 : Theme.key_dialogTextBlack)); if (premiumBlocked != wasPremiumBlocked) { invalidate(); } @@ -200,7 +200,7 @@ public void setDialog(long uid, boolean checked, CharSequence name) { } else if (DialogObject.isUserDialog(uid)) { user = MessagesController.getInstance(currentAccount).getUser(uid); premiumBlocked = MessagesController.getInstance(currentAccount).isUserPremiumBlocked(uid); - nameTextView.setTextColor(getThemedColor(premiumBlocked ? Theme.key_windowBackgroundWhiteGrayText5 : currentType == TYPE_CALL ? Theme.key_voipgroup_nameText : Theme.key_dialogTextBlack)); + nameTextView.setTextColor(getThemedColor(premiumBlocked ? Theme.key_windowBackgroundWhiteGrayText5 : Theme.key_dialogTextBlack)); premiumBlockedT.set(premiumBlocked, true); invalidate(); avatarDrawable.setInfo(currentAccount, user); @@ -325,7 +325,7 @@ protected boolean drawChild(Canvas canvas, View child, long drawingTime) { int left = imageView.getRight() - dp(9.33f); canvas.save(); - Theme.dialogs_onlineCirclePaint.setColor(getThemedColor(currentType == TYPE_CALL ? Theme.key_voipgroup_inviteMembersBackground : Theme.key_windowBackgroundWhite)); + Theme.dialogs_onlineCirclePaint.setColor(getThemedColor(Theme.key_windowBackgroundWhite)); canvas.drawCircle(left, top, dp(12) * lockT, Theme.dialogs_onlineCirclePaint); if (premiumGradient == null) { premiumGradient = new PremiumGradient.PremiumGradientTools(Theme.key_premiumGradient1, Theme.key_premiumGradient2, -1, -1, -1, resourcesProvider); @@ -350,7 +350,7 @@ protected boolean drawChild(Canvas canvas, View child, long drawingTime) { if (isOnline || onlineProgress != 0) { int top = imageView.getBottom() - dp(6); int left = imageView.getRight() - dp(10); - Theme.dialogs_onlineCirclePaint.setColor(getThemedColor(currentType == TYPE_CALL ? Theme.key_voipgroup_inviteMembersBackground : Theme.key_windowBackgroundWhite)); + Theme.dialogs_onlineCirclePaint.setColor(getThemedColor(Theme.key_windowBackgroundWhite)); canvas.drawCircle(left, top, dp(7) * onlineProgress, Theme.dialogs_onlineCirclePaint); Theme.dialogs_onlineCirclePaint.setColor(getThemedColor(Theme.key_chats_onlineCircle)); canvas.drawCircle(left, top, dp(5) * onlineProgress, Theme.dialogs_onlineCirclePaint); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedAudioCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedAudioCell.java index 10190888b1..efd1cad069 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedAudioCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedAudioCell.java @@ -187,7 +187,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { } if (currentMessageObject.hasHighlightedWords()) { - CharSequence caption = Emoji.replaceEmoji(currentMessageObject.messageOwner.message.replace("\n", " ").replaceAll(" +", " ").trim(), Theme.chat_msgTextPaint.getFontMetricsInt(), AndroidUtilities.dp(20), false); + CharSequence caption = Emoji.replaceEmoji(currentMessageObject.messageOwner.message.replace("\n", " ").replaceAll(" +", " ").trim(), Theme.chat_msgTextPaint.getFontMetricsInt(), false); CharSequence sequence = AndroidUtilities.highlightText(caption, currentMessageObject.highlightedWords, resourcesProvider); if (sequence != null) { sequence = TextUtils.ellipsize(AndroidUtilities.ellipsizeCenterEnd(sequence, currentMessageObject.highlightedWords.get(0), maxWidth, captionTextPaint, 130), captionTextPaint, maxWidth, TextUtils.TruncateAt.END); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedLinkCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedLinkCell.java index 21e91e70ce..54068dad58 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedLinkCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedLinkCell.java @@ -91,7 +91,9 @@ class CheckForLongPress implements Runnable { public void run() { if (checkingForLongPress && getParent() != null && currentPressCount == pressCount) { checkingForLongPress = false; - performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} if (pressedLinkIndex >= 0) { delegate.onLinkPress(links.get(pressedLinkIndex).toString(), true); } @@ -413,7 +415,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { } if (message != null && !TextUtils.isEmpty(message.messageOwner.message)) { - CharSequence caption = Emoji.replaceEmoji(message.messageOwner.message.replace("\n", " ").replaceAll(" +", " ").trim(), Theme.chat_msgTextPaint.getFontMetricsInt(), AndroidUtilities.dp(20), false); + CharSequence caption = Emoji.replaceEmoji(message.messageOwner.message.replace("\n", " ").replaceAll(" +", " ").trim(), Theme.chat_msgTextPaint.getFontMetricsInt(), false); CharSequence sequence = AndroidUtilities.highlightText(caption, message.highlightedWords, null); if (sequence != null) { sequence = TextUtils.ellipsize(AndroidUtilities.ellipsizeCenterEnd(sequence, message.highlightedWords.get(0), maxWidth, captionTextPaint, 130), captionTextPaint, maxWidth, TextUtils.TruncateAt.END); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedPhotoVideoCell2.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedPhotoVideoCell2.java index c467a27697..ec6224ea04 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedPhotoVideoCell2.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedPhotoVideoCell2.java @@ -116,7 +116,7 @@ public class SharedPhotoVideoCell2 extends FrameLayout { static boolean lastAutoDownload; private Path path = new Path(); - private SpoilerEffect mediaSpoilerEffect = new SpoilerEffect(); + private SpoilerEffect mediaSpoilerEffect; private float spoilerRevealProgress; private float spoilerRevealX; private float spoilerRevealY; @@ -546,6 +546,9 @@ protected void onDraw(Canvas canvas) { canvas.clipRect(imageReceiver.getImageX(), imageReceiver.getImageY(), imageReceiver.getImageX2(), imageReceiver.getImageY2()); mediaSpoilerEffect2.draw(canvas, this, (int) imageReceiver.getImageWidth(), (int) imageReceiver.getImageHeight()); } else { + if (mediaSpoilerEffect == null) { + mediaSpoilerEffect = new SpoilerEffect(); + } int sColor = Color.WHITE; mediaSpoilerEffect.setColor(ColorUtils.setAlphaComponent(sColor, (int) (Color.alpha(sColor) * 0.325f))); mediaSpoilerEffect.setBounds((int) imageReceiver.getImageX(), (int) imageReceiver.getImageY(), (int) imageReceiver.getImageX2(), (int) imageReceiver.getImageY2()); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/StickerEmojiCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/StickerEmojiCell.java index 4cb2d1910b..daca76ac5f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/StickerEmojiCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/StickerEmojiCell.java @@ -220,7 +220,7 @@ public void setSticker(TLRPC.Document document, SendMessagesHelper.ImportingStic imageView.setImage(null, null, null, null, DocumentObject.getSvgRectThumb(Theme.key_dialogBackgroundGray, 1.0f), 0, path.animated ? "tgs" : null, 0, 1); } if (emoji != null) { - emojiTextView.setText(Emoji.replaceEmoji(emoji, emojiTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(16), false)); + emojiTextView.setText(Emoji.replaceEmoji(emoji, emojiTextView.getPaint().getFontMetricsInt(), false)); emojiTextView.setVisibility(VISIBLE); } else { emojiTextView.setVisibility(INVISIBLE); @@ -262,7 +262,7 @@ public void setSticker(TLRPC.Document document, SendMessagesHelper.ImportingStic } if (emoji != null) { - emojiTextView.setText(Emoji.replaceEmoji(emoji, emojiTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(16), false)); + emojiTextView.setText(Emoji.replaceEmoji(emoji, emojiTextView.getPaint().getFontMetricsInt(), false)); emojiTextView.setVisibility(VISIBLE); } else if (showEmoji) { boolean set = false; @@ -270,14 +270,14 @@ public void setSticker(TLRPC.Document document, SendMessagesHelper.ImportingStic TLRPC.DocumentAttribute attribute = document.attributes.get(a); if (attribute instanceof TLRPC.TL_documentAttributeSticker) { if (attribute.alt != null && attribute.alt.length() > 0) { - emojiTextView.setText(Emoji.replaceEmoji(attribute.alt, emojiTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(16), false)); + emojiTextView.setText(Emoji.replaceEmoji(attribute.alt, emojiTextView.getPaint().getFontMetricsInt(), false)); set = true; } break; } } if (!set) { - emojiTextView.setText(Emoji.replaceEmoji(MediaDataController.getInstance(currentAccount).getEmojiForSticker(sticker.id), emojiTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(16), false)); + emojiTextView.setText(Emoji.replaceEmoji(MediaDataController.getInstance(currentAccount).getEmojiForSticker(sticker.id), emojiTextView.getPaint().getFontMetricsInt(), false)); } emojiTextView.setVisibility(VISIBLE); } else { @@ -366,7 +366,7 @@ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { TLRPC.DocumentAttribute attribute = sticker.attributes.get(a); if (attribute instanceof TLRPC.TL_documentAttributeSticker) { if (attribute.alt != null && attribute.alt.length() > 0) { - emojiTextView.setText(Emoji.replaceEmoji(attribute.alt, emojiTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(16), false)); + emojiTextView.setText(Emoji.replaceEmoji(attribute.alt, emojiTextView.getPaint().getFontMetricsInt(), false)); descr = attribute.alt + " " + descr; } break; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/StickerSetCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/StickerSetCell.java index 818dfa5f70..154e9757bc 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/StickerSetCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/StickerSetCell.java @@ -184,7 +184,7 @@ public StickerSetCell(Context context, Theme.ResourcesProvider resourcesProvider textView = new TextView(context) { @Override public void setText(CharSequence text, BufferType type) { - text = Emoji.replaceEmoji(text, getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false); + text = Emoji.replaceEmoji(text, getPaint().getFontMetricsInt(), false); super.setText(text, type); } }; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/StickerSetNameCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/StickerSetNameCell.java index 00ef52420e..d83ee1e3dc 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/StickerSetNameCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/StickerSetNameCell.java @@ -183,7 +183,7 @@ public void setText(CharSequence text, int resId, CharSequence iconAccDescr, int if (searchLength != 0) { updateTextSearchSpan(); } else { - textView.setText(Emoji.replaceEmoji(text, textView.getPaint().getFontMetricsInt(), dp(14), false)); + textView.setText(Emoji.replaceEmoji(text, textView.getPaint().getFontMetricsInt(), false)); } if (resId != 0) { buttonView.setImageResource(resId); @@ -213,7 +213,7 @@ private void updateTextSearchSpan() { builder.setSpan(new ForegroundColorSpan(getThemedColor(Theme.key_chat_emojiPanelStickerSetNameHighlight)), stickerSetNameSearchIndex, stickerSetNameSearchIndex + stickerSetNameSearchLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } catch (Exception ignore) { } - textView.setText(Emoji.replaceEmoji(builder, textView.getPaint().getFontMetricsInt(), dp(14), false)); + textView.setText(Emoji.replaceEmoji(builder, textView.getPaint().getFontMetricsInt(), false)); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextDetailCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextDetailCell.java index 3b471b9149..e7d938c68b 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextDetailCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextDetailCell.java @@ -14,9 +14,7 @@ import android.graphics.Canvas; import android.graphics.Color; import android.graphics.drawable.Drawable; -import android.text.Spannable; import android.text.TextUtils; -import android.text.style.ClickableSpan; import android.util.TypedValue; import android.view.Gravity; import android.view.HapticFeedbackConstants; @@ -27,11 +25,9 @@ import android.widget.ImageView; import android.widget.TextView; -import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.Emoji; import org.telegram.messenger.LocaleController; import org.telegram.ui.ActionBar.Theme; -import org.telegram.ui.Components.AnimatedEmojiSpan; import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.LinkSpanDrawable; @@ -199,7 +195,7 @@ public void setImageClickListener(View.OnClickListener clickListener) { } public void setTextWithEmojiAndValue(CharSequence text, CharSequence value, boolean divider) { - textView.setText(Emoji.replaceEmoji(text, textView.getPaint().getFontMetricsInt(), dp(14), false)); + textView.setText(Emoji.replaceEmoji(text, textView.getPaint().getFontMetricsInt(), false)); valueTextView.setText(value); needDivider = divider; setWillNotDraw(!divider); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextDetailSettingsCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextDetailSettingsCell.java index 1ac0e41227..48d278b1da 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextDetailSettingsCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextDetailSettingsCell.java @@ -119,7 +119,7 @@ public void setValue(CharSequence value) { } public void setTextWithEmojiAnd21Value(String text, CharSequence value, boolean divider) { - textView.setText(Emoji.replaceEmoji(text, textView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false)); + textView.setText(Emoji.replaceEmoji(text, textView.getPaint().getFontMetricsInt(), false)); valueTextView.setText(value); needDivider = divider; setWillNotDraw(!divider); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextInfoPrivacyCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextInfoPrivacyCell.java index fd92d4ce38..747d7a9daa 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextInfoPrivacyCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextInfoPrivacyCell.java @@ -33,9 +33,10 @@ public class TextInfoPrivacyCell extends FrameLayout { - private TextView textView; + private LinkSpanDrawable.LinksTextView textView; private LinkSpanDrawable.LinkCollector links; private int linkTextColorKey = Theme.key_windowBackgroundWhiteLinkText; + private Integer linkTextRippleColor; private int topPadding = 10; private int bottomPadding = 17; private int fixedSize; @@ -67,12 +68,21 @@ protected void onDraw(Canvas canvas) { super.onDraw(canvas); afterTextDraw(); } + + @Override + public int overrideColor() { + if (linkTextRippleColor != null) { + return linkTextRippleColor; + } + return super.overrideColor(); + } }; textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); textView.setPadding(0, AndroidUtilities.dp(10), 0, AndroidUtilities.dp(17)); textView.setMovementMethod(LinkMovementMethod.getInstance()); textView.setTextColor(getThemedColor(Theme.key_windowBackgroundWhiteGrayText4)); + textView.setEmojiColor(getThemedColor(Theme.key_windowBackgroundWhiteGrayText4)); textView.setLinkTextColor(getThemedColor(linkTextColorKey)); textView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, padding, 0, padding, 0)); @@ -178,10 +188,14 @@ public void setTextColorByKey(int key) { textView.setTag(key); } - public TextView getTextView() { + public LinkSpanDrawable.LinksTextView getTextView() { return textView; } + public void setLinkTextRippleColor(Integer color) { + linkTextRippleColor = color; + } + public int length() { return textView.length(); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextSelectionHelper.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextSelectionHelper.java index 83abe42196..56c7a1f272 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextSelectionHelper.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/TextSelectionHelper.java @@ -272,7 +272,9 @@ public void run() { textY = maybeTextY; selectedView = newView; - textSelectionOverlay.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); + try { + textSelectionOverlay.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); + } catch (Exception ignored) {} AndroidUtilities.cancelRunOnUIThread(showActionsRunnable); AndroidUtilities.runOnUIThread(showActionsRunnable); showHandleViews(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ThemesHorizontalListCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ThemesHorizontalListCell.java index cf6e0fc44a..8a37e438e3 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ThemesHorizontalListCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ThemesHorizontalListCell.java @@ -47,6 +47,7 @@ import org.telegram.messenger.Utilities; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.EmojiThemes; import org.telegram.ui.ActionBar.Theme; @@ -196,7 +197,9 @@ public boolean onTouchEvent(MotionEvent event) { if (action == MotionEvent.ACTION_DOWN) { pressed = true; } else { - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} showOptionsForTheme(themeInfo); } } @@ -333,7 +336,7 @@ private boolean parseTheme() { if (!file.exists()) { if (!loadingWallpapers.containsKey(themeInfo)) { loadingWallpapers.put(themeInfo, themeInfo.slug); - TLRPC.TL_account_getWallPaper req = new TLRPC.TL_account_getWallPaper(); + TL_account.getWallPaper req = new TL_account.getWallPaper(); TLRPC.TL_inputWallPaperSlug inputWallPaperSlug = new TLRPC.TL_inputWallPaperSlug(); inputWallPaperSlug.slug = themeInfo.slug; req.wallpaper = inputWallPaperSlug; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/UserCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/UserCell.java index 4471148764..45b495b544 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/UserCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/UserCell.java @@ -69,7 +69,8 @@ public class UserCell extends FrameLayout implements NotificationCenter.Notifica private TextView adminTextView; private TextView addButton; private Drawable premiumDrawable; - private AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable emojiStatus; + private final AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable botVerification; + private final AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable emojiStatus; private ImageView closeView; protected Theme.ResourcesProvider resourcesProvider; @@ -179,6 +180,7 @@ public boolean onTouchEvent(MotionEvent event) { nameTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP); addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 20, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 28 + (checkbox == 2 ? 18 : 0) + additionalPadding : (64 + padding), 10, LocaleController.isRTL ? (64 + padding) : 28 + (checkbox == 2 ? 18 : 0) + additionalPadding, 0)); + botVerification = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(nameTextView, dp(20)); emojiStatus = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(nameTextView, dp(20)); statusTextView = new SimpleTextView(context); @@ -296,7 +298,7 @@ public void setData(Object object, TLRPC.EncryptedChat ec, CharSequence name, Ch currentStatus = status; try { if (name != null && nameTextView != null) { - name = Emoji.replaceEmoji(name, nameTextView.getPaint().getFontMetricsInt(), dp(18), false); + name = Emoji.replaceEmoji(name, nameTextView.getPaint().getFontMetricsInt(), false); } } catch (Exception ignore) {} currentName = name; @@ -565,18 +567,28 @@ public void update(int mask) { CharSequence name = lastName; if (name != null) { try { - name = Emoji.replaceEmoji(lastName, nameTextView.getPaint().getFontMetricsInt(), dp(18), false); + name = Emoji.replaceEmoji(lastName, nameTextView.getPaint().getFontMetricsInt(), false); } catch (Exception ignore) {} } nameTextView.setText(name); } + long botVerificationIcon = 0; + if (currentUser != null) { + botVerificationIcon = DialogObject.getBotVerificationIcon(currentUser); + } else if (currentChat != null) { + botVerificationIcon = DialogObject.getBotVerificationIcon(currentChat); + } + if (botVerificationIcon == 0) { + botVerification.set((Drawable) null, false); + nameTextView.setLeftDrawable(null); + } else { + botVerification.set(botVerificationIcon, false); + botVerification.setColor(Theme.getColor(Theme.key_chats_verifiedBackground, resourcesProvider)); + nameTextView.setLeftDrawable(botVerification); + } if (currentUser != null && MessagesController.getInstance(currentAccount).isPremiumUser(currentUser) && !MessagesController.getInstance(currentAccount).premiumFeaturesBlocked()) { - if (currentUser.emoji_status instanceof TLRPC.TL_emojiStatusUntil && ((TLRPC.TL_emojiStatusUntil) currentUser.emoji_status).until > (int) (System.currentTimeMillis() / 1000)) { - emojiStatus.set(((TLRPC.TL_emojiStatusUntil) currentUser.emoji_status).document_id, false); - emojiStatus.setColor(Theme.getColor(Theme.key_chats_verifiedBackground, resourcesProvider)); - nameTextView.setRightDrawable(emojiStatus); - } else if (currentUser.emoji_status instanceof TLRPC.TL_emojiStatus) { - emojiStatus.set(((TLRPC.TL_emojiStatus) currentUser.emoji_status).document_id, false); + if (DialogObject.getEmojiStatusDocumentId(currentUser.emoji_status) != 0) { + emojiStatus.set(DialogObject.getEmojiStatusDocumentId(currentUser.emoji_status), false); emojiStatus.setColor(Theme.getColor(Theme.key_chats_verifiedBackground, resourcesProvider)); nameTextView.setRightDrawable(emojiStatus); } else { @@ -686,6 +698,7 @@ protected void onAttachedToWindow() { super.onAttachedToWindow(); NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiLoaded); emojiStatus.attach(); + botVerification.attach(); } @Override @@ -693,6 +706,7 @@ protected void onDetachedFromWindow() { super.onDetachedFromWindow(); NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiLoaded); emojiStatus.detach(); + botVerification.detach(); storyParams.onDetachFromWindow(); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/UserCell2.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/UserCell2.java index 3902fa6111..1bf5102246 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/UserCell2.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/UserCell2.java @@ -83,7 +83,7 @@ public UserCell2(Context context, int padding, int checkbox, Theme.ResourcesProv nameTextView = new SimpleTextView(context) { @Override public boolean setText(CharSequence value) { - value = Emoji.replaceEmoji(value, getPaint().getFontMetricsInt(), AndroidUtilities.dp(15), false); + value = Emoji.replaceEmoji(value, getPaint().getFontMetricsInt(), false); return super.setText(value); } }; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChangeBioActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChangeBioActivity.java index 63797b5824..48188d52ac 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChangeBioActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChangeBioActivity.java @@ -35,6 +35,7 @@ import org.telegram.messenger.UserConfig; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenu; import org.telegram.ui.ActionBar.AlertDialog; @@ -210,7 +211,7 @@ private void saveName() { final AlertDialog progressDialog = new AlertDialog(getParentActivity(), AlertDialog.ALERT_TYPE_SPINNER); - final TLRPC.TL_account_updateProfile req = new TLRPC.TL_account_updateProfile(); + final TL_account.updateProfile req = new TL_account.updateProfile(); req.about = newName; req.flags |= 4; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChangeNameActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChangeNameActivity.java index 0042aaed16..1ba26f5ce9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChangeNameActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChangeNameActivity.java @@ -26,6 +26,7 @@ import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; import org.telegram.messenger.UserConfig; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenu; import org.telegram.ui.ActionBar.BaseFragment; @@ -177,7 +178,7 @@ private void saveName() { if (currentUser.first_name != null && currentUser.first_name.equals(newFirst) && currentUser.last_name != null && currentUser.last_name.equals(newLast)) { return; } - TLRPC.TL_account_updateProfile req = new TLRPC.TL_account_updateProfile(); + TL_account.updateProfile req = new TL_account.updateProfile(); req.flags = 3; currentUser.first_name = req.first_name = newFirst; currentUser.last_name = req.last_name = newLast; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChangeUsernameActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChangeUsernameActivity.java index 49d4eee860..a57a2f16f4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChangeUsernameActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChangeUsernameActivity.java @@ -66,6 +66,7 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.tgnet.tl.TL_bots; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenu; @@ -312,7 +313,7 @@ public void onItemClick(View view, int position) { boolean reqActive = !username.active; TLObject req; if (botId == 0) { - TLRPC.TL_account_toggleUsername toggle = new TLRPC.TL_account_toggleUsername(); + TL_account.toggleUsername toggle = new TL_account.toggleUsername(); toggle.username = reqUsername; toggle.active = reqActive; req = toggle; @@ -612,7 +613,7 @@ private void sendReorder() { TLObject req; if (botId == 0) { - TLRPC.TL_account_reorderUsernames reorder = new TLRPC.TL_account_reorderUsernames(); + TL_account.reorderUsernames reorder = new TL_account.reorderUsernames(); reorder.order = usernames; req = reorder; } else { @@ -1296,7 +1297,7 @@ private boolean checkUserName(String name, boolean alert) { lastCheckName = name; final String nameFinal = name; checkRunnable = () -> { - TLRPC.TL_account_checkUsername req = new TLRPC.TL_account_checkUsername(); + TL_account.checkUsername req = new TL_account.checkUsername(); req.username = nameFinal; checkReqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { checkReqId = 0; @@ -1371,7 +1372,7 @@ private void saveName() { final AlertDialog progressDialog = new AlertDialog(getParentActivity(), AlertDialog.ALERT_TYPE_SPINNER); - final TLRPC.TL_account_updateUsername req = new TLRPC.TL_account_updateUsername(); + final TL_account.updateUsername req = new TL_account.updateUsername(); req.username = username; NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_NAME); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java index b472cb56fc..f4d5d7587c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java @@ -102,6 +102,7 @@ import org.telegram.messenger.browser.Browser; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenu; import org.telegram.ui.ActionBar.ActionBarMenuItem; @@ -253,7 +254,7 @@ public class ChannelAdminLogActivity extends BaseFragment implements Notificatio private PhotoViewer.PhotoViewerProvider provider = new PhotoViewer.EmptyPhotoViewerProvider() { @Override - public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { + public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview, boolean closing) { int count = chatListView.getChildCount(); for (int a = 0; a < count; a++) { @@ -2427,8 +2428,8 @@ private void loadAntispamUser(long userId) { inputUser.user_id = userId; req.id.add(inputUser); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> { - if (res instanceof TLRPC.Vector) { - ArrayList objects = ((TLRPC.Vector) res).objects; + if (res instanceof Vector) { + ArrayList objects = ((Vector) res).objects; ArrayList users = new ArrayList<>(); for (int i = 0; i < objects.size(); ++i) { if (objects.get(i) instanceof TLRPC.User) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChannelColorActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChannelColorActivity.java index 8c82a94b8b..5872d01f26 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChannelColorActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChannelColorActivity.java @@ -2,6 +2,7 @@ import static org.telegram.messenger.AndroidUtilities.dp; import static org.telegram.messenger.AndroidUtilities.dpf2; +import static org.telegram.messenger.LocaleController.getString; import static org.telegram.ui.Components.Premium.LimitReachedBottomSheet.TYPE_BOOSTS_FOR_CUSTOM_EMOJI_PACK; import android.animation.Animator; @@ -61,6 +62,8 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.ResultCallback; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; +import org.telegram.tgnet.tl.TL_stars; import org.telegram.tgnet.tl.TL_stories; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenuItem; @@ -71,6 +74,7 @@ import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.ActionBar.ThemeColors; import org.telegram.ui.Cells.ChatMessageCell; +import org.telegram.ui.Cells.HeaderCell; import org.telegram.ui.Cells.TextCell; import org.telegram.ui.Cells.TextInfoPrivacyCell; import org.telegram.ui.Cells.ThemePreviewMessagesCell; @@ -170,7 +174,7 @@ protected int getEmojiStickersLevelMin() { private SpannableStringBuilder lock; public void updateButton(boolean animated) { - if (boostsStatus == null) { + if (button == null || boostsStatus == null) { return; } int minLevel = minLevelRequired(); @@ -253,21 +257,24 @@ public void toggle() { @Override public boolean onFragmentCreate() { getMediaDataController().loadRestrictedStatusEmojis(); - NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.boostByChannelCreated); - NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.chatWasBoostedByUser); + getNotificationCenter().addObserver(this, NotificationCenter.boostByChannelCreated); + getNotificationCenter().addObserver(this, NotificationCenter.chatWasBoostedByUser); + getNotificationCenter().addObserver(this, NotificationCenter.dialogDeleted); return super.onFragmentCreate(); } @Override public void onFragmentDestroy() { super.onFragmentDestroy(); - NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.boostByChannelCreated); - NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.chatWasBoostedByUser); + getNotificationCenter().removeObserver(this, NotificationCenter.boostByChannelCreated); + getNotificationCenter().removeObserver(this, NotificationCenter.chatWasBoostedByUser); + getNotificationCenter().removeObserver(this, NotificationCenter.dialogDeleted); } public ChannelColorActivity(long dialogId) { super(); this.dialogId = dialogId; + TLRPC.Chat chat = getMessagesController().getChat(-dialogId); if (chat != null) { currentLevel = chat.level; @@ -305,6 +312,7 @@ public void setResourceProvider(Theme.ResourcesProvider resourceProvider) { protected RecyclerListView listView; protected Adapter adapter; + protected GridLayoutManager layoutManager; protected FrameLayout buttonContainer; protected ButtonWithCounterView button; @@ -373,6 +381,7 @@ public void onItemClick(int id) { updateRows(); createListView(); listView.setAdapter(adapter = new Adapter()); + layoutManager = new GridLayoutManager(context, 3); listView.setLayoutManager(new LinearLayoutManager(context)); listView.setBackgroundColor(getThemedColor(Theme.key_windowBackgroundGray)); contentView.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL, 0, 0, 0, 68)); @@ -391,7 +400,11 @@ public void onItemClick(int id) { } else if (position == profileEmojiRow) { selectedEmojiId = selectedProfileEmoji; } else if (position == statusEmojiRow) { - selectedEmojiId = DialogObject.getEmojiStatusDocumentId(selectedStatusEmoji); + if (selectedStatusEmoji instanceof TLRPC.TL_emojiStatusCollectible) { + selectedEmojiId = ((TLRPC.TL_emojiStatusCollectible) selectedStatusEmoji).collectible_id; + } else { + selectedEmojiId = DialogObject.getEmojiStatusDocumentId(selectedStatusEmoji); + } } if (position == packEmojiRow) { final int requiredLvl = getEmojiStickersLevelMin(); @@ -404,7 +417,8 @@ public void onItemClick(int id) { presentFragment(fragment); return; } - showSelectStatusDialog((EmojiCell) view, selectedEmojiId, position == statusEmojiRow, (documentId, until) -> { + final EmojiCell cell = (EmojiCell) view; + showSelectStatusDialog(cell, selectedEmojiId, position == statusEmojiRow, (documentId, until, gift) -> { if (position == replyEmojiRow) { selectedReplyEmoji = documentId; updateMessagesPreview(true); @@ -414,24 +428,35 @@ public void onItemClick(int id) { } else if (position == statusEmojiRow) { if (documentId == 0) { selectedStatusEmoji = null; + } else if (gift != null) { + final TLRPC.TL_emojiStatusCollectible status = MessagesController.emojiStatusCollectibleFromGift(gift); + if (until != null) { + status.flags |= 1; + status.until = until; + } + selectedStatusEmoji = status; + selectedProfileColor = -1; + selectedProfileEmoji = 0; } else { + final TLRPC.TL_emojiStatus status = new TLRPC.TL_emojiStatus(); + status.document_id = documentId; if (until != null) { - selectedStatusEmoji = new TLRPC.TL_emojiStatusUntil(); - ((TLRPC.TL_emojiStatusUntil) selectedStatusEmoji).until = until; - ((TLRPC.TL_emojiStatusUntil) selectedStatusEmoji).document_id = documentId; - } else { - selectedStatusEmoji = new TLRPC.TL_emojiStatus(); - ((TLRPC.TL_emojiStatus) selectedStatusEmoji).document_id = documentId; + status.flags |= 1; + status.until = until; } + selectedStatusEmoji = status; } updateProfilePreview(true); } updateButton(true); - ((EmojiCell) view).setEmoji(documentId, true); - }); + ((EmojiCell) view).setEmoji(documentId, gift != null, true); + }, selectedStatusEmoji instanceof TLRPC.TL_emojiStatusCollectible ? Theme.getColor(Theme.key_windowBackgroundWhiteBlueIcon, resourceProvider) : cell.getColor()); } else if (position == removeProfileColorRow) { selectedProfileColor = -1; selectedProfileEmoji = 0; + if (selectedStatusEmoji instanceof TLRPC.TL_emojiStatusCollectible) { + selectedStatusEmoji = null; + } updateProfilePreview(true); updateButton(true); updateRows(); @@ -491,6 +516,17 @@ public int getBottomOffset(int tag) { return fragmentView = contentView; } + public boolean seesLoading() { + if (listView == null) return false; + for (int i = 0; i < listView.getChildCount(); ++i) { + View child = listView.getChildAt(i); + if (child instanceof FlickerLoadingView) { + return true; + } + } + return false; + } + @Override public boolean onBackPressed() { if (currentLevel >= minLevelRequired() && hasUnsavedChanged()) { @@ -680,6 +716,15 @@ private void buttonClick() { req.emoji_status = new TLRPC.TL_emojiStatusEmpty(); channel.emoji_status = new TLRPC.TL_emojiStatusEmpty(); channel.flags2 &=~ 512; + } else if (selectedStatusEmoji instanceof TLRPC.TL_emojiStatusCollectible) { + final TLRPC.TL_emojiStatusCollectible valueStatus = (TLRPC.TL_emojiStatusCollectible) selectedStatusEmoji; + final TLRPC.TL_inputEmojiStatusCollectible status = new TLRPC.TL_inputEmojiStatusCollectible(); + status.collectible_id = valueStatus.collectible_id; + status.flags = valueStatus.flags; + status.until = valueStatus.until; + req.emoji_status = status; + channel.emoji_status = selectedStatusEmoji; + channel.flags |= 512; } else { req.emoji_status = selectedStatusEmoji; channel.emoji_status = selectedStatusEmoji; @@ -735,7 +780,11 @@ private void showLimit() { type = LimitReachedBottomSheet.TYPE_BOOSTS_FOR_PROFILE_ICON; } if (!DialogObject.emojiStatusesEqual(currentStatusEmoji, selectedStatusEmoji) && getEmojiStatusLevelMin() > currentLevel) { - type = LimitReachedBottomSheet.TYPE_BOOSTS_FOR_EMOJI_STATUS; + if (selectedStatusEmoji instanceof TLRPC.TL_emojiStatusCollectible) { + type = LimitReachedBottomSheet.TYPE_BOOSTS_FOR_WEAR_COLLECTIBLE; + } else { + type = LimitReachedBottomSheet.TYPE_BOOSTS_FOR_EMOJI_STATUS; + } } if (!ChatThemeController.wallpaperEquals(currentWallpaper, selectedWallpaper)) { if (!TextUtils.isEmpty(ChatThemeController.getWallpaperEmoticon(selectedWallpaper))) { @@ -785,7 +834,7 @@ private void showUnsavedAlert() { } private SelectAnimatedEmojiDialog.SelectAnimatedEmojiDialogWindow selectAnimatedEmojiDialog; - public void showSelectStatusDialog(EmojiCell cell, long documentId, boolean emojiStatus, Utilities.Callback2 onSet) { + public void showSelectStatusDialog(EmojiCell cell, long documentId, boolean emojiStatus, Utilities.Callback3 onSet, int accentColor) { if (selectAnimatedEmojiDialog != null || cell == null) { return; } @@ -819,11 +868,11 @@ public void showSelectStatusDialog(EmojiCell cell, long documentId, boolean emoj } else { type = down ? SelectAnimatedEmojiDialog.TYPE_SET_REPLY_ICON : SelectAnimatedEmojiDialog.TYPE_SET_REPLY_ICON_BOTTOM; } - SelectAnimatedEmojiDialog popupLayout = new SelectAnimatedEmojiDialog(ChannelColorActivity.this, getContext(), true, xoff, type, true, getResourceProvider(), down ? 24 : 16, cell.getColor()) { + SelectAnimatedEmojiDialog popupLayout = new SelectAnimatedEmojiDialog(ChannelColorActivity.this, getContext(), true, xoff, type, true, getResourceProvider(), down ? 24 : 16, accentColor) { @Override - protected void onEmojiSelected(View emojiView, Long documentId, TLRPC.Document document, Integer until) { + protected void onEmojiSelected(View emojiView, Long documentId, TLRPC.Document document, TL_stars.TL_starGiftUnique gift, Integer until) { if (onSet != null) { - onSet.run(documentId == null ? 0 : documentId, until); + onSet.run(documentId == null ? 0 : documentId, until, gift); } if (popup[0] != null) { selectAnimatedEmojiDialog = null; @@ -831,6 +880,11 @@ protected void onEmojiSelected(View emojiView, Long documentId, TLRPC.Document d } } + @Override + public long getDialogId() { + return dialogId; + } + @Override protected float getScrimDrawableTranslationY() { return 0; @@ -859,6 +913,9 @@ public void dismiss() { private static final int VIEW_TYPE_BUTTON = 5; private static final int VIEW_TYPE_BUTTON_EMOJI = 6; private static final int VIEW_TYPE_SHADOW = 7; + private static final int VIEW_TYPE_HEADER = 8; + private static final int VIEW_TYPE_GIFT = 9; + private static final int VIEW_TYPE_GIFT_FLICKER = 10; protected int rowsCount = 0; @@ -900,7 +957,7 @@ protected void updateRows() { profilePreviewRow = rowsCount++; profileColorGridRow = rowsCount++; profileEmojiRow = rowsCount++; - if (selectedProfileEmoji != 0 || selectedProfileColor >= 0) { + if (selectedProfileEmoji != 0 || selectedProfileColor >= 0 || selectedStatusEmoji instanceof TLRPC.TL_emojiStatusCollectible) { boolean wasButton = removeProfileColorRow >= 0; removeProfileColorRow = rowsCount++; if (!wasButton && adapter != null) { @@ -1041,6 +1098,9 @@ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int gridCell.setDivider(false); gridCell.setOnColorClick(color -> { selectedProfileColor = color; + if (selectedStatusEmoji instanceof TLRPC.TL_emojiStatusCollectible) { + selectedStatusEmoji = null; + } updateButton(true); updateProfilePreview(true); }); @@ -1048,6 +1108,18 @@ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int view = gridCell; } else if (viewType == VIEW_TYPE_PROFILE_PREVIEW) { view = new ProfilePreview(getContext()); + } else if (viewType == VIEW_TYPE_HEADER) { + HeaderCell headerCell = new HeaderCell(getContext(), resourceProvider); + headerCell.setBackgroundColor(getThemedColor(Theme.key_windowBackgroundWhite)); + view = headerCell; + } else if (viewType == VIEW_TYPE_GIFT) { + PeerColorActivity.GiftCell giftCell = new PeerColorActivity.GiftCell(getContext(), resourceProvider); + view = giftCell; + } else if (viewType == VIEW_TYPE_GIFT_FLICKER) { + FlickerLoadingView flickerLoadingView = new FlickerLoadingView(getContext(), resourceProvider); + flickerLoadingView.setIsSingleCell(true); + flickerLoadingView.setViewType(FlickerLoadingView.STAR_GIFT_SELECT); + view = flickerLoadingView; } else { view = new TextInfoPrivacyCell(getContext()); } @@ -1081,7 +1153,7 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi } else { emojiCell.setLockLevel(0); } - emojiCell.setEmoji(selectedReplyEmoji, false); + emojiCell.setEmoji(selectedReplyEmoji, false, false); } else if (position == profileEmojiRow) { emojiCell.setAdaptiveEmojiColor(currentAccount, selectedProfileColor, false); emojiCell.setText(LocaleController.getString(R.string.ChannelProfileLogo)); @@ -1091,7 +1163,7 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi } else { emojiCell.setLockLevel(0); } - emojiCell.setEmoji(selectedProfileEmoji, false); + emojiCell.setEmoji(selectedProfileEmoji, false, false); } else if (position == statusEmojiRow) { emojiCell.setAdaptiveEmojiColor(currentAccount, selectedProfileColor, false); emojiCell.setText(LocaleController.getString(getEmojiStatusStrRes())); @@ -1100,7 +1172,7 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi } else { emojiCell.setLockLevel(0); } - emojiCell.setEmoji(DialogObject.getEmojiStatusDocumentId(selectedStatusEmoji), false); + emojiCell.setEmoji(DialogObject.getEmojiStatusDocumentId(selectedStatusEmoji), DialogObject.isEmojiStatusCollectible(selectedStatusEmoji), false); } else if (position == packEmojiRow) { emojiCell.setAdaptiveEmojiColor(currentAccount, selectedProfileColor, false); emojiCell.setText(LocaleController.getString(getEmojiPackStrRes())); @@ -1111,18 +1183,18 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi } TLRPC.ChatFull chatFull = getMessagesController().getChatFull(-dialogId); if (chatFull != null && chatFull.emojiset != null) { - emojiCell.setEmoji(getEmojiSetThumbId(chatFull.emojiset), false); + emojiCell.setEmoji(getEmojiSetThumbId(chatFull.emojiset), false, false); } else { - emojiCell.setEmoji(0, false); + emojiCell.setEmoji(0, false, false); } } else if (position == packStickerRow) { emojiCell.setText(LocaleController.getString(getStickerPackStrRes())); emojiCell.setLockLevel(0); TLRPC.ChatFull chatFull = getMessagesController().getChatFull(-dialogId); if (chatFull != null && chatFull.stickerset != null) { - emojiCell.setEmoji(getEmojiSetThumb(chatFull.stickerset), false); + emojiCell.setEmoji(getEmojiSetThumb(chatFull.stickerset), false, false); } else { - emojiCell.setEmoji(0, false); + emojiCell.setEmoji(0, false, false); } } break; @@ -1151,9 +1223,9 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi ProfilePreview profilePreview = (ProfilePreview) holder.itemView; profilePreview.backgroundView.setColor(currentAccount, selectedProfileColor, false); profilePreview.profileView.setColor(selectedProfileColor, false); - profilePreview.profileView.setEmoji(selectedProfileEmoji, false); + profilePreview.profileView.setEmoji(selectedProfileEmoji, false, false); profilePreview.profileView.setForum(isForum()); - profilePreview.profileView.setStatusEmoji(DialogObject.getEmojiStatusDocumentId(selectedStatusEmoji), false); + profilePreview.profileView.setStatusEmoji(DialogObject.getEmojiStatusDocumentId(selectedStatusEmoji), false, false); profilePreview.profileView.overrideAvatarColor(selectedReplyColor); break; case VIEW_TYPE_COLOR_PROFILE_GRID: @@ -1170,10 +1242,15 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi public void onViewAttachedToWindow(@NonNull RecyclerView.ViewHolder holder) { if (holder.itemView instanceof ProfilePreview) { ProfilePreview profilePreview = (ProfilePreview) holder.itemView; - profilePreview.profileView.setColor(selectedProfileColor, false); - profilePreview.profileView.setEmoji(selectedProfileEmoji, false); + if (selectedStatusEmoji instanceof TLRPC.TL_emojiStatusCollectible) { + profilePreview.profileView.setColor(MessagesController.PeerColor.fromCollectible(selectedStatusEmoji), false); + profilePreview.profileView.setEmoji(((TLRPC.TL_emojiStatusCollectible) selectedStatusEmoji).pattern_document_id, true, false); + } else { + profilePreview.profileView.setColor(selectedProfileColor, false); + profilePreview.profileView.setEmoji(selectedProfileEmoji, false, false); + } + profilePreview.profileView.setStatusEmoji(DialogObject.getEmojiStatusDocumentId(selectedStatusEmoji), DialogObject.isEmojiStatusCollectible(selectedStatusEmoji), false); profilePreview.profileView.setForum(isForum()); - profilePreview.profileView.setStatusEmoji(DialogObject.getEmojiStatusDocumentId(selectedStatusEmoji), false); profilePreview.profileView.overrideAvatarColor(selectedReplyColor); } else if (holder.itemView instanceof ThemePreviewMessagesCell) { ThemePreviewMessagesCell messagesCell = (ThemePreviewMessagesCell) holder.itemView; @@ -1247,7 +1324,7 @@ public void updateMessagesPreview(boolean animated) { } if (emojiPicker instanceof EmojiCell) { ((EmojiCell) emojiPicker).setAdaptiveEmojiColor(currentAccount, selectedReplyColor, true); - ((EmojiCell) emojiPicker).setEmoji(selectedReplyEmoji, animated); + ((EmojiCell) emojiPicker).setEmoji(selectedReplyEmoji, false, animated); } if (wallpaperPicker instanceof ThemeChooser) { ((ThemeChooser) wallpaperPicker).setSelectedEmoticon(getThemeChooserEmoticon(), animated); @@ -1256,16 +1333,21 @@ public void updateMessagesPreview(boolean animated) { } public void updateProfilePreview(boolean animated) { - View profilePreview = findChildAt(profilePreviewRow); - View colorPicker = findChildAt(profileColorGridRow); - View emojiPicker = findChildAt(profileEmojiRow); - View emojiStatusPicker = findChildAt(statusEmojiRow); - View packEmojiPicker = findChildAt(packEmojiRow); - View packStatusPicker = findChildAt(packStickerRow); + final View profilePreview = findChildAt(profilePreviewRow); + final View colorPicker = findChildAt(profileColorGridRow); + final View emojiPicker = findChildAt(profileEmojiRow); + final View emojiStatusPicker = findChildAt(statusEmojiRow); + final View packEmojiPicker = findChildAt(packEmojiRow); + final View packStatusPicker = findChildAt(packStickerRow); if (profilePreview instanceof ProfilePreview) { - ((ProfilePreview) profilePreview).setColor(selectedProfileColor, animated); - ((ProfilePreview) profilePreview).setEmoji(selectedProfileEmoji, animated); + if (selectedStatusEmoji instanceof TLRPC.TL_emojiStatusCollectible) { + ((ProfilePreview) profilePreview).setColor(MessagesController.PeerColor.fromCollectible(selectedStatusEmoji), animated); + ((ProfilePreview) profilePreview).setEmoji(((TLRPC.TL_emojiStatusCollectible) selectedStatusEmoji).pattern_document_id, true, animated); + } else { + ((ProfilePreview) profilePreview).setColor(selectedProfileColor, animated); + ((ProfilePreview) profilePreview).setEmoji(selectedProfileEmoji, false, animated); + } ((ProfilePreview) profilePreview).setEmojiStatus(selectedStatusEmoji, animated); ((ProfilePreview) profilePreview).profileView.overrideAvatarColor(selectedReplyColor); } @@ -1276,27 +1358,31 @@ public void updateProfilePreview(boolean animated) { } if (emojiPicker instanceof EmojiCell) { ((EmojiCell) emojiPicker).setAdaptiveEmojiColor(currentAccount, selectedProfileColor, false); - ((EmojiCell) emojiPicker).setEmoji(selectedProfileEmoji, animated); + ((EmojiCell) emojiPicker).setEmoji(selectedProfileEmoji, false, animated); } if (emojiStatusPicker instanceof EmojiCell) { - ((EmojiCell) emojiStatusPicker).setAdaptiveEmojiColor(currentAccount, selectedProfileColor, false); - ((EmojiCell) emojiStatusPicker).setEmoji(DialogObject.getEmojiStatusDocumentId(selectedStatusEmoji), animated); + if (selectedStatusEmoji instanceof TLRPC.TL_emojiStatusCollectible) { + ((EmojiCell) emojiStatusPicker).setAdaptiveEmojiColor(MessagesController.PeerColor.fromCollectible(selectedStatusEmoji)); + } else { + ((EmojiCell) emojiStatusPicker).setAdaptiveEmojiColor(currentAccount, selectedProfileColor, false); + } + ((EmojiCell) emojiStatusPicker).setEmoji(DialogObject.getEmojiStatusDocumentId(selectedStatusEmoji), DialogObject.isEmojiStatusCollectible(selectedStatusEmoji), animated); } if (packEmojiPicker instanceof EmojiCell) { ((EmojiCell) packEmojiPicker).setAdaptiveEmojiColor(currentAccount, selectedProfileColor, false); TLRPC.ChatFull chatFull = getMessagesController().getChatFull(-dialogId); if (chatFull != null && chatFull.emojiset != null) { - ((EmojiCell) packEmojiPicker).setEmoji(getEmojiSetThumbId(chatFull.emojiset), false); + ((EmojiCell) packEmojiPicker).setEmoji(getEmojiSetThumbId(chatFull.emojiset), false, false); } else { - ((EmojiCell) packEmojiPicker).setEmoji(0, false); + ((EmojiCell) packEmojiPicker).setEmoji(0, false, false); } } if (packStatusPicker instanceof EmojiCell) { TLRPC.ChatFull chatFull = getMessagesController().getChatFull(-dialogId); if (chatFull != null && chatFull.stickerset != null) { - ((EmojiCell) packStatusPicker).setEmoji(getEmojiSetThumb(chatFull.stickerset), false); + ((EmojiCell) packStatusPicker).setEmoji(getEmojiSetThumb(chatFull.stickerset), false, false); } else { - ((EmojiCell) packStatusPicker).setEmoji(0, false); + ((EmojiCell) packStatusPicker).setEmoji(0, false, false); } } @@ -1409,11 +1495,16 @@ public void setColor(int colorId, boolean animated) { backgroundView.setColor(currentAccount, colorId, animated); } - public void setEmoji(long emojiId, boolean animated) { - profileView.setEmoji(emojiId, animated); + public void setColor(MessagesController.PeerColor peerColor, boolean animated) { + profileView.setColor(peerColor, animated); + backgroundView.setColor(peerColor, animated); + } + + public void setEmoji(long emojiId, boolean isCollectible, boolean animated) { + profileView.setEmoji(emojiId, isCollectible, animated); } public void setEmojiStatus(TLRPC.EmojiStatus emojiStatus, boolean animated) { - profileView.setStatusEmoji(DialogObject.getEmojiStatusDocumentId(emojiStatus), animated); + profileView.setStatusEmoji(DialogObject.getEmojiStatusDocumentId(emojiStatus), false, animated); } } @@ -1456,6 +1547,19 @@ public void setLockLevel(int lvl) { private int color; public void setAdaptiveEmojiColor(int currentAccount, int colorId, boolean isReply) { if (colorId < 0) { + setAdaptiveEmojiColor(null); + } else if (colorId < 7) { + color = Theme.getColor(Theme.keys_avatar_nameInMessage[colorId], resourcesProvider); + } else { + MessagesController.PeerColors peerColors = isReply ? MessagesController.getInstance(currentAccount).peerColors : MessagesController.getInstance(currentAccount).profilePeerColors; + MessagesController.PeerColor peerColor = peerColors == null ? null : peerColors.getColor(colorId); + setAdaptiveEmojiColor(peerColor); + } + invalidate(); + } + + public void setAdaptiveEmojiColor(MessagesController.PeerColor peerColor) { + if (peerColor == null) { if (AndroidUtilities.computePerceivedBrightness(Theme.getColor(Theme.key_actionBarDefault, resourcesProvider)) > .8f) { color = Theme.getColor(Theme.key_windowBackgroundWhiteBlueText, resourcesProvider); } else if (AndroidUtilities.computePerceivedBrightness(Theme.getColor(Theme.key_actionBarDefault, resourcesProvider)) < .2f) { @@ -1463,25 +1567,20 @@ public void setAdaptiveEmojiColor(int currentAccount, int colorId, boolean isRep } else { color = Theme.blendOver(Theme.getColor(Theme.key_windowBackgroundWhite, resourcesProvider), Theme.multAlpha(PeerColorActivity.adaptProfileEmojiColor(Theme.getColor(Theme.key_actionBarDefault, resourcesProvider)), .7f)); } - } else if (colorId < 7) { - color = Theme.getColor(Theme.keys_avatar_nameInMessage[colorId], resourcesProvider); } else { - MessagesController.PeerColors peerColors = isReply ? MessagesController.getInstance(currentAccount).peerColors : MessagesController.getInstance(currentAccount).profilePeerColors; - MessagesController.PeerColor peerColor = peerColors == null ? null : peerColors.getColor(colorId); if (peerColor != null) { color = peerColor.getColor(0, resourcesProvider); } else { color = Theme.getColor(Theme.keys_avatar_nameInMessage[0], resourcesProvider); } } - invalidate(); } public void setText(CharSequence text) { textView.setText(text); } - public void setEmoji(long documentId, boolean animated) { + public void setEmoji(long documentId, boolean isCollectible, boolean animated) { if (documentId == 0) { imageDrawable.set((Drawable) null, animated); if (offText == null) { @@ -1491,9 +1590,10 @@ public void setEmoji(long documentId, boolean animated) { imageDrawable.set(documentId, animated); offText = null; } + imageDrawable.setParticles(isCollectible, animated); } - public void setEmoji(TLRPC.Document document, boolean animated) { + public void setEmoji(TLRPC.Document document, boolean isCollectible, boolean animated) { if (document == null) { imageDrawable.set((Drawable) null, animated); if (offText == null) { @@ -1503,6 +1603,7 @@ public void setEmoji(TLRPC.Document document, boolean animated) { imageDrawable.set(document, animated); offText = null; } + imageDrawable.setParticles(isCollectible, animated); } public void updateColors() { @@ -1961,7 +2062,7 @@ private boolean parseTheme(Theme.ThemeInfo themeInfo) { if (!file.exists()) { if (!loadingWallpapers.containsKey(themeInfo)) { loadingWallpapers.put(themeInfo, themeInfo.slug); - TLRPC.TL_account_getWallPaper req = new TLRPC.TL_account_getWallPaper(); + TL_account.getWallPaper req = new TL_account.getWallPaper(); TLRPC.TL_inputWallPaperSlug inputWallPaperSlug = new TLRPC.TL_inputWallPaperSlug(); inputWallPaperSlug.slug = themeInfo.slug; req.wallpaper = inputWallPaperSlug; @@ -2498,6 +2599,15 @@ public void didReceivedNotification(int id, int account, Object... args) { if (!isGiveaway) { getMessagesController().getBoostsController().getBoostsStats(dialogId, this::updateBoostsAndLevels); } + } else if (id == NotificationCenter.dialogDeleted) { + long dialogId = (long) args[0]; + if (this.dialogId == dialogId) { + if (parentLayout != null && parentLayout.getLastFragment() == this) { + finishFragment(); + } else { + removeSelfFromStack(); + } + } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChannelCreateActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChannelCreateActivity.java index ce050d45df..db0505b186 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChannelCreateActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChannelCreateActivity.java @@ -1005,7 +1005,7 @@ public void onUploadProgressChanged(float progress) { } @Override - public void didStartUpload(boolean isVideo) { + public void didStartUpload(boolean fromAvatarConstructor, boolean isVideo) { if (avatarProgressView == null) { return; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChannelMonetizationLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/ChannelMonetizationLayout.java index 31c7aad03f..0f65ea698b 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChannelMonetizationLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChannelMonetizationLayout.java @@ -59,6 +59,7 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.tgnet.tl.TL_stars; import org.telegram.tgnet.tl.TL_stats; import org.telegram.tgnet.tl.TL_stories; @@ -614,10 +615,10 @@ private void initWithdraw(boolean stars, TLRPC.InputCheckPasswordSRP password, T fragment.showDialog(builder.create()); } } else if ("SRP_ID_INVALID".equals(error.text)) { - TLRPC.TL_account_getPassword getPasswordReq = new TLRPC.TL_account_getPassword(); + TL_account.getPassword getPasswordReq = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(getPasswordReq, (response2, error2) -> AndroidUtilities.runOnUIThread(() -> { if (error2 == null) { - TLRPC.account_Password currentPassword = (TLRPC.account_Password) response2; + TL_account.Password currentPassword = (TL_account.Password) response2; passwordFragment.setCurrentPasswordInfo(null, currentPassword); TwoStepVerificationActivity.initPasswordNewAlgo(currentPassword); initWithdraw(stars, passwordFragment.getNewSrpPassword(), passwordFragment); @@ -991,14 +992,18 @@ private void sendCpmUpdate() { TLRPC.TL_channels_restrictSponsoredMessages req = new TLRPC.TL_channels_restrictSponsoredMessages(); req.channel = MessagesController.getInstance(currentAccount).getInputChannel(-dialogId); req.restricted = switchOffValue; - ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> { if (err != null) { - BulletinFactory.showError(err); + AndroidUtilities.runOnUIThread(() -> { + BulletinFactory.showError(err); + }); } else if (res instanceof TLRPC.Updates) { - initialSwitchOffValue = switchOffValue; + AndroidUtilities.runOnUIThread(() -> { + initialSwitchOffValue = switchOffValue; + }); MessagesController.getInstance(currentAccount).processUpdates((TLRPC.Updates) res, false); } - })); + }); } private boolean onLongClick(UItem item, View view, int position, float x, float y) { @@ -1065,7 +1070,7 @@ public ProceedOverviewCell(Context context, Theme.ResourcesProvider resourcesPro setOrientation(VERTICAL); layout = new LinearLayout(context); - layout.setOrientation(HORIZONTAL); + layout.setOrientation(VERTICAL); addView(layout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 22, 9, 22, 0)); for (int i = 0; i < 2; ++i) { @@ -1080,7 +1085,7 @@ public ProceedOverviewCell(Context context, Theme.ResourcesProvider resourcesPro amountContainer[i].addView(cryptoAmountView[i], LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM, 0, 0, 5, 0)); amountView[i] = new AnimatedEmojiSpan.TextViewEmojis(context); - amountView[i].setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13); + amountView[i].setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11.5f); amountView[i].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText, resourcesProvider)); amountContainer[i].addView(amountView[i], LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM)); } @@ -1122,15 +1127,22 @@ public void set(ProceedOverview value) { SpannableStringBuilder s = new SpannableStringBuilder(crypto_currency + " "); CharSequence finalS; if ("TON".equalsIgnoreCase(crypto_currency)) { - s.append(formatter.format(value.crypto_amount / 1_000_000_000.0)); - finalS = replaceTON(s, cryptoAmountView[i].getPaint(), .87f, true); + String formatted = formatter.format(value.crypto_amount / 1_000_000_000.0); + int index = formatted.indexOf('.'); + if (index >= 0) { + s.append(LocaleController.formatNumber((long) Math.floor(value.crypto_amount / 1_000_000_000.0), ' ')); + s.append(formatted.substring(index)); + } else { + s.append(formatted); + } + finalS = replaceTON(s, cryptoAmountView[i].getPaint(), 1.05f, true); } else if ("XTR".equalsIgnoreCase(crypto_currency)) { if (i == 0) { s.append(LocaleController.formatNumber(value.crypto_amount, ' ')); } else { s.append(StarsIntroActivity.formatStarsAmount(value.crypto_amount2, .8f, ' ')); } - finalS = StarsIntroActivity.replaceStarsWithPlain(s, .8f); + finalS = StarsIntroActivity.replaceStarsWithPlain(s, .7f); } else { s.append(Long.toString(value.crypto_amount)); finalS = s; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Charts/BaseChartView.java b/TMessagesProj/src/main/java/org/telegram/ui/Charts/BaseChartView.java index e47fe48f2e..5e5427b172 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Charts/BaseChartView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Charts/BaseChartView.java @@ -1513,7 +1513,9 @@ public void selectDate(long activeZoom) { legendSignatureView.setVisibility(VISIBLE); selectionA = 1f; moveLegend(chartFullWidth * (pickerDelegate.pickerStart) - HORIZONTAL_PADDING); - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} } public long getStartDate() { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index c5b9e92b8e..c0f9449345 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -182,6 +182,7 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.tgnet.tl.TL_bots; import org.telegram.tgnet.tl.TL_stories; import org.telegram.ui.ActionBar.ActionBar; @@ -242,6 +243,7 @@ import org.telegram.ui.Components.voip.CellFlickerDrawable; import org.telegram.ui.Components.voip.VoIPHelper; import org.telegram.ui.Delegates.ChatActivityMemberRequestsDelegate; +import org.telegram.ui.Gifts.GiftSheet; import org.telegram.ui.Stars.StarReactionsOverlay; import org.telegram.ui.Stars.StarsController; import org.telegram.ui.Stars.StarsIntroActivity; @@ -255,7 +257,6 @@ import org.telegram.ui.Stories.recorder.StoryRecorder; import org.telegram.ui.bots.BotAdView; import org.telegram.ui.bots.BotCommandsMenuView; -import org.telegram.ui.bots.BotWebViewAttachedSheet; import org.telegram.ui.bots.BotWebViewSheet; import org.telegram.ui.bots.WebViewRequestProps; @@ -354,6 +355,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not private RadialProgressView bottomOverlayProgress; private AnimatorSet bottomOverlayAnimation; private boolean bottomOverlayChatWaitsReply; + private ImageView bottomGiftButton; + private HintView2 bottomGiftHintView; private BlurredFrameLayout bottomOverlayChat; private BlurredFrameLayout bottomMessagesActionContainer; @Nullable @@ -582,7 +585,7 @@ public ArrayList getFilteredMessages() { public static final int SEARCH_CHANNEL_POSTS = 3; private int searchType; - public TLRPC.TL_businessChatLink businessLink = null; + public TL_account.TL_businessChatLink businessLink = null; public String quickReplyShortcut; private int chatMode; @@ -1025,7 +1028,7 @@ public void run() { private final ChatMessagesMetadataController chatMessagesMetadataController = new ChatMessagesMetadataController(this); private TLRPC.TL_channels_sendAsPeers sendAsPeersObj; - private TLRPC.TL_account_resolvedBusinessChatLinks resolvedChatLink; + private TL_account.resolvedBusinessChatLinks resolvedChatLink; private boolean switchFromTopics; private boolean switchingFromTopics; @@ -1073,6 +1076,7 @@ public void run() { private final static int OPTION_OPEN_PROFILE = 104; private final static int OPTION_FACT_CHECK = 106; private final static int OPTION_EDIT_PRICE = 107; + private final static int OPTION_GIFT = 108; private final static int[] allowedNotificationsDuringChatListAnimations = new int[]{ NotificationCenter.messagesRead, @@ -1349,7 +1353,7 @@ default void onReport() { private PhotoViewer.PhotoViewerProvider photoViewerProvider = new PhotoViewer.EmptyPhotoViewerProvider() { @Override - public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { + public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview, boolean closing) { return ChatActivity.this.getPlaceForPhoto(messageObject, fileLocation, index, needPreview, false); } @@ -1362,7 +1366,7 @@ public boolean validateGroupId(long groupId) { private PhotoViewer.PhotoViewerProvider photoViewerPaidMediaProvider = new PhotoViewer.EmptyPhotoViewerProvider() { @Override - public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { + public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview, boolean closing) { return ChatActivity.this.getPlaceForPhoto(messageObject, fileLocation, index, needPreview, false); } @@ -1382,7 +1386,7 @@ public boolean forceAllInGroup() { private PhotoViewer.PhotoViewerProvider botContextProvider = new PhotoViewer.EmptyPhotoViewerProvider() { @Override - public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { + public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview, boolean closing) { if (index < 0 || index >= botContextResults.size() || mentionContainer == null || mentionContainer.getListView() == null) { return null; } @@ -1481,7 +1485,7 @@ public void sendButtonPressed(int index, VideoEditedInfo videoEditedInfo, boolea private final static int share_business_link = 66; private final static int rename_business_link = 67; private final static int delete_business_link = 68; - + private final static int share = 69; private final static int id_chat_compose_panel = 1000; @@ -1497,7 +1501,7 @@ public boolean onItemClick(View view, int position, float x, float y) { boolean showMenu = true; if (view instanceof ChatActionCell) { ChatActionCell actionCell = (ChatActionCell) view; - showMenu = actionCell.getMessageObject().messageOwner.action instanceof TLRPC.TL_messageActionSetMessagesTTL || actionCell.getMessageObject().type == MessageObject.TYPE_SUGGEST_PHOTO || actionCell.getMessageObject().isWallpaperAction(); + showMenu = actionCell.getMessageObject().messageOwner.action instanceof TLRPC.TL_messageActionSetMessagesTTL || actionCell.getMessageObject().type == MessageObject.TYPE_SUGGEST_PHOTO || actionCell.getMessageObject().isWallpaperAction() || actionCell.getMessageObject().type == MessageObject.TYPE_GIFT_STARS; } if (!actionBar.isActionModeShowed() && (!isReport() || showMenu)) { result = createMenu(view, false, true, x, y, true); @@ -1693,21 +1697,37 @@ public boolean hasDoubleTap(View view, int position) { if (!available && chatInfo != null) { available = ChatObject.reactionIsAvailable(chatInfo, reaction == null ? reactionStringSetting : reaction.reaction); } - if (!available || !(view instanceof ChatMessageCell)) { + if (!available) { return false; } - ChatMessageCell cell = (ChatMessageCell) view; - return !cell.getMessageObject().isSending() && !cell.getMessageObject().isEditing() && cell.getMessageObject().type != MessageObject.TYPE_PHONE_CALL && !actionBar.isActionModeShowed() && !isSecretChat() && !isInScheduleMode() && !cell.getMessageObject().isSponsored(); + MessageObject messageObject; + if (view instanceof ChatMessageCell) { + messageObject = ((ChatMessageCell) view).getPrimaryMessageObject(); + } else if (view instanceof ChatActionCell) { + messageObject = ((ChatActionCell) view).getMessageObject(); + } else { + return false; + } + return messageObject != null && !messageObject.isDateObject && !messageObject.isSending() && messageObject.canSetReaction() && !messageObject.isEditing() && !actionBar.isActionModeShowed() && !isSecretChat() && !isInScheduleMode() && !messageObject.isSponsored(); } @Override public void onDoubleTap(View view, int position, float x, float y) { - if (!(view instanceof ChatMessageCell) || getParentActivity() == null || isSecretChat() || isInScheduleMode() || isInPreviewMode() || chatMode == MODE_QUICK_REPLIES) { + if (getParentActivity() == null || isSecretChat() || isInScheduleMode() || isInPreviewMode() || chatMode == MODE_QUICK_REPLIES) { return; } - ChatMessageCell cell = (ChatMessageCell) view; - MessageObject primaryMessage = cell.getPrimaryMessageObject(); - if (primaryMessage.isSecretMedia() || primaryMessage.isExpiredStory() || primaryMessage.type == MessageObject.TYPE_JOINED_CHANNEL) { + MessageObject messageObject; + if (view instanceof ChatMessageCell) { + messageObject = ((ChatMessageCell) view).getPrimaryMessageObject(); + } else if (view instanceof ChatActionCell) { + messageObject = ((ChatActionCell) view).getMessageObject(); + if (messageObject.isDateObject) { + return; + } + } else { + return; + } + if (messageObject.isSecretMedia() || !messageObject.canSetReaction() || messageObject.isExpiredStory() || messageObject.type == MessageObject.TYPE_JOINED_CHANNEL) { return; } ReactionsEffectOverlay.removeCurrent(false); @@ -1720,10 +1740,10 @@ public void onDoubleTap(View view, int position, float x, float y) { if (!available) { return; } - selectReaction(cell, primaryMessage, null, null, x, y, ReactionsLayoutInBubble.VisibleReaction.fromEmojicon(reactionString), true, false, false, false); + selectReaction(view, messageObject, null, null, x, y, ReactionsLayoutInBubble.VisibleReaction.fromEmojicon(reactionString), true, false, false, false); } else { TLRPC.TL_availableReaction reaction = getMediaDataController().getReactionsMap().get(reactionString); - if (reaction == null || cell.getMessageObject().isSponsored()) { + if (reaction == null || messageObject.isSponsored()) { return; } boolean available = dialog_id >= 0; @@ -1733,7 +1753,7 @@ public void onDoubleTap(View view, int position, float x, float y) { if (!available) { return; } - selectReaction(cell, primaryMessage, null, null, x, y, ReactionsLayoutInBubble.VisibleReaction.fromEmojicon(reaction), true, false, false, false); + selectReaction(view, messageObject, null, null, x, y, ReactionsLayoutInBubble.VisibleReaction.fromEmojicon(reaction), true, false, false, false); } } }; @@ -2359,7 +2379,7 @@ public boolean onFragmentCreate() { attachMenuBotToOpen = arguments.getString("attach_bot", null); attachMenuBotStartCommand = arguments.getString("attach_bot_start_command", null); inlineReturn = arguments.getLong("inline_return", 0); - String inlineQuery = arguments.getString("inline_query"); + final String inlineQuery = arguments.getString("inline_query"); textToSet = arguments.getString("start_text"); premiumInvoiceBot = arguments.getBoolean("premium_bot", false); startLoadFromMessageId = arguments.getInt("message_id", 0); @@ -4197,8 +4217,10 @@ protected void onMeasure(int widthSpec, int heightSpec) { protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); if (lastWidth != r - l) { + if (lastWidth != 0) { + hideHints(false); + } lastWidth = r - l; - hideHints(false); } int height = getMeasuredHeight(); @@ -4506,9 +4528,7 @@ private void processTouchEvent(MotionEvent e) { if (!wasTrackingVibrate) { try { performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - } catch (Exception ignore) { - - } + } catch (Exception ignore) {} wasTrackingVibrate = true; } } else { @@ -5215,6 +5235,7 @@ private void drawChatBackgroundElements(Canvas canvas) { canvas.translate(cell.getX(), cell.getY()); canvas.scale(cell.getScaleX(), cell.getScaleY(), cell.getMeasuredWidth() / 2f, cell.getMeasuredHeight() / 2f); cell.drawBackground(canvas, true); + cell.drawReactions(canvas, true, null); canvas.restore(); } } @@ -6594,7 +6615,9 @@ public void onClick(View view) { chatActivityEnterView.getEditField().setAllowDrawCursor(true); } }); - view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} return true; }); @@ -7044,7 +7067,9 @@ public void getOutline(View view, Outline outline) { chatActivityEnterView.getEditField().setAllowDrawCursor(true); } }); - view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} return false; }); reactionsMentiondownButton.setVisibility(View.INVISIBLE); @@ -8582,7 +8607,7 @@ private void showBotMessageHint(ChatMessageCell cell, boolean byClick) { botMessageHint.show(); }); } - + private void hideHints() { if (savedMessagesTagHint != null && savedMessagesTagHint.shown()) { savedMessagesTagHint.hide(); @@ -9187,33 +9212,7 @@ public void requestLayout() { } }, themeDelegate)); - emojiStatusSpamHint = new LinkSpanDrawable.LinksTextView(getContext(), themeDelegate) { - Layout lastLayout; - AnimatedEmojiSpan.EmojiGroupedSpans stack; - PorterDuffColorFilter colorFilter; - int lastColor; - - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - AnimatedEmojiSpan.release(this, stack); - lastLayout = null; - } - - @Override - protected void dispatchDraw(Canvas canvas) { - super.dispatchDraw(canvas); - if (lastLayout != getLayout()) { - stack = AnimatedEmojiSpan.update(AnimatedEmojiDrawable.CACHE_TYPE_EMOJI_STATUS, this, stack, lastLayout = getLayout()); - } - int color = getThemedColor(Theme.key_windowBackgroundWhiteBlueIcon); - if (lastColor != color || colorFilter == null) { - colorFilter = new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY); - lastColor = color; - } - AnimatedEmojiSpan.drawAnimatedEmojis(canvas, getLayout(), stack, 0, null, 0, 0, 0, 1f, colorFilter); - } - }; + emojiStatusSpamHint = new LinkSpanDrawable.LinksTextView(getContext(), themeDelegate); emojiStatusSpamHint.setTextColor(getThemedColor(Theme.key_chat_topPanelMessage)); emojiStatusSpamHint.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13.3f); emojiStatusSpamHint.setGravity(Gravity.CENTER); @@ -9330,6 +9329,7 @@ protected void dispatchDraw(Canvas canvas) { if (currentEncryptedChat != null) { did = currentUser.id; } + shownBotVerification = false; getMessagesController().hidePeerSettingsBar(did, currentUser, currentChat); updateTopPanel(true); updateInfoTopView(true); @@ -9811,14 +9811,23 @@ private void playReactionAnimation(Integer messageId) { if (fragmentView == null) { return; } - ChatMessageCell cell = findMessageCell(messageId, false); - if (cell != null) { - TLRPC.MessagePeerReaction reaction = cell.getMessageObject().getRandomUnreadReaction(); - if (reaction != null && cell.reactionsLayoutInBubble.hasUnreadReactions) { + BaseCell cell = findMessageCell(messageId, false); + if (cell instanceof ChatMessageCell) { + final ChatMessageCell messageCell = (ChatMessageCell) cell; + final TLRPC.MessagePeerReaction reaction = messageCell.getMessageObject().getRandomUnreadReaction(); + if (reaction != null && messageCell.reactionsLayoutInBubble.hasUnreadReactions) { + ReactionsEffectOverlay.show(ChatActivity.this, null, cell, null,0, 0, ReactionsLayoutInBubble.VisibleReaction.fromTL(reaction.reaction), currentAccount, reaction.big ? ReactionsEffectOverlay.LONG_ANIMATION : ReactionsEffectOverlay.SHORT_ANIMATION); + ReactionsEffectOverlay.startAnimation(); + } + messageCell.markReactionsAsRead(); + } else if (cell instanceof ChatActionCell) { + final ChatActionCell actionCell = (ChatActionCell) cell; + final TLRPC.MessagePeerReaction reaction = actionCell.getMessageObject().getRandomUnreadReaction(); + if (reaction != null && actionCell.reactionsLayoutInBubble.hasUnreadReactions) { ReactionsEffectOverlay.show(ChatActivity.this, null, cell, null,0, 0, ReactionsLayoutInBubble.VisibleReaction.fromTL(reaction.reaction), currentAccount, reaction.big ? ReactionsEffectOverlay.LONG_ANIMATION : ReactionsEffectOverlay.SHORT_ANIMATION); ReactionsEffectOverlay.startAnimation(); } - cell.markReactionsAsRead(); + actionCell.markReactionsAsRead(); } } @@ -9894,7 +9903,7 @@ private void dimBehindView(float value, boolean blur, boolean hidePagedownButton } scrimProgressDirection = true; animators.add(scrimPaintAlphaAnimator = ValueAnimator.ofFloat(0, value)); - + if (blur) { AndroidUtilities.makeGlobalBlurBitmap(bitmap -> { scrimBlurBitmap = bitmap; @@ -12344,6 +12353,9 @@ private void hideHints(boolean scroll) { if (checksHintView != null) { checksHintView.hide(); } + if (bottomGiftHintView != null) { + bottomGiftHintView.hide(); + } } private void hideSendButtonHints() { @@ -13383,7 +13395,7 @@ public void searchLinks(final CharSequence charSequence, final boolean force) { return; } - final TLRPC.TL_messages_getWebPagePreview req = new TLRPC.TL_messages_getWebPagePreview(); + final TL_account.getWebPagePreview req = new TL_account.getWebPagePreview(); if (textToCheck instanceof String) { req.message = (String) textToCheck; } else { @@ -13430,7 +13442,7 @@ public void searchLinks(final CharSequence charSequence, final boolean force) { private HashMap lastLinkPreviewResults; - private void requestLinkPreviewCached(TLRPC.TL_messages_getWebPagePreview req, Utilities.Callback2 done) { + private void requestLinkPreviewCached(TL_account.getWebPagePreview req, Utilities.Callback2 done) { if (lastLinkPreviewResults == null) { lastLinkPreviewResults = new HashMap<>(); } @@ -13452,12 +13464,19 @@ private void requestLinkPreviewCached(TLRPC.TL_messages_getWebPagePreview req, U } } - private void requestLinkPreview(TLRPC.TL_messages_getWebPagePreview req, Utilities.Callback2 done) { + private void requestLinkPreview(TL_account.getWebPagePreview req, Utilities.Callback2 done) { cancelSearchLinks(); linkSearchRequestId = getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { linkSearchRequestId = 0; - if (response instanceof TLRPC.TL_messageMediaWebPage) { - TLRPC.TL_messageMediaWebPage media = (TLRPC.TL_messageMediaWebPage) response; + TLRPC.TL_messageMediaWebPage media = null; + if (response instanceof TL_account.webPagePreview) { + final TL_account.webPagePreview preview = (TL_account.webPagePreview) response; + getMessagesController().putUsers(preview.users, false); + if (preview.media instanceof TLRPC.TL_messageMediaWebPage) { + media = (TLRPC.TL_messageMediaWebPage) preview.media; + } + } + if (media != null) { if (media.webpage != null && "telegram_story".equals(media.webpage.type)) { TLRPC.TL_webPageAttributeStory _attrStory = null; if (media.webpage.attributes != null) { @@ -13477,13 +13496,14 @@ private void requestLinkPreview(TLRPC.TL_messages_getWebPagePreview req, Utiliti return; } final TLRPC.TL_webPageAttributeStory attrStory = _attrStory; + final TLRPC.TL_messageMediaWebPage finalMedia = media; getMessagesStorage().getStorageQueue().postRunnable(() -> { try { LongSparseArray> array = new LongSparseArray<>(); TLRPC.TL_message message = new TLRPC.TL_message(); message.message = ""; message.id = 0; - message.media = media; + message.media = finalMedia; ArrayList list = new ArrayList<>(); list.add(new MessageObject(currentAccount, message, false, false)); array.put(DialogObject.getPeerDialogId(attrStory.peer), list); @@ -13529,7 +13549,7 @@ private void forwardMessages(ArrayList arrayList, boolean fromMyN if ((scheduleDate != 0) == (chatMode == MODE_SCHEDULED)) { waitingForSendingMessageLoad = true; } - int result = getSendMessagesHelper().sendMessage(arrayList, dialog_id, fromMyName, hideCaption, notify, scheduleDate, getThreadMessage()); + int result = getSendMessagesHelper().sendMessage(arrayList, dialog_id, fromMyName, hideCaption, notify, scheduleDate, getThreadMessage(), -1); AlertsCreator.showSendMediaAlert(result, this, themeDelegate); if (result != 0) { AndroidUtilities.runOnUIThread(() -> { @@ -13856,7 +13876,7 @@ public void showFieldPanel(boolean show, MessageObject messageObjectToReply, Mes mess = mess.subSequence(0, 150); } mess = AndroidUtilities.replaceNewLines(mess); - Spannable cs = new SpannableStringBuilder(Emoji.replaceEmoji(mess, replyObjectTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false)); + Spannable cs = new SpannableStringBuilder(Emoji.replaceEmoji(mess, replyObjectTextView.getPaint().getFontMetricsInt(), false)); MediaDataController.addTextStyleRuns(messageObjectToEdit, cs); if (messageObjectToEdit.messageOwner != null) { cs = MessageObject.replaceAnimatedEmoji(cs, messageObjectToEdit.messageOwner.entities, replyObjectTextView.getPaint().getFontMetricsInt()); @@ -14002,7 +14022,7 @@ public void showFieldPanel(boolean show, MessageObject messageObjectToReply, Mes if (entities != null) { replyObjectText = MessageObject.replaceAnimatedEmoji(replyObjectText, entities, replyObjectTextView.getPaint().getFontMetricsInt()); } - replyObjectText = Emoji.replaceEmoji(replyObjectText, replyObjectTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false); + replyObjectText = Emoji.replaceEmoji(replyObjectText, replyObjectTextView.getPaint().getFontMetricsInt(), false); } } else if (!TextUtils.isEmpty(restrictionReason)) { replyObjectText = restrictionReason; @@ -14018,7 +14038,7 @@ public void showFieldPanel(boolean show, MessageObject messageObjectToReply, Mes } else if (messageObjectToReply.replyToForumTopic != null) { replyObjectText = ForumUtilities.getTopicSpannedName(messageObjectToReply.replyToForumTopic, replyObjectTextView.getPaint(), false); } else if (messageObjectToReply.messageOwner.media instanceof TLRPC.TL_messageMediaGame) { - replyObjectText = Emoji.replaceEmoji(messageObjectToReply.messageOwner.media.game.title, replyObjectTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false); + replyObjectText = Emoji.replaceEmoji(messageObjectToReply.messageOwner.media.game.title, replyObjectTextView.getPaint().getFontMetricsInt(), false); sourceText = messageObjectToReply.messageOwner.media.game.title; } else if (messageObjectToReply.messageText != null || messageObjectToReply.caption != null) { CharSequence mess = messageObjectToReply.caption != null ? messageObjectToReply.caption.toString() : messageObjectToReply.messageText.toString(); @@ -14030,7 +14050,7 @@ public void showFieldPanel(boolean show, MessageObject messageObjectToReply, Mes if (messageObjectToReply.messageOwner != null && messageObjectToReply.messageOwner.entities != null) { mess = MessageObject.replaceAnimatedEmoji(mess, messageObjectToReply.messageOwner.entities, replyObjectTextView.getPaint().getFontMetricsInt()); } - replyObjectText = Emoji.replaceEmoji(mess, replyObjectTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false); + replyObjectText = Emoji.replaceEmoji(mess, replyObjectTextView.getPaint().getFontMetricsInt(), false); } if (replyObjectText != null) { if (replyObjectText instanceof Spannable && sourceText != null) { @@ -14197,7 +14217,7 @@ public void showFieldPanel(boolean show, MessageObject messageObjectToReply, Mes if (mess.length() > 150) { mess = mess.subSequence(0, 150); } - mess = Emoji.replaceEmoji(mess, replyObjectTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false); + mess = Emoji.replaceEmoji(mess, replyObjectTextView.getPaint().getFontMetricsInt(), false); if (mess instanceof Spannable) { MediaDataController.addTextStyleRuns(messageObject.messageOwner.entities, messageObject.messageText, (Spannable) mess); if (messageObject.messageOwner != null) { @@ -14892,6 +14912,25 @@ public void updateMessagesVisiblePart(boolean inLayout) { if (messageObject != null && messageObject.getDialogId() == dialog_id && messageObject.getId() > maxVisibleId) { maxVisibleId = Math.max(maxVisibleId, messageObject.getId()); } + if (fragmentOpened && openAnimationEnded && (chatListItemAnimator == null || !chatListItemAnimator.isRunning()) && cell.checkUnreadReactions(clipTop, chatListView.getMeasuredHeight() - blurredViewBottomOffset)) { + reactionsMentionCount--; + getMessagesStorage().markMessageReactionsAsRead(getDialogId(), getTopicId(), cell.getMessageObject().getId(), true); + if (reactionsMentionCount <= 0) { + getMessagesController().markReactionsAsRead(dialog_id, getTopicId()); + } + if (reactionsMentionCount >= 0) { + TLRPC.MessagePeerReaction reaction = cell.getMessageObject().getRandomUnreadReaction(); + if (reaction != null) { + ReactionsLayoutInBubble.VisibleReaction visibleReaction = ReactionsLayoutInBubble.VisibleReaction.fromTL(reaction.reaction); + ReactionsEffectOverlay.show(ChatActivity.this, null, cell, null, 0, 0, visibleReaction, currentAccount, reaction.big ? ReactionsEffectOverlay.LONG_ANIMATION : ReactionsEffectOverlay.SHORT_ANIMATION); + ReactionsEffectOverlay.startAnimation(); + } + cell.markReactionsAsRead(); + } else { + reactionsMentionCount = 0; + } + updateReactionsMentionButton(true); + } cell.setVisiblePart(visibleTop, visibleBackgroundHeight); } else if (view instanceof BotHelpCell) { view.invalidate(); @@ -16632,6 +16671,9 @@ protected void dispatchDraw(Canvas canvas) { if (cell != null) { cell.setInvalidatesParent(true); cell.setScrimReaction(scrimViewReaction); + } else if (actionCell != null) { + actionCell.setInvalidatesParent(true); + actionCell.setScrimReaction(scrimViewReaction); } canvas.clipRect(viewClipLeft, viewClipTop, viewClipRight, viewClipBottom); canvas.translate(chatListView.getLeft() + child.getX(), chatListView.getY() + child.getY()); @@ -16651,6 +16693,9 @@ protected void dispatchDraw(Canvas canvas) { if (cell != null) { cell.setInvalidatesParent(false); cell.setScrimReaction(null); + } else if (actionCell != null) { + actionCell.setInvalidatesParent(false); + actionCell.setScrimReaction(null); } } @@ -16702,6 +16747,38 @@ protected void dispatchDraw(Canvas canvas) { cell.drawScrimReactionPreview(this, canvas, scrimViewReactionOffset, scrimViewReaction, scrimProgress); canvas.restore(); } + } else if (scrimViewReaction != null && actionCell != null) { + if (scrimBlurBitmapPaint != null) { + scrimBlurMatrix.reset(); + final float s = (float) getMeasuredWidth() / scrimBlurBitmap.getWidth(); + scrimBlurMatrix.postScale(s, s); + scrimBlurBitmapShader.setLocalMatrix(scrimBlurMatrix); + scrimBlurBitmapPaint.setAlpha((int) (0xFF * scrimViewProgress)); + canvas.drawRect(0, 0, getMeasuredWidth(), getMeasuredHeight(), scrimBlurBitmapPaint); + } else { + scrimPaint.setAlpha((int) (255 * scrimPaintAlpha * scrimViewAlpha)); + canvas.drawRect(0, 0, getMeasuredWidth(), getMeasuredHeight(), scrimPaint); + } + + if (viewClipTop < viewClipBottom) { + final float scrimProgress = scrimPaintAlpha * scrimViewAlpha / 0.2f; + + float alpha = child.getAlpha() * scrimViewAlpha; + if (alpha < 1f) { + canvas.saveLayerAlpha(viewClipLeft, viewClipTop, viewClipRight, viewClipBottom, (int) (255 * alpha), Canvas.ALL_SAVE_FLAG); + } else { + canvas.save(); + } + canvas.clipRect(viewClipLeft, viewClipTop, viewClipRight, viewClipBottom); + canvas.translate(chatListView.getLeft() + child.getX(), chatListView.getY() + child.getY()); + actionCell.drawScrimReaction(canvas, scrimViewReaction, scrimProgress, scrimProgressDirection); + canvas.restore(); + + canvas.save(); + canvas.translate(chatListView.getLeft() + child.getX(), chatListView.getY() + child.getY()); + actionCell.drawScrimReactionPreview(this, canvas, scrimViewReactionOffset, scrimViewReaction, scrimProgress); + canvas.restore(); + } } } @@ -17619,9 +17696,9 @@ private int getMessageType(MessageObject messageObject) { } else { if (messageObject.isAnimatedEmoji()) { return 2; - } else if (messageObject.type == 6) { + } else if (messageObject.type == MessageObject.TYPE_LOADING) { return -1; - } else if (messageObject.type == 10 || messageObject.type == MessageObject.TYPE_ACTION_PHOTO || messageObject.type == MessageObject.TYPE_SUGGEST_PHOTO || messageObject.isWallpaperAction()) { + } else if (messageObject.type == MessageObject.TYPE_DATE || messageObject.type == MessageObject.TYPE_ACTION_PHOTO || messageObject.type == MessageObject.TYPE_SUGGEST_PHOTO || messageObject.type == MessageObject.TYPE_GIFT_STARS || messageObject.isWallpaperAction()) { if (messageObject.getId() == 0) { return -1; } @@ -18312,6 +18389,7 @@ public void updateTitle(boolean animated) { } } setParentActivityTitle(avatarContainer.getTitleTextView().getText()); + updateTitleIcons(); } private void updateTopicTitleIcon() { @@ -18381,7 +18459,15 @@ private void updateTitleIcons(boolean forceToggleMuted) { if (!UserObject.isReplyUser(currentUser) && (!isThreadChat() || isTopic) && isMuted) { rightIcon = getThemedDrawable(Theme.key_drawable_muteIconDrawable); } - avatarContainer.setTitleIcons(currentEncryptedChat != null ? getThemedDrawable(Theme.key_drawable_lockIconDrawable) : null, rightIcon); + Drawable leftIcon = null; + if (currentEncryptedChat != null) { + leftIcon = getThemedDrawable(Theme.key_drawable_lockIconDrawable); + } else if (currentChat != null) { + leftIcon = avatarContainer.getBotVerificationDrawable(DialogObject.getBotVerificationIcon(currentChat), false); + } else if (currentUser != null && !UserObject.isUserSelf(currentUser)) { + leftIcon = avatarContainer.getBotVerificationDrawable(DialogObject.getBotVerificationIcon(currentUser), false); + } + avatarContainer.setTitleIcons(leftIcon, rightIcon); if (!forceToggleMuted && muteItem != null) { if (isMuted) { muteItem.setRightIconVisibility(View.GONE); @@ -18613,7 +18699,7 @@ private void openEditingMessageInPhotoEditor() { photos.add(entry); PhotoViewer.getInstance().openPhotoForSelect(photos, 0, 2, false, new PhotoViewer.EmptyPhotoViewerProvider() { @Override - public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { + public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview, boolean closing) { return ChatActivity.this.getPlaceForPhoto(object, null, index, needPreview, true); } @@ -20627,8 +20713,12 @@ public void didReceivedNotification(int id, int account, final Object... args) { final ArrayList messages = new ArrayList<>(); MessageObject conversionMessage = null; boolean conversion = false; + boolean deletedThreadMessage = false; for (int msg_id : markAsDeletedMessages) { MessageObject msg = messagesDict[0].get(msg_id); + if (msg_id == threadMessageId) { + deletedThreadMessage = true; + } if (msg != null) { if (msg.messageOwner != null && msg.messageOwner.video_processing_pending) { if (conversionMessage == null) conversionMessage = msg; @@ -20669,6 +20759,13 @@ public void didReceivedNotification(int id, int account, final Object... args) { .show(true); } } + if (deletedThreadMessage && isThreadChat() && !isTopic) { + if (parentLayout != null && parentLayout.getLastFragment() == this) { + finishFragment(); + } else { + removeSelfFromStack(); + } + } } else if (id == NotificationCenter.quickRepliesDeleted) { if (chatMode != MODE_QUICK_REPLIES) return; if ((Long) args[1] != getQuickReplyId()) return; @@ -21388,7 +21485,9 @@ public void didReceivedNotification(int id, int account, final Object... args) { for (int a = 0, N = results.results.size(); a < N; a++) { TLRPC.TL_pollAnswerVoters voters = results.results.get(a); if (voters.chosen) { - pollView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + pollView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {}; if (voters.correct) { fireworksOverlay.start(); } else { @@ -22263,6 +22362,9 @@ public void didReceivedNotification(int id, int account, final Object... args) { profileChannelMessageFetcher.fetch(userInfo); } birthdayAssetsFetcher = ProfileBirthdayEffect.BirthdayEffectFetcher.of(currentAccount, userInfo, birthdayAssetsFetcher); + if (chatInfo != null && chatInfo.bot_verification != null) { + updateTopPanel(true); + } } } else if (id == NotificationCenter.didSetNewWallpapper) { if (fragmentView != null) { @@ -22439,10 +22541,10 @@ public void didReceivedNotification(int id, int account, final Object... args) { if (messages != null) { for (int i = 0; i < messages.size(); i++) { int messageId = messages.get(i); - ChatMessageCell cell = findMessageCell(messageId, true); + BaseCell cell = findMessageCell(messageId, true); if (cell != null && reactionsMentionCount > 0) { reactionsMentionCount--; - getMessagesStorage().markMessageReactionsAsRead(getDialogId(), getTopicId(), cell.getMessageObject().getId(), true); + getMessagesStorage().markMessageReactionsAsRead(getDialogId(), getTopicId(), messageId, true); AndroidUtilities.runOnUIThread(() -> { playReactionAnimation(messageId); }, 200); @@ -22598,13 +22700,13 @@ public void didReceivedNotification(int id, int account, final Object... args) { avatarContainer.avatarImageView.invalidate(); } } else if (id == NotificationCenter.channelRecommendationsLoaded) { - final long chatId = (long) args[0]; + final long dialogId = (long) args[0]; if (chatListView != null) { for (int i = 0; i < chatListView.getChildCount(); ++i) { View child = chatListView.getChildAt(i); if (child instanceof ChatMessageCell){ ChatMessageCell cell = (ChatMessageCell) child; - if (cell.channelRecommendationsCell != null && cell.channelRecommendationsCell.chatId == chatId) { + if (cell.channelRecommendationsCell != null && cell.channelRecommendationsCell.chatId == -dialogId) { boolean wasExpanded = cell.channelRecommendationsCell.isExpanded(); cell.channelRecommendationsCell.update(); if (cell.channelRecommendationsCell.isExpanded() != wasExpanded) { @@ -22652,7 +22754,7 @@ public void didReceivedNotification(int id, int account, final Object... args) { } else if (id == NotificationCenter.businessLinksUpdated) { String businessLinkArgument = arguments.getString("business_link"); if (businessLinkArgument != null) { - TLRPC.TL_businessChatLink link = BusinessLinksController.getInstance(currentAccount).findLink(businessLinkArgument); + TL_account.TL_businessChatLink link = BusinessLinksController.getInstance(currentAccount).findLink(businessLinkArgument); if (link != null) { businessLink = link; updateTitle(true); @@ -22953,9 +23055,7 @@ private void addSponsoredMessages(boolean animated) { int postId = 0; try { postId = matcher.groupCount() >= 2 ? Integer.parseInt(matcher.group(2)) : 0; - } catch (Exception e2) { - FileLog.e(e2, false); - } + } catch (Exception e2) {} TLObject obj = getMessagesController().getUserOrChat(username); long did; if (obj instanceof TLRPC.User) { @@ -22982,7 +23082,7 @@ private void addSponsoredMessages(boolean animated) { if (notPushedSponsoredMessages != null) { notPushedSponsoredMessages.clear(); } - processNewMessages(res.messages); + processNewMessages(res.messages, false); } } @@ -23328,6 +23428,9 @@ private void rotateMotionBackgroundDrawable() { private ArrayList notPushedSponsoredMessages; private void processNewMessages(ArrayList arr) { + processNewMessages(arr, true); + } + private void processNewMessages(ArrayList arr, final boolean animatedFromBottom) { FileLog.d("processNewMessages " + arr.size() + " messages"); long currentUserId = getUserConfig().getClientUserId(); boolean updateChat = false; @@ -23335,7 +23438,7 @@ private void processNewMessages(ArrayList arr) { boolean isAd = false; if (chatListItemAnimator != null) { - chatListItemAnimator.setShouldAnimateEnterFromBottom(true); + chatListItemAnimator.setShouldAnimateEnterFromBottom(animatedFromBottom); } boolean notifiedSearch = false; @@ -23463,7 +23566,7 @@ private void processNewMessages(ArrayList arr) { messageObject.generateGameMessageText(null); } else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionPaymentSent) { messageObject.generatePaymentSentMessageText(null, false); - }else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionPaymentSentMe) { + } else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionPaymentSentMe) { messageObject.generatePaymentSentMessageText(null, true); } } @@ -23597,9 +23700,8 @@ private void processNewMessages(ArrayList arr) { } MessageObject lastActionSetChatThemeMessageObject = null; - int lastAdIndex = -1; + boolean addedAdUnder = false; for (int a = 0; a < arr.size(); a++) { - FileLog.d("processNewMessages 2. " + a + " out of " + arr.size()); MessageObject obj = arr.get(a); if (obj.scheduled != (chatMode == MODE_SCHEDULED)) { continue; @@ -23749,34 +23851,18 @@ private void processNewMessages(ArrayList arr) { } } if (isAd && sponsoredMessagesPostsBetween > 0) { - if (lastAdIndex < 0) { - placeToPaste = lastAdIndex = 0; - } else { - placeToPaste = lastAdIndex + 1; - int h = 0, interval = 0; - boolean good = false; - for (; placeToPaste < messages.size(); ++placeToPaste) { - MessageObject msg = messages.get(placeToPaste); - if (msg != null && !msg.isSponsored()) { - h += msg.getApproximateHeight(); - interval++; - } - if (interval > sponsoredMessagesPostsBetween && h > AndroidUtilities.displaySize.y) { - placeToPaste = Math.min(placeToPaste + 1, messages.size()); - good = true; - break; - } - } - if (!good || placeToPaste > messages.size()) { - if (notPushedSponsoredMessages == null) { - notPushedSponsoredMessages = new ArrayList<>(); - } - notPushedSponsoredMessages.add(obj); - continue; + placeToPaste = findAdPlace(); + if (placeToPaste < 0 || placeToPaste > messages.size()) { + if (notPushedSponsoredMessages == null) { + notPushedSponsoredMessages = new ArrayList<>(); } - lastAdIndex = placeToPaste; + notPushedSponsoredMessages.add(obj); + continue; } } + if (isAd && placeToPaste == 0) { + addedAdUnder = true; + } if (currentEncryptedChat != null && obj.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage && obj.messageOwner.media.webpage instanceof TLRPC.TL_webPageUrlPending) { if (webpagesToReload == null) { webpagesToReload = new HashMap<>(); @@ -24007,7 +24093,7 @@ private void processNewMessages(ArrayList arr) { } } else { if (child != null) { - chatLayoutManager.scrollToPositionWithOffset(lastVisible + 1, getScrollingOffsetForView(child)); + chatLayoutManager.scrollToPositionWithOffset(lastVisible + (addedAdUnder ? 1 : 0), getScrollingOffsetForView(child)); } } if (newMentionsCount != 0 && mentiondownButtonCounter != null) { @@ -24056,7 +24142,7 @@ private void processNewMessages(ArrayList arr) { updateReplyMessageHeader(true); if (!isAd && notPushedSponsoredMessages != null && !notPushedSponsoredMessages.isEmpty() && arr != notPushedSponsoredMessages) { - processNewMessages(notPushedSponsoredMessages); + processNewMessages(notPushedSponsoredMessages, false); } invalidatePremiumBlocked(); @@ -24186,6 +24272,11 @@ private void processDeletedMessages(ArrayList markAsDeletedMessages, lo if (selectedObject != null && obj == selectedObject || obj != null && selectedObjectGroup != null && selectedObjectGroup == groupedMessagesMap.get(obj.getGroupId())) { closeMenu(); } + if (PhotoViewer.isPlayingMessage(obj)) { + PhotoViewer.getInstance().closePhoto(false, false); + } else if (PhotoViewer.isPlayingMessageInPip(obj)) { + PhotoViewer.getPipInstance().destroyPhotoViewer(); + } if (loadIndex == 0) { if (pinnedMessageObjects.containsKey(mid)) { pinnedMessageObjects.remove(mid); @@ -24774,7 +24865,7 @@ private void showPollSolution(MessageObject messageObject, TLRPC.PollResults res CharSequence text; if (!results.solution_entities.isEmpty()) { text = new SpannableStringBuilder(results.solution); - text = Emoji.replaceEmoji(text, Theme.chat_msgBotButtonPaint.getFontMetricsInt(), AndroidUtilities.dp(13), false); + text = Emoji.replaceEmoji(text, Theme.chat_msgBotButtonPaint.getFontMetricsInt(), false); text = MessageObject.replaceAnimatedEmoji(text, results.solution_entities, Theme.chat_msgBotButtonPaint.getFontMetricsInt()); MessageObject.addEntitiesToText(text, results.solution_entities, false, true, true, false); } else { @@ -25451,6 +25542,7 @@ private void updateBottomOverlay() { bottomOverlayChatWaitsReply = false; bottomOverlayLinks = false; boolean forceNoBottom = false; + boolean showGiftButton = false; if (chatMode == MODE_DEFAULT && getDialogId() != getUserConfig().getClientUserId() && userInfo != null && userInfo.contact_require_premium && !getUserConfig().isPremium()) { bottomOverlayLinks = true; bottomOverlayChatText.setVisibility(View.GONE); @@ -25543,6 +25635,7 @@ private void updateBottomOverlay() { bottomOverlayChatText.setEnabled(true); } showBottomOverlayProgress(false, bottomOverlayProgress.getTag() != null); + showGiftButton = chatInfo != null && chatInfo.stargifts_available; } else if (forumTopic != null && forumTopic.closed) { if (!ChatObject.canManageTopic(currentAccount, currentChat, forumTopic)) { Drawable lock = getContext().getResources().getDrawable(R.drawable.msg_mini_lock2).mutate(); @@ -25614,6 +25707,7 @@ private void updateBottomOverlay() { if (currentChat != null && currentChat.gigagroup && !isReport() && chatMode == 0) { bottomOverlayImage.setVisibility(View.VISIBLE); + showGiftButton = false; } else { bottomOverlayImage.setVisibility(View.INVISIBLE); } @@ -25802,9 +25896,42 @@ public void onAnimationEnd(Animator animation) { chatActivityEnterView.setVisibility(View.VISIBLE); chatActivityEnterView.setBotInfo(botInfo); } + showGiftButton(showGiftButton && bottomOverlayChat.getVisibility() == View.VISIBLE, false); checkRaiseSensors(); } + private void showGiftButton(boolean show, boolean animated) { + if (getContext() == null) return; + final boolean wasShown = bottomGiftButton != null && bottomGiftButton.getAlpha() > 0.5f; + if (bottomGiftButton == null) { + bottomGiftButton = new ImageView(getContext()); + bottomGiftButton.setImageResource(R.drawable.input_gift_s); + bottomGiftButton.setScaleType(ImageView.ScaleType.CENTER); + bottomGiftButton.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_chat_fieldOverlayText), PorterDuff.Mode.SRC_IN)); + bottomOverlayChat.addView(bottomGiftButton, LayoutHelper.createFrame(48, 48, Gravity.RIGHT | Gravity.CENTER_VERTICAL)); + bottomGiftButton.setBackground(Theme.createSelectorDrawable(Theme.multAlpha(getThemedColor(Theme.key_chat_fieldOverlayText), .10f), Theme.RIPPLE_MASK_CIRCLE_20DP)); + bottomGiftButton.setOnClickListener(v -> { + MessagesController.getGlobalMainSettings().edit().putInt("channelgifthint", 3).apply(); + showDialog(new GiftSheet(getContext(), currentAccount, getDialogId(), null, null)); + }); + bottomGiftButton.setContentDescription(getString(R.string.Gift2ChannelSend)); + ScaleStateListAnimator.apply(bottomGiftButton); + } + AndroidUtilities.updateViewShow(bottomGiftButton, show, true, animated); + if (show && !wasShown && bottomGiftHintView == null && MessagesController.getGlobalMainSettings().getInt("channelgifthint", 0) < 2) { + bottomGiftHintView = new HintView2(getContext(), HintView2.DIRECTION_BOTTOM); + bottomGiftHintView.setPadding(dp(7.33f), 0, dp(7.33f), 0); + bottomGiftHintView.setMultilineText(false); + bottomGiftHintView.setText(getString(R.string.Gift2ChannelSendHint)); + bottomGiftHintView.setJoint(1, -24 + 7.33f); + contentView.addView(bottomGiftHintView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 100, Gravity.BOTTOM | Gravity.FILL_HORIZONTAL, 0, 0, 0, 51 - 8.66f)); + bottomGiftHintView.setOnHiddenListener(() -> AndroidUtilities.removeFromParent(bottomGiftHintView)); + bottomGiftHintView.show(); + MessagesController.getGlobalMainSettings().edit().putInt("channelgifthint", MessagesController.getGlobalMainSettings().getInt("channelgifthint", 0) + 1).apply(); + } + } + + private boolean shouldDisplaySwipeToLeftToReplyInForum() { return isForumInViewAsMessagesMode() && replyingMessageObject == null && !canSendMessageToGeneralTopic(); } @@ -25957,7 +26084,7 @@ public void onAnimationCancel(Animator animation) { alertViewAnimator.start(); } alertNameTextView.setText(name); - alertTextView.setText(Emoji.replaceEmoji(message.replace('\n', ' '), alertTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false)); + alertTextView.setText(Emoji.replaceEmoji(message.replace('\n', ' '), alertTextView.getPaint().getFontMetricsInt(), false)); if (hideAlertViewRunnable != null) { AndroidUtilities.cancelRunOnUIThread(hideAlertViewRunnable); } @@ -26273,7 +26400,7 @@ public void onAnimationCancel(Animator animation) { if (botButton instanceof TLRPC.TL_keyboardButtonBuy && pinnedMessageObject != null && MessageObject.getMedia(pinnedMessageObject.messageOwner) instanceof TLRPC.TL_messageMediaInvoice) { string = StarsIntroActivity.replaceStars(string); } - string = Emoji.replaceEmoji(string, buttonTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false); + string = Emoji.replaceEmoji(string, buttonTextView.getPaint().getFontMetricsInt(), false); buttonTextView.setText(string); final MessageObject buttonMessage = pinnedMessageObject; buttonTextView.setOnClickListener(e -> { @@ -26465,7 +26592,7 @@ public void onAnimationCancel(Animator animation) { mess = mess.replace('\n', ' '); pinnedText = mess; } else if (pinnedMessageObject.messageOwner.media instanceof TLRPC.TL_messageMediaGame) { - pinnedText = Emoji.replaceEmoji(pinnedMessageObject.messageOwner.media.game.title, messageTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false); + pinnedText = Emoji.replaceEmoji(pinnedMessageObject.messageOwner.media.game.title, messageTextView.getPaint().getFontMetricsInt(), false); } else if (!TextUtils.isEmpty(pinnedMessageObject.caption)) { String mess = pinnedMessageObject.caption.toString(); if (mess.length() > 150) { @@ -26473,7 +26600,7 @@ public void onAnimationCancel(Animator animation) { } mess = mess.replace('\n', ' '); pinnedText = mess; - pinnedText = Emoji.replaceEmoji(pinnedText, messageTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false); + pinnedText = Emoji.replaceEmoji(pinnedText, messageTextView.getPaint().getFontMetricsInt(), false); if (pinnedMessageObject != null && pinnedMessageObject.messageOwner != null) { pinnedText = pinnedMessageObject.replaceAnimatedEmoji(pinnedText, messageTextView.getPaint().getFontMetricsInt()); } @@ -26484,7 +26611,7 @@ public void onAnimationCancel(Animator animation) { } mess = mess.replace('\n', ' '); pinnedText = mess; - pinnedText = Emoji.replaceEmoji(pinnedText, messageTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false); + pinnedText = Emoji.replaceEmoji(pinnedText, messageTextView.getPaint().getFontMetricsInt(), false); if (pinnedMessageObject != null && pinnedMessageObject.messageOwner != null) { pinnedText = pinnedMessageObject.replaceAnimatedEmoji(pinnedText, messageTextView.getPaint().getFontMetricsInt()); } @@ -26872,6 +26999,7 @@ protected boolean createLayout(int width) { } private boolean shownRestartTopic, shownTranslateTopic; + private boolean shownBotVerification; private void updateTopPanel(boolean animated) { if (chatMode != 0) { return; @@ -26899,7 +27027,18 @@ private void updateTopPanel(boolean animated) { boolean chatWithAdminChannel = preferences.getBoolean("dialog_bar_chat_with_channel" + did, false); int chatWithAdminDate = preferences.getInt("dialog_bar_chat_with_date" + did, 0); boolean showAddMembersToGroup = preferences.getBoolean("dialog_bar_invite" + did, false); - TLRPC.EmojiStatus showEmojiStatusReport = currentUser != null && (showReport || showBlock) && !getMessagesController().premiumFeaturesBlocked() && (currentUser.emoji_status instanceof TLRPC.TL_emojiStatus || currentUser.emoji_status instanceof TLRPC.TL_emojiStatusUntil && ((TLRPC.TL_emojiStatusUntil) currentUser.emoji_status).until > (int) (System.currentTimeMillis() / 1000)) ? currentUser.emoji_status : null; + TLRPC.EmojiStatus showEmojiStatusReport = currentUser != null && (showReport || showBlock) ? DialogObject.filterEmojiStatus(currentUser.emoji_status) : null; + TL_bots.botVerification showBotVerificationReport = (show && (showReport || showBlock) || shownBotVerification || preferences.getBoolean("dialog_bar_botver" + did, true)) ? (userInfo != null && !UserObject.isUserSelf(currentUser) && userInfo.bot_verification != null ? userInfo.bot_verification : chatInfo != null && chatInfo.bot_verification != null ? chatInfo.bot_verification : null) : null; + if (showBotVerificationReport != null) { + if (!shownBotVerification) { + preferences.edit().putBoolean("dialog_bar_botver" + did, false).apply(); + } + shownBotVerification = true; + if (!show) { + showReport = showGeo = showShare = showBlock = showAdd = showArchive = showAddMembersToGroup = false; + } + show = true; + } boolean showRestartTopic = !isInPreviewMode() && forumTopic != null && forumTopic.closed && !forumTopic.hidden && ChatObject.canManageTopic(currentAccount, currentChat, forumTopic); boolean showTranslate = ( getUserConfig().isPremium() ? @@ -26911,7 +27050,7 @@ private void updateTopPanel(boolean animated) { if (showRestartTopic) { shownRestartTopic = true; } - if (showTranslate || showBizBot) { + if (showTranslate || showBizBot || showEmojiStatusReport != null) { shownTranslateTopic = true; } boolean showRestartTopic1 = (showRestartTopic || shownRestartTopic) && !(showReport || showBlock || showGeo); @@ -27072,6 +27211,7 @@ private void updateTopPanel(boolean animated) { if ((shownTranslateTopic || shownRestartTopic) && !show) { showReport = showGeo = showShare = showBlock = showAdd = showArchive = showAddMembersToGroup = false; showEmojiStatusReport = null; + showBotVerificationReport = null; show = true; } if (reportSpamButton != null) { @@ -27253,7 +27393,7 @@ public void onClick(View view) { if (chatWithAdminTextView != null) { chatWithAdminTextView.setVisibility(isChatWithAdmin ? View.VISIBLE : View.GONE); } - if (userBlocked || ((addToContactsButton == null || addToContactsButton.getVisibility() == View.GONE) && (reportSpamButton == null || reportSpamButton.getVisibility() == View.GONE) && (chatWithAdminTextView == null || chatWithAdminTextView.getVisibility() == View.GONE) && (restartTopicButton == null || restartTopicButton.getVisibility() == View.GONE) && (translateButton == null || translateButton.getVisibility() == View.GONE) && (bizBotButton == null || bizBotButton.getVisibility() == View.GONE))) { + if (userBlocked || (showBotVerificationReport == null && (addToContactsButton == null || addToContactsButton.getVisibility() == View.GONE) && (reportSpamButton == null || reportSpamButton.getVisibility() == View.GONE) && (chatWithAdminTextView == null || chatWithAdminTextView.getVisibility() == View.GONE) && (restartTopicButton == null || restartTopicButton.getVisibility() == View.GONE) && (translateButton == null || translateButton.getVisibility() == View.GONE) && (bizBotButton == null || bizBotButton.getVisibility() == View.GONE))) { show = false; } @@ -27263,16 +27403,17 @@ public void onClick(View view) { if (topChatPanelView == null) { return; } + emojiStatusSpamHint.resetEmojiColor(); emojiStatusSpamHint.setVisibility(View.VISIBLE); + emojiStatusSpamHint.setTextColor(getThemedColor(Theme.key_chat_topPanelMessage)); + emojiStatusSpamHint.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13.3f); topViewSeparator1.setVisibility(View.VISIBLE); topViewSeparator2.setVisibility(View.VISIBLE); SpannableStringBuilder text = new SpannableStringBuilder(LocaleController.getString(R.string.ReportSpamUserEmojiStatusHint)); SpannableString emoji = new SpannableString("x"); Long docid = null; - if (currentUser.emoji_status instanceof TLRPC.TL_emojiStatus) { - docid = ((TLRPC.TL_emojiStatus) currentUser.emoji_status).document_id; - } else if (currentUser.emoji_status instanceof TLRPC.TL_emojiStatusUntil && ((TLRPC.TL_emojiStatusUntil) currentUser.emoji_status).until > (int) (System.currentTimeMillis() / 1000)) { - docid = ((TLRPC.TL_emojiStatusUntil) currentUser.emoji_status).document_id; + if (DialogObject.getEmojiStatusDocumentId(currentUser.emoji_status) != 0) { + docid = DialogObject.getEmojiStatusDocumentId(currentUser.emoji_status); } if (docid != null) { AnimatedEmojiSpan span = new AnimatedEmojiSpan(docid, emojiStatusSpamHint.getPaint().getFontMetricsInt()); @@ -27305,6 +27446,35 @@ public void updateDrawState(@NonNull TextPaint ds) { topChatPanelHeight += AndroidUtilities.dp(4); emojiStatusSpamHint.setTranslationY(topChatPanelHeight); topChatPanelHeight += AndroidUtilities.dp(10) + emojiStatusSpamHint.getMeasuredHeight(); + } else if (showBotVerificationReport != null) { + createTopPanel(); + if (topChatPanelView == null) { + return; + } + topViewSeparator2.setVisibility(View.VISIBLE); + if ((restartTopicButton == null || restartTopicButton.getVisibility() != View.VISIBLE) && + (reportSpamButton == null || reportSpamButton.getVisibility() != View.VISIBLE) && + (addToContactsButton == null || addToContactsButton.getVisibility() != View.VISIBLE) && + (user == null || TextUtils.isEmpty(chatWithAdmin)) + ) { + topChatPanelHeight -= AndroidUtilities.dp(48); + topViewSeparator2.setVisibility(View.GONE); + closeReportSpam.setVisibility(View.GONE); + } + emojiStatusSpamHint.setVisibility(View.VISIBLE); + emojiStatusSpamHint.setTextColor(getThemedColor(Theme.key_chat_topPanelMessage)); + emojiStatusSpamHint.setEmojiColor(getThemedColor(Theme.key_chat_topPanelMessage)); + emojiStatusSpamHint.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13.3f); + topViewSeparator1.setVisibility(View.VISIBLE); + SpannableStringBuilder text = new SpannableStringBuilder("x"); + text.setSpan(new AnimatedEmojiSpan(showBotVerificationReport.icon, emojiStatusSpamHint.getPaint().getFontMetricsInt()), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + text.append(" "); + text.append(showBotVerificationReport.description); + emojiStatusSpamHint.setText(text); + emojiStatusSpamHint.measure(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.displaySize.x - AndroidUtilities.dp(50), View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(99999, View.MeasureSpec.AT_MOST)); + topChatPanelHeight += AndroidUtilities.dp(4); + emojiStatusSpamHint.setTranslationY(topChatPanelHeight); + topChatPanelHeight += AndroidUtilities.dp(10) + emojiStatusSpamHint.getMeasuredHeight(); } else { if (emojiStatusSpamHint != null) { emojiStatusSpamHint.setVisibility(View.GONE); @@ -27327,8 +27497,11 @@ public void updateDrawState(@NonNull TextPaint ds) { user != null && !TextUtils.isEmpty(chatWithAdmin) ) { topViewSeparator3.setVisibility(View.VISIBLE); + topViewSeparator3.setTranslationY(showTranslate ? 0 : -dp(48 - 36)); } else { - topChatPanelHeight -= AndroidUtilities.dp(48); + if (showBotVerificationReport == null) { + topChatPanelHeight -= AndroidUtilities.dp(48); + } topViewSeparator3.setVisibility(View.GONE); } if (showTranslate) { @@ -27998,7 +28171,7 @@ public void onPause() { } } - public void setResolvedChatLink(TLRPC.TL_account_resolvedBusinessChatLinks resolvedChatLink) { + public void setResolvedChatLink(TL_account.resolvedBusinessChatLinks resolvedChatLink) { this.resolvedChatLink = resolvedChatLink; } @@ -28833,7 +29006,7 @@ public void setAutoDeleteHistory(int time, int action) { icons.add(R.drawable.msg_block2); if (!getMessagesController().premiumFeaturesBlocked()) { - items.add(LocaleController.getString(R.string.RemoveAds)); + items.add(getString(R.string.RemoveAds)); options.add(OPTION_REMOVE_ADS); icons.add(R.drawable.msg_cancel); } @@ -28908,6 +29081,11 @@ public void setAutoDeleteHistory(int time, int action) { icons.add(R.drawable.menu_reply); } } + if (selectedObject != null && selectedObject.messageOwner != null && currentUser != null && !UserObject.isService(currentUser.id) && (selectedObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGift || selectedObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGiftUnique || selectedObject.messageOwner.action instanceof TLRPC.TL_messageActionGiftPremium)) { + items.add(selectedObject.isOutOwner() ? getString(R.string.SendAnotherGift) : formatString(R.string.SendGiftTo, UserObject.getForcedFirstName(currentUser))); + options.add(OPTION_GIFT); + icons.add(R.drawable.menu_gift); + } if (message.canDeleteMessage(chatMode == MODE_SCHEDULED, currentChat) && (threadMessageObjects == null || !threadMessageObjects.contains(message)) && !(message != null && message.messageOwner != null && message.messageOwner.action instanceof TLRPC.TL_messageActionTopicCreate)) { items.add(LocaleController.getString(chatMode == MODE_SAVED && threadMessageId != getUserConfig().getClientUserId() ? R.string.Remove : R.string.Delete)); options.add(OPTION_DELETE); @@ -29326,8 +29504,8 @@ public void setAutoDeleteHistory(int time, int action) { Rect rect = new Rect(); List availableReacts = getMediaDataController().getEnabledReactionsList(); - boolean isReactionsViewAvailable = !isSecretChat() && !isInScheduleMode() && currentUser == null && primaryMessage.hasReactions() && (!ChatObject.isChannel(currentChat) || currentChat.megagroup) && !availableReacts.isEmpty() && primaryMessage.messageOwner.reactions.can_see_list && !primaryMessage.isSecretMedia(); - boolean isReactionsAvailable; + final boolean isReactionsViewAvailable = !isSecretChat() && !isInScheduleMode() && currentUser == null && primaryMessage.hasReactions() && (!ChatObject.isChannel(currentChat) || currentChat.megagroup) && !availableReacts.isEmpty() && primaryMessage.messageOwner.reactions.can_see_list && !primaryMessage.isSecretMedia(); + final boolean isReactionsAvailable; if (message.isForwardedChannelPost()) { TLRPC.ChatFull chatInfo = getMessagesController().getChatFull(-message.getFromChatId()); if (chatInfo == null) { @@ -29338,14 +29516,11 @@ public void setAutoDeleteHistory(int time, int action) { } else { isReactionsAvailable = !message.isSecretMedia() && chatMode != MODE_QUICK_REPLIES && !isSecretChat() && !isInScheduleMode() && primaryMessage.isReactionsAvailable() && (chatInfo != null && (!(chatInfo.available_reactions instanceof TLRPC.TL_chatReactionsNone) || chatInfo.paid_reactions_available) || (chatInfo == null && !ChatObject.isChannel(currentChat)) || currentUser != null) && !availableReacts.isEmpty(); } - boolean showMessageSeen = !isReactionsViewAvailable && !isInScheduleMode() && currentChat != null && message.isOutOwner() && message.isSent() && !message.isEditing() && !message.isSending() && !message.isSendError() && !message.isContentUnread() && !message.isUnread() && (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - message.messageOwner.date < getMessagesController().chatReadMarkExpirePeriod) && (ChatObject.isMegagroup(currentChat) || !ChatObject.isChannel(currentChat)) && chatInfo != null && chatInfo.participants_count <= getMessagesController().chatReadMarkSizeThreshold && !(message.messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByRequest) && (v instanceof ChatMessageCell); - boolean showPrivateMessageSeen = !isReactionsViewAvailable && currentChat == null && currentEncryptedChat == null && (currentUser != null && !UserObject.isUserSelf(currentUser) && !UserObject.isReplyUser(currentUser) && !UserObject.isAnonymous(currentUser) && !currentUser.bot && !UserObject.isService(currentUser.id)) && (userInfo == null || !userInfo.read_dates_private) && !isInScheduleMode() && message.isOutOwner() && message.isSent() && !message.isEditing() && !message.isSending() && !message.isSendError() && !message.isContentUnread() && !message.isUnread() && (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - message.messageOwner.date < getMessagesController().pmReadDateExpirePeriod) && !(message.messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByRequest) && (v instanceof ChatMessageCell); - boolean showPrivateMessageEdit = (currentUser == null || !UserObject.isReplyUser(currentUser) && !UserObject.isAnonymous(currentUser)) && !isInScheduleMode() && message.isEdited() && !(message.messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByRequest) && (v instanceof ChatMessageCell); - boolean showPrivateMessageFwdOriginal = false && (currentUser == null || !UserObject.isReplyUser(currentUser) && !UserObject.isAnonymous(currentUser)) && !isInScheduleMode() && message.isForwarded() && !(message.messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByRequest) && (v instanceof ChatMessageCell); - boolean showSponsorInfo = selectedObject != null && selectedObject.isSponsored() && (selectedObject.sponsoredInfo != null || selectedObject.sponsoredAdditionalInfo != null || selectedObject.sponsoredUrl != null && !selectedObject.sponsoredUrl.startsWith("https://" + getMessagesController().linkPrefix)); - if (chatMode == MODE_SAVED) { - showMessageSeen = false; - } + final boolean showMessageSeen = !isReactionsViewAvailable && !isInScheduleMode() && currentChat != null && message.isOutOwner() && message.isSent() && !message.isEditing() && !message.isSending() && !message.isSendError() && !message.isContentUnread() && !message.isUnread() && (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - message.messageOwner.date < getMessagesController().chatReadMarkExpirePeriod) && (ChatObject.isMegagroup(currentChat) || !ChatObject.isChannel(currentChat)) && chatInfo != null && chatInfo.participants_count <= getMessagesController().chatReadMarkSizeThreshold && !(message.messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByRequest) && chatMode != MODE_SAVED && message.canSetReaction(); + final boolean showPrivateMessageSeen = !isReactionsViewAvailable && currentChat == null && currentEncryptedChat == null && (currentUser != null && !UserObject.isUserSelf(currentUser) && !UserObject.isReplyUser(currentUser) && !UserObject.isAnonymous(currentUser) && !currentUser.bot && !UserObject.isService(currentUser.id)) && (userInfo == null || !userInfo.read_dates_private) && !isInScheduleMode() && message.isOutOwner() && message.isSent() && !message.isEditing() && !message.isSending() && !message.isSendError() && !message.isContentUnread() && !message.isUnread() && (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - message.messageOwner.date < getMessagesController().pmReadDateExpirePeriod) && !(message.messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByRequest); + final boolean showPrivateMessageEdit = (currentUser == null || !UserObject.isReplyUser(currentUser) && !UserObject.isAnonymous(currentUser)) && !isInScheduleMode() && message.isEdited() && !(message.messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByRequest); + final boolean showPrivateMessageFwdOriginal = false && (currentUser == null || !UserObject.isReplyUser(currentUser) && !UserObject.isAnonymous(currentUser)) && !isInScheduleMode() && message.isForwarded() && !(message.messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByRequest); + final boolean showSponsorInfo = selectedObject != null && selectedObject.isSponsored() && (selectedObject.sponsoredInfo != null || selectedObject.sponsoredAdditionalInfo != null || selectedObject.sponsoredUrl != null && !selectedObject.sponsoredUrl.startsWith("https://" + getMessagesController().linkPrefix)); final boolean isReactionsAvailableFinal = isReactionsAvailable; int flags = 0; @@ -30226,12 +30401,20 @@ public boolean onTouch(View v, MotionEvent event) { @Override public void onReactionClicked(View v, ReactionsLayoutInBubble.VisibleReaction visibleReaction, boolean longpress, boolean addToRecent) { float x = 0, y = 0; - ChatMessageCell cell = findMessageCell(primaryMessage.getId(), true); - if (cell != null) { - ReactionsLayoutInBubble.ReactionButton btn = cell.reactionsLayoutInBubble.getReactionButton(visibleReaction); + BaseCell cell = findMessageCell(primaryMessage.getId(), true); + if (cell instanceof ChatMessageCell) { + final ChatMessageCell messageCell = (ChatMessageCell) cell; + final ReactionsLayoutInBubble.ReactionButton btn = messageCell.reactionsLayoutInBubble.getReactionButton(visibleReaction); if (btn != null) { - x = cell.reactionsLayoutInBubble.x + btn.x + btn.width / 2f; - y = cell.reactionsLayoutInBubble.y + btn.y + btn.height / 2f; + x = messageCell.reactionsLayoutInBubble.x + btn.x + btn.width / 2f; + y = messageCell.reactionsLayoutInBubble.y + btn.y + btn.height / 2f; + } + } else if (cell instanceof ChatActionCell) { + final ChatActionCell actionCell = (ChatActionCell) cell; + final ReactionsLayoutInBubble.ReactionButton btn = actionCell.reactionsLayoutInBubble.getReactionButton(visibleReaction); + if (btn != null) { + x = actionCell.reactionsLayoutInBubble.x + btn.x + btn.width / 2f; + y = actionCell.reactionsLayoutInBubble.y + btn.y + btn.height / 2f; } } if (visibleReaction != null && visibleReaction.isStar) { @@ -30365,7 +30548,9 @@ public void dismiss() { } ReactionsContainerLayout finalReactionsLayout1 = reactionsLayout; - reactionsLayout.setParentLayout(scrimPopupContainerLayout); + if (reactionsLayout != null) { + reactionsLayout.setParentLayout(scrimPopupContainerLayout); + } scrimPopupWindow = new ActionBarPopupWindow(scrimPopupContainerLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT) { @Override public void dismiss() { @@ -30777,8 +30962,8 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) { Runnable updateReactionRunnable; - private void showMultipleReactionsPromo(ChatMessageCell cell, ReactionsLayoutInBubble.VisibleReaction visibleReaction, int currentChosenReactions) { - if (SharedConfig.multipleReactionsPromoShowed || cell == null || cell.getMessageObject() == null || visibleReaction == null || getUserConfig().isPremium()) { + private void showMultipleReactionsPromo(View cell, ReactionsLayoutInBubble.VisibleReaction visibleReaction, int currentChosenReactions) { + if (SharedConfig.multipleReactionsPromoShowed || cell == null || visibleReaction == null || getUserConfig().isPremium()) { return; } if (currentChosenReactions == 1) { @@ -30803,7 +30988,7 @@ private void showMultipleReactionsPromo(ChatMessageCell cell, ReactionsLayoutInB } } - public void selectReaction(ChatMessageCell cell, MessageObject primaryMessage, ReactionsContainerLayout reactionsLayout, View fromView, float x, float y, ReactionsLayoutInBubble.VisibleReaction visibleReaction, boolean fromDoubleTap, boolean bigEmoji, boolean addToRecent, boolean withoutAnimation) { + public void selectReaction(View cell, MessageObject primaryMessage, ReactionsContainerLayout reactionsLayout, View fromView, float x, float y, ReactionsLayoutInBubble.VisibleReaction visibleReaction, boolean fromDoubleTap, boolean bigEmoji, boolean addToRecent, boolean withoutAnimation) { if (isInScheduleMode() || primaryMessage == null) { return; } @@ -30815,7 +31000,9 @@ public void selectReaction(ChatMessageCell cell, MessageObject primaryMessage, R } if (bigEmoji) { if (cell != null) { - cell.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + cell.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} } ArrayList reactors = null; if (primaryMessage != null && primaryMessage.messageOwner != null && primaryMessage.messageOwner.reactions != null) { @@ -30847,12 +31034,12 @@ public void selectReaction(ChatMessageCell cell, MessageObject primaryMessage, R return; } StarsController.PendingPaidReactions pending = StarsController.getInstance(currentAccount).sendPaidReaction(primaryMessage, ChatActivity.this, +1, true, true, null); - if (pending != null && cell != null) { - StarReactionsOverlay overlay = getStarReactionsOverlay(); - overlay.setMessageCell(cell); + if (pending != null && cell instanceof BaseCell) { + final StarReactionsOverlay overlay = getStarReactionsOverlay(); + overlay.setMessageCell((BaseCell) cell); pending.setOverlay(overlay); overlay.show(); - int[] loc = new int[2], loc2 = new int[2]; + final int[] loc = new int[2], loc2 = new int[2]; cell.getLocationInWindow(loc); overlay.getLocationInWindow(loc2); overlay.tap(loc[0] - loc2[0] + x, loc[1] - loc2[1] + y, false, true); @@ -30866,8 +31053,8 @@ public void selectReaction(ChatMessageCell cell, MessageObject primaryMessage, R } ReactionsEffectOverlay.removeCurrent(false); - int currentChosenReactions = primaryMessage.getChoosenReactions().size(); - boolean added = primaryMessage.selectReaction(visibleReaction, bigEmoji, fromDoubleTap); + final int currentChosenReactions = primaryMessage.getChoosenReactions().size(); + final boolean added = primaryMessage.selectReaction(visibleReaction, bigEmoji, fromDoubleTap); int messageIdForCell = primaryMessage.getId(); if (groupedMessagesMap.get(primaryMessage.getGroupId()) != null) { int flags = primaryMessage.shouldDrawReactionsInLayout() ? MessageObject.POSITION_FLAG_BOTTOM | MessageObject.POSITION_FLAG_LEFT : MessageObject.POSITION_FLAG_BOTTOM | MessageObject.POSITION_FLAG_RIGHT; @@ -30886,10 +31073,8 @@ public void selectReaction(ChatMessageCell cell, MessageObject primaryMessage, R ReactionsEffectOverlay.show(ChatActivity.this, reactionsLayout, cell, fromView, x, y, visibleReaction, currentAccount, reactionsLayout != null ? (bigEmoji ? ReactionsEffectOverlay.LONG_ANIMATION : ReactionsEffectOverlay.ONLY_MOVE_ANIMATION) : ReactionsEffectOverlay.SHORT_ANIMATION); } } - if (added) { - if (visibleReaction.emojicon != null) { - AndroidUtilities.makeAccessibilityAnnouncement(LocaleController.formatString("AccDescrYouReactedWith", R.string.AccDescrYouReactedWith, visibleReaction.emojicon)); - } + if (added && visibleReaction != null && visibleReaction.emojicon != null) { + AndroidUtilities.makeAccessibilityAnnouncement(LocaleController.formatString(R.string.AccDescrYouReactedWith, visibleReaction.emojicon)); } ArrayList visibleReactions = new ArrayList<>(); visibleReactions.addAll(primaryMessage.getChoosenReactions()); @@ -30904,7 +31089,7 @@ public void run() { if (fromDoubleTap) { doOnIdle(() -> { AndroidUtilities.runOnUIThread(() -> { - ChatMessageCell cell = findMessageCell(finalMessageIdForCell, true); + BaseCell cell = findMessageCell(finalMessageIdForCell, true); if (added) { ReactionsEffectOverlay.show(ChatActivity.this, reactionsLayout, cell, null, x, y, visibleReaction, currentAccount, ReactionsEffectOverlay.SHORT_ANIMATION); ReactionsEffectOverlay.startAnimation(); @@ -30992,20 +31177,55 @@ private void updateMessageAnimatedInternal(MessageObject message, boolean update } } - public ChatMessageCell findMessageCell(int id, boolean visibleForUser) { + public BaseCell findMessageCell(int id, boolean visibleForUser) { + if (chatListView == null) { + return null; + } + for (int i = 0, n = chatListView.getChildCount(); i < n; i++) { + View child = chatListView.getChildAt(i); + if (child instanceof ChatMessageCell && ((ChatMessageCell) child).getMessageObject().getId() == id) { + if (visibleForUser) { + float clipTop = chatListViewPaddingTop - chatListViewPaddingVisibleOffset - AndroidUtilities.dp(4); + if (child.getY() + child.getMeasuredHeight() < clipTop || child.getY() > chatListView.getMeasuredHeight() - blurredViewBottomOffset) { + return null; + } + } + return (ChatMessageCell) child; + } else if (child instanceof ChatActionCell && ((ChatActionCell) child).getMessageObject().getId() == id) { + if (visibleForUser) { + float clipTop = chatListViewPaddingTop - chatListViewPaddingVisibleOffset - AndroidUtilities.dp(4); + if (child.getY() + child.getMeasuredHeight() < clipTop || child.getY() > chatListView.getMeasuredHeight() - blurredViewBottomOffset) { + return null; + } + } + return (ChatActionCell) child; + } + } + return null; + } + + public View findCell(int id, boolean visibleForUser) { if (chatListView == null) { return null; } for (int i = 0, n = chatListView.getChildCount(); i < n; i++) { View child = chatListView.getChildAt(i); - if (chatListView.getChildAt(i) instanceof ChatMessageCell && ((ChatMessageCell) chatListView.getChildAt(i)).getMessageObject().getId() == id) { + if (child instanceof ChatMessageCell && ((ChatMessageCell) child).getMessageObject().getId() == id) { if (visibleForUser) { float clipTop = chatListViewPaddingTop - chatListViewPaddingVisibleOffset - AndroidUtilities.dp(4); if (child.getY() + child.getMeasuredHeight() < clipTop || child.getY() > chatListView.getMeasuredHeight() - blurredViewBottomOffset) { return null; } } - return (ChatMessageCell) chatListView.getChildAt(i); + return child; + } else if (child instanceof ChatActionCell && ((ChatActionCell) child).getMessageObject().getId() == id) { + if (visibleForUser) { + float clipTop = chatListViewPaddingTop - chatListViewPaddingVisibleOffset - AndroidUtilities.dp(4); + if (child.getY() + child.getMeasuredHeight() < clipTop || child.getY() > chatListView.getMeasuredHeight() - blurredViewBottomOffset) { + return null; + } + } + return child; } } return null; @@ -31556,6 +31776,10 @@ private void processSelectedOption(int option) { selectedObjectToEditCaption = null; break; } + case OPTION_GIFT: { + showDialog(new GiftSheet(getContext(), currentAccount, getDialogId(), null, null)); + break; + } case OPTION_PIN: { final int mid; if (selectedObjectGroup != null && !selectedObjectGroup.messages.isEmpty()) { @@ -31631,7 +31855,9 @@ private void processSelectedOption(int option) { bulletin.show(); View view = bulletin.getLayout(); view.postDelayed(() -> { - view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} }, 550); }); builder.setNegativeButton(LocaleController.getString(R.string.Cancel), null); @@ -31713,7 +31939,7 @@ private void processSelectedOption(int option) { ClipData clip = ClipData.newPlainText("label", exportedMessageLink.link); clipboard.setPrimaryClip(clip); if (BulletinFactory.canShowBulletin(ChatActivity.this)) { - BulletinFactory.of(ChatActivity.this).createCopyLinkBulletin(!isThreadChat() && exportedMessageLink.link.contains("/c/"), themeDelegate).show(); + BulletinFactory.of(ChatActivity.this).createCopyLinkBulletin(!isThreadChat() && exportedMessageLink.link.contains("/c/")).show(); } } catch (Exception e) { FileLog.e(e); @@ -32372,9 +32598,9 @@ private void updateVisibleRows(boolean suppressUpdateMessageObject) { highlightMessageQuoteFirst = false; highlightMessageQuoteFirstTime = 0; highlightMessageQuote = null; - cell.setCheckBoxVisible(threadMessageObjects == null || !threadMessageObjects.contains(messageObject), true); - int idx = messageObject.getDialogId() == dialog_id ? 0 : 1; - if (selectedMessagesIds[idx].indexOfKey(messageObject.getId()) >= 0) { + cell.setCheckBoxVisible(threadMessageObjects == null || messageObject == null || !threadMessageObjects.contains(messageObject), true); + int idx = messageObject == null || messageObject.getDialogId() == dialog_id ? 0 : 1; + if (messageObject != null && selectedMessagesIds[idx].indexOfKey(messageObject.getId()) >= 0) { setCellSelectionBackground(messageObject, cell, idx, true); selected = true; } else { @@ -32388,10 +32614,10 @@ private void updateVisibleRows(boolean suppressUpdateMessageObject) { cell.setChecked(false, false, true); } - if ((!cell.getMessageObject().deleted || cell.linkedChatId != linkedChatId) && !suppressUpdateMessageObject) { + if (messageObject != null && (!messageObject.deleted || cell.linkedChatId != linkedChatId) && !suppressUpdateMessageObject) { cell.setIsUpdating(true); cell.linkedChatId = chatInfo != null ? chatInfo.linked_chat_id : 0; - cell.setMessageObject(cell.getMessageObject(), cell.getCurrentMessagesGroup(), cell.isPinnedBottom(), cell.isPinnedTop()); + cell.setMessageObject(messageObject, cell.getCurrentMessagesGroup(), cell.isPinnedBottom(), cell.isPinnedTop()); cell.setIsUpdating(false); } if (cell != scrimView) { @@ -32413,7 +32639,7 @@ private void updateVisibleRows(boolean suppressUpdateMessageObject) { showNoQuoteAlert = false; } else if (chatMode == MODE_SEARCH && searchingHashtag != null && searchingQuery != null) { cell.setHighlightedText(searchingQuery); - } else if (searchItem != null && searchItemVisible && getMediaDataController().isMessageFound(messageObject.getId(), messageObject.getDialogId() == mergeDialogId) && getMediaDataController().getLastSearchQuery() != null) { + } else if (searchItem != null && searchItemVisible && messageObject != null && getMediaDataController().isMessageFound(messageObject.getId(), messageObject.getDialogId() == mergeDialogId) && getMediaDataController().getLastSearchQuery() != null) { cell.setHighlightedText(getMediaDataController().getLastSearchQuery()); } else { cell.setHighlightedText(null); @@ -34245,6 +34471,11 @@ public void didOpenPremiumGift(ChatActionCell cell, TLRPC.TL_premiumGiftOption g } } + @Override + public void didPressReaction(ChatActionCell cell, TLRPC.ReactionCount reaction, boolean longpress, float x, float y) { + ChatActivity.this.didPressReaction(cell, reaction, longpress, x, y); + } + @Override public void forceUpdate(ChatActionCell cell, boolean anchorScroll) { if (cell == null) return; @@ -34394,8 +34625,8 @@ public void didClickImage(ChatActionCell cell) { PhotoViewer.getInstance().openPhotoForSelect(photos, 0, PhotoViewer.SELECT_TYPE_AVATAR, false, new PhotoViewer.EmptyPhotoViewerProvider() { @Override - public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { - return photoViewerProvider.getPlaceForPhoto(message, fileLocation, index, needPreview); + public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview, boolean closing) { + return photoViewerProvider.getPlaceForPhoto(message, fileLocation, index, needPreview, false); } @Override @@ -36058,7 +36289,7 @@ public void didPressSideButton(ChatMessageCell cell) { arrayList.add(messageObject); } final boolean includeStory = getMessagesController().storiesEnabled() && StoryEntry.canRepostMessage(messageObject); - showDialog(new ShareAlert(getContext(), ChatActivity.this, arrayList, null, null, ChatObject.isChannel(currentChat), null, null, false, false, includeStory, themeDelegate) { + showDialog(new ShareAlert(getContext(), ChatActivity.this, arrayList, null, null, ChatObject.isChannel(currentChat), null, null, false, false, includeStory, null, themeDelegate) { { includeStoryFromMessage = includeStory; } @Override public void dismissInternal() { @@ -36234,10 +36465,14 @@ public void didPressSponsoredInfo(ChatMessageCell cell, float x, float y) { } @Override - public void didPressUserStatus(ChatMessageCell cell, TLRPC.User user, TLRPC.Document document) { + public void didPressUserStatus(ChatMessageCell cell, TLRPC.User user, TLRPC.Document document, String giftSlug) { if (cell == null) { return; } + if (!TextUtils.isEmpty(giftSlug)) { + Browser.openUrl(getContext(), "https://" + getMessagesController().linkPrefix + "/nft/" + giftSlug); + return; + } PremiumPreviewBottomSheet premiumPreviewBottomSheet = new PremiumPreviewBottomSheet(ChatActivity.this, currentAccount, user, themeDelegate); int[] coords = new int[2]; cell.getLocationOnScreen(coords); @@ -36675,321 +36910,7 @@ public void didLongPressBotButton(ChatMessageCell cell, TLRPC.KeyboardButton but @Override public void didPressReaction(ChatMessageCell cell, TLRPC.ReactionCount reaction, boolean longpress, float x, float y) { - if (getParentActivity() == null) { - return; - } - if (savedMessagesTagHint != null && savedMessagesTagHint.shown()) { - savedMessagesTagHint.hide(); - } - if (videoConversionTimeHint != null && videoConversionTimeHint.shown()) { - videoConversionTimeHint.hide(); - } - if (getUserConfig().getClientUserId() == getDialogId() && cell.areTags() && !getUserConfig().isPremium()) { - if (longpress) return; - new PremiumFeatureBottomSheet(ChatActivity.this, PremiumPreviewFragment.PREMIUM_FEATURE_SAVED_TAGS, true).show(); - return; - } - if (longpress && reaction.reaction instanceof TLRPC.TL_reactionPaid) { - cell.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); - MessageObject messageObject = cell.getPrimaryMessageObject(); - if (messageObject == null) return; - ArrayList reactors = null; - if (messageObject.messageOwner != null && messageObject.messageOwner.reactions != null) { - reactors = messageObject.messageOwner.reactions.top_reactors; - } - StarsController.getInstance(currentAccount).commitPaidReaction(); - TLRPC.ChatFull chatFull = getMessagesController().getChatFull(-StarsController.MessageId.from(messageObject).did); - final StarsReactionsSheet sheet = new StarsReactionsSheet(getContext(), currentAccount, dialog_id, ChatActivity.this, messageObject, reactors, chatFull == null || chatFull.paid_reactions_available, themeDelegate); - sheet.setMessageCell(ChatActivity.this, messageObject.getId(), findMessageCell(messageObject.getId(), true)); - sheet.show(); - return; - } - if (longpress || cell.areTags() && (isInsideContainer || searchingReaction != null && searchingReaction.isSame(reaction.reaction))) { - if (/*!ChatObject.isChannelAndNotMegaGroup(currentChat) || dialog_id >= 0*/ true) { - cell.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); - FrameLayout scrimPopupContainerLayout = new FrameLayout(getParentActivity()) { - @Override - public boolean dispatchKeyEvent(KeyEvent event) { - if (event.getKeyCode() == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) { - closeMenu(); - } - return super.dispatchKeyEvent(event); - } - - @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - int h = Math.min(MeasureSpec.getSize(heightMeasureSpec), AndroidUtilities.dp(ReactedUsersListView.VISIBLE_ITEMS * ReactedUsersListView.ITEM_HEIGHT_DP)); - if (h == 0) { - h = AndroidUtilities.dp(ReactedUsersListView.VISIBLE_ITEMS * ReactedUsersListView.ITEM_HEIGHT_DP); - } - super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(h, MeasureSpec.AT_MOST)); - } - - Path path = new Path(); - @Override - protected void dispatchDraw(Canvas canvas) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - canvas.save(); - path.rewind(); - path.addRoundRect(AndroidUtilities.dp(8), AndroidUtilities.dp(8), getWidth() - AndroidUtilities.dp(8), getHeight() - AndroidUtilities.dp(8), AndroidUtilities.dp(6), AndroidUtilities.dp(6), Path.Direction.CW); - canvas.clipPath(path); - super.dispatchDraw(canvas); - canvas.restore(); - } else { - super.dispatchDraw(canvas); - } - } - }; - scrimPopupContainerLayout.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT)); - - final ReactionsLayoutInBubble.ReactionButton button = cell.getReactionButton(ReactionsLayoutInBubble.VisibleReaction.fromTL(reaction.reaction)); - if (button == null) { - return; - } - - Rect backgroundPaddings = new Rect(); - Drawable shadowDrawable2 = ContextCompat.getDrawable(getParentActivity(), R.drawable.popup_fixed_alert).mutate(); - shadowDrawable2.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_actionBarDefaultSubmenuBackground), PorterDuff.Mode.MULTIPLY)); - shadowDrawable2.getPadding(backgroundPaddings); - scrimPopupContainerLayout.setBackground(shadowDrawable2); - - MessageObject messageObject = cell.getPrimaryMessageObject(); - float bottom = cell.reactionsLayoutInBubble.y + button.y + AndroidUtilities.dp(28); - float left = cell.reactionsLayoutInBubble.x + button.x; - int[] loc = new int[2]; - cell.getLocationInWindow(loc); - boolean forceBottom = false; - final boolean tags = getUserConfig().getClientUserId() == getDialogId() && !getMessagesController().getSavedMessagesController().unsupported; - if (tags) { - MessagesController.getGlobalMainSettings().edit().putInt("savedsearchtaghint", 1).apply(); - - ActionBarPopupWindow.ActionBarPopupWindowLayout popupLayout = new ActionBarPopupWindow.ActionBarPopupWindowLayout(getParentActivity(), 0, getResourceProvider(), 0); - if (getUserConfig().isPremium()) { - ActionBarMenuSubItem editTag = new ActionBarMenuSubItem(getParentActivity(), false, false); - editTag.setTextAndIcon(LocaleController.getString(TextUtils.isEmpty(getMessagesController().getSavedTagName(reaction.reaction)) ? R.string.SavedTagLabelTag : R.string.SavedTagRenameTag), R.drawable.menu_tag_rename); - editTag.setMinimumWidth(160); - editTag.setOnClickListener(view -> { - closeMenu(); - SearchTagsList.openRenameTagAlert(getContext(), currentAccount, reaction.reaction, themeDelegate, false); - }); - popupLayout.addView(editTag); - } - if (!isInsideContainer && (searchingReaction == null || !searchingReaction.isSame(reaction.reaction)) && (chatMode == 0 || chatMode == MODE_SAVED)) { - ActionBarMenuSubItem filterByTag = new ActionBarMenuSubItem(getParentActivity(), false, false); - filterByTag.setTextAndIcon(LocaleController.getString(R.string.SavedTagFilterByTag), R.drawable.menu_tag_filter); - filterByTag.setMinimumWidth(160); - filterByTag.setOnClickListener(view -> { - closeMenu(); - openSearchWithText(""); - if (actionBarSearchTags != null) { - actionBarSearchTags.setChosen(ReactionsLayoutInBubble.VisibleReaction.fromTL(reaction.reaction), true); - } - }); - popupLayout.addView(filterByTag); - } - ActionBarMenuSubItem removeTag = new ActionBarMenuSubItem(getParentActivity(), false, false); - removeTag.setTextAndIcon(LocaleController.getString(R.string.SavedTagRemoveTag), R.drawable.menu_tag_delete); - removeTag.setMinimumWidth(160); - removeTag.setOnClickListener(view -> { - pressedReaction(cell, reaction, 0, 0); - }); - removeTag.setColors(Theme.getColor(Theme.key_color_red), Theme.getColor(Theme.key_color_red)); - popupLayout.addView(removeTag); - scrimPopupContainerLayout.addView(popupLayout); - } else if (messageObject != null && messageObject.messageOwner != null && messageObject.messageOwner.reactions != null && messageObject.messageOwner.reactions.can_see_list || dialog_id >= 0) { - if (reaction.reaction instanceof TLRPC.TL_reactionCustomEmoji) { - button.stopAnimation(); - } - scrimPopupContainerLayout.addView(new ReactedUsersListView(getParentActivity(), themeDelegate, currentAccount, messageObject, reaction, false, false) - .setOnCustomEmojiSelectedListener((reactedUsersListView1, customEmojiStickerSets) -> { - EmojiPacksAlert alert = new EmojiPacksAlert(ChatActivity.this, getParentActivity(), themeDelegate, customEmojiStickerSets) { - @Override - public void dismiss() { - super.dismiss(); - dimBehindView(false); - } - }; - alert.setCalcMandatoryInsets(isKeyboardVisible()); - alert.setDimBehind(false); - closeMenu(false); - showDialog(alert); - }) - .setOnProfileSelectedListener((view1, userId, messagePeerReaction) -> { - Bundle args = new Bundle(); - if (userId > 0) { - args.putLong("user_id", userId); - } else { - args.putLong("chat_id", -userId); - } - args.putInt("report_reaction_message_id", cell.getMessageObject().getId()); - args.putLong("report_reaction_from_dialog_id", dialog_id); - ProfileActivity fragment = new ProfileActivity(args); - presentFragment(fragment); - closeMenu(); - }), LayoutHelper.createFrame(240, LayoutHelper.WRAP_CONTENT)); - } else if (reaction.reaction instanceof TLRPC.TL_reactionCustomEmoji) { - TLRPC.TL_reactionCustomEmoji customEmoji = (TLRPC.TL_reactionCustomEmoji) reaction.reaction; - TLRPC.InputStickerSet inputStickerSet = AnimatedEmojiDrawable.getDocumentFetcher(currentAccount).findStickerSet(customEmoji.document_id); - if (inputStickerSet != null) { - button.stopAnimation(); - ArrayList arr = new ArrayList(); - arr.add(inputStickerSet); - MessageContainsEmojiButton setButton = new MessageContainsEmojiButton(currentAccount, getContext(), themeDelegate, arr, MessageContainsEmojiButton.SINGLE_REACTION_TYPE); - setButton.setOnClickListener(v -> { - new EmojiPacksAlert(new BaseFragment() { - @Override - public int getCurrentAccount() { - return currentAccount; - } - - @Override - public Context getContext() { - return ChatActivity.this.getContext(); - } - - @Override - public Theme.ResourcesProvider getResourceProvider() { - return themeDelegate; - } - }, getContext(), themeDelegate, arr).show(); - closeMenu(); - }); - scrimPopupContainerLayout.addView(setButton, LayoutHelper.createFrame(240, LayoutHelper.WRAP_CONTENT)); - forceBottom = true; - } else { - scrimPopupContainerLayout.setVisibility(View.GONE); - } - } else { - scrimPopupContainerLayout.setVisibility(View.GONE); - } - - scrimPopupWindow = new ActionBarPopupWindow(scrimPopupContainerLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT) { - @Override - public void dismiss() { - super.dismiss(); - if (scrimPopupWindow != this) { - return; - } - scrimPopupWindow = null; - menuDeleteItem = null; - scrimPopupWindowItems = null; - chatLayoutManager.setCanScrollVertically(true); - if (scrimPopupWindowHideDimOnDismiss) { - dimBehindView(false); - } else { - scrimPopupWindowHideDimOnDismiss = true; - } - if (chatActivityEnterView != null && chatActivityEnterView.getEditField() != null) { - chatActivityEnterView.getEditField().setAllowDrawCursor(true); - } - } - }; - scrimPopupWindow.setPauseNotifications(true); - scrimPopupWindow.setDismissAnimationDuration(220); - scrimPopupWindow.setOutsideTouchable(true); - scrimPopupWindow.setClippingEnabled(true); - scrimPopupWindow.setAnimationStyle(R.style.PopupContextAnimation); - scrimPopupWindow.setFocusable(true); - scrimPopupContainerLayout.measure(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST)); - scrimPopupWindow.setInputMethodMode(ActionBarPopupWindow.INPUT_METHOD_NOT_NEEDED); - scrimPopupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED); - scrimPopupWindow.getContentView().setFocusableInTouchMode(true); - - int totalHeight = contentView.getHeight(); - int height = scrimPopupContainerLayout.getMeasuredHeight(); - int keyboardHeight = contentView.measureKeyboardHeight(); - if (keyboardHeight > AndroidUtilities.dp(20)) { - totalHeight += keyboardHeight; - } - - int popupX = (int) (left - AndroidUtilities.dp(28)); - popupX = Math.max(AndroidUtilities.dp(6), Math.min(chatListView.getMeasuredWidth() - AndroidUtilities.dp(6) - scrimPopupContainerLayout.getMeasuredWidth(), popupX)); - if (AndroidUtilities.isTablet()) { - int[] location = new int[2]; - fragmentView.getLocationInWindow(location); - popupX += location[0]; - } - int popupY; - if (height < totalHeight) { - float cellY = chatListView.getY() + cell.getY(); - if (isInsideContainer) { - int[] location = new int[2]; - cell.getLocationInWindow(location); - cellY = location[1]; - } - if (height < totalHeight / 2f && cellY + cell.reactionsLayoutInBubble.y + button.y > totalHeight / 2f && !forceBottom) { - scrimViewReactionOffset = -(height - dp(12)); - popupY = (int) (cellY + cell.reactionsLayoutInBubble.y + button.y - height); - } else { - scrimViewReactionOffset = 0; - popupY = (int) (cellY + cell.reactionsLayoutInBubble.y + button.y + button.height); - } - } else { - scrimViewReactionOffset = 0; - popupY = inBubbleMode ? 0 : AndroidUtilities.statusBarHeight; - } - if (scrimPopupContainerLayout.getVisibility() != View.VISIBLE) { - scrimViewReactionOffset = 0; - } - scrimPopupWindow.showAtLocation(chatListView, Gravity.LEFT | Gravity.TOP, scrimPopupX = popupX, scrimPopupY = popupY); - - chatListView.stopScroll(); - chatLayoutManager.setCanScrollVertically(false); - scrimViewReaction = reaction.reaction.hashCode(); - scrimViewReactionAnimated = reaction.reaction instanceof TLRPC.TL_reactionCustomEmoji && LiteMode.isEnabled(LiteMode.FLAG_ANIMATED_EMOJI_KEYBOARD); - dimBehindView(cell, !tags, true); - hideHints(false); - if (topUndoView != null) { - topUndoView.hide(true, 1); - } - if (undoView != null) { - undoView.hide(true, 1); - } - if (chatActivityEnterView != null && chatActivityEnterView.getEditField() != null) { - chatActivityEnterView.getEditField().setAllowDrawCursor(false); - } - } - } else if (cell.areTags() && (chatMode == 0 || chatMode == MODE_SAVED)) { - closeMenu(); - openSearchWithText(""); - if (actionBarSearchTags != null) { - actionBarSearchTags.setChosen(ReactionsLayoutInBubble.VisibleReaction.fromTL(reaction.reaction), true); - } - } else if (reaction != null) { - pressedReaction(cell, reaction, x, y); - } - } - - private void pressedReaction(ChatMessageCell cell, TLRPC.ReactionCount reaction, float x, float y) { - ReactionsLayoutInBubble.VisibleReaction visibleReaction = ReactionsLayoutInBubble.VisibleReaction.fromTL(reaction.reaction); - MessageObject messageObject = cell.getPrimaryMessageObject(); - selectReaction(cell, cell.getPrimaryMessageObject(), null, null, x, y, visibleReaction,false, false, false, false); - if (messageObject != null & messageObject.messageOwner != null) { - if (chatAdapter.isFiltered) { - MessageObject realMessage = messagesDict[0].get(messageObject.getId()); - if (realMessage != null && realMessage.messageOwner != null) { - realMessage.messageOwner.reactions = messageObject.messageOwner.reactions; - } - } else if (!chatAdapter.isFiltered && searchingReaction != null) { - updateFilteredMessages(false); - } - } - if (chatAdapter.isFiltered && !cell.getPrimaryMessageObject().hasReaction(searchingReaction)) { - final MessageObject msg = cell.getPrimaryMessageObject(); - final MessageObject.GroupedMessages groupedMessages = getValidGroupedMessage(msg); - if (groupedMessages != null) { - for (int i = 0; i < groupedMessages.messages.size(); ++i) { - MessageObject gmsg = groupedMessages.messages.get(i); - getMediaDataController().removeMessageFromResults(gmsg.getId()); - } - } else { - getMediaDataController().removeMessageFromResults(msg.getId()); - } - if (messagesSearchAdapter != null) { - messagesSearchAdapter.notifyDataSetChanged(); - } - updateFilteredMessages(true); - } + ChatActivity.this.didPressReaction(cell, reaction, longpress, x, y); } @@ -37096,13 +37017,21 @@ public void didPressMoreChannelRecommendations(ChatMessageCell cell) { } @Override - public void didPressChannelRecommendation(ChatMessageCell cell, TLRPC.Chat chat, boolean longPress) { - if (getContext() == null || chat == null || parentLayout != null && parentLayout.isInPreviewMode()) { + public void didPressChannelRecommendation(ChatMessageCell cell, TLObject peer, boolean longPress) { + if (getContext() == null || peer == null || parentLayout != null && parentLayout.isInPreviewMode()) { return; } Bundle args = new Bundle(); - args.putLong("chat_id", chat.id); - if (longPress) { + if (peer instanceof TLRPC.Chat) { + args.putLong("chat_id", ((TLRPC.Chat) peer).id); + } else if (peer instanceof TLRPC.User) { + args.putLong("user_id", ((TLRPC.User) peer).id); + } else { + return; + } + if (longPress && peer instanceof TLRPC.Chat) { + final TLRPC.Chat chat = (TLRPC.Chat) peer; + ActionBarPopupWindow.ActionBarPopupWindowLayout previewMenu = new ActionBarPopupWindow.ActionBarPopupWindowLayout(getContext(), R.drawable.popup_fixed_alert, getResourceProvider(), ActionBarPopupWindow.ActionBarPopupWindowLayout.FLAG_SHOWN_FROM_BOTTOM); previewMenu.setBackgroundColor(getThemedColor(Theme.key_actionBarDefaultSubmenuBackground)); @@ -37683,6 +37612,10 @@ public void end(boolean replaced) { logSponsoredClicked(message, true, false); } } + if (message.getDuration() > 0 && message.getVideoStartsTimestamp() > 0) { + final int timestamp = message.getVideoStartsTimestamp(); + message.forceSeekTo = (float) (timestamp / message.getDuration()); + } openPhotoViewerForMessage(cell, message); } else if (message.type == MessageObject.TYPE_VIDEO) { sendSecretMessageRead(message, true); @@ -37809,7 +37742,7 @@ public void end(boolean replaced) { }; LaunchActivity.instance.checkAppUpdate(true, progressDialogCurrent); } - } else if (BuildVars.isHuaweiStoreApp()){ + } else if (BuildVars.isHuaweiStoreApp()) { Browser.openUrl(getContext(), BuildVars.HUAWEI_STORE_URL); } else { Browser.openUrl(getContext(), BuildVars.PLAYSTORE_APP_URL); @@ -37822,6 +37755,31 @@ public void end(boolean replaced) { return; } ChatActivity.this.createArticleViewer(false).open(messageObject); + } else if (messageObject.messageOwner.media != null && messageObject.messageOwner.media.webpage != null && !TextUtils.isEmpty(messageObject.messageOwner.media.webpage.url)) { + final String url = messageObject.messageOwner.media.webpage.url; + final String host = AndroidUtilities.getHostAuthority(url); + if (!openLinkInternally(url, cell, null, messageObject.getId(), PROGRESS_INSTANT)) { + if (progressDialogCurrent != null) { + progressDialogCurrent.cancel(true); + } + progressDialogCurrent = cell == null || cell.getMessageObject() == null ? null : new Browser.Progress() { + @Override + public void init() { + progressDialogAtMessageId = cell.getMessageObject().getId(); + progressDialogAtMessageType = PROGRESS_INSTANT; + progressDialogLinkSpan = null; + cell.invalidate(); + } + + @Override + public void end(boolean replaced) { + if (!replaced) { + AndroidUtilities.runOnUIThread(ChatActivity.this::resetProgressDialogLoading, 250); + } + } + }; + Browser.openUrl(getParentActivity(), Uri.parse(url), true, false, false, progressDialogCurrent, null, false, true, false); + } } } else if (type == ChatMessageCell.INSTANT_BUTTON_TYPE_CONTACT_VIEW) { long uid = messageObject.messageOwner.media.user_id; @@ -38083,7 +38041,9 @@ public void onDiceFinished() { return; } fireworksOverlay.start(); - fireworksOverlay.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + fireworksOverlay.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {}; } @Override @@ -38560,6 +38520,10 @@ public ArrayList getThemeDescriptions() { if (translateButton != null) { translateButton.updateColors(); } + if (bottomGiftButton != null) { + bottomGiftButton.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_featuredStickers_addButton), PorterDuff.Mode.SRC_IN)); + bottomGiftButton.setBackground(Theme.createSelectorDrawable(Theme.multAlpha(getThemedColor(Theme.key_featuredStickers_addButton), .10f), Theme.RIPPLE_MASK_CIRCLE_20DP)); + } }; ArrayList themeDescriptions = new ArrayList<>(); @@ -40295,7 +40259,7 @@ public void updateClip(int[] clip) { clip[1] = chatListView.getMeasuredHeight() - (chatListView.getPaddingBottom() - AndroidUtilities.dp(3)); } } - + private void updateVisibleWallpaperActions() { if (chatListView != null && chatAdapter != null) { for (int i = 0; i < chatListView.getChildCount(); ++i) { @@ -40688,7 +40652,7 @@ public void didLongPressUsername(ChatMessageCell cell, CharacterStyle link, Stri showDialog(dialog); }; if (true || BuildVars.DEBUG_PRIVATE_VERSION) { - TLRPC.TL_account_checkUsername req2 = new TLRPC.TL_account_checkUsername(); + TL_account.checkUsername req2 = new TL_account.checkUsername(); req2.username = username; int reqId2 = getConnectionsManager().sendRequest(req2, (res2, err2) -> AndroidUtilities.runOnUIThread(() -> { final boolean selling = err2 != null && "USERNAME_PURCHASE_AVAILABLE".equals(err2.text); @@ -41026,6 +40990,9 @@ private void gotChatInfo() { StarsController.getInstance(currentAccount).getBalance(); } } + if (chatInfo != null && chatInfo.bot_verification != null) { + updateTopPanel(true); + } } @Override @@ -41038,4 +41005,452 @@ public int getHashtagTabsHeight() { if (chatActivity.hashtagSearchTabs == null) return 0; return chatActivity.hashtagSearchTabs.getCurrentHeight(); } + + public void didPressReaction(View cell, TLRPC.ReactionCount reaction, boolean longpress, float x, float y) { + if (getParentActivity() == null) { + return; + } + if (savedMessagesTagHint != null && savedMessagesTagHint.shown()) { + savedMessagesTagHint.hide(); + } + if (videoConversionTimeHint != null && videoConversionTimeHint.shown()) { + videoConversionTimeHint.hide(); + } + MessageObject messageObject; + if (cell instanceof ChatMessageCell) { + messageObject = ((ChatMessageCell) cell).getPrimaryMessageObject(); + } else if (cell instanceof ChatActionCell) { + messageObject = ((ChatActionCell) cell).getMessageObject(); + } else { + return; + } + if (messageObject == null) return; + if (getUserConfig().getClientUserId() == getDialogId() && messageObject.areTags() && !getUserConfig().isPremium()) { + if (longpress) return; + new PremiumFeatureBottomSheet(ChatActivity.this, PremiumPreviewFragment.PREMIUM_FEATURE_SAVED_TAGS, true).show(); + return; + } + if (longpress && reaction.reaction instanceof TLRPC.TL_reactionPaid) { + cell.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + ArrayList reactors = null; + if (messageObject.messageOwner != null && messageObject.messageOwner.reactions != null) { + reactors = messageObject.messageOwner.reactions.top_reactors; + } + StarsController.getInstance(currentAccount).commitPaidReaction(); + TLRPC.ChatFull chatFull = getMessagesController().getChatFull(-StarsController.MessageId.from(messageObject).did); + final StarsReactionsSheet sheet = new StarsReactionsSheet(getContext(), currentAccount, dialog_id, ChatActivity.this, messageObject, reactors, chatFull == null || chatFull.paid_reactions_available, themeDelegate); + sheet.setMessageCell(ChatActivity.this, messageObject.getId(), findMessageCell(messageObject.getId(), true)); + sheet.show(); + return; + } + if (longpress || messageObject.areTags() && (isInsideContainer || searchingReaction != null && searchingReaction.isSame(reaction.reaction))) { + cell.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + FrameLayout scrimPopupContainerLayout = new FrameLayout(getParentActivity()) { + @Override + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getKeyCode() == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) { + closeMenu(); + } + return super.dispatchKeyEvent(event); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + int h = Math.min(MeasureSpec.getSize(heightMeasureSpec), AndroidUtilities.dp(ReactedUsersListView.VISIBLE_ITEMS * ReactedUsersListView.ITEM_HEIGHT_DP)); + if (h == 0) { + h = AndroidUtilities.dp(ReactedUsersListView.VISIBLE_ITEMS * ReactedUsersListView.ITEM_HEIGHT_DP); + } + super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(h, MeasureSpec.AT_MOST)); + } + + Path path = new Path(); + @Override + protected void dispatchDraw(Canvas canvas) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + canvas.save(); + path.rewind(); + path.addRoundRect(AndroidUtilities.dp(8), AndroidUtilities.dp(8), getWidth() - AndroidUtilities.dp(8), getHeight() - AndroidUtilities.dp(8), AndroidUtilities.dp(6), AndroidUtilities.dp(6), Path.Direction.CW); + canvas.clipPath(path); + super.dispatchDraw(canvas); + canvas.restore(); + } else { + super.dispatchDraw(canvas); + } + } + }; + scrimPopupContainerLayout.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT)); + + final ReactionsLayoutInBubble.VisibleReaction reactionObj = ReactionsLayoutInBubble.VisibleReaction.fromTL(reaction.reaction); + ReactionsLayoutInBubble.ReactionButton button = null; + ReactionsLayoutInBubble reactionsLayoutInBubble; + if (cell instanceof ChatMessageCell) { + reactionsLayoutInBubble = ((ChatMessageCell) cell).reactionsLayoutInBubble; + button = reactionsLayoutInBubble.getReactionButton(reactionObj); + } else if (cell instanceof ChatActionCell) { + reactionsLayoutInBubble = ((ChatActionCell) cell).reactionsLayoutInBubble; + button = reactionsLayoutInBubble.getReactionButton(reactionObj); + } else return; + if (button == null) { + return; + } + + Rect backgroundPaddings = new Rect(); + Drawable shadowDrawable2 = ContextCompat.getDrawable(getParentActivity(), R.drawable.popup_fixed_alert).mutate(); + shadowDrawable2.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_actionBarDefaultSubmenuBackground), PorterDuff.Mode.MULTIPLY)); + shadowDrawable2.getPadding(backgroundPaddings); + scrimPopupContainerLayout.setBackground(shadowDrawable2); + + float bottom = reactionsLayoutInBubble.y + button.y + AndroidUtilities.dp(28); + float left = reactionsLayoutInBubble.x + button.x; + int[] loc = new int[2]; + cell.getLocationInWindow(loc); + boolean forceBottom = false; + final boolean tags = getUserConfig().getClientUserId() == getDialogId() && !getMessagesController().getSavedMessagesController().unsupported; + if (tags) { + MessagesController.getGlobalMainSettings().edit().putInt("savedsearchtaghint", 1).apply(); + + ActionBarPopupWindow.ActionBarPopupWindowLayout popupLayout = new ActionBarPopupWindow.ActionBarPopupWindowLayout(getParentActivity(), 0, getResourceProvider(), 0); + if (getUserConfig().isPremium()) { + ActionBarMenuSubItem editTag = new ActionBarMenuSubItem(getParentActivity(), false, false); + editTag.setTextAndIcon(LocaleController.getString(TextUtils.isEmpty(getMessagesController().getSavedTagName(reaction.reaction)) ? R.string.SavedTagLabelTag : R.string.SavedTagRenameTag), R.drawable.menu_tag_rename); + editTag.setMinimumWidth(160); + editTag.setOnClickListener(view -> { + closeMenu(); + SearchTagsList.openRenameTagAlert(getContext(), currentAccount, reaction.reaction, themeDelegate, false); + }); + popupLayout.addView(editTag); + } + if (!isInsideContainer && (searchingReaction == null || !searchingReaction.isSame(reaction.reaction)) && (chatMode == 0 || chatMode == MODE_SAVED)) { + ActionBarMenuSubItem filterByTag = new ActionBarMenuSubItem(getParentActivity(), false, false); + filterByTag.setTextAndIcon(LocaleController.getString(R.string.SavedTagFilterByTag), R.drawable.menu_tag_filter); + filterByTag.setMinimumWidth(160); + filterByTag.setOnClickListener(view -> { + closeMenu(); + openSearchWithText(""); + if (actionBarSearchTags != null) { + actionBarSearchTags.setChosen(ReactionsLayoutInBubble.VisibleReaction.fromTL(reaction.reaction), true); + } + }); + popupLayout.addView(filterByTag); + } + ActionBarMenuSubItem removeTag = new ActionBarMenuSubItem(getParentActivity(), false, false); + removeTag.setTextAndIcon(LocaleController.getString(R.string.SavedTagRemoveTag), R.drawable.menu_tag_delete); + removeTag.setMinimumWidth(160); + removeTag.setOnClickListener(view -> { + pressedReaction(cell, reaction, 0, 0); + }); + removeTag.setColors(Theme.getColor(Theme.key_color_red), Theme.getColor(Theme.key_color_red)); + popupLayout.addView(removeTag); + scrimPopupContainerLayout.addView(popupLayout); + } else if (messageObject != null && messageObject.messageOwner != null && messageObject.messageOwner.reactions != null && messageObject.messageOwner.reactions.can_see_list || dialog_id >= 0) { + if (reaction.reaction instanceof TLRPC.TL_reactionCustomEmoji) { + button.stopAnimation(); + } + scrimPopupContainerLayout.addView(new ReactedUsersListView(getParentActivity(), themeDelegate, currentAccount, messageObject, reaction, false, false) + .setOnCustomEmojiSelectedListener((reactedUsersListView1, customEmojiStickerSets) -> { + EmojiPacksAlert alert = new EmojiPacksAlert(ChatActivity.this, getParentActivity(), themeDelegate, customEmojiStickerSets) { + @Override + public void dismiss() { + super.dismiss(); + dimBehindView(false); + } + }; + alert.setCalcMandatoryInsets(isKeyboardVisible()); + alert.setDimBehind(false); + closeMenu(false); + showDialog(alert); + }) + .setOnProfileSelectedListener((view1, userId, messagePeerReaction) -> { + Bundle args = new Bundle(); + if (userId > 0) { + args.putLong("user_id", userId); + } else { + args.putLong("chat_id", -userId); + } + args.putInt("report_reaction_message_id", messageObject.getId()); + args.putLong("report_reaction_from_dialog_id", dialog_id); + ProfileActivity fragment = new ProfileActivity(args); + presentFragment(fragment); + closeMenu(); + }), LayoutHelper.createFrame(240, LayoutHelper.WRAP_CONTENT)); + } else if (reaction.reaction instanceof TLRPC.TL_reactionCustomEmoji) { + TLRPC.TL_reactionCustomEmoji customEmoji = (TLRPC.TL_reactionCustomEmoji) reaction.reaction; + TLRPC.InputStickerSet inputStickerSet = AnimatedEmojiDrawable.getDocumentFetcher(currentAccount).findStickerSet(customEmoji.document_id); + if (inputStickerSet != null) { + button.stopAnimation(); + ArrayList arr = new ArrayList(); + arr.add(inputStickerSet); + MessageContainsEmojiButton setButton = new MessageContainsEmojiButton(currentAccount, getContext(), themeDelegate, arr, MessageContainsEmojiButton.SINGLE_REACTION_TYPE); + setButton.setOnClickListener(v -> { + new EmojiPacksAlert(new BaseFragment() { + @Override + public int getCurrentAccount() { + return currentAccount; + } + + @Override + public Context getContext() { + return ChatActivity.this.getContext(); + } + + @Override + public Theme.ResourcesProvider getResourceProvider() { + return themeDelegate; + } + }, getContext(), themeDelegate, arr).show(); + closeMenu(); + }); + scrimPopupContainerLayout.addView(setButton, LayoutHelper.createFrame(240, LayoutHelper.WRAP_CONTENT)); + forceBottom = true; + } else { + scrimPopupContainerLayout.setVisibility(View.GONE); + } + } else { + scrimPopupContainerLayout.setVisibility(View.GONE); + } + + scrimPopupWindow = new ActionBarPopupWindow(scrimPopupContainerLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT) { + @Override + public void dismiss() { + super.dismiss(); + if (scrimPopupWindow != this) { + return; + } + scrimPopupWindow = null; + menuDeleteItem = null; + scrimPopupWindowItems = null; + chatLayoutManager.setCanScrollVertically(true); + if (scrimPopupWindowHideDimOnDismiss) { + dimBehindView(false); + } else { + scrimPopupWindowHideDimOnDismiss = true; + } + if (chatActivityEnterView != null && chatActivityEnterView.getEditField() != null) { + chatActivityEnterView.getEditField().setAllowDrawCursor(true); + } + } + }; + scrimPopupWindow.setPauseNotifications(true); + scrimPopupWindow.setDismissAnimationDuration(220); + scrimPopupWindow.setOutsideTouchable(true); + scrimPopupWindow.setClippingEnabled(true); + scrimPopupWindow.setAnimationStyle(R.style.PopupContextAnimation); + scrimPopupWindow.setFocusable(true); + scrimPopupContainerLayout.measure(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST)); + scrimPopupWindow.setInputMethodMode(ActionBarPopupWindow.INPUT_METHOD_NOT_NEEDED); + scrimPopupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED); + scrimPopupWindow.getContentView().setFocusableInTouchMode(true); + + int totalHeight = contentView.getHeight(); + int height = scrimPopupContainerLayout.getMeasuredHeight(); + int keyboardHeight = contentView.measureKeyboardHeight(); + if (keyboardHeight > AndroidUtilities.dp(20)) { + totalHeight += keyboardHeight; + } + + int popupX = (int) (left - AndroidUtilities.dp(28)); + popupX = Math.max(AndroidUtilities.dp(6), Math.min(chatListView.getMeasuredWidth() - AndroidUtilities.dp(6) - scrimPopupContainerLayout.getMeasuredWidth(), popupX)); + if (AndroidUtilities.isTablet()) { + int[] location = new int[2]; + fragmentView.getLocationInWindow(location); + popupX += location[0]; + } + int popupY; + if (height < totalHeight) { + float cellY = chatListView.getY() + cell.getY(); + if (isInsideContainer) { + int[] location = new int[2]; + cell.getLocationInWindow(location); + cellY = location[1]; + } + if (height < totalHeight / 2f && cellY + reactionsLayoutInBubble.y + button.y > totalHeight / 2f && !forceBottom) { + scrimViewReactionOffset = -(height - dp(12)); + popupY = (int) (cellY + reactionsLayoutInBubble.y + button.y - height); + } else { + scrimViewReactionOffset = 0; + popupY = (int) (cellY + reactionsLayoutInBubble.y + button.y + button.height); + } + } else { + scrimViewReactionOffset = 0; + popupY = inBubbleMode ? 0 : AndroidUtilities.statusBarHeight; + } + if (scrimPopupContainerLayout.getVisibility() != View.VISIBLE) { + scrimViewReactionOffset = 0; + } + scrimPopupWindow.showAtLocation(chatListView, Gravity.LEFT | Gravity.TOP, scrimPopupX = popupX, scrimPopupY = popupY); + + chatListView.stopScroll(); + chatLayoutManager.setCanScrollVertically(false); + scrimViewReaction = reaction.reaction.hashCode(); + scrimViewReactionAnimated = reaction.reaction instanceof TLRPC.TL_reactionCustomEmoji && LiteMode.isEnabled(LiteMode.FLAG_ANIMATED_EMOJI_KEYBOARD); + dimBehindView(cell, !tags, true); + hideHints(false); + if (topUndoView != null) { + topUndoView.hide(true, 1); + } + if (undoView != null) { + undoView.hide(true, 1); + } + if (chatActivityEnterView != null && chatActivityEnterView.getEditField() != null) { + chatActivityEnterView.getEditField().setAllowDrawCursor(false); + } + } else if (messageObject.areTags() && (chatMode == 0 || chatMode == MODE_SAVED)) { + closeMenu(); + openSearchWithText(""); + if (actionBarSearchTags != null) { + actionBarSearchTags.setChosen(ReactionsLayoutInBubble.VisibleReaction.fromTL(reaction.reaction), true); + } + } else if (reaction != null) { + pressedReaction(cell, reaction, x, y); + } + } + + private void pressedReaction(View cell, TLRPC.ReactionCount reaction, float x, float y) { + ReactionsLayoutInBubble.VisibleReaction visibleReaction = ReactionsLayoutInBubble.VisibleReaction.fromTL(reaction.reaction); + MessageObject messageObject; + if (cell instanceof ChatMessageCell) { + messageObject = ((ChatMessageCell) cell).getPrimaryMessageObject(); + } else if (cell instanceof ChatActionCell) { + messageObject = ((ChatActionCell) cell).getMessageObject(); + } else return; + selectReaction(cell, messageObject, null, null, x, y, visibleReaction,false, false, false, false); + if (messageObject != null & messageObject.messageOwner != null) { + if (chatAdapter.isFiltered) { + MessageObject realMessage = messagesDict[0].get(messageObject.getId()); + if (realMessage != null && realMessage.messageOwner != null) { + realMessage.messageOwner.reactions = messageObject.messageOwner.reactions; + } + } else if (!chatAdapter.isFiltered && searchingReaction != null) { + updateFilteredMessages(false); + } + } + if (chatAdapter.isFiltered && !messageObject.hasReaction(searchingReaction)) { + final MessageObject msg = messageObject; + final MessageObject.GroupedMessages groupedMessages = getValidGroupedMessage(msg); + if (groupedMessages != null) { + for (int i = 0; i < groupedMessages.messages.size(); ++i) { + MessageObject gmsg = groupedMessages.messages.get(i); + getMediaDataController().removeMessageFromResults(gmsg.getId()); + } + } else { + getMediaDataController().removeMessageFromResults(msg.getId()); + } + if (messagesSearchAdapter != null) { + messagesSearchAdapter.notifyDataSetChanged(); + } + updateFilteredMessages(true); + } + } + + private int findAdPlace() { + final ArrayList cachedApproximateHeight = new ArrayList<>(messages.size()); + final int unreadRow = messages.indexOf(unreadMessageObject); + int unreadY = -1; + int unreadOffset = 0; + final ArrayList adsY = new ArrayList<>(); + final ArrayList adsIndices = new ArrayList<>(); + final ArrayList adsIndexOffset = new ArrayList<>(); + final HashSet groupIds = new HashSet<>(); + int y = 0, o = 0; + for (int i = 0; i < messages.size(); ++i) { + final MessageObject msg = messages.get(i); + final int h = msg.getApproximateHeight(true); + cachedApproximateHeight.add(h); + if (msg.isSponsored() || i == unreadRow) { + if (i == unreadRow) { + unreadY = y; + } + adsIndices.add(i); + adsY.add(y); + adsIndexOffset.add(o); + } + if (!msg.hasValidGroupIdFast()) { + o++; + y += h; + } else if (!groupIds.contains(msg.getGroupId())) { + groupIds.add(msg.getGroupId()); + o++; + y += h; + } + } + if (adsIndices.size() - (unreadRow >= 0 ? 1 : 0) <= 0) { + return 0; + } + y = unreadY; + o = unreadOffset; + groupIds.clear(); + for (int i = unreadRow; i >= 0; --i) { + final MessageObject msg = messages.get(i); + final int h = cachedApproximateHeight.get(i); + if (!msg.hasValidGroupIdFast()) { + o--; + y -= h; + } else if (!groupIds.contains(msg.getGroupId())) { + groupIds.add(msg.getGroupId()); + o--; + y -= h; + } + if (msg.isSponsored() || msg.hasValidGroupIdFast() || msg == unreadMessageObject) continue; + + int t = -1, ty = -1, to = -1; + int b = -1, by = -1, bo = -1; + for (int j = 0; j < adsIndices.size(); ++j) { + int idx = adsIndices.get(j); + if (idx >= i && (t == -1 || t > idx)) { + t = idx; + ty = adsY.get(j); + to = adsIndexOffset.get(j); + } + if (idx <= i && (b == -1 || b < idx)) { + b = idx; + by = adsY.get(j); + bo = adsIndexOffset.get(j); + } + } + if ( + (t == -1 || Math.abs(t - i) > sponsoredMessagesPostsBetween + 1 && Math.abs(to - o) > sponsoredMessagesPostsBetween + 1 && Math.abs(ty - (y + h)) > AndroidUtilities.displaySize.y) && + (b == -1 || Math.abs(b - i) > sponsoredMessagesPostsBetween + 1 && Math.abs(bo - o) > sponsoredMessagesPostsBetween + 1 && Math.abs(by - y) > AndroidUtilities.displaySize.y) + ) { + return i; + } + } + y = 0; + o = 0; + groupIds.clear(); + for (int i = 0; i < messages.size(); ++i) { + MessageObject msg = messages.get(i); + final int h = cachedApproximateHeight.get(i); + if (!msg.hasValidGroupIdFast()) { + o++; + y += h; + } else if (!groupIds.contains(msg.getGroupId())) { + groupIds.add(msg.getGroupId()); + o++; + } + if (msg.isSponsored() || msg.hasValidGroupIdFast() || msg == unreadMessageObject) continue; + + int t = -1, ty = -1, to = -1; + int b = -1, by = -1, bo = -1; + for (int j = 0; j < adsIndices.size(); ++j) { + int idx = adsIndices.get(j); + if (idx >= i && (t == -1 || t > idx)) { + t = idx; + ty = adsY.get(j); + to = adsIndexOffset.get(j); + } + if (idx <= i && (b == -1 || b < idx)) { + b = idx; + by = adsY.get(j); + bo = adsIndexOffset.get(j); + } + } + if ( + (t == -1 || Math.abs(t - i) >= sponsoredMessagesPostsBetween + 1 && Math.abs(to - o) >= sponsoredMessagesPostsBetween + 1 && Math.abs(ty - (y + h)) > AndroidUtilities.displaySize.y) && + (b == -1 || Math.abs(b - i) >= sponsoredMessagesPostsBetween + 1 && Math.abs(bo - o) >= sponsoredMessagesPostsBetween + 1 && Math.abs(by - y) > AndroidUtilities.displaySize.y) + ) { + return i; + } + } + return -1; + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java index 36ce11b1a0..a83745afc4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java @@ -20,7 +20,6 @@ import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.app.Dialog; -import android.app.Notification; import android.content.Context; import android.content.Intent; import android.graphics.Canvas; @@ -100,12 +99,12 @@ import org.telegram.ui.Components.Reactions.ChatCustomReactionsEditActivity; import org.telegram.ui.Components.Reactions.ReactionsUtils; import org.telegram.ui.Components.SizeNotifierFrameLayout; -import org.telegram.ui.Components.Text; import org.telegram.ui.Components.UndoView; import org.telegram.ui.Stars.BotStarsActivity; import org.telegram.ui.Stars.BotStarsController; import org.telegram.ui.Stars.StarsIntroActivity; import org.telegram.ui.bots.AffiliateProgramFragment; +import org.telegram.ui.bots.BotVerifySheet; import org.telegram.ui.bots.ChannelAffiliateProgramsFragment; import java.text.DecimalFormat; @@ -179,12 +178,19 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image private TextCell changeBotSettingsCell; private TextInfoPrivacyCell botInfoCell; + private TextInfoPrivacyCell verifyInfoCell; + private TextCell verifyCell; + private TLRPC.FileLocation avatar; private long chatId; private TLRPC.Chat currentChat; private TLRPC.ChatFull info; + private TLRPC.TL_chatAdminRights chatAdminRights; + private TLRPC.TL_chatBannedRights chatBannedRights; + private TLRPC.TL_chatBannedRights chatDefaultBannedRights; + private long userId; private TLRPC.User currentUser; private TLRPC.UserFull userInfo; @@ -209,7 +215,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image private PhotoViewer.PhotoViewerProvider provider = new PhotoViewer.EmptyPhotoViewerProvider() { @Override - public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { + public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview, boolean closing) { if (fileLocation == null) { return null; } @@ -351,6 +357,10 @@ public boolean onFragmentCreate() { } if (currentChat != null) { + chatAdminRights = TLRPC.TL_chatAdminRights.clone(currentChat.admin_rights); + chatBannedRights = TLRPC.TL_chatBannedRights.clone(currentChat.banned_rights); + chatDefaultBannedRights = TLRPC.TL_chatBannedRights.clone(currentChat.default_banned_rights); + avatarDrawable.setInfo(5, currentChat.title, null); isChannel = ChatObject.isChannel(currentChat) && !currentChat.megagroup; // signMessages = currentChat.signatures; @@ -373,6 +383,8 @@ public boolean onFragmentCreate() { imageUpdater.parentFragment = this; imageUpdater.setDelegate(this); NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.updateInterfaces); + NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.dialogDeleted); + NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.channelRightsUpdated); if (info != null) { loadLinksCount(); @@ -412,6 +424,8 @@ public void onFragmentDestroy() { } } NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.updateInterfaces); + NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.dialogDeleted); + NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.channelRightsUpdated); if (nameTextView != null) { nameTextView.onDestroy(); } @@ -1020,7 +1034,9 @@ public void afterTextChanged(Editable editable) { text = AndroidUtilities.replaceTags(LocaleController.formatPluralString("ChannelTopicsForbidden", getMessagesController().forumUpgradeParticipantsMin)); } BulletinFactory.of(this).createSimpleBulletin(R.raw.topics, text).show(); - frameLayout.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + frameLayout.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} return; } forum = !forum; @@ -1179,8 +1195,7 @@ public void afterTextChanged(Editable editable) { if (channelAffiliateProgramsCell != null) { infoContainer.addView(channelAffiliateProgramsCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } - - if (channelAffiliateProgramsCell != null && getMessagesController().starrefConnectAllowed) { + if (channelAffiliateProgramsCell != null && getMessagesController().starrefConnectAllowed && ChatObject.isChannelAndNotMegaGroup(currentChat)) { channelAffiliateProgramsCell.setVisibility(View.VISIBLE); } if (logCell != null) { @@ -1268,6 +1283,21 @@ public void updateDrawState(TextPaint ds) { botInfoCell.setText(span); linearLayout1.addView(botInfoCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + verifyCell = new TextCell(context); + verifyCell.setBackground(Theme.getSelectorDrawable(true)); + verifyCell.setTextAndIcon(getString(R.string.BotVerifyAccounts), R.drawable.menu_factcheck, false); + verifyCell.setColors(Theme.key_windowBackgroundWhiteBlueText4, Theme.key_windowBackgroundWhiteBlueText4); + linearLayout1.addView(verifyCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + verifyCell.setOnClickListener(v -> BotVerifySheet.openVerify(currentAccount, userId, userInfo.bot_info.verifier_settings)); + + verifyInfoCell = new TextInfoPrivacyCell(context); + verifyInfoCell.setFixedSize(12); + verifyInfoCell.setBackground(Theme.getThemedDrawableByKey(getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + linearLayout1.addView(verifyInfoCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + + verifyCell.setVisibility(userInfo != null && userInfo.bot_info != null && userInfo.bot_info.verifier_settings != null ? View.VISIBLE : View.GONE); + verifyInfoCell.setVisibility(userInfo != null && userInfo.bot_info != null && userInfo.bot_info.verifier_settings != null ? View.VISIBLE : View.GONE); + if (currentUser.bot && currentUser.bot_can_edit) { balanceContainer = new LinearLayout(context); @@ -1336,6 +1366,8 @@ public void updateDrawState(TextPaint ds) { gap.setBackground(Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); gap.setTag(R.id.fit_width_tag, 1); linearLayout1.addView(gap, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 8)); + + balanceContainer.setVisibility(starsBalanceCell.getVisibility() == View.VISIBLE || tonBalanceCell.getVisibility() == View.VISIBLE ? View.VISIBLE : View.GONE); } } @@ -1383,7 +1415,7 @@ public void updateDrawState(TextPaint ds) { undoView = new UndoView(context); sizeNotifierFrameLayout.addView(undoView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | Gravity.LEFT, 8, 0, 8, 8)); - nameTextView.setText(Emoji.replaceEmoji(currentUser != null ? ContactsController.formatName(currentUser) : currentChat.title, nameTextView.getEditText().getPaint().getFontMetricsInt(), dp(16), true)); + nameTextView.setText(Emoji.replaceEmoji(currentUser != null ? ContactsController.formatName(currentUser) : currentChat.title, nameTextView.getEditText().getPaint().getFontMetricsInt(), true)); nameTextView.setSelection(nameTextView.length()); if (info != null) { descriptionTextView.setText(info.about); @@ -1477,6 +1509,9 @@ private void setAvatar() { if (PhotoViewer.hasInstance() && PhotoViewer.getInstance().isVisible()) { PhotoViewer.getInstance().checkCurrentImageVisibility(); } + if (channelAffiliateProgramsCell != null && getMessagesController().starrefConnectAllowed && ChatObject.isChannelAndNotMegaGroup(currentChat)) { + channelAffiliateProgramsCell.setVisibility(View.VISIBLE); + } } private void updateCanForum() { @@ -1515,6 +1550,19 @@ public void didReceivedNotification(int id, int account, Object... args) { if ((mask & MessagesController.UPDATE_MASK_NAME) != 0) { updatePublicLinksCount(); } + } else if (id == NotificationCenter.channelRightsUpdated) { + TLRPC.Chat chat = (TLRPC.Chat) args[0]; + if (chat != null && chat.id == chatId && ( + chatAdminRights != null && !chatAdminRights.equals(chat.admin_rights) || + chatBannedRights != null && !chatBannedRights.equals(chat.banned_rights) || + chatDefaultBannedRights != null && !chatDefaultBannedRights.equals(chat.default_banned_rights) + )) { + if (parentLayout != null && parentLayout.getLastFragment() == this) { + finishFragment(); + } else { + removeSelfFromStack(); + } + } } else if (id == NotificationCenter.chatAvailableReactionsUpdated) { long chatId = (long) args[0]; if (chatId == this.chatId) { @@ -1533,6 +1581,7 @@ public void didReceivedNotification(int id, int account, Object... args) { if (publicLinkCell != null) { publicLinkCell.setNeedDivider(c.botHasStars(userId) || c.botHasTON(userId)); } + balanceContainer.setVisibility(starsBalanceCell.getVisibility() == View.VISIBLE || tonBalanceCell.getVisibility() == View.VISIBLE ? View.VISIBLE : View.GONE); } if (tonBalanceCell != null) { BotStarsController c = BotStarsController.getInstance(currentAccount); @@ -1556,6 +1605,7 @@ public void didReceivedNotification(int id, int account, Object... args) { if (publicLinkCell != null) { publicLinkCell.setNeedDivider(c.botHasStars(userId) || c.botHasTON(userId)); } + balanceContainer.setVisibility(starsBalanceCell.getVisibility() == View.VISIBLE || tonBalanceCell.getVisibility() == View.VISIBLE ? View.VISIBLE : View.GONE); } } } else if (id == NotificationCenter.userInfoDidLoad) { @@ -1568,6 +1618,15 @@ public void didReceivedNotification(int id, int account, Object... args) { if (did == -chatId) { } + } else if (id == NotificationCenter.dialogDeleted) { + long dialogId = (long) args[0]; + if (-this.chatId == dialogId) { + if (parentLayout != null && parentLayout.getLastFragment() == this) { + finishFragment(); + } else { + removeSelfFromStack(); + } + } } } @@ -1580,7 +1639,7 @@ public void onUploadProgressChanged(float progress) { } @Override - public void didStartUpload(boolean isVideo) { + public void didStartUpload(boolean fromAvatarConstructor, boolean isVideo) { if (avatarProgressView == null) { return; } @@ -1921,6 +1980,12 @@ public void setInfo(TLRPC.UserFull userFull) { botAffiliateProgramCell.setValue(userInfo.starref_program == null ? getString(R.string.AffiliateProgramBotOff) : String.format(Locale.US, "%.1f%%", userInfo.starref_program.commission_permille / 10.0f), false); } } + if (verifyCell != null) { + verifyCell.setVisibility(userInfo != null && userInfo.bot_info != null && userInfo.bot_info.verifier_settings != null ? View.VISIBLE : View.GONE); + } + if (verifyInfoCell != null) { + verifyInfoCell.setVisibility(userInfo != null && userInfo.bot_info != null && userInfo.bot_info.verifier_settings != null ? View.VISIBLE : View.GONE); + } } } @@ -1934,6 +1999,9 @@ public void setInfo(TLRPC.ChatFull chatFull) { availableReactions = info.available_reactions; preloadedReactions.clear(); preloadedReactions.addAll(ReactionsUtils.startPreloadReactions(currentChat, info)); + if (channelAffiliateProgramsCell != null && getMessagesController().starrefConnectAllowed && ChatObject.isChannelAndNotMegaGroup(currentChat)) { + channelAffiliateProgramsCell.setVisibility(View.VISIBLE); + } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatEditTypeActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatEditTypeActivity.java index 98855272e7..a1188e036b 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatEditTypeActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatEditTypeActivity.java @@ -215,6 +215,7 @@ public boolean onFragmentCreate() { // } } getNotificationCenter().addObserver(this, NotificationCenter.chatInfoDidLoad); + getNotificationCenter().addObserver(this, NotificationCenter.dialogDeleted); return super.onFragmentCreate(); } @@ -222,6 +223,7 @@ public boolean onFragmentCreate() { public void onFragmentDestroy() { super.onFragmentDestroy(); getNotificationCenter().removeObserver(this, NotificationCenter.chatInfoDidLoad); + getNotificationCenter().removeObserver(this, NotificationCenter.dialogDeleted); AndroidUtilities.removeAdjustResize(getParentActivity(), classGuid); } @@ -670,6 +672,15 @@ public void didReceivedNotification(int id, int account, Object... args) { invite = chatFull.exported_invite; updatePrivatePublic(); } + } else if (id == NotificationCenter.dialogDeleted) { + long dialogId = (long) args[0]; + if (-this.chatId == dialogId) { + if (parentLayout != null && parentLayout.getLastFragment() == this) { + finishFragment(); + } else { + removeSelfFromStack(); + } + } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatLinkActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatLinkActivity.java index b4e370d53a..595e1709f8 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatLinkActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatLinkActivity.java @@ -224,6 +224,7 @@ public boolean onFragmentCreate() { super.onFragmentCreate(); getNotificationCenter().addObserver(this, NotificationCenter.chatInfoDidLoad); getNotificationCenter().addObserver(this, NotificationCenter.updateInterfaces); + getNotificationCenter().addObserver(this, NotificationCenter.dialogDeleted); loadChats(); return true; } @@ -233,6 +234,7 @@ public void onFragmentDestroy() { super.onFragmentDestroy(); getNotificationCenter().removeObserver(this, NotificationCenter.chatInfoDidLoad); getNotificationCenter().removeObserver(this, NotificationCenter.updateInterfaces); + getNotificationCenter().removeObserver(this, NotificationCenter.dialogDeleted); } private boolean joinToSendProgress = false; @@ -279,6 +281,15 @@ public void didReceivedNotification(int id, int account, Object... args) { } } } + } else if (id == NotificationCenter.dialogDeleted) { + long dialogId = (long) args[0]; + if (-this.currentChatId == dialogId) { + if (parentLayout != null && parentLayout.getLastFragment() == this) { + finishFragment(); + } else { + removeSelfFromStack(); + } + } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatPullingDownDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatPullingDownDrawable.java index ae176d86da..b80f392924 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatPullingDownDrawable.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatPullingDownDrawable.java @@ -328,7 +328,9 @@ public void draw(Canvas canvas, View parent, float progress, float alpha) { if ((progress >= 1f && lastProgress < 1f) || (progress < 1f && lastProgress == 1f)) { long time = System.currentTimeMillis(); if (time - lastHapticTime > 100) { - parent.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + parent.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} lastHapticTime = time; } lastProgress = progress; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatReactionsEditActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatReactionsEditActivity.java index f7cade8124..e1fb9b7b96 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatReactionsEditActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatReactionsEditActivity.java @@ -89,6 +89,7 @@ public boolean onFragmentCreate() { } } getNotificationCenter().addObserver(this, NotificationCenter.reactionsDidLoad); + getNotificationCenter().addObserver(this, NotificationCenter.dialogDeleted); return super.onFragmentCreate(); } @@ -325,6 +326,7 @@ public void onFragmentDestroy() { super.onFragmentDestroy(); getMessagesController().setChatReactions(chatId, selectedType, chatReactions); getNotificationCenter().removeObserver(this, NotificationCenter.reactionsDidLoad); + getNotificationCenter().removeObserver(this, NotificationCenter.dialogDeleted); } @@ -393,6 +395,15 @@ public void didReceivedNotification(int id, int account, Object... args) { availableReactions.clear(); availableReactions.addAll(getMediaDataController().getEnabledReactionsList()); listAdapter.notifyDataSetChanged(); + } else if (id == NotificationCenter.dialogDeleted) { + long dialogId = (long) args[0]; + if (dialogId == -this.chatId) { + if (parentLayout != null && parentLayout.getLastFragment() == this) { + finishFragment(); + } else { + removeSelfFromStack(); + } + } } } } \ No newline at end of file diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatRightsEditActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatRightsEditActivity.java index 968e60ed69..d2a4aa0e93 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatRightsEditActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatRightsEditActivity.java @@ -46,10 +46,12 @@ import org.telegram.messenger.FileLog; import org.telegram.messenger.LocaleController; import org.telegram.messenger.MessagesController; +import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; import org.telegram.messenger.UserObject; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenu; import org.telegram.ui.ActionBar.AlertDialog; @@ -82,7 +84,7 @@ import java.util.Calendar; import java.util.Locale; -public class ChatRightsEditActivity extends BaseFragment { +public class ChatRightsEditActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate { private ListAdapter listViewAdapter; private RecyclerListView listView; @@ -1080,10 +1082,10 @@ private void initTransfer(TLRPC.InputCheckPasswordSRP srp, TwoStepVerificationAc } showDialog(builder.create()); } else if ("SRP_ID_INVALID".equals(error.text)) { - TLRPC.TL_account_getPassword getPasswordReq = new TLRPC.TL_account_getPassword(); + TL_account.getPassword getPasswordReq = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(getPasswordReq, (response2, error2) -> AndroidUtilities.runOnUIThread(() -> { if (error2 == null) { - TLRPC.account_Password currentPassword = (TLRPC.account_Password) response2; + TL_account.Password currentPassword = (TL_account.Password) response2; passwordFragment.setCurrentPasswordInfo(null, currentPassword); TwoStepVerificationActivity.initPasswordNewAlgo(currentPassword); initTransfer(passwordFragment.getNewSrpPassword(), passwordFragment); @@ -1113,6 +1115,32 @@ private void initTransfer(TLRPC.InputCheckPasswordSRP srp, TwoStepVerificationAc })); } + @Override + public boolean onFragmentCreate() { + getNotificationCenter().addObserver(this, NotificationCenter.dialogDeleted); + return super.onFragmentCreate(); + } + + @Override + public void onFragmentDestroy() { + getNotificationCenter().removeObserver(this, NotificationCenter.dialogDeleted); + super.onFragmentDestroy(); + } + + @Override + public void didReceivedNotification(int id, int account, Object... args) { + if (id == NotificationCenter.dialogDeleted) { + long dialogId = (long) args[0]; + if (-this.chatId == dialogId) { + if (parentLayout != null && parentLayout.getLastFragment() == this) { + finishFragment(); + } else { + removeSelfFromStack(); + } + } + } + } + private void updateRows(boolean update) { int transferOwnerShadowRowPrev = Math.min(transferOwnerShadowRow, transferOwnerRow); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java index be11b71dd5..3a1710a982 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java @@ -552,6 +552,7 @@ private void updateRows() { public boolean onFragmentCreate() { super.onFragmentCreate(); getNotificationCenter().addObserver(this, NotificationCenter.chatInfoDidLoad); + getNotificationCenter().addObserver(this, NotificationCenter.dialogDeleted); loadChatParticipants(0, 200); return true; } @@ -560,6 +561,7 @@ public boolean onFragmentCreate() { public void onFragmentDestroy() { super.onFragmentDestroy(); getNotificationCenter().removeObserver(this, NotificationCenter.chatInfoDidLoad); + getNotificationCenter().removeObserver(this, NotificationCenter.dialogDeleted); } @Override @@ -1950,6 +1952,15 @@ public void didReceivedNotification(int id, int account, Object... args) { } AndroidUtilities.runOnUIThread(() -> loadChatParticipants(0, 200)); } + } else if (id == NotificationCenter.dialogDeleted) { + long dialogId = (long) args[0]; + if (dialogId == -chatId) { + if (parentLayout != null && parentLayout.getLastFragment() == this) { + finishFragment(); + } else { + removeSelfFromStack(); + } + } } } @@ -3011,20 +3022,20 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { GraySectionCell sectionCell = (GraySectionCell) holder.itemView; if (position == groupStartRow) { if (type == TYPE_BANNED) { - sectionCell.setText(getString("ChannelBlockedUsers", R.string.ChannelBlockedUsers)); + sectionCell.setText(getString(R.string.ChannelBlockedUsers)); } else if (type == TYPE_KICKED) { - sectionCell.setText(getString("ChannelRestrictedUsers", R.string.ChannelRestrictedUsers)); + sectionCell.setText(getString(R.string.ChannelRestrictedUsers)); } else { if (isChannel) { - sectionCell.setText(getString("ChannelSubscribers", R.string.ChannelSubscribers)); + sectionCell.setText(getString(R.string.ChannelSubscribers)); } else { - sectionCell.setText(getString("ChannelMembers", R.string.ChannelMembers)); + sectionCell.setText(getString(R.string.ChannelMembers)); } } } else if (position == globalStartRow) { - sectionCell.setText(getString("GlobalSearch", R.string.GlobalSearch)); + sectionCell.setText(getString(R.string.GlobalSearch)); } else if (position == contactsStartRow) { - sectionCell.setText(getString("Contacts", R.string.Contacts)); + sectionCell.setText(getString(R.string.Contacts)); } break; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/AlertsCreator.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/AlertsCreator.java index 9a5af41015..96aacbdcd4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/AlertsCreator.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/AlertsCreator.java @@ -95,6 +95,8 @@ import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; +import org.telegram.tgnet.tl.TL_phone; import org.telegram.ui.ActionBar.ActionBarMenuItem; import org.telegram.ui.ActionBar.ActionBarPopupWindow; import org.telegram.ui.ActionBar.AlertDialog; @@ -303,7 +305,7 @@ public static Dialog processError(int currentAccount, TLRPC.TL_error error, Base } else { showSimpleAlert(fragment, LocaleController.getString(R.string.ImportErrorTitle), LocaleController.getString(R.string.ErrorOccurred) + "\n" + error.text); } - } else if (request instanceof TLRPC.TL_account_saveSecureValue || request instanceof TLRPC.TL_account_getAuthorizationForm) { + } else if (request instanceof TL_account.saveSecureValue || request instanceof TL_account.getAuthorizationForm) { if (fragment == null) { fragment = LaunchActivity.getLastFragment(); } @@ -325,7 +327,7 @@ public static Dialog processError(int currentAccount, TLRPC.TL_error error, Base request instanceof TLRPC.TL_messages_editChatDefaultBannedRights || request instanceof TLRPC.TL_messages_editChatAdmin || request instanceof TLRPC.TL_messages_migrateChat || - request instanceof TLRPC.TL_phone_inviteToGroupCall) { + request instanceof TL_phone.inviteToGroupCall) { if (fragment != null && error.text.equals("CHANNELS_TOO_MUCH")) { if (fragment.getParentActivity() != null) { fragment.showDialog(new LimitReachedBottomSheet(fragment, fragment.getParentActivity(), LimitReachedBottomSheet.TYPE_TO0_MANY_COMMUNITIES, currentAccount, null)); @@ -477,7 +479,7 @@ public static Dialog processError(int currentAccount, TLRPC.TL_error error, Base if (fragment != null && fragment.getParentActivity() != null) { Toast.makeText(fragment.getParentActivity(), LocaleController.getString(R.string.ErrorOccurred) + "\n" + error.text, Toast.LENGTH_SHORT).show(); } - } else if (request instanceof TLRPC.TL_account_confirmPhone || request instanceof TLRPC.TL_account_verifyPhone || request instanceof TLRPC.TL_account_verifyEmail) { + } else if (request instanceof TL_account.confirmPhone || request instanceof TL_account.verifyPhone || request instanceof TL_account.verifyEmail) { if (error.text.contains("PHONE_CODE_EMPTY") || error.text.contains("PHONE_CODE_INVALID") || error.text.contains("CODE_INVALID") || error.text.contains("CODE_EMPTY")) { return showSimpleAlert(fragment, LocaleController.getString(R.string.InvalidCode)); } else if (error.text.contains("PHONE_CODE_EXPIRED") || error.text.contains("EMAIL_VERIFY_EXPIRED")) { @@ -499,7 +501,7 @@ public static Dialog processError(int currentAccount, TLRPC.TL_error error, Base } else if (error.code != -1000) { return showSimpleAlert(fragment, LocaleController.getString(R.string.ErrorOccurred) + "\n" + error.text); } - } else if (request instanceof TLRPC.TL_account_sendConfirmPhoneCode) { + } else if (request instanceof TL_account.sendConfirmPhoneCode) { if (error.code == 400) { return showSimpleAlert(fragment, LocaleController.getString(R.string.CancelLinkExpired)); } else { @@ -509,7 +511,7 @@ public static Dialog processError(int currentAccount, TLRPC.TL_error error, Base return showSimpleAlert(fragment, LocaleController.getString(R.string.ErrorOccurred)); } } - } else if (request instanceof TLRPC.TL_account_changePhone) { + } else if (request instanceof TL_account.changePhone) { if (error.text.contains("PHONE_NUMBER_INVALID")) { showSimpleAlert(fragment, LocaleController.getString(R.string.InvalidPhoneNumber)); } else if (error.text.contains("PHONE_CODE_EMPTY") || error.text.contains("PHONE_CODE_INVALID")) { @@ -523,7 +525,7 @@ public static Dialog processError(int currentAccount, TLRPC.TL_error error, Base } else { showSimpleAlert(fragment, error.text); } - } else if (request instanceof TLRPC.TL_account_sendChangePhoneCode) { + } else if (request instanceof TL_account.sendChangePhoneCode) { if (error.text.contains("PHONE_NUMBER_INVALID")) { LoginActivity.needShowInvalidAlert(fragment, (String) args[0], false); } else if (error.text.contains("PHONE_CODE_EMPTY") || error.text.contains("PHONE_CODE_INVALID")) { @@ -539,7 +541,7 @@ public static Dialog processError(int currentAccount, TLRPC.TL_error error, Base } else { showSimpleAlert(fragment, LocaleController.getString(R.string.ErrorOccurred)); } - } else if (request instanceof TLRPC.TL_account_updateUsername) { + } else if (request instanceof TL_account.updateUsername) { switch (error.text) { case "USERNAME_INVALID": showSimpleAlert(fragment, LocaleController.getString(R.string.UsernameInvalid)); @@ -557,7 +559,7 @@ public static Dialog processError(int currentAccount, TLRPC.TL_error error, Base } else { showSimpleAlert(fragment, LocaleController.getString(R.string.ErrorOccurred) + "\n" + error.text); } - } else if (request instanceof TLRPC.TL_account_getPassword || request instanceof TLRPC.TL_account_getTmpPassword) { + } else if (request instanceof TL_account.getPassword || request instanceof TL_account.getTmpPassword) { if (error.text.startsWith("FLOOD_WAIT")) { showSimpleToast(fragment, getFloodWaitString(error.text)); } else { @@ -2325,7 +2327,7 @@ public void afterTextChanged(Editable s) { editTextView.setSelection(editTextView.getText().toString().length()); builder.setView(dialogView); - DialogInterface.OnClickListener onDoneListener = (dialogInterface, i) -> { + AlertDialog.OnButtonClickListener onDoneListener = (dialogInterface, i) -> { if (peerId > 0) { final TLRPC.UserFull userFull = MessagesController.getInstance(currentAccount).getUserFull(UserConfig.getInstance(currentAccount).getClientUserId()); final String newName = editTextView.getText().toString().replace("\n", " ").replaceAll(" +", " ").trim(); @@ -2343,7 +2345,7 @@ public void afterTextChanged(Editable s) { NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.userInfoDidLoad, peerId, userFull); } - final TLRPC.TL_account_updateProfile req = new TLRPC.TL_account_updateProfile(); + final TL_account.updateProfile req = new TL_account.updateProfile(); req.about = newName; req.flags |= 4; NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.showBulletin, Bulletin.TYPE_BIO_CHANGED, peerId); @@ -2457,7 +2459,7 @@ public static void createChangeNameAlert(long peerId, Context context, int curre builder.setView(dialogView); EditText finalLastNameEditTextView = lastNameEditTextView; - DialogInterface.OnClickListener onDoneListener = (dialogInterface, i) -> { + AlertDialog.OnButtonClickListener onDoneListener = (dialogInterface, i) -> { if (firstNameEditTextView.getText() == null) { return; } @@ -2478,7 +2480,7 @@ public static void createChangeNameAlert(long peerId, Context context, int curre dialogInterface.dismiss(); return; } - TLRPC.TL_account_updateProfile req = new TLRPC.TL_account_updateProfile(); + TL_account.updateProfile req = new TL_account.updateProfile(); req.flags = 3; currentUser.first_name = req.first_name = newFirst; currentUser.last_name = req.last_name = newLast; @@ -2578,18 +2580,12 @@ public static void showDiscardTopicDialog(BaseFragment baseFragment, Theme.Resou AlertDialog.Builder builder = new AlertDialog.Builder(baseFragment.getParentActivity(), resourcesProvider); builder.setTitle(LocaleController.getString(R.string.DiscardTopic)); builder.setMessage(LocaleController.getString(R.string.DiscardTopicMessage)); - builder.setNegativeButton(LocaleController.getString(R.string.Cancel), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - } + builder.setNegativeButton(LocaleController.getString(R.string.Cancel), (dialog, which) -> { + dialog.dismiss(); }); - builder.setPositiveButton(LocaleController.getString(R.string.Discard), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - onDiscard.run(); - } + builder.setPositiveButton(LocaleController.getString(R.string.Discard), (dialog, which) -> { + dialog.dismiss(); + onDiscard.run(); }); baseFragment.showDialog(builder.create()); } @@ -3693,7 +3689,7 @@ public CharSequence getAccessibilityClassName() { return builder; } - public static BottomSheet.Builder createBirthdayPickerDialog(Context context, String title, String button, TLRPC.TL_birthday currentBirthday, final Utilities.Callback whenSelectedBirthday, Runnable addPrivacyText, Theme.ResourcesProvider resourcesProvider) { + public static BottomSheet.Builder createBirthdayPickerDialog(Context context, String title, String button, TL_account.TL_birthday currentBirthday, final Utilities.Callback whenSelectedBirthday, Runnable addPrivacyText, Theme.ResourcesProvider resourcesProvider) { if (context == null) { return null; } @@ -3926,7 +3922,7 @@ public CharSequence getAccessibilityClassName() { buttonTextView.setBackground(Theme.createSimpleSelectorRoundRectDrawable(dp(8), Theme.getColor(Theme.key_featuredStickers_addButton, resourcesProvider), Theme.getColor(Theme.key_featuredStickers_addButtonPressed, resourcesProvider))); container.addView(buttonTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48, Gravity.LEFT | Gravity.BOTTOM, 16, 15, 16, 16)); buttonTextView.setOnClickListener(v -> { - TLRPC.TL_birthday b = new TLRPC.TL_birthday(); + TL_account.TL_birthday b = new TL_account.TL_birthday(); b.day = dayPicker.getValue(); b.month = 1 + monthPicker.getValue(); if (yearPicker.getValue() != undefinedYear) { @@ -5401,7 +5397,7 @@ public void getOutline(View view, Outline outline) { return builder; } - public static AlertDialog.Builder createGigagroupConvertAlert(Activity activity, DialogInterface.OnClickListener onProcess, DialogInterface.OnClickListener onCancel) { + public static AlertDialog.Builder createGigagroupConvertAlert(Activity activity, AlertDialog.OnButtonClickListener onProcess, AlertDialog.OnButtonClickListener onCancel) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); String svg = AndroidUtilities.readRes(R.raw.gigagroup); FrameLayout frameLayout = new FrameLayout(activity); @@ -5429,7 +5425,7 @@ public void getOutline(View view, Outline outline) { } @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) - public static AlertDialog.Builder createDrawOverlayPermissionDialog(Activity activity, DialogInterface.OnClickListener onCancel) { + public static AlertDialog.Builder createDrawOverlayPermissionDialog(Activity activity, AlertDialog.OnButtonClickListener onCancel) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); String svg = AndroidUtilities.readRes(R.raw.pip_video_request); @@ -6120,7 +6116,7 @@ public static void createDeleteMessagesAlert(BaseFragment fragment, TLRPC.User u } } - DialogInterface.OnClickListener deleteAction = (dialogInterface, i) -> { + AlertDialog.OnButtonClickListener deleteAction = (dialogInterface, i) -> { ArrayList ids = null; long thisDialogId = dialogId; if (isSavedMessages) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedEmojiDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedEmojiDrawable.java index e754591e16..4910dc1a55 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedEmojiDrawable.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedEmojiDrawable.java @@ -42,8 +42,10 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.NativeByteBuffer; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.SelectAnimatedEmojiDialog; +import org.telegram.ui.Stars.StarsReactionsSheet; import java.io.File; import java.util.ArrayList; @@ -74,12 +76,13 @@ public class AnimatedEmojiDrawable extends Drawable { public static final int CACHE_TYPE_EMOJI_CALL = 17; public static final int CACHE_TYPE_SAVED_REACTION = 18; public static final int CACHE_TYPE_COLORABLE = 19; - // taken from RestrictedEmoji, using thumb as regular emojis - public static final int CACHE_TYPE_STANDARD_EMOJI = 20; + public static final int CACHE_TYPE_STANDARD_EMOJI = 20; // taken from RestrictedEmoji, using thumb as regular emojis public static final int CACHE_TYPE_ALERT_STANDARD_EMOJI = 21; public static final int CACHE_TYPE_FORUM_TOPIC_PULL_DOWN = 22; public static final int CACHE_TYPE_MESSAGE_EFFECT_MINI = 23; public static final int CACHE_TYPE_ALERT_PREVIEW_LARGE_140 = 24; + public static final int CACHE_TYPE_TOGGLEABLE_EDIT = 25; + public static final int CACHE_TYPE_NOANIMATE_FOLDER = 26; public int rawDrawIndex; @@ -306,8 +309,8 @@ private void loadFromServer(ArrayList loadFromServerIds) { req.document_id = loadFromServerIds; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> NotificationCenter.getInstance(currentAccount).doOnIdle(() -> AndroidUtilities.runOnUIThread(() -> { HashSet loadedFromServer = new HashSet<>(loadFromServerIds); - if (res instanceof TLRPC.Vector) { - ArrayList objects = ((TLRPC.Vector) res).objects; + if (res instanceof Vector) { + ArrayList objects = ((Vector) res).objects; putToStorage(objects); processDocuments(objects); for (int i = 0; i < objects.size(); i++) { @@ -497,18 +500,18 @@ public void setupEmojiThumb(String emoji) { } private void updateSize() { - if (this.cacheType == CACHE_TYPE_MESSAGES) { + if (this.cacheType == CACHE_TYPE_MESSAGES || this.cacheType == CACHE_TYPE_NOANIMATE_FOLDER) { sizedp = (int) ((Math.abs(Theme.chat_msgTextPaint.ascent()) + Math.abs(Theme.chat_msgTextPaint.descent())) * 1.15f / AndroidUtilities.density); - } else if (this.cacheType == CACHE_TYPE_MESSAGES_LARGE || this.cacheType == CACHE_TYPE_ALERT_PREVIEW_LARGE || this.cacheType == CACHE_TYPE_COLORABLE || this.cacheType == CACHE_TYPE_STANDARD_EMOJI) { + } else if (Theme.chat_msgTextPaintEmoji != null && (this.cacheType == CACHE_TYPE_MESSAGES_LARGE || this.cacheType == CACHE_TYPE_ALERT_PREVIEW_LARGE || this.cacheType == CACHE_TYPE_COLORABLE || this.cacheType == CACHE_TYPE_STANDARD_EMOJI)) { sizedp = (int) ((Math.abs(Theme.chat_msgTextPaintEmoji[2].ascent()) + Math.abs(Theme.chat_msgTextPaintEmoji[2].descent())) * 1.15f / AndroidUtilities.density); - } else if (this.cacheType == STANDARD_LOTTIE_FRAME) { + } else if (Theme.chat_msgTextPaintEmoji != null && this.cacheType == STANDARD_LOTTIE_FRAME) { sizedp = (int) ((Math.abs(Theme.chat_msgTextPaintEmoji[0].ascent()) + Math.abs(Theme.chat_msgTextPaintEmoji[0].descent())) * 1.15f / AndroidUtilities.density); } else if (cacheType == CACHE_TYPE_AVATAR_CONSTRUCTOR_PREVIEW || cacheType == CACHE_TYPE_AVATAR_CONSTRUCTOR_PREVIEW2 || cacheType == CACHE_TYPE_EMOJI_CALL) { sizedp = 100; } else if (cacheType == CACHE_TYPE_FORUM_TOPIC_LARGE || cacheType == CACHE_TYPE_FORUM_TOPIC_PULL_DOWN) { sizedp = 56; } else if (cacheType == CACHE_TYPE_ALERT_PREVIEW_LARGE_140) { - sizedp = 140; + sizedp = 140; } else if (this.cacheType == CACHE_TYPE_MESSAGE_EFFECT_MINI) { sizedp = 14; } else { @@ -570,7 +573,7 @@ private void initDocument(boolean force) { imageReceiver.setUniqKeyPrefix(cacheType + "_"); } imageReceiver.setVideoThumbIsSame(true); - boolean onlyStaticPreview = SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_LOW && cacheType == CACHE_TYPE_ALERT_PREVIEW_TAB_STRIP || cacheType == CACHE_TYPE_KEYBOARD && !liteModeKeyboard || cacheType == CACHE_TYPE_ALERT_PREVIEW && !liteModeReactions; + boolean onlyStaticPreview = SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_LOW && cacheType == CACHE_TYPE_ALERT_PREVIEW_TAB_STRIP || (cacheType == CACHE_TYPE_KEYBOARD || cacheType == CACHE_TYPE_TOGGLEABLE_EDIT) && !liteModeKeyboard || cacheType == CACHE_TYPE_ALERT_PREVIEW && !liteModeReactions; if (cacheType == CACHE_TYPE_ALERT_PREVIEW_STATIC || cacheType == CACHE_TYPE_ALERT_PREVIEW_STATIC_WITH_THUMB) { onlyStaticPreview = true; } @@ -584,7 +587,7 @@ private void initDocument(boolean force) { if (cacheType != CACHE_TYPE_EMOJI_CALL && cacheType != CACHE_TYPE_AVATAR_CONSTRUCTOR_PREVIEW2 && cacheType != CACHE_TYPE_AVATAR_CONSTRUCTOR_PREVIEW && cacheType != STANDARD_LOTTIE_FRAME && (cacheType != CACHE_TYPE_MESSAGES_LARGE || SharedConfig.getDevicePerformanceClass() < SharedConfig.PERFORMANCE_CLASS_HIGH) && cacheType != CACHE_TYPE_RENDERING_VIDEO) { filter += "_pcache"; } - if (cacheType != CACHE_TYPE_EMOJI_CALL && cacheType != CACHE_TYPE_MESSAGES && cacheType != CACHE_TYPE_MESSAGES_LARGE && cacheType != CACHE_TYPE_AVATAR_CONSTRUCTOR_PREVIEW && cacheType != CACHE_TYPE_AVATAR_CONSTRUCTOR_PREVIEW2 && cacheType != CACHE_TYPE_COLORABLE && cacheType != CACHE_TYPE_STANDARD_EMOJI && cacheType != CACHE_TYPE_ALERT_STANDARD_EMOJI) { + if (cacheType != CACHE_TYPE_EMOJI_CALL && cacheType != CACHE_TYPE_MESSAGES && cacheType != CACHE_TYPE_NOANIMATE_FOLDER && cacheType != CACHE_TYPE_MESSAGES_LARGE && cacheType != CACHE_TYPE_AVATAR_CONSTRUCTOR_PREVIEW && cacheType != CACHE_TYPE_AVATAR_CONSTRUCTOR_PREVIEW2 && cacheType != CACHE_TYPE_COLORABLE && cacheType != CACHE_TYPE_STANDARD_EMOJI && cacheType != CACHE_TYPE_ALERT_STANDARD_EMOJI) { filter += "_compress"; } if (cacheType == STANDARD_LOTTIE_FRAME) { @@ -602,7 +605,7 @@ private void initDocument(boolean force) { thumbDrawable = svgThumb; } else if ("application/x-tgsticker".equals(document.mime_type)) { String probableCacheKey = (cacheType != 0 ? cacheType + "_" : "") + documentId + "@" + filter; - if (SharedConfig.getDevicePerformanceClass() != SharedConfig.PERFORMANCE_CLASS_LOW || (cacheType == CACHE_TYPE_KEYBOARD || cacheType == CACHE_TYPE_FORUM_TOPIC_PULL_DOWN || !ImageLoader.getInstance().hasLottieMemCache(probableCacheKey))) { + if (SharedConfig.getDevicePerformanceClass() != SharedConfig.PERFORMANCE_CLASS_LOW || ((cacheType == CACHE_TYPE_KEYBOARD || cacheType == CACHE_TYPE_TOGGLEABLE_EDIT) || cacheType == CACHE_TYPE_FORUM_TOPIC_PULL_DOWN || !ImageLoader.getInstance().hasLottieMemCache(probableCacheKey))) { float thumbAlpha = cacheType == CACHE_TYPE_FORUM_TOPIC_PULL_DOWN ? 0.8f : 0.2f; SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(document.thumbs, Theme.key_windowBackgroundWhiteGrayIcon, thumbAlpha); if (svgThumb != null && MessageObject.isAnimatedStickerDocument(document, true)) { @@ -663,7 +666,7 @@ private void initDocument(boolean force) { imageReceiver.setLayerNum(6656); } imageReceiver.setAspectFit(true); - if (cacheType == CACHE_TYPE_RENDERING_VIDEO || cacheType == CACHE_TYPE_SAVED_REACTION || cacheType == STANDARD_LOTTIE_FRAME || cacheType == CACHE_TYPE_TAB_STRIP || cacheType == CACHE_TYPE_ALERT_PREVIEW_TAB_STRIP) { + if (cacheType == CACHE_TYPE_RENDERING_VIDEO || cacheType == CACHE_TYPE_NOANIMATE_FOLDER || cacheType == CACHE_TYPE_SAVED_REACTION || cacheType == STANDARD_LOTTIE_FRAME || cacheType == CACHE_TYPE_TAB_STRIP || cacheType == CACHE_TYPE_ALERT_PREVIEW_TAB_STRIP || cacheType == CACHE_TYPE_TOGGLEABLE_EDIT && disabledToggleableAnimations) { imageReceiver.setAllowStartAnimation(false); imageReceiver.setAllowStartLottieAnimation(false); imageReceiver.setAutoRepeat(0); @@ -684,6 +687,43 @@ private void initDocument(boolean force) { invalidate(); } + private static boolean disabledToggleableAnimations; + public static void toggleAnimations(int currentAccount, boolean enabled) { + if (disabledToggleableAnimations == (!enabled)) return; + disabledToggleableAnimations = !enabled; + if (globalEmojiCache == null) return; + final int key = Objects.hash(currentAccount, CACHE_TYPE_TOGGLEABLE_EDIT); + LongSparseArray emojis = globalEmojiCache.get(key); + if (emojis != null) { + for (int i = 0; i < emojis.size(); ++i) { + AnimatedEmojiDrawable drawable = emojis.valueAt(i); + if (drawable == null) continue; + ImageReceiver imageReceiver = drawable.getImageReceiver(); + if (imageReceiver == null) continue; + if (enabled) { + imageReceiver.setAllowStartLottieAnimation(true); + imageReceiver.setAllowStartAnimation(true); + imageReceiver.setAutoRepeat(1); + AnimatedFileDrawable animation = imageReceiver.getAnimation(); + if (animation != null) { + animation.setUseSharedQueue(imageReceiver.useSharedAnimationQueue); + animation.start(); + } else { + RLottieDrawable rLottieDrawable = imageReceiver.getLottieAnimation(); + if (rLottieDrawable != null) { + rLottieDrawable.start(); + } + } + } else { + imageReceiver.setAllowStartAnimation(false); + imageReceiver.setAllowStartLottieAnimation(false); + imageReceiver.setAutoRepeat(0); + imageReceiver.stopAnimation(); + } + } + } + } + public boolean preloading; public void preload() { this.preloading = true; @@ -1001,9 +1041,10 @@ public static class SwapAnimatedEmojiDrawable extends Drawable implements Animat public boolean center = false; private int cacheType; - private OvershootInterpolator overshootInterpolator = new OvershootInterpolator(2f); - private AnimatedFloat changeProgress = new AnimatedFloat((View) null, 300, CubicBezierInterpolator.EASE_OUT); - private Drawable[] drawables = new Drawable[2]; + private final OvershootInterpolator overshootInterpolator = new OvershootInterpolator(2f); + private final AnimatedFloat changeProgress = new AnimatedFloat((View) null, 300, CubicBezierInterpolator.EASE_OUT); + private final AnimatedFloat particlesAlpha = new AnimatedFloat((View) null, 300, CubicBezierInterpolator.EASE_OUT); + private final Drawable[] drawables = new Drawable[2]; private View parentView; private View secondParent; private boolean invalidateParent; @@ -1026,6 +1067,7 @@ public SwapAnimatedEmojiDrawable(View parentView, int size, int cacheType) { public SwapAnimatedEmojiDrawable(View parentView, boolean invalidateParent, int size, int cacheType) { changeProgress.setParent(this.parentView = parentView); + particlesAlpha.setParent(this.parentView = parentView); this.size = size; this.cacheType = cacheType; this.invalidateParent = invalidateParent; @@ -1033,6 +1075,7 @@ public SwapAnimatedEmojiDrawable(View parentView, boolean invalidateParent, int public void setParentView(View parentView) { changeProgress.setParent(parentView); + particlesAlpha.setParent(parentView); this.parentView = parentView; } @@ -1047,6 +1090,28 @@ public void play() { } } + private boolean hasParticles; + private StarsReactionsSheet.Particles particles; + public void setParticles(boolean show, boolean animated) { + if (hasParticles == show) return; + if (animated) { + if (particles == null) { + particles = new StarsReactionsSheet.Particles(StarsReactionsSheet.Particles.TYPE_RADIAL, 8); + } + hasParticles = show; + invalidate(); + } else { + hasParticles = show; + if (show && particles == null) { + particles = new StarsReactionsSheet.Particles(StarsReactionsSheet.Particles.TYPE_RADIAL, 8); + } else if (!show && particles != null) { + particles = null; + } + particlesAlpha.set(show, true); + invalidate(); + } + } + private Integer lastColor; private int colorFilterLastColor; private ColorFilter colorFilter; @@ -1061,14 +1126,29 @@ public void setColor(Integer color) { } } + private int offsetX, offsetY; + public void offset(int ox, int oy) { + offsetX = ox; + offsetY = oy; + } + public Integer getColor() { return lastColor; } + private final Rect bounds = new Rect(); @Override public void draw(@NonNull Canvas canvas) { float progress = changeProgress.set(1); - Rect bounds = getBounds(); + bounds.set(getBounds()); + bounds.offset(offsetX, offsetY); + final float particlesAlpha = this.particlesAlpha.set(hasParticles); + if (particlesAlpha > 0) { + particles.setBounds(bounds); + particles.process(); + particles.draw(canvas, Theme.multAlpha(lastColor == null ? 0xFFFFFFFF : lastColor, particlesAlpha)); + invalidate(); + } if (drawables[1] != null && progress < 1) { drawables[1].setAlpha((int) (alpha * (1f - progress))); int dw = drawables[1].getIntrinsicWidth() < 0 ? getIntrinsicWidth() : drawables[1].getIntrinsicWidth(); @@ -1077,17 +1157,17 @@ public void draw(@NonNull Canvas canvas) { drawables[1].setBounds(bounds); } else if (center) { drawables[1].setBounds( - bounds.centerX() - dw / 2, - bounds.centerY() - dh / 2, - bounds.centerX() + dw / 2, - bounds.centerY() + dh / 2 + bounds.centerX() - dw / 2, + bounds.centerY() - dh / 2, + bounds.centerX() + dw / 2, + bounds.centerY() + dh / 2 ); } else { // left drawables[1].setBounds( - bounds.left, - bounds.centerY() - dh / 2, - bounds.left + dw, - bounds.centerY() + dh / 2 + bounds.left, + bounds.centerY() - dh / 2, + bounds.left + dw, + bounds.centerY() + dh / 2 ); } drawables[1].setColorFilter(colorFilter); @@ -1158,7 +1238,7 @@ public float isNotEmpty() { } public boolean isEmpty() { - return drawables[0] != null; + return drawables[0] == null; } public boolean set(long documentId, int cacheType, boolean animated) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedEmojiSpan.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedEmojiSpan.java index 4ecc1db014..55ed85d086 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedEmojiSpan.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedEmojiSpan.java @@ -7,11 +7,14 @@ import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.Paint; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.text.Layout; import android.text.Spannable; import android.text.SpannableString; +import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.TextUtils; import android.text.style.CharacterStyle; @@ -1002,6 +1005,10 @@ public static CharSequence cloneSpans(CharSequence text, int newCacheType) { } public static CharSequence cloneSpans(CharSequence text, int newCacheType, Paint.FontMetricsInt fontMetricsInt) { + return cloneSpans(text, newCacheType, fontMetricsInt, 1.0f); + } + + public static CharSequence cloneSpans(CharSequence text, int newCacheType, Paint.FontMetricsInt fontMetricsInt, float scale) { if (!(text instanceof Spanned)) { return text; } @@ -1030,6 +1037,7 @@ public static CharSequence cloneSpans(CharSequence text, int newCacheType, Paint if (newCacheType != -1) { newSpan.cacheType = newCacheType; } + newSpan.scale = oldSpan.scale * scale; newText.setSpan(newSpan, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } else { // newText.setSpan(spans[i], start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); @@ -1038,29 +1046,53 @@ public static CharSequence cloneSpans(CharSequence text, int newCacheType, Paint return newText; } + public static CharSequence onlyEmojiSpans(CharSequence text) { + if (text == null) return null; + SpannableStringBuilder result = new SpannableStringBuilder(text); + CharacterStyle[] spans = result.getSpans(0, result.length(), CharacterStyle.class); + for (int i = 0; i < spans.length; ++i) { + if (!(spans[i] instanceof AnimatedEmojiSpan) && !(spans[i] instanceof Emoji.EmojiSpan)) { + result.removeSpan(spans[i]); + } + } + return result; + } + public static class TextViewEmojis extends TextView { + private int cacheType = AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES; public TextViewEmojis(Context context) { super(context); } + private ColorFilter emojiColorFilter; + public void setEmojiColor(int emojiColor) { + emojiColorFilter = new PorterDuffColorFilter(emojiColor, PorterDuff.Mode.SRC_IN); + } + + public void setCacheType(int cacheType) { + if (this.cacheType == cacheType) return; + this.cacheType = cacheType; + stack = AnimatedEmojiSpan.update(cacheType, this, stack, getLayout()); + } + AnimatedEmojiSpan.EmojiGroupedSpans stack; @Override public void setText(CharSequence text, TextView.BufferType type) { super.setText(text, type); - stack = AnimatedEmojiSpan.update(AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, this, stack, getLayout()); + stack = AnimatedEmojiSpan.update(cacheType, this, stack, getLayout()); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); - stack = AnimatedEmojiSpan.update(AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, this, stack, getLayout()); + stack = AnimatedEmojiSpan.update(cacheType, this, stack, getLayout()); } @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); - stack = AnimatedEmojiSpan.update(AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, this, stack, getLayout()); + stack = AnimatedEmojiSpan.update(cacheType, this, stack, getLayout()); } @Override @@ -1078,7 +1110,7 @@ protected void onDraw(Canvas canvas) { canvas.save(); canvas.translate(offsetX, offsetY); } - AnimatedEmojiSpan.drawAnimatedEmojis(canvas, getLayout(), stack, 0, null, 0, 0, 0, 1f); + AnimatedEmojiSpan.drawAnimatedEmojis(canvas, getLayout(), stack, 0, null, 0, 0, 0, 1f, emojiColorFilter); if (offsetY != 0 || offsetX != 0) { canvas.restore(); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedFileDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedFileDrawable.java index f62e11a78a..25aa39b053 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedFileDrawable.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedFileDrawable.java @@ -247,7 +247,7 @@ private void chekDestroyDecoder() { } } - private void invalidateInternal() { + public void invalidateInternal() { for (int i = 0; i < parents.size(); i++) { parents.get(i).invalidate(); } @@ -912,8 +912,8 @@ public void drawInternal(Canvas canvas, boolean drawInBackground, long currentTi currentTime = System.currentTimeMillis(); } - RectF rect = drawInBackground ? dstRectBackground[threadIndex] : dstRect; - Paint paint = drawInBackground ? backgroundPaint[threadIndex] : getPaint(); + final RectF rect = drawInBackground ? dstRectBackground[threadIndex] : dstRect; + final Paint paint = drawInBackground ? backgroundPaint[threadIndex] : getPaint(); if (!drawInBackground) { updateCurrentFrame(currentTime, false); @@ -1063,6 +1063,21 @@ public Bitmap getAnimatedBitmap() { return null; } + public void replaceAnimatedBitmap(Bitmap b) { + if (renderingBitmap != null) { + unusedBitmaps.add(renderingBitmap); + } + if (nextRenderingBitmap != null) { + unusedBitmaps.add(nextRenderingBitmap); + } + if (nextRenderingBitmap2 != null) { + unusedBitmaps.add(nextRenderingBitmap2); + } + renderingBitmap = b; + nextRenderingBitmap = null; + nextRenderingBitmap2 = null; + } + public void setActualDrawRect(float x, float y, float width, float height) { float bottom = y + height; float right = x + width; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedFloat.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedFloat.java index e1d526205c..48f7a2d26f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedFloat.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedFloat.java @@ -134,6 +134,13 @@ public float set(boolean mustBe) { } // do set(value, true) when it's needed to skip animation + public void force(float value) { + this.set(value, true); + } + + public void force(boolean value) { + this.set(value ? 1 : 0, true); + } public float set(boolean mustBe, boolean force) { return this.set(mustBe ? 1 : 0, force); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedTextView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedTextView.java index a6306b4cc0..2d203f73bc 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedTextView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedTextView.java @@ -996,7 +996,7 @@ public void setEmojiColorFilter(ColorFilter colorFilter) { public void setEmojiColor(int emojiColor) { if (this.emojiColor != emojiColor) { - emojiColorFilter = new PorterDuffColorFilter(this.emojiColor = emojiColor, PorterDuff.Mode.MULTIPLY); + emojiColorFilter = new PorterDuffColorFilter(this.emojiColor = emojiColor, PorterDuff.Mode.SRC_IN); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/AvatarConstructorFragment.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/AvatarConstructorFragment.java index 1dab97b36e..c2f5dc77b3 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/AvatarConstructorFragment.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/AvatarConstructorFragment.java @@ -46,6 +46,7 @@ import org.telegram.messenger.SvgHelper; import org.telegram.messenger.Utilities; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_stars; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenu; import org.telegram.ui.ActionBar.ActionBarMenuItem; @@ -95,13 +96,13 @@ public class AvatarConstructorFragment extends BaseFragment { private int gradientBackgroundItemWidth; public static final int[][] defaultColors = new int[][]{ - new int[]{0xFF4D8DFF, 0xFF2BBFFF, 0xFF20E2CD, 0xFF0EE1F1}, - new int[]{0xFF5EB6FB, 0xFF1FCEEB, 0xFF45F7B7, 0xFF1FF1D9}, - new int[]{0xFF09D260, 0xFF5EDC40, 0xFFC1E526, 0xFF80DF2B}, - new int[]{0xFFF5694E, 0xFFF5772C, 0xFFFFD412, 0xFFFFA743}, - new int[]{0xFFF64884, 0xFFEF5B41, 0xFFF6A730, 0xFFFF7742}, - new int[]{0xFFF94BA0, 0xFFFB5C80, 0xFFFFB23A, 0xFFFE7E62}, - new int[]{0xFF837CFF, 0xFFB063FF, 0xFFFF72A9, 0xFFE269FF} + new int[]{ 0xFF5387DB, 0xFF4F90DB, 0xFF60D6BB, 0xFF50D2D9 }, + new int[]{ 0xFF54A5E3, 0xFF48ADC7, 0xFF63D695, 0xFF5AE6BC }, + new int[]{ 0xFF3ABD86, 0xFF55BD4A, 0xFFCCCC52, 0xFFB0C756 }, + new int[]{ 0xFF836CEB, 0xFFAF68E8, 0xFFDE6D9A, 0xFFD974ED }, + new int[]{ 0xFFEC5BA1, 0xFFEB6577, 0xFFEB9744, 0xFFF27E64 }, + new int[]{ 0xFFEA5877, 0xFFE2724D, 0xFFF4AA49, 0xFFF08550 }, + new int[]{ 0xFFF07854, 0xFFED7E39, 0xFFF0C241, 0xFFF0B04A } }; public boolean finishOnDone = true; private ActionBarMenuItem setPhotoItem; @@ -414,7 +415,7 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto } } - protected void onEmojiSelected(View view, Long documentId, TLRPC.Document document, Integer until) { + protected void onEmojiSelected(View view, Long documentId, TLRPC.Document document, TL_stars.TL_starGiftUnique gift, Integer until) { long docId = documentId == null ? 0 : documentId; setPreview(docId, document); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/AvatarDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/AvatarDrawable.java index 434cc0ff55..87b438255f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/AvatarDrawable.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/AvatarDrawable.java @@ -394,6 +394,17 @@ private static String takeFirstCharacter(String text) { return text.substring(0, text.offsetByCodePoints(0, Math.min(text.codePointCount(0, text.length()), 1))); } + public void setInfo(long id) { + invalidateTextLayout = true; + hasGradient = true; + hasAdvancedGradient = false; + color = getThemedColor(Theme.keys_avatar_background[getColorIndex(id)]); + color2 = getThemedColor(Theme.keys_avatar_background2[getColorIndex(id)]); + avatarType = AVATAR_TYPE_NORMAL; + drawDeleted = false; + getAvatarSymbols("", "", "", stringBuilder); + } + public void setInfo(long id, String firstName, String lastName, String custom) { setInfo(id, firstName, lastName, custom, null, null); } @@ -529,6 +540,11 @@ public static void getAvatarSymbols(String firstName, String lastName, String cu } } + private Drawable customIconDrawable; + public void setCustomIcon(Drawable drawable) { + customIconDrawable = drawable; + } + @Override public void draw(Canvas canvas) { Rect bounds = getBounds(); @@ -600,10 +616,12 @@ public void draw(Canvas canvas) { Theme.dialogs_archiveAvatarDrawable.setBounds(x, y, x + w, y + h); Theme.dialogs_archiveAvatarDrawable.draw(canvas); canvas.restore(); - } else if (avatarType != 0) { + } else if (avatarType != 0 || customIconDrawable != null) { Drawable drawable; - if (avatarType == AVATAR_TYPE_SAVED) { + if (customIconDrawable != null) { + drawable = customIconDrawable; + } else if (avatarType == AVATAR_TYPE_SAVED) { drawable = Theme.avatarDrawables[0]; } else if (avatarType == AVATAR_TYPE_FILTER_CONTACTS) { drawable = Theme.avatarDrawables[2]; @@ -681,7 +699,7 @@ public void draw(Canvas canvas) { invalidateTextLayout = false; if (stringBuilder.length() > 0) { CharSequence text = stringBuilder.toString().toUpperCase(); - text = Emoji.replaceEmoji(text, namePaint.getFontMetricsInt(), dp(16), true); + text = Emoji.replaceEmoji(text, namePaint.getFontMetricsInt(), true); if (textLayout == null || !TextUtils.equals(text, textLayout.getText())) { try { textLayout = new StaticLayout(text, namePaint, dp(100), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/BackupImageView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/BackupImageView.java index 39c9049259..6441660f5a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/BackupImageView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/BackupImageView.java @@ -39,6 +39,7 @@ public class BackupImageView extends View { protected int width = -1; protected int height = -1; public AnimatedEmojiDrawable animatedEmojiDrawable; + public ColorFilter animatedEmojiDrawableColorFilter; private AvatarDrawable avatarDrawable; boolean attached; @@ -316,6 +317,9 @@ protected void onDraw(Canvas canvas) { if (imageReceiver == null) { return; } + if (animatedEmojiDrawable != null && animatedEmojiDrawableColorFilter != null) { + animatedEmojiDrawable.setColorFilter(animatedEmojiDrawableColorFilter); + } if (width != -1 && height != -1) { if (drawFromStart) { imageReceiver.setImageCoords(0, 0, width, height); @@ -358,6 +362,11 @@ public void setAnimatedEmojiDrawable(AnimatedEmojiDrawable animatedEmojiDrawable invalidate(); } + public void setEmojiColorFilter(ColorFilter colorFilter) { + animatedEmojiDrawableColorFilter = colorFilter; + invalidate(); + } + public AnimatedEmojiDrawable getAnimatedEmojiDrawable() { return animatedEmojiDrawable; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Bulletin.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Bulletin.java index 35bb4ee66d..666a359b56 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Bulletin.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Bulletin.java @@ -1,6 +1,7 @@ package org.telegram.ui.Components; import static org.telegram.messenger.AndroidUtilities.dp; +import static org.telegram.messenger.AndroidUtilities.dpf2; import static java.lang.annotation.RetentionPolicy.SOURCE; import android.animation.Animator; @@ -239,6 +240,12 @@ public Bulletin show() { return show(false); } + private boolean skipShowAnimation; + public Bulletin skipShowAnimation() { + skipShowAnimation = true; + return this; + } + public Bulletin show(boolean top) { if (!showing && containerLayout != null) { showing = true; @@ -302,7 +309,7 @@ public void onLayoutChange(View v, int left, int t, int right, int bottom, int o if (currentDelegate != null) { currentDelegate.onShow(Bulletin.this); } - if (isTransitionsEnabled()) { + if (isTransitionsEnabled() && !skipShowAnimation) { ensureLayoutTransitionCreated(); layout.transitionRunningEnter = true; layout.delegate = currentDelegate; @@ -1578,6 +1585,95 @@ public void didReceivedNotification(int id, int account, Object... args) { } } + public static class ProgressLayout extends ButtonLayout { + + public float progress; + public FrameLayout progressView; + public BackupImageView imageView; + public AnimatedTextView textView; + + public ProgressLayout(@NonNull Context context, Theme.ResourcesProvider resourcesProvider) { + super(context, resourcesProvider); + + progressView = new FrameLayout(context) { + private final AnimatedFloat animatedProgress = new AnimatedFloat(this, 320, CubicBezierInterpolator.EASE_OUT_QUINT); + private final AnimatedFloat animatedDone = new AnimatedFloat(this, 320, CubicBezierInterpolator.EASE_OUT_QUINT); + private final Paint strokePaint = new Paint(Paint.ANTI_ALIAS_FLAG); { + strokePaint.setStyle(Paint.Style.STROKE); + strokePaint.setColor(0xFFFFFFF); + strokePaint.setStrokeWidth(dp(1.66f)); + strokePaint.setStrokeCap(Paint.Cap.ROUND); + strokePaint.setStrokeJoin(Paint.Join.ROUND); + } + private final RectF rect = new RectF(); + private final long start = System.currentTimeMillis(); + @Override + protected void onDraw(@NonNull Canvas canvas) { + final float progress = animatedProgress.set(ProgressLayout.this.progress); + final float done = animatedDone.set(ProgressLayout.this.progress >= 1); + + final float cx = getWidth() / 2.0f, cy = getHeight() / 2.0f; + rect.set(cx - dpf2(13), cy - dpf2(13), cx + dpf2(13), cy + dpf2(13)); + + float t = ((System.currentTimeMillis() - start) * .45f) % 5400; + float segment0 = Math.max(0, 1520 * t / 5400f - 20); + float segment1 = 1520 * t / 5400f; + for (int i = 0; i < 4; ++i) { + segment1 += CircularProgressDrawable.interpolator.getInterpolation((t - i * 1350) / 667f) * 250; + segment0 += CircularProgressDrawable.interpolator.getInterpolation((t - (667 + i * 1350)) / 667f) * 250; + } + strokePaint.setColor(Theme.multAlpha(0xFFFFFFFF, 1.0f * (1.0f - done))); + canvas.drawArc(rect, -90 - segment0, -360 * Math.max(.02f, progress), false, strokePaint); + + if (progress < 1 && done < 1) { + invalidate(); + } + + super.onDraw(canvas); + } + }; + progressView.setWillNotDraw(false); + addView(progressView, LayoutHelper.createFrameRelatively(32, 32, Gravity.START | Gravity.CENTER_VERTICAL, 12, 8, 12, 8)); + + imageView = new BackupImageView(context); + imageView.setRoundRadius(dp(14)); + progressView.addView(imageView, LayoutHelper.createFrame(28, 28, Gravity.CENTER)); + + textView = new AnimatedTextView(context); + textView.setTypeface(Typeface.SANS_SERIF); + textView.setTextSize(dp(15)); + textView.setPadding(0, dp(8), 0, dp(8)); + addView(textView, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, 18, Gravity.START | Gravity.CENTER_VERTICAL, 56, 0, 8, 0)); + + setTextColor(getThemedColor(Theme.key_undo_infoColor)); + setBackground(getThemedColor(Theme.key_undo_background)); + } + + public ProgressLayout(@NonNull Context context, Theme.ResourcesProvider resourcesProvider, int backgroundColor, int textColor) { + this(context, resourcesProvider); + setBackground(backgroundColor); + setTextColor(textColor); + } + + public void setTextColor(int textColor) { + textView.setTextColor(textColor); + } + + public CharSequence getAccessibilityText() { + return textView.getText(); + } + + private boolean inprogress; + public void setProgress(float progress) { + if (inprogress != progress < 1) { + inprogress = progress < 1; + imageView.animate().scaleX(inprogress ? 0.78f : 1.0f).scaleY(inprogress ? 0.78f : 1.0f).setDuration(320).setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT).start(); + } + this.progress = progress; + progressView.invalidate(); + } + } + public static class LottieLayout extends ButtonLayout { public RLottieImageView imageView; @@ -1599,7 +1695,7 @@ public LottieLayout(@NonNull Context context, Theme.ResourcesProvider resourcesP @Override public void setText(CharSequence text, BufferType type) { - text = Emoji.replaceEmoji(text, getPaint().getFontMetricsInt(), dp(13), false); + text = Emoji.replaceEmoji(text, getPaint().getFontMetricsInt(), false); super.setText(text, type); } }; @@ -1725,7 +1821,7 @@ public UsersLayout(@NonNull Context context, boolean subtitle, Theme.ResourcesPr textView = new LinkSpanDrawable.LinksTextView(context) { @Override public void setText(CharSequence text, BufferType type) { - text = Emoji.replaceEmoji(text, getPaint().getFontMetricsInt(), dp(13), false); + text = Emoji.replaceEmoji(text, getPaint().getFontMetricsInt(), false); super.setText(text, type); } }; @@ -1744,7 +1840,7 @@ public void setText(CharSequence text, BufferType type) { textView = new LinkSpanDrawable.LinksTextView(context) { @Override public void setText(CharSequence text, BufferType type) { - text = Emoji.replaceEmoji(text, getPaint().getFontMetricsInt(), dp(13), false); + text = Emoji.replaceEmoji(text, getPaint().getFontMetricsInt(), false); super.setText(text, type); } }; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/BulletinFactory.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/BulletinFactory.java index 63b61dcd19..2aa0e9d73c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/BulletinFactory.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/BulletinFactory.java @@ -9,10 +9,6 @@ import android.graphics.PorterDuffColorFilter; import android.graphics.Typeface; import android.graphics.drawable.Drawable; -import android.net.Uri; -import android.os.Bundle; -import android.os.Environment; -import android.provider.MediaStore; import android.text.Spannable; import android.text.SpannableString; import android.text.SpannableStringBuilder; @@ -20,7 +16,6 @@ import android.text.TextPaint; import android.text.TextUtils; import android.text.style.ClickableSpan; -import android.util.Log; import android.util.TypedValue; import android.view.Gravity; import android.view.HapticFeedbackConstants; @@ -30,14 +25,10 @@ import androidx.annotation.CheckResult; import androidx.annotation.NonNull; -import androidx.core.content.FileProvider; import androidx.core.graphics.ColorUtils; -import com.google.common.collect.Lists; - import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ApplicationLoader; -import org.telegram.messenger.BuildVars; import org.telegram.messenger.ChatObject; import org.telegram.messenger.DialogObject; import org.telegram.messenger.FileLoader; @@ -57,12 +48,10 @@ import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.BottomSheet; import org.telegram.ui.ActionBar.Theme; -import org.telegram.ui.ChatActivity; import org.telegram.ui.LaunchActivity; import org.telegram.ui.PremiumPreviewFragment; import org.telegram.ui.Stories.recorder.HintView2; -import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -107,9 +96,13 @@ public Bulletin makeForError(TLRPC.TL_error error) { public void showForError(TLRPC.TL_error error) { if (!LaunchActivity.isActive) return; if (error == null) { - createErrorBulletin(LocaleController.formatString(R.string.UnknownError)).show(); + Bulletin b = createErrorBulletin(LocaleController.formatString(R.string.UnknownError)); + b.hideAfterBottomSheet = false; + b.show(); } else { - createErrorBulletin(LocaleController.formatString(R.string.UnknownErrorCode, error.text)).show(); + Bulletin b = createErrorBulletin(LocaleController.formatString(R.string.UnknownErrorCode, error.text)); + b.hideAfterBottomSheet = false; + b.show(); } } @@ -478,6 +471,10 @@ public Bulletin createUsersBulletin(TLObject user, CharSequence text, CharSequen return createUsersBulletin(Arrays.asList(user), text, subtitle, null); } + public Bulletin createUsersBulletin(TLObject user, CharSequence text) { + return createUsersBulletin(Arrays.asList(user), text, null, null); + } + public Bulletin createUsersBulletin(List users, CharSequence text, CharSequence subtitle) { return createUsersBulletin(users, text, subtitle, null); } @@ -527,7 +524,7 @@ public Bulletin createUsersBulletin(List users, CharSequence } } else { layout.textView.setSingleLine(false); - layout.textView.setMaxLines(2); + layout.textView.setMaxLines(4); layout.textView.setText(text); if (layout.textView.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) { int margin = dp(12 + 56 + 2 - (3 - count) * 12); @@ -929,7 +926,7 @@ public Bulletin createErrorBulletinSubtitle(CharSequence errorMessage, CharSeque @CheckResult public Bulletin createCopyLinkBulletin() { - return createCopyLinkBulletin(false, resourcesProvider); + return createCopyLinkBulletin(false); } @CheckResult @@ -949,7 +946,7 @@ public Bulletin createCopyBulletin(String message, Theme.ResourcesProvider resou } @CheckResult - public Bulletin createCopyLinkBulletin(boolean isPrivate, Theme.ResourcesProvider resourcesProvider) { + public Bulletin createCopyLinkBulletin(boolean isPrivate) { if (!AndroidUtilities.shouldShowClipboardToast()) { return new Bulletin.EmptyBulletin(); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ButtonSpan.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ButtonSpan.java index 0d7cc662ac..ee07f99d58 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ButtonSpan.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ButtonSpan.java @@ -10,7 +10,9 @@ import android.text.Layout; import android.text.Spannable; import android.text.SpannableString; +import android.text.SpannableStringBuilder; import android.text.Spanned; +import android.text.TextUtils; import android.text.style.ClickableSpan; import android.text.style.ReplacementSpan; import android.view.MotionEvent; @@ -33,7 +35,7 @@ public class ButtonSpan extends ReplacementSpan { private final Runnable onClickListener; private ButtonBounce bounce; - private ButtonSpan(CharSequence buttonText, Runnable onClick, Theme.ResourcesProvider resourcesProvider) { + public ButtonSpan(CharSequence buttonText, Runnable onClick, Theme.ResourcesProvider resourcesProvider) { this.resourcesProvider = resourcesProvider; this.onClickListener = onClick; text = new Text(buttonText, 12); @@ -100,7 +102,10 @@ public ButtonSpan findSpan(float x, int y) { ButtonSpan[] spans = spanned.getSpans(layout.getLineStart(line), layout.getLineEnd(line), ButtonSpan.class); for (int i = 0; i < spans.length; ++i) { ButtonSpan span = spans[i]; - if (spanned.getSpanStart(span) <= offset && spanned.getSpanEnd(span) >= offset) { + if ( + spanned.getSpanStart(span) <= offset && spanned.getSpanEnd(span) >= offset && + layout.getPrimaryHorizontal(spanned.getSpanStart(span)) <= x && layout.getPrimaryHorizontal(spanned.getSpanEnd(span)) >= x + ) { return span; } } @@ -113,7 +118,7 @@ public ButtonSpan findSpan(float x, int y) { @Override public boolean onTouchEvent(MotionEvent event) { int action = event.getAction(); - ButtonSpan span = findSpan(event.getX(), (int) event.getY()); + ButtonSpan span = findSpan(event.getX() - getPaddingLeft(), (int) event.getY() - getPaddingTop()); if (action == MotionEvent.ACTION_DOWN) { pressedSpan = span; if (pressedSpan != null) { @@ -136,5 +141,30 @@ public boolean onTouchEvent(MotionEvent event) { } return pressedSpan != null || super.onTouchEvent(event); } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + } + + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + super.onLayout(changed, left, top, right, bottom); + if (buttonToBeAdded != null && getMeasuredWidth() > 0) { + SpannableString btn = new SpannableString(" btn"); + btn.setSpan(buttonToBeAdded, 1, btn.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + SpannableStringBuilder sb = new SpannableStringBuilder( + TextUtils.ellipsize(getText(), getPaint(), getMeasuredWidth() - getPaddingLeft() - getPaddingRight() - buttonToBeAdded.getSize() - dp(4), TextUtils.TruncateAt.END) + ); + sb.append(btn); + setText(sb); + buttonToBeAdded = null; + } + } + + ButtonSpan buttonToBeAdded; + public void addButton(ButtonSpan span) { + buttonToBeAdded = span; + } } } \ No newline at end of file diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/CaptionPhotoViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/CaptionPhotoViewer.java index 6a627e43d5..b8416d5684 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/CaptionPhotoViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/CaptionPhotoViewer.java @@ -446,9 +446,9 @@ public int getEditTextHeight() { @Override public boolean dispatchTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { - moveButtonBounce.setPressed(moveButtonBounds.contains(event.getX(), event.getY())); + moveButtonBounce.setPressed(moveButtonAnimated.get() > 0 && moveButtonBounds.contains(event.getX(), event.getY())); } else if (event.getAction() == MotionEvent.ACTION_MOVE) { - if (moveButtonBounce.isPressed() && !moveButtonBounds.contains(event.getX(), event.getY())) { + if (moveButtonBounce.isPressed() && (moveButtonAnimated.get() <= 0 || !moveButtonBounds.contains(event.getX(), event.getY()))) { moveButtonBounce.setPressed(false); } } else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java index c17722002e..6b691d04b1 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java @@ -130,6 +130,7 @@ import org.telegram.messenger.MediaDataController; import org.telegram.messenger.MessageObject; import org.telegram.messenger.MessagesController; +import org.telegram.messenger.MessagesStorage; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.NotificationsController; import org.telegram.messenger.R; @@ -145,6 +146,7 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.tgnet.tl.TL_bots; import org.telegram.tgnet.tl.TL_stories; import org.telegram.ui.ActionBar.ActionBar; @@ -189,6 +191,7 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Locale; @@ -665,7 +668,7 @@ public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo i private MessageObject editingMessageObject; private boolean editingCaption; - private TLRPC.TL_businessChatLink editingBusinessLink; + private TL_account.TL_businessChatLink editingBusinessLink; private BusinessLinkPresetMessage lastSavedBusinessLinkMessage; @@ -3897,8 +3900,7 @@ private void createBotCommandsMenuButton() { botCommandsMenuButton.setOpened(open); try { performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - } catch (Exception ignore) { - } + } catch (Exception ignore) {} if (hasBotWebView()) { if (open) { if (emojiViewVisible || botKeyboardViewVisible) { @@ -4082,7 +4084,9 @@ protected void onLineCountChanged(int oldLineCount, int newLineCount) { private void startLockTransition() { AnimatorSet animatorSet = new AnimatorSet(); - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} ObjectAnimator translate = ObjectAnimator.ofFloat(this, "lockAnimatedTranslation", startTranslation); translate.setStartDelay(100); @@ -8694,7 +8698,7 @@ public void setCommand(MessageObject messageObject, String command, boolean long } } - public void setEditingBusinessLink(TLRPC.TL_businessChatLink businessLink) { + public void setEditingBusinessLink(TL_account.TL_businessChatLink businessLink) { editingBusinessLink = businessLink; updateFieldHint(false); if (editingBusinessLink != null) { @@ -10055,7 +10059,8 @@ public void run() { TLRPC.TL_keyboardButtonRequestPeer btn = (TLRPC.TL_keyboardButtonRequestPeer) button; if (btn.peer_type != null && messageObject != null && messageObject.messageOwner != null) { if (btn.peer_type instanceof TLRPC.TL_requestPeerTypeUser && btn.max_quantity > 1) { - MultiContactsSelectorBottomSheet.open(btn.max_quantity, ids -> { + TLRPC.TL_requestPeerTypeUser peer_type = (TLRPC.TL_requestPeerTypeUser) btn.peer_type; + MultiContactsSelectorBottomSheet.open(peer_type.bot, peer_type.premium, btn.max_quantity, ids -> { if (ids != null && !ids.isEmpty()) { TLRPC.TL_messages_sendBotRequestedPeer req = new TLRPC.TL_messages_sendBotRequestedPeer(); req.peer = MessagesController.getInstance(currentAccount).getInputPeer(messageObject.messageOwner.peer_id); @@ -10090,7 +10095,13 @@ public void run() { req.peer = MessagesController.getInstance(currentAccount).getInputPeer(messageObject.messageOwner.peer_id); req.msg_id = messageObject.getId(); req.button_id = btn.button_id; - req.requested_peers.add(MessagesController.getInstance(currentAccount).getInputPeer(dids.get(0).dialogId)); + HashSet dialogIds = new HashSet<>(); + for (MessagesStorage.TopicKey key : dids) { + dialogIds.add(key.dialogId); + } + for (long did : dialogIds) { + req.requested_peers.add(MessagesController.getInstance(currentAccount).getInputPeer(did)); + } ConnectionsManager.getInstance(currentAccount).sendRequest(req, null); } dialogFragment.finishFragment(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlert.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlert.java index 554f92cc14..355ea8a158 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlert.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlert.java @@ -836,6 +836,7 @@ public void onPanTransitionEnd() { protected int avatarPicker; protected boolean avatarSearch; + protected Utilities.Callback0Return avatarWithBulletin; protected boolean typeButtonsAvailable; private boolean stories; @@ -2764,7 +2765,7 @@ public void afterTextChanged(Editable editable) { for (int i = 0; i < spans.length; i++) { editable.removeSpan(spans[i]); } - Emoji.replaceEmoji(editable, commentTextView.getEditText().getPaint().getFontMetricsInt(), dp(20), false); + Emoji.replaceEmoji(editable, commentTextView.getEditText().getPaint().getFontMetricsInt(), false); processChange = false; } int beforeLimit; @@ -2891,7 +2892,7 @@ public void afterTextChanged(Editable editable) { for (int i = 0; i < spans.length; i++) { editable.removeSpan(spans[i]); } - Emoji.replaceEmoji(editable, topCommentTextView.getEditText().getPaint().getFontMetricsInt(), dp(20), false); + Emoji.replaceEmoji(editable, topCommentTextView.getEditText().getPaint().getFontMetricsInt(), false); processChange = false; } int beforeLimit; @@ -3443,7 +3444,9 @@ R.raw.position_above, getString(R.string.CaptionBelow), messageSendPreview.show(); - view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} return true; }); @@ -4743,6 +4746,8 @@ private void updateActionBarVisibility(boolean show, boolean animated) { } if (needMoreItem) { animators.add(ObjectAnimator.ofFloat(selectedMenuItem, View.ALPHA, show ? 1.0f : 0.0f)); + animators.add(ObjectAnimator.ofFloat(selectedMenuItem, View.SCALE_X, show ? 1.0f : 0.6f)); + animators.add(ObjectAnimator.ofFloat(selectedMenuItem, View.SCALE_Y, show ? 1.0f : 0.6f)); } actionBarAnimation.playTogether(animators); actionBarAnimation.addListener(new AnimatorListenerAdapter() { @@ -5135,9 +5140,10 @@ public void setStories(boolean value) { stories = value; } - public void setAvatarPicker(int type, boolean search) { + public void setAvatarPicker(int type, boolean search, Utilities.Callback0Return withBulletinClosingAnimation) { avatarPicker = type; avatarSearch = search; + avatarWithBulletin = withBulletinClosingAnimation; if (avatarPicker != 0) { typeButtonsAvailable = false; if (currentAttachLayout == null || currentAttachLayout == photoLayout) { @@ -5652,7 +5658,7 @@ private void replaceWithText(int start, int len, CharSequence text, boolean pars SpannableStringBuilder builder = new SpannableStringBuilder(getCommentView().getText()); builder.replace(start, start + len, text); if (parseEmoji) { - Emoji.replaceEmoji(builder, getCommentView().getEditText().getPaint().getFontMetricsInt(), dp(20), false); + Emoji.replaceEmoji(builder, getCommentView().getEditText().getPaint().getFontMetricsInt(), false); } getCommentView().setText(builder); getCommentView().setSelection(start + text.length()); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertContactsLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertContactsLayout.java index 7ee847575a..cbe1f5f618 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertContactsLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertContactsLayout.java @@ -118,7 +118,7 @@ public UserCell(Context context, Theme.ResourcesProvider resourcesProvider) { nameTextView = new SimpleTextView(context) { @Override public boolean setText(CharSequence value, boolean force) { - value = Emoji.replaceEmoji(value, getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false); + value = Emoji.replaceEmoji(value, getPaint().getFontMetricsInt(), false); return super.setText(value, force); } }; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayout.java index af0f64b83c..6662c46ab5 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayout.java @@ -42,7 +42,6 @@ import android.text.Spannable; import android.text.SpannableStringBuilder; import android.text.TextUtils; -import android.util.Log; import android.util.Pair; import android.util.TypedValue; import android.view.Gravity; @@ -110,7 +109,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; -import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -384,15 +382,21 @@ public void onEditModeChanged(boolean isEditMode) { } @Override - public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { - PhotoAttachPhotoCell cell = getCellForIndex(index); + public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview, boolean closing) { + if (closing && parentAlert.avatarWithBulletin != null) { + final PhotoViewer.PlaceProviderObject object = parentAlert.avatarWithBulletin.run(); + if (object != null) { + return object; + } + } + final PhotoAttachPhotoCell cell = getCellForIndex(index); if (cell != null) { - int[] coords = new int[2]; + final int[] coords = new int[2]; cell.getImageView().getLocationInWindow(coords); if (Build.VERSION.SDK_INT < 26) { coords[0] -= parentAlert.getLeftInset(); } - PhotoViewer.PlaceProviderObject object = new PhotoViewer.PlaceProviderObject(); + final PhotoViewer.PlaceProviderObject object = new PhotoViewer.PlaceProviderObject(); object.viewX = coords[0]; object.viewY = coords[1]; object.parentView = gridView; @@ -710,10 +714,10 @@ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { checkCamera(false); captionItem = new MessagePreviewView.ToggleButton( - context, - R.raw.position_below, getString(R.string.CaptionAbove), - R.raw.position_above, getString(R.string.CaptionBelow), - resourcesProvider + context, + R.raw.position_below, getString(R.string.CaptionAbove), + R.raw.position_above, getString(R.string.CaptionBelow), + resourcesProvider ); captionItem.setState(!parentAlert.captionAbove, false); @@ -972,6 +976,9 @@ public int getSpanSize(int position) { PhotoViewer.getInstance().setAvatarFor(parentAlert.getAvatarFor()); if (parentAlert.isPhotoPicker && !parentAlert.isStickerMode) { PhotoViewer.getInstance().closePhotoAfterSelect = false; + } else if (parentAlert.avatarPicker != 0) { + PhotoViewer.getInstance().closePhotoAfterSelect = true; + PhotoViewer.getInstance().closePhotoAfterSelectWithAnimation = parentAlert.avatarWithBulletin != null; } if (parentAlert.isStickerMode) { PhotoViewer.getInstance().enableStickerMode(null, false, parentAlert.customStickerHandler); @@ -2352,9 +2359,8 @@ public void onAnimationEnd(Animator animator) { if (cameraView != null) { if (Build.VERSION.SDK_INT >= 21) { cameraView.invalidateOutline(); - } else { - cameraView.invalidate(); } + cameraView.invalidate(); } if (cameraOpened) { parentAlert.delegate.onCameraOpened(); @@ -2429,22 +2435,18 @@ protected void dispatchDraw(Canvas canvas) { if (AndroidUtilities.makingGlobalBlurBitmap) { return; } - if (Build.VERSION.SDK_INT >= 21) { - super.dispatchDraw(canvas); + int maxY = (int) Math.min(parentAlert.getCommentTextViewTop() + currentPanTranslationY + parentAlert.getContainerView().getTranslationY() - cameraView.getTranslationY() - (parentAlert.mentionContainer != null ? parentAlert.mentionContainer.clipBottom() + dp(8) : 0), getMeasuredHeight()); + if (cameraAnimationInProgress) { + AndroidUtilities.rectTmp.set(animationClipLeft + cameraViewOffsetX * (1f - cameraOpenProgress), animationClipTop + cameraViewOffsetY * (1f - cameraOpenProgress), animationClipRight, Math.min(maxY, animationClipBottom)); + } else if (!cameraAnimationInProgress && !cameraOpened) { + AndroidUtilities.rectTmp.set(cameraViewOffsetX, cameraViewOffsetY, getMeasuredWidth(), Math.min(maxY, getMeasuredHeight())); } else { - int maxY = (int) Math.min(parentAlert.getCommentTextViewTop() + currentPanTranslationY + parentAlert.getContainerView().getTranslationY() - cameraView.getTranslationY() - (parentAlert.mentionContainer != null ? parentAlert.mentionContainer.clipBottom() + dp(8) : 0), getMeasuredHeight()); - if (cameraAnimationInProgress) { - AndroidUtilities.rectTmp.set(animationClipLeft + cameraViewOffsetX * (1f - cameraOpenProgress), animationClipTop + cameraViewOffsetY * (1f - cameraOpenProgress), animationClipRight, Math.min(maxY, animationClipBottom)); - } else if (!cameraAnimationInProgress && !cameraOpened) { - AndroidUtilities.rectTmp.set(cameraViewOffsetX, cameraViewOffsetY, getMeasuredWidth(), Math.min(maxY, getMeasuredHeight())); - } else { - AndroidUtilities.rectTmp.set(0 , 0, getMeasuredWidth(), Math.min(maxY, getMeasuredHeight())); - } - canvas.save(); - canvas.clipRect(AndroidUtilities.rectTmp); - super.dispatchDraw(canvas); - canvas.restore(); + AndroidUtilities.rectTmp.set(0 , 0, getMeasuredWidth(), Math.min(maxY, getMeasuredHeight())); } + canvas.save(); + canvas.clipRect(AndroidUtilities.rectTmp); + super.dispatchDraw(canvas); + canvas.restore(); } @Override @@ -2810,9 +2812,8 @@ public void onAnimationEnd(Animator animator) { if (cameraView != null) { if (Build.VERSION.SDK_INT >= 21) { cameraView.invalidateOutline(); - } else { - cameraView.invalidate(); } + cameraView.invalidate(); } cameraOpened = false; @@ -2960,9 +2961,8 @@ public void setCameraOpenProgress(float value) { } if (Build.VERSION.SDK_INT >= 21) { cameraView.invalidateOutline(); - } else { - cameraView.invalidate(); } + cameraView.invalidate(); } @Keep @@ -3034,9 +3034,8 @@ protected void checkCameraViewPosition() { if (cameraView != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { cameraView.invalidateOutline(); - } else { - cameraView.invalidate(); } + cameraView.invalidate(); } if (cameraIcon != null) { cameraIcon.invalidate(); @@ -3069,9 +3068,8 @@ protected void checkCameraViewPosition() { if (cameraView != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { cameraView.invalidateOutline(); - } else { - cameraView.invalidate(); } + cameraView.invalidate(); } if (cameraIcon != null) { cameraIcon.invalidate(); @@ -3181,12 +3179,12 @@ private boolean isNoGalleryPermissions() { activity = parentAlert.baseFragment.getParentActivity(); } return Build.VERSION.SDK_INT >= 23 && ( - activity == null || - Build.VERSION.SDK_INT >= 33 && ( - activity.checkSelfPermission(Manifest.permission.READ_MEDIA_IMAGES) != PackageManager.PERMISSION_GRANTED || - activity.checkSelfPermission(Manifest.permission.READ_MEDIA_VIDEO) != PackageManager.PERMISSION_GRANTED - ) || - Build.VERSION.SDK_INT < 33 && activity.checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED + activity == null || + Build.VERSION.SDK_INT >= 33 && ( + activity.checkSelfPermission(Manifest.permission.READ_MEDIA_IMAGES) != PackageManager.PERMISSION_GRANTED || + activity.checkSelfPermission(Manifest.permission.READ_MEDIA_VIDEO) != PackageManager.PERMISSION_GRANTED + ) || + Build.VERSION.SDK_INT < 33 && activity.checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED ); } @@ -3950,9 +3948,8 @@ public void onPanTransitionStart(boolean keyboardVisible, int contentHeight) { if (cameraView != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { cameraView.invalidateOutline(); - } else { - cameraView.invalidate(); } + cameraView.invalidate(); } if (cameraIcon != null) { cameraIcon.invalidate(); @@ -3966,9 +3963,8 @@ public void onContainerTranslationUpdated(float currentPanTranslationY) { if (cameraView != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { cameraView.invalidateOutline(); - } else { - cameraView.invalidate(); } + cameraView.invalidate(); } if (cameraIcon != null) { cameraIcon.invalidate(); @@ -4430,9 +4426,11 @@ public int getItemCount() { count++; } photosStartRow = count; - count += cameraPhotos.size(); - if (selectedAlbumEntry != null) { - count += selectedAlbumEntry.photos.size(); + if (!noGalleryPermissions) { + count += cameraPhotos.size(); + if (selectedAlbumEntry != null) { + count += selectedAlbumEntry.photos.size(); + } } photosEndRow = count; if (this == adapter) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayoutPreview.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayoutPreview.java index 64c5152c07..cc8c16ddba 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayoutPreview.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayoutPreview.java @@ -13,7 +13,6 @@ import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; -import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import android.graphics.Rect; @@ -37,7 +36,6 @@ import android.widget.TextView; import androidx.annotation.NonNull; -import androidx.core.graphics.ColorUtils; import androidx.core.math.MathUtils; import androidx.exifinterface.media.ExifInterface; import androidx.recyclerview.widget.LinearLayoutManager; @@ -61,7 +59,6 @@ import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Cells.ChatActionCell; import org.telegram.ui.ChatActivity; -import org.telegram.ui.Components.spoilers.SpoilerEffect; import org.telegram.ui.Components.spoilers.SpoilerEffect2; import org.telegram.ui.LaunchActivity; import org.telegram.ui.PhotoViewer; @@ -1213,6 +1210,7 @@ public void onDraw(Canvas canvas) { hintView.setVisiblePart(y, hintView.getMeasuredHeight()); if (hintView.hasGradientService()) { hintView.drawBackground(canvas, true); + hintView.drawReactions(canvas, true, null); } hintView.draw(canvas); canvas.restore(); @@ -1482,7 +1480,7 @@ public int getPhotoIndex(int index) { } @Override - public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { + public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview, boolean closing) { if (index < 0 || index >= photos.size() || !isPhotoChecked(index)) { return null; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPollLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPollLayout.java index 308f50f916..e0cf928893 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPollLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPollLayout.java @@ -1240,7 +1240,7 @@ public void onEmojiSelected(String symbol) { i = 0; } try { - CharSequence localCharSequence = Emoji.replaceEmoji(symbol, editText.getPaint().getFontMetricsInt(), AndroidUtilities.dp(18), false); + CharSequence localCharSequence = Emoji.replaceEmoji(symbol, editText.getPaint().getFontMetricsInt(), false); editText.setText(editText.getText().insert(i, localCharSequence)); int j = i + localCharSequence.length(); editText.setSelection(j, j); @@ -1538,7 +1538,7 @@ public void afterTextChanged(Editable s) { for (ImageSpan span : spans) { s.removeSpan(span); } - Emoji.replaceEmoji(s, cell.getEditField().getPaint().getFontMetricsInt(), AndroidUtilities.dp(18), false); + Emoji.replaceEmoji(s, cell.getEditField().getPaint().getFontMetricsInt(), false); suggestEmojiPanel.setDirection(SuggestEmojiView.DIRECTION_TO_TOP); suggestEmojiPanel.setDelegate(cell); @@ -1611,7 +1611,7 @@ public void afterTextChanged(Editable s) { for (ImageSpan span : spans) { s.removeSpan(span); } - Emoji.replaceEmoji(s, cell.getEditField().getPaint().getFontMetricsInt(), AndroidUtilities.dp(18), false); + Emoji.replaceEmoji(s, cell.getEditField().getPaint().getFontMetricsInt(), false); suggestEmojiPanel.setDirection(SuggestEmojiView.DIRECTION_TO_TOP); suggestEmojiPanel.setDelegate(cell); @@ -1783,7 +1783,7 @@ public void afterTextChanged(Editable s) { for (ImageSpan span : spans) { s.removeSpan(span); } - Emoji.replaceEmoji(s, cell.getEditField().getPaint().getFontMetricsInt(), AndroidUtilities.dp(18), false); + Emoji.replaceEmoji(s, cell.getEditField().getPaint().getFontMetricsInt(), false); float y = holder.itemView.getY() - AndroidUtilities.dp(166) + holder.itemView.getMeasuredHeight(); if (y > 0) { suggestEmojiPanel.setDirection(SuggestEmojiView.DIRECTION_TO_BOTTOM); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAvatarContainer.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAvatarContainer.java index 0a24ec5466..1c85d6e3d8 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAvatarContainer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAvatarContainer.java @@ -8,6 +8,8 @@ package org.telegram.ui.Components; +import static org.telegram.messenger.AndroidUtilities.dp; + import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; @@ -79,7 +81,7 @@ public class ChatAvatarContainer extends FrameLayout implements NotificationCent private AvatarDrawable avatarDrawable = new AvatarDrawable(); private int currentAccount = UserConfig.selectedAccount; private boolean occupyStatusBar = true; - private int leftPadding = AndroidUtilities.dp(8); + private int leftPadding = dp(8); private int rightAvatarPadding = 0; StatusDrawable currentTypingDrawable; @@ -106,7 +108,8 @@ public class ChatAvatarContainer extends FrameLayout implements NotificationCent public boolean allowShorterStatus = false; public boolean premiumIconHiddable = false; - private AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable emojiStatusDrawable; + private final AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable emojiStatusDrawable; + private final AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable botVerificationDrawable; protected boolean useAnimatedSubtitle() { return false; @@ -239,7 +242,7 @@ public boolean onTouchEvent(MotionEvent event) { } } avatarImageView.setContentDescription(LocaleController.getString(R.string.AccDescrProfilePicture)); - avatarImageView.setRoundRadius(AndroidUtilities.dp(21)); + avatarImageView.setRoundRadius(dp(21)); addView(avatarImageView); if (avatarClickable) { avatarImageView.setOnClickListener(v -> { @@ -255,10 +258,10 @@ public boolean onTouchEvent(MotionEvent event) { titleTextView.setTextSize(18); titleTextView.setGravity(Gravity.LEFT); titleTextView.setTypeface(AndroidUtilities.bold()); - titleTextView.setLeftDrawableTopPadding(-AndroidUtilities.dp(1.3f)); + titleTextView.setLeftDrawableTopPadding(-dp(1.3f)); titleTextView.setCanHideRightDrawable(false); titleTextView.setRightDrawableOutside(true); - titleTextView.setPadding(0, AndroidUtilities.dp(6), 0, AndroidUtilities.dp(12)); + titleTextView.setPadding(0, dp(6), 0, dp(12)); addView(titleTextView); if (useAnimatedSubtitle()) { @@ -267,10 +270,10 @@ public boolean onTouchEvent(MotionEvent event) { animatedSubtitleTextView.setEllipsizeByGradient(true); animatedSubtitleTextView.setTextColor(getThemedColor(Theme.key_actionBarDefaultSubtitle)); animatedSubtitleTextView.setTag(Theme.key_actionBarDefaultSubtitle); - animatedSubtitleTextView.setTextSize(AndroidUtilities.dp(14)); + animatedSubtitleTextView.setTextSize(dp(14)); animatedSubtitleTextView.setGravity(Gravity.LEFT); - animatedSubtitleTextView.setPadding(0, 0, AndroidUtilities.dp(10), 0); - animatedSubtitleTextView.setTranslationY(-AndroidUtilities.dp(1)); + animatedSubtitleTextView.setPadding(0, 0, dp(10), 0); + animatedSubtitleTextView.setTranslationY(-dp(1)); addView(animatedSubtitleTextView); } else { subtitleTextView = new SimpleTextConnectedView(context, subtitleTextLargerCopyView); @@ -279,13 +282,13 @@ public boolean onTouchEvent(MotionEvent event) { subtitleTextView.setTag(Theme.key_actionBarDefaultSubtitle); subtitleTextView.setTextSize(14); subtitleTextView.setGravity(Gravity.LEFT); - subtitleTextView.setPadding(0, 0, AndroidUtilities.dp(10), 0); + subtitleTextView.setPadding(0, 0, dp(10), 0); addView(subtitleTextView); } if (parentFragment != null) { timeItem = new ImageView(context); - timeItem.setPadding(AndroidUtilities.dp(10), AndroidUtilities.dp(10), AndroidUtilities.dp(5), AndroidUtilities.dp(5)); + timeItem.setPadding(dp(10), dp(10), dp(5), dp(5)); timeItem.setScaleType(ImageView.ScaleType.CENTER); timeItem.setAlpha(0.0f); timeItem.setScaleY(0.0f); @@ -343,7 +346,8 @@ public boolean onTouchEvent(MotionEvent event) { } } - emojiStatusDrawable = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(titleTextView, AndroidUtilities.dp(24)); + emojiStatusDrawable = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(titleTextView, dp(24)); + botVerificationDrawable = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(titleTextView, dp(17)); } public ButtonBounce bounce = new ButtonBounce(this); @@ -412,9 +416,9 @@ protected boolean onAvatarClick() { } public void setTitleExpand(boolean titleExpand) { - int newRightPadding = titleExpand ? AndroidUtilities.dp(10) : 0; + int newRightPadding = titleExpand ? dp(10) : 0; if (titleTextView.getPaddingRight() != newRightPadding) { - titleTextView.setPadding(0, AndroidUtilities.dp(6), newRightPadding, AndroidUtilities.dp(12)); + titleTextView.setPadding(0, dp(6), newRightPadding, dp(12)); requestLayout(); invalidate(); } @@ -487,7 +491,7 @@ public void dismiss() { scrimPopupWindow[0].setClippingEnabled(true); scrimPopupWindow[0].setAnimationStyle(R.style.PopupContextAnimation); scrimPopupWindow[0].setFocusable(true); - autoDeletePopupWrapper.windowLayout.measure(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST)); + autoDeletePopupWrapper.windowLayout.measure(View.MeasureSpec.makeMeasureSpec(dp(1000), View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(dp(1000), View.MeasureSpec.AT_MOST)); scrimPopupWindow[0].setInputMethodMode(ActionBarPopupWindow.INPUT_METHOD_NOT_NEEDED); scrimPopupWindow[0].getContentView().setFocusableInTouchMode(true); scrimPopupWindow[0].showAtLocation(avatarImageView, 0, (int) (avatarImageView.getX() + getX()), (int) avatarImageView.getY()); @@ -591,22 +595,22 @@ public void setTitleColors(int title, int subtitle) { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int width = MeasureSpec.getSize(widthMeasureSpec) + titleTextView.getPaddingRight(); - int availableWidth = width - AndroidUtilities.dp((avatarImageView.getVisibility() == VISIBLE ? 54 : 0) + 16); - avatarImageView.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(42), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(42), MeasureSpec.EXACTLY)); - titleTextView.measure(MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(24 + 8) + titleTextView.getPaddingRight(), MeasureSpec.AT_MOST)); + int availableWidth = width - dp((avatarImageView.getVisibility() == VISIBLE ? 54 : 0) + 16); + avatarImageView.measure(MeasureSpec.makeMeasureSpec(dp(42), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(dp(42), MeasureSpec.EXACTLY)); + titleTextView.measure(MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(dp(24 + 8) + titleTextView.getPaddingRight(), MeasureSpec.AT_MOST)); if (subtitleTextView != null) { - subtitleTextView.measure(MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(20), MeasureSpec.AT_MOST)); + subtitleTextView.measure(MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(dp(20), MeasureSpec.AT_MOST)); } else if (animatedSubtitleTextView != null) { - animatedSubtitleTextView.measure(MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(20), MeasureSpec.AT_MOST)); + animatedSubtitleTextView.measure(MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(dp(20), MeasureSpec.AT_MOST)); } if (timeItem != null) { - timeItem.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(34), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(34), MeasureSpec.EXACTLY)); + timeItem.measure(MeasureSpec.makeMeasureSpec(dp(34), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(dp(34), MeasureSpec.EXACTLY)); } if (starBgItem != null) { - starBgItem.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(20), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(20), MeasureSpec.EXACTLY)); + starBgItem.measure(MeasureSpec.makeMeasureSpec(dp(20), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(dp(20), MeasureSpec.EXACTLY)); } if (starFgItem != null) { - starFgItem.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(20), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(20), MeasureSpec.EXACTLY)); + starFgItem.measure(MeasureSpec.makeMeasureSpec(dp(20), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(dp(20), MeasureSpec.EXACTLY)); } setMeasuredDimension(width, MeasureSpec.getSize(heightMeasureSpec)); if (lastWidth != -1 && lastWidth != width && lastWidth > width) { @@ -614,8 +618,8 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { } SimpleTextView titleTextLargerCopyView = this.titleTextLargerCopyView.get(); if (titleTextLargerCopyView != null) { - int largerAvailableWidth = largerWidth - AndroidUtilities.dp((avatarImageView.getVisibility() == VISIBLE ? 54 : 0) + 16); - titleTextLargerCopyView.measure(MeasureSpec.makeMeasureSpec(largerAvailableWidth, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(24), MeasureSpec.AT_MOST)); + int largerAvailableWidth = largerWidth - dp((avatarImageView.getVisibility() == VISIBLE ? 54 : 0) + 16); + titleTextLargerCopyView.measure(MeasureSpec.makeMeasureSpec(largerAvailableWidth, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(dp(24), MeasureSpec.AT_MOST)); } lastWidth = width; } @@ -632,7 +636,7 @@ private void fadeOutToLessWidth(int largerWidth) { titleTextLargerCopyView.setTextSize(18); titleTextLargerCopyView.setGravity(Gravity.LEFT); titleTextLargerCopyView.setTypeface(AndroidUtilities.bold()); - titleTextLargerCopyView.setLeftDrawableTopPadding(-AndroidUtilities.dp(1.3f)); + titleTextLargerCopyView.setLeftDrawableTopPadding(-dp(1.3f)); titleTextLargerCopyView.setRightDrawable(titleTextView.getRightDrawable()); titleTextLargerCopyView.setRightDrawable2(titleTextView.getRightDrawable2()); titleTextLargerCopyView.setRightDrawableOutside(titleTextView.getRightDrawableOutside()); @@ -680,38 +684,38 @@ private void fadeOutToLessWidth(int largerWidth) { @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { int actionBarHeight = ActionBar.getCurrentActionBarHeight(); - int viewTop = (actionBarHeight - AndroidUtilities.dp(42)) / 2 + (Build.VERSION.SDK_INT >= 21 && occupyStatusBar ? AndroidUtilities.statusBarHeight : 0); - avatarImageView.layout(leftPadding, viewTop + 1, leftPadding + AndroidUtilities.dp(42), viewTop + 1 + AndroidUtilities.dp(42)); - int l = leftPadding + (avatarImageView.getVisibility() == VISIBLE ? AndroidUtilities.dp( 54) : 0) + rightAvatarPadding; + int viewTop = (actionBarHeight - dp(42)) / 2 + (Build.VERSION.SDK_INT >= 21 && occupyStatusBar ? AndroidUtilities.statusBarHeight : 0); + avatarImageView.layout(leftPadding, viewTop + 1, leftPadding + dp(42), viewTop + 1 + dp(42)); + int l = leftPadding + (avatarImageView.getVisibility() == VISIBLE ? dp( 54) : 0) + rightAvatarPadding; SimpleTextView titleTextLargerCopyView = this.titleTextLargerCopyView.get(); if (getSubtitleTextView().getVisibility() != GONE) { - titleTextView.layout(l, viewTop + AndroidUtilities.dp(1.3f) - titleTextView.getPaddingTop(), l + titleTextView.getMeasuredWidth(), viewTop + titleTextView.getTextHeight() + AndroidUtilities.dp(1.3f) - titleTextView.getPaddingTop() + titleTextView.getPaddingBottom()); + titleTextView.layout(l, viewTop + dp(1.3f) - titleTextView.getPaddingTop(), l + titleTextView.getMeasuredWidth(), viewTop + titleTextView.getTextHeight() + dp(1.3f) - titleTextView.getPaddingTop() + titleTextView.getPaddingBottom()); if (titleTextLargerCopyView != null) { - titleTextLargerCopyView.layout(l, viewTop + AndroidUtilities.dp(1.3f), l + titleTextLargerCopyView.getMeasuredWidth(), viewTop + titleTextLargerCopyView.getTextHeight() + AndroidUtilities.dp(1.3f)); + titleTextLargerCopyView.layout(l, viewTop + dp(1.3f), l + titleTextLargerCopyView.getMeasuredWidth(), viewTop + titleTextLargerCopyView.getTextHeight() + dp(1.3f)); } } else { - titleTextView.layout(l, viewTop + AndroidUtilities.dp(11) - titleTextView.getPaddingTop(), l + titleTextView.getMeasuredWidth(), viewTop + titleTextView.getTextHeight() + AndroidUtilities.dp(11) - titleTextView.getPaddingTop() + titleTextView.getPaddingBottom()); + titleTextView.layout(l, viewTop + dp(11) - titleTextView.getPaddingTop(), l + titleTextView.getMeasuredWidth(), viewTop + titleTextView.getTextHeight() + dp(11) - titleTextView.getPaddingTop() + titleTextView.getPaddingBottom()); if (titleTextLargerCopyView != null) { - titleTextLargerCopyView.layout(l, viewTop + AndroidUtilities.dp(11), l + titleTextLargerCopyView.getMeasuredWidth(), viewTop + titleTextLargerCopyView.getTextHeight() + AndroidUtilities.dp(11)); + titleTextLargerCopyView.layout(l, viewTop + dp(11), l + titleTextLargerCopyView.getMeasuredWidth(), viewTop + titleTextLargerCopyView.getTextHeight() + dp(11)); } } if (timeItem != null) { - timeItem.layout(leftPadding + AndroidUtilities.dp(16), viewTop + AndroidUtilities.dp(15), leftPadding + AndroidUtilities.dp(16 + 34), viewTop + AndroidUtilities.dp(15 + 34)); + timeItem.layout(leftPadding + dp(16), viewTop + dp(15), leftPadding + dp(16 + 34), viewTop + dp(15 + 34)); } if (starBgItem != null) { - starBgItem.layout(leftPadding + AndroidUtilities.dp(28), viewTop + AndroidUtilities.dp(24), leftPadding + AndroidUtilities.dp(28) + starBgItem.getMeasuredWidth(), viewTop + AndroidUtilities.dp(24) + starBgItem.getMeasuredHeight()); + starBgItem.layout(leftPadding + dp(28), viewTop + dp(24), leftPadding + dp(28) + starBgItem.getMeasuredWidth(), viewTop + dp(24) + starBgItem.getMeasuredHeight()); } if (starFgItem != null) { - starFgItem.layout(leftPadding + AndroidUtilities.dp(28), viewTop + AndroidUtilities.dp(24), leftPadding + AndroidUtilities.dp(28) + starFgItem.getMeasuredWidth(), viewTop + AndroidUtilities.dp(24) + starFgItem.getMeasuredHeight()); + starFgItem.layout(leftPadding + dp(28), viewTop + dp(24), leftPadding + dp(28) + starFgItem.getMeasuredWidth(), viewTop + dp(24) + starFgItem.getMeasuredHeight()); } if (subtitleTextView != null) { - subtitleTextView.layout(l, viewTop + AndroidUtilities.dp(24), l + subtitleTextView.getMeasuredWidth(), viewTop + subtitleTextView.getTextHeight() + AndroidUtilities.dp(24)); + subtitleTextView.layout(l, viewTop + dp(24), l + subtitleTextView.getMeasuredWidth(), viewTop + subtitleTextView.getTextHeight() + dp(24)); } else if (animatedSubtitleTextView != null) { - animatedSubtitleTextView.layout(l, viewTop + AndroidUtilities.dp(24), l + animatedSubtitleTextView.getMeasuredWidth(), viewTop + animatedSubtitleTextView.getTextHeight() + AndroidUtilities.dp(24)); + animatedSubtitleTextView.layout(l, viewTop + dp(24), l + animatedSubtitleTextView.getMeasuredWidth(), viewTop + animatedSubtitleTextView.getTextHeight() + dp(24)); } SimpleTextView subtitleTextLargerCopyView = this.subtitleTextLargerCopyView.get(); if (subtitleTextLargerCopyView != null) { - subtitleTextLargerCopyView.layout(l, viewTop + AndroidUtilities.dp(24), l + subtitleTextLargerCopyView.getMeasuredWidth(), viewTop + subtitleTextLargerCopyView.getTextHeight() + AndroidUtilities.dp(24)); + subtitleTextLargerCopyView.layout(l, viewTop + dp(24), l + subtitleTextLargerCopyView.getMeasuredWidth(), viewTop + subtitleTextLargerCopyView.getTextHeight() + dp(24)); } } @@ -811,13 +815,23 @@ public void setTitleIcons(Drawable leftIcon, Drawable mutedIcon) { } } + public AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable getBotVerificationDrawable(long icon, boolean animated) { + if (icon == 0) { + return null; + } + botVerificationDrawable.set(icon, animated); + botVerificationDrawable.setColor(getThemedColor(Theme.key_profile_verifiedBackground)); + botVerificationDrawable.offset(0, dp(1)); + return botVerificationDrawable; + } + public void setTitle(CharSequence value) { setTitle(value, false, false, false, false, null, false); } public void setTitle(CharSequence value, boolean scam, boolean fake, boolean verified, boolean premium, TLRPC.EmojiStatus emojiStatus, boolean animated) { if (value != null) { - value = Emoji.replaceEmoji(value, titleTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(24), false); + value = Emoji.replaceEmoji(value, titleTextView.getPaint().getFontMetricsInt(), false); } titleTextView.setText(value); if (scam || fake) { @@ -981,7 +995,7 @@ public void updateSubtitle(boolean animated) { if (animated) { titleAnimation = new AnimatorSet(); titleAnimation.playTogether( - ObjectAnimator.ofFloat(titleTextView, View.TRANSLATION_Y, AndroidUtilities.dp(9.7f)), + ObjectAnimator.ofFloat(titleTextView, View.TRANSLATION_Y, dp(9.7f)), ObjectAnimator.ofFloat(getSubtitleTextView(), View.ALPHA, 0.0f)); titleAnimation.addListener(new AnimatorListenerAdapter() { @Override @@ -1000,7 +1014,7 @@ public void onAnimationEnd(Animator animation) { titleAnimation.setDuration(180); titleAnimation.start(); } else { - titleTextView.setTranslationY(AndroidUtilities.dp(9.7f)); + titleTextView.setTranslationY(dp(9.7f)); getSubtitleTextView().setAlpha(0.0f); getSubtitleTextView().setVisibility(INVISIBLE); } @@ -1083,7 +1097,7 @@ public void onAnimationEnd(Animator animation) { } newSubtitle = printString; if (MessagesController.getInstance(currentAccount).getPrintingStringType(parentFragment.getDialogId(), parentFragment.getThreadId()) == 5) { - newSubtitle = Emoji.replaceEmoji(newSubtitle, getSubtitlePaint().getFontMetricsInt(), AndroidUtilities.dp(15), false); + newSubtitle = Emoji.replaceEmoji(newSubtitle, getSubtitlePaint().getFontMetricsInt(), false); } useOnlineColor = true; setTypingAnimation(true); @@ -1181,7 +1195,7 @@ public void setChatAvatar(TLRPC.Chat chat) { avatarDrawable.setInfo(currentAccount, chat); if (avatarImageView != null) { avatarImageView.setForUserOrChat(chat, avatarDrawable); - avatarImageView.setRoundRadius(ChatObject.isForum(chat) ? AndroidUtilities.dp(ChatObject.hasStories(chat) ? 11 : 16) : AndroidUtilities.dp(21)); + avatarImageView.setRoundRadius(ChatObject.isForum(chat) ? dp(ChatObject.hasStories(chat) ? 11 : 16) : dp(21)); } } @@ -1270,7 +1284,7 @@ public void checkAndUpdateAvatar() { if (avatarImageView != null) { avatarImageView.setForUserOrChat(chat, avatarDrawable); } - avatarImageView.setRoundRadius(chat.forum ? AndroidUtilities.dp(ChatObject.hasStories(chat) ? 11 : 16) : AndroidUtilities.dp(21)); + avatarImageView.setRoundRadius(chat.forum ? dp(ChatObject.hasStories(chat) ? 11 : 16) : dp(21)); } } @@ -1312,6 +1326,9 @@ protected void onAttachedToWindow() { if (emojiStatusDrawable != null) { emojiStatusDrawable.attach(); } + if (botVerificationDrawable != null) { + botVerificationDrawable.attach(); + } } @Override @@ -1327,6 +1344,9 @@ protected void onDetachedFromWindow() { if (emojiStatusDrawable != null) { emojiStatusDrawable.detach(); } + if (botVerificationDrawable != null) { + botVerificationDrawable.detach(); + } } @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatThemeBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatThemeBottomSheet.java index 0bbcd7afad..accc578b44 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatThemeBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatThemeBottomSheet.java @@ -59,6 +59,7 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.ResultCallback; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.tgnet.tl.TL_stories; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BackDrawable; @@ -1175,7 +1176,7 @@ private boolean parseTheme(Theme.ThemeInfo themeInfo) { if (!file.exists()) { if (!loadingWallpapers.containsKey(themeInfo)) { loadingWallpapers.put(themeInfo, themeInfo.slug); - TLRPC.TL_account_getWallPaper req = new TLRPC.TL_account_getWallPaper(); + TL_account.getWallPaper req = new TL_account.getWallPaper(); TLRPC.TL_inputWallPaperSlug inputWallPaperSlug = new TLRPC.TL_inputWallPaperSlug(); inputWallPaperSlug.slug = themeInfo.slug; req.wallpaper = inputWallPaperSlug; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/CheckBoxBase.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/CheckBoxBase.java index a81d0b6739..7282878740 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/CheckBoxBase.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/CheckBoxBase.java @@ -1,5 +1,6 @@ package org.telegram.ui.Components; +import static org.telegram.messenger.AndroidUtilities.dp; import static org.telegram.messenger.AndroidUtilities.lerp; import android.animation.Animator; @@ -63,6 +64,8 @@ public void setAlpha(float alpha) { private int checkColorKey = Theme.key_checkboxCheck; private int backgroundColorKey = Theme.key_chat_serviceBackground; private int background2ColorKey = Theme.key_chat_serviceBackground; + private int strokeBackgroundKey = Theme.key_dialogBackground; + private int strokeBackgroundWidth = -1; private int backgroundColor; @@ -101,11 +104,11 @@ public CheckBoxBase(View parent, int sz, Theme.ResourcesProvider resourcesProvid checkPaint.setStrokeCap(Paint.Cap.ROUND); checkPaint.setStyle(Paint.Style.STROKE); checkPaint.setStrokeJoin(Paint.Join.ROUND); - checkPaint.setStrokeWidth(AndroidUtilities.dp(1.9f)); + checkPaint.setStrokeWidth(dp(1.9f)); backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); backgroundPaint.setStyle(Paint.Style.STROKE); - backgroundPaint.setStrokeWidth(AndroidUtilities.dp(1.2f)); + backgroundPaint.setStrokeWidth(dp(1.2f)); } public void setResourcesProvider(Theme.ResourcesProvider resourcesProvider) { @@ -179,16 +182,16 @@ public void setEnabled(boolean value) { public void setBackgroundType(int type) { backgroundType = type; if (type == 12 || type == 13) { - backgroundPaint.setStrokeWidth(AndroidUtilities.dp(1)); + backgroundPaint.setStrokeWidth(dp(1)); } else if (type == 4 || type == 5) { - backgroundPaint.setStrokeWidth(AndroidUtilities.dp(1.9f)); + backgroundPaint.setStrokeWidth(dp(1.9f)); if (type == 5) { - checkPaint.setStrokeWidth(AndroidUtilities.dp(1.5f)); + checkPaint.setStrokeWidth(dp(1.5f)); } } else if (type == 3) { - backgroundPaint.setStrokeWidth(AndroidUtilities.dp(3f)); + backgroundPaint.setStrokeWidth(dp(3f)); } else if (type != 0) { - backgroundPaint.setStrokeWidth(AndroidUtilities.dp(1.5f)); + backgroundPaint.setStrokeWidth(dp(1.5f)); } } @@ -225,6 +228,16 @@ public void setColor(int background, int background2, int check) { invalidate(); } + public void setStrokeBackgroundColor(int key) { + strokeBackgroundKey = key; + invalidate(); + } + + public void setStrokeBackgroundWidth(int width) { + strokeBackgroundWidth = width; + invalidate(); + } + public void setBackgroundColor(int backgroundColor) { this.backgroundColor = backgroundColor; invalidate(); @@ -274,13 +287,13 @@ public void setChecked(int num, boolean checked, boolean animated) { } public void draw(Canvas canvas) { - float rad = AndroidUtilities.dp(size / 2); + float rad = dp(size / 2); float outerRad = rad; if (backgroundType == 12 || backgroundType == 13) { - rad = outerRad = AndroidUtilities.dp(10); + rad = outerRad = dp(10); } else { if (backgroundType != 0 && backgroundType != 11) { - outerRad -= AndroidUtilities.dp(0.2f); + outerRad -= dp(0.2f); } } @@ -327,10 +340,10 @@ public void draw(Canvas canvas) { if (backgroundType == 12 || backgroundType == 13) { //draw nothing } else if (backgroundType == 8 || backgroundType == 10 || backgroundType == 14) { - canvas.drawCircle(cx, cy, rad - AndroidUtilities.dp(1.5f), backgroundPaint); + canvas.drawCircle(cx, cy, rad - dp(1.5f), backgroundPaint); } else if (backgroundType == 6 || backgroundType == 7) { - canvas.drawCircle(cx, cy, rad - AndroidUtilities.dp(1), paint); - canvas.drawCircle(cx, cy, rad - AndroidUtilities.dp(1.5f), backgroundPaint); + canvas.drawCircle(cx, cy, rad - dp(1), paint); + canvas.drawCircle(cx, cy, rad - dp(1.5f), backgroundPaint); } else { canvas.drawCircle(cx, cy, rad, paint); } @@ -350,7 +363,7 @@ public void draw(Canvas canvas) { } else { backgroundPaint.setShader(null); } - canvas.drawCircle(cx, cy, (rad - AndroidUtilities.dp(1)) * backgroundAlpha, backgroundPaint); + canvas.drawCircle(cx, cy, (rad - dp(1)) * backgroundAlpha, backgroundPaint); backgroundPaint.setStyle(Paint.Style.STROKE); } else if (backgroundType == 0 || backgroundType == 11) { canvas.drawCircle(cx, cy, rad, backgroundPaint); @@ -373,7 +386,7 @@ public void draw(Canvas canvas) { } if (backgroundType == 6) { - int color = getThemedColor(Theme.key_dialogBackground); + int color = getThemedColor(strokeBackgroundKey); int alpha = Color.alpha(color); backgroundPaint.setColor(color); backgroundPaint.setAlpha((int) (alpha * progress)); @@ -414,10 +427,10 @@ public void draw(Canvas canvas) { } if (backgroundType != -1) { - float sizeHalf = AndroidUtilities.dp(size) / 2f; + float sizeHalf = dp(size) / 2f; int restoreCount = canvas.save(); canvas.translate(cx - sizeHalf, cy - sizeHalf); - canvas.saveLayerAlpha(0, 0, AndroidUtilities.dp(size), AndroidUtilities.dp(size), 255, Canvas.ALL_SAVE_FLAG); + canvas.saveLayerAlpha(0, 0, dp(size), dp(size), 255, Canvas.ALL_SAVE_FLAG); Paint circlePaint = circlePaintProvider.provide(null); if (backgroundType == 12 || backgroundType == 13) { int a = circlePaint.getAlpha(); @@ -427,7 +440,7 @@ public void draw(Canvas canvas) { circlePaint.setAlpha(a); } } else { - rad -= AndroidUtilities.dp(0.5f); + rad -= dp(0.5f); canvas.drawCircle(sizeHalf, sizeHalf, rad, circlePaint); canvas.drawCircle(sizeHalf, sizeHalf, rad * (1.0f - roundProgress), eraser); } @@ -440,11 +453,11 @@ public void draw(Canvas canvas) { forbidPaint.setStyle(Paint.Style.STROKE); forbidPaint.setStrokeCap(Paint.Cap.ROUND); forbidPaint.setStrokeJoin(Paint.Join.ROUND); - forbidPaint.setPathEffect(new DashPathEffect(new float[] { AndroidUtilities.dp(0.66f), AndroidUtilities.dp(4) }, 0)); + forbidPaint.setPathEffect(new DashPathEffect(new float[] { dp(0.66f), dp(4) }, 0)); } - forbidPaint.setStrokeWidth(AndroidUtilities.dp(1.66f)); + forbidPaint.setStrokeWidth(dp(1.66f)); forbidPaint.setColor(getThemedColor(Theme.key_switchTrack)); - canvas.drawCircle(cx, cy, AndroidUtilities.dp(9), forbidPaint); + canvas.drawCircle(cx, cy, dp(9), forbidPaint); } else if (checkProgress != 0) { if (checkedText != null) { if (textPaint == null) { @@ -467,11 +480,11 @@ public void draw(Canvas canvas) { textSize = 8f; y = 15.75f; } - textPaint.setTextSize(AndroidUtilities.dp(textSize)); + textPaint.setTextSize(dp(textSize)); textPaint.setColor(getThemedColor(checkColorKey)); canvas.save(); canvas.scale(checkProgress, 1.0f, cx, cy); - canvas.drawText(checkedText, cx - textPaint.measureText(checkedText) / 2f, AndroidUtilities.dp(y), textPaint); + canvas.drawText(checkedText, cx - textPaint.measureText(checkedText) / 2f, dp(y), textPaint); canvas.restore(); } else { path.reset(); @@ -481,10 +494,10 @@ public void draw(Canvas canvas) { } else if (backgroundType == 5) { scale = 0.8f; } - float checkSide = AndroidUtilities.dp(9 * scale) * checkProgress; - float smallCheckSide = AndroidUtilities.dp(4 * scale) * checkProgress; - int x = cx - AndroidUtilities.dp(1.5f); - int y = cy + AndroidUtilities.dp(4); + float checkSide = dp(9 * scale) * checkProgress; + float smallCheckSide = dp(4 * scale) * checkProgress; + int x = cx - dp(1.5f); + int y = cy + dp(4); float side = (float) Math.sqrt(smallCheckSide * smallCheckSide / 2.0f); path.moveTo(x - side, y - side); path.lineTo(x, y); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/CircularProgressDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/CircularProgressDrawable.java index eecc2be5f5..5b4fed2bfd 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/CircularProgressDrawable.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/CircularProgressDrawable.java @@ -112,4 +112,13 @@ public int getOpacity() { return PixelFormat.TRANSPARENT; } + @Override + public int getIntrinsicWidth() { + return (int) (size + thickness); + } + + @Override + public int getIntrinsicHeight() { + return (int) (size + thickness); + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/CompatDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/CompatDrawable.java new file mode 100644 index 0000000000..170c79c251 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/CompatDrawable.java @@ -0,0 +1,55 @@ +package org.telegram.ui.Components; + +import android.graphics.Canvas; +import android.graphics.ColorFilter; +import android.graphics.Paint; +import android.graphics.PixelFormat; +import android.graphics.drawable.Drawable; +import android.view.View; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +public class CompatDrawable extends Drawable { + public final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); + + public CompatDrawable(View view) { + if (view != null) { + view.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() { + @Override + public void onViewAttachedToWindow(@NonNull View v) { + onAttachedToWindow(); + } + + @Override + public void onViewDetachedFromWindow(@NonNull View v) { + onDetachedToWindow(); + } + }); + if (view.isAttachedToWindow()) { + view.post(this::onAttachedToWindow); + } + } + } + + @Override + public void draw(@NonNull Canvas canvas) { + + } + + @Override + public void setAlpha(int alpha) { + paint.setAlpha(alpha); + } + @Override + public void setColorFilter(@Nullable ColorFilter colorFilter) { + paint.setColorFilter(colorFilter); + } + @Override + public int getOpacity() { + return PixelFormat.TRANSPARENT; + } + + public void onAttachedToWindow() {} + public void onDetachedToWindow() {} +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/CreateRtmpStreamBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/CreateRtmpStreamBottomSheet.java index eeeefe23f4..9fefdf518d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/CreateRtmpStreamBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/CreateRtmpStreamBottomSheet.java @@ -22,6 +22,7 @@ import org.telegram.messenger.R; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_phone; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Cells.TextDetailCell; @@ -74,13 +75,13 @@ public CreateRtmpStreamBottomSheet(BaseFragment fragment, TLRPC.Peer selectedPee fixNavigationBar(); updateTitle(); - TLRPC.TL_phone_getGroupCallStreamRtmpUrl req = new TLRPC.TL_phone_getGroupCallStreamRtmpUrl(); + TL_phone.getGroupCallStreamRtmpUrl req = new TL_phone.getGroupCallStreamRtmpUrl(); req.peer = MessagesController.getInstance(currentAccount).getInputPeer(dialogId); req.revoke = false; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (response != null) { - if (response instanceof TLRPC.TL_phone_groupCallStreamRtmpUrl) { - TLRPC.TL_phone_groupCallStreamRtmpUrl rtmpUrl = (TLRPC.TL_phone_groupCallStreamRtmpUrl) response; + if (response instanceof TL_phone.groupCallStreamRtmpUrl) { + TL_phone.groupCallStreamRtmpUrl rtmpUrl = (TL_phone.groupCallStreamRtmpUrl) response; this.rtmpUrl = rtmpUrl.url; this.rtmpKey = rtmpUrl.key; adapter.update(false); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Crop/CropAreaView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Crop/CropAreaView.java index 9af5041e6c..c4c0aec77b 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Crop/CropAreaView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Crop/CropAreaView.java @@ -64,11 +64,13 @@ interface AreaViewListener { private int previousX; private int previousY; - private float bottomPadding; + private float bottomPadding, topPadding; private boolean dimVisibile; private boolean frameVisible; + private float overrideDimAlpha = -1.0f; private float frameAlpha = 1.0f; + private float overrideFrameAlpha = -1.0f; private long lastUpdateTime; private Paint dimPaint; @@ -190,6 +192,14 @@ public void setDimVisibility(boolean visible) { dimVisibile = visible; } + public void setDimAlpha(float alpha) { + overrideDimAlpha = alpha; + } + + public void setFrameAlpha(float alpha) { + overrideFrameAlpha = alpha; + } + public void setFrameVisibility(boolean visible, boolean animated) { frameVisible = visible; if (frameVisible) { @@ -205,6 +215,10 @@ public void setBottomPadding(float value) { bottomPadding = value; } + public void setTopPadding(float value) { + topPadding = value; + } + public Interpolator getInterpolator() { return interpolator; } @@ -278,7 +292,11 @@ protected void onDraw(Canvas canvas) { int left = -getWidth() * 4, top = -getHeight() * 4, right = getWidth() * 4, bottom = getHeight() * 4; - dimPaint.setAlpha((int) (0xff - 0x7f * frameAlpha)); + if (overrideDimAlpha >= 0) { + dimPaint.setAlpha((int) (0xFF * overrideDimAlpha)); + } else { + dimPaint.setAlpha((int) (0xff - 0x7f * frameAlpha)); + } canvas.drawRect(left, top, right, 0, dimPaint); canvas.drawRect(left, 0, 0, getHeight(), dimPaint); @@ -304,10 +322,17 @@ protected void onDraw(Canvas canvas) { type = previousGridType; } - shadowPaint.setAlpha((int) (gridProgress * 26 * frameAlpha)); - linePaint.setAlpha((int) (gridProgress * 178 * frameAlpha)); - framePaint.setAlpha((int) (178 * frameAlpha)); - handlePaint.setAlpha((int) (255 * frameAlpha)); + if (overrideFrameAlpha >= 0) { + shadowPaint.setAlpha((int) (gridProgress * 26 * overrideFrameAlpha)); + linePaint.setAlpha((int) (gridProgress * 178 * overrideFrameAlpha)); + framePaint.setAlpha((int) (178 * overrideFrameAlpha)); + handlePaint.setAlpha((int) (255 * overrideFrameAlpha)); + } else { + shadowPaint.setAlpha((int) (gridProgress * 26 * frameAlpha)); + linePaint.setAlpha((int) (gridProgress * 178 * frameAlpha)); + framePaint.setAlpha((int) (178 * frameAlpha)); + handlePaint.setAlpha((int) (255 * frameAlpha)); + } canvas.drawRect(originX + inset, originY + inset, originX + width - inset, originY + inset + lineThickness, framePaint); canvas.drawRect(originX + inset, originY + inset, originX + inset + lineThickness, originY + height - inset, framePaint); @@ -357,7 +382,7 @@ protected void onDraw(Canvas canvas) { canvas.restore(); } else { float width = getMeasuredWidth() - 2 * sidePadding; - float height = getMeasuredHeight() - bottomPadding - (Build.VERSION.SDK_INT >= 21 && !inBubbleMode ? AndroidUtilities.statusBarHeight : 0) - 2 * sidePadding; + float height = getMeasuredHeight() - bottomPadding - (Build.VERSION.SDK_INT >= 21 && !inBubbleMode ? AndroidUtilities.statusBarHeight : 0) - topPadding - 2 * sidePadding; size = (int) Math.min(width, height); if (circleBitmap == null || circleBitmap.getWidth() != size) { @@ -603,13 +628,13 @@ public RectF getTargetRectToFill(float aspectRatio) { public void calculateRect(RectF rect, float cropAspectRatio) { float statusBarHeight = (Build.VERSION.SDK_INT >= 21 && !inBubbleMode ? AndroidUtilities.statusBarHeight : 0); float left, top, right, bottom; - float measuredHeight = (float) getMeasuredHeight() - bottomPadding - statusBarHeight; + float measuredHeight = (float) getMeasuredHeight() - bottomPadding - topPadding - statusBarHeight; float aspectRatio = (float) getMeasuredWidth() / measuredHeight; float minSide = Math.min(getMeasuredWidth(), measuredHeight) - 2 * sidePadding; float width = getMeasuredWidth() - 2 * sidePadding; float height = measuredHeight - 2 * sidePadding; float centerX = getMeasuredWidth() / 2.0f; - float centerY = statusBarHeight + measuredHeight / 2.0f; + float centerY = statusBarHeight + topPadding + measuredHeight / 2.0f; if (Math.abs(1.0f - cropAspectRatio) < 0.0001) { left = centerX - (minSide / 2.0f); @@ -842,7 +867,7 @@ public boolean onTouchEvent(MotionEvent event) { } } - float topPadding = statusBarHeight + sidePadding; + float topPadding = statusBarHeight + this.topPadding + sidePadding; float finalBottomPadidng = bottomPadding + sidePadding; if (tempRect.top < topPadding) { if (lockAspectRatio > 0) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Crop/CropRotationWheel.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Crop/CropRotationWheel.java index 2d02b7ec54..ef1d31a0b9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Crop/CropRotationWheel.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Crop/CropRotationWheel.java @@ -41,7 +41,7 @@ public interface RotationWheelListener { private ImageView aspectRatioButton; private ImageView rotation90Button; - private ImageView mirrorButton; + private ImageView mirrorButton; // private TextView degreesLabel; private String degreesText; private TextPaint degreesTextPaint; @@ -192,7 +192,9 @@ public boolean onTouchEvent(MotionEvent ev) { try { if (Math.abs(newAngle - MAX_ANGLE) < 0.001f && Math.abs(this.rotation - MAX_ANGLE) >= 0.001f || Math.abs(newAngle - -MAX_ANGLE) < 0.001f && Math.abs(this.rotation - -MAX_ANGLE) >= 0.001f) { - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); + } catch (Exception ignored) {} } else if (Math.floor(this.rotation / 2.5f) != Math.floor(newAngle / 2.5f)) { AndroidUtilities.vibrateCursor(this); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Crop/CropView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Crop/CropView.java index 45c81f9ebf..a46a6929f7 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Crop/CropView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Crop/CropView.java @@ -7,13 +7,11 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; -import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.PointF; import android.graphics.RectF; import android.os.Build; -import android.util.Log; import android.view.MotionEvent; import android.view.ViewTreeObserver; import android.widget.FrameLayout; @@ -30,10 +28,7 @@ import org.telegram.messenger.VideoEditedInfo; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.BubbleActivity; -import org.telegram.ui.Components.Paint.Swatch; -import org.telegram.ui.Components.Paint.Views.TextPaintView; import org.telegram.ui.Components.PaintingOverlay; -import org.telegram.ui.Components.Point; import org.telegram.ui.Components.VideoEditTextureView; import java.io.File; @@ -63,7 +58,8 @@ public class CropView extends FrameLayout implements CropAreaView.AreaViewListen private Bitmap bitmap; private boolean freeform; - private float bottomPadding; + public float bottomPadding; + public float topPadding; private boolean animating; private CropGestureDetector detector; @@ -74,7 +70,7 @@ public class CropView extends FrameLayout implements CropAreaView.AreaViewListen private boolean isVisible; - private int bitmapRotation; + protected int bitmapRotation; public void setSubtitle(String subtitle) { areaView.setSubtitle(subtitle); @@ -152,12 +148,6 @@ private float getY() { return y; } - private void setScale(float s, float pivotX, float pivotY) { - scale = s; - matrix.reset(); - matrix.setScale(s, s, pivotX, pivotY); - } - private void scale(float s, float pivotX, float pivotY) { scale *= s; matrix.postScale(s, s, pivotX, pivotY); @@ -200,7 +190,7 @@ private void mirror() { mirrored = !mirrored; } - private void reset(CropAreaView areaView, float orient, boolean freeform) { + private void reset(float orient) { matrix.reset(); x = 0.0f; @@ -213,15 +203,6 @@ private void reset(CropAreaView areaView, float orient, boolean freeform) { matrix.postScale(scale, scale); } - private void rotateToOrientation(float orientation) { - matrix.postScale(1f / scale, 1f / scale); - this.orientation = orientation; - float wasMinimumScale = minimumScale; - updateMinimumScale(); - scale = scale / wasMinimumScale * minimumScale; - matrix.postScale(scale, scale); - } - private void updateMinimumScale() { float w = (orientation + baseRotation) % 180 != 0 ? height : width; float h = (orientation + baseRotation) % 180 != 0 ? width : height; @@ -305,10 +286,94 @@ public void setBottomPadding(float value) { areaView.setBottomPadding(value); } + public void setTopPadding(float value) { + topPadding = value; + areaView.setTopPadding(value); + } + public void setAspectRatio(float ratio) { areaView.setActualRect(ratio); } + public void stop() { + state = null; + } + + public void start(int rotation, boolean fform, boolean same, CropTransform transform, MediaController.CropState restoreState) { + freeform = fform; + paintingOverlay = null; + videoEditTextureView = null; + cropTransform = transform; + bitmapRotation = rotation; + bitmap = null; + areaView.setIsVideo(videoEditTextureView != null); + int w = getCurrentWidth(); + int h = getCurrentHeight(); + if (state == null || !same) { + state = new CropState(w, h, 0); + areaView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { + @Override + public boolean onPreDraw() { + reset(); + if (restoreState != null) { + if (restoreState.lockedAspectRatio > 0.0001f) { + areaView.setLockedAspectRatio(restoreState.lockedAspectRatio); + if (listener != null) { + listener.onAspectLock(true); + } + } + setFreeform(restoreState.freeform); + + float aspect = areaView.getAspectRatio(); + float stateWidth; + float stateHeight; + int rotatedW; + int rotatedH; + if (restoreState.transformRotation == 90 || restoreState.transformRotation == 270) { + aspect = 1.0f / aspect; + stateWidth = state.height; + stateHeight = state.width; + rotatedW = h; + rotatedH = w; + } else { + stateWidth = state.width; + stateHeight = state.height; + rotatedW = w; + rotatedH = h; + } + + int orientation = restoreState.transformRotation; + boolean fform = freeform; + if (freeform && areaView.getLockAspectRatio() > 0) { + areaView.setLockedAspectRatio(1.0f / areaView.getLockAspectRatio()); + areaView.setActualRect(areaView.getLockAspectRatio()); + fform = false; + } else { + areaView.setBitmap(getCurrentWidth(), getCurrentHeight(), (orientation + state.getBaseRotation()) % 180 != 0, freeform); + } + state.reset(orientation); + + areaView.setActualRect(aspect * restoreState.cropPw / restoreState.cropPh); + state.mirrored = restoreState.mirrored; + state.rotate(restoreState.cropRotate, 0, 0); + state.translate(restoreState.cropPx * rotatedW * state.minimumScale, restoreState.cropPy * rotatedH * state.minimumScale); + float ts = Math.max(areaView.getCropWidth() / stateWidth, areaView.getCropHeight() / stateHeight) / state.minimumScale; + state.scale(restoreState.cropScale * ts, 0, 0); + updateMatrix(); + + if (listener != null) { + listener.onChange(false); + } + } + areaView.getViewTreeObserver().removeOnPreDrawListener(this); + return false; + } + }); + } else { + state.update(w, h, rotation); + } + } + public void setBitmap(Bitmap b, int rotation, boolean fform, boolean same, PaintingOverlay overlay, CropTransform transform, VideoEditTextureView videoView, MediaController.CropState restoreState) { freeform = fform; paintingOverlay = overlay; @@ -365,7 +430,7 @@ public boolean onPreDraw() { } else { areaView.setBitmap(getCurrentWidth(), getCurrentHeight(), (orientation + state.getBaseRotation()) % 180 != 0, freeform); } - state.reset(areaView, orientation, fform); + state.reset(orientation); areaView.setActualRect(aspect * restoreState.cropPw / restoreState.cropPh); state.mirrored = restoreState.mirrored; @@ -435,7 +500,7 @@ public void reset(boolean force) { areaView.setBitmap(getCurrentWidth(), getCurrentHeight(), state != null && state.getBaseRotation() % 180 != 0, freeform); areaView.setLockedAspectRatio(freeform ? 0.0f : 1.0f); if (state != null) { - state.reset(areaView, 0, freeform); + state.reset(0); state.mirrored = false; } areaView.getCropRect(initialAreaRect); @@ -488,7 +553,7 @@ private void fillAreaView(RectF targetRect, boolean allowZoomOut) { float statusBarHeight = (Build.VERSION.SDK_INT >= 21 && !inBubbleMode ? AndroidUtilities.statusBarHeight : 0); final float x = (targetRect.centerX() - imageView.getWidth() / 2) / areaView.getCropWidth() * state.getOrientedWidth(); - final float y = (targetRect.centerY() - (imageView.getHeight() - bottomPadding + statusBarHeight) / 2) / areaView.getCropHeight() * state.getOrientedHeight(); + final float y = (targetRect.centerY() - (imageView.getHeight() - bottomPadding + statusBarHeight + topPadding) / 2) / areaView.getCropHeight() * state.getOrientedHeight(); final float targetScale = scale; final boolean animEnsureFit = ensureFit; @@ -712,7 +777,7 @@ public void onAnimationEnd(Animator animation) { } } - private int getCurrentWidth() { + public int getCurrentWidth() { if (videoEditTextureView != null) { return videoEditTextureView.getVideoWidth(); } @@ -720,7 +785,7 @@ private int getCurrentWidth() { return bitmapRotation == 90 || bitmapRotation == 270 ? bitmap.getHeight() : bitmap.getWidth(); } - private int getCurrentHeight() { + public int getCurrentHeight() { if (videoEditTextureView != null) { return videoEditTextureView.getVideoHeight(); } @@ -776,6 +841,7 @@ public void maximize(boolean animated) { final float fromScale = state.scale; final float fromRot = state.rotation; animator.addUpdateListener(animation -> { + if (state == null) return; float t = (float) animation.getAnimatedValue(); AndroidUtilities.lerp(fromActualRect, initialAreaRect, t, animatedRect); areaView.setActualRect(animatedRect); @@ -821,7 +887,7 @@ public boolean rotate(float angle) { areaView.setBitmap(getCurrentWidth(), getCurrentHeight(), (orientation + state.getBaseRotation()) % 180 != 0, freeform); } - state.reset(areaView, orientation, fform); + state.reset(orientation); updateMatrix(); fitContentInBounds(true, false, false); @@ -947,7 +1013,7 @@ public void onScale(float scale, float x, float y) { float statusBarHeight = (Build.VERSION.SDK_INT >= 21 && !inBubbleMode ? AndroidUtilities.statusBarHeight : 0); float pivotX = (x - imageView.getWidth() / 2) / areaView.getCropWidth() * state.getOrientedWidth(); - float pivotY = (y - (imageView.getHeight() - bottomPadding - statusBarHeight) / 2) / areaView.getCropHeight() * state.getOrientedHeight(); + float pivotY = (y - (imageView.getHeight() - bottomPadding - statusBarHeight - topPadding) / 2) / areaView.getCropHeight() * state.getOrientedHeight(); state.scale(scale, pivotX, pivotY); updateMatrix(); @@ -1148,48 +1214,59 @@ public void makeCrop(MediaController.MediaEditState editState) { if (editState.cropState == null) { editState.cropState = new MediaController.CropState(); } + applyToCropState(editState.cropState); + return; + } + + public void applyToCropState(MediaController.CropState cropState) { + areaView.getCropRect(cropRect); + + float w = scaleWidthToMaxSize(cropRect, sizeRect); + int width = (int) Math.ceil(w); + int height = (int) (Math.ceil(width / areaView.getAspectRatio())); + float scale = width / areaView.getCropWidth(); + state.matrix.getValues(values); float sc = state.minimumScale * scale; - editState.cropState.transformRotation = state.getOrientationOnly(); + cropState.transformRotation = state.getOrientationOnly(); if (BuildVars.LOGS_ENABLED) { - FileLog.d("set transformRotation = " + editState.cropState.transformRotation); + FileLog.d("set transformRotation = " + cropState.transformRotation); } - while (editState.cropState.transformRotation < 0) { - editState.cropState.transformRotation += 360; + while (cropState.transformRotation < 0) { + cropState.transformRotation += 360; } int sw; int sh; - if (editState.cropState.transformRotation == 90 || editState.cropState.transformRotation == 270) { + if (cropState.transformRotation == 90 || cropState.transformRotation == 270) { sw = (int) state.height; sh = (int) state.width; } else { sw = (int) state.width; sh = (int) state.height; } - editState.cropState.cropPw = (float) (width / Math.ceil(sw * sc)); - editState.cropState.cropPh = (float) (height / Math.ceil(sh * sc)); - if (editState.cropState.cropPw > 1 || editState.cropState.cropPh > 1) { - float max = Math.max(editState.cropState.cropPw, editState.cropState.cropPh); - editState.cropState.cropPw /= max; - editState.cropState.cropPh /= max; - } - editState.cropState.cropScale = state.scale * Math.min(sw / areaView.getCropWidth(), sh / areaView.getCropHeight()); - editState.cropState.cropPx = values[2] / sw / state.scale; - editState.cropState.cropPy = values[5] / sh / state.scale; - editState.cropState.cropRotate = state.rotation; - editState.cropState.stateScale = state.scale; - editState.cropState.mirrored = state.mirrored; - - editState.cropState.scale = scale; - editState.cropState.matrix = state.matrix; - editState.cropState.width = width; - editState.cropState.height = height; - editState.cropState.freeform = freeform; - editState.cropState.lockedAspectRatio = areaView.getLockAspectRatio(); - - editState.cropState.initied = true; - return; + cropState.cropPw = (float) (width / Math.ceil(sw * sc)); + cropState.cropPh = (float) (height / Math.ceil(sh * sc)); + if (cropState.cropPw > 1 || cropState.cropPh > 1) { + float max = Math.max(cropState.cropPw, cropState.cropPh); + cropState.cropPw /= max; + cropState.cropPh /= max; + } + cropState.cropScale = state.scale * Math.min(sw / areaView.getCropWidth(), sh / areaView.getCropHeight()); + cropState.cropPx = values[2] / sw / state.scale; + cropState.cropPy = values[5] / sh / state.scale; + cropState.cropRotate = state.rotation; + cropState.stateScale = state.scale; + cropState.mirrored = state.mirrored; + + cropState.scale = scale; + cropState.matrix = state.matrix; + cropState.width = width; + cropState.height = height; + cropState.freeform = freeform; + cropState.lockedAspectRatio = areaView.getLockAspectRatio(); + + cropState.initied = true; } private void setLockedAspectRatio(float aspectRatio) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/CustomPhoneKeyboardView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/CustomPhoneKeyboardView.java index fccfd0e235..12680c0e0c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/CustomPhoneKeyboardView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/CustomPhoneKeyboardView.java @@ -43,8 +43,10 @@ public class CustomPhoneKeyboardView extends ViewGroup { checkFindEditText(); if (editText == null || editText.length() == 0 && !dispatchBackWhenEmpty) return; - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - playSoundEffect(SoundEffectConstants.CLICK); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + playSoundEffect(SoundEffectConstants.CLICK); + } catch (Exception ignore) {} editText.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL)); editText.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DEL)); @@ -106,7 +108,9 @@ public CustomPhoneKeyboardView(Context context) { checkFindEditText(); if (editText == null) return; - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignore) {} if (editText instanceof EditTextBoldCursor) { ((EditTextBoldCursor) editText).setTextWatchersSuppressed(true, false); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/DialogCellTags.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/DialogCellTags.java index 799a8c18db..887719cdb3 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/DialogCellTags.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/DialogCellTags.java @@ -11,13 +11,16 @@ import android.graphics.PorterDuffXfermode; import android.graphics.Shader; import android.text.Layout; +import android.text.SpannableStringBuilder; import android.text.StaticLayout; import android.text.TextUtils; +import android.view.View; import org.telegram.messenger.AccountInstance; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.Emoji; import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MessageObject; import org.telegram.messenger.MessagesController; import org.telegram.messenger.UserConfig; import org.telegram.ui.ActionBar.Theme; @@ -28,10 +31,15 @@ public class DialogCellTags { + private final View parentView; private final ArrayList filters = new ArrayList<>(); private final ArrayList tags = new ArrayList<>(); private Tag moreTags = null; + public DialogCellTags(View view) { + parentView = view; + } + private static class Tag { private final static float padDp = 4.66f; private final static float heightDp = 14.66f; @@ -39,38 +47,38 @@ private static class Tag { public int filterId; public int colorId; - StaticLayout layout; + Text text; int color; - int left; int width; private int textHeight; - public static Tag asMore(int n) { + public static Tag asMore(View view, int n) { Tag tag = new Tag(); tag.filterId = n; String text = "+" + n; - tag.layout = new StaticLayout(text, Theme.dialogs_tagTextPaint, AndroidUtilities.displaySize.x, Layout.Alignment.ALIGN_NORMAL, 0f, 1f, false); - tag.left = (int) (tag.layout.getLineCount() >= 1 ? tag.layout.getLineLeft(0) : 0); - tag.width = dp(2 * padDp) + (int) (tag.layout.getLineCount() >= 1 ? tag.layout.getLineWidth(0) : 0); - tag.textHeight = tag.layout.getHeight(); + tag.text = new Text(text, 10, AndroidUtilities.bold()).supportAnimatedEmojis(view); + tag.width = dp(2 * padDp) + (int) tag.text.getCurrentWidth(); + tag.textHeight = (int) tag.text.getHeight(); tag.color = Theme.getColor(Theme.key_avatar_nameInMessageBlue); return tag; } - public static Tag fromFilter(int currentAccount, MessagesController.DialogFilter filter) { + public static Tag fromFilter(View view, int currentAccount, MessagesController.DialogFilter filter) { Tag tag = new Tag(); tag.filterId = filter.id; tag.colorId = filter.color; - CharSequence text = (filter.name == null ? "" : filter.name).toUpperCase(); - text = Emoji.replaceEmoji(text, Theme.dialogs_tagTextPaint.getFontMetricsInt(), false); - tag.layout = new StaticLayout(text, Theme.dialogs_tagTextPaint, AndroidUtilities.displaySize.x, Layout.Alignment.ALIGN_NORMAL, 0f, 1f, false); - tag.left = (int) (tag.layout.getLineCount() >= 1 ? tag.layout.getLineLeft(0) : 0); - tag.width = dp(2 * padDp) + (int) (tag.layout.getLineCount() >= 1 ? tag.layout.getLineWidth(0) : 0); - tag.textHeight = tag.layout.getHeight(); + CharSequence text = new SpannableStringBuilder((filter.name == null ? "" : filter.name).toUpperCase()); + tag.text = new Text(text, 10, AndroidUtilities.bold()).supportAnimatedEmojis(view); + text = Emoji.replaceEmoji(text, tag.text.getFontMetricsInt(), false); + text = MessageObject.replaceAnimatedEmoji(text, filter.entities, tag.text.getFontMetricsInt()); + tag.text.setText(text); + tag.text.setEmojiCacheType(AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER); + tag.width = dp(2 * padDp) + (int) tag.text.getCurrentWidth(); + tag.textHeight = (int) tag.text.getHeight(); tag.color = Theme.getColor(Theme.keys_avatar_nameInMessage[filter.color % Theme.keys_avatar_nameInMessage.length]); @@ -79,14 +87,10 @@ public static Tag fromFilter(int currentAccount, MessagesController.DialogFilter public void draw(Canvas canvas) { Theme.dialogs_tagPaint.setColor(Theme.multAlpha(color, Theme.isCurrentThemeDark() ? .20f : .10f)); - Theme.dialogs_tagTextPaint.setColor(color); AndroidUtilities.rectTmp.set(0, 0, width, dp(heightDp)); canvas.drawRoundRect(AndroidUtilities.rectTmp, dp(4), dp(4), Theme.dialogs_tagPaint); - canvas.save(); - canvas.translate(dp(padDp) - left, (dp(heightDp) - textHeight) / 2f); - layout.draw(canvas); - canvas.restore(); + text.draw(canvas, dp(padDp), dp(heightDp) / 2f, color, 1.0f); } } @@ -140,8 +144,8 @@ public boolean update(int currentAccount, int dialogsType, long dialogId) { changed = true; tags.remove(i); i--; - } else if (filter.color != tag.colorId || filter.name != null && tag.layout != null && filter.name.length() != tag.layout.getText().length()) { - tags.set(i, Tag.fromFilter(currentAccount, filter)); + } else if (filter.color != tag.colorId || filter.name != null && tag.text != null && filter.name.length() != tag.text.getText().length()) { + tags.set(i, Tag.fromFilter(parentView, currentAccount, filter)); changed = true; } } @@ -159,7 +163,7 @@ public boolean update(int currentAccount, int dialogsType, long dialogId) { if (tag == null) { changed = true; - tags.add(i, Tag.fromFilter(currentAccount, filter)); + tags.add(i, Tag.fromFilter(parentView, currentAccount, filter)); } } @@ -210,7 +214,7 @@ public void draw(Canvas canvas, int width) { if (i < tags.size()) { final int count = tags.size() - i; if (moreTags == null || moreTags.filterId != count) { - moreTags = Tag.asMore(count); + moreTags = Tag.asMore(parentView, count); } if (LocaleController.isRTL) { canvas.translate(-moreTags.width, 0); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/DialogsBotsAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/DialogsBotsAdapter.java index 64aa9d9234..11308e8044 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/DialogsBotsAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/DialogsBotsAdapter.java @@ -26,6 +26,7 @@ import org.telegram.messenger.MessagesController; import org.telegram.messenger.MessagesStorage; import org.telegram.messenger.R; +import org.telegram.messenger.Utilities; import org.telegram.messenger.browser.Browser; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; @@ -106,20 +107,20 @@ public void fillItems(ArrayList items, UniversalAdapter adapter) { HashSet uids = new HashSet<>(); if (!TextUtils.isEmpty(query)) { - ArrayList foundChannels = new ArrayList<>(); - foundChannels.addAll(searchMine); - foundChannels.addAll(searchGlobal); - if (!foundChannels.isEmpty()) { - if (foundChannels.size() > 5 && (!searchMessages.isEmpty() && !showOnlyPopular)) { + ArrayList foundBots = new ArrayList<>(); + foundBots.addAll(searchMine); + foundBots.addAll(searchGlobal); + if (!foundBots.isEmpty()) { + if (foundBots.size() > 5 && (!searchMessages.isEmpty() && !showOnlyPopular)) { items.add(UItem.asGraySection(getString(R.string.SearchApps), getString(expandedSearchBots ? R.string.ShowLess : R.string.ShowMore), this::toggleExpandedSearchBots)); } else { items.add(UItem.asGraySection(getString(R.string.SearchApps))); } - int count = foundChannels.size(); + int count = foundBots.size(); if (!expandedSearchBots && (!searchMessages.isEmpty() && !showOnlyPopular)) count = Math.min(5, count); for (int i = 0; i < count; ++i) { - items.add(UItem.asProfileCell(foundChannels.get(i))); + items.add(UItem.asProfileCell(foundBots.get(i)).withOpenButton(openBotCallback)); } } if (!searchMessages.isEmpty() && !showOnlyPopular) { @@ -156,9 +157,10 @@ public void fillItems(ArrayList items, UniversalAdapter adapter) { final TLRPC.User user = top_peers_bots.get(i); if (uids.contains(user.id)) continue; uids.add(user.id); - items.add(UItem.asProfileCell(user).accent()); + items.add(UItem.asProfileCell(user).accent().withOpenButton(openBotCallback)); } } + uids.clear(); topPeersEnd = items.size(); if (!popular.bots.isEmpty()) { if (!showOnlyPopular) items.add(UItem.asGraySection(getString(R.string.SearchAppsPopular))); @@ -166,15 +168,15 @@ public void fillItems(ArrayList items, UniversalAdapter adapter) { final TLRPC.User user = popular.bots.get(i); if (uids.contains(user.id)) continue; uids.add(user.id); - items.add(UItem.asProfileCell(user).accent().red()); + items.add(UItem.asProfileCell(user).accent().red().withOpenButton(openBotCallback)); hasAdded = true; } - if (popular.loading) { + if (popular.loading || !popular.endReached) { items.add(UItem.asFlicker(FlickerLoadingView.PROFILE_SEARCH_CELL)); items.add(UItem.asFlicker(FlickerLoadingView.PROFILE_SEARCH_CELL)); items.add(UItem.asFlicker(FlickerLoadingView.PROFILE_SEARCH_CELL)); } - } else if (popular.loading) { + } else if (popular.loading || !popular.endReached) { if (!showOnlyPopular) items.add(UItem.asFlicker(FlickerLoadingView.GRAY_SECTION)); items.add(UItem.asFlicker(FlickerLoadingView.PROFILE_SEARCH_CELL)); items.add(UItem.asFlicker(FlickerLoadingView.PROFILE_SEARCH_CELL)); @@ -456,14 +458,28 @@ private void loadCache(Runnable whenDone) { final SQLiteDatabase db = storage.getDatabase(); SQLiteCursor cursor = null; try { - cursor = db.queryFinalized("SELECT uid, time, offset FROM popular_bots"); + cursor = db.queryFinalized("SELECT uid, time, offset FROM popular_bots ORDER BY pos"); while (cursor.next()) { userIds.add(cursor.longValue(0)); time = Math.max(time, cursor.longValue(1)); offset = cursor.stringValue(2); } cursor.dispose(); - users.addAll(storage.getUsers(userIds)); + ArrayList usersByIds = storage.getUsers(userIds); + if (usersByIds != null) { + for (long userId : userIds) { + TLRPC.User user = null; + for (TLRPC.User u : usersByIds) { + if (u != null && u.id == userId) { + user = u; + break; + } + } + if (user != null) { + users.add(user); + } + } + } } catch (Exception e) { FileLog.e(e); } finally { @@ -480,6 +496,7 @@ private void loadCache(Runnable whenDone) { bots.addAll(users); this.cacheTime = finalTime; this.lastOffset = finalOffset; + this.endReached = TextUtils.isEmpty(finalOffset); this.cacheLoaded = true; whenDone.run(); @@ -493,7 +510,7 @@ private void saveCache() { savingCache = true; final long time = cacheTime; - final String offset = lastOffset; + final String offset = lastOffset == null ? "" : lastOffset; final ArrayList ids = new ArrayList<>(); for (int i = 0; i < bots.size(); ++i) { ids.add(bots.get(i).id); @@ -505,12 +522,13 @@ private void saveCache() { SQLitePreparedStatement state = null; try { db.executeFast("DELETE FROM popular_bots").stepThis().dispose(); - state = db.executeFast("REPLACE INTO popular_bots VALUES(?, ?, ?)"); + state = db.executeFast("REPLACE INTO popular_bots VALUES(?, ?, ?, ?)"); for (int i = 0; i < ids.size(); i++) { state.requery(); state.bindLong(1, ids.get(i)); state.bindLong(2, time); state.bindString(3, offset); + state.bindInteger(4, i); state.step(); } } catch (Exception e) { @@ -536,7 +554,7 @@ public void load() { loading = false; whenUpdated.run(); - if (System.currentTimeMillis() - cacheTime > 60 * 60 * 1000) { + if (bots.isEmpty() || System.currentTimeMillis() - cacheTime > 60 * 60 * 1000) { bots.clear(); lastOffset = null; load(); @@ -545,7 +563,7 @@ public void load() { return; } - TL_bots.getPopularAppBots req = new TL_bots.getPopularAppBots(); + final TL_bots.getPopularAppBots req = new TL_bots.getPopularAppBots(); req.limit = 20; req.offset = lastOffset == null ? "" : lastOffset; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { @@ -570,6 +588,10 @@ public void load() { } } + private final Utilities.Callback openBotCallback = this::openBot; + public void openBot(TLRPC.User user) { + MessagesController.getInstance(currentAccount).openApp(user, 0); + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/DialogsChannelsAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/DialogsChannelsAdapter.java index a5d34b0f43..e431251012 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/DialogsChannelsAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/DialogsChannelsAdapter.java @@ -21,6 +21,7 @@ import org.telegram.messenger.MessagesStorage; import org.telegram.messenger.R; import org.telegram.tgnet.ConnectionsManager; +import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Adapters.DialogsSearchAdapter; @@ -91,10 +92,13 @@ public void fillItems(ArrayList items, UniversalAdapter adapter) { MessagesController.ChannelRecommendations recommendations = MessagesController.getInstance(currentAccount).getCachedChannelRecommendations(0); if (recommendations != null) { ArrayList chats = new ArrayList<>(); - for (TLRPC.Chat chat : recommendations.chats) { - TLRPC.Chat localChat = MessagesController.getInstance(currentAccount).getChat(chat.id); - if (ChatObject.isNotInChat(chat) && (localChat == null || ChatObject.isNotInChat(localChat))) - chats.add(chat); + for (TLObject obj : recommendations.chats) { + if (obj instanceof TLRPC.Chat) { + final TLRPC.Chat chat = (TLRPC.Chat) obj; + TLRPC.Chat localChat = MessagesController.getInstance(currentAccount).getChat(chat.id); + if (ChatObject.isNotInChat(chat) && (localChat == null || ChatObject.isNotInChat(localChat))) + chats.add(chat); + } } if (!chats.isEmpty()) { items.add(UItem.asGraySection(getString(R.string.SearchRecommendedChannels))); @@ -281,23 +285,24 @@ private void searchMessages(boolean next) { String q = this.query.toLowerCase(), qT = AndroidUtilities.translitSafe(q); MessagesController.ChannelRecommendations recommendations = MessagesController.getInstance(currentAccount).getCachedChannelRecommendations(0); if (recommendations != null && !recommendations.chats.isEmpty()) { - for (TLRPC.Chat chat : recommendations.chats) { - if (chat == null) - continue; - if (!ChatObject.isChannelAndNotMegaGroup(chat)) - continue; - TLRPC.Chat localChat = MessagesController.getInstance(currentAccount).getChat(chat.id); - if (!(ChatObject.isNotInChat(chat) && (localChat == null || ChatObject.isNotInChat(localChat)))) - continue; - String t = chat.title.toLowerCase(), tT = AndroidUtilities.translitSafe(t); - if ( - t.startsWith(q) || t.contains(" " + q) || - tT.startsWith(qT) || tT.contains(" " + qT) - ) { - if (chatIds.contains(chat.id)) + for (TLObject obj : recommendations.chats) { + if (obj instanceof TLRPC.Chat) { + final TLRPC.Chat chat = (TLRPC.Chat) obj; + if (!ChatObject.isChannelAndNotMegaGroup(chat)) + continue; + TLRPC.Chat localChat = MessagesController.getInstance(currentAccount).getChat(chat.id); + if (!(ChatObject.isNotInChat(chat) && (localChat == null || ChatObject.isNotInChat(localChat)))) continue; - chatIds.add(chat.id); - searchRecommendedChannels.add(chat); + String t = chat.title.toLowerCase(), tT = AndroidUtilities.translitSafe(t); + if ( + t.startsWith(q) || t.contains(" " + q) || + tT.startsWith(qT) || tT.contains(" " + qT) + ) { + if (chatIds.contains(chat.id)) + continue; + chatIds.add(chat.id); + searchRecommendedChannels.add(chat); + } } } } @@ -322,7 +327,7 @@ private void searchMessages(boolean next) { } } - private Runnable searchMessagesRunnable = () -> searchMessages(false); + private final Runnable searchMessagesRunnable = () -> searchMessages(false); public void search(String query) { updateMyChannels(); if (TextUtils.equals(query, this.query)) return; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/EditCoverButton.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/EditCoverButton.java new file mode 100644 index 0000000000..a2279ecd0c --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/EditCoverButton.java @@ -0,0 +1,124 @@ +package org.telegram.ui.Components; + +import static org.telegram.messenger.AndroidUtilities.dp; + +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; +import android.graphics.RectF; +import android.graphics.drawable.Drawable; +import android.view.MotionEvent; +import android.view.View; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.ImageReceiver; +import org.telegram.messenger.R; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.PhotoViewer; + +public class EditCoverButton extends View { + + private final Text text; + private final PhotoViewerBlurDrawable blur; + private final Drawable arrowDrawable; + + private final ButtonBounce bounce = new ButtonBounce(this); + private final Path clipPath = new Path(); + private Bitmap image; + private final Paint imagePaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG); + private final RectF imageBounds = new RectF(); + + public EditCoverButton(Context context, PhotoViewer photoViewer, CharSequence text, boolean withArrow) { + super(context); + + this.text = new Text(text, 14, AndroidUtilities.bold()); + this.blur = new PhotoViewerBlurDrawable(photoViewer, photoViewer.blurManager, this).setApplyBounds(false); + if (withArrow) { + this.arrowDrawable = context.getResources().getDrawable(R.drawable.arrow_newchat).mutate(); + this.arrowDrawable.setColorFilter(new PorterDuffColorFilter(0x99FFFFFF, PorterDuff.Mode.SRC_IN)); + } else { + this.arrowDrawable = null; + } + + } + + public void setImage(Bitmap bitmap) { + this.image = bitmap; + invalidate(); + } + + @Override + protected void onDraw(@NonNull Canvas canvas) { + final float scale = bounce.getScale(0.05f); + canvas.save(); + canvas.scale(scale, scale, getWidth() / 2.0f, getHeight() / 2.0f); + + final int leftPadding = (image != null ? dp(30.33f) : dp(11.33f)); + final int width = leftPadding + (int) Math.ceil(text.getCurrentWidth()) + dp(19); + final int height = dp(24); + final int left = (getWidth() - width) / 2, cy = getHeight() / 2; + + blur.setBounds(left, cy - height / 2, left + width, cy + height / 2); + blur.draw(canvas); + + if (image != null) { + imageBounds.set(left + dp(.66f), cy - dp(22.66f) / 2, left + dp(.66f + 22.66f), cy + dp(22.66f) / 2); + canvas.save(); + clipPath.rewind(); + clipPath.addRoundRect(imageBounds, dp(22.66f), dp(22.66f), Path.Direction.CW); + canvas.clipPath(clipPath); + float imageScale = Math.max((float) dp(22.66f) / image.getWidth(), (float) dp(22.66f) / image.getHeight()); + canvas.translate(imageBounds.centerX(), imageBounds.centerY()); + canvas.scale(imageScale, imageScale); + canvas.translate(-image.getWidth() / 2.0f, -image.getHeight() / 2.0f); + canvas.drawBitmap(image, 0, 0, imagePaint); + canvas.restore(); + } + + text.draw(canvas, left + leftPadding, cy, 0xFFFFFFFF, 1.0f); + + arrowDrawable.setBounds(left + width - dp(17), cy - dp(6), left + width - dp(5), cy + dp(6)); + arrowDrawable.draw(canvas); + + canvas.restore(); + } + + private OnClickListener listener; + @Override + public void setOnClickListener(@Nullable OnClickListener l) { + listener = l; + } + + @Override + public boolean onTouchEvent(MotionEvent event) { + final boolean hit = blur.getBounds().contains((int) event.getX(), (int) event.getY()); + if (event.getAction() == MotionEvent.ACTION_DOWN) { + bounce.setPressed(hit); + } else if (event.getAction() == MotionEvent.ACTION_MOVE) { + if (!hit) { + bounce.setPressed(false); + } + } else if (event.getAction() == MotionEvent.ACTION_CANCEL) { + if (bounce.isPressed()) { + bounce.setPressed(false); + return true; + } + } else if (event.getAction() == MotionEvent.ACTION_UP) { + if (bounce.isPressed()) { + bounce.setPressed(false); + if (listener != null) { + listener.onClick(this); + } + return true; + } + } + return bounce.isPressed(); + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/EditTextEffects.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/EditTextEffects.java index f0c829ff8f..4c4f75c971 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/EditTextEffects.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/EditTextEffects.java @@ -202,10 +202,19 @@ public void setText(CharSequence text, BufferType type) { super.setText(text, type); } + private int lastTextColor; + private Integer emojiColor; + public void setEmojiColor(Integer emojiColor) { + this.emojiColor = emojiColor; + animatedEmojiColorFilter = new PorterDuffColorFilter(emojiColor == null ? lastTextColor : emojiColor, PorterDuff.Mode.SRC_IN); + invalidate(); + } + @Override public void setTextColor(int color) { + lastTextColor = color; super.setTextColor(color); - animatedEmojiColorFilter = new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN); + animatedEmojiColorFilter = new PorterDuffColorFilter(emojiColor == null ? color : emojiColor, PorterDuff.Mode.SRC_IN); } @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/EditTextEmoji.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/EditTextEmoji.java index 3147a9fbb2..6185091eea 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/EditTextEmoji.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/EditTextEmoji.java @@ -7,10 +7,8 @@ import android.animation.ValueAnimator; import android.app.Activity; import android.app.Dialog; -import android.content.ComponentName; import android.content.Context; import android.content.ContextWrapper; -import android.content.Intent; import android.graphics.Canvas; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; @@ -23,30 +21,23 @@ import android.text.Spanned; import android.util.TypedValue; import android.view.ActionMode; -import android.view.ContextMenu; import android.view.Gravity; import android.view.KeyEvent; import android.view.Menu; -import android.view.MenuItem; import android.view.MotionEvent; -import android.view.SubMenu; import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import android.widget.FrameLayout; import android.widget.ImageView; -import androidx.core.graphics.ColorUtils; - import org.telegram.messenger.AndroidUtilities; -import org.telegram.messenger.BuildVars; import org.telegram.messenger.Emoji; import org.telegram.messenger.FileLog; import org.telegram.messenger.LocaleController; import org.telegram.messenger.MessagesController; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; -import org.telegram.messenger.SharedConfig; import org.telegram.messenger.UserConfig; import org.telegram.messenger.XiaomiUtilities; import org.telegram.tgnet.TLRPC; @@ -136,6 +127,10 @@ protected void extendActionMode(ActionMode actionMode, Menu menu) { } + public int emojiCacheType() { + return AnimatedEmojiDrawable.getCacheTypeForEnterView(); + } + public EditTextEmoji(Context context, SizeNotifierFrameLayout parent, BaseFragment fragment, int style, boolean allowAnimatedEmoji) { this(context, parent, fragment, style, allowAnimatedEmoji, null); } @@ -167,11 +162,15 @@ public boolean onTouchEvent(MotionEvent event) { openKeyboardInternal(); } if (event.getAction() == MotionEvent.ACTION_DOWN) { + boolean wasFocused = isFocused(); requestFocus(); if (!AndroidUtilities.showKeyboard(this)) { clearFocus(); requestFocus(); } + if (!wasFocused) { + setSelection(getText().length()); + } } try { return super.onTouchEvent(event); @@ -232,6 +231,11 @@ protected void onSelectionChanged(int selStart, int selEnd) { } } } + + @Override + protected int emojiCacheType() { + return EditTextEmoji.this.emojiCacheType(); + } }; editText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI); editText.setInputType(editText.getInputType() | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES); @@ -337,8 +341,12 @@ protected void dispatchDraw(Canvas canvas) { } } else if (!isPopupShowing()) { showPopup(1); + boolean wasFocused = editText.isFocused(); emojiView.onOpen(editText.length() > 0, false); editText.requestFocus(); + if (!wasFocused) { + editText.setSelection(editText.length()); + } } else { if (emojiExpanded) { hidePopup(true); @@ -428,6 +436,7 @@ public void setFocusable(boolean focusable) { public void hideEmojiView() { if (!emojiViewVisible && emojiView != null && emojiView.getVisibility() != GONE) { emojiView.setVisibility(GONE); + emojiViewAlpha = 0.0f; } emojiPadding = 0; final boolean wasExpanded = emojiExpanded; @@ -549,12 +558,14 @@ public void hidePopup(boolean byBackButton) { height += ((ViewGroup) emojiView.getParent()).getHeight() - emojiView.getBottom(); } final int finalHeight = height; + emojiViewAlpha = 1.0f; ValueAnimator animator = ValueAnimator.ofFloat(0, finalHeight); animator.addUpdateListener(animation -> { float v = (float) animation.getAnimatedValue(); emojiView.setTranslationY(v); + emojiViewAlpha = 1f - v / (float) finalHeight; if (finalHeight > 0 && (currentStyle == STYLE_STORY || currentStyle == STYLE_PHOTOVIEWER)) { - emojiView.setAlpha(1f - v / (float) finalHeight); + emojiView.setAlpha(emojiViewAlpha); } bottomPanelTranslationY(v - finalHeight); }); @@ -566,6 +577,7 @@ public void onAnimationEnd(Animator animation) { emojiView.setTranslationY(0); emojiView.setAlpha(0); bottomPanelTranslationY(0); + emojiViewAlpha = 0.0f; hideEmojiView(); } }); @@ -586,6 +598,11 @@ public void onAnimationEnd(Animator animation) { } } + private float emojiViewAlpha; + public float getEmojiPaddingShown() { + return emojiViewAlpha; + } + protected void bottomPanelTranslationY(float translation) { } @@ -628,6 +645,7 @@ protected void showPopup(int show) { emojiView.setVisibility(VISIBLE); emojiViewVisible = true; + emojiViewAlpha = 1.0f; View currentView = emojiView; if (keyboardHeight <= 0) { @@ -668,8 +686,9 @@ protected void showPopup(int show) { animator.addUpdateListener(animation -> { float v = (float) animation.getAnimatedValue(); emojiView.setTranslationY(v); + emojiViewAlpha = 1f - v / (float) emojiPadding; if (emojiPadding > 0 && (currentStyle == STYLE_STORY || currentStyle == STYLE_PHOTOVIEWER)) { - emojiView.setAlpha(1f - v / (float) emojiPadding); + emojiView.setAlpha(emojiViewAlpha); } bottomPanelTranslationY(v); }); @@ -678,6 +697,7 @@ protected void showPopup(int show) { public void onAnimationEnd(Animator animation) { emojiView.setTranslationY(0); emojiView.setAlpha(1f); + emojiViewAlpha = 1.0f; bottomPanelTranslationY(0); } }); @@ -686,6 +706,8 @@ public void onAnimationEnd(Animator animation) { animator.start(); } else { emojiView.setAlpha(1f); + emojiViewAlpha = 1.0f; + bottomPanelTranslationY(0); } } else { if (emojiButton != null) { @@ -700,11 +722,13 @@ public void onAnimationEnd(Animator animation) { onEmojiKeyboardUpdate(); if (AndroidUtilities.usingHardwareInput || AndroidUtilities.isInMultiwindow) { emojiView.setVisibility(GONE); + emojiViewAlpha = 0.0f; } } if (sizeNotifierLayout != null) { if (show == 0) { emojiPadding = 0; + emojiViewAlpha = 0.0f; } sizeNotifierLayout.requestLayout(); onWindowSizeChanged(); @@ -776,8 +800,10 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto } } }; + emojiView.emojiCacheType = emojiViewCacheType; emojiView.allowEmojisForNonPremium(allowEmojisForNonPremium); emojiView.setVisibility(GONE); + emojiViewAlpha = 0.0f; if (AndroidUtilities.isTablet()) { emojiView.setForseMultiwindowLayout(true); } @@ -858,7 +884,7 @@ public void onEmojiSelected(String symbol) { } try { innerTextChange = 2; - CharSequence localCharSequence = Emoji.replaceEmoji(symbol, editText.getPaint().getFontMetricsInt(), dp(20), false); + CharSequence localCharSequence = Emoji.replaceEmoji(symbol, editText.getPaint().getFontMetricsInt(), false); editText.setText(editText.getText().insert(i, localCharSequence)); int j = i + localCharSequence.length(); editText.setSelection(j, j); @@ -1008,4 +1034,12 @@ public View getEmojiButton() { private int getThemedColor(int key) { return Theme.getColor(key, resourcesProvider); } + + private int emojiViewCacheType = AnimatedEmojiDrawable.CACHE_TYPE_KEYBOARD; + public void setEmojiViewCacheType(int cacheType) { + emojiViewCacheType = cacheType; + if (emojiView != null) { + emojiView.emojiCacheType = cacheType; + } + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/EffectsTextView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/EffectsTextView.java index f74aa0928e..340c461305 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/EffectsTextView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/EffectsTextView.java @@ -53,7 +53,7 @@ public EffectsTextView(Context context, LinkSpanDrawable.LinkCollector customLin @Override public void setText(CharSequence text, BufferType type) { - text = Emoji.replaceEmoji(text, getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false); + text = Emoji.replaceEmoji(text, getPaint().getFontMetricsInt(), false); super.setText(text, type); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/EmbedBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/EmbedBottomSheet.java index f2ee9aef9e..65703939a9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/EmbedBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/EmbedBottomSheet.java @@ -390,15 +390,20 @@ public void onHideCustomView() { webView.setWebViewClient(new WebViewClient() { @Override public boolean onRenderProcessGone(WebView view, RenderProcessGoneDetail detail) { - if (!AndroidUtilities.isSafeToShow(getContext())) { + try { + if (!AndroidUtilities.isSafeToShow(getContext())) { + return true; + } + new AlertDialog.Builder(getContext(), resourcesProvider) + .setTitle(getString(R.string.ChromeCrashTitle)) + .setMessage(AndroidUtilities.replaceSingleTag(getString(R.string.ChromeCrashMessage), () -> Browser.openUrl(getContext(), "https://play.google.com/store/apps/details?id=com.google.android.webview"))) + .setPositiveButton(getString(R.string.OK), null) + .show(); return true; + } catch (Exception e) { + FileLog.e(e); + return false; } - new AlertDialog.Builder(getContext(), resourcesProvider) - .setTitle(getString(R.string.ChromeCrashTitle)) - .setMessage(AndroidUtilities.replaceSingleTag(getString(R.string.ChromeCrashMessage), () -> Browser.openUrl(getContext(), "https://play.google.com/store/apps/details?id=com.google.android.webview"))) - .setPositiveButton(getString(R.string.OK), null) - .show(); - return true; } @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/EmojiPacksAlert.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/EmojiPacksAlert.java index 0cf571558f..11f361eada 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/EmojiPacksAlert.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/EmojiPacksAlert.java @@ -65,6 +65,7 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import org.telegram.ui.ActionBar.ActionBarMenuItem; import org.telegram.ui.ActionBar.ActionBarMenuSubItem; import org.telegram.ui.ActionBar.ActionBarPopupWindow; @@ -164,22 +165,23 @@ public Boolean canSetAsStatus(TLRPC.Document document) { @Override public void setAsEmojiStatus(TLRPC.Document document, Integer until) { - TLRPC.EmojiStatus status; + final TLRPC.EmojiStatus emojiStatus; if (document == null) { - status = new TLRPC.TL_emojiStatusEmpty(); - } else if (until != null) { - status = new TLRPC.TL_emojiStatusUntil(); - ((TLRPC.TL_emojiStatusUntil) status).document_id = document.id; - ((TLRPC.TL_emojiStatusUntil) status).until = until; + emojiStatus = new TLRPC.TL_emojiStatusEmpty(); } else { - status = new TLRPC.TL_emojiStatus(); - ((TLRPC.TL_emojiStatus) status).document_id = document.id; + final TLRPC.TL_emojiStatus status = new TLRPC.TL_emojiStatus(); + status.document_id = document.id; + if (until != null) { + status.flags |= 1; + status.until = until; + } + emojiStatus = status; } - TLRPC.User user = UserConfig.getInstance(UserConfig.selectedAccount).getCurrentUser(); + final TLRPC.User user = UserConfig.getInstance(UserConfig.selectedAccount).getCurrentUser(); final TLRPC.EmojiStatus previousEmojiStatus = user == null ? new TLRPC.TL_emojiStatusEmpty() : user.emoji_status; - MessagesController.getInstance(currentAccount).updateEmojiStatus(status); + MessagesController.getInstance(currentAccount).updateEmojiStatus(emojiStatus); - Runnable undoAction = () -> MessagesController.getInstance(currentAccount).updateEmojiStatus(previousEmojiStatus); + final Runnable undoAction = () -> MessagesController.getInstance(currentAccount).updateEmojiStatus(previousEmojiStatus); if (document == null) { final Bulletin.SimpleLayout layout = new Bulletin.SimpleLayout(getContext(), resourcesProvider); layout.textView.setText(LocaleController.getString(R.string.RemoveStatusInfo)); @@ -253,7 +255,6 @@ protected void onUpdate() { progressDrawable = new CircularProgressDrawable(AndroidUtilities.dp(32), AndroidUtilities.dp(3.5f), getThemedColor(Theme.key_featuredStickers_addButton)); - final ColorFilter colorFilter = new PorterDuffColorFilter(ColorUtils.setAlphaComponent(getThemedColor(Theme.key_windowBackgroundWhiteLinkText), 178), PorterDuff.Mode.MULTIPLY); containerView = contentView = new ContentView(context); paddingView = new View(context) { @@ -1931,24 +1932,24 @@ public void init() { } ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> { AndroidUtilities.runOnUIThread(() -> { - if (err != null || !(res instanceof TLRPC.Vector)) { - EmojiPacksAlert.this.dismiss(); - if (fragment != null && fragment.getParentActivity() != null) { + if (err != null || !(res instanceof Vector)) { + EmojiPacksAlert.this.dismiss(); + if (fragment != null && fragment.getParentActivity() != null) { BulletinFactory.of(fragment).createErrorBulletin(LocaleController.getString(R.string.UnknownError)).show(); - } + } } else { - TLRPC.Vector vector = (TLRPC.Vector) res; + Vector vector = (Vector) res; if (inputStickerSets == null) { inputStickerSets = new ArrayList<>(); } - for (int i = 0; i < vector.objects.size(); ++i) { - Object object = vector.objects.get(i); - if (object instanceof TLRPC.StickerSetCovered && ((TLRPC.StickerSetCovered) object).set != null) { + for (int i = 0; i < vector.objects.size(); ++i) { + Object object = vector.objects.get(i); + if (object instanceof TLRPC.StickerSetCovered && ((TLRPC.StickerSetCovered) object).set != null) { inputStickerSets.add(MediaDataController.getInputStickerSet(((TLRPC.StickerSetCovered) object).set)); - } - } - parentObject = null; - init(); + } + } + parentObject = null; + init(); } }); }); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/EmojiTabsStrip.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/EmojiTabsStrip.java index b22a680c1d..740c0d28ed 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/EmojiTabsStrip.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/EmojiTabsStrip.java @@ -20,7 +20,6 @@ import android.view.View; import android.view.ViewGroup; import android.widget.HorizontalScrollView; -import android.widget.ImageView; import android.widget.LinearLayout; import androidx.annotation.NonNull; @@ -36,6 +35,7 @@ import org.telegram.messenger.MessageObject; import org.telegram.messenger.R; import org.telegram.messenger.UserConfig; +import org.telegram.messenger.Utilities; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Components.Premium.PremiumLockIconView; @@ -49,6 +49,7 @@ public class EmojiTabsStrip extends ScrollableHorizontalScrollView { private int recentDrawableId = R.drawable.msg_emoji_recent; + private int giftsDrawableId = R.drawable.msg_emoji_gem; private static int[] emojiTabsDrawableIds = { R.drawable.msg_emoji_smiles, R.drawable.msg_emoji_cat, @@ -80,6 +81,7 @@ public class EmojiTabsStrip extends ScrollableHorizontalScrollView { public EmojiTabButton toggleEmojiStickersTab; public EmojiTabButton recentTab; + public EmojiTabButton giftsTab; private EmojiTabButton settingsTab; private EmojiTabsView emojiTabs; private HashMap removingViews = new HashMap<>(); @@ -102,11 +104,11 @@ public class EmojiTabsStrip extends ScrollableHorizontalScrollView { private int currentType; public boolean updateButtonDrawables = true; - public EmojiTabsStrip(Context context, Theme.ResourcesProvider resourcesProvider, boolean includeRecent, boolean includeStandard, boolean includeAnimated, int type, Runnable onSettingsOpen) { - this(context, resourcesProvider, includeRecent, includeStandard, includeAnimated, type, onSettingsOpen, Theme.getColor(Theme.key_windowBackgroundWhiteBlueIcon, resourcesProvider)); + public EmojiTabsStrip(Context context, Theme.ResourcesProvider resourcesProvider, boolean includeRecent, boolean includeGifts, boolean includeStandard, boolean includeAnimated, int type, Runnable onSettingsOpen) { + this(context, resourcesProvider, includeRecent, includeGifts, includeStandard, includeAnimated, type, onSettingsOpen, Theme.getColor(Theme.key_windowBackgroundWhiteBlueIcon, resourcesProvider)); } - public EmojiTabsStrip(Context context, Theme.ResourcesProvider resourcesProvider, boolean includeRecent, boolean includeStandard, boolean includeAnimated, int type, Runnable onSettingsOpen, int accentColor) { + public EmojiTabsStrip(Context context, Theme.ResourcesProvider resourcesProvider, boolean includeRecent, boolean includeGifts, boolean includeStandard, boolean includeAnimated, int type, Runnable onSettingsOpen, int accentColor) { super(context); this.includeAnimated = includeAnimated; this.resourcesProvider = resourcesProvider; @@ -122,7 +124,7 @@ public EmojiTabsStrip(Context context, Theme.ResourcesProvider resourcesProvider protected void onLayout(boolean changed, int l, int t, int r, int b) { int cy = (b - t) / 2; if (includeAnimated) { - int x = getPaddingLeft() - (!recentIsShown ? AndroidUtilities.dp(30 + 3) : 0); + int x = getPaddingLeft(); for (int i = 0; i < getChildCount(); ++i) { View child = getChildAt(i); if (child == settingsTab || removingViews.containsKey(child)) { @@ -146,11 +148,13 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) { } lastX.put(id, x); } + if (child == recentTab && !recentIsShown || child == giftsTab && !giftsIsShown) { + continue; + } x += child.getMeasuredWidth() + AndroidUtilities.dp(3); } } if (settingsTab != null) { - x += (!recentIsShown ? AndroidUtilities.dp(30 + 3) : 0); Long id = settingsTab.id; if (x + settingsTab.getMeasuredWidth() + getPaddingRight() <= EmojiTabsStrip.this.getMeasuredWidth()) { settingsTab.layout(x = (r - l - getPaddingRight() - settingsTab.getMeasuredWidth()), cy - settingsTab.getMeasuredHeight() / 2, r - l - getPaddingRight(), cy + settingsTab.getMeasuredHeight() / 2); @@ -166,11 +170,11 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) { } } } else { - final int childCount = getChildCount() - (!recentIsShown ? 1 : 0); + final int childCount = getChildCount() - (!recentIsShown ? 1 : 0) - (!giftsIsShown ? 1 : 0); int margin = (int) ((r - l - getPaddingLeft() - getPaddingRight() - childCount * AndroidUtilities.dp(30)) / (float) Math.max(1, childCount - 1)); int x = getPaddingLeft(); for (int i = 0; i < childCount; ++i) { - View child = getChildAt((!recentIsShown ? 1 : 0) + i); + View child = getChildAt((!recentIsShown ? 1 : 0) + (!giftsIsShown ? 1 : 0) + i); if (child != null) { child.layout(x, cy - child.getMeasuredHeight() / 2, x + child.getMeasuredWidth(), cy + child.getMeasuredHeight() / 2); x += child.getMeasuredWidth() + margin; @@ -182,7 +186,7 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { final int AT_MOST = MeasureSpec.makeMeasureSpec(99999999, MeasureSpec.AT_MOST); - int width = getPaddingLeft() + getPaddingRight() - (int) (recentIsShown ? 0 : recentTab.getAlpha() * AndroidUtilities.dp(30 + 3)); + int width = getPaddingLeft() + getPaddingRight() - (int) (recentIsShown || recentTab == null ? 0 : recentTab.getAlpha() * AndroidUtilities.dp(30 + 3)) - (int) (giftsIsShown || giftsTab == null ? 0 : giftsTab.getAlpha() * AndroidUtilities.dp(30 + 3)); for (int i = 0; i < getChildCount(); ++i) { View child = getChildAt(i); if (child != null) { @@ -197,11 +201,11 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { setMeasuredDimension(Math.max(width, MeasureSpec.getSize(widthMeasureSpec)), MeasureSpec.getSize(heightMeasureSpec)); } - private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); - private RectF from = new RectF(); - private RectF to = new RectF(); - private RectF rect = new RectF(); - private Path path = new Path(); + private final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); + private final RectF from = new RectF(); + private final RectF to = new RectF(); + private final RectF rect = new RectF(); + private final Path path = new Path(); @Override protected void dispatchDraw(Canvas canvas) { @@ -226,7 +230,7 @@ protected void dispatchDraw(Canvas canvas) { getChildBounds(selectFrom, from); getChildBounds(selectTo, to); AndroidUtilities.lerp(from, to, selectT - selectFrom, rect); - float isEmojiTabs = emojiTabs == null ? 0 : MathUtils.clamp(1f - Math.abs(selectT - 1), 0, 1); + float isEmojiTabs = emojiTabs == null ? 0 : 1f - Utilities.clamp01(Math.abs(selectT - (1 + (giftsTab != null ? 1 : 0)))); float isMiddle = 4f * selectAnimationT * (1f - selectAnimationT); float hw = rect.width() / 2 * (1f + isMiddle * .3f); float hh = rect.height() / 2 * (1f - isMiddle * .05f); @@ -299,13 +303,18 @@ private void getChildBounds(int i, RectF out) { if (type == SelectAnimatedEmojiDialog.TYPE_TOPIC_ICON) { recentDrawableId = R.drawable.msg_emoji_smiles; } - if(type == SelectAnimatedEmojiDialog.TYPE_CHAT_REACTIONS) { + if (type == SelectAnimatedEmojiDialog.TYPE_CHAT_REACTIONS) { recentDrawableId = R.drawable.emoji_love; } if (includeRecent) { contentView.addView(recentTab = new EmojiTabButton(context, recentDrawableId, false, false)); recentTab.id = (long) "recent".hashCode(); } + if (includeGifts) { + contentView.addView(giftsTab = new EmojiTabButton(context, giftsDrawableId, false, false)); + giftsTab.setAlpha(0.0f); + giftsTab.id = (long) "gifts".hashCode(); + } if (!includeAnimated) { for (int i = 0; i < emojiTabsDrawableIds.length; ++i) { contentView.addView(new EmojiTabButton(context, emojiTabsDrawableIds[i], false, i == 0)); @@ -362,6 +371,33 @@ public void showRecent(boolean show) { recentFirstChange = false; } + private boolean giftsFirstChange = true; + private boolean giftsIsShown = false; + + public void showGifts(boolean show) { + if (giftsTab == null || !giftsFirstChange && giftsIsShown == show) { + return; + } + giftsIsShown = show; + if (giftsFirstChange) { + giftsTab.setVisibility(show ? View.VISIBLE : View.GONE); + giftsTab.setAlpha(show ? 1f : 0f); + } else { + giftsTab.setVisibility(View.VISIBLE); + giftsTab.animate().alpha(show ? 1f : 0f).setDuration(200).setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT).withEndAction(() -> { + if (!show) { + giftsTab.setVisibility(View.GONE); + } + }).start(); + } + contentView.requestLayout(); + giftsFirstChange = false; + } + + public boolean isGiftsVisible() { + return giftsTab != null && giftsIsShown; + } + protected boolean doIncludeFeatured() { return true; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/EmojiView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/EmojiView.java index a66b9d895c..92690bdc0f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/EmojiView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/EmojiView.java @@ -513,20 +513,21 @@ public void sendEmoji(TLRPC.Document emoji) { @Override public void setAsEmojiStatus(TLRPC.Document document, Integer until) { - TLRPC.EmojiStatus status; + final TLRPC.EmojiStatus emojiStatus; if (document == null) { - status = new TLRPC.TL_emojiStatusEmpty(); - } else if (until != null) { - status = new TLRPC.TL_emojiStatusUntil(); - ((TLRPC.TL_emojiStatusUntil) status).document_id = document.id; - ((TLRPC.TL_emojiStatusUntil) status).until = until; + emojiStatus = new TLRPC.TL_emojiStatusEmpty(); } else { - status = new TLRPC.TL_emojiStatus(); - ((TLRPC.TL_emojiStatus) status).document_id = document.id; + TLRPC.TL_emojiStatus status = new TLRPC.TL_emojiStatus(); + status.document_id = document.id; + if (until != null) { + status.flags |= 1; + status.until = until; + } + emojiStatus = status; } - TLRPC.User user = UserConfig.getInstance(UserConfig.selectedAccount).getCurrentUser(); + final TLRPC.User user = UserConfig.getInstance(UserConfig.selectedAccount).getCurrentUser(); final TLRPC.EmojiStatus previousEmojiStatus = user == null ? new TLRPC.TL_emojiStatusEmpty() : user.emoji_status; - MessagesController.getInstance(currentAccount).updateEmojiStatus(status); + MessagesController.getInstance(currentAccount).updateEmojiStatus(emojiStatus); Runnable undoAction = () -> MessagesController.getInstance(currentAccount).updateEmojiStatus(previousEmojiStatus); if (document == null) { @@ -1553,7 +1554,7 @@ protected boolean drawChild(Canvas canvas, View child, long drawingTime) { if (needAnimatedEmoji) { MediaDataController.getInstance(currentAccount).checkStickers(MediaDataController.TYPE_EMOJIPACKS); MediaDataController.getInstance(currentAccount).checkFeaturedEmoji(); - animatedEmojiTextColorFilter = new PorterDuffColorFilter(getThemedColor(Theme.key_windowBackgroundWhiteBlackText), PorterDuff.Mode.SRC_IN); + animatedEmojiTextColorFilter = new PorterDuffColorFilter(getThemedColor(Theme.key_featuredStickers_addButton), PorterDuff.Mode.SRC_IN); } emojiGridView = new EmojiGridView(context); DefaultItemAnimator emojiItemAnimator = new DefaultItemAnimator(); @@ -1729,7 +1730,7 @@ public void onScrollStateChanged(RecyclerView recyclerView, int newState) { } }); - emojiTabs = new EmojiTabsStrip(context, resourcesProvider, true, true, needAnimatedEmoji, 0, fragment != null ? () -> { + emojiTabs = new EmojiTabsStrip(context, resourcesProvider, true, false, true, needAnimatedEmoji, 0, fragment != null ? () -> { if (delegate != null) { delegate.onEmojiSettingsClick(emojiAdapter.frozenEmojiPacks); } @@ -2474,7 +2475,9 @@ public boolean onTouchEvent(MotionEvent event) { backspacePressed = false; if (!backspaceOnce) { if (delegate != null && delegate.onBackspace()) { - backspaceButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + backspaceButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignore) {} } } } @@ -4705,9 +4708,11 @@ private void showBackspaceButton(boolean show, boolean animated) { backspaceButton.setVisibility(VISIBLE); } backspaceButtonAnimation = new AnimatorSet(); - backspaceButtonAnimation.playTogether(ObjectAnimator.ofFloat(backspaceButton, View.ALPHA, show ? 1.0f : 0.0f), - ObjectAnimator.ofFloat(backspaceButton, View.SCALE_X, show ? 1.0f : 0.0f), - ObjectAnimator.ofFloat(backspaceButton, View.SCALE_Y, show ? 1.0f : 0.0f)); + backspaceButtonAnimation.playTogether( + ObjectAnimator.ofFloat(backspaceButton, View.ALPHA, show ? 1.0f : 0.0f), + ObjectAnimator.ofFloat(backspaceButton, View.SCALE_X, show ? 1.0f : 0.0f), + ObjectAnimator.ofFloat(backspaceButton, View.SCALE_Y, show ? 1.0f : 0.0f) + ); backspaceButtonAnimation.setDuration(200); backspaceButtonAnimation.setInterpolator(CubicBezierInterpolator.EASE_OUT); backspaceButtonAnimation.addListener(new AnimatorListenerAdapter() { @@ -5145,7 +5150,9 @@ private void postBackspaceRunnable(final int time) { return; } if (delegate != null && delegate.onBackspace()) { - backspaceButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + backspaceButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignore) {} } backspaceOnce = true; postBackspaceRunnable(Math.max(50, time - 100)); @@ -5557,7 +5564,7 @@ public void updateColors() { gifSearchAdapter.progressEmptyView.textView.setTextColor(getThemedColor(Theme.key_chat_emojiPanelEmptyText)); gifSearchAdapter.progressEmptyView.progressView.setProgressColor(getThemedColor(Theme.key_progressCircle)); } - animatedEmojiTextColorFilter = new PorterDuffColorFilter(getThemedColor(Theme.key_windowBackgroundWhiteBlackText), PorterDuff.Mode.SRC_IN); + animatedEmojiTextColorFilter = new PorterDuffColorFilter(getThemedColor(Theme.key_featuredStickers_addButton), PorterDuff.Mode.SRC_IN); for (int a = 0; a < tabIcons.length; a++) { Theme.setEmojiDrawableColor(tabIcons[a], getThemedColor(Theme.key_chat_emojiBottomPanelIcon), false); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/FilterTabsView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/FilterTabsView.java index 02420d4d9b..df9968fa2f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/FilterTabsView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/FilterTabsView.java @@ -16,6 +16,7 @@ import android.annotation.SuppressLint; import android.content.Context; import android.graphics.Canvas; +import android.graphics.ColorFilter; import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; @@ -49,6 +50,7 @@ import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.Emoji; import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MessageObject; import org.telegram.messenger.MessagesController; import org.telegram.messenger.MessagesStorage; import org.telegram.messenger.R; @@ -57,6 +59,7 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.Stories.recorder.HintView2; import java.util.ArrayList; @@ -103,19 +106,24 @@ public interface FilterTabsViewDelegate { public class Tab { public int id; - public String title; + public CharSequence title; public int titleWidth; public int counter; public boolean isDefault; public boolean isLocked; + public boolean noanimate; - public Tab(int i, String t) { + public Tab(int i, String t, ArrayList e, boolean noanimate) { id = i; - title = t; + title = new SpannableStringBuilder(t); + title = Emoji.replaceEmoji(title, textPaint.getFontMetricsInt(), false); +// MessageObject.addEntitiesToText(title, e, false, false, false, true); + title = MessageObject.replaceAnimatedEmoji(title, e, textPaint.getFontMetricsInt()); + this.noanimate = noanimate; } public int getWidth(boolean store) { - int width = titleWidth = (int) Math.ceil(textPaint.measureText(title)); + int width = titleWidth = (int) Math.ceil(HintView2.measureCorrectly(title, textPaint)); int c; if (store) { c = delegate.getTabCounter(id); @@ -137,11 +145,15 @@ public int getWidth(boolean store) { return Math.max(AndroidUtilities.dp(40), width); } - public boolean setTitle(String newTitle) { + public boolean setTitle(String newTitle, ArrayList newEntities, boolean noanimate) { if (TextUtils.equals(title, newTitle)) { return false; } - title = newTitle; + title = new SpannableStringBuilder(newTitle); + title = Emoji.replaceEmoji(title, textPaint.getFontMetricsInt(), false); +// MessageObject.addEntitiesToText(title, newEntities, false, false, false, true); + title = MessageObject.replaceAnimatedEmoji(title, newEntities, textPaint.getFontMetricsInt()); + this.noanimate = noanimate; return true; } } @@ -154,7 +166,9 @@ public class TabView extends View { private int tabWidth; private int currentPosition; private RectF rect = new RectF(); - private String currentText; + private CharSequence currentText; + private boolean currentNoanimate; + private AnimatedEmojiSpan.EmojiGroupedSpans textLayoutEmojis; private StaticLayout textLayout; private int textOffsetX; @@ -177,9 +191,12 @@ public class TabView extends View { StaticLayout stableCounter; StaticLayout lastTitleLayout; - String lastTitle; + CharSequence lastTitle; + private AnimatedEmojiSpan.EmojiGroupedSpans titleAnimateInLayoutEmojis; private StaticLayout titleAnimateInLayout; + private AnimatedEmojiSpan.EmojiGroupedSpans titleAnimateOutLayoutEmojis; private StaticLayout titleAnimateOutLayout; + private AnimatedEmojiSpan.EmojiGroupedSpans titleAnimateStableLayoutEmojis; private StaticLayout titleAnimateStableLayout; private boolean animateTextChange; private boolean animateTextChangeOut; @@ -207,6 +224,20 @@ public void setTab(Tab tab, int position) { currentPosition = position; setContentDescription(tab.title); requestLayout(); + + if (currentNoanimate != (currentTab != null && currentTab.noanimate)) { + AnimatedEmojiSpan.release(this, textLayoutEmojis); + AnimatedEmojiSpan.release(this, titleAnimateInLayoutEmojis); + AnimatedEmojiSpan.release(this, titleAnimateOutLayoutEmojis); + AnimatedEmojiSpan.release(this, titleAnimateStableLayoutEmojis); + if (attached) { + textLayoutEmojis = AnimatedEmojiSpan.update(currentTab.noanimate ? AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER : AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, this, textLayoutEmojis, textLayout); + titleAnimateInLayoutEmojis = AnimatedEmojiSpan.update(currentTab.noanimate ? AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER : AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, this, titleAnimateInLayoutEmojis, titleAnimateInLayout); + titleAnimateOutLayoutEmojis = AnimatedEmojiSpan.update(currentTab.noanimate ? AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER : AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, this, titleAnimateOutLayoutEmojis, titleAnimateOutLayout); + titleAnimateStableLayoutEmojis = AnimatedEmojiSpan.update(currentTab.noanimate ? AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER : AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, this, titleAnimateStableLayoutEmojis, titleAnimateStableLayout); + } + currentNoanimate = currentTab.noanimate; + } } public int getId() { @@ -215,6 +246,7 @@ public int getId() { @Override protected void onDetachedFromWindow() { + attached = false; super.onDetachedFromWindow(); animateChange = false; animateTabCounter = false; @@ -229,6 +261,10 @@ protected void onDetachedFromWindow() { changeAnimator = null; } invalidate(); + AnimatedEmojiSpan.release(this, textLayoutEmojis); + AnimatedEmojiSpan.release(this, titleAnimateInLayoutEmojis); + AnimatedEmojiSpan.release(this, titleAnimateOutLayoutEmojis); + AnimatedEmojiSpan.release(this, titleAnimateStableLayoutEmojis); } @Override @@ -300,6 +336,7 @@ protected void onDraw(Canvas canvas) { textPaint.setColor(ColorUtils.blendARGB(color1, color2, animationValue)); } } + emojiColorFilter = new PorterDuffColorFilter(textPaint.getColor(), PorterDuff.Mode.SRC_IN); float counterWidth; int countWidth; @@ -336,8 +373,8 @@ protected void onDraw(Canvas canvas) { if (!TextUtils.equals(currentTab.title, currentText)) { currentText = currentTab.title; - CharSequence text = Emoji.replaceEmoji(currentText, textPaint.getFontMetricsInt(), AndroidUtilities.dp(15), false); - textLayout = new StaticLayout(text, textPaint, AndroidUtilities.dp(400), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0, false); + textLayout = new StaticLayout(currentText, textPaint, AndroidUtilities.dp(400), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0, false); + textLayoutEmojis = AnimatedEmojiSpan.update(currentTab.noanimate ? AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER : AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, this, textLayoutEmojis, textLayout); textHeight = textLayout.getHeight(); textOffsetX = (int) -textLayout.getLineLeft(0); } @@ -350,6 +387,7 @@ protected void onDraw(Canvas canvas) { canvas.save(); canvas.translate(textX + textOffsetX + titleOffsetX, (getMeasuredHeight() - textHeight) / 2f + 1); titleAnimateStableLayout.draw(canvas); + AnimatedEmojiSpan.drawAnimatedEmojis(canvas, titleAnimateStableLayout, titleAnimateStableLayoutEmojis, 0, null, computeVerticalScrollOffset() - AndroidUtilities.dp(6), computeVerticalScrollOffset() + computeVerticalScrollExtent(), 0, 1.0f, emojiColorFilter); canvas.restore(); } if (titleAnimateInLayout != null) { @@ -358,6 +396,7 @@ protected void onDraw(Canvas canvas) { textPaint.setAlpha((int) (alpha * (animateTextChangeOut ? 1f - changeProgress : changeProgress))); canvas.translate(textX + textOffsetX + titleOffsetX, (getMeasuredHeight() - textHeight) / 2f + 1); titleAnimateInLayout.draw(canvas); + AnimatedEmojiSpan.drawAnimatedEmojis(canvas, titleAnimateInLayout, titleAnimateInLayoutEmojis, 0, null, computeVerticalScrollOffset() - AndroidUtilities.dp(6), computeVerticalScrollOffset() + computeVerticalScrollExtent(), 0, (animateTextChangeOut ? 1f - changeProgress : changeProgress), emojiColorFilter); canvas.restore(); textPaint.setAlpha(alpha); } @@ -367,6 +406,7 @@ protected void onDraw(Canvas canvas) { textPaint.setAlpha((int) (alpha * (animateTextChangeOut ? changeProgress : 1f - changeProgress))); canvas.translate(textX + textOffsetX + titleOffsetX, (getMeasuredHeight() - textHeight) / 2f + 1); titleAnimateOutLayout.draw(canvas); + AnimatedEmojiSpan.drawAnimatedEmojis(canvas, titleAnimateOutLayout, titleAnimateOutLayoutEmojis, 0, null, computeVerticalScrollOffset() - AndroidUtilities.dp(6), computeVerticalScrollOffset() + computeVerticalScrollExtent(), 0, (animateTextChangeOut ? changeProgress : 1f - changeProgress), emojiColorFilter); canvas.restore(); textPaint.setAlpha(alpha); } @@ -375,6 +415,7 @@ protected void onDraw(Canvas canvas) { canvas.save(); canvas.translate(textX + textOffsetX, (getMeasuredHeight() - textHeight) / 2f + 1); textLayout.draw(canvas); + AnimatedEmojiSpan.drawAnimatedEmojis(canvas, textLayout, textLayoutEmojis, 0, null, computeVerticalScrollOffset() - AndroidUtilities.dp(6), computeVerticalScrollOffset() + computeVerticalScrollExtent(), 0, 1.0f, emojiColorFilter); canvas.restore(); } } @@ -533,6 +574,17 @@ protected void onDraw(Canvas canvas) { } } + private boolean attached; + @Override + protected void onAttachedToWindow() { + attached = true; + super.onAttachedToWindow(); + textLayoutEmojis = AnimatedEmojiSpan.update(currentTab.noanimate ? AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER : AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, this, textLayoutEmojis, textLayout); + titleAnimateInLayoutEmojis = AnimatedEmojiSpan.update(currentTab.noanimate ? AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER : AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, this, titleAnimateInLayoutEmojis, titleAnimateInLayout); + titleAnimateOutLayoutEmojis = AnimatedEmojiSpan.update(currentTab.noanimate ? AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER : AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, this, titleAnimateOutLayoutEmojis, titleAnimateOutLayout); + titleAnimateStableLayoutEmojis = AnimatedEmojiSpan.update(currentTab.noanimate ? AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER : AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, this, titleAnimateStableLayoutEmojis, titleAnimateStableLayout); + } + public boolean animateChange() { boolean changed = false; if (currentTab.counter != lastTabCount) { @@ -591,8 +643,8 @@ public boolean animateChange() { if (lastTitle != null && !currentTab.title.equals(lastTitle)) { boolean animateOut; - String maxStr; - String substring; + CharSequence maxStr; + CharSequence substring; if (lastTitle.length() > currentTab.title.length()) { animateOut = true; maxStr = lastTitle; @@ -602,9 +654,9 @@ public boolean animateChange() { maxStr = currentTab.title; substring = lastTitle; } - int startFrom = maxStr.indexOf(substring); + int startFrom = AndroidUtilities.charSequenceIndexOf(maxStr, substring); if (startFrom >= 0) { - CharSequence text = Emoji.replaceEmoji(maxStr, textPaint.getFontMetricsInt(), AndroidUtilities.dp(15), false); + CharSequence text = Emoji.replaceEmoji(maxStr, textPaint.getFontMetricsInt(), false); SpannableStringBuilder inStr = new SpannableStringBuilder(text); SpannableStringBuilder stabeStr = new SpannableStringBuilder(text); if (startFrom != 0) { @@ -616,17 +668,23 @@ public boolean animateChange() { inStr.setSpan(new EmptyStubSpan(), startFrom, startFrom + substring.length(), 0); titleAnimateInLayout = new StaticLayout(inStr, textPaint, AndroidUtilities.dp(400), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0, false); + if (attached) titleAnimateInLayoutEmojis = AnimatedEmojiSpan.update(currentTab.noanimate ? AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER : AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, this, titleAnimateInLayoutEmojis, titleAnimateInLayout); titleAnimateStableLayout = new StaticLayout(stabeStr, textPaint, AndroidUtilities.dp(400), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0, false); + if (attached) titleAnimateStableLayoutEmojis = AnimatedEmojiSpan.update(currentTab.noanimate ? AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER : AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, this, titleAnimateStableLayoutEmojis, titleAnimateStableLayout); animateTextChange = true; animateTextChangeOut = animateOut; titleXOffset = startFrom == 0 ? 0 : -titleAnimateStableLayout.getPrimaryHorizontal(startFrom); animateFromTitleWidth = lastTitleWidth; titleAnimateOutLayout = null; + AnimatedEmojiSpan.release(this, titleAnimateOutLayoutEmojis); changed = true; } else { titleAnimateInLayout = new StaticLayout(currentTab.title, textPaint, AndroidUtilities.dp(400), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0, false); + if (attached) titleAnimateInLayoutEmojis = AnimatedEmojiSpan.update(currentTab.noanimate ? AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER : AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, this, titleAnimateInLayoutEmojis, titleAnimateInLayout); titleAnimateOutLayout = new StaticLayout(lastTitle, textPaint, AndroidUtilities.dp(400), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0, false); + if (attached) titleAnimateOutLayoutEmojis = AnimatedEmojiSpan.update(currentTab.noanimate ? AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER : AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, this, titleAnimateOutLayoutEmojis, titleAnimateOutLayout); titleAnimateStableLayout = null; + AnimatedEmojiSpan.release(this, titleAnimateStableLayoutEmojis); animateTextChange = true; titleXOffset = 0; animateFromTitleWidth = lastTitleWidth; @@ -702,10 +760,11 @@ public void onAnimationEnd(Animator animation) { } } - private TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); - private TextPaint textCounterPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); - private Paint deletePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); - private Paint counterPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private final TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); + private final TextPaint textCounterPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); + private final Paint deletePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); + private final Paint counterPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private ColorFilter emojiColorFilter = new PorterDuffColorFilter(0, PorterDuff.Mode.SRC_IN); private ArrayList tabs = new ArrayList<>(); @@ -1153,7 +1212,7 @@ public void resetTabId() { selectedTabId = -1; } - public void addTab(int id, int stableId, String text, boolean isDefault, boolean isLocked) { + public void addTab(int id, int stableId, String text, ArrayList entities, boolean noanimate, boolean isDefault, boolean isLocked) { int position = tabs.size(); if (position == 0 && selectedTabId == -1) { selectedTabId = id; @@ -1165,7 +1224,7 @@ public void addTab(int id, int stableId, String text, boolean isDefault, boolean currentPosition = position; } - Tab tab = new Tab(id, text); + Tab tab = new Tab(id, text, entities, noanimate); tab.isDefault = isDefault; tab.isLocked = isLocked; allTabsWidth += tab.getWidth(true) + AndroidUtilities.dp(32); @@ -1353,9 +1412,9 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int width = MeasureSpec.getSize(widthMeasureSpec) - AndroidUtilities.dp(7) - AndroidUtilities.dp(7); Tab firstTab = findDefaultTab(); if (firstTab != null) { - firstTab.setTitle(LocaleController.getString(R.string.FilterAllChats)); + firstTab.setTitle(LocaleController.getString(R.string.FilterAllChats), null, false); int tabWidth = firstTab.getWidth(false); - firstTab.setTitle(allTabsWidth > width ? LocaleController.getString(R.string.FilterAllChatsShort) : LocaleController.getString(R.string.FilterAllChats)); + firstTab.setTitle(allTabsWidth > width ? LocaleController.getString(R.string.FilterAllChatsShort) : LocaleController.getString(R.string.FilterAllChats), null, false); int trueTabsWidth = allTabsWidth - tabWidth; trueTabsWidth += firstTab.getWidth(false); int prevWidth = additionalTabWidth; @@ -1520,7 +1579,7 @@ public void checkTabsCounter() { invalidated = true; requestLayout(); allTabsWidth = 0; - findDefaultTab().setTitle(LocaleController.getString(R.string.FilterAllChats)); + findDefaultTab().setTitle(LocaleController.getString(R.string.FilterAllChats), null, false); for (int b = 0; b < N; b++) { allTabsWidth += tabs.get(b).getWidth(true) + AndroidUtilities.dp(32); } @@ -1551,7 +1610,7 @@ public void notifyTabCounterChanged(int id) { listView.setItemAnimator(itemAnimator); adapter.notifyDataSetChanged(); allTabsWidth = 0; - findDefaultTab().setTitle(LocaleController.getString(R.string.FilterAllChats)); + findDefaultTab().setTitle(LocaleController.getString(R.string.FilterAllChats), null, false); for (int b = 0, N = tabs.size(); b < N; b++) { allTabsWidth += tabs.get(b).getWidth(true) + AndroidUtilities.dp(32); } @@ -1808,7 +1867,9 @@ public void shakeLock(int id) { TabView tabView = (TabView) listView.getChildAt(i); if (tabView.currentTab.id == id) { tabView.shakeLockIcon(1, 0); - tabView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + tabView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignore) {} break; } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/FiltersListBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/FiltersListBottomSheet.java index c89ad4cdb7..f8b51bfa48 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/FiltersListBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/FiltersListBottomSheet.java @@ -28,6 +28,7 @@ import org.telegram.messenger.DialogObject; import org.telegram.messenger.Emoji; import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MessageObject; import org.telegram.messenger.MessagesController; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; @@ -63,6 +64,7 @@ public interface FiltersListBottomSheetDelegate { public FiltersListBottomSheet(DialogsActivity baseFragment, ArrayList selectedDialogs) { super(baseFragment.getParentActivity(), false); + fixNavigationBar(); this.selectedDialogs = selectedDialogs; this.fragment = baseFragment; // dialogFilters = getCanAddDialogFilters(baseFragment, selectedDialogs); @@ -431,7 +433,11 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { } else { icon = R.drawable.msg_folders; } - cell.setTextAndIcon(Emoji.replaceEmoji(filter.name, cell.getTextView().getPaint().getFontMetricsInt(), false), 0, new FolderDrawable(getContext(), icon, filter.color), false); + CharSequence title = filter.name; + title = Emoji.replaceEmoji(title, cell.getTextView().getPaint().getFontMetricsInt(), false); + title = MessageObject.replaceAnimatedEmoji(title, filter.entities, cell.getTextView().getPaint().getFontMetricsInt()); + cell.setTextAndIcon(title, 0, new FolderDrawable(getContext(), icon, filter.color), false); + cell.getTextView().setEmojiColor(Theme.getColor(Theme.key_featuredStickers_addButton, resourcesProvider)); boolean isChecked = true; for (int i = 0; i < selectedDialogs.size(); ++i) { long did = selectedDialogs.get(i); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/FlickerLoadingView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/FlickerLoadingView.java index 5bd8cd6e26..b30550fcba 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/FlickerLoadingView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/FlickerLoadingView.java @@ -56,6 +56,7 @@ public class FlickerLoadingView extends View implements Theme.Colorable { public static final int BROWSER_BOOKMARK = 32; public static final int STAR_SUBSCRIPTION = 33; public static final int STAR_GIFT = 34; + public static final int STAR_GIFT_SELECT = 35; private int gradientWidth; private LinearGradient gradient; @@ -163,7 +164,7 @@ protected void onDraw(Canvas canvas) { paint = globalGradientView.paint; } - if (getViewType() == STAR_GIFT) { + if (getViewType() == STAR_GIFT || getViewType() == STAR_GIFT_SELECT) { parentXOffset = -getX(); } @@ -855,7 +856,7 @@ protected void onDraw(Canvas canvas) { break; } } - } else if (getViewType() == STAR_GIFT) { + } else if (getViewType() == STAR_GIFT || getViewType() == STAR_GIFT_SELECT) { rectF.set(paddingLeft, paddingTop, getMeasuredWidth() - paddingLeft, getMeasuredHeight() - paddingTop); rectF.inset(dp(3.33f), dp(4)); canvas.drawRoundRect(rectF, dp(11), dp(11), paint); @@ -880,7 +881,7 @@ public void updateGradient() { if (width == 0) { width = getMeasuredWidth(); } - if (viewType == STAR_GIFT) { + if (viewType == STAR_GIFT || viewType == STAR_GIFT_SELECT) { width = Math.max(width, AndroidUtilities.displaySize.x); } int height = parentHeight; @@ -917,7 +918,7 @@ public void updateColors() { if (this.color1 != color1 || this.color0 != color0) { this.color0 = color0; this.color1 = color1; - if (viewType == STAR_GIFT) { + if (viewType == STAR_GIFT || viewType == STAR_GIFT_SELECT) { gradientWidth = AndroidUtilities.displaySize.x; } else if (isSingleCell || viewType == MESSAGE_SEEN_TYPE || viewType == CHAT_THEMES_TYPE || viewType == QR_TYPE) { gradientWidth = dp(200); @@ -1005,6 +1006,8 @@ private int getCellHeight(int width) { return dp(56) + 1; case STAR_GIFT: return dp(140); + case STAR_GIFT_SELECT: + return dp(120 - 8); } return 0; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/FloatingDebug/FloatingDebugView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/FloatingDebug/FloatingDebugView.java index 8f093b9f6f..405b51f616 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/FloatingDebug/FloatingDebugView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/FloatingDebug/FloatingDebugView.java @@ -78,7 +78,9 @@ public class FloatingDebugView extends FrameLayout implements NotificationCenter private boolean inLongPress; private Runnable onLongPress = () -> { inLongPress = true; - performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} }; private boolean isBigMenuShown; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/FolderBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/FolderBottomSheet.java index 5318fe2688..dc2650176d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/FolderBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/FolderBottomSheet.java @@ -1,6 +1,11 @@ package org.telegram.ui.Components; import static org.telegram.messenger.AndroidUtilities.dp; +import static org.telegram.messenger.LocaleController.formatPluralSpannable; +import static org.telegram.messenger.LocaleController.formatPluralString; +import static org.telegram.messenger.LocaleController.formatSpannable; +import static org.telegram.messenger.LocaleController.formatString; +import static org.telegram.messenger.LocaleController.getString; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -18,6 +23,7 @@ import android.graphics.drawable.Drawable; import android.graphics.drawable.ShapeDrawable; import android.text.Layout; +import android.text.SpannableStringBuilder; import android.text.StaticLayout; import android.text.TextPaint; import android.util.Pair; @@ -38,7 +44,9 @@ import org.telegram.messenger.BotWebViewVibrationEffect; import org.telegram.messenger.ChatObject; import org.telegram.messenger.DialogObject; +import org.telegram.messenger.Emoji; import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MessageObject; import org.telegram.messenger.MessagesController; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; @@ -46,6 +54,7 @@ import org.telegram.messenger.Utilities; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import org.telegram.tgnet.tl.TL_chatlists; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; @@ -69,8 +78,10 @@ public class FolderBottomSheet extends BottomSheetWithRecyclerListView { private TL_chatlists.TL_chatlists_chatlistUpdates updates; private boolean deleting; - private String title = ""; - private String escapedTitle = ""; + private CharSequence title = ""; + private ArrayList titleEntities = new ArrayList<>(); + private boolean titleNoanimate; + private CharSequence escapedTitle = ""; private ArrayList peers; private ArrayList alreadyJoined = new ArrayList<>(); private ArrayList selectedPeers = new ArrayList<>(); @@ -119,11 +130,12 @@ public static void showForDeletion(final BaseFragment fragment, final int filter return; } FolderBottomSheet sheet; - if (res instanceof TLRPC.Vector) { + if (res instanceof Vector) { + Vector vector = (Vector) res; ArrayList suggestions = new ArrayList<>(); try { - for (int i = 0; i < ((TLRPC.Vector) res).objects.size(); ++i) { - TLRPC.Peer peer = (TLRPC.Peer) ((TLRPC.Vector) res).objects.get(i); + for (int i = 0; i < vector.objects.size(); ++i) { + TLRPC.Peer peer = (TLRPC.Peer) vector.objects.get(i); suggestions.add(DialogObject.getPeerDialogId(peer)); } } catch (Exception ignore) { @@ -139,14 +151,14 @@ public static void showForDeletion(final BaseFragment fragment, final int filter if (filter != null && filter.isMyChatlist()) { AlertDialog alertDialog = new AlertDialog.Builder(fragment.getContext()) - .setTitle(LocaleController.getString(R.string.FilterDelete)) - .setMessage(LocaleController.getString(R.string.FilterDeleteAlertLinks)) - .setNegativeButton(LocaleController.getString(R.string.Cancel), (d, w) -> { + .setTitle(getString(R.string.FilterDelete)) + .setMessage(getString(R.string.FilterDeleteAlertLinks)) + .setNegativeButton(getString(R.string.Cancel), (d, w) -> { if (whenDone != null) { whenDone.run(false); } }) - .setPositiveButton(LocaleController.getString(R.string.Delete), (d, w) -> { + .setPositiveButton(getString(R.string.Delete), (d, w) -> { showDeleteAlert.run(); }) .create(); @@ -184,6 +196,8 @@ public FolderBottomSheet(BaseFragment fragment, int filterId, List select) } if (filter != null) { title = filter.name; + titleEntities = filter.entities; + titleNoanimate = filter.title_noanimate; for (int i = 0; i < selectedPeers.size(); ++i) { long did = selectedPeers.get(i); @@ -240,8 +254,11 @@ public FolderBottomSheet(BaseFragment fragment, String slug, TL_chatlists.chatli selectedPeers.clear(); if (invite instanceof TL_chatlists.TL_chatlists_chatlistInvite) { - title = ((TL_chatlists.TL_chatlists_chatlistInvite) invite).title; - peers = ((TL_chatlists.TL_chatlists_chatlistInvite) invite).peers; + TL_chatlists.TL_chatlists_chatlistInvite chatlistInvite = (TL_chatlists.TL_chatlists_chatlistInvite) invite; + title = chatlistInvite.title.text; + titleEntities = chatlistInvite.title.entities; + titleNoanimate = chatlistInvite.title_noanimate; + peers = chatlistInvite.peers; } else if (invite instanceof TL_chatlists.TL_chatlists_chatlistInviteAlready) { TL_chatlists.TL_chatlists_chatlistInviteAlready inv = (TL_chatlists.TL_chatlists_chatlistInviteAlready) invite; peers = inv.missing_peers; @@ -250,8 +267,11 @@ public FolderBottomSheet(BaseFragment fragment, String slug, TL_chatlists.chatli ArrayList myFilters = fragment.getMessagesController().dialogFilters; if (myFilters != null) { for (int i = 0; i < myFilters.size(); ++i) { - if (myFilters.get(i).id == filterId) { - title = myFilters.get(i).name; + final MessagesController.DialogFilter filter = myFilters.get(i); + if (filter.id == filterId) { + title = filter.name; + titleEntities = filter.entities; + titleNoanimate = filter.title_noanimate; break; } } @@ -262,7 +282,8 @@ public FolderBottomSheet(BaseFragment fragment, String slug, TL_chatlists.chatli } private void init() { - escapedTitle = title.replace('*', '✱'); +// escapedTitle = title.replace('*', '✱'); + escapedTitle = AndroidUtilities.replaceCharSequence("*", title, "✱"); if (peers != null) { for (int i = 0; i < peers.size(); ++i) { @@ -421,7 +442,10 @@ private void onJoinButtonClicked() { button.setLoading(true); reqId = getBaseFragment().getConnectionsManager().sendRequest(reqObject, (res, err) -> AndroidUtilities.runOnUIThread(() -> { reqId = -1; - BulletinFactory.of(fragment).createSimpleBulletin(R.raw.ic_delete, LocaleController.formatString("FolderLinkDeletedTitle", R.string.FolderLinkDeletedTitle, title), LocaleController.formatPluralString("FolderLinkDeletedSubtitle", inputPeers.size())).setDuration(Bulletin.DURATION_PROLONG).show(); + BulletinFactory.of(fragment) + .createSimpleBulletin(R.raw.ic_delete, formatString(R.string.FolderLinkDeletedTitle, title), formatPluralString("FolderLinkDeletedSubtitle", inputPeers.size())) + .setDuration(Bulletin.DURATION_PROLONG) + .show(); success = true; dismiss(); getBaseFragment().getMessagesController().invalidateChatlistFolderUpdate(filterId); @@ -452,19 +476,19 @@ private void onJoinButtonClicked() { BulletinFactory.of(fragment) .createSimpleBulletin( R.raw.folder_in, - AndroidUtilities.replaceTags(LocaleController.formatString("FolderLinkUpdatedTitle", R.string.FolderLinkUpdatedTitle, escapedTitle)), + AndroidUtilities.replaceTags(LocaleController.formatString(R.string.FolderLinkUpdatedTitle, escapedTitle)), inputPeers.size() <= 0 ? - LocaleController.formatPluralString("FolderLinkUpdatedSubtitle", alreadyJoined.size()) : - LocaleController.formatPluralString("FolderLinkUpdatedJoinedSubtitle", inputPeers.size()) + formatPluralString("FolderLinkUpdatedSubtitle", alreadyJoined.size()) : + formatPluralString("FolderLinkUpdatedJoinedSubtitle", inputPeers.size()) ) .setDuration(Bulletin.DURATION_PROLONG) .show(); } else { BulletinFactory.of(fragment) .createSimpleBulletin( - R.raw.contact_check, - AndroidUtilities.replaceTags(LocaleController.formatString("FolderLinkAddedTitle", R.string.FolderLinkAddedTitle, escapedTitle)), - LocaleController.formatPluralString("FolderLinkAddedSubtitle", inputPeers.size()) + R.raw.contact_check, + AndroidUtilities.replaceTags(LocaleController.formatString(R.string.FolderLinkAddedTitle, escapedTitle)), + formatPluralString("FolderLinkAddedSubtitle", inputPeers.size()) ) .setDuration(Bulletin.DURATION_PROLONG) .show(); @@ -610,9 +634,9 @@ public void onViewCreated(FrameLayout containerView) { } else { TLRPC.Chat chat = getBaseFragment().getMessagesController().getChat(-did); if (ChatObject.isChannelAndNotMegaGroup(chat)) { - text = LocaleController.getString(R.string.FolderLinkAlreadySubscribed); + text = getString(R.string.FolderLinkAlreadySubscribed); } else { - text = LocaleController.getString(R.string.FolderLinkAlreadyJoined); + text = getString(R.string.FolderLinkAlreadyJoined); } array.add(chat); } @@ -641,13 +665,17 @@ public void updateCount(boolean animated) { int count = selectedPeers.size(); if (button != null) { if (deleting) { - button.setText(count > 0 ? LocaleController.getString(R.string.FolderLinkButtonRemoveChats) : LocaleController.getString(R.string.FolderLinkButtonRemove), animated); + button.setText(count > 0 ? getString(R.string.FolderLinkButtonRemoveChats) : getString(R.string.FolderLinkButtonRemove), animated); } else if (peers == null || peers.isEmpty()) { - button.setText(LocaleController.getString(R.string.OK), animated); + button.setText(getString(R.string.OK), animated); } else if (invite instanceof TL_chatlists.TL_chatlists_chatlistInvite) { - button.setText(LocaleController.formatString("FolderLinkButtonAdd", R.string.FolderLinkButtonAdd, title), animated); + CharSequence title = this.title; + title = Emoji.replaceEmoji(title, button.getTextPaint().getFontMetricsInt(), false); + title = MessageObject.replaceAnimatedEmoji(title, titleEntities, button.getTextPaint().getFontMetricsInt()); + button.setText(formatSpannable(R.string.FolderLinkButtonAdd, title), animated); + button.setEmojiCacheType(titleNoanimate ? AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER : AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES); } else { - button.setText(count > 0 ? LocaleController.formatPluralString("FolderLinkButtonJoinPlural", count) : LocaleController.getString(R.string.FolderLinkButtonNone), animated); + button.setText(count > 0 ? formatPluralString("FolderLinkButtonJoinPlural", count) : getString(R.string.FolderLinkButtonNone), animated); } button.setCount(count, animated); if (invite instanceof TL_chatlists.TL_chatlists_chatlistInvite) { @@ -701,7 +729,15 @@ public Button(Context context, String string) { setWillNotDraw(false); } - public void setText(String newText, boolean animated) { + public TextPaint getTextPaint() { + return text.getPaint(); + } + + public void setEmojiCacheType(int cacheType) { + text.setEmojiCacheType(cacheType); + } + + public void setText(CharSequence newText, boolean animated) { if (animated) { text.cancelAnimation(); } @@ -898,20 +934,20 @@ protected void onDraw(Canvas canvas) { public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); info.setClassName("android.widget.Button"); - info.setContentDescription(text.getText() + (lastCount > 0 ? ", " + LocaleController.formatPluralString("Chats", lastCount) : "")); + info.setContentDescription(text.getText() + (lastCount > 0 ? ", " + formatPluralString("Chats", lastCount) : "")); } } @Override protected CharSequence getTitle() { if (deleting) { - return LocaleController.getString(R.string.FolderLinkTitleRemove); + return getString(R.string.FolderLinkTitleRemove); } else if (invite instanceof TL_chatlists.TL_chatlists_chatlistInvite) { - return LocaleController.getString(R.string.FolderLinkTitleAdd); + return getString(R.string.FolderLinkTitleAdd); } else if (peers == null || peers.isEmpty()) { - return LocaleController.getString(R.string.FolderLinkTitleAlready); + return getString(R.string.FolderLinkTitleAlready); } else { - return LocaleController.getString(R.string.FolderLinkTitleAddChats); + return getString(R.string.FolderLinkTitleAddChats); } } @@ -935,7 +971,7 @@ public boolean isEnabled(RecyclerView.ViewHolder holder) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = null; if (viewType == VIEW_TYPE_TITLE) { - view = titleCell = new TitleCell(getContext(), invite instanceof TL_chatlists.TL_chatlists_chatlistInviteAlready || updates != null, escapedTitle); + view = titleCell = new TitleCell(getContext(), invite instanceof TL_chatlists.TL_chatlists_chatlistInviteAlready || updates != null, escapedTitle, titleEntities, titleNoanimate); } else if (viewType == VIEW_TYPE_HINT) { view = new TextInfoPrivacyCell(getContext()); view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray)); @@ -972,9 +1008,9 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi object = user; name = UserObject.getUserName(user); if (user != null && user.bot) { - status = LocaleController.getString(R.string.FilterInviteBot); + status = getString(R.string.FilterInviteBot); } else { - status = LocaleController.getString(R.string.FilterInviteUser); + status = getString(R.string.FilterInviteUser); } } else if (peer instanceof TLRPC.TL_peerChat) { did = -peer.chat_id; @@ -995,9 +1031,9 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi } } else { if (ChatObject.isChannelAndNotMegaGroup(chat)) { - status = LocaleController.getString(R.string.ChannelPublic); + status = getString(R.string.ChannelPublic); } else { - status = LocaleController.getString(R.string.MegaPublic); + status = getString(R.string.MegaPublic); } } } @@ -1008,7 +1044,7 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi } else if (viewType == VIEW_TYPE_HEADER) { HeaderCell headerCell = (HeaderCell) holder.itemView; if (position == alreadyHeaderRow) { - headerCell.setText(LocaleController.getString(R.string.FolderLinkHeaderAlready), false); + headerCell.setText(getString(R.string.FolderLinkHeaderAlready), false); headerCell.setAction("", null); } else { FolderBottomSheet.this.headerCell = headerCell; @@ -1023,9 +1059,9 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi } else { hintCell.setFixedSize(0); if (deleting) { - hintCell.setText(LocaleController.getString(R.string.FolderLinkHintRemove)); + hintCell.setText(getString(R.string.FolderLinkHintRemove)); } else { - hintCell.setText(LocaleController.getString(R.string.FolderLinkHint)); + hintCell.setText(getString(R.string.FolderLinkHint)); } } } else if (viewType == VIEW_TYPE_TITLE) { @@ -1053,14 +1089,6 @@ public int getItemCount() { }; } - private String getFilterName(MessagesController.DialogFilter filter) { - if (filter == null) - return null; - if (filter.isDefault()) - return LocaleController.getString(R.string.FilterAllChats); - return filter.name; - } - public static class HeaderCell extends FrameLayout { public AnimatedTextView textView; public AnimatedTextView actionTextView; @@ -1116,57 +1144,36 @@ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { private class TitleCell extends FrameLayout { private boolean already; - private String title; + private CharSequence title; private FoldersPreview preview; - private TextView titleTextView, subtitleTextView; + private AnimatedEmojiSpan.TextViewEmojis titleTextView, subtitleTextView; - public TitleCell(Context context, boolean already, String title) { + public TitleCell(Context context, boolean already, CharSequence title, ArrayList titleEntities, boolean titleNoanimate) { super(context); this.already = already; - this.title = title; String left2Folder = null, - left1Folder = LocaleController.getString("FolderLinkPreviewLeft"), - right1Folder = LocaleController.getString("FolderLinkPreviewRight"), + left1Folder = getString(R.string.FolderLinkPreviewLeft), + right1Folder = getString(R.string.FolderLinkPreviewRight), right2Folder = null; -// try { -// ArrayList filters = MessagesController.getInstance(UserConfig.selectedAccount).dialogFilters; -// if (filterId >= 0) { -// for (int i = 0; i < filters.size(); ++i) { -// if (filters.get(i).id == filterId) { -// if (i - 2 >= 0) { -// left2Folder = getFilterName(filters.get(i - 2)); -// } -// if (i - 1 >= 0) { -// left1Folder = getFilterName(filters.get(i - 1)); -// } -// if (i + 1 < filters.size()) { -// right1Folder = getFilterName(filters.get(i + 1)); -// } -// if (i + 2 < filters.size()) { -// right2Folder = getFilterName(filters.get(i + 2)); -// } -// break; -// } -// } -// } else if (filters.size() > 1) { -// left2Folder = getFilterName(filters.get(filters.size() - 2)); -// left1Folder = getFilterName(filters.get(filters.size() - 1)); -// } -// } catch (Exception ignore) {} - preview = new FoldersPreview(context, left2Folder, left1Folder, title, right1Folder, right2Folder); + preview = new FoldersPreview(context, left2Folder, left1Folder, title == null ? "" : new SpannableStringBuilder(title), titleEntities, titleNoanimate, right1Folder, right2Folder); addView(preview, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 44, Gravity.TOP | Gravity.FILL_HORIZONTAL, 0, 17.33f, 0, 0)); - titleTextView = new TextView(context); + titleTextView = new AnimatedEmojiSpan.TextViewEmojis(context); titleTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); titleTextView.setTypeface(AndroidUtilities.bold()); - titleTextView.setText(getTitle()); titleTextView.setGravity(Gravity.CENTER); + titleTextView.setLineSpacing(dp(-1), 1.0f); + this.title = Emoji.replaceEmoji(new SpannableStringBuilder(title), titleTextView.getPaint().getFontMetricsInt(), false, 0.8f); + this.title = MessageObject.replaceAnimatedEmoji(this.title, titleEntities, titleTextView.getPaint().getFontMetricsInt(), false, 0.8f); + titleTextView.setText(getTitle()); + titleTextView.setCacheType(titleNoanimate ? AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER : AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES); + titleTextView.setEmojiColor(Theme.getColor(Theme.key_featuredStickers_addButton, resourcesProvider)); addView(titleTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP, 32, 78.3f, 32, 0)); - subtitleTextView = new TextView(context); + subtitleTextView = new AnimatedEmojiSpan.TextViewEmojis(context); subtitleTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); subtitleTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); subtitleTextView.setLines(2); @@ -1179,19 +1186,19 @@ public TitleCell(Context context, boolean already, String title) { public void setSelectedCount(int count, boolean animated) { if (deleting) { - subtitleTextView.setText(AndroidUtilities.replaceTags(LocaleController.formatString("FolderLinkSubtitleRemove", R.string.FolderLinkSubtitleRemove, title))); + subtitleTextView.setText(AndroidUtilities.replaceTags(formatSpannable(R.string.FolderLinkSubtitleRemove, title))); } else if (already) { preview.setCount(peers != null ? peers.size() : 0, false); if (peers == null || peers.isEmpty()) { - subtitleTextView.setText(AndroidUtilities.replaceTags(LocaleController.formatString("FolderLinkSubtitleAlready", R.string.FolderLinkSubtitleAlready, title))); + subtitleTextView.setText(AndroidUtilities.replaceTags(formatSpannable(R.string.FolderLinkSubtitleAlready, title))); } else { - subtitleTextView.setText(AndroidUtilities.replaceTags(LocaleController.formatPluralString("FolderLinkSubtitleChats", peers != null ? peers.size() : 0, title))); + subtitleTextView.setText(AndroidUtilities.replaceTags(formatPluralSpannable("FolderLinkSubtitleChats", peers != null ? peers.size() : 0, title))); } } else { if (peers == null || peers.isEmpty()) { - subtitleTextView.setText(AndroidUtilities.replaceTags(LocaleController.formatString("FolderLinkSubtitleAlready", R.string.FolderLinkSubtitleAlready, title))); + subtitleTextView.setText(AndroidUtilities.replaceTags(formatSpannable(R.string.FolderLinkSubtitleAlready, title))); } else { - subtitleTextView.setText(AndroidUtilities.replaceTags(LocaleController.formatString("FolderLinkSubtitle", R.string.FolderLinkSubtitle, title))); + subtitleTextView.setText(AndroidUtilities.replaceTags(formatSpannable(R.string.FolderLinkSubtitle, title))); } } } @@ -1212,16 +1219,11 @@ private class FoldersPreview extends View { Path path = new Path(); float[] radii = new float[8]; - StaticLayout leftFolder2; - float leftFolder2Width; - StaticLayout leftFolder; - float leftFolderWidth; - StaticLayout middleFolder; - float middleFolderWidth; - StaticLayout rightFolder; - float rightFolderWidth; - StaticLayout rightFolder2; - float rightFolder2Width; + Text leftFolder2; + Text leftFolder; + Text middleFolder; + Text rightFolder; + Text rightFolder2; LinearGradient leftGradient, rightGradient; Paint leftPaint = new Paint(Paint.ANTI_ALIAS_FLAG), rightPaint = new Paint(Paint.ANTI_ALIAS_FLAG); @@ -1234,6 +1236,8 @@ public FoldersPreview( CharSequence left2FolderText, CharSequence left1FolderText, CharSequence middleFolderText, + ArrayList middleFolderEntities, + boolean middleFolderNoanimate, CharSequence right1FolderText, CharSequence right2FolderText ) { @@ -1257,23 +1261,35 @@ public FoldersPreview( countText.setTypeface(AndroidUtilities.bold()); countText.setGravity(Gravity.CENTER_HORIZONTAL); + final int textColor = Theme.multAlpha(Theme.getColor(Theme.key_profile_tabText), .8f); + final int selectedTextColor = Theme.getColor(Theme.key_windowBackgroundWhiteBlueText2); if (left2FolderText != null) { - leftFolder2 = makeLayout(left2FolderText, false); - leftFolder2Width = leftFolder2.getLineWidth(0); + leftFolder2 = new Text(normalizeTitle(left2FolderText), 15.33f, AndroidUtilities.bold()) + .supportAnimatedEmojis(this) + .setColor(textColor); } if (left1FolderText != null) { - leftFolder = makeLayout(left1FolderText, false); - leftFolderWidth = leftFolder.getLineWidth(0); + leftFolder = new Text(normalizeTitle(left1FolderText), 15.33f, AndroidUtilities.bold()) + .supportAnimatedEmojis(this) + .setColor(textColor); } - middleFolder = makeLayout(middleFolderText, true); - middleFolderWidth = middleFolder.getLineWidth(0); + middleFolderText = normalizeTitle(middleFolderText); + middleFolder = new Text(middleFolderText, 15.33f, AndroidUtilities.bold()) + .supportAnimatedEmojis(this) + .setColor(selectedTextColor); + middleFolderText = Emoji.replaceEmoji(middleFolderText, middleFolder.getFontMetricsInt(), false); + middleFolderText = MessageObject.replaceAnimatedEmoji(middleFolderText, middleFolderEntities, middleFolder.getFontMetricsInt()); + middleFolder.setText(middleFolderText); + middleFolder.setEmojiCacheType(middleFolderNoanimate ? AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER : AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES); if (right1FolderText != null) { - rightFolder = makeLayout(right1FolderText, false); - rightFolderWidth = rightFolder.getLineWidth(0); + rightFolder = new Text(normalizeTitle(right1FolderText), 15.33f, AndroidUtilities.bold()) + .supportAnimatedEmojis(this) + .setColor(textColor); } if (right2FolderText != null) { - rightFolder2 = makeLayout(right2FolderText, false); - rightFolder2Width = rightFolder2.getLineWidth(0); + rightFolder2 = new Text(normalizeTitle(right2FolderText), 15.33f, AndroidUtilities.bold()) + .supportAnimatedEmojis(this) + .setColor(textColor); } radii[0] = radii[1] = radii[2] = radii[3] = dp(3); @@ -1287,11 +1303,11 @@ public FoldersPreview( rightPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT)); } - private StaticLayout makeLayout(CharSequence text, boolean selected) { + private CharSequence normalizeTitle(CharSequence text) { if (text == null || "ALL_CHATS".equals(text.toString())) { - text = LocaleController.getString(R.string.FilterAllChats); + text = getString(R.string.FilterAllChats); } - return new StaticLayout(text, selected ? selectedTextPaint : paint, AndroidUtilities.displaySize.x, Layout.Alignment.ALIGN_NORMAL, 1f, 0, false); + return text; } @Override @@ -1303,18 +1319,23 @@ protected void onDraw(Canvas canvas) { float cx = getMeasuredWidth() / 2f; float cy = getMeasuredHeight() / 2f; - canvas.save(); - float width = middleFolderWidth + (isCountEmpty() ? 0 : dp(4.66f + 5.33f + 5.33f) + countText.getCurrentWidth()); - float cleft = cx - width / 2f; - canvas.translate(cleft, cy - middleFolder.getHeight() / 2f); - middleFolder.draw(canvas); - canvas.restore(); + float width, cleft; + if (middleFolder != null) { + canvas.save(); + width = middleFolder.getCurrentWidth() + (isCountEmpty() ? 0 : dp(4.66f + 5.33f + 5.33f) + countText.getCurrentWidth()); + cleft = cx - width / 2f; + canvas.translate(cleft, cy - middleFolder.getHeight() / 2f); + middleFolder.draw(canvas); + canvas.restore(); + } else { + width = 0; cleft = cx; + } if (!isCountEmpty()) { AndroidUtilities.rectTmp2.set( - (int) (cleft + middleFolderWidth + dp(4.66f)), + (int) (cleft + middleFolder.getCurrentWidth() + dp(4.66f)), (int) (cy - dp(9)), - (int) (cleft + middleFolderWidth + dp(4.66f + 5.33f + 5.33f) + countText.getCurrentWidth()), + (int) (cleft + middleFolder.getCurrentWidth() + dp(4.66f + 5.33f + 5.33f) + countText.getCurrentWidth()), (int) (cy + dp(9)) ); AndroidUtilities.rectTmp.set(AndroidUtilities.rectTmp2); @@ -1327,11 +1348,11 @@ protected void onDraw(Canvas canvas) { final float gap = dp(30); - float x = cleft - gap - leftFolderWidth; + float x = cleft - gap - leftFolder.getCurrentWidth(); float minx = x; - if (leftFolder2 != null && leftFolderWidth < dp(64)) { - minx -= gap + leftFolder2Width; + if (leftFolder2 != null && leftFolder.getCurrentWidth() < dp(64)) { + minx -= gap + leftFolder2.getCurrentWidth(); canvas.save(); canvas.translate(minx, cy - leftFolder2.getHeight() / 2f + dp(1)); leftFolder2.draw(canvas); @@ -1351,15 +1372,15 @@ protected void onDraw(Canvas canvas) { canvas.translate(x + gap, cy - rightFolder.getHeight() / 2f + dp(1)); rightFolder.draw(canvas); canvas.restore(); - x += gap + rightFolderWidth; + x += gap + rightFolder.getCurrentWidth(); } - if (rightFolder2 != null && rightFolderWidth < dp(64)) { + if (rightFolder2 != null && rightFolder.getCurrentWidth() < dp(64)) { canvas.save(); canvas.translate(x + gap, cy - rightFolder2.getHeight() / 2f + dp(1)); rightFolder2.draw(canvas); canvas.restore(); - x += gap + rightFolder2Width; + x += gap + rightFolder2.getCurrentWidth(); } float y = cy + middleFolder.getHeight() / 2f + dp(12); @@ -1413,14 +1434,14 @@ private void updateHeaderCell(boolean animated) { } if (deleting) { - headerCell.setText(LocaleController.formatPluralString("FolderLinkHeaderChatsQuit", peers.size()), false); + headerCell.setText(formatPluralString("FolderLinkHeaderChatsQuit", peers.size()), false); } else { - headerCell.setText(LocaleController.formatPluralString("FolderLinkHeaderChatsJoin", peers.size()), false); + headerCell.setText(formatPluralString("FolderLinkHeaderChatsJoin", peers.size()), false); } if (peers != null && (peers.size() - alreadyJoined.size()) > 1) { final boolean deselect = selectedPeers.size() >= peers.size() - alreadyJoined.size(); headerCell.setAction( - deselect ? LocaleController.getString(R.string.DeselectAll) : LocaleController.getString(R.string.SelectAll), () -> deselectAll(headerCell, deselect) + deselect ? getString(R.string.DeselectAll) : getString(R.string.SelectAll), () -> deselectAll(headerCell, deselect) ); } else { headerCell.setAction("", null); @@ -1429,7 +1450,7 @@ private void updateHeaderCell(boolean animated) { private void announceSelection(boolean buttonSelect) { AndroidUtilities.makeAccessibilityAnnouncement( - LocaleController.formatPluralString("FilterInviteHeaderChats", selectedPeers.size()) + (buttonSelect && headerCell != null ? ", " + headerCell.actionTextView.getText() : "") + formatPluralString("FilterInviteHeaderChats", selectedPeers.size()) + (buttonSelect && headerCell != null ? ", " + headerCell.actionTextView.getText() : "") ); } @@ -1445,7 +1466,7 @@ private void deselectAll(HeaderCell headerCell, boolean deselect) { } } updateCount(true); - headerCell.setAction(deselect ? LocaleController.getString(R.string.SelectAll) : LocaleController.getString(R.string.DeselectAll), () -> deselectAll(headerCell, !deselect)); + headerCell.setAction(deselect ? getString(R.string.SelectAll) : getString(R.string.DeselectAll), () -> deselectAll(headerCell, !deselect)); announceSelection(true); for (int i = 0; i < recyclerListView.getChildCount(); ++i) { View child = recyclerListView.getChildAt(i); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/FragmentContextView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/FragmentContextView.java index 9dec38bae3..5b094e8359 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/FragmentContextView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/FragmentContextView.java @@ -32,10 +32,8 @@ import android.os.Build; import android.os.Bundle; import android.os.SystemClock; -import android.text.Layout; import android.text.SpannableStringBuilder; import android.text.Spanned; -import android.text.StaticLayout; import android.text.TextPaint; import android.text.TextUtils; import android.util.TypedValue; @@ -73,6 +71,7 @@ import org.telegram.messenger.voip.VoIPService; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_phone; import org.telegram.ui.ActionBar.ActionBarMenuItem; import org.telegram.ui.ActionBar.ActionBarMenuSlider; import org.telegram.ui.ActionBar.AlertDialog; @@ -575,7 +574,9 @@ private void updateJoinButtonWidth(int width) { isMuted = false; AndroidUtilities.runOnUIThread(toggleMicRunnable, 90); - muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignore) {} }; @@ -610,7 +611,9 @@ public boolean onTouchEvent(MotionEvent event) { muteButton.playAnimation(); if (VoIPService.getSharedInstance() != null) { VoIPService.getSharedInstance().setMicMute(true, true, false); - muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignore) {} } pressed = false; Theme.getFragmentContextViewWavesDrawable().updateState(true); @@ -667,7 +670,9 @@ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { } muteButton.playAnimation(); Theme.getFragmentContextViewWavesDrawable().updateState(true); - muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignore) {} }); closeButton = new ImageView(context); @@ -2500,7 +2505,7 @@ public void toggleScheduledNotify() { fragment.getConnectionsManager().cancelRequest(toggleGroupCallStartSubscriptionReqId, true); toggleGroupCallStartSubscriptionReqId = 0; } - TLRPC.TL_phone_toggleGroupCallStartSubscription req = new TLRPC.TL_phone_toggleGroupCallStartSubscription(); + TL_phone.toggleGroupCallStartSubscription req = new TL_phone.toggleGroupCallStartSubscription(); req.call = call.getInputGroupCall(); call.call.schedule_start_subscribed = willBeNotified = !willBeNotified; req.subscribed = willBeNotified; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/GroupCallPip.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/GroupCallPip.java index c52603c5b0..4df448bcf7 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/GroupCallPip.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/GroupCallPip.java @@ -130,7 +130,9 @@ public void run() { return; } AndroidUtilities.runOnUIThread(micRunnable, 90); - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignore) {} pressed = true; } } @@ -254,7 +256,9 @@ public boolean onTouchEvent(MotionEvent event) { if (pressed) { if (VoIPService.getSharedInstance() != null) { VoIPService.getSharedInstance().setMicMute(true, false, false); - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} } pressed = false; } else if (event.getAction() == MotionEvent.ACTION_UP && !moving) { @@ -889,7 +893,9 @@ void prepareToRemove(boolean prepare) { iconView.playAnimation(); } if (prepare) { - button.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + button.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} } } button.prepareToRemove(prepare); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/GroupCreateSpan.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/GroupCreateSpan.java index 4076fe3d8b..5ee881055b 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/GroupCreateSpan.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/GroupCreateSpan.java @@ -234,7 +234,7 @@ public GroupCreateSpan(Context context, Object object, ContactsController.Contac firstName = firstName.replace('\n', ' '); CharSequence name = firstName; - name = Emoji.replaceEmoji(name, textPaint.getFontMetricsInt(), AndroidUtilities.dp(12), false); + name = Emoji.replaceEmoji(name, textPaint.getFontMetricsInt(), false); name = TextUtils.ellipsize(name, textPaint, maxNameWidth, TextUtils.TruncateAt.END); nameLayout = new StaticLayout(name, textPaint, 1000, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); if (nameLayout.getLineCount() > 0) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ImageUpdater.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ImageUpdater.java index e82267cace..911327ea21 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ImageUpdater.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ImageUpdater.java @@ -83,6 +83,7 @@ public class ImageUpdater implements NotificationCenter.NotificationCenterDelega public String currentPicturePath; private TLRPC.PhotoSize bigPhoto; private TLRPC.PhotoSize smallPhoto; + private Bitmap smallPhotoBitmap; private boolean isVideo; private String uploadingImage; private String uploadingVideo; @@ -144,7 +145,7 @@ public void processEntry(MediaController.PhotoEntry photoEntry) { } else { bitmap = ImageLoader.loadBitmap(path, null, 800, 800, true); } - processBitmap(bitmap, avatarObject); + processBitmap(false, bitmap, avatarObject); } public void cancel() { @@ -172,6 +173,14 @@ public void showAvatarConstructor(TLRPC.VideoSize emojiMarkup) { public interface ImageUpdaterDelegate { void didUploadPhoto(TLRPC.InputFile photo, TLRPC.InputFile video, double videoStartTimestamp, String videoPath, TLRPC.PhotoSize bigSize, TLRPC.PhotoSize smallSize, boolean isVideo, TLRPC.VideoSize emojiMarkup); + default PhotoViewer.PlaceProviderObject getCloseIntoObject() { + return null; + } + + default boolean supportsBulletin() { + return false; + } + default String getInitialSearchString() { return null; } @@ -180,7 +189,7 @@ default void onUploadProgressChanged(float progress) { } - default void didStartUpload(boolean isVideo) { + default void didStartUpload(boolean fromAvatarConstructor, boolean isVideo) { } @@ -197,6 +206,16 @@ public boolean isUploadingImage() { return uploadingImage != null || uploadingVideo != null || convertingVideo != null; } + public String getUploadingFilePath() { + if (uploadingImage != null) { + return uploadingImage; + } + if (uploadingVideo != null) { + return uploadingVideo; + } + return null; + } + public void clear() { canceled = false; if (uploadingImage != null || uploadingVideo != null || convertingVideo != null) { @@ -337,6 +356,12 @@ public void onPause() { } } + public void updateColors() { + if (chatAttachAlert != null) { + chatAttachAlert.checkColors(); + } + } + public boolean dismissDialogOnPause(Dialog dialog) { return dialog != chatAttachAlert; } @@ -398,7 +423,7 @@ public void actionButtonPressed(boolean canceled, boolean notify, int scheduleDa info.ttl = searchImage.ttl; } } - didSelectPhotos(media); + didSelectPhotos(false, media); } @Override @@ -446,7 +471,7 @@ private void createChatAttachView() { } if (chatAttachAlert == null) { chatAttachAlert = new ChatAttachAlert(parentFragment.getParentActivity(), parentFragment, forceDarkTheme, showingFromDialog); - chatAttachAlert.setAvatarPicker(canSelectVideo ? 2 : 1, searchAvailable); + chatAttachAlert.setAvatarPicker(canSelectVideo ? 2 : 1, searchAvailable, delegate != null && delegate.supportsBulletin() ? delegate::getCloseIntoObject : null); chatAttachAlert.setDelegate(new ChatAttachAlert.ChatAttachViewDelegate() { @Override @@ -454,6 +479,7 @@ public void didPressedButton(int button, boolean arg, boolean notify, int schedu if (parentFragment == null || parentFragment.getParentActivity() == null || chatAttachAlert == null) { return; } + boolean fromAvatarConstructor = false; if (button == 8 || button == 7) { HashMap photos = chatAttachAlert.getPhotoLayout().getSelectedPhotos(); ArrayList order = chatAttachAlert.getPhotoLayout().getSelectedPhotosOrder(); @@ -478,6 +504,7 @@ public void didPressedButton(int button, boolean arg, boolean notify, int schedu info.masks = photoEntry.stickers; info.ttl = photoEntry.ttl; info.emojiMarkup = photoEntry.emojiMarkup; + fromAvatarConstructor = info.emojiMarkup instanceof TLRPC.TL_videoSizeEmojiMarkup; } else if (object instanceof MediaController.SearchImage) { MediaController.SearchImage searchImage = (MediaController.SearchImage) object; if (searchImage.imagePath != null) { @@ -499,7 +526,7 @@ public void didPressedButton(int button, boolean arg, boolean notify, int schedu searchImage.date = (int) (System.currentTimeMillis() / 1000); } } - didSelectPhotos(media); + didSelectPhotos(fromAvatarConstructor, media); if (button != 8) { chatAttachAlert.dismiss(true); @@ -556,7 +583,7 @@ public void openAvatarsSearch() { } } - private void didSelectPhotos(ArrayList photos) { + private void didSelectPhotos(boolean fromAvatarConstructor, ArrayList photos) { if (!photos.isEmpty()) { SendMessagesHelper.SendingMediaInfo info = photos.get(0); Bitmap bitmap = null; @@ -610,7 +637,7 @@ private void didSelectPhotos(ArrayList phot } } } - processBitmap(bitmap, avatarObject); + processBitmap(fromAvatarConstructor, bitmap, avatarObject); } } @@ -704,7 +731,7 @@ public void openGallery() { fragment.setDelegate(new PhotoAlbumPickerActivity.PhotoAlbumPickerActivityDelegate() { @Override public void didSelectPhotos(ArrayList photos, boolean notify, int scheduleDate) { - ImageUpdater.this.didSelectPhotos(photos); + ImageUpdater.this.didSelectPhotos(false, photos); } @Override @@ -740,7 +767,7 @@ private void startCrop(String path, Uri uri) { } catch (Exception e) { FileLog.e(e); Bitmap bitmap = ImageLoader.loadBitmap(path, uri, 800, 800, true); - processBitmap(bitmap, null); + processBitmap(false, bitmap, null); } }); } @@ -763,6 +790,11 @@ public void sendButtonPressed(int index, VideoEditedInfo videoEditedInfo, boolea processEntry(photoEntry); } + @Override + public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview, boolean closing) { + return delegate == null ? null : delegate.getCloseIntoObject(); + } + @Override public boolean allowCaption() { return false; @@ -773,6 +805,7 @@ public boolean canScrollAway() { return false; } }, null); + PhotoViewer.getInstance().closePhotoAfterSelectWithAnimation = true; } public void onActivityResult(int requestCode, int resultCode, Intent data) { @@ -803,7 +836,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { } } - private void processBitmap(Bitmap bitmap, MessageObject avatarObject) { + private void processBitmap(boolean fromAvatarConstructor, Bitmap bitmap, MessageObject avatarObject) { if (bitmap == null) { return; } @@ -816,7 +849,7 @@ private void processBitmap(Bitmap bitmap, MessageObject avatarObject) { smallPhoto = ImageLoader.scaleAndSaveImage(bitmap, 150, 150, 80, false, 150, 150); if (smallPhoto != null) { try { - Bitmap b = BitmapFactory.decodeFile(FileLoader.getInstance(currentAccount).getPathToAttach(smallPhoto, true).getAbsolutePath()); + Bitmap b = smallPhotoBitmap = BitmapFactory.decodeFile(FileLoader.getInstance(currentAccount).getPathToAttach(smallPhoto, true).getAbsolutePath()); String key = smallPhoto.location.volume_id + "_" + smallPhoto.location.local_id + "@50_50"; ImageLoader.getInstance().putImageToCache(new BitmapDrawable(b), key, true); } catch (Throwable ignore) { @@ -831,7 +864,7 @@ private void processBitmap(Bitmap bitmap, MessageObject avatarObject) { if (avatarObject != null && avatarObject.videoEditedInfo != null) { if (supportEmojiMarkup && !MessagesController.getInstance(currentAccount).uploadMarkupVideo) { if (delegate != null) { - delegate.didStartUpload(true); + delegate.didStartUpload(fromAvatarConstructor, true); } if (delegate != null) { //skip upload step @@ -851,12 +884,12 @@ private void processBitmap(Bitmap bitmap, MessageObject avatarObject) { MediaController.getInstance().scheduleVideoConvert(avatarObject, true, true, false); uploadingImage = null; if (delegate != null) { - delegate.didStartUpload(true); + delegate.didStartUpload(fromAvatarConstructor, true); } isVideo = true; } else { if (delegate != null) { - delegate.didStartUpload(false); + delegate.didStartUpload(fromAvatarConstructor, false); } isVideo = false; } @@ -873,9 +906,13 @@ private void processBitmap(Bitmap bitmap, MessageObject avatarObject) { } } + public Bitmap getPreviewBitmap() { + return smallPhotoBitmap; + } + @Override public void didFinishEdit(Bitmap bitmap) { - processBitmap(bitmap, null); + processBitmap(false, bitmap, null); } private void cleanup() { @@ -942,7 +979,7 @@ public void didReceivedNotification(int id, int account, Object... args) { uploadingImage = null; if (id == NotificationCenter.fileLoaded || id == NotificationCenter.httpFileDidLoad) { Bitmap bitmap = ImageLoader.loadBitmap(finalPath, null, 800, 800, true); - processBitmap(bitmap, null); + processBitmap(false, bitmap, null); } else { imageReceiver.setImageBitmap((Drawable) null); if (delegate != null) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/InstantCameraView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/InstantCameraView.java index 334644a580..ecda0dcfc9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/InstantCameraView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/InstantCameraView.java @@ -3278,9 +3278,7 @@ private void prepareEncoder(boolean fromPause) { } try { performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - } catch (Exception ignore) { - - } + } catch (Exception ignore) {} AndroidUtilities.lockOrientation(delegate.getParentActivity()); recordPlusTime = fromPause ? recordedTime : 0; recordStartTime = System.currentTimeMillis(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/InviteLinkBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/InviteLinkBottomSheet.java index 6869b62468..6990a3947a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/InviteLinkBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/InviteLinkBottomSheet.java @@ -50,6 +50,7 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import org.telegram.tgnet.tl.TL_stars; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; @@ -409,7 +410,7 @@ public void onScrolled(RecyclerView recyclerView, int dx, int dy) { } if (!TextUtils.isEmpty(invite.title)) { SpannableStringBuilder builder = new SpannableStringBuilder(invite.title); - Emoji.replaceEmoji(builder, titleTextView.getPaint().getFontMetricsInt(), (int) titleTextView.getPaint().getTextSize(), false); + Emoji.replaceEmoji(builder, titleTextView.getPaint().getFontMetricsInt(), false); titleTextView.setText(builder); } @@ -499,15 +500,13 @@ private void loadCreator() { TLRPC.TL_users_getUsers req = new TLRPC.TL_users_getUsers(); req.id.add(MessagesController.getInstance(UserConfig.selectedAccount).getInputUser(invite.admin_id)); ConnectionsManager.getInstance(UserConfig.selectedAccount).sendRequest(req, (response, error) -> { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - if (error == null) { - TLRPC.Vector vector = (TLRPC.Vector) response; - TLRPC.User user = (TLRPC.User) vector.objects.get(0); - users.put(invite.admin_id, user); - adapter.notifyDataSetChanged(); - } + AndroidUtilities.runOnUIThread(() -> { + if (response instanceof Vector) { + Vector vector = (Vector) response; + if (vector.objects.isEmpty()) return; + TLRPC.User user = vector.objects.get(0); + users.put(invite.admin_id, user); + adapter.notifyDataSetChanged(); } }); }); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ItemOptions.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ItemOptions.java index eff977608a..7250bb4412 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ItemOptions.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ItemOptions.java @@ -62,6 +62,9 @@ import org.telegram.ui.Stories.recorder.HintView2; import org.telegram.ui.Stories.recorder.ToggleButton; +import java.util.Arrays; +import java.util.Collections; + public class ItemOptions { public static ItemOptions makeOptions(@NonNull BaseFragment fragment, @NonNull View scrimView) { @@ -672,6 +675,12 @@ public ItemOptions setMaxHeight(int px) { return this; } + public boolean onTopOfScrim; + public ItemOptions setOnTopOfScrim() { + this.onTopOfScrim = true; + return this; + } + public ActionBarMenuSubItem getLast() { if (linearLayout != null) { if (linearLayout.getChildCount() <= 0) return null; @@ -825,12 +834,15 @@ public ItemOptions show() { container.addView(dimView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); dimView.setAlpha(0); dimView.animate().alpha(1f).setUpdateListener(anm -> { - if (dimView != null && (scrimViewRoundRadius > 0 || scrimViewPadding > 0)) { + if (dimView != null && (scrimViewRoundRadius > 0 || scrimViewPadding > 0 || (blur && dimView instanceof DimView && ((DimView) dimView).clipTop < 1))) { dimView.invalidate(); } }).setDuration(150); } layout.measure(View.MeasureSpec.makeMeasureSpec(container.getMeasuredWidth(), View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(container.getMeasuredHeight(), View.MeasureSpec.AT_MOST)); + final RectF layoutBounds = new RectF(); + final android.graphics.Rect layoutPadding = lastLayout.getPadding(); + layoutBounds.set(layoutPadding.left, layoutPadding.top, layout.getMeasuredWidth() - layoutPadding.right, layout.getMeasuredHeight() - layoutPadding.bottom); actionBarPopupWindow = new ActionBarPopupWindow(layout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT) { @Override @@ -870,28 +882,33 @@ public void onDismiss() { int X; if (scrimView != null) { if (gravity == Gravity.RIGHT) { - X = (int) (container.getX() + x + scrimViewBounds.width() - layout.getMeasuredWidth()); + X = (int) (container.getX() + x + scrimViewBounds.width() - layoutBounds.right); } else if (gravity == Gravity.CENTER_HORIZONTAL) { X = (int) (container.getX() + x + scrimViewBounds.width() / 2.0f - layout.getMeasuredWidth() / 2.0f); } else { - X = (int) (container.getX() + x); + if (x + layoutBounds.width() > container.getWidth()) { + X = (int) (container.getX() + x + scrimViewBounds.width() - layoutBounds.right); + } else { + X = (int) (container.getX() + x - layoutBounds.left); + } } } else { X = (container.getWidth() - layout.getMeasuredWidth()) / 2; // at the center } int Y; + float scrimHeight = onTopOfScrim ? 0 : scrimViewBounds.height(); if (forceBottom) { - Y = (int) (Math.min(y + scrimViewBounds.height(), AndroidUtilities.displaySize.y) - layout.getMeasuredHeight() + container.getY()); + Y = (int) (Math.min(y + scrimHeight, AndroidUtilities.displaySize.y) - layout.getMeasuredHeight() + container.getY()); } else if (scrimView != null) { - if (forceTop || y + scrimViewBounds.height() + layout.getMeasuredHeight() + dp(16) > AndroidUtilities.displaySize.y - AndroidUtilities.navigationBarHeight) { + if (forceTop || y + scrimHeight + layout.getMeasuredHeight() + dp(16) > AndroidUtilities.displaySize.y - AndroidUtilities.navigationBarHeight) { // put above scrimView - y -= scrimViewBounds.height(); + y -= scrimHeight; y -= layout.getMeasuredHeight(); - if (allowCenter && Math.max(0, y + scrimViewBounds.height()) + layout.getMeasuredHeight() > point[1] + scrimViewBounds.top && scrimViewBounds.height() == scrimView.getHeight()) { - y = (container.getHeight() - layout.getMeasuredHeight()) / 2f - scrimViewBounds.height() - container.getY(); + if (allowCenter && Math.max(0, y + scrimHeight) + layout.getMeasuredHeight() > point[1] + scrimViewBounds.top && scrimViewBounds.height() == scrimView.getHeight()) { + y = (container.getHeight() - layout.getMeasuredHeight()) / 2f - scrimHeight - container.getY(); } } - Y = (int) (y + scrimViewBounds.height() + container.getY()); // under scrimView + Y = (int) (y + scrimHeight + container.getY()); // under scrimView } else { Y = (container.getHeight() - layout.getMeasuredHeight()) / 2; // at the center } @@ -1074,7 +1091,7 @@ public class DimView extends View { private Bitmap blurBitmap; private Paint blurPaint; - private final float clipTop; + public final float clipTop; private final int dim; private final Path clipPath = new Path(); @@ -1103,7 +1120,9 @@ public DimView(Context context) { if (blur) { blurPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG); + scrimView.setAlpha(0.0f); AndroidUtilities.makeGlobalBlurBitmap(b -> { + scrimView.setAlpha(1.0f); blurBitmap = b; }, 12.0f); } @@ -1127,7 +1146,7 @@ protected void onDraw(Canvas canvas) { } else if (cachedBitmap != null && scrimView.getParent() instanceof View) { canvas.save(); if (clipTop < 1) { - canvas.clipRect(-viewAdditionalOffsets.left, -viewAdditionalOffsets.top + point[1] - clipTop + 1, getMeasuredWidth() + viewAdditionalOffsets.right, getMeasuredHeight() + viewAdditionalOffsets.bottom); + canvas.clipRect(-viewAdditionalOffsets.left, -viewAdditionalOffsets.top + point[1] - clipTop * (blur ? 1.0f - getAlpha() : 1.0f) + 1, getMeasuredWidth() + viewAdditionalOffsets.right, getMeasuredHeight() + viewAdditionalOffsets.bottom); } canvas.translate(point[0], point[1]); @@ -1160,7 +1179,7 @@ protected void onDraw(Canvas canvas) { } else if (scrimView != null && scrimView.getParent() instanceof View) { canvas.save(); if (clipTop < 1) { - canvas.clipRect(-viewAdditionalOffsets.left, -viewAdditionalOffsets.top + point[1] - clipTop + 1, getMeasuredWidth() + viewAdditionalOffsets.right, getMeasuredHeight() + viewAdditionalOffsets.bottom); + canvas.clipRect(-viewAdditionalOffsets.left, -viewAdditionalOffsets.top + point[1] - clipTop * (blur ? 1.0f - getAlpha() : 1.0f) + 1, getMeasuredWidth() + viewAdditionalOffsets.right, getMeasuredHeight() + viewAdditionalOffsets.bottom); } canvas.translate(point[0], point[1]); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/JoinCallAlert.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/JoinCallAlert.java index 17e17ef5fd..a663b82e1a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/JoinCallAlert.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/JoinCallAlert.java @@ -40,6 +40,7 @@ import org.telegram.messenger.voip.VoIPService; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_phone; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.BottomSheet; @@ -203,7 +204,7 @@ public static void checkFewUsers(Context context, long did, AccountInstance acco return; } final AlertDialog progressDialog = new AlertDialog(context, AlertDialog.ALERT_TYPE_SPINNER); - TLRPC.TL_phone_getGroupCallJoinAs req = new TLRPC.TL_phone_getGroupCallJoinAs(); + TL_phone.getGroupCallJoinAs req = new TL_phone.getGroupCallJoinAs(); req.peer = accountInstance.getMessagesController().getInputPeer(did); int reqId = accountInstance.getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { try { @@ -212,7 +213,7 @@ public static void checkFewUsers(Context context, long did, AccountInstance acco FileLog.e(e); } if (response != null) { - TLRPC.TL_phone_joinAsPeers res = (TLRPC.TL_phone_joinAsPeers) response; + TL_phone.joinAsPeers res = (TL_phone.joinAsPeers) response; cachedChats = res.peers; lastCacheDid = did; lastCacheTime = SystemClock.elapsedRealtime(); @@ -243,7 +244,7 @@ public static void open(Context context, long did, AccountInstance accountInstan } } else { final AlertDialog progressDialog = new AlertDialog(context, AlertDialog.ALERT_TYPE_SPINNER); - TLRPC.TL_phone_getGroupCallJoinAs req = new TLRPC.TL_phone_getGroupCallJoinAs(); + TL_phone.getGroupCallJoinAs req = new TL_phone.getGroupCallJoinAs(); req.peer = accountInstance.getMessagesController().getInputPeer(did); int reqId = accountInstance.getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { try { @@ -252,7 +253,7 @@ public static void open(Context context, long did, AccountInstance accountInstan FileLog.e(e); } if (response != null) { - TLRPC.TL_phone_joinAsPeers res = (TLRPC.TL_phone_joinAsPeers) response; + TL_phone.joinAsPeers res = (TL_phone.joinAsPeers) response; if (res.peers.size() == 1) { TLRPC.InputPeer peer = accountInstance.getMessagesController().getInputPeer(MessageObject.getPeerId(res.peers.get(0))); delegate.didSelectChat(peer, false, false, false); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/LinkSpanDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/LinkSpanDrawable.java index d7bdade0f3..534a4ea406 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/LinkSpanDrawable.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/LinkSpanDrawable.java @@ -685,8 +685,8 @@ protected void onDraw(Canvas canvas) { canvas.translate(getPaddingLeft(), offset); } stack = AnimatedEmojiSpan.update(emojiCacheType(), this, stack, getLayout()); - if (emojiColorFilter == null) { - emojiColorFilter = new PorterDuffColorFilter(getPaint().linkColor, PorterDuff.Mode.SRC_IN); + if (emojiColorIsLink && (emojiColorFilter == null || emojiColorFilterColor != getPaint().linkColor)) { + emojiColorFilter = new PorterDuffColorFilter(emojiColorFilterColor = getPaint().linkColor, PorterDuff.Mode.SRC_IN); } AnimatedEmojiSpan.drawAnimatedEmojis(canvas, layout, stack, 0, null, 0, 0, 0, 1f, emojiColorFilter); } catch (Exception e) { @@ -702,7 +702,21 @@ protected int emojiCacheType() { return AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES; } + private boolean emojiColorIsLink = true; private ColorFilter emojiColorFilter; + private int emojiColorFilterColor; + + public void resetEmojiColor() { + emojiColorIsLink = false; + emojiColorFilter = null; + invalidate(); + } + + public void setEmojiColor(int color) { + emojiColorIsLink = false; + emojiColorFilter = new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN); + invalidate(); + } @Override public void setText(CharSequence text, TextView.BufferType type) { @@ -728,18 +742,6 @@ protected void onDetachedFromWindow() { AnimatedEmojiSpan.release(this, stack); } - @Override - public void setTextColor(int color) { - super.setTextColor(color); - emojiColorFilter = new PorterDuffColorFilter(getPaint().linkColor, PorterDuff.Mode.SRC_IN); - } - - @Override - public void setTextColor(ColorStateList colors) { - super.setTextColor(colors); - emojiColorFilter = new PorterDuffColorFilter(getPaint().linkColor, PorterDuff.Mode.SRC_IN); - } - public boolean hasLinks() { Layout textLayout = getLayout(); if (textLayout == null) return false; @@ -751,6 +753,91 @@ public boolean hasLinks() { } } + public static class LinksSimpleTextView extends SimpleTextView { + private Theme.ResourcesProvider resourcesProvider; + public LinksSimpleTextView(Context context) { + this(context, null); + } + + public LinksSimpleTextView(Context context, Theme.ResourcesProvider resourcesProvider) { + super(context); + this.resourcesProvider = resourcesProvider; + } + + private final LinkCollector links = new LinkCollector(this); + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + canvas.save(); + canvas.translate(getLayoutX(), getLayoutY()); + if (links.draw(canvas)) { + invalidate(); + } + canvas.restore(); + } + + private LinkSpanDrawable pressedLink; + + public ClickableSpan hit(int x, int y) { + Layout textLayout = getLayout(); + if (textLayout == null) { + return null; + } + x -= getLayoutX(); + y -= getLayoutY(); + final int line = textLayout.getLineForVertical(y); + final int off = textLayout.getOffsetForHorizontal(line, x); + final float left = textLayout.getLineLeft(line); + if (left <= x && left + textLayout.getLineWidth(line) >= x && y >= 0 && y <= textLayout.getHeight()) { + Spannable buffer = new SpannableString(textLayout.getText()); + ClickableSpan[] spans = buffer.getSpans(off, off, ClickableSpan.class); + if (spans.length != 0 && !AndroidUtilities.isAccessibilityScreenReaderEnabled()) { + return spans[0]; + } + } + return null; + } + + @Override + public boolean onTouchEvent(MotionEvent event) { + if (links != null) { + Layout textLayout = getLayout(); + ClickableSpan span; + if ((span = hit((int) event.getX(), (int) event.getY())) != null) { + if (event.getAction() == MotionEvent.ACTION_DOWN) { + final LinkSpanDrawable link = new LinkSpanDrawable(span, resourcesProvider, event.getX(), event.getY()); + pressedLink = link; + links.addLink(pressedLink); + Spannable buffer = new SpannableString(textLayout.getText()); + int start = buffer.getSpanStart(pressedLink.getSpan()); + int end = buffer.getSpanEnd(pressedLink.getSpan()); + LinkPath path = pressedLink.obtainNewPath(); + path.setCurrentLayout(textLayout, start, 0); + textLayout.getSelectionPath(start, end, path); + return true; + } + } + if (event.getAction() == MotionEvent.ACTION_UP) { + links.clear(); + if (pressedLink != null && pressedLink.getSpan() == span) { + if (pressedLink.getSpan() instanceof ClickableSpan) { + ((ClickableSpan) pressedLink.getSpan()).onClick(this); + } + pressedLink = null; + return true; + } + pressedLink = null; + } + if (event.getAction() == MotionEvent.ACTION_CANCEL) { + links.clear(); + pressedLink = null; + } + } + return pressedLink != null || super.onTouchEvent(event); + } + } + public static class ClickableSmallTextView extends SimpleTextView { private Theme.ResourcesProvider resourcesProvider; public ClickableSmallTextView(Context context) { @@ -766,8 +853,8 @@ private int getLinkColor() { return ColorUtils.setAlphaComponent(getTextColor(), (int) (Color.alpha(getTextColor()) * .1175f)); } - private LinkCollector links = new LinkCollector(this); - private Paint linkBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private final LinkCollector links = new LinkCollector(this); + private final Paint linkBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); @Override protected void onDraw(Canvas canvas) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/MediaActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/MediaActivity.java index b3321b7a83..1782fed32d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/MediaActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/MediaActivity.java @@ -197,14 +197,11 @@ public void onItemClick(int id) { AlertDialog.Builder builder = new AlertDialog.Builder(getContext(), getResourceProvider()); builder.setTitle(storyItems.size() > 1 ? LocaleController.getString(R.string.DeleteStoriesTitle) : LocaleController.getString(R.string.DeleteStoryTitle)); builder.setMessage(LocaleController.formatPluralString("DeleteStoriesSubtitle", storyItems.size())); - builder.setPositiveButton(LocaleController.getString(R.string.Delete), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - getMessagesController().getStoriesController().deleteStories(dialogId, storyItems); - sharedMediaLayout.closeActionMode(false); - } + builder.setPositiveButton(LocaleController.getString(R.string.Delete), (dialog, which) -> { + getMessagesController().getStoriesController().deleteStories(dialogId, storyItems); + sharedMediaLayout.closeActionMode(false); }); - builder.setNegativeButton(LocaleController.getString(R.string.Cancel), (DialogInterface.OnClickListener) (dialog, which) -> { + builder.setNegativeButton(LocaleController.getString(R.string.Cancel), (dialog, which) -> { dialog.dismiss(); }); AlertDialog dialog = builder.create(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/MentionsContainerView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/MentionsContainerView.java index db0d2d9f5c..f4a60dc860 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/MentionsContainerView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/MentionsContainerView.java @@ -28,17 +28,14 @@ import org.telegram.messenger.FileLoader; import org.telegram.messenger.FileLog; import org.telegram.messenger.ImageReceiver; -import org.telegram.messenger.LocaleController; import org.telegram.messenger.MediaDataController; import org.telegram.messenger.MessageObject; import org.telegram.messenger.NotificationCenter; -import org.telegram.messenger.R; import org.telegram.messenger.SharedConfig; import org.telegram.messenger.UserConfig; import org.telegram.messenger.UserObject; import org.telegram.messenger.VideoEditedInfo; import org.telegram.tgnet.TLRPC; -import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Adapters.MentionsAdapter; @@ -47,7 +44,6 @@ import org.telegram.ui.Cells.ContextLinkCell; import org.telegram.ui.Cells.MentionCell; import org.telegram.ui.Cells.StickerCell; -import org.telegram.ui.ChatActivity; import org.telegram.ui.ContentPreviewViewer; import org.telegram.ui.PhotoViewer; @@ -563,7 +559,7 @@ public void setDialogId(long dialogId) { private PhotoViewer.PhotoViewerProvider botContextProvider = new PhotoViewer.EmptyPhotoViewerProvider() { @Override - public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { + public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview, boolean closing) { if (index < 0 || index >= botContextResults.size()) { return null; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/MessagePrivateSeenView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/MessagePrivateSeenView.java index a1c0f01c8d..85429fd27a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/MessagePrivateSeenView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/MessagePrivateSeenView.java @@ -32,6 +32,7 @@ import org.telegram.messenger.UserObject; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.BottomSheet; import org.telegram.ui.ActionBar.SimpleTextView; @@ -224,7 +225,7 @@ public static void showSheet(Context context, int currentAccount, long dialogId, button1.setOnClickListener(v -> { button1.setLoading(true); if (lastSeen) { - TLRPC.TL_account_setPrivacy req = new TLRPC.TL_account_setPrivacy(); + TL_account.setPrivacy req = new TL_account.setPrivacy(); req.key = new TLRPC.TL_inputPrivacyKeyStatusTimestamp(); req.rules.add(new TLRPC.TL_inputPrivacyValueAllowAll()); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { @@ -242,7 +243,7 @@ public static void showSheet(Context context, int currentAccount, long dialogId, } })); } else { - TLRPC.TL_account_setGlobalPrivacySettings req = new TLRPC.TL_account_setGlobalPrivacySettings(); + TL_account.setGlobalPrivacySettings req = new TL_account.setGlobalPrivacySettings(); req.settings = ContactsController.getInstance(currentAccount).getGlobalPrivacySettings(); if (req.settings == null) { req.settings = new TLRPC.TL_globalPrivacySettings(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/MuteDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/MuteDrawable.java new file mode 100644 index 0000000000..27531e98db --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/MuteDrawable.java @@ -0,0 +1,109 @@ +package org.telegram.ui.Components; + +import static org.telegram.messenger.AndroidUtilities.dp; +import static org.telegram.messenger.AndroidUtilities.dpf2; +import static org.telegram.messenger.AndroidUtilities.lerp; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.ColorFilter; +import android.graphics.Paint; +import android.graphics.PixelFormat; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffXfermode; +import android.graphics.Rect; +import android.graphics.Xfermode; +import android.graphics.drawable.Drawable; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import org.telegram.messenger.R; + +public class MuteDrawable extends Drawable { + + private Drawable baseDrawable; + private final Paint strokePaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private final Paint clipPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + + public MuteDrawable(Context context) { + baseDrawable = context.getResources().getDrawable(R.drawable.filled_sound_on).mutate(); + + strokePaint.setStyle(Paint.Style.STROKE); + strokePaint.setStrokeWidth(dpf2(1.566f)); + strokePaint.setColor(0xFFFFFFFF); + strokePaint.setStrokeCap(Paint.Cap.ROUND); + strokePaint.setStrokeJoin(Paint.Join.ROUND); + + clipPaint.setStyle(Paint.Style.STROKE); + clipPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR)); + clipPaint.setStrokeWidth(dpf2(4.5f)); + clipPaint.setColor(0xFFFF0000); + clipPaint.setStrokeCap(Paint.Cap.ROUND); + clipPaint.setStrokeJoin(Paint.Join.ROUND); + } + + private final AnimatedFloat animatedMuted = new AnimatedFloat(this::invalidateSelf, 0, 200, CubicBezierInterpolator.EASE_OUT); + private boolean muted; + + @Override + public void draw(@NonNull Canvas canvas) { + final Rect bounds = getBounds(); + canvas.saveLayerAlpha(bounds.left, bounds.top, bounds.right, bounds.bottom, 0xFF, Canvas.ALL_SAVE_FLAG); + + baseDrawable.setBounds(bounds); + baseDrawable.draw(canvas); + + final float muted = animatedMuted.set(this.muted); + if (muted > 0) { + final float p = dpf2(.783f); + float ax = bounds.centerX() - dp(9) + p, ay = bounds.centerY() - dp(9) + p; + float bx = bounds.centerX() + dp(9) - p, by = bounds.centerY() + dp(9) - p; + if (this.muted) { + ax = lerp(bx, ax, muted); + ay = lerp(by, ay, muted); + } else { + bx = lerp(ax, bx, muted); + by = lerp(ay, by, muted); + } + canvas.drawLine(ax, ay, bx, by, clipPaint); + strokePaint.setAlpha((int) (0xFF * Math.min(1, 10 * muted))); + canvas.drawLine(ax, ay, bx, by, strokePaint); + } + + canvas.restore(); + } + + public void setMuted(boolean muted, boolean animated) { + this.muted = muted; + if (!animated) { + animatedMuted.set(muted, true); + } + invalidateSelf(); + } + + @Override + public void setAlpha(int alpha) { + baseDrawable.setAlpha(alpha); + } + + @Override + public void setColorFilter(@Nullable ColorFilter colorFilter) { + + } + + @Override + public int getOpacity() { + return PixelFormat.TRANSPARENT; + } + + @Override + public int getIntrinsicHeight() { + return dp(24); + } + + @Override + public int getIntrinsicWidth() { + return dp(24); + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/OutlineTextContainerView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/OutlineTextContainerView.java index d394575aca..30445228f2 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/OutlineTextContainerView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/OutlineTextContainerView.java @@ -47,18 +47,18 @@ public class OutlineTextContainerView extends FrameLayout { obj.updateColor(); }).setMultiplier(SPRING_MULTIPLIER); - private RectF rect = new RectF(); + private final RectF rect = new RectF(); private String mText = ""; - private Paint outlinePaint = new Paint(Paint.ANTI_ALIAS_FLAG); - private TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); + private final Paint outlinePaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private final TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); - private SpringAnimation selectionSpring = new SpringAnimation(this, SELECTION_PROGRESS_PROPERTY); + private final SpringAnimation selectionSpring = new SpringAnimation(this, SELECTION_PROGRESS_PROPERTY); private float selectionProgress; - private SpringAnimation titleSpring = new SpringAnimation(this, TITLE_PROGRESS_PROPERTY); + private final SpringAnimation titleSpring = new SpringAnimation(this, TITLE_PROGRESS_PROPERTY); private float titleProgress; - private SpringAnimation errorSpring = new SpringAnimation(this, ERROR_PROGRESS_PROPERTY); + private final SpringAnimation errorSpring = new SpringAnimation(this, ERROR_PROGRESS_PROPERTY); private float errorProgress; private float strokeWidthRegular = Math.max(2, AndroidUtilities.dp(0.5f)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/EntityView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/EntityView.java index aaf119272c..13576aa2b3 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/EntityView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/EntityView.java @@ -84,12 +84,14 @@ default boolean isEntityDeletable() { private EntityViewDelegate delegate; private Point position; - protected SelectionView selectionView; + public SelectionView selectionView; private final Runnable longPressRunnable = () -> { recognizedLongPress = true; if (delegate != null) { - performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} delegate.onEntityLongClicked(EntityView.this); } }; @@ -601,8 +603,7 @@ public void scale(float scale) { if (allowHaptic() && (newScale >= getMaxScale() || newScale <= getMinScale()) != (oldScale >= getMaxScale() || oldScale <= getMinScale())) { try { performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); - } catch (Exception ignore) { - } + } catch (Exception ignore) {} } setScaleX(newScale); setScaleY(newScale); @@ -834,7 +835,7 @@ public SelectionView(Context context) { dotStrokePaint.setShadowLayer(AndroidUtilities.dpf2(0.75f), 0, 0, 0x50000000); } - protected void updatePosition() { + public void updatePosition() { Rect bounds = getSelectionBounds(); LayoutParams layoutParams = (LayoutParams) getLayoutParams(); layoutParams.leftMargin = (int) bounds.x; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/LPhotoPaintView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/LPhotoPaintView.java index 1316ec817b..a41d051cb9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/LPhotoPaintView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/LPhotoPaintView.java @@ -478,7 +478,7 @@ protected void onDraw(Canvas canvas) { text.setSpan(new AnimatedEmojiSpan(e.document_id, textPaintView.getFontMetricsInt()), e.offset, e.offset + e.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } CharSequence charSequence = text; - charSequence = Emoji.replaceEmoji(charSequence, textPaintView.getFontMetricsInt(), (int) (textPaintView.getFontSize() * .8f), false); + charSequence = Emoji.replaceEmoji(charSequence, textPaintView.getFontMetricsInt(), false); if (charSequence instanceof Spanned) { Emoji.EmojiSpan[] spans = ((Spanned) charSequence).getSpans(0, charSequence.length(), Emoji.EmojiSpan.class); if (spans != null) { @@ -1549,7 +1549,7 @@ public PhotoView createPhoto(String path, boolean select) { size.height = w; } PhotoView view = new PhotoView(getContext(), centerPositionForEntity(), 0, 1f, size, path, orientation.first, orientation.second); - view.centerImage.setLayerNum(4 + 8); +// view.centerImage.setLayerNum(4 + 8); // view.setHasStickyX(true); // view.setHasStickyY(true); view.setDelegate(this); @@ -3629,7 +3629,7 @@ public void onEmojiSelected(String symbol) { } try { innerTextChange = 2; - CharSequence localCharSequence = Emoji.replaceEmoji(symbol, textPaintView.getFontMetricsInt(), (int) (textPaintView.getFontSize() * .8f), false); + CharSequence localCharSequence = Emoji.replaceEmoji(symbol, textPaintView.getFontMetricsInt(), false); if (localCharSequence instanceof Spanned) { Emoji.EmojiSpan[] spans = ((Spanned) localCharSequence).getSpans(0, localCharSequence.length(), Emoji.EmojiSpan.class); if (spans != null) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/LinkPreview.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/LinkPreview.java index eb58e63b45..7472342f14 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/LinkPreview.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/LinkPreview.java @@ -29,6 +29,8 @@ import org.telegram.messenger.UserConfig; import org.telegram.messenger.UserObject; import org.telegram.tgnet.AbstractSerializedData; +import org.telegram.tgnet.InputSerializedData; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.Theme; @@ -492,7 +494,7 @@ public static class WebPagePreview extends TLObject { public int photoSize; - public static WebPagePreview TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { + public static WebPagePreview TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { if (WebPagePreview.constructor != constructor) { if (exception) { throw new RuntimeException(String.format("can't parse magic %x in WebPagePreview", constructor)); @@ -506,7 +508,7 @@ public static WebPagePreview TLdeserialize(AbstractSerializedData stream, int co } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = (webpage != null) ? flags | 1 : flags &~ 1; flags = !TextUtils.isEmpty(name) ? flags | 2 : flags &~ 2; @@ -526,7 +528,7 @@ public void serializeToStream(AbstractSerializedData stream) { } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); largePhoto = (flags & 8) != 0; captionAbove = (flags & 16) != 0; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/MessageEntityView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/MessageEntityView.java index 7555d63082..ee1d2ea2e0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/MessageEntityView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/MessageEntityView.java @@ -81,10 +81,10 @@ public MessageEntityView(Context context, Point position, float angle, float sca setScale(scale); int date = 0; for (int i = 0; i < thisMessageObjects.size(); ++i) { - MessageObject msg = thisMessageObjects.get(i); + final MessageObject msg = thisMessageObjects.get(i); date = msg.messageOwner.date; - TLRPC.Message messageOwner = copyMessage(msg.messageOwner); - Boolean b = StoryEntry.useForwardForRepost(msg); + final TLRPC.Message messageOwner = copyMessage(msg.messageOwner); + final Boolean b = StoryEntry.useForwardForRepost(msg); if (b != null && b && messageOwner.fwd_from != null && messageOwner.fwd_from.from_id != null) { messageOwner.from_id = messageOwner.fwd_from.from_id; messageOwner.peer_id = messageOwner.fwd_from.from_id; @@ -92,7 +92,8 @@ public MessageEntityView(Context context, Point position, float angle, float sca messageOwner.fwd_from = null; } messageOwner.voiceTranscriptionOpen = false; - MessageObject newMsg = new MessageObject(msg.currentAccount, messageOwner, msg.replyMessageObject, MessagesController.getInstance(msg.currentAccount).getUsers(), MessagesController.getInstance(msg.currentAccount).getChats(), null, null, true, true, 0, true, isRepostVideoPreview, false); + final MessageObject newMsg = new MessageObject(msg.currentAccount, messageOwner, msg.replyMessageObject, MessagesController.getInstance(msg.currentAccount).getUsers(), MessagesController.getInstance(msg.currentAccount).getChats(), null, null, true, true, 0, true, isRepostVideoPreview, false); + newMsg.setType(); messageObjects.add(newMsg); } // dateCell = new ChatActionCell(context, false, resourcesProvider) { @@ -149,6 +150,9 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (child instanceof ChatMessageCell) { childleft = child.getLeft() + ((ChatMessageCell) child).getBoundsLeft(); childright = child.getLeft() + ((ChatMessageCell) child).getBoundsRight(); + } else if (child instanceof ChatActionCell) { + childleft = child.getLeft() + ((ChatActionCell) child).getBoundsLeft(); + childright = child.getLeft() + ((ChatActionCell) child).getBoundsRight(); } left = Math.min(childleft, left); right = Math.max(childright, right); @@ -166,6 +170,9 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto if (child instanceof ChatMessageCell) { childleft = child.getLeft() + ((ChatMessageCell) child).getBoundsLeft(); childright = child.getLeft() + ((ChatMessageCell) child).getBoundsRight(); + } else if (child instanceof ChatActionCell) { + childleft = child.getLeft() + ((ChatActionCell) child).getBoundsLeft(); + childright = child.getLeft() + ((ChatActionCell) child).getBoundsRight(); } cleft = Math.min(childleft, cleft); cright = Math.max(childright, cright); @@ -402,6 +409,7 @@ private void drawChatBackgroundElements(Canvas canvas) { canvas.translate(cell.getX(), cell.getY()); canvas.scale(cell.getScaleX(), cell.getScaleY(), cell.getMeasuredWidth() / 2f, cell.getMeasuredHeight() / 2f); cell.drawBackground(canvas, true); + cell.drawReactions(canvas, true, null); canvas.restore(); } } @@ -750,6 +758,32 @@ public boolean isEnabled(RecyclerView.ViewHolder holder) { @NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + if (viewType == 1) { + final ChatActionCell cell = new ChatActionCell(context, false, resourcesProvider) { + public final BlurringShader.StoryBlurDrawer blurDrawer = new BlurringShader.StoryBlurDrawer(blurManager, this, BlurringShader.StoryBlurDrawer.BLUR_TYPE_ACTION_BACKGROUND); + private final TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); { + textPaint.setTypeface(AndroidUtilities.bold()); + textPaint.setTextSize(AndroidUtilities.dp(Math.max(16, SharedConfig.fontSize) - 2)); + textPaint.setColor(0xffffffff); + } + + @Override + protected Paint getThemedPaint(String paintKey) { + if (Theme.key_paint_chatActionText.equals(paintKey) || Theme.key_paint_chatActionText2.equals(paintKey)) { + return textPaint; + } + if (Theme.key_paint_chatActionBackground.equals(paintKey)) { + usesBackgroundPaint = true; + Paint paint = blurDrawer.adapt(isDark).getPaint(1f); + if (paint != null) { + return paint; + } + } + return super.getThemedPaint(paintKey); + } + }; + return new RecyclerListView.Holder(cell); + } ChatMessageCell cell = new ChatMessageCell(context, UserConfig.selectedAccount, false, null, resourcesProvider) { public BlurringShader.StoryBlurDrawer blurDrawer = new BlurringShader.StoryBlurDrawer(blurManager, this, BlurringShader.StoryBlurDrawer.BLUR_TYPE_ACTION_BACKGROUND); @@ -831,14 +865,27 @@ protected boolean drawPhotoImage(Canvas canvas) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { position = messageObjects.size() - 1 - position; MessageObject message = messageObjects.get(position); - boolean pinnedTop = false; - if (groupedMessages != null) { - MessageObject.GroupedMessagePosition p = groupedMessages.getPosition(message); - if (p != null) { - pinnedTop = p.minY != 0; + if (holder.itemView instanceof ChatMessageCell) { + final ChatMessageCell cell = (ChatMessageCell) holder.itemView; + boolean pinnedTop = false; + if (groupedMessages != null) { + MessageObject.GroupedMessagePosition p = groupedMessages.getPosition(message); + if (p != null) { + pinnedTop = p.minY != 0; + } } + cell.setMessageObject(message, groupedMessages, groupedMessages != null, pinnedTop); + } else if (holder.itemView instanceof ChatActionCell) { + final ChatActionCell cell = (ChatActionCell) holder.itemView; + cell.setMessageObject(message); } - ((ChatMessageCell) holder.itemView).setMessageObject(message, groupedMessages, groupedMessages != null, pinnedTop); + } + + @Override + public int getItemViewType(int position) { + position = messageObjects.size() - 1 - position; + MessageObject message = messageObjects.get(position); + return message.contentType; } @Override @@ -994,6 +1041,26 @@ public float getBubbleBounds(RectF rect) { top = Math.min(top, cbottom); bottom = Math.max(bottom, ctop); bottom = Math.max(bottom, cbottom); + } else if (child instanceof ChatActionCell) { + ChatActionCell cell = (ChatActionCell) child; + float cleft, ctop, cright, cbottom; + if (cell.starGiftLayout.has()) { + cleft = container.getX() + cell.getX() + cell.getBoundsLeft(); + cright = container.getX() + cell.getX() + cell.getBoundsRight(); + ctop = container.getY() + cell.getY(); + cbottom = container.getY() + cell.getY() + cell.getMeasuredHeight(); + } else { + // TODO + continue; + } + left = Math.min(left, cleft); + left = Math.min(left, cright); + right = Math.max(right, cleft); + right = Math.max(right, cright); + top = Math.min(top, ctop); + top = Math.min(top, cbottom); + bottom = Math.max(bottom, ctop); + bottom = Math.max(bottom, cbottom); } } rect.set(left, top, right, bottom); @@ -1040,18 +1107,22 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { setMeasuredDimension(container.getMeasuredWidth(), container.getMeasuredHeight()); updatePosition(); if (firstMeasure) { - int maxWidth = MeasureSpec.getSize(widthMeasureSpec) - dp(22 * 2); - int maxHeight = MeasureSpec.getSize(heightMeasureSpec) - dp(96 * 2); + final boolean isAction = messageObjects != null && messageObjects.size() == 1 && messageObjects.get(0).contentType == 1; + + final int maxWidth = MeasureSpec.getSize(widthMeasureSpec) - dp(isAction ? 0 : 22 * 2); + final int maxHeight = MeasureSpec.getSize(heightMeasureSpec) - dp(isAction ? 0 : 96 * 2); - int width = getMeasuredWidth(); - int height = getMeasuredHeight(); + final int width = getMeasuredWidth(); + final int height = getMeasuredHeight(); - float scale = Math.min((float) maxWidth / width, (float) maxHeight / height); + final float scale = Math.min((float) maxWidth / width, (float) maxHeight / height); if (scale < 1) { setScale(scale); } - Point p = getPosition(); - p.x -= dp(19) * Math.min(1, scale); + final Point p = getPosition(); + if (!isAction) { + p.x -= dp(19) * Math.min(1, scale); + } setPosition(p); firstMeasure = false; @@ -1331,8 +1402,13 @@ public void setupTheme(StoryEntry entry) { invalidateAll(); } - public TLRPC.TL_message copyMessage(TLRPC.Message msg) { - TLRPC.TL_message newmsg = new TLRPC.TL_message(); + public TLRPC.Message copyMessage(TLRPC.Message msg) { + TLRPC.Message newmsg; + if (msg instanceof TLRPC.TL_message) { + newmsg = new TLRPC.TL_message(); + } else if (msg instanceof TLRPC.TL_messageService) { + newmsg = new TLRPC.TL_messageService(); + } else return msg; newmsg.id = msg.id; newmsg.from_id = msg.from_id; newmsg.peer_id = msg.peer_id; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/PaintTypefaceListView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/PaintTypefaceListView.java index 6c4cd8d9b5..c000b6a986 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/PaintTypefaceListView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/PaintTypefaceListView.java @@ -3,6 +3,7 @@ import android.content.Context; import android.graphics.Canvas; import android.graphics.Path; +import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; @@ -103,4 +104,14 @@ public void setMaskProvider(Consumer maskProvider) { this.maskProvider = maskProvider; invalidate(); } + + @Override + public boolean dispatchTouchEvent(MotionEvent ev) { + return super.dispatchTouchEvent(ev); + } + + @Override + public boolean onTouchEvent(MotionEvent e) { + return super.onTouchEvent(e); + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/PhotoView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/PhotoView.java index 98198f7e78..f4cffc83ca 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/PhotoView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/PhotoView.java @@ -23,6 +23,8 @@ import android.view.ViewGroup; import android.widget.FrameLayout; +import androidx.annotation.NonNull; + import com.google.mlkit.common.MlKitException; import com.google.mlkit.vision.common.InputImage; import com.google.mlkit.vision.segmentation.subject.SubjectSegmentation; @@ -38,6 +40,7 @@ import org.telegram.messenger.MediaController; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Components.AnimatedFileDrawable; import org.telegram.ui.Components.AnimatedFloat; import org.telegram.ui.Components.CubicBezierInterpolator; @@ -54,7 +57,7 @@ public class PhotoView extends EntityView { - private class FrameLayoutDrawer extends FrameLayout { + public class FrameLayoutDrawer extends FrameLayout { public FrameLayoutDrawer(Context context) { super(context); setWillNotDraw(false); @@ -79,33 +82,34 @@ protected void onDraw(Canvas canvas) { private boolean segmented = false; private AnimatedFloat segmentedT; - private final FrameLayoutDrawer containerView; - public final ImageReceiver centerImage = new ImageReceiver() { - @Override - protected boolean setImageBitmapByKey(Drawable drawable, String key, int type, boolean memCache, int guid) { - if (type == TYPE_IMAGE && drawable instanceof BitmapDrawable) { - segmentImage(((BitmapDrawable) drawable).getBitmap()); - } - return super.setImageBitmapByKey(drawable, key, type, memCache, guid); - } - }; + public final FrameLayoutDrawer containerView; + public Bitmap bitmap; +// public final ImageReceiver centerImage = new ImageReceiver() { +// @Override +// protected boolean setImageBitmapByKey(Drawable drawable, String key, int type, boolean memCache, int guid) { +// if (type == TYPE_IMAGE && drawable instanceof BitmapDrawable) { +// segmentImage(((BitmapDrawable) drawable).getBitmap()); +// } +// return super.setImageBitmapByKey(drawable, key, type, memCache, guid); +// } +// }; private File segmentedFile; public void preloadSegmented(String path) { - if (TextUtils.isEmpty(path)) return; - segmentingLoading = true; - final int side = Math.round(Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y) * .8f / AndroidUtilities.density); - BitmapFactory.Options opts = new BitmapFactory.Options(); - opts.inJustDecodeBounds = true; - BitmapFactory.decodeFile(path, opts); - opts.inSampleSize = StoryEntry.calculateInSampleSize(opts, side, side); - opts.inJustDecodeBounds = false; - opts.inDither = true; - segmentedImage = BitmapFactory.decodeFile(path, opts); - if (segmentedImage != null) { - segmentedFile = new File(path); - segmentingLoaded = true; - } +// if (TextUtils.isEmpty(path)) return; +// segmentingLoading = true; +// final int side = Math.round(Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y) * .8f / AndroidUtilities.density); +// BitmapFactory.Options opts = new BitmapFactory.Options(); +// opts.inJustDecodeBounds = true; +// BitmapFactory.decodeFile(path, opts); +// opts.inSampleSize = StoryEntry.calculateInSampleSize(opts, side, side); +// opts.inJustDecodeBounds = false; +// opts.inDither = true; +// segmentedImage = BitmapFactory.decodeFile(path, opts); +// if (segmentedImage != null) { +// segmentedFile = new File(path); +// segmentingLoaded = true; +// } segmentingLoading = false; } @@ -125,12 +129,17 @@ public PhotoView(Context context, Point position, float angle, float scale, Size this.orientation = orientation; this.invert = invert; - centerImage.setAspectFit(true); - centerImage.setInvalidateAll(true); - centerImage.setParentView(containerView); - centerImage.setRoundRadius(dp(12)); - centerImage.setOrientation(orientation, invert, true); - centerImage.setImage(ImageLocation.getForPath(path), getImageFilter(), null, null, null, 1); + + bitmap = BitmapFactory.decodeFile(path); + if (bitmap != null) { + segmentImage(bitmap); + } +// centerImage.setAspectFit(true); +// centerImage.setInvalidateAll(true); +// centerImage.setParentView(containerView); +// centerImage.setRoundRadius(dp(12)); +// centerImage.setOrientation(orientation, invert, true); +// centerImage.setImage(ImageLocation.getForPath(path), getImageFilter(), null, null, null, 1); updatePosition(); } @@ -148,17 +157,17 @@ public PhotoView(Context context, Point position, float angle, float scale, Size mirrorT = new AnimatedFloat(containerView, 0, 500, CubicBezierInterpolator.EASE_OUT_QUINT); segmentedT = new AnimatedFloat(containerView, 0, 350, CubicBezierInterpolator.EASE_OUT_QUINT); - centerImage.setAspectFit(true); - centerImage.setInvalidateAll(true); - centerImage.setParentView(containerView); - centerImage.setRoundRadius(dp(12)); - - if (object instanceof TLRPC.Photo) { - TLRPC.Photo photo = (TLRPC.Photo) object; - TLRPC.PhotoSize photoSize = FileLoader.getClosestPhotoSizeWithSize(photo.sizes, 1000); - TLRPC.PhotoSize thumbPhotoSize = FileLoader.getClosestPhotoSizeWithSize(photo.sizes, 90); - centerImage.setImage(ImageLocation.getForPhoto(photoSize, photo), getImageFilter(), ImageLocation.getForPhoto(thumbPhotoSize, photo), getImageFilter(), (String) null, null, 1); - } +// centerImage.setAspectFit(true); +// centerImage.setInvalidateAll(true); +// centerImage.setParentView(containerView); +// centerImage.setRoundRadius(dp(12)); +// +// if (object instanceof TLRPC.Photo) { +// TLRPC.Photo photo = (TLRPC.Photo) object; +// TLRPC.PhotoSize photoSize = FileLoader.getClosestPhotoSizeWithSize(photo.sizes, 1000); +// TLRPC.PhotoSize thumbPhotoSize = FileLoader.getClosestPhotoSizeWithSize(photo.sizes, 90); +// centerImage.setImage(ImageLocation.getForPhoto(photoSize, photo), getImageFilter(), ImageLocation.getForPhoto(thumbPhotoSize, photo), getImageFilter(), (String) null, null, 1); +// } updatePosition(); } @@ -179,8 +188,8 @@ public void segmentImage(Bitmap source) { .addOnSuccessListener(result -> { segmentingLoaded = true; segmentingLoading = false; - segmentedImage = result.getForegroundBitmap(); - highlightSegmented(); +// segmentedImage = result.getForegroundBitmap(); +// highlightSegmented(); }) .addOnFailureListener(error -> { segmentingLoading = false; @@ -234,17 +243,17 @@ public void onSwitchSegmentedAnimationStarted(boolean thanos) { } public Bitmap getSegmentedOutBitmap() { - if (!(centerImage.getImageDrawable() instanceof BitmapDrawable)) + if (bitmap == null) return null; - Bitmap source = ((BitmapDrawable) centerImage.getImageDrawable()).getBitmap(); + Bitmap source = bitmap; Bitmap mask = segmentedImage; if (source == null || mask == null) return null; int w = source.getWidth(), h = source.getHeight(); - if (orientation == 90 || orientation == 270 || orientation == -90 || orientation == -270) { + if ((orientation / 90) % 2 == 1) { w = source.getHeight(); h = source.getWidth(); } @@ -278,13 +287,13 @@ public Bitmap getSegmentedOutBitmap() { @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); - centerImage.onDetachedFromWindow(); +// centerImage.onDetachedFromWindow(); } @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); - centerImage.onAttachedToWindow(); +// centerImage.onAttachedToWindow(); } public int getAnchor() { @@ -326,9 +335,13 @@ public void toggleSegmented(boolean animated) { } } - protected void updatePosition() { + public void updatePosition() { float halfWidth = baseSize.width / 2.0f; float halfHeight = baseSize.height / 2.0f; + if (crop != null) { + halfWidth *= crop.cropPw; + halfHeight *= crop.cropPh; + } setX(getPositionX() - halfWidth); setY(getPositionY() - halfHeight); updateSelectionView(); @@ -345,6 +358,8 @@ protected void updatePosition() { private Paint highlightPaint; private boolean needHighlight; + private final Paint bitmapPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG); + protected void stickerDraw(Canvas canvas) { if (containerView == null) { return; @@ -357,9 +372,36 @@ protected void stickerDraw(Canvas canvas) { final float segmentedT = this.segmentedT.set(segmented); if (!segmented) { - centerImage.setAlpha(1f - segmentedT); - centerImage.setImageCoords(0, 0, (int) baseSize.width, (int) baseSize.height); - centerImage.draw(canvas); + canvas.save(); + bitmapPaint.setAlpha((int) (0xFF * (1f - segmentedT))); + if (bitmap != null) { + canvas.translate(containerView.getWidth() / 2.0f, containerView.getHeight() / 2.0f); + canvas.rotate(orientation); + float scale = Math.max(baseSize.width / bitmap.getWidth(), baseSize.height / bitmap.getHeight()); + canvas.scale(scale, scale); + if (crop != null) { + canvas.rotate(-getOrientation()); + int w = getContentWidth(), h = getContentHeight(); + if (((getOrientation() + crop.transformRotation) / 90) % 2 == 1) { + w = getContentHeight(); + h = getContentWidth(); + } + canvas.clipRect( + -w * crop.cropPw / 2.0f, -h * crop.cropPh / 2.0f, + +w * crop.cropPw / 2.0f, +h * crop.cropPh / 2.0f + ); + canvas.scale(crop.cropScale, crop.cropScale); + canvas.translate(crop.cropPx * w, crop.cropPy * h); + canvas.rotate(crop.cropRotate + crop.transformRotation); + if (crop.mirrored) { + canvas.scale(-1, 1); + } + canvas.rotate(getOrientation()); + } + canvas.translate(-bitmap.getWidth() / 2.0f, -bitmap.getHeight() / 2.0f); + canvas.drawBitmap(bitmap, 0, 0, bitmapPaint); + } + canvas.restore(); if (segmentedT > 0) { drawSegmented(canvas); } @@ -399,9 +441,10 @@ protected void stickerDraw(Canvas canvas) { highlightStart = -1; needHighlight = false; if (!overridenSegmented) { - centerImage.setImageCoords(0, 0, (int) baseSize.width, (int) baseSize.height); - centerImage.setAlpha(1f); - centerImage.draw(canvas); + // TODO +// centerImage.setImageCoords(0, 0, (int) baseSize.width, (int) baseSize.height); +// centerImage.setAlpha(1f); +// centerImage.draw(canvas); } drawSegmented(canvas); } @@ -409,6 +452,28 @@ protected void stickerDraw(Canvas canvas) { canvas.restore(); } + private void applyCrop(Canvas canvas) { + if (crop != null) { + canvas.rotate(-getOrientation()); + int w = getContentWidth(), h = getContentHeight(); + if (((getOrientation() + crop.transformRotation) / 90) % 2 == 1) { + w = getContentHeight(); + h = getContentWidth(); + } + canvas.clipRect( + -w * crop.cropPw / 2.0f, -h * crop.cropPh / 2.0f, + +w * crop.cropPw / 2.0f, +h * crop.cropPh / 2.0f + ); + canvas.scale(crop.cropScale, crop.cropScale); + canvas.translate(crop.cropPx * w, crop.cropPy * h); + canvas.rotate(crop.cropRotate + crop.transformRotation); + if (crop.mirrored) { + canvas.scale(-1, 1); + } + canvas.rotate(getOrientation()); + } + } + private Path roundRectPath; private void drawSegmented(Canvas canvas) { if (segmentedImage == null) return; @@ -446,22 +511,18 @@ public void highlightSegmented() { } } - public long getDuration() { - RLottieDrawable rLottieDrawable = centerImage.getLottieAnimation(); - if (rLottieDrawable != null) { - return rLottieDrawable.getDuration(); - } - AnimatedFileDrawable animatedFileDrawable = centerImage.getAnimation(); - if (animatedFileDrawable != null) { - return animatedFileDrawable.getDurationMs(); - } - return 0; - - } - @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - super.onMeasure(MeasureSpec.makeMeasureSpec((int) baseSize.width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec((int) baseSize.height, MeasureSpec.EXACTLY)); + float w = baseSize.width; + float h = baseSize.height; + if (crop != null) { + w *= crop.cropPw; + h *= crop.cropPh; + } + super.onMeasure( + MeasureSpec.makeMeasureSpec((int) w, MeasureSpec.EXACTLY), + MeasureSpec.makeMeasureSpec((int) h, MeasureSpec.EXACTLY) + ); } @Override @@ -473,8 +534,10 @@ public Rect getSelectionBounds() { float scale = parentView.getScaleX(); float width = getMeasuredWidth() * getScale() + dp(64) / scale; float height = getMeasuredHeight() * getScale() + dp(64) / scale; + float pwidth = getMeasuredWidth() * getScale() + dp(64) / scale; + float pheight = getMeasuredHeight() * getScale() + dp(64) / scale; float left = (getPositionX() - width / 2.0f) * scale; - float right = left + width * scale; + float right = left + pwidth * scale; return new Rect(left, (getPositionY() - height / 2.0f) * scale, right - left, height * scale); } @@ -588,4 +651,26 @@ protected void onDraw(Canvas canvas) { canvas.restoreToCount(count); } } + + public MediaController.CropState crop; + + public int getOrientation() { + return orientation; + } + + public int getContentWidth() { + if (bitmap == null) return 1; + return bitmap.getWidth(); + } + + public int getContentHeight() { + if (bitmap == null) return 1; + return bitmap.getHeight(); + } + + public void drawContent(Canvas canvas) { + if (bitmap == null) return; + bitmapPaint.setAlpha((int) (0xFF)); + canvas.drawBitmap(bitmap, 0, 0, bitmapPaint); + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/PaintingOverlay.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/PaintingOverlay.java index 52973e071b..754c75d226 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/PaintingOverlay.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/PaintingOverlay.java @@ -5,7 +5,6 @@ import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; -import android.graphics.Typeface; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Build; @@ -33,8 +32,6 @@ import java.util.ArrayList; import java.util.HashMap; -import java.util.Map; -import java.util.Set; public class PaintingOverlay extends FrameLayout { @@ -226,7 +223,7 @@ public boolean onTouchEvent(MotionEvent event) { editText.setPadding(AndroidUtilities.dp(7), AndroidUtilities.dp(7), AndroidUtilities.dp(7), AndroidUtilities.dp(7)); editText.setTextSize(TypedValue.COMPLEX_UNIT_PX, entity.fontSize); editText.setTypeface(entity.textTypeface.getTypeface()); - SpannableString text = new SpannableString(Emoji.replaceEmoji(entity.text, editText.getPaint().getFontMetricsInt(), (int) (editText.getTextSize() * .8f), false)); + SpannableString text = new SpannableString(Emoji.replaceEmoji(entity.text, editText.getPaint().getFontMetricsInt(), false)); for (VideoEditedInfo.EmojiEntity e : entity.entities) { text.setSpan(new AnimatedEmojiSpan(e.document_id, editText.getPaint().getFontMetricsInt()), e.offset, e.offset + e.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/PasscodeView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/PasscodeView.java index 87fbabe6f7..88679526e6 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/PasscodeView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/PasscodeView.java @@ -1373,7 +1373,11 @@ public void onGlobalLayout() { imageView.getAnimatedDrawable().setCustomEndFrame(37); imageView.playAnimation(); showPin(true); - AndroidUtilities.runOnUIThread(() -> imageView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING), 350); + AndroidUtilities.runOnUIThread(() -> { + try { + imageView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignore) {} + }, 350); AnimatorSet animatorSet = new AnimatorSet(); ArrayList animators = new ArrayList<>(); int w = AndroidUtilities.displaySize.x; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoFilterView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoFilterView.java index 298d86b466..9840cb6322 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoFilterView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoFilterView.java @@ -49,6 +49,8 @@ import org.telegram.messenger.SharedConfig; import org.telegram.messenger.Utilities; import org.telegram.tgnet.AbstractSerializedData; +import org.telegram.tgnet.InputSerializedData; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.BubbleActivity; import org.telegram.ui.Cells.PhotoEditRadioCell; @@ -250,7 +252,7 @@ public boolean isDefault() { return Math.abs(blacksLevel - 0) < 0.00001 && Math.abs(shadowsLevel - 25) < 0.00001 && Math.abs(midtonesLevel - 50) < 0.00001 && Math.abs(highlightsLevel - 75) < 0.00001 && Math.abs(whitesLevel - 100) < 0.00001; } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeFloat(blacksLevel); stream.writeFloat(shadowsLevel); stream.writeFloat(midtonesLevel); @@ -258,7 +260,7 @@ public void serializeToStream(AbstractSerializedData stream) { stream.writeFloat(whitesLevel); } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { blacksLevel = previousBlacksLevel = stream.readFloat(exception); shadowsLevel = previousShadowsLevel = stream.readFloat(exception); midtonesLevel = previousMidtonesLevel = stream.readFloat(exception); @@ -306,14 +308,14 @@ public boolean shouldBeSkipped() { return luminanceCurve.isDefault() && redCurve.isDefault() && greenCurve.isDefault() && blueCurve.isDefault(); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { luminanceCurve.serializeToStream(stream); redCurve.serializeToStream(stream); greenCurve.serializeToStream(stream); blueCurve.serializeToStream(stream); } - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { luminanceCurve.readParams(stream, exception); redCurve.readParams(stream, exception); greenCurve.readParams(stream, exception); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerBlurDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerBlurDrawable.java new file mode 100644 index 0000000000..0e68b08d09 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerBlurDrawable.java @@ -0,0 +1,68 @@ +package org.telegram.ui.Components; + +import android.graphics.Canvas; +import android.graphics.Path; +import android.graphics.Rect; +import android.graphics.RectF; +import android.view.View; + +import androidx.annotation.NonNull; + +import org.telegram.messenger.R; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.PhotoViewer; + +public class PhotoViewerBlurDrawable extends CompatDrawable { + + private final PhotoViewer photoViewer; + private final View view; + private final BlurringShader.StoryBlurDrawer backgroundBlur; + + public PhotoViewerBlurDrawable(PhotoViewer photoViewer, BlurringShader.BlurManager blurManager, View view) { + super(view); + this.photoViewer = photoViewer; + this.view = view; + backgroundBlur = new BlurringShader.StoryBlurDrawer(blurManager, view, BlurringShader.StoryBlurDrawer.BLUR_TYPE_BACKGROUND, false); + } + + private int rounding = -1; + public void setRounding(int rounding) { + this.rounding = rounding; + } + + private boolean applyBounds = true; + public PhotoViewerBlurDrawable setApplyBounds(boolean v) { + applyBounds = v; + return this; + } + + private final Path path = new Path(); + private final RectF rect = new RectF(); + + @Override + public void draw(@NonNull Canvas canvas) { + final Rect bounds = getBounds(); + canvas.save(); + path.rewind(); + final float r; + final float alpha = (float) paint.getAlpha() / 0xFF; + if (rounding == -1) { + r = Math.min(bounds.width(), bounds.height()) / 2.0f; + } else { + r = rounding; + } + rect.set(bounds); + path.addRoundRect(rect, r, r, Path.Direction.CW); + canvas.clipPath(path); + View v = view; + while (v != null && v != photoViewer.windowView && v.getParent() instanceof View) { + canvas.translate(-v.getX(), -v.getY()); + v = (View) v.getParent(); + } + if (applyBounds) { + canvas.translate(rect.left, rect.top); + } + photoViewer.drawCaptionBlur(canvas, backgroundBlur, Theme.multAlpha(0xFF262626, alpha), Theme.multAlpha(0x33000000, alpha), false, true, false); + canvas.restore(); + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerCaptionEnterView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerCaptionEnterView.java index 64a3a5da47..dd918bf343 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerCaptionEnterView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerCaptionEnterView.java @@ -311,7 +311,7 @@ public void afterTextChanged(Editable editable) { for (int i = 0; i < spans.length; i++) { editable.removeSpan(spans[i]); } - Emoji.replaceEmoji(editable, messageEditText.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false); + Emoji.replaceEmoji(editable, messageEditText.getPaint().getFontMetricsInt(), false); processChange = false; } } @@ -735,7 +735,7 @@ public void onEmojiSelected(String symbol) { } try { innerTextChange = true; - CharSequence localCharSequence = Emoji.replaceEmoji(symbol, messageEditText.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false); + CharSequence localCharSequence = Emoji.replaceEmoji(symbol, messageEditText.getPaint().getFontMetricsInt(), false); messageEditText.setText(messageEditText.getText().insert(i, localCharSequence)); int j = i + localCharSequence.length(); messageEditText.setSelection(j, j); @@ -759,7 +759,7 @@ public void replaceWithText(int start, int len, CharSequence text, boolean parse SpannableStringBuilder builder = new SpannableStringBuilder(messageEditText.getText()); builder.replace(start, start + len, text); if (parseEmoji) { - Emoji.replaceEmoji(builder, messageEditText.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false); + Emoji.replaceEmoji(builder, messageEditText.getPaint().getFontMetricsInt(), false); } messageEditText.setText(builder); messageEditText.setSelection(Math.min(start + text.length(), messageEditText.length())); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerCoverEditor.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerCoverEditor.java new file mode 100644 index 0000000000..661122c742 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/PhotoViewerCoverEditor.java @@ -0,0 +1,104 @@ +package org.telegram.ui.Components; + +import android.content.Context; +import android.view.Gravity; +import android.widget.FrameLayout; + +import org.telegram.messenger.MediaController; +import org.telegram.messenger.Utilities; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.PhotoViewer; +import org.telegram.ui.Stories.recorder.ButtonWithCounterView; +import org.telegram.ui.Stories.recorder.GallerySheet; +import org.telegram.ui.Stories.recorder.TimelineView; + +public class PhotoViewerCoverEditor extends FrameLayout { + + public TimelineView timelineView; + public ButtonWithCounterView button; + public EditCoverButton openGalleryButton; + + private VideoPlayer videoPlayer; + private long time = -1; + private float aspectRatio = 1.39f; + + private GallerySheet gallerySheet; + + public PhotoViewerCoverEditor(Context context, Theme.ResourcesProvider resourcesProvider, PhotoViewer photoViewer, BlurringShader.BlurManager blurManager) { + super(context); + + timelineView = new TimelineView(context, null, null, resourcesProvider, blurManager); + timelineView.setCover(); + addView(timelineView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, TimelineView.heightDp(), Gravity.FILL_HORIZONTAL | Gravity.BOTTOM, 0, 0, 0, 16 + 48 + 10)); + + button = new ButtonWithCounterView(context, resourcesProvider); + button.setText("Save Cover", false); + addView(button, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.FILL_HORIZONTAL | Gravity.BOTTOM, 10, 10, 10, 10)); + + openGalleryButton = new EditCoverButton(context, photoViewer, "Choose from Gallery", true); + openGalleryButton.setOnClickListener(v -> { + if (gallerySheet == null) { + gallerySheet = new GallerySheet(context, resourcesProvider, aspectRatio); + gallerySheet.setOnDismissListener(() -> { + gallerySheet = null; + }); + gallerySheet.setOnGalleryImage(onGalleryListener); + } + gallerySheet.show(); + }); + addView(openGalleryButton, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 32, Gravity.FILL_HORIZONTAL | Gravity.BOTTOM, 60, 0, 60, 16 + 48 + 10 + 60)); + + timelineView.setDelegate(new TimelineView.TimelineDelegate() { + @Override + public void onVideoLeftChange(boolean released, float left) { + if (videoPlayer == null) return; + final long _duration = videoPlayer.getDuration(); + time = (long) ((left + 0.04f * (left / (1f - 0.04f))) * _duration); + videoPlayer.seekTo(time, !released); + } + }); + } + + public void set(MediaController.PhotoEntry entry, VideoPlayer player, Theme.ResourcesProvider resourcesProvider) { + button.updateColors(resourcesProvider); + + if (entry.width > 0 && entry.height > 0) { + aspectRatio = Utilities.clamp((float) entry.height / entry.width, 1.39f, 0.85f); + } else { + aspectRatio = 1.39f; + } + + this.videoPlayer = player; + time = entry.customThumb && entry.customThumbSavedPosition >= 0 ? entry.customThumbSavedPosition : player.getCurrentPosition(); + if (entry.customThumb) { + player.seekTo(time, false); + } + timelineView.setVideo(false, player.getCurrentUri().getPath(), player.getDuration(), player.player.getVolume()); + float left = (float) time / Math.max(1, player.getDuration()) * (1f - 0.04f); + timelineView.setVideoLeft(left); + timelineView.setVideoRight(left + 0.04f); + timelineView.setCoverVideo(0, player.getDuration()); + } + + public void closeGallery() { + if (gallerySheet != null) { + gallerySheet.dismiss(); + gallerySheet = null; + } + } + + private Utilities.Callback onGalleryListener; + public void setOnGalleryImage(Utilities.Callback listener) { + onGalleryListener = listener; + } + + public long getTime() { + return time; + } + + public void destroy() { + videoPlayer = null; + timelineView.setVideo(false, null, 0, 0); + } + +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/PickerBottomLayoutViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/PickerBottomLayoutViewer.java index c755a5daec..edf3f5a081 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/PickerBottomLayoutViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/PickerBottomLayoutViewer.java @@ -42,7 +42,7 @@ public PickerBottomLayoutViewer(Context context, boolean darkTheme) { cancelButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); cancelButton.setTextColor(isDarkTheme ? 0xffffffff : 0xff19a7e8); cancelButton.setGravity(Gravity.CENTER); - cancelButton.setBackgroundDrawable(Theme.createSelectorDrawable(isDarkTheme ? Theme.ACTION_BAR_PICKER_SELECTOR_COLOR : Theme.ACTION_BAR_AUDIO_SELECTOR_COLOR, 0)); + cancelButton.setBackground(Theme.createSelectorDrawable(isDarkTheme ? Theme.ACTION_BAR_PICKER_SELECTOR_COLOR : Theme.ACTION_BAR_AUDIO_SELECTOR_COLOR, 0)); cancelButton.setPadding(AndroidUtilities.dp(20), 0, AndroidUtilities.dp(20), 0); cancelButton.setText(LocaleController.getString(R.string.Cancel).toUpperCase()); cancelButton.setTypeface(AndroidUtilities.bold()); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/PollVotesAlert.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/PollVotesAlert.java index 0e57b13cbf..adedd12813 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/PollVotesAlert.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/PollVotesAlert.java @@ -229,11 +229,11 @@ public void setText(CharSequence left, ArrayList entities, NotificationCenter.listenEmojiLoading(textView); CharSequence answerText = new SpannableStringBuilder(left); MediaDataController.addTextStyleRuns(entities, left, (Spannable) answerText); - answerText = Emoji.replaceEmoji(answerText, textView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false); + answerText = Emoji.replaceEmoji(answerText, textView.getPaint().getFontMetricsInt(), false); MessageObject.replaceAnimatedEmoji(answerText, entities, textView.getPaint().getFontMetricsInt()); textView.setText(answerText); } else { - textView.setText(Emoji.replaceEmoji(left, textView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false)); + textView.setText(Emoji.replaceEmoji(left, textView.getPaint().getFontMetricsInt(), false)); } String p = String.format("%d", percent); SpannableStringBuilder builder; @@ -928,7 +928,7 @@ public void onScrollStateChanged(RecyclerView recyclerView, int newState) { MessageObject.replaceAnimatedEmoji(questionText, poll.question.entities, titleTextView.getPaint().getFontMetricsInt()); titleTextView.setText(questionText); } else { - titleTextView.setText(Emoji.replaceEmoji(poll.question == null ? "" : poll.question.text, titleTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(18), false)); + titleTextView.setText(Emoji.replaceEmoji(poll.question == null ? "" : poll.question.text, titleTextView.getPaint().getFontMetricsInt(), false)); } actionBar = new ActionBar(context) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/CarouselView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/CarouselView.java index a6bbd9c27f..289ea38155 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/CarouselView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/CarouselView.java @@ -101,7 +101,9 @@ public boolean onSingleTapUp(MotionEvent motionEvent) { toAngle = -(360 - toAngle); } scrollToInternal(offsetAngle + (float) toAngle); - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} } return true; } @@ -156,7 +158,9 @@ private void checkSelectedHaptic() { int selected = ((int) (offsetAngle / aStep)); if (lastSelected != selected) { lastSelected = selected; - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/DoubledLimitsBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/DoubledLimitsBottomSheet.java index 2bae5e3634..78f4b2acec 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/DoubledLimitsBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/DoubledLimitsBottomSheet.java @@ -276,52 +276,52 @@ public Adapter(int currentAccount, boolean drawHeader, Theme.ResourcesProvider r MessagesController messagesController = MessagesController.getInstance(currentAccount); limits.add(new Limit( LocaleController.getString(R.string.GroupsAndChannelsLimitTitle), - LocaleController.formatString("GroupsAndChannelsLimitSubtitle", R.string.GroupsAndChannelsLimitSubtitle, messagesController.channelsLimitPremium), + LocaleController.formatString(R.string.GroupsAndChannelsLimitSubtitle, messagesController.channelsLimitPremium), messagesController.channelsLimitDefault, messagesController.channelsLimitPremium )); limits.add(new Limit( LocaleController.getString(R.string.PinChatsLimitTitle), - LocaleController.formatString("PinChatsLimitSubtitle", R.string.PinChatsLimitSubtitle, messagesController.dialogFiltersPinnedLimitPremium), + LocaleController.formatString(R.string.PinChatsLimitSubtitle, messagesController.dialogFiltersPinnedLimitPremium), messagesController.dialogFiltersPinnedLimitDefault, messagesController.dialogFiltersPinnedLimitPremium )); limits.add(new Limit( LocaleController.getString(R.string.PublicLinksLimitTitle), - LocaleController.formatString("PublicLinksLimitSubtitle", R.string.PublicLinksLimitSubtitle, messagesController.publicLinksLimitPremium), + LocaleController.formatString(R.string.PublicLinksLimitSubtitle, messagesController.publicLinksLimitPremium), messagesController.publicLinksLimitDefault, messagesController.publicLinksLimitPremium )); limits.add(new Limit( LocaleController.getString(R.string.SavedGifsLimitTitle), - LocaleController.formatString("SavedGifsLimitSubtitle", R.string.SavedGifsLimitSubtitle, messagesController.savedGifsLimitPremium), + LocaleController.formatString(R.string.SavedGifsLimitSubtitle, messagesController.savedGifsLimitPremium), messagesController.savedGifsLimitDefault, messagesController.savedGifsLimitPremium )); limits.add(new Limit( LocaleController.getString(R.string.FavoriteStickersLimitTitle), - LocaleController.formatString("FavoriteStickersLimitSubtitle", R.string.FavoriteStickersLimitSubtitle, messagesController.stickersFavedLimitPremium), + LocaleController.formatString(R.string.FavoriteStickersLimitSubtitle, messagesController.stickersFavedLimitPremium), messagesController.stickersFavedLimitDefault, messagesController.stickersFavedLimitPremium )); limits.add(new Limit( LocaleController.getString(R.string.BioLimitTitle), - LocaleController.formatString("BioLimitSubtitle", R.string.BioLimitSubtitle, messagesController.stickersFavedLimitPremium), + LocaleController.formatString(R.string.BioLimitSubtitle, messagesController.stickersFavedLimitPremium), messagesController.aboutLengthLimitDefault, messagesController.aboutLengthLimitPremium )); limits.add(new Limit( LocaleController.getString(R.string.CaptionsLimitTitle), - LocaleController.formatString("CaptionsLimitSubtitle", R.string.CaptionsLimitSubtitle, messagesController.stickersFavedLimitPremium), + LocaleController.formatString(R.string.CaptionsLimitSubtitle, messagesController.stickersFavedLimitPremium), messagesController.captionLengthLimitDefault, messagesController.captionLengthLimitPremium )); limits.add(new Limit( LocaleController.getString(R.string.FoldersLimitTitle), - LocaleController.formatString("FoldersLimitSubtitle", R.string.FoldersLimitSubtitle, messagesController.dialogFiltersLimitPremium), + LocaleController.formatString(R.string.FoldersLimitSubtitle, messagesController.dialogFiltersLimitPremium), messagesController.dialogFiltersLimitDefault, messagesController.dialogFiltersLimitPremium )); limits.add(new Limit( LocaleController.getString(R.string.ChatPerFolderLimitTitle), - LocaleController.formatString("ChatPerFolderLimitSubtitle", R.string.ChatPerFolderLimitSubtitle, messagesController.dialogFiltersChatsLimitPremium), + LocaleController.formatString(R.string.ChatPerFolderLimitSubtitle, messagesController.dialogFiltersChatsLimitPremium), messagesController.dialogFiltersChatsLimitDefault, messagesController.dialogFiltersChatsLimitPremium )); limits.add(new Limit( LocaleController.getString(R.string.ConnectedAccountsLimitTitle), - LocaleController.formatString("ConnectedAccountsLimitSubtitle", R.string.ConnectedAccountsLimitSubtitle, 4), + LocaleController.formatString(R.string.ConnectedAccountsLimitSubtitle, 4), UserConfig.MAX_ACCOUNT_DEFAULT_COUNT, UserConfig.MAX_ACCOUNT_COUNT )); limits.add(new Limit( diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/GLIcon/Icon3D.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/GLIcon/Icon3D.java index 434b939572..6daf73c5db 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/GLIcon/Icon3D.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/GLIcon/Icon3D.java @@ -72,6 +72,7 @@ public class Icon3D { int resolutionHandle; int gradientPositionHandle; int modelIndexHandle; + int typeHandle; int nightHandle; int timeHandle; @@ -195,6 +196,7 @@ private void init(Context context) { resolutionHandle = GLES20.glGetUniformLocation(mProgramObject, "resolution"); gradientPositionHandle = GLES20.glGetUniformLocation(mProgramObject, "gradientPosition"); modelIndexHandle = GLES20.glGetUniformLocation(mProgramObject, "modelIndex"); + typeHandle = GLES20.glGetUniformLocation(mProgramObject, "type"); nightHandle = GLES20.glGetUniformLocation(mProgramObject, "night"); timeHandle = GLES20.glGetUniformLocation(mProgramObject, "time"); @@ -250,35 +252,15 @@ private void init(Context context) { GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mBackgroundTextureHandle); + Bitmap bitmap = null; if (type == TYPE_STAR || type == TYPE_GOLDEN_STAR) { - Bitmap bitmap; -// if (type == TYPE_GOLDEN_STAR) { - bitmap = SvgHelper.getBitmap(R.raw.start_texture, 240, 240, Color.WHITE); -// } else { -// bitmap = SvgHelper.getBitmap(R.raw.start_texture, 80, 80, Color.WHITE); -// Utilities.stackBlurBitmap(bitmap, 3); -// } - - final int[] texture = new int[1]; - GLES20.glGenTextures(1, texture, 0); - GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texture[0]); - - GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR); - GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR); - - GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0); - bitmap.recycle(); - - GLES20.glActiveTexture(GLES20.GL_TEXTURE0); - GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texture[0]); - GLES20.glUniform1i(mTextureUniformHandle, 0); - - GLES20.glActiveTexture(GLES20.GL_TEXTURE1); - GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, normalMap[0]); - GLES20.glUniform1i(mNormalMapUniformHandle, 1); + bitmap = SvgHelper.getBitmap(R.raw.start_texture, 240, 240, Color.WHITE); } else if (type == TYPE_COIN) { - Bitmap bitmap = getBitmapFromAsset(context, "models/coin_border.png"); - + bitmap = getBitmapFromAsset(context, "models/coin_border.png"); + } else if (type == TYPE_DEAL) { + bitmap = getBitmapFromAsset(context, "models/deal_border.png"); + } + if (bitmap != null) { final int[] texture = new int[1]; GLES20.glGenTextures(1, texture, 0); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texture[0]); @@ -361,6 +343,7 @@ public void draw(float[] mvpMatrix, float[] worldMatrix, int width, int height, GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, buffers[3 * i + 2]); GLES20.glVertexAttribPointer(mVerticesHandle, 3, GLES20.GL_FLOAT, false, 0, 0); GLES20.glUniform1i(modelIndexHandle, i); + GLES20.glUniform1i(typeHandle, type); GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, trianglesCount[i] / 3); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/LimitPreviewView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/LimitPreviewView.java index a5c6380d7e..9f8e3b2951 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/LimitPreviewView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/LimitPreviewView.java @@ -405,7 +405,9 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) { if (v > 1f && animatingRotate) { if (!wasHaptic) { wasHaptic = true; - limitIcon.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + limitIcon.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} } limitIcon.setRotation(limitIconRotation + (v - 1f) * 60); } else if (!animatingRotation) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/LimitReachedBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/LimitReachedBottomSheet.java index cec3453ef9..ccc96e58cb 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/LimitReachedBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/LimitReachedBottomSheet.java @@ -140,8 +140,9 @@ public class LimitReachedBottomSheet extends BottomSheetWithRecyclerListView imp public static final int TYPE_BOOSTS_FOR_CUSTOM_WALLPAPER = 23; public static final int TYPE_BOOSTS_FOR_PROFILE_COLOR = 24; public static final int TYPE_BOOSTS_FOR_EMOJI_STATUS = 25; - public static final int TYPE_BOOSTS_FOR_REPLY_ICON = 26; - public static final int TYPE_BOOSTS_FOR_PROFILE_ICON = 27; + public static final int TYPE_BOOSTS_FOR_WEAR_COLLECTIBLE = 26; + public static final int TYPE_BOOSTS_FOR_REPLY_ICON = 27; + public static final int TYPE_BOOSTS_FOR_PROFILE_ICON = 28; public static final int TYPE_BOOSTS_FOR_CUSTOM_EMOJI_PACK = 29; public static final int TYPE_BOOSTS_FOR_ADS = 30; public static final int TYPE_FEATURES = 31; @@ -334,6 +335,7 @@ public LimitReachedBottomSheet(BaseFragment fragment, Context context, int type, type == TYPE_BOOSTS_FOR_COLOR || type == TYPE_BOOSTS_FOR_PROFILE_COLOR || type == TYPE_BOOSTS_FOR_EMOJI_STATUS || + type == TYPE_BOOSTS_FOR_WEAR_COLLECTIBLE || type == TYPE_BOOSTS_FOR_CUSTOM_EMOJI_PACK || type == TYPE_BOOSTS_FOR_WALLPAPER || type == TYPE_BOOSTS_FOR_CUSTOM_WALLPAPER || @@ -425,6 +427,7 @@ public void invalidate() { type == TYPE_BOOSTS_FOR_COLOR || type == TYPE_BOOSTS_FOR_PROFILE_COLOR || type == TYPE_BOOSTS_FOR_EMOJI_STATUS || + type == TYPE_BOOSTS_FOR_WEAR_COLLECTIBLE || type == TYPE_BOOSTS_FOR_CUSTOM_EMOJI_PACK || type == TYPE_BOOSTS_FOR_WALLPAPER || type == TYPE_BOOSTS_FOR_CUSTOM_WALLPAPER || @@ -488,7 +491,9 @@ protected void onDraw(Canvas canvas) { recyclerListView.setOnItemLongClickListener((view, position) -> { recyclerListView.getOnItemClickListener().onItemClick(view, position); if (type != TYPE_BOOSTS_FOR_USERS) { - view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} } return false; }); @@ -603,6 +608,7 @@ protected void onDraw(Canvas canvas) { type == TYPE_BOOSTS_FOR_COLOR || type == TYPE_BOOSTS_FOR_PROFILE_COLOR || type == TYPE_BOOSTS_FOR_EMOJI_STATUS || + type == TYPE_BOOSTS_FOR_WEAR_COLLECTIBLE || type == TYPE_BOOSTS_FOR_CUSTOM_EMOJI_PACK || type == TYPE_BOOSTS_FOR_WALLPAPER || type == TYPE_BOOSTS_FOR_CUSTOM_WALLPAPER || @@ -800,7 +806,9 @@ public Animator onDisappear(ViewGroup sceneRoot, View view, TransitionValues sta headerView.description.setText(AndroidUtilities.replaceTags(getBoostDescriptionStringAfterBoost())); updateButton(); fireworksOverlay.start(); - fireworksOverlay.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + fireworksOverlay.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} headerView.boostCounterView.setCount(canApplyBoost.boostCount, true); recyclerListView.smoothScrollToPosition(0); if (type == TYPE_BOOSTS_FOR_REMOVE_RESTRICTIONS) { @@ -867,6 +875,7 @@ public void updatePremiumButtonText() { type == TYPE_BOOSTS_FOR_COLOR || type == TYPE_BOOSTS_FOR_PROFILE_COLOR || type == TYPE_BOOSTS_FOR_EMOJI_STATUS || + type == TYPE_BOOSTS_FOR_WEAR_COLLECTIBLE || type == TYPE_BOOSTS_FOR_CUSTOM_EMOJI_PACK || type == TYPE_BOOSTS_FOR_WALLPAPER || type == TYPE_BOOSTS_FOR_CUSTOM_WALLPAPER || @@ -1034,6 +1043,7 @@ public CharSequence getTitle() { case TYPE_BOOSTS_FOR_CUSTOM_WALLPAPER: case TYPE_BOOSTS_FOR_REACTIONS: case TYPE_BOOSTS_FOR_EMOJI_STATUS: + case TYPE_BOOSTS_FOR_WEAR_COLLECTIBLE: case TYPE_BOOSTS_FOR_CUSTOM_EMOJI_PACK: case TYPE_BOOSTS_FOR_REPLY_ICON: case TYPE_BOOSTS_FOR_PROFILE_ICON: @@ -1458,6 +1468,7 @@ private boolean isBoostingForAdminPossible() { || type == TYPE_BOOSTS_FOR_COLOR || type == TYPE_BOOSTS_FOR_PROFILE_COLOR || type == TYPE_BOOSTS_FOR_EMOJI_STATUS + || type == TYPE_BOOSTS_FOR_WEAR_COLLECTIBLE || type == TYPE_BOOSTS_FOR_CUSTOM_EMOJI_PACK || type == TYPE_BOOSTS_FOR_WALLPAPER || type == TYPE_BOOSTS_FOR_REPLY_ICON @@ -1626,6 +1637,11 @@ public HeaderView(Context context) { isGroup ? R.string.GroupNeedBoostsForEmojiStatusDescription : R.string.ChannelNeedBoostsForEmojiStatusDescription, isGroup ? messagesController.groupEmojiStatusLevelMin : messagesController.channelEmojiStatusLevelMin ); + } else if (type == TYPE_BOOSTS_FOR_WEAR_COLLECTIBLE) { + descriptionStr = LocaleController.formatString( + isGroup ? R.string.GroupNeedBoostsForWearCollectiblesDescription : R.string.ChannelNeedBoostsForWearCollectiblesDescription, + isGroup ? messagesController.groupEmojiStatusLevelMin : messagesController.channelEmojiStatusLevelMin + ); } else if (type == TYPE_BOOSTS_FOR_REPLY_ICON) { descriptionStr = LocaleController.formatString( isGroup ? R.string.GroupNeedBoostsForReplyIconDescription : R.string.ChannelNeedBoostsForReplyIconDescription, @@ -1733,6 +1749,7 @@ public HeaderView(Context context) { type == TYPE_BOOSTS_FOR_COLOR || type == TYPE_BOOSTS_FOR_PROFILE_COLOR || type == TYPE_BOOSTS_FOR_EMOJI_STATUS || + type == TYPE_BOOSTS_FOR_WEAR_COLLECTIBLE || type == TYPE_BOOSTS_FOR_CUSTOM_EMOJI_PACK || type == TYPE_BOOSTS_FOR_WALLPAPER || type == TYPE_BOOSTS_FOR_CUSTOM_WALLPAPER || @@ -1949,6 +1966,8 @@ public void invalidate() { title.setText(LocaleController.getString(R.string.BoostingEnableProfileIcon)); } else if (type == TYPE_BOOSTS_FOR_EMOJI_STATUS) { title.setText(LocaleController.getString(R.string.BoostingEnableEmojiStatus)); + } else if (type == TYPE_BOOSTS_FOR_WEAR_COLLECTIBLE) { + title.setText(LocaleController.getString(R.string.BoostingEnableWearCollectibles)); } else if (type == TYPE_BOOSTS_FOR_CUSTOM_EMOJI_PACK) { title.setText(LocaleController.getString(R.string.BoostingEnableGroupEmojiPack)); } else if (type == TYPE_BOOSTS_FOR_WALLPAPER || type == TYPE_BOOSTS_FOR_CUSTOM_WALLPAPER) { @@ -2172,6 +2191,11 @@ private String getBoostDescriptionStringAfterBoost() { isGroup ? R.string.GroupNeedBoostsForEmojiStatusDescription : R.string.ChannelNeedBoostsForEmojiStatusDescription, isGroup ? messagesController.groupEmojiStatusLevelMin : messagesController.channelEmojiStatusLevelMin ); + } else if (type == TYPE_BOOSTS_FOR_WEAR_COLLECTIBLE) { + descriptionStr = LocaleController.formatString( + isGroup ? R.string.GroupNeedBoostsForWearCollectiblesDescription : R.string.ChannelNeedBoostsForWearCollectiblesDescription, + isGroup ? messagesController.groupEmojiStatusLevelMin : messagesController.channelEmojiStatusLevelMin + ); } else if (type == TYPE_BOOSTS_FOR_REPLY_ICON) { descriptionStr = LocaleController.formatString( isGroup ? R.string.GroupNeedBoostsForReplyIconDescription : R.string.ChannelNeedBoostsForReplyIconDescription, @@ -2366,7 +2390,7 @@ private static LimitParams getLimitParams(int type, int currentAccount) { limitParams.descriptionStr = LocaleController.formatString("LimitReachedStoriesMonthly", R.string.LimitReachedStoriesMonthly, limitParams.defaultLimit, limitParams.premiumLimit); limitParams.descriptionStrPremium = LocaleController.formatString("LimitReachedStoriesMonthlyPremium", R.string.LimitReachedStoriesMonthlyPremium, limitParams.premiumLimit); limitParams.descriptionStrLocked = LocaleController.formatString("LimitReachedStoriesMonthlyPremium", R.string.LimitReachedStoriesMonthlyPremium, limitParams.defaultLimit); - } else if (type == TYPE_BOOSTS_FOR_POSTING || type == TYPE_BOOSTS_FOR_REMOVE_RESTRICTIONS || type == TYPE_BOOSTS_FOR_COLOR || type == TYPE_BOOSTS_FOR_PROFILE_COLOR || type == TYPE_BOOSTS_FOR_REPLY_ICON || type == TYPE_BOOSTS_FOR_PROFILE_ICON || type == TYPE_BOOSTS_FOR_EMOJI_STATUS || type == TYPE_BOOSTS_FOR_ADS || type == TYPE_BOOSTS_FOR_CUSTOM_EMOJI_PACK || type == TYPE_BOOSTS_FOR_WALLPAPER || type == TYPE_BOOSTS_FOR_CUSTOM_WALLPAPER || type == TYPE_BOOSTS_FOR_USERS || type == TYPE_BOOSTS_FOR_REACTIONS) { + } else if (type == TYPE_BOOSTS_FOR_POSTING || type == TYPE_BOOSTS_FOR_REMOVE_RESTRICTIONS || type == TYPE_BOOSTS_FOR_COLOR || type == TYPE_BOOSTS_FOR_PROFILE_COLOR || type == TYPE_BOOSTS_FOR_REPLY_ICON || type == TYPE_BOOSTS_FOR_PROFILE_ICON || type == TYPE_BOOSTS_FOR_EMOJI_STATUS || type == TYPE_BOOSTS_FOR_ADS || type == TYPE_BOOSTS_FOR_CUSTOM_EMOJI_PACK || type == TYPE_BOOSTS_FOR_WALLPAPER || type == TYPE_BOOSTS_FOR_CUSTOM_WALLPAPER || type == TYPE_BOOSTS_FOR_USERS || type == TYPE_BOOSTS_FOR_REACTIONS || type == TYPE_BOOSTS_FOR_WEAR_COLLECTIBLE) { limitParams.defaultLimit = MessagesController.getInstance(currentAccount).storiesSentMonthlyLimitDefault; limitParams.premiumLimit = MessagesController.getInstance(currentAccount).storiesSentMonthlyLimitPremium; limitParams.icon = R.drawable.filled_limit_boost; @@ -2433,6 +2457,7 @@ private void updateRows() { type == TYPE_BOOSTS_FOR_WALLPAPER || type == TYPE_BOOSTS_FOR_CUSTOM_WALLPAPER || type == TYPE_BOOSTS_FOR_EMOJI_STATUS || + type == TYPE_BOOSTS_FOR_WEAR_COLLECTIBLE || type == TYPE_BOOSTS_FOR_CUSTOM_EMOJI_PACK || type == TYPE_BOOSTS_FOR_REACTIONS || type == TYPE_BOOSTS_FOR_ADS diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/PremiumLockIconView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/PremiumLockIconView.java index ec69a8f6c1..dd59ef5b4c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/PremiumLockIconView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/PremiumLockIconView.java @@ -100,6 +100,9 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { public void setColor(int color) { colorRetrieved = true; + if (blendColor != null) { + color = Theme.blendOver(color, blendColor); + } if (currentColor != color) { currentColor = color; if (type == TYPE_REACTIONS || type == TYPE_REACTIONS_LOCK) { @@ -275,6 +278,11 @@ public void setWaitingImage() { invalidate(); } + private Integer blendColor; + public void setBlendWithColor(Integer color) { + blendColor = color; + } + public boolean done() { return colorRetrieved; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/PremiumStickersPreviewRecycler.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/PremiumStickersPreviewRecycler.java index 8eaba8cafb..0b6215189e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/PremiumStickersPreviewRecycler.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/PremiumStickersPreviewRecycler.java @@ -205,7 +205,9 @@ protected void dispatchDraw(Canvas canvas) { } else if (oldSelectedView != sortedView.get(sortedView.size() - 1)) { oldSelectedView = sortedView.get(sortedView.size() - 1); if (haptic) { - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} } } for (int i = 0; i < sortedView.size(); i++) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/BoostDialogs.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/BoostDialogs.java index 2f9f50c3bf..cd7120d9eb 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/BoostDialogs.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/BoostDialogs.java @@ -93,8 +93,7 @@ public static void processApplyGiftCodeError(TLRPC.TL_error error, FrameLayout c ).show(); try { containerLayout.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - } catch (Exception ignore) { - } + } catch (Exception ignore) {} } else { BoostDialogs.showToastError(containerLayout.getContext(), error); } @@ -313,9 +312,7 @@ public CharSequence getAccessibilityClassName() { final NumberPicker.OnValueChangeListener onValueChangeListener = (picker, oldVal, newVal) -> { try { container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - } catch (Exception ignore) { - - } + } catch (Exception ignore) {} if (picker.getTag() != null && (picker.getTag().equals("DAY"))) { if (picker.getValue() == picker.getMinValue()) { Calendar calendarCurrent = Calendar.getInstance(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/BoostRepository.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/BoostRepository.java index 727d78a299..c186cbf980 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/BoostRepository.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/BoostRepository.java @@ -27,6 +27,7 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import org.telegram.tgnet.tl.TL_stories; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.bots.BotWebViewSheet; @@ -600,12 +601,12 @@ public static int loadGiftOptions(int currentAccount, TLRPC.Chat chat, Utilities } return connection.sendRequest(req, (response, error) -> { - if (response != null) { - TLRPC.Vector vector = (TLRPC.Vector) response; - List result = new ArrayList<>(); - List products = new ArrayList<>(); + if (response instanceof Vector) { + final Vector vector = (Vector) response; + final List result = new ArrayList<>(); + final List products = new ArrayList<>(); for (int i = 0; i < vector.objects.size(); i++) { - final TLRPC.TL_premiumGiftCodeOption object = (TLRPC.TL_premiumGiftCodeOption) vector.objects.get(i); + final TLRPC.TL_premiumGiftCodeOption object = vector.objects.get(i); result.add(object); if (object.store_product != null) { products.add(QueryProductDetailsParams.Product.newBuilder() @@ -645,7 +646,33 @@ public static int loadGiftOptions(int currentAccount, TLRPC.Chat chat, Utilities }); } - public static int searchContacts(int reqId, String query, Utilities.Callback> onDone) { + public static int searchContacts(String query, boolean allowBots, Utilities.Callback> onDone) { + MessagesController controller = MessagesController.getInstance(UserConfig.selectedAccount); + ConnectionsManager connection = ConnectionsManager.getInstance(UserConfig.selectedAccount); + if (query == null || query.isEmpty()) { + AndroidUtilities.runOnUIThread(() -> onDone.run(Collections.emptyList())); + return 0; + } + TLRPC.TL_contacts_search req = new TLRPC.TL_contacts_search(); + req.q = query; + req.limit = 50; + return connection.sendRequest(req, (response, error) -> { + if (response instanceof TLRPC.TL_contacts_found) { + TLRPC.TL_contacts_found res = (TLRPC.TL_contacts_found) response; + controller.putUsers(res.users, false); + List result = new ArrayList<>(); + for (int a = 0; a < res.users.size(); a++) { + TLRPC.User user = res.users.get(a); + if (!user.self && !UserObject.isDeleted(user) && (allowBots || !user.bot) && !UserObject.isService(user.id)) { + result.add(user); + } + } + AndroidUtilities.runOnUIThread(() -> onDone.run(result)); + } + }); + } + + public static void searchContactsLocally(String query, boolean allowBots, Utilities.Callback> onDone) { final int currentAccount = UserConfig.selectedAccount; final ArrayList users = new ArrayList<>(); final ArrayList contacts = ContactsController.getInstance(currentAccount).contacts; @@ -660,7 +687,7 @@ public static int searchContacts(int reqId, String query, Utilities.Callback onDone.run(Collections.emptyList())); -// return 0; -// } -// TLRPC.TL_contacts_search req = new TLRPC.TL_contacts_search(); -// req.q = query; -// req.limit = 50; -// return connection.sendRequest(req, (response, error) -> { -// if (response instanceof TLRPC.TL_contacts_found) { -// TLRPC.TL_contacts_found res = (TLRPC.TL_contacts_found) response; -// controller.putUsers(res.users, false); -// List result = new ArrayList<>(); -// for (int a = 0; a < res.users.size(); a++) { -// TLRPC.User user = res.users.get(a); -// if (!user.self && !UserObject.isDeleted(user) && !user.bot && !UserObject.isService(user.id)) { -// result.add(user); -// } -// } -// AndroidUtilities.runOnUIThread(() -> onDone.run(result)); -// } -// }); } public static void searchChats(long currentChatId, int guid, String query, int count, Utilities.Callback> onDone) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/BoostViaGiftsBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/BoostViaGiftsBottomSheet.java index c261928cf2..82278256e5 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/BoostViaGiftsBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/BoostViaGiftsBottomSheet.java @@ -24,6 +24,7 @@ import org.telegram.messenger.Utilities; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_payments; import org.telegram.tgnet.tl.TL_stars; import org.telegram.tgnet.tl.TL_stories; import org.telegram.ui.ActionBar.BaseFragment; @@ -421,7 +422,11 @@ private void loadOptions() { private void updateActionButton(boolean animated) { if (isPreparedGiveaway()) { - actionBtn.setStartGiveAwayStyle(prepaidGiveaway.quantity * BoostRepository.giveawayBoostsPerPremium(), animated); + if (prepaidGiveaway instanceof TL_stories.TL_prepaidStarsGiveaway) { + actionBtn.setStartGiveAwayStyle(prepaidGiveaway.quantity, animated); + } else { + actionBtn.setStartGiveAwayStyle(prepaidGiveaway.quantity * BoostRepository.giveawayBoostsPerPremium(), animated); + } } else { if (selectedBoostSubType == BoostTypeCell.TYPE_GIVEAWAY) { actionBtn.setStartGiveAwayStyle(getSelectedSliderValueWithBoosts(), animated); @@ -611,7 +616,11 @@ private void updateRows(boolean animated, boolean notify) { items.add(Item.asSubTitle(getString(R.string.BoostingChannelsGroupsIncludedGiveaway))); if (isPreparedGiveaway()) { - items.add(Item.asChat(currentChat, false, prepaidGiveaway.quantity * BoostRepository.giveawayBoostsPerPremium())); + if (prepaidGiveaway instanceof TL_stories.TL_prepaidStarsGiveaway) { + items.add(Item.asChat(currentChat, false, prepaidGiveaway.quantity)); + } else { + items.add(Item.asChat(currentChat, false, prepaidGiveaway.quantity * BoostRepository.giveawayBoostsPerPremium())); + } } else { items.add(Item.asChat(currentChat, false, getSelectedSliderValueWithBoosts())); } @@ -640,7 +649,11 @@ private void updateRows(boolean animated, boolean notify) { } items.add(Item.asSubTitle(getString(R.string.BoostingChannelsGroupsIncludedGiveaway))); if (isPreparedGiveaway()) { - items.add(Item.asChat(currentChat, false, prepaidGiveaway.quantity * BoostRepository.giveawayBoostsPerPremium())); + if (prepaidGiveaway instanceof TL_stories.TL_prepaidStarsGiveaway) { + items.add(Item.asChat(currentChat, false, prepaidGiveaway.quantity)); + } else { + items.add(Item.asChat(currentChat, false, prepaidGiveaway.quantity * BoostRepository.giveawayBoostsPerPremium())); + } } else { items.add(Item.asChat(currentChat, false, getSelectedSliderValueWithBoosts())); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/UserSelectorBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/UserSelectorBottomSheet.java index d4b116a957..fa1ea8e1a5 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/UserSelectorBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/UserSelectorBottomSheet.java @@ -1,6 +1,7 @@ package org.telegram.ui.Components.Premium.boosts; import static org.telegram.messenger.AndroidUtilities.dp; +import static org.telegram.messenger.LocaleController.formatPluralString; import static org.telegram.messenger.LocaleController.getString; import android.annotation.SuppressLint; @@ -9,6 +10,7 @@ import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Rect; +import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.text.SpannableStringBuilder; @@ -29,7 +31,9 @@ import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.BirthdayController; +import org.telegram.messenger.ChatObject; import org.telegram.messenger.ContactsController; +import org.telegram.messenger.DialogObject; import org.telegram.messenger.LocaleController; import org.telegram.messenger.MediaDataController; import org.telegram.messenger.MessagesController; @@ -38,9 +42,12 @@ import org.telegram.messenger.R; import org.telegram.messenger.UserConfig; import org.telegram.messenger.UserObject; +import org.telegram.messenger.Utilities; import org.telegram.messenger.browser.Browser; import org.telegram.tgnet.ConnectionsManager; +import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.Theme; @@ -50,6 +57,7 @@ import org.telegram.ui.Components.BottomSheetWithRecyclerListView; import org.telegram.ui.Components.Bulletin; import org.telegram.ui.Components.BulletinFactory; +import org.telegram.ui.Components.CombinedDrawable; import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.ItemOptions; import org.telegram.ui.Components.LayoutHelper; @@ -82,24 +90,25 @@ public class UserSelectorBottomSheet extends BottomSheetWithRecyclerListView imp public static final int TYPE_PREMIUM = 0; public static final int TYPE_STARS = 1; public static final int TYPE_STAR_GIFT = 2; + public static final int TYPE_TRANSFER = 3; private static UserSelectorBottomSheet instance; - public static void open() { - open(0, null); + public static UserSelectorBottomSheet open() { + return open(0, null); } - public static void open(long userId, BirthdayController.BirthdayState birthdayState) { - open(TYPE_PREMIUM, userId, birthdayState); + public static UserSelectorBottomSheet open(long userId, BirthdayController.BirthdayState birthdayState) { + return open(TYPE_PREMIUM, userId, birthdayState); } - public static void open(int type, long userId, BirthdayController.BirthdayState birthdayState) { + public static UserSelectorBottomSheet open(int type, long userId, BirthdayController.BirthdayState birthdayState) { BaseFragment fragment = LaunchActivity.getLastFragment(); if (fragment == null) { - return; + return null; } if (instance != null) { - return; + return instance; } final int finalType = type; UserSelectorBottomSheet sheet = new UserSelectorBottomSheet(fragment, userId, birthdayState, type, true) { @@ -116,7 +125,7 @@ protected int getType() { } else { sheet.show(); } - instance = sheet; + return instance = sheet; } public static boolean handleIntent(Intent intent, Browser.Progress progress) { @@ -161,7 +170,7 @@ public static boolean handleIntent(Intent intent, Browser.Progress progress) { private final HashSet selectedIds = new HashSet<>(); private final List contacts = new ArrayList<>(); private final List hints = new ArrayList<>(); - private final List foundedUsers = new ArrayList<>(); + private final ArrayList searchResult = new ArrayList<>(); private final Map> contactsMap = new HashMap<>(); private final List contactsLetters = new ArrayList<>(); private final HashMap allSelectedObjects = new LinkedHashMap<>(); @@ -182,21 +191,56 @@ public static boolean handleIntent(Intent intent, Browser.Progress progress) { public void run() { final String finalQuery = query; if (finalQuery != null) { - loadData(finalQuery); + search(finalQuery); } } }; - private void loadData(String query) { - lastRequestId = BoostRepository.searchContacts(lastRequestId, query, arg -> { - foundedUsers.clear(); - foundedUsers.addAll(arg); + private int runningRequest = -1; + private void cancelSearch() { + if (runningRequest >= 0) { + ConnectionsManager.getInstance(currentAccount).cancelRequest(runningRequest, true); + runningRequest = -1; + } + } + + private void search(String query) { + cancelSearch(); + final TLRPC.TL_contacts_search req = new TLRPC.TL_contacts_search(); + req.q = query; + runningRequest = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { + searchResult.clear(); + runningRequest = -1; + if (res instanceof TLRPC.TL_contacts_found) { + final TLRPC.TL_contacts_found r = (TLRPC.TL_contacts_found) res; + final MessagesController m = MessagesController.getInstance(currentAccount); + m.putUsers(r.users, false); + m.putChats(r.chats, false); + + final HashSet dialogIds = new HashSet<>(); + for (TLRPC.Peer peer : r.my_results) { + final long did = DialogObject.getPeerDialogId(peer); + if (dialogIds.contains(did)) continue; + final TLObject obj = m.getUserOrChat(did); + if (obj == null) continue; + searchResult.add(obj); + dialogIds.add(did); + } + for (TLRPC.Peer peer : r.results) { + final long did = DialogObject.getPeerDialogId(peer); + if (dialogIds.contains(did)) continue; + final TLObject obj = m.getUserOrChat(did); + if (obj == null) continue; + searchResult.add(obj); + dialogIds.add(did); + } + } updateList(true, true); - }); + })); } private void checkEditTextHint() { - if (!selectedIds.isEmpty() || type == TYPE_STARS || type == TYPE_STAR_GIFT) { + if (!selectedIds.isEmpty() || type == TYPE_STARS || type == TYPE_STAR_GIFT || type == TYPE_TRANSFER) { if (!isHintSearchText) { isHintSearchText = true; AndroidUtilities.runOnUIThread(() -> searchField.setHintText(getString(R.string.Search), true), 10); @@ -224,7 +268,7 @@ public void draw(@NonNull Canvas canvas, CharSequence text, int start, int end, } public UserSelectorBottomSheet(BaseFragment fragment, long userId, BirthdayController.BirthdayState state, int type, boolean needFocus) { - super(fragment, needFocus, false, false, fragment.getResourceProvider()); + super(fragment, needFocus, false, false, fragment == null ? null : fragment.getResourceProvider()); this.type = type; this.birthdays = state; @@ -276,7 +320,7 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) { }; searchField.setBackgroundColor(getThemedColor(Theme.key_dialogBackground)); searchField.setOnSearchTextChange(this::onSearch); - searchField.setHintText(getString(!selectedIds.isEmpty() || type == TYPE_STARS || type == TYPE_STAR_GIFT ? R.string.Search : R.string.GiftPremiumUsersSearchHint), false); + searchField.setHintText(getString(!selectedIds.isEmpty() || type == TYPE_STARS || type == TYPE_STAR_GIFT || type == TYPE_TRANSFER ? R.string.Search : R.string.GiftPremiumUsersSearchHint), false); sectionCell = new View(getContext()) { @Override @@ -330,8 +374,21 @@ public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newStat } if (view instanceof SelectorUserCell) { TLRPC.User user = ((SelectorUserCell) view).getUser(); - long id = user.id; - if (type == TYPE_STARS) { + TLRPC.Chat chat = ((SelectorUserCell) view).getChat(); + if (user == null && chat == null && type == TYPE_TRANSFER) { + if (onUserSelectedListener != null) { + onUserSelectedListener.run(-99L); + } + return; + } + if (user == null && chat == null) return; + long id = user != null ? user.id : -chat.id; + if (type == TYPE_TRANSFER) { + if (onUserSelectedListener != null) { + onUserSelectedListener.run(id); + } + return; + } else if (type == TYPE_STARS) { if (searchField != null) { AndroidUtilities.hideKeyboard(searchField.getEditText()); } @@ -511,8 +568,7 @@ private void showMaximumUsersToast() { BulletinFactory.of(container, resourcesProvider).createSimpleBulletin(R.raw.chats_infotip, text).show(true); try { container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - } catch (Exception ignore) { - } + } catch (Exception ignore) {} } private void updateList(boolean animated, boolean notify) { @@ -644,6 +700,8 @@ private int addSection(ArrayList items, CharSequence title return h; } + private Drawable tonIcon; + @SuppressLint("NotifyDataSetChanged") public void updateItems(boolean animated, boolean notify) { oldItems.clear(); @@ -652,37 +710,63 @@ public void updateItems(boolean animated, boolean notify) { int h = 0; if (isSearching()) { - for (TLRPC.User foundedUser : foundedUsers) { - if (foundedUser == null || foundedUser.bot || UserObject.isService(foundedUser.id)) continue; - h += dp(56); - items.add(Item.asUser(foundedUser, selectedIds.contains(foundedUser.id)).withOptions(openOptions(foundedUser))); + for (TLObject peer : searchResult) { + long did; + if (peer instanceof TLRPC.User) { + final TLRPC.User user = (TLRPC.User) peer; + if (user.bot || UserObject.isService(user.id)) continue; + did = user.id; + h += dp(56); + items.add(Item.asUser(user, selectedIds.contains(did)).withOptions(openOptions(user))); + } else if (peer instanceof TLRPC.Chat) { + final TLRPC.Chat chat = (TLRPC.Chat) peer; + if (type != TYPE_TRANSFER) continue; + if (!ChatObject.isChannelAndNotMegaGroup(chat)) continue; + did = -chat.id; + h += dp(56); + items.add(Item.asChat(chat, selectedIds.contains(did))); + } } } else { - TLRPC.UserFull userFull = MessagesController.getInstance(currentAccount).getUserFull(UserConfig.getInstance(currentAccount).getClientUserId()); + if (includeTonOption && type == TYPE_TRANSFER) { + if (tonIcon == null) { + final CombinedDrawable icon = new CombinedDrawable( + Theme.createCircleDrawable(dp(46), Theme.getColor(Theme.key_featuredStickers_addButton, resourcesProvider)), + getContext().getResources().getDrawable(R.drawable.ton).mutate() + ); + icon.setIconSize(dp(24), dp(24)); + tonIcon = icon; + } + items.add(Item.asCustomUser(2, tonIcon, getString(R.string.Gift2ExportTONTitle), tonDays > 0 ? formatPluralString("Gift2ExportTONUnlocksIn", tonDays) : "")); + } + final TLRPC.UserFull userFull = MessagesController.getInstance(currentAccount).getUserFull(UserConfig.getInstance(currentAccount).getClientUserId()); if (userFull == null) { MessagesController.getInstance(currentAccount).loadFullUser(UserConfig.getInstance(currentAccount).getCurrentUser(), 0, true); } - if (userFull != null && userFull.birthday == null) { + if (type != TYPE_TRANSFER && userFull != null && userFull.birthday == null) { h += dp(50); items.add(Item.asButton(1, R.drawable.menu_birthday, getString(R.string.GiftsBirthdaySetup))); } - if (userId >= 0) { - TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(userId); - if (user != null) { - // - } - } if (birthdays != null) { h += addSection(items, getString(R.string.BirthdayToday), birthdays.today, true); h += addSection(items, getString(R.string.BirthdayYesterday), birthdays.yesterday, true); h += addSection(items, getString(R.string.BirthdayTomorrow), birthdays.tomorrow, true); } + if (type == TYPE_PREMIUM || type == TYPE_STAR_GIFT) { + final TLRPC.User currentUser = UserConfig.getInstance(currentAccount).getCurrentUser(); + if (currentUser != null) { + items.add(Item.asTopSection(getString(R.string.Gift2MyselfSection))); + final Item item = Item.asUser(currentUser, selectedIds.contains(currentUser.id)); + item.subtext = getString(R.string.Gift2Myself); + items.add(item); + } + } Item topSection = null; - ArrayList selected = new ArrayList<>(); + final ArrayList selected = new ArrayList<>(); if (!hints.isEmpty()) { - List userItems = new ArrayList<>(); - for (TLRPC.TL_topPeer hint : hints) { - TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(hint.peer.user_id); + final List userItems = new ArrayList<>(); + for (final TLRPC.TL_topPeer hint : hints) { + final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(hint.peer.user_id); if (user == null || user.id == userId || user.self || user.bot || UserObject.isService(user.id) || UserObject.isDeleted(user)) { continue; } @@ -700,17 +784,17 @@ public void updateItems(boolean animated, boolean notify) { items.addAll(userItems); } } - for (String contactLetter : contactsLetters) { - List userItems = new ArrayList<>(); - for (TLRPC.TL_contact contact : contactsMap.get(contactLetter)) { - long myUid = UserConfig.getInstance(currentAccount).getClientUserId(); + for (final String contactLetter : contactsLetters) { + final List userItems = new ArrayList<>(); + for (final TLRPC.TL_contact contact : contactsMap.get(contactLetter)) { + final long myUid = UserConfig.getInstance(currentAccount).getClientUserId(); if (contact.user_id == myUid || contact.user_id == userId) { continue; } if (birthdays != null && birthdays.contains(contact.user_id)) { continue; } - TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(contact.user_id); + final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(contact.user_id); if (user == null || user.bot || UserObject.isService(user.id)) continue; h += dp(56); if (selectedIds.contains(user.id)) selected.add(user.id); @@ -757,6 +841,9 @@ public void updateItems(boolean animated, boolean notify) { } public View.OnClickListener openOptions(TLRPC.User user) { + if (type == TYPE_TRANSFER) { + return null; + } return (View view) -> { ItemOptions.makeOptions(container, resourcesProvider, (View) view.getParent()) .add(R.drawable.profile_discuss, LocaleController.getString(R.string.SendMessage), () -> { @@ -791,8 +878,37 @@ public void onConfigurationChanged(Configuration newConfig) { updateItems(false, true); } + private String customTitle; + public void setTitle(String title) { + customTitle = title; + + if (actionBar != null) { + actionBar.setTitle(getTitle()); + } + if (headerView != null) { + headerView.setText(getTitle()); + } + } + + private Utilities.Callback onUserSelectedListener; + public void setOnUserSelector(Utilities.Callback listener) { + onUserSelectedListener = listener; + } + + private boolean includeTonOption; + private int tonDays; + public void addTONOption(int days) { + includeTonOption = true; + tonDays = days; + updateItems(false, true); + } + + @Override protected CharSequence getTitle() { + if (customTitle != null) { + return customTitle; + } if (getType() == TYPE_STARS) { return getString(R.string.GiftStarsTitle); } @@ -834,11 +950,11 @@ public void didReceivedNotification(int id, int account, Object... args) { private void openBirthdaySetup() { AlertsCreator.createBirthdayPickerDialog(getContext(), getString(R.string.EditProfileBirthdayTitle), getString(R.string.EditProfileBirthdayButton), null, birthday -> { - TLRPC.TL_account_updateBirthday req = new TLRPC.TL_account_updateBirthday(); + TL_account.updateBirthday req = new TL_account.updateBirthday(); req.flags |= 1; req.birthday = birthday; TLRPC.UserFull userFull = MessagesController.getInstance(currentAccount).getUserFull(UserConfig.getInstance(currentAccount).getClientUserId()); - TLRPC.TL_birthday oldBirthday = userFull != null ? userFull.birthday : null; + TL_account.TL_birthday oldBirthday = userFull != null ? userFull.birthday : null; if (userFull != null) { userFull.flags2 |= 32; userFull.birthday = birthday; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/adapters/SelectorAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/adapters/SelectorAdapter.java index 515a78307d..7441b82b0c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/adapters/SelectorAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/adapters/SelectorAdapter.java @@ -3,6 +3,7 @@ import android.annotation.SuppressLint; import android.content.Context; import android.graphics.Paint; +import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; @@ -148,8 +149,14 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi final int viewType = holder.getItemViewType(); if (viewType == VIEW_TYPE_USER) { SelectorUserCell userCell = (SelectorUserCell) holder.itemView; - if (item.user != null) { + if (item.icon != null) { + userCell.setCustomUser(item.icon, item.text, item.subtext); + } else if (item.user != null) { userCell.setUser(item.user); + if (item.subtext != null) { + userCell.setSubtitle(item.subtext); + userCell.subtitleTextView.setTextColor(Theme.getColor(Theme.key_dialogTextGray3, resourcesProvider)); + } } else if (item.chat != null) { userCell.setChat(item.chat, getParticipantsCount(item.chat)); } else if (item.peer != null) { @@ -307,6 +314,7 @@ public static class Item extends AdapterWithDiffUtils.Item { public View.OnClickListener callback; public View.OnClickListener options; public View view; + public Drawable icon; private Item(int viewType, boolean selectable) { super(viewType, selectable); @@ -332,6 +340,15 @@ public static Item asCustom(View view) { return item; } + public static Item asCustomUser(int id, Drawable icon, CharSequence title, CharSequence subtitle) { + Item item = new Item(VIEW_TYPE_USER, true); + item.id = id; + item.icon = icon; + item.text = title; + item.subtext = subtitle; + return item; + } + public static Item asUser(TLRPC.User user, boolean checked) { Item item = new Item(VIEW_TYPE_USER, true); item.user = user; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/cells/BaseCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/cells/BaseCell.java index 5d0b6a6915..49a7ee37fc 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/cells/BaseCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/cells/BaseCell.java @@ -5,12 +5,12 @@ import android.annotation.SuppressLint; import android.content.Context; import android.graphics.Canvas; -import android.graphics.Color; import android.graphics.Paint; import android.graphics.drawable.Drawable; import android.text.SpannableString; import android.text.SpannableStringBuilder; import android.text.Spanned; +import android.text.TextUtils; import android.view.Gravity; import android.view.View; import android.widget.FrameLayout; @@ -38,7 +38,7 @@ public abstract class BaseCell extends FrameLayout { protected final BackupImageView imageView; protected final SimpleTextView titleTextView; - protected final SimpleTextView subtitleTextView; + public final SimpleTextView subtitleTextView; protected final RadioButton radioButton; @@ -64,7 +64,7 @@ public BaseCell(Context context, Theme.ResourcesProvider resourcesProvider) { titleTextView = new SimpleTextView(context) { @Override public boolean setText(CharSequence value) { - value = Emoji.replaceEmoji(value, getPaint().getFontMetricsInt(), AndroidUtilities.dp(15), false); + value = Emoji.replaceEmoji(value, getPaint().getFontMetricsInt(), false); return super.setText(value); } }; @@ -132,8 +132,8 @@ protected CharSequence withArrow(CharSequence text) { return finalText; } - protected void setSubtitle(CharSequence text) { - if (text == null) { + public void setSubtitle(CharSequence text) { + if (TextUtils.isEmpty(text)) { titleTextView.setTranslationY(0); subtitleTextView.setVisibility(View.GONE); } else { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/cells/TableCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/cells/TableCell.java index 5625a9d883..a53e25a222 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/cells/TableCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/cells/TableCell.java @@ -1,6 +1,5 @@ package org.telegram.ui.Components.Premium.boosts.cells; -import static org.telegram.messenger.AndroidUtilities.dp; import static org.telegram.tgnet.tl.TL_stories.Boost.NO_USER_ID; import android.annotation.SuppressLint; @@ -232,12 +231,12 @@ public void setData(TLRPC.TL_payments_checkedGiftCode giftCode, Utilities.Callba builder.append(fromChat.title); builder.append("**"); builder = AndroidUtilities.replaceSingleTag(builder.toString(), Theme.key_chat_messageLinkIn, 0, () -> onObjectClicked.run(fromChat), resourcesProvider); - fromTextView.setText(Emoji.replaceEmoji(builder, fromTextView.getPaint().getFontMetricsInt(), dp(12), false)); + fromTextView.setText(Emoji.replaceEmoji(builder, fromTextView.getPaint().getFontMetricsInt(), false)); fromImageView.setForUserOrChat(fromChat, new AvatarDrawable(fromChat)); fromFrameLayout.setOnClickListener(v -> onObjectClicked.run(fromChat)); } else { TLRPC.User fromUser = MessagesController.getInstance(UserConfig.selectedAccount).getUser(giftCode.from_id.user_id); - fromTextView.setText(Emoji.replaceEmoji(UserObject.getFirstName(fromUser), fromTextView.getPaint().getFontMetricsInt(), dp(12), false)); + fromTextView.setText(Emoji.replaceEmoji(UserObject.getFirstName(fromUser), fromTextView.getPaint().getFontMetricsInt(), false)); fromImageView.setForUserOrChat(fromUser, new AvatarDrawable(fromUser)); fromFrameLayout.setOnClickListener(v -> onObjectClicked.run(fromUser)); } @@ -262,7 +261,7 @@ public void setData(TLRPC.TL_payments_checkedGiftCode giftCode, Utilities.Callba builder.append(UserObject.getFirstName(toUser)); builder.append("**"); builder = AndroidUtilities.replaceSingleTag(builder.toString(), Theme.key_chat_messageLinkIn, 0, () -> onObjectClicked.run(toUser), resourcesProvider); - toTextView.setText(Emoji.replaceEmoji(builder, toTextView.getPaint().getFontMetricsInt(), dp(12), false)); + toTextView.setText(Emoji.replaceEmoji(builder, toTextView.getPaint().getFontMetricsInt(), false)); toImageView.setForUserOrChat(toUser, new AvatarDrawable(toUser)); toFrameLayout.setOnClickListener(v -> onObjectClicked.run(toUser)); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/cells/selector/SelectorCountryCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/cells/selector/SelectorCountryCell.java index 8a2ecea22b..3f8d04c516 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/cells/selector/SelectorCountryCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/cells/selector/SelectorCountryCell.java @@ -59,7 +59,7 @@ protected int dividerPadding() { public void setCountry(TLRPC.TL_help_country country, boolean divider) { this.country = country; - titleTextView.setText(Emoji.replaceEmoji(getCountryNameWithFlag(country), titleTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false)); + titleTextView.setText(Emoji.replaceEmoji(getCountryNameWithFlag(country), titleTextView.getPaint().getFontMetricsInt(), false)); setDivider(divider); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/cells/selector/SelectorUserCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/cells/selector/SelectorUserCell.java index 7a9f451185..76ea04b69e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/cells/selector/SelectorUserCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/cells/selector/SelectorUserCell.java @@ -6,6 +6,7 @@ import android.content.Context; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; +import android.graphics.drawable.Drawable; import android.view.Gravity; import android.view.View; import android.widget.ImageView; @@ -134,7 +135,15 @@ public void setUser(TLRPC.User user) { imageView.setForUserOrChat(user, avatarDrawable); titleTextView.setText(UserObject.getUserName(user)); isOnline[0] = false; - setSubtitle(LocaleController.formatUserStatus(UserConfig.selectedAccount, user, isOnline)); + if (UserObject.isBot(user)) { + if (user.bot_active_users > 0) { + setSubtitle(LocaleController.formatPluralStringComma("BotUsers", user.bot_active_users, ',')); + } else { + setSubtitle(LocaleController.getString(R.string.Bot)); + } + } else { + setSubtitle(LocaleController.formatUserStatus(UserConfig.selectedAccount, user, isOnline)); + } subtitleTextView.setTextColor(Theme.getColor(isOnline[0] ? Theme.key_dialogTextBlue2 : Theme.key_dialogTextGray3, resourcesProvider)); if (checkBox != null) { checkBox.setAlpha(1f); @@ -142,6 +151,22 @@ public void setUser(TLRPC.User user) { titleTextView.setRightDrawable(statusBadgeComponent.updateDrawable(user, Theme.getColor(Theme.key_chats_verifiedBackground), false)); } + public void setCustomUser(Drawable icon, CharSequence title, CharSequence subtitle) { + optionsView.setVisibility(View.GONE); + this.user = null; + this.chat = null; + imageView.setRoundRadius(dp(20)); + imageView.setImageDrawable(icon); + titleTextView.setText(title); + isOnline[0] = false; + setSubtitle(subtitle); + subtitleTextView.setTextColor(Theme.getColor(isOnline[0] ? Theme.key_dialogTextBlue2 : Theme.key_dialogTextGray3, resourcesProvider)); + if (checkBox != null) { + checkBox.setAlpha(1f); + } + titleTextView.setRightDrawable(null); + } + public void setChat(TLRPC.Chat chat, int participants_count) { optionsView.setVisibility(View.GONE); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/RLottieDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/RLottieDrawable.java index be023373ec..2629709f6e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/RLottieDrawable.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/RLottieDrawable.java @@ -748,6 +748,10 @@ public int getCurrentFrame() { return currentFrame; } + public float getProgress() { + return (float) currentFrame / metaData[0]; + } + public int getCustomEndFrame() { return customEndFrame; } @@ -1246,7 +1250,9 @@ public void updateCurrentFrame(long time, boolean updateInBackground) { if (vibrationPattern != null && currentParentView != null && allowVibration) { Integer force = vibrationPattern.get(currentFrame - 1); if (force != null) { - currentParentView.performHapticFeedback(force == 1 ? HapticFeedbackConstants.LONG_PRESS : HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + currentParentView.performHapticFeedback(force == 1 ? HapticFeedbackConstants.LONG_PRESS : HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} } } setCurrentFrame(now, timeDiff, timeCheck, false); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactedHeaderView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactedHeaderView.java index aaf07ae7dc..b256c363ac 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactedHeaderView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactedHeaderView.java @@ -27,6 +27,7 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import org.telegram.ui.ActionBar.Theme; import java.util.ArrayList; @@ -131,10 +132,10 @@ protected void onAttachedToWindow() { req.peer = MessagesController.getInstance(currentAccount).getInputPeer(message.getDialogId()); long fromId = message.messageOwner.from_id != null ? message.messageOwner.from_id.user_id : 0; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { - if (response instanceof TLRPC.Vector) { + if (response instanceof Vector) { List usersToRequest = new ArrayList<>(); List dates = new ArrayList<>(); - TLRPC.Vector v = (TLRPC.Vector) response; + Vector v = (Vector) response; for (Object obj : v.objects) { if (obj instanceof Long) { long l = (long) obj; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/BackSpaceButtonView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/BackSpaceButtonView.java index 17823abe61..c605f12714 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/BackSpaceButtonView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/BackSpaceButtonView.java @@ -55,7 +55,9 @@ public boolean onTouchEvent(MotionEvent event) { if (!backspaceOnce) { if (onBackspace != null) { onBackspace.run(false); - backspaceButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + backspaceButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} } } } @@ -112,7 +114,9 @@ private void postBackspaceRunnable(final int time) { } if (onBackspace != null) { onBackspace.run(time < 300); - backspaceButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + backspaceButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} } backspaceOnce = true; postBackspaceRunnable(Math.max(50, time - 100)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ChatCustomReactionsEditActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ChatCustomReactionsEditActivity.java index 859d1450cb..c5d634590a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ChatCustomReactionsEditActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ChatCustomReactionsEditActivity.java @@ -35,7 +35,6 @@ import androidx.annotation.NonNull; -import org.checkerframework.checker.units.qual.A; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.FileLog; import org.telegram.messenger.LocaleController; @@ -44,6 +43,7 @@ import org.telegram.messenger.R; import org.telegram.messenger.browser.Browser; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_stars; import org.telegram.tgnet.tl.TL_stories; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.AdjustPanLayoutHelper; @@ -55,17 +55,12 @@ import org.telegram.ui.Cells.SlideIntChooseView; import org.telegram.ui.Cells.TextCheckCell; import org.telegram.ui.Cells.TextInfoPrivacyCell; -import org.telegram.ui.ChannelAdminLogActivity; import org.telegram.ui.Components.AnimatedEmojiDrawable; import org.telegram.ui.Components.AnimatedEmojiSpan; import org.telegram.ui.Components.BulletinFactory; import org.telegram.ui.Components.CubicBezierInterpolator; -import org.telegram.ui.Components.HideViewAfterAnimation; import org.telegram.ui.Components.LayoutHelper; -import org.telegram.ui.DialogsActivity; -import org.telegram.ui.LaunchActivity; import org.telegram.ui.SelectAnimatedEmojiDialog; -import org.telegram.ui.Stories.recorder.KeyboardNotifier; import java.util.ArrayList; import java.util.HashMap; @@ -145,6 +140,7 @@ public boolean onFragmentCreate() { getNotificationCenter().addObserver(this, NotificationCenter.reactionsDidLoad); allAvailableReactions.addAll(getMediaDataController().getEnabledReactionsList()); NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.stopAllHeavyOperations, 512); + getNotificationCenter().addObserver(this, NotificationCenter.dialogDeleted); return super.onFragmentCreate(); } @@ -491,7 +487,7 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto } } - protected void onEmojiSelected(View view, Long documentId, TLRPC.Document document, Integer until) { + protected void onEmojiSelected(View view, Long documentId, TLRPC.Document document, TL_stars.TL_starGiftUnique gift, Integer until) { if (selectedEmojisMap.containsKey(documentId)) { selectedEmojisIds.remove(documentId); AnimatedEmojiSpan removedSpan = selectedEmojisMap.remove(documentId); @@ -727,6 +723,7 @@ public void onFragmentDestroy() { if (selectedType == SELECT_TYPE_NONE && reactionsCount != currentReactionsCount) { getMessagesController().setCustomChatReactions(chatId, selectedType, grabReactions(false), reactionsCount, null, null, null); } + getNotificationCenter().removeObserver(this, NotificationCenter.dialogDeleted); } @Override @@ -896,7 +893,16 @@ private void updateScrollViewMarginBottom(int margin) { @Override public void didReceivedNotification(int id, int account, Object... args) { - + if (id == NotificationCenter.dialogDeleted) { + long dialogId = (long) args[0]; + if (dialogId == -this.chatId) { + if (parentLayout != null && parentLayout.getLastFragment() == this) { + finishFragment(); + } else { + removeSelfFromStack(); + } + } + } } public void toggleStarsEnabled() { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/CustomEmojiReactionsWindow.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/CustomEmojiReactionsWindow.java index ef394f2ea1..045aad4f46 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/CustomEmojiReactionsWindow.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/CustomEmojiReactionsWindow.java @@ -48,6 +48,7 @@ import org.telegram.messenger.UserConfig; import org.telegram.messenger.Utilities; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_stars; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.ChatActivity; @@ -204,9 +205,11 @@ protected void onReactionClick(ImageViewEmoji emoji, ReactionsLayoutInBubble.Vis } @Override - protected void onEmojiSelected(View emojiView, Long documentId, TLRPC.Document document, Integer until) { + protected void onEmojiSelected(View emojiView, Long documentId, TLRPC.Document document, TL_stars.TL_starGiftUnique gift, Integer until) { if (baseFragment != null && !reactionsContainerLayout.channelReactions && reactionsContainerLayout.getWindowType() != SelectAnimatedEmojiDialog.TYPE_STICKER_SET_EMOJI && !UserConfig.getInstance(baseFragment.getCurrentAccount()).isPremium()) { - windowView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + windowView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} BulletinFactory.of(windowView, null).createEmojiBulletin( document, AndroidUtilities.replaceTags(LocaleController.getString(R.string.UnlockPremiumEmojiReaction)), diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ReactionsEffectOverlay.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ReactionsEffectOverlay.java index bc5caa796e..b59f24885a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ReactionsEffectOverlay.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ReactionsEffectOverlay.java @@ -28,6 +28,7 @@ import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.Cells.ChatActionCell; import org.telegram.ui.Cells.ChatMessageCell; import org.telegram.ui.ChatActivity; import org.telegram.ui.Components.AnimatedEmojiDrawable; @@ -81,7 +82,7 @@ public class ReactionsEffectOverlay { private ReactionsContainerLayout.ReactionHolderView holderView = null; private SelectAnimatedEmojiDialog.ImageViewEmoji holderView2 = null; private boolean wasScrolled; - private ChatMessageCell cell; + private View cell; private boolean useWindow; private ViewGroup decorView; private static long lastHapticTime; @@ -90,13 +91,20 @@ public class ReactionsEffectOverlay { public boolean isStories; boolean isFinished; - public ReactionsEffectOverlay(Context context, BaseFragment fragment, ReactionsContainerLayout reactionsLayout, ChatMessageCell cell, View fromAnimationView, float x, float y, ReactionsLayoutInBubble.VisibleReaction visibleReaction, int currentAccount, int animationType, boolean isStories) { + public ReactionsEffectOverlay(Context context, BaseFragment fragment, ReactionsContainerLayout reactionsLayout, View cell, View fromAnimationView, float x, float y, ReactionsLayoutInBubble.VisibleReaction visibleReaction, int currentAccount, int animationType, boolean isStories) { this.fragment = fragment; this.isStories = isStories; - if (cell != null) { - this.messageId = cell.getMessageObject().getId(); - this.groupId = cell.getMessageObject().getGroupId(); + final MessageObject messageObject; + if (cell instanceof ChatMessageCell) { + messageObject = ((ChatMessageCell) cell).getMessageObject(); + this.messageId = messageObject.getId(); + this.groupId = messageObject.getGroupId(); + } else if (cell instanceof ChatActionCell) { + messageObject = ((ChatActionCell) cell).getMessageObject(); + this.messageId = messageObject.getId(); + this.groupId = 0; } else { + messageObject = null; this.messageId = 0; this.groupId = 0; } @@ -105,8 +113,10 @@ public ReactionsEffectOverlay(Context context, BaseFragment fragment, ReactionsC this.currentAccount = currentAccount; this.cell = cell; ReactionsLayoutInBubble.ReactionButton reactionButton = null; - if (cell != null) { - reactionButton = cell.getReactionButton(visibleReaction); + if (cell instanceof ChatMessageCell) { + reactionButton = ((ChatMessageCell) cell).getReactionButton(visibleReaction); + } else if (cell instanceof ChatActionCell) { + reactionButton = ((ChatActionCell) cell).getReactionButton(visibleReaction); } if (isStories && animationType == ONLY_MOVE_ANIMATION) { ReactionsEffectOverlay.currentShortOverlay = nextReactionOverlay = new ReactionsEffectOverlay(context, fragment, reactionsLayout, cell, fromAnimationView, x, y, visibleReaction, currentAccount, SHORT_ANIMATION, true); @@ -127,8 +137,8 @@ public ReactionsEffectOverlay(Context context, BaseFragment fragment, ReactionsC if (animationType == SHORT_ANIMATION) { Random random = new Random(); ArrayList recentReactions = null; - if (cell != null && cell.getMessageObject().messageOwner.reactions != null) { - recentReactions = cell.getMessageObject().messageOwner.reactions.recent_reactions; + if (messageObject != null && messageObject.messageOwner.reactions != null) { + recentReactions = messageObject.messageOwner.reactions.recent_reactions; } if (recentReactions != null && chatActivity != null && chatActivity.getDialogId() < 0) { for (int i = 0; i < recentReactions.size(); i++) { @@ -296,27 +306,36 @@ protected void dispatchDraw(Canvas canvas) { holderView.pressedBackupImageView.setAlpha(0); } } - ChatMessageCell drawingCell; + View drawingCell; if (fragment instanceof ChatActivity) { - drawingCell = ((ChatActivity) fragment).findMessageCell(messageId, false); + drawingCell = ((ChatActivity) fragment).findCell(messageId, false); } else { drawingCell = cell; } float toX, toY, toH; if (isStories) { - toH = SharedConfig.deviceIsHigh() ? AndroidUtilities.dp(120) : AndroidUtilities.dp(50); - } else if (cell != null && cell.getMessageObject().shouldDrawReactionsInLayout()) { + toH = SharedConfig.deviceIsHigh() ? AndroidUtilities.dp(120) : AndroidUtilities.dp(50); + } else if (messageObject != null && messageObject.shouldDrawReactionsInLayout()) { toH = AndroidUtilities.dp(20); } else { toH = AndroidUtilities.dp(14); } if (drawingCell != null) { - cell.getLocationInWindow(loc); + drawingCell.getLocationInWindow(loc); - ReactionsLayoutInBubble.ReactionButton reactionButton = cell.getReactionButton(reaction); toX = loc[0]; toY = loc[1]; + ReactionsLayoutInBubble.ReactionButton reactionButton = null; + if (drawingCell instanceof ChatMessageCell) { + ChatMessageCell messageCell = (ChatMessageCell) drawingCell; + reactionButton = messageCell.getReactionButton(reaction); + if (messageCell.drawPinnedBottom && !messageCell.shouldDrawTimeOnMedia()) { + toY += AndroidUtilities.dp(2); + } + } else if (drawingCell instanceof ChatActionCell) { + reactionButton = ((ChatActionCell) drawingCell).getReactionButton(reaction); + } if (reactionButton != null) { toX += reactionButton.drawingImageRect.left; toY += reactionButton.drawingImageRect.top; @@ -324,9 +343,6 @@ protected void dispatchDraw(Canvas canvas) { if (chatActivity != null) { toY += chatActivity.drawingChatListViewYoffset; } - if (drawingCell.drawPinnedBottom && !drawingCell.shouldDrawTimeOnMedia()) { - toY += AndroidUtilities.dp(2); - } lastDrawnToX = toX; lastDrawnToY = toY; } else if (isStories) { @@ -447,7 +463,9 @@ protected void dispatchDraw(Canvas canvas) { if (isStories && animationType == ONLY_MOVE_ANIMATION) { if (!isFinished) { isFinished = true; - performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} ViewGroup viewGroup = (ViewGroup) getParent(); viewGroup.addView(nextReactionOverlay.windowView); @@ -468,8 +486,10 @@ public void onAnimationEnd(Animator animation) { } if (ReactionsEffectOverlay.this.animateOutProgress >= 1f) { if (animationType == LONG_ANIMATION || animationType == ONLY_MOVE_ANIMATION) { - if (cell != null) { - cell.reactionsLayoutInBubble.animateReaction(reaction); + if (cell instanceof ChatMessageCell) { + ((ChatMessageCell) cell).reactionsLayoutInBubble.animateReaction(reaction); + } else if (cell instanceof ChatActionCell) { + ((ChatActionCell) cell).reactionsLayoutInBubble.animateReaction(reaction); } } ReactionsEffectOverlay.this.animateOutProgress = 1f; @@ -480,7 +500,7 @@ public void onAnimationEnd(Animator animation) { } if (cell != null) { cell.invalidate(); - if (cell.getCurrentMessagesGroup() != null && cell.getParent() != null) { + if (cell instanceof ChatMessageCell && ((ChatMessageCell) cell).getCurrentMessagesGroup() != null && cell.getParent() != null) { ((View) cell.getParent()).invalidate(); } } @@ -627,12 +647,12 @@ protected void onDetachedFromWindow() { if (animationType == LONG_ANIMATION || animationType == SHORT_ANIMATION) { AnimatedEmojiDrawable animatedEmojiDrawable = new AnimatedEmojiDrawable(AnimatedEmojiDrawable.CACHE_TYPE_KEYBOARD, currentAccount, visibleReaction.documentId); int color; - if (cell != null) { + if (messageObject != null) { color = Theme.getColor( - cell.getMessageObject().shouldDrawWithoutBackground() ? - cell.getMessageObject().isOutOwner() ? Theme.key_chat_outReactionButtonBackground : Theme.key_chat_inReactionButtonBackground : - cell.getMessageObject().isOutOwner() ? Theme.key_chat_outReactionButtonTextSelected : Theme.key_chat_inReactionButtonTextSelected, - fragment != null ? fragment.getResourceProvider() : null + messageObject.shouldDrawWithoutBackground() ? + messageObject.isOutOwner() ? Theme.key_chat_outReactionButtonBackground : Theme.key_chat_inReactionButtonBackground : + messageObject.isOutOwner() ? Theme.key_chat_outReactionButtonTextSelected : Theme.key_chat_inReactionButtonTextSelected, + fragment != null ? fragment.getResourceProvider() : null ); } else { color = Color.WHITE; @@ -720,7 +740,7 @@ private void removeCurrentView() { } } - public static void show(BaseFragment baseFragment, ReactionsContainerLayout reactionsLayout, ChatMessageCell cell, View fromAnimationView, float x, float y, ReactionsLayoutInBubble.VisibleReaction visibleReaction, int currentAccount, int animationType) { + public static void show(BaseFragment baseFragment, ReactionsContainerLayout reactionsLayout, View cell, View fromAnimationView, float x, float y, ReactionsLayoutInBubble.VisibleReaction visibleReaction, int currentAccount, int animationType) { if (cell == null || visibleReaction == null || baseFragment == null || baseFragment.getParentActivity() == null) { return; } @@ -763,7 +783,7 @@ public static void show(BaseFragment baseFragment, ReactionsContainerLayout reac reactionsEffectOverlay.decorView.addView(reactionsEffectOverlay.windowView); } cell.invalidate(); - if (cell.getCurrentMessagesGroup() != null && cell.getParent() != null) { + if (cell instanceof ChatMessageCell && ((ChatMessageCell) cell).getCurrentMessagesGroup() != null && cell.getParent() != null) { ((View) cell.getParent()).invalidate(); } @@ -780,7 +800,11 @@ public static void startAnimation() { } else { startShortAnimation(); if (currentShortOverlay != null) { - currentShortOverlay.cell.reactionsLayoutInBubble.animateReaction(currentShortOverlay.reaction); + if (currentShortOverlay.cell instanceof ChatMessageCell) { + ((ChatMessageCell) currentShortOverlay.cell).reactionsLayoutInBubble.animateReaction(currentShortOverlay.reaction); + } else if (currentShortOverlay.cell instanceof ChatActionCell) { + ((ChatActionCell) currentShortOverlay.cell).reactionsLayoutInBubble.animateReaction(currentShortOverlay.reaction); + } } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ReactionsLayoutInBubble.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ReactionsLayoutInBubble.java index 9cc1686adb..4b89435721 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ReactionsLayoutInBubble.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Reactions/ReactionsLayoutInBubble.java @@ -17,6 +17,7 @@ import android.text.Spanned; import android.text.TextPaint; import android.text.TextUtils; +import android.util.Log; import android.view.Gravity; import android.view.MotionEvent; import android.view.View; @@ -46,6 +47,7 @@ import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.Cells.ChatActionCell; import org.telegram.ui.Cells.ChatMessageCell; import org.telegram.ui.Components.AnimatedEmojiDrawable; import org.telegram.ui.Components.AnimatedEmojiSpan; @@ -71,10 +73,10 @@ public class ReactionsLayoutInBubble { private final static int ANIMATION_TYPE_MOVE = 3; public float drawServiceShaderBackground; - private static Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); - private static Paint tagPaint = new Paint(Paint.ANTI_ALIAS_FLAG); - private static Paint cutTagPaint = new Paint(Paint.ANTI_ALIAS_FLAG); - private static TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); + private static final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); + private static final Paint tagPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private static final Paint cutTagPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private static final TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); public static void initPaints(Theme.ResourcesProvider resourcesProvider) { paint.setColor(Theme.getColor(Theme.key_chat_inLoader, resourcesProvider)); @@ -94,7 +96,7 @@ public static void initPaints(Theme.ResourcesProvider resourcesProvider) { private boolean wasDrawn; private boolean animateMove; private boolean animateWidth; - private boolean animateHeight; + public boolean animateHeight; public int positionOffsetY; int currentAccount; public int height; @@ -108,7 +110,7 @@ public static void initPaints(Theme.ResourcesProvider resourcesProvider) { ArrayList outButtons = new ArrayList<>(); HashMap lastDrawingReactionButtons = new HashMap<>(); HashMap lastDrawingReactionButtonsTmp = new HashMap<>(); - ChatMessageCell parentView; + View parentView; MessageObject messageObject; Theme.ResourcesProvider resourcesProvider; private Integer scrimViewReaction; @@ -121,7 +123,7 @@ public static void initPaints(Theme.ResourcesProvider resourcesProvider) { private static int animationUniq; private final static ButtonsComparator comparator = new ButtonsComparator(); - HashMap animatedReactions = new HashMap<>(); + final HashMap animatedReactions = new HashMap<>(); private int lastDrawTotalHeight; private int animateFromTotalHeight; public boolean hasUnreadReactions; @@ -142,7 +144,7 @@ private static long getPeerId(TLObject object) { } public boolean tags; - public ReactionsLayoutInBubble(ChatMessageCell parentView) { + public ReactionsLayoutInBubble(View parentView) { this.parentView = parentView; currentAccount = UserConfig.selectedAccount; initPaints(resourcesProvider); @@ -273,6 +275,7 @@ public void setMessage(MessageObject messageObject, boolean isSmall, boolean isT isEmpty = reactionButtons.isEmpty(); } + private final ArrayList reactionLineWidths = new ArrayList<>(); public void measure(int availableWidth, int gravity) { height = 0; width = 0; @@ -282,9 +285,11 @@ public void measure(int availableWidth, int gravity) { return; } this.availableWidth = availableWidth; + reactionLineWidths.clear(); int maxWidth = 0; int currentX = 0; int currentY = 0; + int lineOffset = 0; for (int i = 0; i < reactionButtons.size(); i++) { ReactionButton button = reactionButtons.get(i); if (button.isSmall) { @@ -315,36 +320,46 @@ public void measure(int availableWidth, int gravity) { } if (currentX + button.width > availableWidth) { + reactionLineWidths.add(currentX); currentX = 0; currentY += button.height + dp(4); + lineOffset++; } button.x = currentX; button.y = currentY; + button.top = lineOffset; currentX += button.width + dp(4); if (currentX > maxWidth) { maxWidth = currentX; } } + reactionLineWidths.add(currentX); if (gravity == Gravity.RIGHT && !reactionButtons.isEmpty()) { int fromP = 0; int startY = reactionButtons.get(0).y; for (int i = 0; i < reactionButtons.size(); i++) { if (reactionButtons.get(i).y != startY) { - int lineOffset = availableWidth - (reactionButtons.get(i - 1).x + reactionButtons.get(i - 1).width); + final int thisLineOffset = availableWidth - (reactionButtons.get(i - 1).x + reactionButtons.get(i - 1).width); for (int k = fromP; k < i; k++) { - reactionButtons.get(k).x += lineOffset; + reactionButtons.get(k).x += thisLineOffset; } fromP = i; } } int last = reactionButtons.size() - 1; - int lineOffset = availableWidth - (reactionButtons.get(last).x + reactionButtons.get(last).width); + final int thisLineOffset = availableWidth - (reactionButtons.get(last).x + reactionButtons.get(last).width); for (int k = fromP; k <= last; k++) { - reactionButtons.get(k).x += lineOffset; + reactionButtons.get(k).x += thisLineOffset; + } + } else if (gravity == Gravity.CENTER_HORIZONTAL && !reactionButtons.isEmpty()) { + for (int i = 0; i < reactionButtons.size(); i++) { + final ReactionButton btn = reactionButtons.get(i); + final float rowWidth = btn.top < 0 || btn.top >= reactionLineWidths.size() ? 0 : reactionLineWidths.get(btn.top); + btn.x += (availableWidth - rowWidth) / 2.0f; } } lastLineX = currentX; - if (gravity == Gravity.RIGHT) { + if (gravity == Gravity.RIGHT || gravity == Gravity.CENTER_HORIZONTAL) { width = availableWidth; } else { width = maxWidth; @@ -354,6 +369,7 @@ public void measure(int availableWidth, int gravity) { } private final RectF scrimRect = new RectF(); + private final Rect scrimRect2 = new Rect(); public void draw(Canvas canvas, float animationProgress, Integer drawOnlyReaction) { if (isEmpty && outButtons.isEmpty()) { @@ -459,16 +475,13 @@ public void drawPreview(View view, Canvas canvas, int offset, Integer drawOnlyRe } for (int i = 0; i < reactionButtons.size(); i++) { ReactionButton reactionButton = reactionButtons.get(i); -// if (Objects.equals(reactionButton.reaction.hashCode(), scrimViewReaction)) { -// continue; -// } if (drawOnlyReaction != null && reactionButton.reaction.hashCode() != drawOnlyReaction) { continue; } if (drawOnlyReaction != null) { AndroidUtilities.rectTmp.set(reactionButton.drawingImageRect); final float scrimSize = dp(140), p = dp(14); - final int parentWidth = parentView != null ? parentView.getParentWidth() : AndroidUtilities.displaySize.x; + final int parentWidth = getParentWidth(); final float left = Utilities.clamp(AndroidUtilities.rectTmp.left - dp(12), parentWidth - scrimSize - dp(24), dp(24)); scrimRect.set(left, AndroidUtilities.rectTmp.top - p - scrimSize + offset, left + scrimSize, AndroidUtilities.rectTmp.top - p + offset); @@ -476,17 +489,38 @@ public void drawPreview(View view, Canvas canvas, int offset, Integer drawOnlyRe AndroidUtilities.lerp(AndroidUtilities.rectTmp, scrimRect, progress, scrimRect); reactionButton.attachPreview(view); - AndroidUtilities.rectTmp2.set((int) scrimRect.left, (int) scrimRect.top, (int) scrimRect.right, (int) scrimRect.bottom); - if (1f - progress > 0) { - canvas.saveLayerAlpha(scrimRect, (int) (0xFF * (1f - progress)), Canvas.ALL_SAVE_FLAG); - reactionButton.drawImage(canvas, AndroidUtilities.rectTmp2, 1f); - canvas.restore(); - } + scrimRect2.set((int) scrimRect.left, (int) scrimRect.top, (int) scrimRect.right, (int) scrimRect.bottom); +// if (1f - progress > 0) { +// canvas.saveLayerAlpha(scrimRect, (int) (0xFF * (1f - progress)), Canvas.ALL_SAVE_FLAG); +// reactionButton.drawImage(canvas, scrimRect2, 1f); +// canvas.restore(); +// } reactionButton.drawPreview(view, canvas, scrimRect, progress); } } } + private int getParentWidth() { + if (parentView instanceof ChatMessageCell) { + return ((ChatMessageCell) parentView).getParentWidth(); + } + return AndroidUtilities.displaySize.x; + } + + private void didPressReaction(TLRPC.ReactionCount reaction, boolean longpress, float x, float y) { + if (parentView instanceof ChatMessageCell) { + final ChatMessageCell cell = (ChatMessageCell) parentView; + final ChatMessageCell.ChatMessageCellDelegate delegate = cell.getDelegate(); + if (delegate == null) return; + delegate.didPressReaction(cell, reaction, longpress, x, y); + } else if (parentView instanceof ChatActionCell) { + final ChatActionCell cell = (ChatActionCell) parentView; + final ChatActionCell.ChatActionCellDelegate delegate = cell.getDelegate(); + if (delegate == null) return; + delegate.didPressReaction(cell, reaction, longpress, x, y); + } + } + public void recordDrawingState() { lastDrawingReactionButtons.clear(); for (int i = 0; i < reactionButtons.size(); i++) { @@ -719,6 +753,7 @@ public static class ReactionButton { public int count; public int x; public int y; + public int top; public int width; public int height; public ImageReceiver imageReceiver; @@ -935,8 +970,13 @@ public void draw(Canvas canvas, float x, float y, float progress, float alpha, b } else { backgroundColor = Theme.getColor(isOutOwner() ? Theme.key_chat_outReactionButtonBackground : Theme.key_chat_inReactionButtonBackground, resourcesProvider); textColor = Theme.getColor(isOutOwner() ? Theme.key_chat_outReactionButtonTextSelected : Theme.key_chat_inReactionButtonTextSelected, resourcesProvider); - serviceTextColor = Theme.getColor(isOutOwner() ? Theme.key_chat_outReactionButtonBackground : Theme.key_chat_inReactionButtonBackground, resourcesProvider); - serviceBackgroundColor = Theme.getColor(isOutOwner() ? Theme.key_chat_outBubble : Theme.key_chat_inBubble); + if (parentView instanceof ChatActionCell) { + serviceTextColor = Theme.getColor(Theme.key_chat_reactionServiceButtonTextSelected, resourcesProvider); + serviceBackgroundColor = Theme.getColor(Theme.key_chat_reactionServiceButtonBackgroundSelected, resourcesProvider); + } else { + serviceTextColor = Theme.getColor(isOutOwner() ? Theme.key_chat_outReactionButtonBackground : Theme.key_chat_inReactionButtonBackground, resourcesProvider); + serviceBackgroundColor = Theme.getColor(isOutOwner() ? Theme.key_chat_outBubble : Theme.key_chat_inBubble, resourcesProvider); + } } } else { if (paid) { @@ -1336,32 +1376,6 @@ public void detachPreview() { } } - private final Drawable.Callback callback = new Drawable.Callback() { - @Override - public void invalidateDrawable(@NonNull Drawable who) { - if (parentView != null) { - parentView.invalidate(); - if (inGroup && parentView.getParent() instanceof View) { - ((View) parentView.getParent()).invalidate(); - } - } - } - - @Override - public void scheduleDrawable(@NonNull Drawable who, @NonNull Runnable what, long when) { - if (parentView != null) { - parentView.scheduleDrawable(who, what, when); - } - } - - @Override - public void unscheduleDrawable(@NonNull Drawable who, @NonNull Runnable what) { - if (parentView != null) { - parentView.unscheduleDrawable(who, what); - } - } - }; - private final Drawable.Callback supercallback = new Drawable.Callback() { @Override public void invalidateDrawable(@NonNull Drawable who) { @@ -1416,7 +1430,7 @@ public boolean checkTouchEvent(MotionEvent event) { final ReactionButton selectedButtonFinal = lastSelectedButton; AndroidUtilities.runOnUIThread(longPressRunnable = () -> { - parentView.getDelegate().didPressReaction(parentView, selectedButtonFinal.reactionCount, true, 0, 0); + didPressReaction(selectedButtonFinal.reactionCount, true, 0, 0); selectedButtonFinal.bounce.setPressed(false); lastSelectedButton = null; pressed = false; @@ -1445,9 +1459,7 @@ public boolean checkTouchEvent(MotionEvent event) { longPressRunnable = null; } if (pressed && lastSelectedButton != null && event.getAction() == MotionEvent.ACTION_UP) { - if (parentView.getDelegate() != null) { - parentView.getDelegate().didPressReaction(parentView, lastSelectedButton.reactionCount, false, event.getX(), event.getY()); - } + didPressReaction(lastSelectedButton.reactionCount, false, event.getX(), event.getY()); } pressed = false; if (lastSelectedButton != null) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactionsContainerLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactionsContainerLayout.java index 6433baa099..dd363b452c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactionsContainerLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ReactionsContainerLayout.java @@ -145,8 +145,8 @@ public boolean equals(Object o) { } } - private Paint bgPaint = new Paint(Paint.ANTI_ALIAS_FLAG); - private Paint leftShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG), + private final Paint bgPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private final Paint leftShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG), rightShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG); private float leftAlpha, rightAlpha; private float transitionProgress = 1f; @@ -292,7 +292,9 @@ public int scrollHorizontallyBy(int dx, RecyclerView.Recycler recycler, Recycler boolean b1 = oldProgress > 1f; boolean b2 = newProgress > 1f; if (b1 != b2) { - recyclerListView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + recyclerListView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignore) {} } if (pullingLeftOffset < 0) { dx = (int) pullingLeftOffset; @@ -323,7 +325,9 @@ public int scrollHorizontallyBy(int dx, RecyclerView.Recycler recycler, Recycler boolean b1 = oldProgress > 1f; boolean b2 = newProgress > 1f; if (b1 != b2) { - recyclerListView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + recyclerListView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignore) {} } if (customReactionsContainer != null) { customReactionsContainer.invalidate(); @@ -2163,7 +2167,9 @@ public void resetAnimation() { Runnable longPressRunnable = new Runnable() { @Override public void run() { - performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} pressedReactionPosition = visibleReactionsList.indexOf(currentReaction); pressedReaction = currentReaction; ReactionsContainerLayout.this.invalidate(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/RecyclerListView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/RecyclerListView.java index f430a46710..999480fe52 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/RecyclerListView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/RecyclerListView.java @@ -1110,12 +1110,16 @@ public void onLongPress(MotionEvent event) { View child = currentChildView; if (onItemLongClickListener != null) { if (onItemLongClickListener.onItemClick(currentChildView, currentChildPosition)) { - child.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + child.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} child.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); } } else { if (onItemLongClickListenerExtended.onItemClick(currentChildView, currentChildPosition, event.getX() - currentChildView.getX(), event.getY() - currentChildView.getY())) { - child.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + child.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} child.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); longPressCalled = true; } @@ -1477,7 +1481,10 @@ public void onScrolled(RecyclerView recyclerView, int dx, int dy) { private Paint backgroundPaint; protected void drawSectionBackground(Canvas canvas, int fromAdapterPosition, int toAdapterPosition, int color) { - if (toAdapterPosition < fromAdapterPosition) { + drawSectionBackground(canvas, fromAdapterPosition, toAdapterPosition, color, 0, 0); + } + protected void drawSectionBackground(Canvas canvas, int fromAdapterPosition, int toAdapterPosition, int color, int topMargin, int bottomMargin) { + if (toAdapterPosition < fromAdapterPosition || fromAdapterPosition < 0 || toAdapterPosition < 0) { return; } @@ -1502,7 +1509,7 @@ protected void drawSectionBackground(Canvas canvas, int fromAdapterPosition, int backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); } backgroundPaint.setColor(color); - canvas.drawRect(0, top, getWidth(), bottom, backgroundPaint); + canvas.drawRect(0, top - topMargin, getWidth(), bottom + bottomMargin, backgroundPaint); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ScrollSlidingTabStrip.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ScrollSlidingTabStrip.java index 029e7b2749..b481e33f07 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ScrollSlidingTabStrip.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ScrollSlidingTabStrip.java @@ -136,7 +136,9 @@ public void run() { return; } if (p >= 0 && p < tabsContainer.getChildCount()) { - performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} draggindViewDxOnScreen = 0f; draggingViewOutProgress = 0f; draggingView = tabsContainer.getChildAt(p); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SearchViewPager.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SearchViewPager.java index f7bf4c2672..ee48170f82 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/SearchViewPager.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SearchViewPager.java @@ -1412,4 +1412,10 @@ public interface ChatPreviewDelegate { void move(float dy); void finish(); } + + public void onShown() { + if (dialogsSearchAdapter != null) { + dialogsSearchAdapter.resetFilter(); + } + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SeekBar.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SeekBar.java index daa39b0c6a..1b032e2183 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/SeekBar.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SeekBar.java @@ -19,7 +19,6 @@ import android.text.StaticLayout; import android.text.TextPaint; import android.util.Pair; -import android.view.HapticFeedbackConstants; import android.view.MotionEvent; import android.view.View; @@ -339,7 +338,7 @@ public void updateTimestamps(MessageObject messageObject, Long videoDuration) { float position = seconds * 1000L / (float) videoDuration; String label = link.label; SpannableStringBuilder builder = new SpannableStringBuilder(label); - Emoji.replaceEmoji(builder, timestampLabelPaint.getFontMetricsInt(), AndroidUtilities.dp(14), false); + Emoji.replaceEmoji(builder, timestampLabelPaint.getFontMetricsInt(), false); timestamps.add(new Pair<>(position, link)); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SeekBarView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SeekBarView.java index 1032b3f06a..1e5d30a0f7 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/SeekBarView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SeekBarView.java @@ -25,7 +25,6 @@ import android.text.TextUtils; import android.util.Pair; import android.util.StateSet; -import android.view.HapticFeedbackConstants; import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; @@ -587,7 +586,7 @@ public void updateTimestamps(MessageObject messageObject, Long duration) { float position = seconds * 1000L / (float) duration; String label = link.label; SpannableStringBuilder builder = new SpannableStringBuilder(label); - Emoji.replaceEmoji(builder, timestampLabelPaint.getFontMetricsInt(), AndroidUtilities.dp(14), false); + Emoji.replaceEmoji(builder, timestampLabelPaint.getFontMetricsInt(), false); timestamps.add(new Pair<>(position, builder)); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ShareAlert.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ShareAlert.java index 04b5610a6d..17bd8b5940 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ShareAlert.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ShareAlert.java @@ -9,6 +9,7 @@ package org.telegram.ui.Components; import static org.telegram.messenger.AndroidUtilities.dp; +import static org.telegram.messenger.AndroidUtilities.dpf2; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -19,6 +20,7 @@ import android.app.Activity; import android.content.Context; import android.graphics.Canvas; +import android.graphics.Color; import android.graphics.LinearGradient; import android.graphics.Outline; import android.graphics.Paint; @@ -27,6 +29,7 @@ import android.graphics.RectF; import android.graphics.Shader; import android.graphics.drawable.Drawable; +import android.net.Uri; import android.os.Build; import android.text.Editable; import android.text.SpannableStringBuilder; @@ -111,6 +114,7 @@ import org.telegram.ui.LaunchActivity; import org.telegram.ui.MessageStatisticActivity; import org.telegram.ui.PremiumPreviewFragment; +import org.telegram.ui.Stories.DarkThemeResourceProvider; import java.util.ArrayList; import java.util.Collections; @@ -123,11 +127,15 @@ public class ShareAlert extends BottomSheet implements NotificationCenter.NotificationCenterDelegate { private FrameLayout frameLayout; - private FrameLayout frameLayout2; + private BlurredFrameLayout frameLayout2; private EditTextEmoji commentTextView; private FrameLayout writeButtonContainer; private View selectedCountView; - private TextView pickerBottomLayout; + private FrameLayout pickerBottom; + private BlurredFrameLayout pickerBottomLayout; + private LinearLayout linkContainer; + private TextView linkCopyButton; + private SimpleTextView linkTextView; private FrameLayout bulletinContainer; public FrameLayout bulletinContainer2; private LinearLayout sharesCountLayout; @@ -156,6 +164,14 @@ public class ShareAlert extends BottomSheet implements NotificationCenter.Notifi private boolean includeStory; public boolean includeStoryFromMessage; + public int timestamp; + public BlurredFrameLayout timestampFrameLayout; + public LinearLayout timestampLayout; + public CheckBox2 timestampCheckbox; + public TextView timestampTextView; + + public BlurredFrameLayout navigationBar; + private ChatActivity parentFragment; private Activity parentActivity; @@ -196,7 +212,6 @@ public class ShareAlert extends BottomSheet implements NotificationCenter.Notifi private SizeNotifierFrameLayout sizeNotifierFrameLayout; private ArrayList recentSearchObjects = new ArrayList<>(); private LongSparseArray recentSearchObjectsById = new LongSparseArray<>(); - private final Theme.ResourcesProvider resourcesProvider; TL_stories.StoryItem storyItem; public void setStoryToShare(TL_stories.StoryItem storyItem) { @@ -235,7 +250,7 @@ public SwitchView(Context context) { rect = new RectF(); searchBackground = new View(context); - searchBackground.setBackgroundDrawable(Theme.createRoundRectDrawable(dp(18), getThemedColor(darkTheme ? Theme.key_voipgroup_searchBackground : Theme.key_dialogSearchBackground))); + searchBackground.setBackgroundDrawable(Theme.createRoundRectDrawable(dp(18), getThemedColor(Theme.key_dialogSearchBackground))); addView(searchBackground, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 36, Gravity.LEFT | Gravity.TOP, 14, 0, 14, 0)); slidingView = new View(context) { @@ -346,13 +361,13 @@ public SearchField(Context context) { super(context); searchBackground = new View(context); - searchBackground.setBackgroundDrawable(Theme.createRoundRectDrawable(dp(18), getThemedColor(darkTheme ? Theme.key_voipgroup_searchBackground : Theme.key_dialogSearchBackground))); + searchBackground.setBackgroundDrawable(Theme.createRoundRectDrawable(dp(18), getThemedColor(Theme.key_dialogSearchBackground))); addView(searchBackground, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 36, Gravity.LEFT | Gravity.TOP, 14, 11, 14, 0)); searchIconImageView = new ImageView(context); searchIconImageView.setScaleType(ImageView.ScaleType.CENTER); searchIconImageView.setImageResource(R.drawable.smiles_inputsearch); - searchIconImageView.setColorFilter(new PorterDuffColorFilter(getThemedColor(darkTheme ? Theme.key_voipgroup_mutedIcon : Theme.key_dialogSearchIcon), PorterDuff.Mode.MULTIPLY)); + searchIconImageView.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_dialogSearchIcon), PorterDuff.Mode.MULTIPLY)); addView(searchIconImageView, LayoutHelper.createFrame(36, 36, Gravity.LEFT | Gravity.TOP, 16, 11, 0, 0)); clearSearchImageView = new ImageView(context); @@ -360,7 +375,7 @@ public SearchField(Context context) { clearSearchImageView.setImageDrawable(progressDrawable = new CloseProgressDrawable2() { @Override protected int getCurrentColor() { - return getThemedColor(darkTheme ? Theme.key_voipgroup_searchPlaceholder : Theme.key_dialogSearchIcon); + return getThemedColor(Theme.key_dialogSearchIcon); } }); progressDrawable.setSide(dp(7)); @@ -376,8 +391,8 @@ protected int getCurrentColor() { searchEditText = new EditTextBoldCursor(context); searchEditText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); - searchEditText.setHintTextColor(getThemedColor(darkTheme ? Theme.key_voipgroup_searchPlaceholder : Theme.key_dialogSearchHint)); - searchEditText.setTextColor(getThemedColor(darkTheme ? Theme.key_voipgroup_searchText : Theme.key_dialogSearchText)); + searchEditText.setHintTextColor(getThemedColor(Theme.key_dialogSearchHint)); + searchEditText.setTextColor(getThemedColor(Theme.key_dialogSearchText)); searchEditText.setBackgroundDrawable(null); searchEditText.setPadding(0, 0, 0, 0); searchEditText.setMaxLines(1); @@ -385,7 +400,7 @@ protected int getCurrentColor() { searchEditText.setSingleLine(true); searchEditText.setImeOptions(EditorInfo.IME_ACTION_SEARCH | EditorInfo.IME_FLAG_NO_EXTRACT_UI); searchEditText.setHint(LocaleController.getString(R.string.ShareSendTo)); - searchEditText.setCursorColor(getThemedColor(darkTheme ? Theme.key_voipgroup_searchText : Theme.key_featuredStickers_addedIcon)); + searchEditText.setCursorColor(getThemedColor(Theme.key_featuredStickers_addedIcon)); searchEditText.setCursorSize(dp(20)); searchEditText.setCursorWidth(1.5f); addView(searchEditText, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 40, Gravity.LEFT | Gravity.TOP, 16 + 38, 9, 16 + 30, 0)); @@ -470,27 +485,41 @@ public ShareAlert(final Context context, ArrayList messages, fina } public ShareAlert(final Context context, ArrayList messages, final String text, boolean channel, final String copyLink, boolean fullScreen, Theme.ResourcesProvider resourcesProvider) { - this(context, null, messages, text, null, channel, copyLink, null, fullScreen, false, false, resourcesProvider); + this(context, null, messages, text, null, channel, copyLink, null, fullScreen, false, false, null, resourcesProvider); } public ShareAlert(final Context context, ChatActivity fragment, ArrayList messages, final String text, final String text2, boolean channel, final String copyLink, final String copyLink2, boolean fullScreen, boolean forCall) { - this(context, fragment, messages, text, text2, channel, copyLink, copyLink2, fullScreen, forCall, false, null); + this(context, fragment, messages, text, text2, channel, copyLink, copyLink2, fullScreen, forCall, false, null, null); } - public ShareAlert(final Context context, ChatActivity fragment, ArrayList messages, final String text, final String text2, boolean channel, final String copyLink, final String copyLink2, boolean fullScreen, boolean forCall, boolean includeStory, Theme.ResourcesProvider resourcesProvider) { - super(context, true, resourcesProvider); - this.resourcesProvider = resourcesProvider; + public ShareAlert(final Context context, ChatActivity fragment, ArrayList messages, final String text, final String text2, boolean channel, final String copyLink, final String copyLink2, boolean fullScreen, boolean forCall, boolean includeStory, Integer video_timestamp, Theme.ResourcesProvider theme) { + super(context, true, theme); + this.resourcesProvider = theme; this.includeStory = includeStory; parentActivity = AndroidUtilities.findActivity(context); darkTheme = forCall; + if (darkTheme) { + this.resourcesProvider = new DarkThemeResourceProvider() { + @Override + public void appendColors() { + sparseIntArray.put(Theme.key_windowBackgroundGray, getColor(Theme.key_dialogBackground)); + sparseIntArray.put(Theme.key_divider, 0xFF171615); + sparseIntArray.put(Theme.key_chat_messagePanelIcons, Theme.multAlpha(Color.WHITE, .45f)); + sparseIntArray.put(Theme.key_dialogBackgroundGray, 0x14FFFFFF); + + sparseIntArray.put(Theme.key_chat_emojiPanelBackground, getColor(Theme.key_dialogBackground)); + } + }; + } parentFragment = fragment; shadowDrawable = context.getResources().getDrawable(R.drawable.sheet_shadow_round).mutate(); - int backgroundColor = getThemedColor(behindKeyboardColorKey = (darkTheme ? Theme.key_voipgroup_inviteMembersBackground : Theme.key_dialogBackground)); + int backgroundColor = getThemedColor(behindKeyboardColorKey = Theme.key_dialogBackground); shadowDrawable.setColorFilter(new PorterDuffColorFilter(backgroundColor, PorterDuff.Mode.MULTIPLY)); - fixNavigationBar(backgroundColor); +// fixNavigationBar(backgroundColor); + occupyNavigationBarWithoutKeyboard = true; isFullscreen = fullScreen; linkToCopy[0] = copyLink; @@ -529,6 +558,7 @@ public void onOpenAnimationEnd() { ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (response != null) { exportedMessageLink = (TLRPC.TL_exportedMessageLink) response; + updateLinkTextView(); if (copyLinkOnEnd) { copyLink(context); } @@ -552,6 +582,7 @@ public void onOpenAnimationEnd() { private int fromOffsetTop; private int toOffsetTop; + { adjustPanLayoutHelper = new AdjustPanLayoutHelper(this) { @@ -590,6 +621,7 @@ protected void onTransitionStart(boolean keyboardVisible, int contentHeight) { @Override protected void onTransitionEnd() { super.onTransitionEnd(); + keyboardT = commentTextView != null && commentTextView.isPopupVisible() || keyboardSize2 > dp(20) ? 1.0f : 0.0f; panTranslationMoveLayout = false; previousScrollOffsetY = scrollOffsetY; gridView.setTopGlowOffset(scrollOffsetY); @@ -597,15 +629,17 @@ protected void onTransitionEnd() { searchEmptyView.setTranslationY(scrollOffsetY); gridView.setTranslationY(0); searchGridView.setTranslationY(0); + updateBottomOverlay(); } @Override protected void onPanTranslationUpdate(float y, float progress, boolean keyboardVisible) { + keyboardT = progress; super.onPanTranslationUpdate(y, progress, keyboardVisible); for (int i = 0; i < containerView.getChildCount(); i++) { - if (containerView.getChildAt(i) != pickerBottomLayout && containerView.getChildAt(i) != bulletinContainer && containerView.getChildAt(i) != shadow[1] && containerView.getChildAt(i) != sharesCountLayout - && containerView.getChildAt(i) != frameLayout2 && containerView.getChildAt(i) != writeButtonContainer && containerView.getChildAt(i) != selectedCountView) { - containerView.getChildAt(i).setTranslationY(y); + final View child = containerView.getChildAt(i); + if (child != pickerBottom && child != bulletinContainer && child != shadow[1] && child != sharesCountLayout && child != frameLayout2 && child != timestampFrameLayout && child != writeButtonContainer && child != selectedCountView && child != navigationBar) { + child.setTranslationY(y); } } currentPanTranslationY = y; @@ -633,6 +667,7 @@ protected void onPanTranslationUpdate(float y, float progress, boolean keyboardV searchEmptyView.setTranslationY(scrollOffsetY + currentPanTranslationY); frameLayout2.invalidate(); setCurrentPanTranslationY(currentPanTranslationY); + updateBottomOverlay(); invalidate(); } @@ -646,6 +681,33 @@ protected boolean heightAnimationEnabled() { }; } + @Override + protected void drawList(Canvas blurCanvas, boolean top, ArrayList views) { + if (gridView.getVisibility() == View.VISIBLE && gridView.getAlpha() >= 0.0f) { + blurCanvas.save(); + blurCanvas.translate(gridView.getX(), gridView.getY()); + gridView.draw(blurCanvas); + blurCanvas.restore(); + } + if (topicsGridView.getVisibility() == View.VISIBLE && topicsGridView.getAlpha() >= 0.0f) { + blurCanvas.save(); + blurCanvas.translate(topicsGridView.getX(), topicsGridView.getY()); + topicsGridView.draw(blurCanvas); + blurCanvas.restore(); + } + if (searchGridView.getVisibility() == View.VISIBLE && searchGridView.getAlpha() >= 0.0f) { + blurCanvas.save(); + blurCanvas.translate(searchGridView.getX(), searchGridView.getY()); + searchGridView.draw(blurCanvas); + blurCanvas.restore(); + } + } + + @Override + protected Theme.ResourcesProvider getResourceProvider() { + return ShareAlert.this.resourcesProvider; + } + @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); @@ -688,14 +750,14 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int padding = (contentSize < availableHeight ? 0 : availableHeight - (availableHeight / 5 * 3)) + dp(8); if (gridView.getPaddingTop() != padding) { ignoreLayout = true; - gridView.setPadding(0, padding, 0, dp(48)); - topicsGridView.setPadding(0, padding, 0, dp(48)); + gridView.setPadding(0, padding, 0, dp(60 + (timestampFrameLayout != null ? 48 : 0)) + navigationBarHeight); + topicsGridView.setPadding(0, padding, 0, dp(60 + (timestampFrameLayout != null ? 48 : 0)) + navigationBarHeight); ignoreLayout = false; } if (keyboardVisible && getLayoutParams().height <= 0 && searchGridView.getPaddingTop() != padding) { ignoreLayout = true; - searchGridView.setPadding(0, 0, 0, dp(48)); + searchGridView.setPadding(0, 0, 0, dp(60 + (timestampFrameLayout != null ? 48 : 0)) + navigationBarHeight); ignoreLayout = false; } fullHeight = contentSize >= totalHeight; @@ -714,15 +776,15 @@ private void onMeasureInternal(int widthMeasureSpec, int heightMeasureSpec) { widthSize -= backgroundPaddingLeft * 2; - int keyboardSize = 0; - if (!commentTextView.isWaitingForKeyboardOpen() && keyboardSize <= dp(20) && !commentTextView.isPopupShowing() && !commentTextView.isAnimatePopupClosing()) { + keyboardSize2 = measureKeyboardHeight(); + if (!commentTextView.isWaitingForKeyboardOpen() && keyboardSize2 <= dp(20) && !commentTextView.isPopupShowing() && !commentTextView.isAnimatePopupClosing()) { ignoreLayout = true; commentTextView.hideEmojiView(); ignoreLayout = false; } ignoreLayout = true; - if (keyboardSize <= dp(20)) { + if (keyboardSize2 <= dp(20)) { if (!AndroidUtilities.isInMultiwindow) { int paddingBottom; if (keyboardVisible) { @@ -736,27 +798,28 @@ private void onMeasureInternal(int widthMeasureSpec, int heightMeasureSpec) { int visibility = commentTextView.isPopupShowing() ? GONE : VISIBLE; if (pickerBottomLayout != null) { pickerBottomLayout.setVisibility(visibility); - if (sharesCountLayout != null) { - sharesCountLayout.setVisibility(visibility); - } } } else { - commentTextView.hideEmojiView(); + if (!commentTextView.isPopupVisible()) { + commentTextView.hideEmojiView(); + } if (pickerBottomLayout != null) { pickerBottomLayout.setVisibility(GONE); - if (sharesCountLayout != null) { - sharesCountLayout.setVisibility(GONE); - } } } ignoreLayout = false; + if (navigationBar != null) { + navigationBar.measure(MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(navigationBarHeight, MeasureSpec.EXACTLY)); + } + int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { View child = getChildAt(i); if (child == null || child.getVisibility() == GONE) { continue; } + if (child == navigationBar) continue; if (commentTextView != null && commentTextView.isPopupView(child)) { if (AndroidUtilities.isInMultiwindow || AndroidUtilities.isTablet()) { if (AndroidUtilities.isTablet()) { @@ -771,6 +834,8 @@ private void onMeasureInternal(int widthMeasureSpec, int heightMeasureSpec) { measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0); } } + + updateBottomOverlay(); } @Override @@ -782,7 +847,7 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) { if (keyboardVisible) { paddingBottom = 0; } else { - paddingBottom = keyboardSize <= dp(20) && !AndroidUtilities.isInMultiwindow && !AndroidUtilities.isTablet() ? commentTextView.getEmojiPadding() : 0; + paddingBottom = keyboardSize <= dp(20) && !AndroidUtilities.isInMultiwindow && !AndroidUtilities.isTablet() ? navigationBarHeight + commentTextView.getEmojiPadding() : 0; } setBottomClip(paddingBottom); @@ -835,17 +900,17 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) { if (commentTextView != null && commentTextView.isPopupView(child)) { if (AndroidUtilities.isTablet()) { - childTop = getMeasuredHeight() - child.getMeasuredHeight(); + childTop = getMeasuredHeight() - navigationBarHeight - child.getMeasuredHeight(); } else { - childTop = getMeasuredHeight() + keyboardSize - child.getMeasuredHeight(); + childTop = getMeasuredHeight() - navigationBarHeight + keyboardSize - child.getMeasuredHeight(); } } child.layout(childLeft, childTop, childLeft + width, childTop + height); } notifyHeightChanged(); + updateBottomOverlay(); updateLayout(); - } @Override @@ -877,7 +942,7 @@ public void requestLayout() { super.requestLayout(); } - private boolean lightStatusBar = AndroidUtilities.computePerceivedBrightness(getThemedColor(darkTheme ? Theme.key_voipgroup_inviteMembersBackground : Theme.key_dialogBackground)) > .721f; + private boolean lightStatusBar = AndroidUtilities.computePerceivedBrightness(getThemedColor(Theme.key_dialogBackground)) > .721f; private final AnimatedFloat pinnedToTop = new AnimatedFloat(this, 0, 350, CubicBezierInterpolator.EASE_OUT_QUINT); @Override @@ -917,7 +982,7 @@ protected void onDraw(Canvas canvas) { if (pinAlpha < 1) { int w = dp(36); rect1.set((getMeasuredWidth() - w) / 2, y, (getMeasuredWidth() + w) / 2, y + dp(4)); - Theme.dialogs_onlineCirclePaint.setColor(getThemedColor(darkTheme ? Theme.key_voipgroup_scrollUp : Theme.key_sheet_scrollUp)); + Theme.dialogs_onlineCirclePaint.setColor(getThemedColor(Theme.key_sheet_scrollUp)); Theme.dialogs_onlineCirclePaint.setAlpha((int) (Theme.dialogs_onlineCirclePaint.getAlpha() * (1f - pinAlpha))); canvas.drawRoundRect(rect1, dp(2), dp(2), Theme.dialogs_onlineCirclePaint); } @@ -951,23 +1016,16 @@ protected void dispatchDraw(Canvas canvas) { containerView = sizeNotifierFrameLayout; containerView.setWillNotDraw(false); containerView.setClipChildren(false); - containerView.setPadding(backgroundPaddingLeft, 0, backgroundPaddingLeft, 0); + containerView.setPadding(backgroundPaddingLeft, 0, backgroundPaddingLeft, AndroidUtilities.navigationBarHeight); frameLayout = new FrameLayout(context); - frameLayout.setBackgroundColor(getThemedColor(darkTheme ? Theme.key_voipgroup_inviteMembersBackground : Theme.key_dialogBackground)); + frameLayout.setBackgroundColor(getThemedColor(Theme.key_dialogBackground)); if (darkTheme && linkToCopy[1] != null) { switchView = new SwitchView(context) { @Override protected void onTabSwitch(int num) { - if (pickerBottomLayout == null) { - return; - } - if (num == 0) { - pickerBottomLayout.setText(LocaleController.getString(R.string.VoipGroupCopySpeakerLink).toUpperCase()); - } else { - pickerBottomLayout.setText(LocaleController.getString(R.string.VoipGroupCopyListenLink).toUpperCase()); - } + updateLinkTextView(); } }; frameLayout.addView(switchView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 36, Gravity.TOP | Gravity.LEFT, 0, 11, 0, 0)); @@ -1012,7 +1070,7 @@ public void onScrolled(RecyclerView recyclerView, int dx, int dy) { } }); topicsGridView.setAdapter(shareTopicsAdapter = new ShareTopicsAdapter(context)); - topicsGridView.setGlowColor(getThemedColor(darkTheme ? Theme.key_voipgroup_inviteMembersBackground : Theme.key_dialogScrollGlow)); + topicsGridView.setGlowColor(getThemedColor(Theme.key_dialogScrollGlow)); topicsGridView.setVerticalScrollBarEnabled(false); topicsGridView.setHorizontalScrollBarEnabled(false); topicsGridView.setOverScrollMode(View.OVER_SCROLL_NEVER); @@ -1127,7 +1185,7 @@ public void getItemOffsets(android.graphics.Rect outRect, View view, RecyclerVie }); containerView.addView(gridView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, 0, 0, 0, 0)); gridView.setAdapter(listAdapter = new ShareDialogsAdapter(context)); - gridView.setGlowColor(getThemedColor(darkTheme ? Theme.key_voipgroup_inviteMembersBackground : Theme.key_dialogScrollGlow)); + gridView.setGlowColor(getThemedColor(Theme.key_dialogScrollGlow)); gridView.setOnItemClickListener((view, position) -> { if (position < 0) { return; @@ -1223,15 +1281,12 @@ public void getItemOffsets(android.graphics.Rect outRect, View view, RecyclerVie } }); searchGridView.setAdapter(searchAdapter); - searchGridView.setGlowColor(getThemedColor(darkTheme ? Theme.key_voipgroup_inviteMembersBackground : Theme.key_dialogScrollGlow)); + searchGridView.setGlowColor(getThemedColor(Theme.key_dialogScrollGlow)); recyclerItemsEnterAnimator = new RecyclerItemsEnterAnimator(searchGridView, true); - FlickerLoadingView flickerLoadingView = new FlickerLoadingView(context, resourcesProvider); + final FlickerLoadingView flickerLoadingView = new FlickerLoadingView(context, resourcesProvider); flickerLoadingView.setViewType(FlickerLoadingView.SHARE_ALERT_TYPE); - if (darkTheme) { - flickerLoadingView.setColors(Theme.key_voipgroup_inviteMembersBackground, Theme.key_voipgroup_searchBackground, -1); - } searchEmptyView = new StickerEmptyView(context, flickerLoadingView, StickerEmptyView.STICKER_TYPE_SEARCH, resourcesProvider); searchEmptyView.addView(flickerLoadingView, 0); searchEmptyView.setAnimateLayoutChange(true); @@ -1263,19 +1318,23 @@ public void getItemOffsets(android.graphics.Rect outRect, View view, RecyclerVie containerView.addView(shadow[1], frameLayoutParams); if (isChannel || linkToCopy[0] != null) { - pickerBottomLayout = new TextView(context); - pickerBottomLayout.setBackgroundDrawable(Theme.createSelectorWithBackgroundDrawable(getThemedColor(darkTheme ? Theme.key_voipgroup_inviteMembersBackground : Theme.key_dialogBackground), getThemedColor(darkTheme ? Theme.key_voipgroup_listSelector : Theme.key_listSelector))); - pickerBottomLayout.setTextColor(getThemedColor(darkTheme ? Theme.key_voipgroup_listeningText : Theme.key_dialogTextBlue2)); - pickerBottomLayout.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); - pickerBottomLayout.setPadding(dp(18), 0, dp(18), 0); - pickerBottomLayout.setTypeface(AndroidUtilities.bold()); - pickerBottomLayout.setGravity(Gravity.CENTER); - if (darkTheme && linkToCopy[1] != null) { - pickerBottomLayout.setText(LocaleController.getString(R.string.VoipGroupCopySpeakerLink).toUpperCase()); - } else { - pickerBottomLayout.setText(LocaleController.getString(R.string.CopyLink).toUpperCase()); - } - pickerBottomLayout.setOnClickListener(v -> { + pickerBottom = new FrameLayout(context); + + pickerBottomLayout = new BlurredFrameLayout(context, sizeNotifierFrameLayout); + pickerBottomLayout.isTopView = false; + pickerBottomLayout.setBackgroundColor(backgroundColor); + pickerBottom.addView(pickerBottomLayout); + + LinearLayout pickerBottomLinearLayout = new LinearLayout(context); + pickerBottomLinearLayout.setOrientation(LinearLayout.HORIZONTAL); + pickerBottomLayout.addView(pickerBottomLinearLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL)); + + linkContainer = new LinearLayout(context); + linkContainer.setOrientation(LinearLayout.HORIZONTAL); + linkContainer.setBackground(Theme.createSimpleSelectorRoundRectDrawable(dp(8), getThemedColor(Theme.key_share_linkBackground), Theme.blendOver(getThemedColor(Theme.key_share_linkBackground), getThemedColor(Theme.key_listSelector)))); + ScaleStateListAnimator.apply(linkContainer, 0.015f, 1.2f); + pickerBottomLinearLayout.addView(linkContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 42, 1, Gravity.FILL_HORIZONTAL | Gravity.BOTTOM, 11, 11, 11, 0)); + linkContainer.setOnClickListener(v -> { if (selectedDialogs.size() == 0 && (isChannel || linkToCopy[0] != null)) { dismiss(); if (linkToCopy[0] == null && loadingLink) { @@ -1286,30 +1345,62 @@ public void getItemOffsets(android.graphics.Rect outRect, View view, RecyclerVie } } }); - containerView.addView(pickerBottomLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.LEFT | Gravity.BOTTOM)); - - if (parentFragment != null && ChatObject.hasAdminRights(parentFragment.getCurrentChat()) && sendingMessageObjects.size() > 0 && sendingMessageObjects.get(0).messageOwner.forwards > 0) { - MessageObject messageObject = sendingMessageObjects.get(0); - if (!messageObject.isForwarded()) { - sharesCountLayout = new LinearLayout(context); - sharesCountLayout.setOrientation(LinearLayout.HORIZONTAL); - sharesCountLayout.setGravity(Gravity.CENTER_VERTICAL); - sharesCountLayout.setBackgroundDrawable(Theme.createSelectorDrawable(getThemedColor(darkTheme ? Theme.key_voipgroup_listSelector : Theme.key_listSelector), 2)); - containerView.addView(sharesCountLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 48, Gravity.RIGHT | Gravity.BOTTOM, 6, 0, -6, 0)); - sharesCountLayout.setOnClickListener(view -> parentFragment.presentFragment(new MessageStatisticActivity(messageObject))); - - ImageView imageView = new ImageView(context); - imageView.setImageResource(R.drawable.share_arrow); - imageView.setColorFilter(new PorterDuffColorFilter(getThemedColor(darkTheme ? Theme.key_voipgroup_listeningText : Theme.key_dialogTextBlue2), PorterDuff.Mode.MULTIPLY)); - sharesCountLayout.addView(imageView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.CENTER_VERTICAL, 20, 0, 0, 0)); - - TextView textView = new TextView(context); - textView.setText(String.format("%d", messageObject.messageOwner.forwards)); - textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); - textView.setTextColor(getThemedColor(darkTheme ? Theme.key_voipgroup_listeningText : Theme.key_dialogTextBlue2)); - textView.setGravity(Gravity.CENTER_VERTICAL); - textView.setTypeface(AndroidUtilities.bold()); - sharesCountLayout.addView(textView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.CENTER_VERTICAL, 8, 0, 20, 0)); + + linkTextView = new SimpleTextView(context); + linkTextView.setTextSize(15); + linkTextView.setTextColor(getThemedColor(Theme.key_share_linkText)); + linkTextView.setEllipsizeByGradient(true); + updateLinkTextView(); + linkContainer.addView(linkTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 1, Gravity.FILL_HORIZONTAL | Gravity.CENTER_VERTICAL, 16, 0, 16, 0)); + + linkCopyButton = new TextView(context); + linkCopyButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + linkCopyButton.setTextColor(getThemedColor(Theme.key_windowBackgroundWhiteBlackText)); + linkCopyButton.setText(LocaleController.getString(R.string.Copy).toUpperCase()); + linkCopyButton.setPadding(dp(9), 0, dp(9), 0); + linkCopyButton.setTypeface(AndroidUtilities.bold()); + linkCopyButton.setGravity(Gravity.CENTER); + linkCopyButton.setBackground(Theme.createRadSelectorDrawable(getThemedColor(Theme.key_listSelector), 4, 4)); + linkContainer.addView(linkCopyButton, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 28, 0, Gravity.RIGHT | Gravity.CENTER_VERTICAL, 0, 0, 7, 0)); + linkCopyButton.setOnClickListener(v -> { + if (selectedDialogs.size() == 0 && (isChannel || linkToCopy[0] != null)) { + dismiss(); + if (linkToCopy[0] == null && loadingLink) { + copyLinkOnEnd = true; + Toast.makeText(ShareAlert.this.getContext(), LocaleController.getString(R.string.Loading), Toast.LENGTH_SHORT).show(); + } else { + copyLink(ShareAlert.this.getContext()); + } + } + }); + ScaleStateListAnimator.apply(linkCopyButton); + + final View shadow = new View(context); + shadow.setBackgroundColor(getThemedColor(Theme.key_divider)); + pickerBottomLayout.addView(shadow, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, darkTheme ? 0.66f : 1.0f / AndroidUtilities.density, Gravity.FILL_HORIZONTAL | Gravity.TOP)); + containerView.addView(pickerBottom, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 53, Gravity.LEFT | Gravity.BOTTOM)); + + if (sendingMessageObjects != null && sendingMessageObjects.size() > 0 && sendingMessageObjects.get(0).messageOwner != null && sendingMessageObjects.get(0).messageOwner.forwards > 0) { + final MessageObject messageObject = sendingMessageObjects.get(0); + final TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-messageObject.getDialogId()); + if (ChatObject.hasAdminRights(chat) && !messageObject.isForwarded()) { + final LinearLayout sharesLayout = new LinearLayout(context); + sharesLayout.setOrientation(LinearLayout.HORIZONTAL); + + final ImageView imageView = new ImageView(context); + imageView.setImageResource(R.drawable.mini_stats_shares); + imageView.setScaleType(ImageView.ScaleType.CENTER); + imageView.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_share_icon), PorterDuff.Mode.SRC_IN)); + sharesLayout.addView(imageView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, Gravity.CENTER_VERTICAL)); + + final TextView textView = new TextView(context); + textView.setTextColor(getThemedColor(Theme.key_share_icon)); + textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); + textView.setGravity(Gravity.CENTER); + textView.setText(LocaleController.formatNumber(messageObject.messageOwner.forwards, ',')); + sharesLayout.addView(textView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, Gravity.CENTER_VERTICAL, 4, -1, 0, 0)); + + pickerBottomLinearLayout.addView(sharesLayout, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, Gravity.CENTER_VERTICAL, 5, 5, 16, 0)); } } } else { @@ -1322,7 +1413,7 @@ public void getItemOffsets(android.graphics.Rect outRect, View view, RecyclerVie bulletinContainer2 = new FrameLayout(context); containerView.addView(bulletinContainer2, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.FILL_HORIZONTAL | Gravity.TOP, 0, 0, 0, 0)); - frameLayout2 = new FrameLayout(context) { + frameLayout2 = new BlurredFrameLayout(context, sizeNotifierFrameLayout) { private final Paint p = new Paint(); private int color; @@ -1361,31 +1452,42 @@ protected void onDraw(Canvas canvas) { } float alphaOffset = (frameLayout2.getMeasuredHeight() - dp(48)) * (1f - getAlpha()); shadow[1].setTranslationY(-(frameLayout2.getMeasuredHeight() - dp(48)) + captionEditTextTopOffset + currentPanTranslationY + alphaOffset); - -// int newColor = getThemedColor(darkTheme ? Theme.key_voipgroup_inviteMembersBackground : Theme.key_dialogBackground); -// if (color != newColor) { -// color = newColor; -// p.setColor(color); -// } -// canvas.drawRect(0, captionEditTextTopOffset + alphaOffset, getMeasuredWidth(), getMeasuredHeight(), p); } + private final Paint dividerPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + @Override protected void dispatchDraw(Canvas canvas) { canvas.save(); canvas.clipRect(0, captionEditTextTopOffset, getMeasuredWidth(), getMeasuredHeight()); + dividerPaint.setColor(getThemedColor(Theme.key_divider)); + canvas.drawRect(0, captionEditTextTopOffset, getMeasuredWidth(), dpf2(.66f), dividerPaint); super.dispatchDraw(canvas); canvas.restore(); } }; + frameLayout2.setBackgroundColor(backgroundColor); + frameLayout2.isTopView = false; frameLayout2.setWillNotDraw(false); frameLayout2.setAlpha(0.0f); frameLayout2.setVisibility(View.INVISIBLE); containerView.addView(frameLayout2, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.BOTTOM)); frameLayout2.setOnTouchListener((v, event) -> true); + navigationBar = new BlurredFrameLayout(context, sizeNotifierFrameLayout); + navigationBar.setBackgroundColor(getThemedColor(Theme.key_dialogBackground)); + navigationBar.isTopView = false; + containerView.addView(navigationBar, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 0, Gravity.FILL_HORIZONTAL | Gravity.BOTTOM)); + AndroidUtilities.setLightNavigationBar(container, AndroidUtilities.computePerceivedBrightness(getThemedColor(Theme.key_dialogBackground)) > .721f); + commentTextView = new EditTextEmoji(context, sizeNotifierFrameLayout, null, EditTextEmoji.STYLE_DIALOG, true, resourcesProvider) { + @Override + protected void bottomPanelTranslationY(float translation) { + super.bottomPanelTranslationY(translation); + updateBottomOverlay(); + } + private boolean shouldAnimateEditTextWithBounds; private int messageEditTextPredrawHeigth; private int messageEditTextPredrawScrollY; @@ -1430,22 +1532,42 @@ protected void onLineCountChanged(int oldLineCount, int newLineCount) { @Override protected void showPopup(int show) { super.showPopup(show); - if (darkTheme) { - navBarColorKey = -1; - AndroidUtilities.setNavigationBarColor(ShareAlert.this.getWindow(), ShareAlert.this.getThemedColor(Theme.key_windowBackgroundGray), true, color -> { - ShareAlert.this.setOverlayNavBarColor(navBarColor = color); - }); - } +// if (darkTheme) { +// navBarColorKey = -1; +// AndroidUtilities.setNavigationBarColor(ShareAlert.this.getWindow(), ShareAlert.this.getThemedColor(Theme.key_windowBackgroundGray), true, color -> { +// ShareAlert.this.setOverlayNavBarColor(navBarColor = color); +// }); +// } } @Override public void hidePopup(boolean byBackButton) { super.hidePopup(byBackButton); - if (darkTheme) { - navBarColorKey = -1; - AndroidUtilities.setNavigationBarColor(ShareAlert.this.getWindow(), ShareAlert.this.getThemedColor(Theme.key_voipgroup_inviteMembersBackground), true, color -> { - ShareAlert.this.setOverlayNavBarColor(navBarColor = color); - }); +// if (darkTheme) { +// navBarColorKey = -1; +// AndroidUtilities.setNavigationBarColor(ShareAlert.this.getWindow(), ShareAlert.this.getThemedColor(Theme.key_voipgroup_inviteMembersBackground), true, color -> { +// ShareAlert.this.setOverlayNavBarColor(navBarColor = color); +// }); +// } + } + + @Override + protected void createEmojiView() { + super.createEmojiView(); + if (navigationBar != null) { + navigationBar.bringToFront(); + } + if (timestampFrameLayout != null) { + timestampFrameLayout.bringToFront(); + } + if (frameLayout2 != null) { + frameLayout2.bringToFront(); + } + if (writeButtonContainer != null) { + writeButtonContainer.bringToFront(); + } + if (selectedCountView != null) { + selectedCountView.bringToFront(); } } }; @@ -1453,7 +1575,7 @@ public void hidePopup(boolean byBackButton) { commentTextView.getEditText().setTextColor(getThemedColor(Theme.key_voipgroup_nameText)); commentTextView.getEditText().setCursorColor(getThemedColor(Theme.key_voipgroup_nameText)); } - commentTextView.setBackgroundColor(backgroundColor); +// commentTextView.setBackgroundColor(backgroundColor); commentTextView.setHint(LocaleController.getString(R.string.ShareComment)); commentTextView.onResume(); commentTextView.setPadding(0, 0, dp(84), 0); @@ -1489,7 +1611,7 @@ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { combinedDrawable.setIconSize(dp(56), dp(56)); drawable = combinedDrawable; } - writeButton.setBackgroundDrawable(drawable); + writeButton.setBackground(drawable); writeButton.setImageResource(R.drawable.attach_send); writeButton.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); writeButton.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_dialogFloatingIcon), PorterDuff.Mode.MULTIPLY)); @@ -1522,7 +1644,7 @@ protected void onDraw(Canvas canvas) { int cy = getMeasuredHeight() / 2; textPaint.setColor(getThemedColor(Theme.key_dialogRoundCheckBoxCheck)); - paint.setColor(getThemedColor(darkTheme ? Theme.key_voipgroup_inviteMembersBackground : Theme.key_dialogBackground)); + paint.setColor(getThemedColor(Theme.key_dialogBackground)); rect.set(cx - size / 2, 0, cx + size / 2, getMeasuredHeight()); canvas.drawRoundRect(rect, dp(12), dp(12), paint); @@ -1538,6 +1660,50 @@ protected void onDraw(Canvas canvas) { selectedCountView.setScaleY(0.2f); containerView.addView(selectedCountView, LayoutHelper.createFrame(42, 24, Gravity.RIGHT | Gravity.BOTTOM, 0, 0, -8, 9)); + if (video_timestamp != null) { + timestamp = video_timestamp; + + timestampFrameLayout = new BlurredFrameLayout(context, sizeNotifierFrameLayout); + timestampFrameLayout.setBackgroundColor(backgroundColor); + timestampFrameLayout.isTopView = false; + + timestampLayout = new LinearLayout(context); + timestampLayout.setPadding(dp(12), dp(4), dp(12), dp(4)); + timestampLayout.setClipToPadding(false); + timestampLayout.setOrientation(LinearLayout.HORIZONTAL); + timestampLayout.setBackground(Theme.createRadSelectorDrawable(getThemedColor(Theme.key_listSelector), 6, 6)); + timestampCheckbox = new CheckBox2(context, 24, resourcesProvider); + timestampCheckbox.setColor(Theme.key_radioBackgroundChecked, Theme.key_checkboxDisabled, Theme.key_checkboxCheck); + timestampCheckbox.setDrawUnchecked(true); + timestampCheckbox.setChecked(false, false); + timestampCheckbox.setDrawBackgroundAsArc(10); + timestampLayout.addView(timestampCheckbox, LayoutHelper.createLinear(26, 26, Gravity.CENTER_VERTICAL, 0, 0, 0, 0)); + timestampTextView = new TextView(context); + timestampTextView.setTextColor(getThemedColor(Theme.key_dialogTextBlack)); + timestampTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + timestampTextView.setText(LocaleController.formatString(R.string.VideoShareAddTimestamp, AndroidUtilities.formatShortDuration(video_timestamp))); + timestampLayout.addView(timestampTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, 9, 0, 0, 0)); + ScaleStateListAnimator.apply(timestampLayout, 0.025f, 1.5f); + timestampLayout.setOnClickListener(v -> { + timestampCheckbox.setChecked(!timestampCheckbox.isChecked(), true); + updateLinkTextView(); + }); + timestampFrameLayout.addView(timestampLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER)); + + if (pickerBottom == null) { + View shadow = new View(context); + shadow.setBackgroundColor(getThemedColor(Theme.key_divider)); + timestampFrameLayout.addView(shadow, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, darkTheme ? 0.66f : 1.0f / AndroidUtilities.density, Gravity.FILL_HORIZONTAL | Gravity.TOP)); + } + + containerView.addView(timestampFrameLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.LEFT | Gravity.BOTTOM)); + + if (pickerBottom == null) { + timestampFrameLayout.setAlpha(0.0f); + timestampFrameLayout.setVisibility(View.INVISIBLE); + } + } + updateSelectedCount(0); DialogsActivity.loadDialogs(AccountInstance.getInstance(currentAccount)); @@ -1950,7 +2116,7 @@ public boolean onTouch(View v, MotionEvent event) { showSendersNameView.setChecked(showSendersName = false); hideSendersNameView.setChecked(!showSendersName); }); - sendPopupLayout1.setupRadialSelectors(getThemedColor(darkTheme ? Theme.key_voipgroup_listSelector : Theme.key_dialogButtonSelector)); + sendPopupLayout1.setupRadialSelectors(getThemedColor(Theme.key_dialogButtonSelector)); layout.addView(sendPopupLayout1, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 0, 0, -8)); } @@ -2011,7 +2177,7 @@ public boolean onTouch(View v, MotionEvent event) { } sendInternal(true); }); - sendPopupLayout2.setupRadialSelectors(getThemedColor(darkTheme ? Theme.key_voipgroup_listSelector : Theme.key_dialogButtonSelector)); + sendPopupLayout2.setupRadialSelectors(getThemedColor(Theme.key_dialogButtonSelector)); layout.addView(sendPopupLayout2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); @@ -2037,7 +2203,9 @@ public boolean onTouch(View v, MotionEvent event) { } sendPopupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, location[0] + view.getMeasuredWidth() - layout.getMeasuredWidth() + dp(8), y); sendPopupWindow.dimBehind(); - view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} return true; } @@ -2052,6 +2220,19 @@ protected void sendInternal(boolean withSound) { CharSequence[] text = new CharSequence[] { commentTextView.getText() }; ArrayList entities = MediaDataController.getInstance(currentAccount).getEntities(text, true); + int video_timestamp = -1; + if (timestampCheckbox != null && timestampCheckbox.isChecked()) { + video_timestamp = timestamp; + } +// String finalText = null; +// if (linkContainer != null && !TextUtils.isEmpty(getLink())) { +// finalText = getLink(); +// if (frameLayout2.getTag() != null && commentTextView.length() > 0) { +// finalText += "\n\n"; +// MediaDataController.offsetEntities(entities, finalText.length()); +// finalText += text[0]; +// } +// } if (sendingMessageObjects != null) { List removeKeys = new ArrayList<>(); for (int a = 0; a < selectedDialogs.size(); a++) { @@ -2061,10 +2242,16 @@ protected void sendInternal(boolean withSound) { if (replyTopMsg != null) { replyTopMsg.isTopicMainMessage = true; } - if (frameLayout2.getTag() != null && commentTextView.length() > 0) { - SendMessagesHelper.getInstance(currentAccount).sendMessage(SendMessagesHelper.SendMessageParams.of(text[0] == null ? null : text[0].toString(), key, replyTopMsg, replyTopMsg, null, true, entities, null, null, withSound, 0, null, false)); - } - int result = SendMessagesHelper.getInstance(currentAccount).sendMessage(sendingMessageObjects, key, !showSendersName,false, withSound, 0, replyTopMsg); + int result; +// if (finalText != null) { +// SendMessagesHelper.getInstance(currentAccount).sendMessage(SendMessagesHelper.SendMessageParams.of(finalText, key, replyTopMsg, replyTopMsg, null, true, entities, null, null, withSound, 0, null, false)); +// result = 0; +// } else { + if (frameLayout2.getTag() != null && commentTextView.length() > 0) { + SendMessagesHelper.getInstance(currentAccount).sendMessage(SendMessagesHelper.SendMessageParams.of(text[0] == null ? null : text[0].toString(), key, replyTopMsg, replyTopMsg, null, true, entities, null, null, withSound, 0, null, false)); + } + result = SendMessagesHelper.getInstance(currentAccount).sendMessage(sendingMessageObjects, key, !showSendersName,false, withSound, 0, replyTopMsg, video_timestamp); +// } if (result != 0) { removeKeys.add(key); } @@ -2308,18 +2495,13 @@ private void copyLink(Context context) { return; } try { - String link; - if (switchView != null) { - link = linkToCopy[switchView.currentTab]; - } else { - link = linkToCopy[0]; - } + final String link = getLink(); android.content.ClipboardManager clipboard = (android.content.ClipboardManager) ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE); android.content.ClipData clip = android.content.ClipData.newPlainText("label", link != null ? link : exportedMessageLink.link); clipboard.setPrimaryClip(clip); if ((delegate == null || !delegate.didCopy()) && parentActivity instanceof LaunchActivity) { final boolean isPrivate = exportedMessageLink != null && exportedMessageLink.link.contains("/c/"); - ((LaunchActivity) parentActivity).showBulletin(factory -> factory.createCopyLinkBulletin(isPrivate, resourcesProvider)); + ((LaunchActivity) parentActivity).showBulletin(factory -> factory.createCopyLinkBulletin(isPrivate)); } } catch (Exception e) { FileLog.e(e); @@ -2340,10 +2522,17 @@ private boolean showCommentTextView(final boolean show) { commentTextView.hidePopup(true); if (show) { frameLayout2.setVisibility(View.VISIBLE); + if (timestampFrameLayout != null && pickerBottom == null) { + timestampFrameLayout.setVisibility(View.VISIBLE); + } writeButtonContainer.setVisibility(View.VISIBLE); + } else { + if (pickerBottom != null) { + pickerBottom.setVisibility(View.VISIBLE); + } } - if (pickerBottomLayout != null) { - ViewCompat.setImportantForAccessibility(pickerBottomLayout, show ? ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS : ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); + if (pickerBottom != null) { + ViewCompat.setImportantForAccessibility(pickerBottom, show ? ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS : ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); } if (sharesCountLayout != null) { ViewCompat.setImportantForAccessibility(sharesCountLayout, show ? ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS : ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); @@ -2351,15 +2540,21 @@ private boolean showCommentTextView(final boolean show) { animatorSet = new AnimatorSet(); ArrayList animators = new ArrayList<>(); animators.add(ObjectAnimator.ofFloat(frameLayout2, View.ALPHA, show ? 1.0f : 0.0f)); + if (timestampFrameLayout != null && pickerBottom == null) { + animators.add(ObjectAnimator.ofFloat(timestampFrameLayout, View.ALPHA, show ? 1.0f : 0.0f)); + } animators.add(ObjectAnimator.ofFloat(writeButtonContainer, View.SCALE_X, show ? 1.0f : 0.2f)); animators.add(ObjectAnimator.ofFloat(writeButtonContainer, View.SCALE_Y, show ? 1.0f : 0.2f)); animators.add(ObjectAnimator.ofFloat(writeButtonContainer, View.ALPHA, show ? 1.0f : 0.0f)); animators.add(ObjectAnimator.ofFloat(selectedCountView, View.SCALE_X, show ? 1.0f : 0.2f)); animators.add(ObjectAnimator.ofFloat(selectedCountView, View.SCALE_Y, show ? 1.0f : 0.2f)); animators.add(ObjectAnimator.ofFloat(selectedCountView, View.ALPHA, show ? 1.0f : 0.0f)); - if (pickerBottomLayout == null || pickerBottomLayout.getVisibility() != View.VISIBLE) { + if (pickerBottom == null || pickerBottom.getVisibility() != View.VISIBLE) { animators.add(ObjectAnimator.ofFloat(shadow[1], View.ALPHA, show ? 1.0f : 0.0f)); } + if (pickerBottomLayout != null) { + animators.add(ObjectAnimator.ofFloat(pickerBottomLayout, View.TRANSLATION_Y, show ? dp(5) : 0.0f)); + } animatorSet.playTogether(animators); animatorSet.setInterpolator(new DecelerateInterpolator()); @@ -2370,7 +2565,14 @@ public void onAnimationEnd(Animator animation) { if (animation.equals(animatorSet)) { if (!show) { frameLayout2.setVisibility(View.INVISIBLE); + if (timestampFrameLayout != null && pickerBottom == null) { + timestampFrameLayout.setVisibility(View.INVISIBLE); + } writeButtonContainer.setVisibility(View.INVISIBLE); + } else { + if (pickerBottom != null) { + pickerBottom.setVisibility(View.INVISIBLE); + } } animatorSet = null; } @@ -2530,7 +2732,7 @@ public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType View view; switch (viewType) { case 0: { - view = new ShareDialogCell(context, darkTheme ? ShareDialogCell.TYPE_CALL : ShareDialogCell.TYPE_SHARE, resourcesProvider) { + view = new ShareDialogCell(context, ShareDialogCell.TYPE_SHARE, resourcesProvider) { @Override protected String repostToCustomName() { if (includeStoryFromMessage) { @@ -3069,7 +3271,7 @@ public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType View view; switch (viewType) { case 5: { - view = new ShareDialogCell(context, darkTheme ? ShareDialogCell.TYPE_CALL : ShareDialogCell.TYPE_SHARE, resourcesProvider); + view = new ShareDialogCell(context, ShareDialogCell.TYPE_SHARE, resourcesProvider); view.setLayoutParams(new RecyclerView.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT, dp(100))); break; } @@ -3165,8 +3367,8 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { } case 3: { GraySectionCell graySectionCell = new GraySectionCell(context, resourcesProvider); - graySectionCell.setTextColor(darkTheme ? Theme.key_voipgroup_nameText : Theme.key_graySectionText); - graySectionCell.setBackgroundColor(getThemedColor(darkTheme ? Theme.key_voipgroup_searchBackground : Theme.key_graySection)); + graySectionCell.setTextColor(Theme.key_graySectionText); + graySectionCell.setBackgroundColor(getThemedColor(Theme.key_graySection)); graySectionCell.setText(LocaleController.getString(R.string.Recent)); view = graySectionCell; break; @@ -3343,4 +3545,72 @@ private void checkCurrentList(boolean force) { } } } + + private String getLink() { + String link; + if (switchView != null) { + link = linkToCopy[switchView.currentTab]; + } else { + link = linkToCopy[0]; + } + if (link == null && exportedMessageLink != null) { + link = exportedMessageLink.link; + } + if (timestampCheckbox != null && timestampCheckbox.isChecked()) { + try { + link = Uri.parse(link).buildUpon().appendQueryParameter("t", AndroidUtilities.formatTimestamp(timestamp)).build().toString(); + } catch (Exception e) { + FileLog.e(e); + } + } + if (link == null) { + return ""; + } + return link; + } + + private void updateLinkTextView() { + if (linkTextView != null) { + String link = getLink(); + if (link != null) { + if (link.startsWith("https://")) { + link = link.substring(8); + } else if (link.startsWith("http://")) { + link = link.substring(7); + } + } + linkTextView.setText(link); + } + } + + private float keyboardT; + private int keyboardSize2; + public void updateBottomOverlay() { + if (frameLayout2 == null) return; + final boolean emojiVisible = commentTextView != null && commentTextView.isPopupVisible(); + if (emojiVisible) { + keyboardT = commentTextView.getEmojiPaddingShown(); + navigationBar.setAlpha(1.0f - keyboardT); + } else if (sizeNotifierFrameLayout != null && sizeNotifierFrameLayout.adjustPanLayoutHelper != null && !sizeNotifierFrameLayout.adjustPanLayoutHelper.animationInProgress()) { + keyboardT = keyboardSize2 > dp(20) ? 1.0f : 0.0f; + navigationBar.setAlpha(1.0f); + } else { + navigationBar.setAlpha(1.0f - keyboardT); + } + navigationBar.setTranslationY(navigationBarHeight); + float bottomMargin = 0; + if (timestampFrameLayout != null) { + timestampFrameLayout.setTranslationY(-bottomMargin); + bottomMargin += dp(48); + } + if (pickerBottom != null) { + pickerBottom.setTranslationY(-bottomMargin); + if (sharesCountLayout != null) { + sharesCountLayout.setTranslationY(-bottomMargin); + } + } + frameLayout2.setTranslationY(-bottomMargin); + writeButtonContainer.setTranslationY(-bottomMargin); + selectedCountView.setTranslationY(-bottomMargin); + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java index 5752653661..9f6b797fd3 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java @@ -133,6 +133,7 @@ import org.telegram.ui.PhotoViewer; import org.telegram.ui.PremiumPreviewFragment; import org.telegram.ui.ProfileActivity; +import org.telegram.ui.Stars.StarsController; import org.telegram.ui.Stories.StoriesController; import org.telegram.ui.Stories.StoriesListPlaceProvider; import org.telegram.ui.Stories.UserListPoller; @@ -514,9 +515,9 @@ public float getPhotoVideoOptionsAlpha(float progress) { return 0; } float alpha = 0; - if (mediaPages[1] != null && (mediaPages[1].selectedType == TAB_PHOTOVIDEO || mediaPages[1].selectedType == TAB_STORIES && TextUtils.isEmpty(getStoriesHashtag()) || mediaPages[1].selectedType == TAB_ARCHIVED_STORIES || mediaPages[1].selectedType == TAB_SAVED_DIALOGS || mediaPages[1].selectedType == TAB_BOT_PREVIEWS)) + if (mediaPages[1] != null && (mediaPages[1].selectedType == TAB_PHOTOVIDEO || mediaPages[1].selectedType == TAB_STORIES && TextUtils.isEmpty(getStoriesHashtag()) || mediaPages[1].selectedType == TAB_ARCHIVED_STORIES || mediaPages[1].selectedType == TAB_SAVED_DIALOGS || mediaPages[1].selectedType == TAB_BOT_PREVIEWS || mediaPages[1].selectedType == TAB_GIFTS && giftsContainer.canFilter())) alpha += progress; - if (mediaPages[0] != null && (mediaPages[0].selectedType == TAB_PHOTOVIDEO || mediaPages[0].selectedType == TAB_STORIES && TextUtils.isEmpty(getStoriesHashtag()) || mediaPages[0].selectedType == TAB_ARCHIVED_STORIES || mediaPages[0].selectedType == TAB_SAVED_DIALOGS || mediaPages[0].selectedType == TAB_BOT_PREVIEWS)) + if (mediaPages[0] != null && (mediaPages[0].selectedType == TAB_PHOTOVIDEO || mediaPages[0].selectedType == TAB_STORIES && TextUtils.isEmpty(getStoriesHashtag()) || mediaPages[0].selectedType == TAB_ARCHIVED_STORIES || mediaPages[0].selectedType == TAB_SAVED_DIALOGS || mediaPages[0].selectedType == TAB_BOT_PREVIEWS || mediaPages[0].selectedType == TAB_GIFTS && giftsContainer.canFilter())) alpha += 1f - progress; return alpha; } @@ -1136,7 +1137,7 @@ public boolean isMediaWasLoaded() { private PhotoViewer.PhotoViewerProvider provider = new PhotoViewer.EmptyPhotoViewerProvider() { @Override - public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { + public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview, boolean closing) { if (messageObject == null || mediaPages[0].selectedType != 0 && mediaPages[0].selectedType != 1 && mediaPages[0].selectedType != 3 && mediaPages[0].selectedType != 5) { return null; } @@ -1479,7 +1480,7 @@ public SharedMediaLayout(Context context, long did, SharedMediaPreloader preload this.initialTab = TAB_STORIES; } else if (userInfo != null && userInfo.stories_pinned_available || chatInfo != null && chatInfo.stories_pinned_available || isStoriesView()) { this.initialTab = getInitialTab(); - } else if (userInfo != null && userInfo.stargifts_count > 0) { + } else if (userInfo != null && userInfo.stargifts_count > 0 || chatInfo != null && chatInfo.stargifts_count > 0) { this.initialTab = TAB_GIFTS; } else if (initialTab != -1 && topicId == 0) { this.initialTab = initialTab; @@ -1733,6 +1734,73 @@ public void onClick(View view) { final int currentAccount = profileActivity.getCurrentAccount(); final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(dialog_id); + if (tab == TAB_GIFTS) { + final StarsController.GiftsList list = giftsContainer.getList(); + ItemOptions.makeOptions(profileActivity, photoVideoOptionsItem) + .addIf(!list.sort_by_date, R.drawable.menu_sort_date, getString(R.string.Gift2FilterSortByDate), () -> { + list.sort_by_date = true; + list.invalidate(true); + }) + .addIf(list.sort_by_date, R.drawable.menu_sort_value, getString(R.string.Gift2FilterSortByValue), () -> { + list.sort_by_date = false; + list.invalidate(true); + }) + .addGap() + .addChecked(list.include_unlimited, getString(R.string.Gift2FilterUnlimited), () -> { + if (list.include_unlimited && !list.include_limited && !list.include_unique) { + list.include_unlimited = false; + list.include_limited = true; + list.include_unique = true; + } else { + list.include_unlimited = !list.include_unlimited; + } + list.invalidate(true); + }) + .addChecked(list.include_limited, getString(R.string.Gift2FilterLimited), () -> { + if (list.include_limited && !list.include_unlimited && !list.include_unique) { + list.include_limited = false; + list.include_unlimited = true; + list.include_unique = true; + } else { + list.include_limited = !list.include_limited; + } + list.invalidate(true); + }) + .addChecked(list.include_unique, getString(R.string.Gift2FilterUnique), () -> { + if (list.include_unique && !list.include_limited && !list.include_unlimited) { + list.include_unique = false; + list.include_limited = true; + list.include_unlimited = true; + } else { + list.include_unique = !list.include_unique; + } + list.invalidate(true); + }) + .addGap() + .addChecked(list.include_displayed, getString(R.string.Gift2FilterDisplayed), () -> { + if (list.include_displayed && !list.include_hidden) { + list.include_displayed = false; + list.include_hidden = true; + } else { + list.include_displayed = !list.include_displayed; + } + list.invalidate(true); + }) + .addChecked(list.include_hidden, getString(R.string.Gift2FilterHidden), () -> { + if (list.include_hidden && !list.include_displayed) { + list.include_hidden = false; + list.include_displayed = true; + } else { + list.include_hidden = !list.include_hidden; + } + list.invalidate(true); + }) + .setOnTopOfScrim() + .setDimAlpha(0) + .show(); + return; + } + if (tab == TAB_BOT_PREVIEWS && user != null && user.bot && user.bot_has_main_app && user.bot_can_edit && botPreviewsContainer != null) { ItemOptions.makeOptions(profileActivity, photoVideoOptionsItem) .addIf(botPreviewsContainer.getItemsCount() < profileActivity.getMessagesController().botPreviewMediasMax, R.drawable.msg_addbot, getString(R.string.ProfileBotAddPreview), () -> { @@ -2294,7 +2362,7 @@ public int getStartedTrackingX() { } }; } else if (profileActivity instanceof ProfileActivity) { - giftsContainer = new ProfileGiftsContainer(context, profileActivity.getCurrentAccount(), ((ProfileActivity) profileActivity).getDialogId(), resourcesProvider) { + giftsContainer = new ProfileGiftsContainer(profileActivity, context, profileActivity.getCurrentAccount(), ((ProfileActivity) profileActivity).getDialogId(), resourcesProvider) { @Override protected int processColor(int color) { return SharedMediaLayout.this.processColor(color); @@ -2823,7 +2891,14 @@ public void getItemOffsets(android.graphics.Rect outRect, View view, RecyclerVie } else if (mediaPage.selectedType == TAB_RECOMMENDED_CHANNELS) { if ((view instanceof ProfileSearchCell || y < dp(60)) && position >= 0 && position < channelRecommendationsAdapter.chats.size()) { Bundle args = new Bundle(); - args.putLong("chat_id", channelRecommendationsAdapter.chats.get(position).id); + TLObject obj = channelRecommendationsAdapter.chats.get(position); + if (obj instanceof TLRPC.Chat) { + args.putLong("chat_id", ((TLRPC.Chat) obj).id); + } else if (obj instanceof TLRPC.User) { + args.putLong("user_id", ((TLRPC.User) obj).id); + } else { + return; + } profileActivity.presentFragment(new ChatActivity(args)); } } else if (mediaPage.selectedType == TAB_SAVED_DIALOGS) { @@ -4075,7 +4150,8 @@ public boolean isSearchItemVisible(int type) { type != TAB_COMMON_GROUPS && type != TAB_SAVED_DIALOGS && type != TAB_RECOMMENDED_CHANNELS && - type != TAB_BOT_PREVIEWS + type != TAB_BOT_PREVIEWS && + type != TAB_GIFTS ); } @@ -4088,7 +4164,8 @@ public boolean isCalendarItemVisible() { } public boolean isOptionsItemVisible() { - return mediaPages[0].selectedType == TAB_PHOTOVIDEO || mediaPages[0].selectedType == TAB_STORIES || mediaPages[0].selectedType == TAB_ARCHIVED_STORIES || mediaPages[0].selectedType == TAB_SAVED_DIALOGS || mediaPages[0].selectedType == TAB_BOT_PREVIEWS; + final int type = mediaPages[0].selectedType; + return type == TAB_PHOTOVIDEO || type == TAB_STORIES || type == TAB_ARCHIVED_STORIES || type == TAB_SAVED_DIALOGS || type == TAB_BOT_PREVIEWS || type == TAB_GIFTS && giftsContainer.canFilter(); } public int getSelectedTab() { @@ -4321,15 +4398,12 @@ public void onActionBarItemClick(View v, int id) { AlertDialog.Builder builder = new AlertDialog.Builder(getContext(), resourcesProvider); builder.setTitle(medias.size() > 1 ? LocaleController.getString(R.string.DeleteBotPreviewsTitle) : LocaleController.getString(R.string.DeleteBotPreviewTitle)); builder.setMessage(LocaleController.formatPluralString("DeleteBotPreviewsSubtitle", medias.size())); - builder.setPositiveButton(LocaleController.getString(R.string.Delete), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - list.delete(medias); - BulletinFactory.of(profileActivity).createSimpleBulletin(R.raw.ic_delete, LocaleController.formatPluralString("BotPreviewsDeleted", medias.size())).show(); - closeActionMode(false); - } + builder.setPositiveButton(LocaleController.getString(R.string.Delete), (dialog, which) -> { + list.delete(medias); + BulletinFactory.of(profileActivity).createSimpleBulletin(R.raw.ic_delete, LocaleController.formatPluralString("BotPreviewsDeleted", medias.size())).show(); + closeActionMode(false); }); - builder.setNegativeButton(LocaleController.getString(R.string.Cancel), (DialogInterface.OnClickListener) (dialog, which) -> { + builder.setNegativeButton(LocaleController.getString(R.string.Cancel), (dialog, which) -> { dialog.dismiss(); }); AlertDialog dialog = builder.create(); @@ -4348,15 +4422,12 @@ public void onClick(DialogInterface dialog, int which) { AlertDialog.Builder builder = new AlertDialog.Builder(getContext(), resourcesProvider); builder.setTitle(storyItems.size() > 1 ? LocaleController.getString(R.string.DeleteStoriesTitle) : LocaleController.getString(R.string.DeleteStoryTitle)); builder.setMessage(LocaleController.formatPluralString("DeleteStoriesSubtitle", storyItems.size())); - builder.setPositiveButton(LocaleController.getString(R.string.Delete), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - profileActivity.getMessagesController().getStoriesController().deleteStories(dialog_id, storyItems); - BulletinFactory.of(profileActivity).createSimpleBulletin(R.raw.ic_delete, LocaleController.formatPluralString("StoriesDeleted", storyItems.size())).show(); - closeActionMode(false); - } + builder.setPositiveButton(LocaleController.getString(R.string.Delete), (dialog, which) -> { + profileActivity.getMessagesController().getStoriesController().deleteStories(dialog_id, storyItems); + BulletinFactory.of(profileActivity).createSimpleBulletin(R.raw.ic_delete, LocaleController.formatPluralString("StoriesDeleted", storyItems.size())).show(); + closeActionMode(false); }); - builder.setNegativeButton(LocaleController.getString(R.string.Cancel), (DialogInterface.OnClickListener) (dialog, which) -> { + builder.setNegativeButton(LocaleController.getString(R.string.Cancel), (dialog, which) -> { dialog.dismiss(); }); AlertDialog dialog = builder.create(); @@ -5521,8 +5592,8 @@ public void didReceivedNotification(int id, int account, Object... args) { } } } else if (id == NotificationCenter.channelRecommendationsLoaded) { - long chatId = (long) args[0]; - if (chatId == -dialog_id) { + long dialogId = (long) args[0]; + if (dialogId == dialog_id) { channelRecommendationsAdapter.update(true); updateTabs(true); checkCurrentTabValid(); @@ -5837,7 +5908,7 @@ public void setMergeDialogId(long did) { } private long giftsLastHash; - private void updateTabs(boolean animated) { + public void updateTabs(boolean animated) { if (scrollSlidingTextTabStrip == null) { return; } @@ -5851,7 +5922,7 @@ private void updateTabs(boolean animated) { boolean hasEditBotPreviews = user != null && user.bot && user.bot_has_main_app && user.bot_can_edit; boolean hasBotPreviews = user != null && user.bot && !user.bot_can_edit && (userInfo != null && userInfo.bot_info != null && userInfo.bot_info.has_preview_medias) && !hasEditBotPreviews; boolean hasStories = (DialogObject.isUserDialog(dialog_id) || DialogObject.isChatDialog(dialog_id)) && !DialogObject.isEncryptedDialog(dialog_id) && (userInfo != null && userInfo.stories_pinned_available || info != null && info.stories_pinned_available || isStoriesView()) && includeStories(); - boolean hasGifts = giftsContainer != null && userInfo != null && userInfo.stargifts_count > 0; + boolean hasGifts = giftsContainer != null && (userInfo != null && userInfo.stargifts_count > 0 || info != null && info.stargifts_count > 0); int changed = 0; if ((hasStories || hasBotPreviews) != scrollSlidingTextTabStrip.hasTab(TAB_STORIES)) { changed++; @@ -6054,7 +6125,7 @@ public Animator onDisappear(ViewGroup sceneRoot, View view, TransitionValues sta } if (hasRecommendations) { if (!scrollSlidingTextTabStrip.hasTab(TAB_RECOMMENDED_CHANNELS)) { - scrollSlidingTextTabStrip.addTextTab(TAB_RECOMMENDED_CHANNELS, getString(R.string.SimilarChannelsTab), idToView); + scrollSlidingTextTabStrip.addTextTab(TAB_RECOMMENDED_CHANNELS, getString(dialog_id > 0 ? R.string.SimilarBotsTab : R.string.SimilarChannelsTab), idToView); } } } @@ -8425,7 +8496,7 @@ public boolean isEnabled(RecyclerView.ViewHolder holder) { private class ChannelRecommendationsAdapter extends RecyclerListView.SelectionAdapter { private final Context mContext; - private final ArrayList chats = new ArrayList<>(); + private final ArrayList chats = new ArrayList<>(); private int more; public ChannelRecommendationsAdapter(Context context) { @@ -8434,20 +8505,29 @@ public ChannelRecommendationsAdapter(Context context) { } public void update(boolean notify) { - if (profileActivity == null || !DialogObject.isChatDialog(dialog_id)) { + if (profileActivity == null) { return; } - TLRPC.Chat thisChat = MessagesController.getInstance(profileActivity.getCurrentAccount()).getChat(-dialog_id); - if (thisChat == null || !ChatObject.isChannelAndNotMegaGroup(thisChat)) { - return; + if (DialogObject.isChatDialog(dialog_id)) { + TLRPC.Chat thisChat = MessagesController.getInstance(profileActivity.getCurrentAccount()).getChat(-dialog_id); + if (thisChat == null || !ChatObject.isChannelAndNotMegaGroup(thisChat)) { + return; + } + } else { + TLRPC.User thisUser = MessagesController.getInstance(profileActivity.getCurrentAccount()).getUser(dialog_id); + if (thisUser == null) { + return; + } } - MessagesController.ChannelRecommendations rec = MessagesController.getInstance(profileActivity.getCurrentAccount()).getChannelRecommendations(thisChat.id); + final MessagesController.ChannelRecommendations rec = MessagesController.getInstance(profileActivity.getCurrentAccount()).getChannelRecommendations(dialog_id); chats.clear(); if (rec != null) { for (int i = 0; i < rec.chats.size(); ++i) { - TLRPC.Chat chat = rec.chats.get(i); - if (chat != null && ChatObject.isNotInChat(chat)) { - chats.add(chat); + TLObject obj = rec.chats.get(i); + if (obj instanceof TLRPC.Chat && ChatObject.isNotInChat((TLRPC.Chat) obj)) { + chats.add(obj); + } else { + chats.add(obj); } } } @@ -8471,7 +8551,7 @@ public int getItemCount() { public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view; if (viewType == VIEW_TYPE_SIMILAR_CHANNEL_BLOCK) { - MoreRecommendationsCell cell = new MoreRecommendationsCell(profileActivity == null ? UserConfig.selectedAccount : profileActivity.getCurrentAccount(), mContext, resourcesProvider, () -> { + MoreRecommendationsCell cell = new MoreRecommendationsCell(profileActivity == null ? UserConfig.selectedAccount : profileActivity.getCurrentAccount(), mContext, dialog_id > 0, resourcesProvider, () -> { if (profileActivity != null) { profileActivity.presentFragment(new PremiumPreviewFragment("similar_channels")); } @@ -8486,10 +8566,16 @@ public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType public void openPreview(int position) { if (position < 0 || position >= chats.size()) return; - TLRPC.Chat chat = chats.get(position); + final TLObject obj = chats.get(position); Bundle args = new Bundle(); - args.putLong("chat_id", chat.id); + if (obj instanceof TLRPC.Chat) { + args.putLong("chat_id", ((TLRPC.Chat) obj).id); + } else if (obj instanceof TLRPC.User) { + args.putLong("user_id", ((TLRPC.User) obj).id); + } else { + return; + } final BaseFragment fragment = new ChatActivity(args); if (profileActivity instanceof ProfileActivity) { ((ProfileActivity) profileActivity).prepareBlurBitmap(); @@ -8498,36 +8584,43 @@ public void openPreview(int position) { ActionBarPopupWindow.ActionBarPopupWindowLayout previewMenu = new ActionBarPopupWindow.ActionBarPopupWindowLayout(getContext(), R.drawable.popup_fixed_alert, resourcesProvider, ActionBarPopupWindow.ActionBarPopupWindowLayout.FLAG_SHOWN_FROM_BOTTOM); previewMenu.setBackgroundColor(getThemedColor(Theme.key_actionBarDefaultSubmenuBackground)); - ActionBarMenuSubItem openChannel = new ActionBarMenuSubItem(getContext(), false, false); - openChannel.setTextAndIcon(getString(R.string.OpenChannel2), R.drawable.msg_channel); - openChannel.setMinimumWidth(160); - openChannel.setOnClickListener(view -> { - if (profileActivity != null && profileActivity.getParentLayout() != null) { - profileActivity.getParentLayout().expandPreviewFragment(); - } - }); - previewMenu.addView(openChannel); - - ActionBarMenuSubItem joinChannel = new ActionBarMenuSubItem(getContext(), false, false); - joinChannel.setTextAndIcon(getString(R.string.ProfileJoinChannel), R.drawable.msg_addbot); - joinChannel.setMinimumWidth(160); - joinChannel.setOnClickListener(view -> { - profileActivity.finishPreviewFragment(); - chat.left = false; - update(false); - notifyItemRemoved(position); - if (chats.isEmpty()) { - updateTabs(true); - checkCurrentTabValid(); - } - profileActivity.getNotificationCenter().postNotificationName(NotificationCenter.channelRecommendationsLoaded, -dialog_id); - profileActivity.getMessagesController().addUserToChat(chat.id, profileActivity.getUserConfig().getCurrentUser(), 0, null, profileActivity, () -> { - BulletinFactory.of(profileActivity).createSimpleBulletin(R.raw.contact_check, LocaleController.formatString(R.string.YouJoinedChannel, chat == null ? "" : chat.title)).show(true); + if (obj instanceof TLRPC.Chat) { + final TLRPC.Chat chat = (TLRPC.Chat) obj; + + ActionBarMenuSubItem openChannel = new ActionBarMenuSubItem(getContext(), false, false); + openChannel.setTextAndIcon(getString(R.string.OpenChannel2), R.drawable.msg_channel); + openChannel.setMinimumWidth(160); + openChannel.setOnClickListener(view -> { + if (profileActivity != null && profileActivity.getParentLayout() != null) { + profileActivity.getParentLayout().expandPreviewFragment(); + } }); - }); - previewMenu.addView(joinChannel); + previewMenu.addView(openChannel); + + ActionBarMenuSubItem joinChannel = new ActionBarMenuSubItem(getContext(), false, false); + joinChannel.setTextAndIcon(getString(R.string.ProfileJoinChannel), R.drawable.msg_addbot); + joinChannel.setMinimumWidth(160); + joinChannel.setOnClickListener(view -> { + profileActivity.finishPreviewFragment(); + chat.left = false; + update(false); + notifyItemRemoved(position); + if (chats.isEmpty()) { + updateTabs(true); + checkCurrentTabValid(); + } + profileActivity.getNotificationCenter().postNotificationName(NotificationCenter.channelRecommendationsLoaded, -dialog_id); + profileActivity.getMessagesController().addUserToChat(chat.id, profileActivity.getUserConfig().getCurrentUser(), 0, null, profileActivity, () -> { + BulletinFactory.of(profileActivity).createSimpleBulletin(R.raw.contact_check, LocaleController.formatString(R.string.YouJoinedChannel, chat == null ? "" : chat.title)).show(true); + }); + }); + previewMenu.addView(joinChannel); + profileActivity.presentFragmentAsPreviewWithMenu(fragment, previewMenu); + } else if (obj instanceof TLRPC.User) { + final TLRPC.User user = (TLRPC.User) obj; - profileActivity.presentFragmentAsPreviewWithMenu(fragment, previewMenu); + profileActivity.presentFragmentAsPreview(fragment); + } } @Override @@ -8541,8 +8634,7 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { cell = ((MoreRecommendationsCell) holder.itemView).channelCell; } if (cell != null) { - TLRPC.Chat chat = chats.get(position); - cell.setData(chat, null, null, null, false, false); + cell.setData(chats.get(position), null, null, null, false, false); cell.useSeparator = position != chats.size() - 1; } } @@ -8567,7 +8659,7 @@ private static class MoreRecommendationsCell extends FrameLayout { private final ButtonWithCounterView button; private final LinkSpanDrawable.LinksTextView textView; - public MoreRecommendationsCell(int currentAccount, Context context, Theme.ResourcesProvider resourcesProvider, Runnable onPremiumClick) { + public MoreRecommendationsCell(int currentAccount, Context context, boolean bots, Theme.ResourcesProvider resourcesProvider, Runnable onPremiumClick) { super(context); this.currentAccount = currentAccount; @@ -8585,8 +8677,8 @@ public MoreRecommendationsCell(int currentAccount, Context context, Theme.Resour addView(gradientView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 60)); button = new ButtonWithCounterView(context, resourcesProvider); - SpannableStringBuilder buttonText = new SpannableStringBuilder(); - buttonText.append(getString(R.string.MoreSimilarButton)); + final SpannableStringBuilder buttonText = new SpannableStringBuilder(); + buttonText.append(getString(bots ? R.string.MoreSimilarBotsButton : R.string.MoreSimilarButton)); buttonText.append(" "); SpannableString lock = new SpannableString("l"); lock.setSpan(new ColoredImageSpan(R.drawable.msg_mini_lock2), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); @@ -8606,7 +8698,7 @@ public MoreRecommendationsCell(int currentAccount, Context context, Theme.Resour textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText, resourcesProvider)); textView.setLinkTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText, resourcesProvider)); textView.setLineSpacing(dp(3), 1f); - SpannableStringBuilder text = AndroidUtilities.premiumText(getString(R.string.MoreSimilarText), () -> { + final SpannableStringBuilder text = AndroidUtilities.premiumText(getString(bots ? R.string.MoreSimilarBotsText : R.string.MoreSimilarText), () -> { if (onPremiumClick != null) { onPremiumClick.run(); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SizeNotifierFrameLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SizeNotifierFrameLayout.java index 70a0d9c028..0d95a44dc4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/SizeNotifierFrameLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SizeNotifierFrameLayout.java @@ -940,7 +940,7 @@ private float getBlurRadius() { } public void drawBlurRect(Canvas canvas, float y, Rect rectTmp, Paint blurScrimPaint, boolean top) { - int blurAlpha = Color.alpha(Theme.getColor(DRAW_USING_RENDERNODE() && SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_HIGH ? Theme.key_chat_BlurAlpha : Theme.key_chat_BlurAlphaSlow)); + int blurAlpha = Color.alpha(Theme.getColor(DRAW_USING_RENDERNODE() && SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_HIGH ? Theme.key_chat_BlurAlpha : Theme.key_chat_BlurAlphaSlow, getResourceProvider())); if (!SharedConfig.chatBlurEnabled()) { canvas.drawRect(rectTmp, blurScrimPaint); return; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/StickersAlert.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/StickersAlert.java index a85548d02d..148714c4da 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/StickersAlert.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/StickersAlert.java @@ -80,6 +80,7 @@ import org.telegram.tgnet.RequestDelegate; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import org.telegram.ui.ActionBar.ActionBarMenuItem; import org.telegram.ui.ActionBar.ActionBarMenuSubItem; import org.telegram.ui.ActionBar.ActionBarPopupWindow; @@ -421,21 +422,19 @@ public StickersAlert(Context context, Object parentObject, TLObject object, Them } RequestDelegate requestDelegate = (response, error) -> AndroidUtilities.runOnUIThread(() -> { reqId = 0; - if (error == null) { - TLRPC.Vector vector = (TLRPC.Vector) response; + if (error == null && response instanceof Vector) { + Vector vector = (Vector) response; if (vector.objects.isEmpty()) { dismiss(); } else if (vector.objects.size() == 1) { - TLRPC.StickerSetCovered set = (TLRPC.StickerSetCovered) vector.objects.get(0); + TLRPC.StickerSetCovered set = vector.objects.get(0); inputStickerSet = new TLRPC.TL_inputStickerSetID(); inputStickerSet.id = set.set.id; inputStickerSet.access_hash = set.set.access_hash; loadStickerSet(false); } else { stickerSetCovereds = new ArrayList<>(); - for (int a = 0; a < vector.objects.size(); a++) { - stickerSetCovereds.add((TLRPC.StickerSetCovered) vector.objects.get(a)); - } + stickerSetCovereds.addAll(vector.objects); gridView.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, 0, 0, 0, 48)); titleTextView.setVisibility(View.GONE); shadow[0].setVisibility(View.GONE); @@ -456,7 +455,7 @@ public StickersAlert(Context context, Object parentObject, TLObject object, Them init(context); } - public StickersAlert(Context context, TLRPC.Vector vector, Theme.ResourcesProvider resourcesProvider) { + public StickersAlert(Context context, Vector vector, Theme.ResourcesProvider resourcesProvider) { super(context, false, resourcesProvider); this.resourcesProvider = resourcesProvider; fixNavigationBar(); @@ -464,7 +463,7 @@ public StickersAlert(Context context, TLRPC.Vector vector, Theme.ResourcesProvid if (vector.objects.isEmpty()) { return; } else if (vector.objects.size() == 1) { - TLRPC.StickerSetCovered set = (TLRPC.StickerSetCovered) vector.objects.get(0); + final TLRPC.StickerSetCovered set = vector.objects.get(0); inputStickerSet = new TLRPC.TL_inputStickerSetID(); inputStickerSet.id = set.set.id; inputStickerSet.access_hash = set.set.access_hash; @@ -472,9 +471,7 @@ public StickersAlert(Context context, TLRPC.Vector vector, Theme.ResourcesProvid init(context); } else { stickerSetCovereds = new ArrayList<>(); - for (int a = 0; a < vector.objects.size(); a++) { - stickerSetCovereds.add((TLRPC.StickerSetCovered) vector.objects.get(a)); - } + stickerSetCovereds.addAll(vector.objects); init(context); gridView.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, 0, 0, 0, 48)); titleTextView.setVisibility(View.GONE); @@ -1036,7 +1033,7 @@ public void onScrolled(RecyclerView recyclerView, int dx, int dy) { if (!selectedStickerPath.validated) { return; } - stickerEmojiTextView.setText(Emoji.replaceEmoji(selectedStickerPath.emoji, stickerEmojiTextView.getPaint().getFontMetricsInt(), dp(30), false)); + stickerEmojiTextView.setText(Emoji.replaceEmoji(selectedStickerPath.emoji, stickerEmojiTextView.getPaint().getFontMetricsInt(), false)); stickerImageView.setImage(ImageLocation.getForPath(selectedStickerPath.path), null, null, null, null, null, selectedStickerPath.animated ? "tgs" : null, 0, null); FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) stickerPreviewLayout.getLayoutParams(); layoutParams.topMargin = scrollOffsetY; @@ -1057,14 +1054,14 @@ public void onScrolled(RecyclerView recyclerView, int dx, int dy) { TLRPC.DocumentAttribute attribute = selectedSticker.attributes.get(a); if (attribute instanceof TLRPC.TL_documentAttributeSticker) { if (attribute.alt != null && attribute.alt.length() > 0) { - stickerEmojiTextView.setText(Emoji.replaceEmoji(attribute.alt, stickerEmojiTextView.getPaint().getFontMetricsInt(), dp(30), false)); + stickerEmojiTextView.setText(Emoji.replaceEmoji(attribute.alt, stickerEmojiTextView.getPaint().getFontMetricsInt(), false)); set = true; } break; } } if (!set) { - stickerEmojiTextView.setText(Emoji.replaceEmoji(MediaDataController.getInstance(currentAccount).getEmojiForSticker(selectedSticker.id), stickerEmojiTextView.getPaint().getFontMetricsInt(), dp(30), false)); + stickerEmojiTextView.setText(Emoji.replaceEmoji(MediaDataController.getInstance(currentAccount).getEmojiForSticker(selectedSticker.id), stickerEmojiTextView.getPaint().getFontMetricsInt(), false)); } if ((stickerSet == null || stickerSet.set == null || !stickerSet.set.emojis) && !ContentPreviewViewer.getInstance().showMenuFor(view)) { @@ -1427,7 +1424,7 @@ private void updateFields() { if (stickerSet != null && stickerSet.documents != null && !stickerSet.documents.isEmpty()) { SpannableStringBuilder stringBuilder = null; CharSequence title = stickerSet.set.title; - title = Emoji.replaceEmoji(title, titleTextView.getPaint().getFontMetricsInt(), dp(18), false); + title = Emoji.replaceEmoji(title, titleTextView.getPaint().getFontMetricsInt(), false); try { if (urlPattern == null) { urlPattern = Pattern.compile("@[a-zA-Z\\d_]{1,32}"); @@ -1757,7 +1754,9 @@ public void afterTextChanged(Editable s) { state[0] = 3; if (!lastNameAvailable) { AndroidUtilities.shakeView(editText); - editText.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + editText.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} } AndroidUtilities.hideKeyboard(editText); SendMessagesHelper.getInstance(currentAccount).prepareImportStickers(setTitle, lastCheckName, importingSoftware, importingStickersPaths, (param) -> { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/StorageDiagramView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/StorageDiagramView.java index 6923fab479..ce4d376982 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/StorageDiagramView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/StorageDiagramView.java @@ -86,7 +86,7 @@ public StorageDiagramView(Context context, long dialogId) { } else { TLObject dialog = MessagesController.getInstance(UserConfig.selectedAccount).getUserOrChat(dialogId); dialogText = DialogObject.setDialogPhotoTitle(avatarImageReceiver, avatarDrawable, dialog); - dialogText = Emoji.replaceEmoji(dialogText, null, AndroidUtilities.dp(6), false); + dialogText = Emoji.replaceEmoji(dialogText, null, false); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SuggestEmojiView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SuggestEmojiView.java index cbabae91dc..ea58fbe082 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/SuggestEmojiView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SuggestEmojiView.java @@ -14,7 +14,6 @@ import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.TextWatcher; -import android.text.style.UnderlineSpan; import android.view.Gravity; import android.view.HapticFeedbackConstants; import android.view.MotionEvent; @@ -40,7 +39,6 @@ import org.telegram.messenger.SharedConfig; import org.telegram.messenger.UserConfig; import org.telegram.messenger.UserObject; -import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.Theme; @@ -149,23 +147,24 @@ public Boolean canSetAsStatus(TLRPC.Document document) { @Override public void setAsEmojiStatus(TLRPC.Document document, Integer until) { - TLRPC.EmojiStatus status; + final TLRPC.EmojiStatus emojiStatus; if (document == null) { - status = new TLRPC.TL_emojiStatusEmpty(); - } else if (until != null) { - status = new TLRPC.TL_emojiStatusUntil(); - ((TLRPC.TL_emojiStatusUntil) status).document_id = document.id; - ((TLRPC.TL_emojiStatusUntil) status).until = until; + emojiStatus = new TLRPC.TL_emojiStatusEmpty(); } else { - status = new TLRPC.TL_emojiStatus(); - ((TLRPC.TL_emojiStatus) status).document_id = document.id; + final TLRPC.TL_emojiStatus status = new TLRPC.TL_emojiStatus(); + status.document_id = document.id; + if (until != null) { + status.flags |= 1; + status.until = until; + } + emojiStatus = status; } - TLRPC.User user = UserConfig.getInstance(UserConfig.selectedAccount).getCurrentUser(); + final TLRPC.User user = UserConfig.getInstance(UserConfig.selectedAccount).getCurrentUser(); final TLRPC.EmojiStatus previousEmojiStatus = user == null ? new TLRPC.TL_emojiStatusEmpty() : user.emoji_status; - MessagesController.getInstance(currentAccount).updateEmojiStatus(status); + MessagesController.getInstance(currentAccount).updateEmojiStatus(emojiStatus); - Runnable undoAction = () -> MessagesController.getInstance(currentAccount).updateEmojiStatus(previousEmojiStatus); - BaseFragment fragment = enterView == null ? null : enterView.getParentFragment(); + final Runnable undoAction = () -> MessagesController.getInstance(currentAccount).updateEmojiStatus(previousEmojiStatus); + final BaseFragment fragment = enterView == null ? null : enterView.getParentFragment(); if (fragment != null) { if (document == null) { final Bulletin.SimpleLayout layout = new Bulletin.SimpleLayout(getContext(), resourcesProvider); @@ -669,7 +668,7 @@ private CharSequence makeEmoji(String emojiSource) { } } else { emoji = emojiSource; - emoji = Emoji.replaceEmoji(emoji, fontMetricsInt, AndroidUtilities.dp(20), true); + emoji = Emoji.replaceEmoji(emoji, fontMetricsInt, true); } return emoji; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SwipeGestureSettingsView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SwipeGestureSettingsView.java index 916f8e5b78..4bff0403a4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/SwipeGestureSettingsView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SwipeGestureSettingsView.java @@ -107,7 +107,9 @@ protected void onDraw(Canvas canvas) { SharedConfig.updateChatListSwipeSetting(newVal); invalidate(); - picker.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + picker.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} }); picker.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); picker.setValue(SharedConfig.getChatSwipeAction(currentAccount)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/TableView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/TableView.java index 36e5adc86a..27fb8cf6f2 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/TableView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/TableView.java @@ -8,15 +8,21 @@ import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Path; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; +import android.graphics.drawable.Drawable; +import android.text.SpannableString; import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.TextPaint; import android.text.TextUtils; import android.text.style.ClickableSpan; import android.util.TypedValue; +import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; +import android.widget.ImageView; import android.widget.TableLayout; import android.widget.TableRow; import android.widget.TextView; @@ -24,6 +30,7 @@ import androidx.annotation.NonNull; import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.DialogObject; import org.telegram.messenger.Emoji; import org.telegram.messenger.LocaleController; import org.telegram.messenger.MessageObject; @@ -35,11 +42,14 @@ import org.telegram.messenger.browser.Browser; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.BaseFragment; +import org.telegram.ui.ActionBar.SimpleTextView; +import org.telegram.ui.ActionBar.TextViewWithLoading; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.AvatarSpan; import org.telegram.ui.ChatActivity; import org.telegram.ui.Components.spoilers.SpoilersTextView; import org.telegram.ui.LaunchActivity; +import org.telegram.ui.Stories.recorder.HintView2; import java.util.ArrayList; import java.util.Date; @@ -63,6 +73,10 @@ public TableView(Context context, Theme.ResourcesProvider resourcesProvider) { setColumnStretchable(1, true); } + public void clear() { + removeAllViews(); + } + public TableRow addRow(CharSequence title, View content) { TableRow row = new TableRow(getContext()); TableRow.LayoutParams lp; @@ -85,6 +99,169 @@ public TableRow addRowUnpadded(CharSequence title, View content) { return row; } + public TableRow addRowMonospaced(CharSequence title, CharSequence text, int textFontSizeDp, Runnable copyButton) { + FrameLayout idLayout = new FrameLayout(getContext()); + idLayout.setPadding(dp(12.66f), dp(9.33f), dp(10.66f), dp(9.33f)); + TextView textView = new TextView(getContext()); + textView.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MONO)); + textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textFontSizeDp); + textView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack, resourcesProvider)); + textView.setMaxLines(4); + textView.setSingleLine(false); + textView.setText(text); + idLayout.addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL, 0, 0, 34, 0)); + if (copyButton != null) { + ImageView copyView = new ImageView(getContext()); + copyView.setImageResource(R.drawable.msg_copy); + copyView.setScaleType(ImageView.ScaleType.CENTER); + copyView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteBlueIcon, resourcesProvider), PorterDuff.Mode.SRC_IN)); + copyView.setOnClickListener(v -> { + AndroidUtilities.addToClipboard(text); + copyButton.run(); + }); + ScaleStateListAnimator.apply(copyView); + copyView.setBackground(Theme.createSelectorDrawable(Theme.multAlpha(Theme.getColor(Theme.key_windowBackgroundWhiteBlueIcon, resourcesProvider), .10f), Theme.RIPPLE_MASK_ROUNDRECT_6DP)); + idLayout.addView(copyView, LayoutHelper.createFrame(30, 30, Gravity.RIGHT | Gravity.CENTER_VERTICAL)); + } + return addRowUnpadded(title, idLayout); + } + + public TableRow addWalletAddressRow(CharSequence title, CharSequence text, Runnable onCopy) { + FrameLayout idLayout = new FrameLayout(getContext()); + LinkSpanDrawable.LinksTextView textView = new LinkSpanDrawable.LinksTextView(getContext()); + textView.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MONO)); + textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13); + textView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack, resourcesProvider)); + textView.setLinkTextColor(Theme.getColor(Theme.key_chat_messageLinkIn, resourcesProvider)); + textView.setMaxLines(4); +// textView.setMaxLines(1); +// textView.setSingleLine(); +// textView.setEllipsize(TextUtils.TruncateAt.MIDDLE); + SpannableStringBuilder sb = new SpannableStringBuilder(text); + sb.insert(sb.length() / 2, "\n"); + if (onCopy != null) { + sb.setSpan(new ClickableSpan() { + @Override + public void onClick(@NonNull View widget) { + AndroidUtilities.addToClipboard(text); + onCopy.run(); + } + @Override + public void updateDrawState(@NonNull TextPaint ds) { + ds.setColor(ds.linkColor); + } + }, 0, sb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + } + textView.setText(sb); + textView.setDisablePaddingsOffsetY(true); + textView.setPadding(dp(12.66f), dp(9.33f), dp(10.66f), dp(9.33f)); + idLayout.addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL, 0, 0, 0, 0)); +// textView.setMaxWidth(HintView2.cutInFancyHalf(textView.getText(), textView.getPaint()) + dp(12.66f + 12.66f)); + return addRowUnpadded(title, idLayout); + } + + public TableRow addRowUserWithEmojiStatus(CharSequence title, final int currentAccount, final long did, Runnable onClick) { + final LinkSpanDrawable.LinksSimpleTextView textView = new LinkSpanDrawable.LinksSimpleTextView(getContext(), resourcesProvider); + textView.setPadding(dp(12.66f), dp(9.33f), dp(12.66f), dp(9.33f)); + textView.setTextColor(Theme.getColor(Theme.key_chat_messageLinkIn, resourcesProvider)); + textView.setLinkTextColor(Theme.getColor(Theme.key_chat_messageLinkIn, resourcesProvider)); + textView.setTextSize(14); + AvatarSpan avatarSpan = new AvatarSpan(textView, currentAccount, 24); + CharSequence username; + boolean deleted = false; + boolean clickable = true; + final boolean unknown; + if (did == UserObject.ANONYMOUS) { + deleted = false; + clickable = false; + unknown = true; + username = getString(R.string.StarsTransactionHidden); + CombinedDrawable iconDrawable = getPlatformDrawable("anonymous"); + iconDrawable.setIconSize(dp(16), dp(16)); + avatarSpan.setImageDrawable(iconDrawable); + } else if (UserObject.isService(did)) { + deleted = false; + unknown = true; + username = getString(R.string.StarsTransactionUnknown); + CombinedDrawable iconDrawable = getPlatformDrawable("fragment"); + iconDrawable.setIconSize(dp(16), dp(16)); + avatarSpan.setImageDrawable(iconDrawable); + } else if (did >= 0) { + unknown = false; + TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(did); + deleted = user == null; + username = UserObject.getUserName(user); + avatarSpan.setUser(user); + } else { + unknown = false; + TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-did); + deleted = chat == null; + username = chat == null ? "" : chat.title; + avatarSpan.setChat(chat); + } + final SpannableStringBuilder ssb = new SpannableStringBuilder("x " + username); + ssb.setSpan(avatarSpan, 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + if (clickable) { + textView.setClickable(true); + ssb.setSpan(new ClickableSpan() { + @Override + public void onClick(@NonNull View widget) { + if (onClick != null) { + onClick.run(); + } + } + @Override + public void updateDrawState(@NonNull TextPaint ds) { + ds.setUnderlineText(false); + } + }, 3, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + } + final int color = Theme.getColor(Theme.key_featuredStickers_addButton, resourcesProvider); + final AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable emojiDrawable = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(textView, dp(20)); + emojiDrawable.setColor(color); + emojiDrawable.offset(dp(12), 0); + final Drawable premiumDrawable = getContext().getResources().getDrawable(R.drawable.msg_premium_liststar).mutate(); + premiumDrawable.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN)); + final Utilities.Callback updateStatus = args -> { + if (did == UserObject.ANONYMOUS || UserObject.isService(did)) { + return; + } + boolean isPremium; + TLRPC.EmojiStatus emoji_status; + if (did > 0) { + TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(did); + emoji_status = user != null ? user.emoji_status : null; + isPremium = user != null && user.premium; + } else { + TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-did); + emoji_status = chat != null ? chat.emoji_status : null; + isPremium = false; + } + final long emojiStatusDocumentId2 = DialogObject.getEmojiStatusDocumentId(emoji_status); + if (emojiStatusDocumentId2 != 0) { + emojiDrawable.set(emojiStatusDocumentId2, true); + emojiDrawable.setParticles(DialogObject.isEmojiStatusCollectible(emoji_status), true); + textView.setRightDrawable(emojiDrawable); + } else if (isPremium) { + emojiDrawable.set(premiumDrawable, true); + emojiDrawable.setParticles(false, true); + textView.setRightDrawable(emojiDrawable); + } else { + textView.setRightDrawable(null); + } + emojiDrawable.setColor(color); + }; + updateStatus.run(null); + textView.setRightDrawable(emojiDrawable); + NotificationCenter.getInstance(currentAccount).listen(textView, NotificationCenter.updateInterfaces, updateStatus); + NotificationCenter.getInstance(currentAccount).listen(textView, NotificationCenter.userEmojiStatusUpdated, updateStatus); + textView.setText(ssb); + if (!deleted) { + return addRowUnpadded(title, textView); + } + return null; + } + public TableRow addRowUser(CharSequence title, final int currentAccount, final long did, Runnable onClick) { return addRowUser(title, currentAccount, did, onClick, null, null); } @@ -97,7 +274,7 @@ public TableRow addRowUser(CharSequence title, final int currentAccount, final l textView.setLinkTextColor(Theme.getColor(Theme.key_chat_messageLinkIn, resourcesProvider)); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); textView.setSingleLine(true); - ((LinkSpanDrawable.LinksTextView) textView).setDisablePaddingsOffsetY(true); + textView.setDisablePaddingsOffsetY(true); AvatarSpan avatarSpan = new AvatarSpan(textView, currentAccount, 24); CharSequence username; boolean deleted = false; @@ -148,7 +325,7 @@ public void updateDrawState(@NonNull TextPaint ds) { }, 3, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } if (buttonText != null) { - ssb.append(" ").append(ButtonSpan.make(buttonText, buttonOnClick, resourcesProvider)); + textView.addButton(new ButtonSpan(buttonText, buttonOnClick, resourcesProvider)); } textView.setText(ssb); if (!deleted) { @@ -227,20 +404,23 @@ public TableRow addRow(CharSequence title, CharSequence text, CharSequence butto return row; } - public void addFullRow(CharSequence text) { + public TableRowFullContent addFullRow(CharSequence text) { SpoilersTextView textView = new SpoilersTextView(getContext()); textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText, resourcesProvider)); + textView.setLinkTextColor(Theme.getColor(Theme.key_chat_messageLinkIn, resourcesProvider)); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); text = Emoji.replaceEmoji(text, textView.getPaint().getFontMetricsInt(), false); textView.setText(text); NotificationCenter.listenEmojiLoading(textView); - TableRow row = new TableRow(getContext()); + final TableRow row = new TableRow(getContext()); TableRow.LayoutParams lp; lp = new TableRow.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT); lp.span = 2; - row.addView(new TableRowFullContent(this, textView), lp); + final TableRowFullContent cell = new TableRowFullContent(this, textView); + row.addView(cell, lp); addView(row); + return cell; } public void addFullRow(CharSequence text, ArrayList entities) { @@ -314,6 +494,7 @@ public static class TableRowFullContent extends FrameLayout { private final TableView table; private final Theme.ResourcesProvider resourcesProvider; + private boolean filled; public TableRowFullContent(TableView table, View content) { this(table, content, false); @@ -341,6 +522,10 @@ public void setFirstLast(boolean first, boolean last) { } } + public void setFilled(boolean filled) { + this.filled = filled; + } + @Override protected void onDraw(Canvas canvas) { if (first || last) { @@ -352,8 +537,10 @@ protected void onDraw(Canvas canvas) { table.path.rewind(); AndroidUtilities.rectTmp.set(table.hw, table.hw, getWidth() - table.hw, getHeight() + table.hw * dp(last ? -1f : +1f)); table.path.addRoundRect(AndroidUtilities.rectTmp, table.radii, Path.Direction.CW); + if (filled) canvas.drawPath(table.path, table.backgroundPaint); canvas.drawPath(table.path, table.borderPaint); } else { + if (filled) canvas.drawRect(table.hw, table.hw, getWidth() + table.hw, getHeight() + table.hw, table.backgroundPaint); canvas.drawRect(table.hw, table.hw, getWidth() - table.hw, getHeight() + table.hw, table.borderPaint); } super.onDraw(canvas); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/TermsOfServiceView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/TermsOfServiceView.java index 7cbc89c8e0..fdbf5c7f45 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/TermsOfServiceView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/TermsOfServiceView.java @@ -22,6 +22,7 @@ import org.telegram.messenger.R; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.Theme; @@ -103,7 +104,7 @@ public TermsOfServiceView(final Context context) { final AlertDialog progressDialog = new AlertDialog(getContext(), AlertDialog.ALERT_TYPE_SPINNER); progressDialog.setCanCancel(false); - TLRPC.TL_account_deleteAccount req = new TLRPC.TL_account_deleteAccount(); + TL_account.deleteAccount req = new TL_account.deleteAccount(); req.reason = "Decline ToS update"; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { try { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Text.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Text.java index df78066196..7da4634908 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Text.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Text.java @@ -3,10 +3,12 @@ import static org.telegram.messenger.AndroidUtilities.dp; import android.graphics.Canvas; +import android.graphics.ColorFilter; import android.graphics.LinearGradient; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; import android.graphics.PorterDuffXfermode; import android.graphics.Shader; import android.graphics.Typeface; @@ -15,6 +17,7 @@ import android.text.TextPaint; import android.text.TextUtils; import android.util.Log; +import android.view.View; import androidx.annotation.NonNull; @@ -49,6 +52,42 @@ public Text setTextSizePx(float px) { return this; } + private boolean drawAnimatedEmojis; + private View parentView; + private AnimatedEmojiSpan.EmojiGroupedSpans animatedEmojis; + private int animatedEmojisCacheType = AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES; + private ColorFilter animatedEmojisColorFilter; + private int animatedEmojisColorFilterColor; + public Text supportAnimatedEmojis(View view) { + drawAnimatedEmojis = true; + parentView = view; + if (view.isAttachedToWindow()) { + animatedEmojis = AnimatedEmojiSpan.update(animatedEmojisCacheType, view, animatedEmojis, layout); + } + view.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() { + @Override + public void onViewAttachedToWindow(@NonNull View v) { + animatedEmojis = AnimatedEmojiSpan.update(animatedEmojisCacheType, view, animatedEmojis, layout); + } + @Override + public void onViewDetachedFromWindow(@NonNull View v) { + AnimatedEmojiSpan.release(view, animatedEmojis); + } + }); + return this; + } + + public Text setEmojiCacheType(int cacheType) { + if (animatedEmojisCacheType != cacheType) { + animatedEmojisCacheType = cacheType; + if (drawAnimatedEmojis) { + AnimatedEmojiSpan.release(parentView, animatedEmojis); + animatedEmojis = AnimatedEmojiSpan.update(animatedEmojisCacheType, parentView, animatedEmojis, layout); + } + } + return this; + } + public void setText(CharSequence text) { layout = new StaticLayout(AndroidUtilities.replaceNewLines(text), paint, (int) Math.max(maxWidth, 1), Layout.Alignment.ALIGN_NORMAL, 1f, 0f, false); width = 0; @@ -89,8 +128,9 @@ public boolean isEmpty() { return layout == null || TextUtils.isEmpty(layout.getText()); } - public void setColor(int color) { + public Text setColor(int color) { paint.setColor(color); + return this; } private float ellipsizeWidth = -1; @@ -170,6 +210,12 @@ public void draw(Canvas canvas) { } else { layout.draw(canvas); } + if (drawAnimatedEmojis) { + if (animatedEmojisColorFilter == null || paint.getColor() != animatedEmojisColorFilterColor) { + animatedEmojisColorFilter = new PorterDuffColorFilter(animatedEmojisColorFilterColor = paint.getColor(), PorterDuff.Mode.SRC_IN); + } + AnimatedEmojiSpan.drawAnimatedEmojis(canvas, layout, animatedEmojis, 0, null, 0, 0, 0, 1.0f, animatedEmojisColorFilter); + } canvas.restore(); if (!doNotSave && ellipsizeWidth >= 0 && width > ellipsizeWidth) { if (ellipsizeGradient == null) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ThanosEffect.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ThanosEffect.java index d873f23229..5e819a6feb 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ThanosEffect.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ThanosEffect.java @@ -1180,6 +1180,7 @@ public Animation(View view, float durationMultipier, Runnable whenDone) { } if (view instanceof ChatActionCell && ((ChatActionCell) view).hasGradientService()) { ((ChatActionCell) view).drawBackground(canvas, true); + ((ChatActionCell) view).drawReactions(canvas, true, null); } else if (view instanceof ChatMessageCell && ((ChatMessageCell) view).drawBackgroundInParent()) { ((ChatMessageCell) view).drawBackgroundInternal(canvas, true); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/UItem.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/UItem.java index 5fac1bce71..ac8d2ea4aa 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/UItem.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/UItem.java @@ -432,6 +432,12 @@ public static UItem asProfileCell(TLObject obj) { return item; } + public UItem withOpenButton(Utilities.Callback onOpenButton) { + this.checked = true; + this.object2 = onOpenButton; + return this; + } + public static UItem asSearchMessage(MessageObject messageObject) { UItem item = new UItem(UniversalAdapter.VIEW_TYPE_SEARCH_MESSAGE, false); item.object = messageObject; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/UndoView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/UndoView.java index 70cbef9449..84f9404e29 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/UndoView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/UndoView.java @@ -1,5 +1,7 @@ package org.telegram.ui.Components; +import static org.telegram.messenger.LocaleController.formatSpannable; + import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; @@ -46,6 +48,7 @@ import org.telegram.messenger.FileLog; import org.telegram.messenger.LocaleController; import org.telegram.messenger.MediaController; +import org.telegram.messenger.MessageObject; import org.telegram.messenger.MessagesController; import org.telegram.messenger.R; import org.telegram.messenger.SavedMessagesController; @@ -65,6 +68,7 @@ @Deprecated // use Bulletin instead public class UndoView extends FrameLayout { + private int infoTextViewEmojiCacheType = AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES; private LinkSpanDrawable.LinksTextView infoTextView; private TextView subinfoTextView; private TextView undoTextView; @@ -240,7 +244,12 @@ public UndoView(Context context, BaseFragment parent, boolean top, Theme.Resourc parentFragment = parent; fromTop = top; - infoTextView = new LinkSpanDrawable.LinksTextView(context, resourcesProvider); + infoTextView = new LinkSpanDrawable.LinksTextView(context, resourcesProvider) { + @Override + protected int emojiCacheType() { + return infoTextViewEmojiCacheType; + } + }; infoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); infoTextView.setTextColor(getThemedColor(Theme.key_undo_infoColor)); infoTextView.setLinkTextColor(getThemedColor(Theme.key_undo_cancelColor)); @@ -819,6 +828,10 @@ public void showWithAction(ArrayList dialogIds, int action, Object infoObj icon = R.raw.chats_infotip; } else if (action == ACTION_ADDED_TO_FOLDER || action == ACTION_REMOVED_FROM_FOLDER) { MessagesController.DialogFilter filter = (MessagesController.DialogFilter) infoObject2; + CharSequence filterName = filter.name; + filterName = Emoji.replaceEmoji(filterName, infoTextView.getPaint().getFontMetricsInt(), false); + filterName = MessageObject.replaceAnimatedEmoji(filterName, filter.entities, infoTextView.getPaint().getFontMetricsInt()); + infoTextViewEmojiCacheType = filter.title_noanimate ? AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER : AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES; if (did != 0) { long dialogId = did; if (DialogObject.isEncryptedDialog(did)) { @@ -834,23 +847,23 @@ public void showWithAction(ArrayList dialogIds, int action, Object infoObj name = LocaleController.getString(R.string.RepliesTitle); } if (action == ACTION_ADDED_TO_FOLDER) { - infoText = AndroidUtilities.replaceTags(LocaleController.formatString("FilterUserAddedToExisting", R.string.FilterUserAddedToExisting, name, filter.name)); + infoText = AndroidUtilities.replaceTags(formatSpannable(R.string.FilterUserAddedToExisting, name, filterName)); } else { - infoText = AndroidUtilities.replaceTags(LocaleController.formatString("FilterUserRemovedFrom", R.string.FilterUserRemovedFrom, name, filter.name)); + infoText = AndroidUtilities.replaceTags(formatSpannable(R.string.FilterUserRemovedFrom, name, filterName)); } } else { TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-dialogId); if (action == ACTION_ADDED_TO_FOLDER) { - infoText = AndroidUtilities.replaceTags(LocaleController.formatString("FilterChatAddedToExisting", R.string.FilterChatAddedToExisting, chat.title, filter.name)); + infoText = AndroidUtilities.replaceTags(formatSpannable(R.string.FilterChatAddedToExisting, chat.title, filterName)); } else { - infoText = AndroidUtilities.replaceTags(LocaleController.formatString("FilterChatRemovedFrom", R.string.FilterChatRemovedFrom, chat.title, filter.name)); + infoText = AndroidUtilities.replaceTags(formatSpannable(R.string.FilterChatRemovedFrom, chat.title, filterName)); } } } else { if (action == ACTION_ADDED_TO_FOLDER) { - infoText = AndroidUtilities.replaceTags(LocaleController.formatString("FilterChatsAddedToExisting", R.string.FilterChatsAddedToExisting, LocaleController.formatPluralString("ChatsSelected", (Integer) infoObject), filter.name)); + infoText = AndroidUtilities.replaceTags(formatSpannable(R.string.FilterChatsAddedToExisting, LocaleController.formatPluralString("ChatsSelected", (Integer) infoObject), filterName)); } else { - infoText = AndroidUtilities.replaceTags(LocaleController.formatString("FilterChatsRemovedFrom", R.string.FilterChatsRemovedFrom, LocaleController.formatPluralString("ChatsSelected", (Integer) infoObject), filter.name)); + infoText = AndroidUtilities.replaceTags(formatSpannable(R.string.FilterChatsRemovedFrom, LocaleController.formatPluralString("ChatsSelected", (Integer) infoObject), filterName)); } } subInfoText = null; @@ -1116,7 +1129,9 @@ public void showWithAction(ArrayList dialogIds, int action, Object infoObj leftImageView.playAnimation(); if (hapticDelay > 0) { leftImageView.postDelayed(() -> { - leftImageView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + leftImageView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} }, hapticDelay); } } else if (currentAction == ACTION_PROXIMITY_SET || currentAction == ACTION_PROXIMITY_REMOVED) { @@ -1240,9 +1255,9 @@ public void showWithAction(ArrayList dialogIds, int action, Object infoObj } else { String info = LocaleController.getServerString("DiceEmojiInfo_" + emoji); if (!TextUtils.isEmpty(info)) { - infoTextView.setText(Emoji.replaceEmoji(info, infoTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false)); + infoTextView.setText(Emoji.replaceEmoji(info, infoTextView.getPaint().getFontMetricsInt(), false)); } else { - infoTextView.setText(Emoji.replaceEmoji(LocaleController.formatString("DiceEmojiInfo", R.string.DiceEmojiInfo, emoji), infoTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false)); + infoTextView.setText(Emoji.replaceEmoji(LocaleController.formatString("DiceEmojiInfo", R.string.DiceEmojiInfo, emoji), infoTextView.getPaint().getFontMetricsInt(), false)); } } leftImageView.setImageDrawable(Emoji.getEmojiDrawable(emoji)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/UniversalAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/UniversalAdapter.java index 7dd413808e..b97f4d970a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/UniversalAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/UniversalAdapter.java @@ -621,6 +621,7 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi if (checkCell.itemId == item.id) { checkCell.setChecked(item.checked); } + checkCell.setEnabled(item.enabled, null); checkCell.setTextAndCheck(item.text, item.checked, divider); checkCell.itemId = item.id; if (viewType == VIEW_TYPE_CHECKRIPPLE) { @@ -885,6 +886,7 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi // add status text title = UserObject.getUserName(user); } + profileCell.allowBotOpenButton(item.checked, item.object2 instanceof Utilities.Callback ? (Utilities.Callback) item.object2 : null); profileCell.setRectangularAvatar(item.red); profileCell.setData(object, null, title, s, false, false); profileCell.useSeparator = divider; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/VideoPlayer.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/VideoPlayer.java index bf5205b758..52f9760e35 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/VideoPlayer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/VideoPlayer.java @@ -918,6 +918,15 @@ public static VideoUri getQualityForThumb(ArrayList qualities) { return uri; } + public static VideoUri getCachedQuality(ArrayList qualities) { + if (qualities == null) return null; + for (final Quality q : qualities) + for (final VideoUri v : q.uris) + if (v.isCached()) + return v; + return null; + } + public static VideoUri getQualityForPlayer(ArrayList qualities) { for (final Quality q : qualities) { for (final VideoUri v : q.uris) { @@ -1509,6 +1518,13 @@ public void setVolume(float volume) { } } + public float getVolume() { + if (player != null) { + return player.getVolume(); + } + return 1.0f; + } + public void seekTo(long positionMs) { seekTo(positionMs, false); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/VideoPlayerSeekBar.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/VideoPlayerSeekBar.java index 2f8eb1d31c..d8f370dcca 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/VideoPlayerSeekBar.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/VideoPlayerSeekBar.java @@ -23,7 +23,6 @@ import android.text.TextPaint; import android.text.TextUtils; import android.util.Pair; -import android.view.HapticFeedbackConstants; import android.view.MotionEvent; import android.view.View; @@ -324,7 +323,7 @@ public void updateTimestamps(MessageObject messageObject, long videoDuration) { float position = seconds * 1000L / (float) videoDuration; String label = link.label; SpannableStringBuilder builder = new SpannableStringBuilder(label); - Emoji.replaceEmoji(builder, timestampLabelPaint.getFontMetricsInt(), AndroidUtilities.dp(14), false); + Emoji.replaceEmoji(builder, timestampLabelPaint.getFontMetricsInt(), false); timestamps.add(new Pair<>(position, builder)); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/VideoSeekPreviewImage.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/VideoSeekPreviewImage.java index 95fa8e4abb..17717a47a5 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/VideoSeekPreviewImage.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/VideoSeekPreviewImage.java @@ -1,5 +1,7 @@ package org.telegram.ui.Components; +import static org.telegram.messenger.AndroidUtilities.dp; + import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapShader; @@ -12,14 +14,17 @@ import android.graphics.drawable.Drawable; import android.net.Uri; import android.text.TextPaint; +import android.util.Log; import android.view.View; import android.view.ViewGroup; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.Bitmaps; import org.telegram.messenger.FileLoader; +import org.telegram.messenger.FileLog; import org.telegram.messenger.ImageReceiver; import org.telegram.messenger.R; +import org.telegram.messenger.UserConfig; import org.telegram.messenger.Utilities; import org.telegram.tgnet.TLRPC; @@ -28,6 +33,8 @@ public class VideoSeekPreviewImage extends View { public final static boolean IS_YOUTUBE_PREVIEWS_SUPPORTED = true; + private boolean open; + private boolean isQualities; private AnimatedFileDrawable fileDrawable; private long duration; private Uri videoUri; @@ -43,7 +50,7 @@ public class VideoSeekPreviewImage extends View { private String frameTime; private int timeWidth; - private TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); + private final TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); private BitmapShader bitmapShader; private RectF dstR = new RectF(); @@ -59,7 +66,7 @@ public class VideoSeekPreviewImage extends View { private boolean isYoutube; private ImageReceiver youtubeBoardsReceiver; private int ytImageX, ytImageY, ytImageWidth, ytImageHeight; - private Path ytPath = new Path(); + private final Path ytPath = new Path(); public interface VideoSeekPreviewImageDelegate { void onReady(); @@ -70,7 +77,7 @@ public VideoSeekPreviewImage(Context context, VideoSeekPreviewImageDelegate vide setVisibility(INVISIBLE); frameDrawable = context.getResources().getDrawable(R.drawable.videopreview); - textPaint.setTextSize(AndroidUtilities.dp(13)); + textPaint.setTextSize(dp(13)); textPaint.setColor(0xffffffff); delegate = videoSeekPreviewImageDelegate; @@ -82,7 +89,7 @@ public VideoSeekPreviewImage(Context context, VideoSeekPreviewImageDelegate vide if (webView == null) { return; } - int viewSize = AndroidUtilities.dp(150); + int viewSize = dp(150); int imageCount = webView.getYoutubeStoryboardImageCount(lastYoutubePosition); int rows = (int) Math.ceil(imageCount / 5f); @@ -192,8 +199,12 @@ public void setProgress(float progress, int w) { pendingProgress = progress; return; } - int bitmapSize = Math.max(200, AndroidUtilities.dp(100)); - Bitmap bitmap = fileDrawable.getFrameAtTime(time); + final int bitmapSize = Math.max(200, dp(100)); + Bitmap bitmap = fileDrawable.getFrameAtTime(time, false); +// final long resultedTime = fileDrawable.getProgressMs(); +// if (Math.abs(time - resultedTime) > Math.max(1500, 0.10f * duration)) { +// bitmap = fileDrawable.getFrameAtTime(time, true); +// } if (bitmap != null) { int width = bitmap.getWidth(); int height = bitmap.getHeight(); @@ -232,12 +243,12 @@ public void setProgress(float progress, int w) { bitmapShader.setLocalMatrix(matrix); bitmapPaint.setShader(bitmapShader); invalidate(); - int viewSize = AndroidUtilities.dp(150); - float bitmapWidth = bitmapFinal.getWidth(); - float bitmapHeight = bitmapFinal.getHeight(); - float aspect = bitmapWidth / bitmapHeight; - int viewWidth; - int viewHeight; + final int viewSize = dp(150); + final float bitmapWidth = bitmapFinal.getWidth(); + final float bitmapHeight = bitmapFinal.getHeight(); + final float aspect = bitmapWidth / bitmapHeight; + final int viewWidth; + final int viewHeight; if (aspect > 1.0f) { viewWidth = viewSize; viewHeight = (int) (viewSize / aspect); @@ -258,29 +269,113 @@ public void setProgress(float progress, int w) { }); } + public void open(VideoPlayer videoPlayer) { + if (videoPlayer == null) return; + if (videoPlayer.getQualitiesCount() > 0) { + VideoPlayer.VideoUri suitableUri = null; + for (int i = 0; i < videoPlayer.getQualitiesCount(); ++i) { + final VideoPlayer.Quality q = videoPlayer.getQuality(i); + for (final VideoPlayer.VideoUri uri : q.uris) { + if (suitableUri == null || !suitableUri.isCached() && uri.isCached() || (suitableUri.isCached() == uri.isCached()) && uri.width * uri.height < suitableUri.width * suitableUri.height) { + suitableUri = uri; + } + } + } + if (suitableUri != null && !suitableUri.isCached()) { + final VideoPlayer.Quality q = videoPlayer.getCurrentQuality(); + if (q != null) { + suitableUri = q.getDownloadUri(); + } + } + if (suitableUri != null && !suitableUri.isCached()) { + // TODO + close(); + return; + } + open(suitableUri); + } else { + open(videoPlayer.getCurrentUri()); + } + } + + public void open(VideoPlayer.VideoUri qualityUri) { + if (qualityUri == null) return; + if (qualityUri.uri.equals(videoUri)) return; + if (open) { + close(); + } + isQualities = true; + videoUri = qualityUri.uri; + Utilities.globalQueue.postRunnable(loadRunnable = () -> { + if (qualityUri.isCached()) { + fileDrawable = new AnimatedFileDrawable(new File(qualityUri.uri.getPath()), true, 0, 0, null, null, null, 0, 0, true, null); + } else { + int currentAccount = UserConfig.selectedAccount; + try { + currentAccount = Utilities.parseInt(qualityUri.uri.getQueryParameter("account")); + } catch (Exception e) { + FileLog.e(e); + } + Object parentObject = null; + try { + parentObject = FileLoader.getInstance(currentAccount).getParentObject(Utilities.parseInt(qualityUri.uri.getQueryParameter("rid"))); + } catch (Exception e) { + FileLog.e(e); + } + final TLRPC.Document document = qualityUri.document; + String path; + final String name = FileLoader.getAttachFileName(document); + if (FileLoader.getInstance(currentAccount).isLoadingFile(name)) { + path = new File(FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE), document.dc_id + "_" + document.id + ".temp").getAbsolutePath(); + } else { + path = FileLoader.getInstance(currentAccount).getPathToAttach(document, false).getAbsolutePath(); + } + + fileDrawable = new AnimatedFileDrawable(new File(path), true, document.size, FileLoader.PRIORITY_NORMAL, document, null, parentObject, 0, currentAccount, true, null); + } + duration = fileDrawable.getDurationMs(); + if (pendingProgress != 0.0f) { + setProgress(pendingProgress, pixelWidth); + pendingProgress = 0.0f; + } + AndroidUtilities.runOnUIThread(() -> { + open = true; + loadRunnable = null; + if (fileDrawable != null) { + ready = true; + delegate.onReady(); + } + }); + }); + } + public void open(Uri uri) { if (uri == null || uri.equals(videoUri)) { return; } + if (open) { + close(); + } + isQualities = false; videoUri = uri; Utilities.globalQueue.postRunnable(loadRunnable = () -> { String scheme = uri.getScheme(); String path; if ("tg".equals(scheme)) { int currentAccount = Utilities.parseInt(uri.getQueryParameter("account")); - Object parentObject = FileLoader.getInstance(currentAccount).getParentObject(Utilities.parseInt(uri.getQueryParameter("rid"))); - TLRPC.TL_document document = new TLRPC.TL_document(); + final Object parentObject = FileLoader.getInstance(currentAccount).getParentObject(Utilities.parseInt(uri.getQueryParameter("rid"))); + final TLRPC.TL_document document = new TLRPC.TL_document(); document.access_hash = Utilities.parseLong(uri.getQueryParameter("hash")); document.id = Utilities.parseLong(uri.getQueryParameter("id")); document.size = Utilities.parseLong(uri.getQueryParameter("size")); document.dc_id = Utilities.parseInt(uri.getQueryParameter("dc")); document.mime_type = uri.getQueryParameter("mime"); document.file_reference = Utilities.hexToBytes(uri.getQueryParameter("reference")); - TLRPC.TL_documentAttributeFilename filename = new TLRPC.TL_documentAttributeFilename(); + final TLRPC.TL_documentAttributeFilename filename = new TLRPC.TL_documentAttributeFilename(); filename.file_name = uri.getQueryParameter("name"); document.attributes.add(filename); document.attributes.add(new TLRPC.TL_documentAttributeVideo()); - String name = FileLoader.getAttachFileName(document); + final String name = FileLoader.getAttachFileName(document); if (FileLoader.getInstance(currentAccount).isLoadingFile(name)) { path = new File(FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE), document.dc_id + "_" + document.id + ".temp").getAbsolutePath(); } else { @@ -297,6 +392,7 @@ public void open(Uri uri) { pendingProgress = 0.0f; } AndroidUtilities.runOnUIThread(() -> { + open = true; loadRunnable = null; if (fileDrawable != null) { ready = true; @@ -316,6 +412,10 @@ public boolean isReady() { return ready; } + public boolean isOpen() { + return open; + } + @Override protected void onDraw(Canvas canvas) { if (bitmapToRecycle != null) { @@ -327,16 +427,16 @@ protected void onDraw(Canvas canvas) { float scale = getMeasuredWidth() / (float) bitmapToDraw.getWidth(); matrix.preScale(scale, scale); bitmapRect.set(0, 0, getMeasuredWidth(), getMeasuredHeight()); - canvas.drawRoundRect(bitmapRect, AndroidUtilities.dp(6), AndroidUtilities.dp(6), bitmapPaint); + canvas.drawRoundRect(bitmapRect, dp(6), dp(6), bitmapPaint); frameDrawable.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight()); frameDrawable.draw(canvas); - canvas.drawText(frameTime, (getMeasuredWidth() - timeWidth) / 2f, getMeasuredHeight() - AndroidUtilities.dp(9), textPaint); + canvas.drawText(frameTime, (getMeasuredWidth() - timeWidth) / 2f, getMeasuredHeight() - dp(9), textPaint); } else if (isYoutube) { canvas.save(); ytPath.rewind(); AndroidUtilities.rectTmp.set(0, 0, getMeasuredWidth(), getMeasuredHeight()); - ytPath.addRoundRect(AndroidUtilities.rectTmp, AndroidUtilities.dp(6), AndroidUtilities.dp(6), Path.Direction.CW); + ytPath.addRoundRect(AndroidUtilities.rectTmp, dp(6), dp(6), Path.Direction.CW); canvas.clipPath(ytPath); canvas.scale((float) getWidth() / ytImageWidth, (float) getHeight() / ytImageHeight); @@ -348,7 +448,7 @@ protected void onDraw(Canvas canvas) { frameDrawable.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight()); frameDrawable.draw(canvas); - canvas.drawText(frameTime, (getMeasuredWidth() - timeWidth) / 2f, getMeasuredHeight() - AndroidUtilities.dp(9), textPaint); + canvas.drawText(frameTime, (getMeasuredWidth() - timeWidth) / 2f, getMeasuredHeight() - dp(9), textPaint); } } @@ -386,5 +486,6 @@ public void close() { currentPixel = -1; videoUri = null; ready = false; + open = false; } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ViewPagerFixed.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ViewPagerFixed.java index 3d8c5d886a..692e1cb91e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ViewPagerFixed.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ViewPagerFixed.java @@ -22,7 +22,6 @@ import android.text.TextPaint; import android.text.TextUtils; import android.transition.TransitionManager; -import android.util.Log; import android.util.SparseArray; import android.util.SparseIntArray; import android.view.Gravity; @@ -1153,7 +1152,7 @@ protected void onDraw(Canvas canvas) { int textX = (getMeasuredWidth() - tabWidth) / 2; if (!TextUtils.equals(currentTab.title, currentText)) { currentText = currentTab.title; - CharSequence text = Emoji.replaceEmoji(currentText, textPaint.getFontMetricsInt(), dp(15), false); + CharSequence text = Emoji.replaceEmoji(currentText, textPaint.getFontMetricsInt(), false); textLayout = new StaticLayout(text, textPaint, dp(400), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0, false); textHeight = textLayout.getHeight(); textOffsetX = (int) -textLayout.getLineLeft(0); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/WebPlayerView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/WebPlayerView.java index bfc33facd9..57eca42351 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/WebPlayerView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/WebPlayerView.java @@ -2090,12 +2090,12 @@ public boolean isInFullscreen() { } public static String getYouTubeVideoId(String url) { - Matcher matcher = youtubeIdRegex.matcher(url); - String id = null; - if (matcher.find()) { - id = matcher.group(1); + if (url == null) return null; + final Matcher matcher = youtubeIdRegex.matcher(url); + if (!matcher.find()) { + return null; } - return id; + return matcher.group(1); } public boolean canHandleUrl(String url) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ZoomControlView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ZoomControlView.java index 5198bb042d..2fa7db57fc 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ZoomControlView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ZoomControlView.java @@ -129,14 +129,18 @@ public boolean onTouchEvent(MotionEvent event) { handled = true; } else if (x >= minusCx - AndroidUtilities.dp(16) && x <= minusCx + AndroidUtilities.dp(16) && y >= minusCy - AndroidUtilities.dp(16) && y <= minusCy + AndroidUtilities.dp(16)) { if (action == MotionEvent.ACTION_UP && animateToZoom((float) Math.floor(getZoom() / 0.25f) * 0.25f - 0.25f)) { - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} } else { pressed = true; } handled = true; } else if (x >= plusCx - AndroidUtilities.dp(16) && x <= plusCx + AndroidUtilities.dp(16) && y >= plusCy - AndroidUtilities.dp(16) && y <= plusCy + AndroidUtilities.dp(16)) { if (action == MotionEvent.ACTION_UP && animateToZoom((float) Math.floor(getZoom() / 0.25f) * 0.25f + 0.25f)) { - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} } else { pressed = true; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/spoilers/SpoilerEffect.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/spoilers/SpoilerEffect.java index 789402ba22..cd6ca4493c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/spoilers/SpoilerEffect.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/spoilers/SpoilerEffect.java @@ -67,19 +67,19 @@ public class SpoilerEffect extends Drawable { public final static float[] ALPHAS = { 0.3f, 0.6f, 1.0f }; - private Paint[] particlePaints = new Paint[ALPHAS.length]; + private final Paint[] particlePaints = new Paint[ALPHAS.length]; - private Stack particlesPool = new Stack<>(); + private final Stack particlesPool = new Stack<>(); private int maxParticles; float[][] particlePoints = new float[ALPHAS.length][MAX_PARTICLES_PER_ENTITY * 5]; - private float[] particleRands = new float[RAND_REPEAT]; - private int[] renderCount = new int[ALPHAS.length]; + private final float[] particleRands = new float[RAND_REPEAT]; + private final int[] renderCount = new int[ALPHAS.length]; private static Path tempPath = new Path(); private RectF visibleRect; - private ArrayList particles = new ArrayList<>(); + private final ArrayList particles = new ArrayList<>(); private View mParent; private long lastDrawTime; @@ -371,7 +371,7 @@ public void draw(@NonNull Canvas canvas) { for (int i = 0; i < particles.size(); i++) { Particle p = particles.get(i); - if (visibleRect != null && !visibleRect.contains(p.x, p.y) || p.alpha != a && enableAlpha) { + if (p == null || visibleRect != null && !visibleRect.contains(p.x, p.y) || p.alpha != a && enableAlpha) { continue; } @@ -596,6 +596,8 @@ public static void addSpoilers(@Nullable View v, Layout textLayout, Spanned span addSpoilers(v, textLayout, -1, -1, spannable, spoilersPool, spoilers, null); } + public static final int MAX_SPOILERS_COUNT = 100; + /** * Parses spoilers from spannable * @@ -614,7 +616,7 @@ public static void addSpoilers(@Nullable View v, Layout textLayout, int layoutLe return; } TextStyleSpan[] spans = spannable.getSpans(0, textLayout.getText().length(), TextStyleSpan.class); - for (int i = 0; i < spans.length; ++i) { + for (int i = 0; i < Math.min(MAX_SPOILERS_COUNT, spans.length); ++i) { if (spans[i].isSpoiler()) { final int start = spannable.getSpanStart(spans[i]); final int end = spannable.getSpanEnd(spans[i]); @@ -743,7 +745,9 @@ public static void renderWithRipple(View v, boolean invalidateSpoilersParent, in SpannableStringBuilder sb = new SpannableStringBuilder(textLayout.getText()); if (textLayout.getText() instanceof Spanned) { Spanned sp = (Spanned) textLayout.getText(); - for (TextStyleSpan ss : sp.getSpans(0, sp.length(), TextStyleSpan.class)) { + TextStyleSpan[] spans = sp.getSpans(0, sp.length(), TextStyleSpan.class); + for (int i = 0; i < Math.min(MAX_SPOILERS_COUNT, spans.length); ++i) { + TextStyleSpan ss = spans[i]; if (ss.isSpoiler()) { int start = sp.getSpanStart(ss), end = sp.getSpanEnd(ss); for (Emoji.EmojiSpan e : sp.getSpans(start, end, Emoji.EmojiSpan.class)) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/spoilers/SpoilersTextView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/spoilers/SpoilersTextView.java index b97e3e58c9..8635d97948 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/spoilers/SpoilersTextView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/spoilers/SpoilersTextView.java @@ -11,15 +11,22 @@ import android.graphics.Rect; import android.graphics.Region; import android.text.Layout; +import android.text.Spannable; +import android.text.SpannableString; import android.text.Spanned; +import android.text.style.ClickableSpan; import android.view.MotionEvent; +import android.view.ViewConfiguration; import android.widget.TextView; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.Emoji; +import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Cells.TextSelectionHelper; import org.telegram.ui.Components.AnimatedEmojiDrawable; import org.telegram.ui.Components.AnimatedEmojiSpan; +import org.telegram.ui.Components.LinkPath; +import org.telegram.ui.Components.LinkSpanDrawable; import java.util.ArrayList; import java.util.List; @@ -38,12 +45,34 @@ public class SpoilersTextView extends TextView implements TextSelectionHelper.Si private AnimatedEmojiSpan.EmojiGroupedSpans animatedEmoji; private boolean useAlphaForEmoji = true; + private final LinkSpanDrawable.LinkCollector links; + private Theme.ResourcesProvider resourcesProvider; + public SpoilersTextView(Context context) { - this(context, true); + this(context, null); + } + + public SpoilersTextView(Context context, Theme.ResourcesProvider resourcesProvider) { + this(context, true, resourcesProvider); } public SpoilersTextView(Context context, boolean revealOnClick) { + this(context, revealOnClick, null); + } + + private boolean clearLinkOnLongPress = true; + public void setClearLinkOnLongPress(boolean clear) { + this.clearLinkOnLongPress = clear; + } + + public void clearLinks() { + links.clear(); + } + + public SpoilersTextView(Context context, boolean revealOnClick, Theme.ResourcesProvider resourcesProvider) { super(context); + this.links = new LinkSpanDrawable.LinkCollector(this); + this.resourcesProvider = resourcesProvider; clickDetector = new SpoilersClickDetector(this, spoilers, (eff, x, y) -> { if (isSpoilersRevealed || !revealOnClick) return; @@ -59,8 +88,63 @@ public SpoilersTextView(Context context, boolean revealOnClick) { }); } + public int overrideLinkColor() { + return Theme.getColor(Theme.key_chat_linkSelectBackground, resourcesProvider); + } + + protected LinkSpanDrawable.LinksTextView.OnLinkPress onPressListener; + protected LinkSpanDrawable.LinksTextView.OnLinkPress onLongPressListener; + + private LinkSpanDrawable pressedLink; + @Override public boolean dispatchTouchEvent(MotionEvent event) { + if (links != null) { + Layout textLayout = getLayout(); + ClickableSpan span; + if ((span = hit((int) event.getX(), (int) event.getY())) != null) { + if (event.getAction() == MotionEvent.ACTION_DOWN) { + final LinkSpanDrawable link = new LinkSpanDrawable(span, resourcesProvider, event.getX(), event.getY()); + link.setColor(overrideLinkColor()); + pressedLink = link; + links.addLink(pressedLink); + Spannable buffer = new SpannableString(textLayout.getText()); + int start = buffer.getSpanStart(pressedLink.getSpan()); + int end = buffer.getSpanEnd(pressedLink.getSpan()); + LinkPath path = pressedLink.obtainNewPath(); + path.setCurrentLayout(textLayout, start, getPaddingTop()); + textLayout.getSelectionPath(start, end, path); + AndroidUtilities.runOnUIThread(() -> { + if (onLongPressListener != null && pressedLink == link) { + onLongPressListener.run(span); + pressedLink = null; + links.clear(); + } + }, ViewConfiguration.getLongPressTimeout()); + return true; + } + } + if (event.getAction() == MotionEvent.ACTION_UP) { + links.clear(); + if (pressedLink != null && pressedLink.getSpan() == span) { + if (onPressListener != null) { + onPressListener.run(pressedLink.getSpan()); + } else if (pressedLink.getSpan() != null) { + pressedLink.getSpan().onClick(this); + } + pressedLink = null; + return true; + } + pressedLink = null; + } + if (event.getAction() == MotionEvent.ACTION_CANCEL) { + links.clear(); + pressedLink = null; + } + } + if (pressedLink != null) { + return true; + } if (allowClickSpoilers && clickDetector.onTouchEvent(event)) return true; return super.dispatchTouchEvent(event); @@ -96,10 +180,34 @@ public void setTextColor(int color) { animatedEmojiColorFilter = new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN); } + private boolean disablePaddingsOffset; + private boolean disablePaddingsOffsetX; + private boolean disablePaddingsOffsetY; + public void setDisablePaddingsOffset(boolean disablePaddingsOffset) { + this.disablePaddingsOffset = disablePaddingsOffset; + } + + public void setDisablePaddingsOffsetX(boolean disablePaddingsOffsetX) { + this.disablePaddingsOffsetX = disablePaddingsOffsetX; + } + + public void setDisablePaddingsOffsetY(boolean disablePaddingsOffsetY) { + this.disablePaddingsOffsetY = disablePaddingsOffsetY; + } + @Override protected void onDraw(Canvas canvas) { int pl = getPaddingLeft(), pt = getPaddingTop(); + canvas.save(); + if (!disablePaddingsOffset) { + canvas.translate(disablePaddingsOffsetX ? 0 : getPaddingLeft(), disablePaddingsOffsetY ? 0 : getPaddingTop()); + } + if (links != null && links.draw(canvas)) { + invalidate(); + } + canvas.restore(); + canvas.save(); path.rewind(); for (SpoilerEffect eff : spoilers) { @@ -197,6 +305,27 @@ private void invalidateSpoilers() { invalidate(); } + + public ClickableSpan hit(int x, int y) { + Layout textLayout = getLayout(); + if (textLayout == null) { + return null; + } + x -= getPaddingLeft(); + y -= getPaddingTop(); + final int line = textLayout.getLineForVertical(y); + final int off = textLayout.getOffsetForHorizontal(line, x); + final float left = textLayout.getLineLeft(line); + if (left <= x && left + textLayout.getLineWidth(line) >= x && y >= 0 && y <= textLayout.getHeight()) { + Spannable buffer = new SpannableString(textLayout.getText()); + ClickableSpan[] spans = buffer.getSpans(off, off, ClickableSpan.class); + if (spans.length != 0 && !AndroidUtilities.isAccessibilityScreenReaderEnabled()) { + return spans[0]; + } + } + return null; + } + @Override public Layout getStaticTextLayout() { return getLayout(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/voip/VoIPHelper.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/voip/VoIPHelper.java index 30f9e6853e..70a185e9fb 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/voip/VoIPHelper.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/voip/VoIPHelper.java @@ -40,6 +40,7 @@ import org.telegram.messenger.voip.VoIPService; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_phone; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.Theme; @@ -383,7 +384,7 @@ public static boolean canRateCall(TLRPC.TL_messageActionPhoneCall call) { public static void sendCallRating(final long callID, final long accessHash, final int account, int rating) { final int currentAccount = UserConfig.selectedAccount; - final TLRPC.TL_phone_setCallRating req = new TLRPC.TL_phone_setCallRating(); + final TL_phone.setCallRating req = new TL_phone.setCallRating(); req.rating = rating; req.comment = ""; req.peer = new TLRPC.TL_inputPhoneCall(); @@ -565,7 +566,7 @@ public static void showRateAlert(final Context context, final Runnable onDismiss int rating = bar.getRating(); if (rating >= 4 || page[0] == 1) { final int currentAccount = UserConfig.selectedAccount; - final TLRPC.TL_phone_setCallRating req = new TLRPC.TL_phone_setCallRating(); + final TL_phone.setCallRating req = new TL_phone.setCallRating(); req.rating = bar.getRating(); ArrayList problemTags = new ArrayList<>(); for (int i = 0; i < problemsWrap.getChildCount(); i++) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ContactAddActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ContactAddActivity.java index c5d48080f2..a10389f298 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ContactAddActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ContactAddActivity.java @@ -358,7 +358,7 @@ protected Theme.ResourcesProvider getResourcesProvider() { checkBoxCell = new CheckBoxCell(getParentActivity(), 0); checkBoxCell.setBackgroundDrawable(Theme.getSelectorDrawable(false)); CharSequence firstName = UserObject.getFirstName(user); - firstName = Emoji.replaceEmoji(firstName, infoTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(12), false); + firstName = Emoji.replaceEmoji(firstName, infoTextView.getPaint().getFontMetricsInt(), false); checkBoxCell.setText(AndroidUtilities.replaceCharSequence("%1$s", AndroidUtilities.replaceTags(LocaleController.getString(R.string.SharePhoneNumberWith)), firstName), "", true, false); checkBoxCell.setPadding(AndroidUtilities.dp(7), 0, AndroidUtilities.dp(7), 0); checkBoxCell.setOnClickListener(v -> checkBoxCell.setChecked(!checkBoxCell.isChecked(), true)); @@ -574,7 +574,7 @@ private void updateAvatarLayout() { if (TextUtils.isEmpty(getPhone())) { nameTextView.setText(LocaleController.getString(R.string.MobileHidden)); CharSequence firstName = UserObject.getFirstName(user); - firstName = Emoji.replaceEmoji(firstName, infoTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(12), false); + firstName = Emoji.replaceEmoji(firstName, infoTextView.getPaint().getFontMetricsInt(), false); infoTextView.setText(AndroidUtilities.replaceCharSequence("%1$s", AndroidUtilities.replaceTags(LocaleController.getString(R.string.MobileHiddenExceptionInfo)), firstName)); } else { nameTextView.setText(PhoneFormat.getInstance().format("+" + getPhone())); @@ -857,7 +857,7 @@ public void onUploadProgressChanged(float progress) { } @Override - public void didStartUpload(boolean isVideo) { + public void didStartUpload(boolean fromAvatarConstructor, boolean isVideo) { if (avatarProgressView == null) { return; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ContentPreviewViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/ContentPreviewViewer.java index 98f642209f..0ff05647de 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ContentPreviewViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ContentPreviewViewer.java @@ -485,7 +485,9 @@ public void run() { showUnlockPremiumView(); menuVisible = true; containerView.invalidate(); - containerView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + containerView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} return; } final boolean inFavs = MediaDataController.getInstance(currentAccount).isStickerInFavorites(currentDocument); @@ -660,7 +662,9 @@ public void dismiss() { } popupWindow.showAtLocation(containerView, 0, (int) ((containerView.getMeasuredWidth() - previewMenu.getMeasuredWidth()) / 2f), y); - containerView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + containerView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} } else if (currentContentType == CONTENT_TYPE_EMOJI && delegate != null) { ArrayList items = new ArrayList<>(); final ArrayList actions = new ArrayList<>(); @@ -778,7 +782,9 @@ public void dismiss() { popupWindow.showAtLocation(containerView, 0, (int) ((containerView.getMeasuredWidth() - previewMenu.getMeasuredWidth()) / 2f), y); ActionBarPopupWindow.startAnimation(previewMenu); - containerView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + containerView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} if (moveY != 0) { if (finalMoveY == 0) { @@ -913,7 +919,9 @@ public void dismiss() { y += AndroidUtilities.dp(24) - moveY; popupWindow.showAtLocation(containerView, 0, (int) ((containerView.getMeasuredWidth() - previewMenu.getMeasuredWidth()) / 2f), y); - containerView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + containerView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} if (moveY != 0) { if (finalMoveY == 0) { @@ -1409,7 +1417,9 @@ public boolean onInterceptTouchEvent(MotionEvent event, final RecyclerListView l } } if (opened) { - currentPreviewCell.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + currentPreviewCell.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} if (delegate != null) { delegate.resetTouch(); } @@ -1567,7 +1577,7 @@ public void open(TLRPC.Document document, SendMessagesHelper.ImportingSticker st } } if (emojiPath != null) { - CharSequence emoji = Emoji.replaceEmoji(emojiPath, textPaint.getFontMetricsInt(), AndroidUtilities.dp(24), false); + CharSequence emoji = Emoji.replaceEmoji(emojiPath, textPaint.getFontMetricsInt(), false); emoji = TextUtils.ellipsize(emoji, textPaint, dp(200), TextUtils.TruncateAt.END); emoji = AndroidUtilities.replaceCharSequence("\u2026", emoji, ""); stickerEmojiLayout = new StaticLayout(emoji, textPaint, AndroidUtilities.dp(200), Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false); @@ -1599,7 +1609,7 @@ public void open(TLRPC.Document document, SendMessagesHelper.ImportingSticker st TLRPC.DocumentAttribute attribute = document.attributes.get(a); if (attribute instanceof TLRPC.TL_documentAttributeSticker) { if (!TextUtils.isEmpty(attribute.alt)) { - CharSequence emoji = Emoji.replaceEmoji(attribute.alt, textPaint.getFontMetricsInt(), AndroidUtilities.dp(24), false); + CharSequence emoji = Emoji.replaceEmoji(attribute.alt, textPaint.getFontMetricsInt(), false); emoji = TextUtils.ellipsize(emoji, textPaint, dp(200), TextUtils.TruncateAt.END); emoji = AndroidUtilities.replaceCharSequence("\u2026", emoji, ""); stickerEmojiLayout = new StaticLayout(emoji, textPaint, AndroidUtilities.dp(200), Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false); @@ -1618,7 +1628,7 @@ public void open(TLRPC.Document document, SendMessagesHelper.ImportingSticker st paintingOverlay.setEntities(sticker.videoEditedInfo.mediaEntities, true, true, false); } if (emojiPath != null) { - CharSequence emoji = Emoji.replaceEmoji(emojiPath, textPaint.getFontMetricsInt(), AndroidUtilities.dp(24), false); + CharSequence emoji = Emoji.replaceEmoji(emojiPath, textPaint.getFontMetricsInt(), false); emoji = TextUtils.ellipsize(emoji, textPaint, dp(200), TextUtils.TruncateAt.END); emoji = AndroidUtilities.replaceCharSequence("\u2026", emoji, ""); stickerEmojiLayout = new StaticLayout(emoji, textPaint, AndroidUtilities.dp(200), Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false); @@ -1960,7 +1970,9 @@ private void prepareBlurBitmap() { return; } preparingBitmap = true; + centerImage.setVisible(false, false); AndroidUtilities.makeGlobalBlurBitmap(bitmap -> { + centerImage.setVisible(true, false); blurrBitmap = bitmap; preparingBitmap = false; if (containerView != null) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/CountrySelectActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/CountrySelectActivity.java index 6d76e3c6d2..bdeddda36c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/CountrySelectActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/CountrySelectActivity.java @@ -392,7 +392,7 @@ public void onBindViewHolder(int section, int position, RecyclerView.ViewHolder ArrayList arr = countries.get(sortedCountries.get(section)); Country c = arr.get(position); TextSettingsCell settingsCell = (TextSettingsCell) holder.itemView; - settingsCell.setTextAndValue(Emoji.replaceEmoji(getCountryNameWithFlag(c), settingsCell.getTextView().getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false), needPhoneCode ? "+" + c.code : null, false); + settingsCell.setTextAndValue(Emoji.replaceEmoji(getCountryNameWithFlag(c), settingsCell.getTextView().getPaint().getFontMetricsInt(), false), needPhoneCode ? "+" + c.code : null, false); } } @@ -532,7 +532,7 @@ public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { Country c = searchResult.get(position); TextSettingsCell settingsCell = (TextSettingsCell) holder.itemView; - settingsCell.setTextAndValue(Emoji.replaceEmoji(getCountryNameWithFlag(c), settingsCell.getTextView().getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false), needPhoneCode ? "+" + c.code : null, false); + settingsCell.setTextAndValue(Emoji.replaceEmoji(getCountryNameWithFlag(c), settingsCell.getTextView().getPaint().getFontMetricsInt(), false), needPhoneCode ? "+" + c.code : null, false); } @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DataSettingsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/DataSettingsActivity.java index 5493fd2467..6ac3dcdc04 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/DataSettingsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/DataSettingsActivity.java @@ -524,12 +524,9 @@ public Integer getSelectorColor(int position) { AlertDialog.Builder confirAlert = new AlertDialog.Builder(getContext()); confirAlert.setTitle(LocaleController.getString(R.string.DecreaseSpeed)); confirAlert.setMessage(LocaleController.getString(R.string.SdCardAlert)); - confirAlert.setPositiveButton(LocaleController.getString(R.string.Proceed), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - setStorageDirectory(storageDir); - builder.getDismissRunnable().run(); - } + confirAlert.setPositiveButton(LocaleController.getString(R.string.Proceed), (dialog, which) -> { + setStorageDirectory(storageDir); + builder.getDismissRunnable().run(); }); confirAlert.setNegativeButton(LocaleController.getString(R.string.Back), null); confirAlert.show(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java index c52968aff7..5fa07571b2 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java @@ -35,15 +35,12 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; -import android.graphics.LinearGradient; -import android.graphics.Matrix; import android.graphics.Outline; import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.Rect; import android.graphics.RectF; -import android.graphics.Shader; import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.ColorDrawable; @@ -60,7 +57,6 @@ import android.util.LongSparseArray; import android.util.Property; import android.util.StateSet; -import android.util.TypedValue; import android.view.Gravity; import android.view.HapticFeedbackConstants; import android.view.KeyEvent; @@ -131,6 +127,7 @@ import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.tgnet.tl.TL_chatlists; import org.telegram.tgnet.tl.TL_stars; import org.telegram.tgnet.tl.TL_stories; @@ -182,9 +179,11 @@ import org.telegram.ui.Components.AvatarDrawable; import org.telegram.ui.Components.BackupImageView; import org.telegram.ui.Components.BlurredRecyclerView; +import org.telegram.ui.Components.ImageUpdater; import org.telegram.ui.Components.PermissionRequest; import org.telegram.ui.Components.UItem; import org.telegram.ui.Gifts.GiftSheet; +import org.telegram.ui.Stars.StarGiftSheet; import org.telegram.ui.Stars.StarsController; import org.telegram.ui.Stars.StarsIntroActivity; import org.telegram.ui.Stories.StealthModeAlert; @@ -210,7 +209,6 @@ import org.telegram.ui.Components.ItemOptions; import org.telegram.ui.Components.JoinGroupAlert; import org.telegram.ui.Components.LayoutHelper; -import org.telegram.ui.Components.MediaActionDrawable; import org.telegram.ui.Components.MediaActivity; import org.telegram.ui.Components.NumberTextView; import org.telegram.ui.Components.PacmanAnimation; @@ -221,7 +219,6 @@ import org.telegram.ui.Components.PullForegroundDrawable; import org.telegram.ui.Components.RLottieDrawable; import org.telegram.ui.Components.RLottieImageView; -import org.telegram.ui.Components.RadialProgress2; import org.telegram.ui.Components.RadialProgressView; import org.telegram.ui.Components.Reactions.ReactionsLayoutInBubble; import org.telegram.ui.Components.RecyclerAnimationScrollHelper; @@ -465,7 +462,7 @@ public void updateList(boolean animated) { private MenuDrawable menuDrawable; private BackDrawable backDrawable; - private Paint actionBarDefaultPaint = new Paint(); + private final Paint actionBarDefaultPaint = new Paint(); private NumberTextView selectedDialogsCountTextView; private final ArrayList actionModeViews = new ArrayList<>(); @@ -653,6 +650,7 @@ public void updateList(boolean animated) { private boolean isPremiumHintUpgrade; + private Long statusDrawableGiftId; private AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable statusDrawable; private DrawerProfileCell.AnimatedStatusView animatedStatusView; public RightSlidingDialogContainer rightSlidingDialogContainer; @@ -2255,7 +2253,9 @@ public boolean onTouchEvent(MotionEvent e) { } if (!canShowHiddenArchive) { canShowHiddenArchive = true; - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} if (parentPage.pullForegroundDrawable != null) { parentPage.pullForegroundDrawable.colorize(true); } @@ -2839,8 +2839,14 @@ public void updateStatus(TLRPC.User user, boolean animated) { return; } Long emojiStatusId = UserObject.getEmojiStatusDocumentId(user); + statusDrawableGiftId = null; if (emojiStatusId != null) { + final boolean isCollectible = user.emoji_status instanceof TLRPC.TL_emojiStatusCollectible; statusDrawable.set(emojiStatusId, animated); + statusDrawable.setParticles(isCollectible, animated); + if (isCollectible) { + statusDrawableGiftId = ((TLRPC.TL_emojiStatusCollectible) user.emoji_status).collectible_id; + } actionBar.setRightDrawableOnClick(e -> { if (dialogStoriesCellVisible && dialogStoriesCell != null && !dialogStoriesCell.isExpanded()) { scrollToTop(true, true); @@ -2864,6 +2870,7 @@ public void draw(@NonNull Canvas canvas) { } premiumStar.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_profile_verifiedBackground), PorterDuff.Mode.MULTIPLY)); statusDrawable.set(premiumStar, animated); + statusDrawable.setParticles(false, animated); actionBar.setRightDrawableOnClick(e -> { if (dialogStoriesCellVisible && dialogStoriesCell != null && !dialogStoriesCell.isExpanded()) { scrollToTop(true, true); @@ -2874,6 +2881,7 @@ public void draw(@NonNull Canvas canvas) { SelectAnimatedEmojiDialog.preload(currentAccount); } else { statusDrawable.set((Drawable) null, animated); + statusDrawable.setParticles(false, animated); actionBar.setRightDrawableOnClick(null); } statusDrawable.setColor(Theme.getColor(Theme.key_profile_verifiedBackground)); @@ -3100,6 +3108,7 @@ public void onSearchExpand() { if (switchItem != null) { switchItem.setVisibility(View.GONE); } + createSearchViewPager(); if (proxyItem != null && proxyItemVisible) { proxyItem.setVisibility(View.GONE); } @@ -3137,6 +3146,15 @@ public void onSearchExpand() { if (optionsItem != null) { optionsItem.setVisibility(View.GONE); } + if (searchViewPager != null) { + searchViewPager.onShown(); + } + if ((searchViewPager != null && searchViewPager.dialogsSearchAdapter != null && searchViewPager.dialogsSearchAdapter.hasRecentSearch()) || getMessagesController().getTotalDialogsCount() > 10 || searchFiltersWasShowed || hasStories) { + searchWas = true; + if (!searchIsShowed) { + showSearch(true, false, true); + } + } } @Override @@ -3239,7 +3257,9 @@ public boolean canToggleSearch() { searchItem.setContentDescription(getString(R.string.Search)); if (onlySelect) { actionBar.setBackButtonImage(R.drawable.ic_ab_back); - if (isReplyTo) { + if (initialDialogsType == DIALOGS_TYPE_BOT_SELECT_VERIFY) { + actionBar.setTitle(getString(R.string.BotChooseChatToVerify)); + } else if (isReplyTo) { actionBar.setTitle(LocaleController.getString(R.string.ReplyToDialog)); } else if (isQuote) { actionBar.setTitle(getString(R.string.QuoteTo)); @@ -3345,8 +3365,7 @@ protected void onDefaultTabMoved() { if (!getMessagesController().premiumFeaturesBlocked()) { try { performHapticFeedback(HapticFeedbackConstants.KEYBOARD_PRESS, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); - } catch (Exception ignore) { - } + } catch (Exception ignore) {} topBulletin = BulletinFactory.of(DialogsActivity.this).createSimpleBulletin(R.raw.filter_reorder, AndroidUtilities.replaceTags(LocaleController.formatString(R.string.LimitReachedReorderFolder, LocaleController.getString(R.string.FilterAllChats))), LocaleController.getString(R.string.PremiumMore), Bulletin.DURATION_PROLONG, () -> { showDialog(new PremiumFeatureBottomSheet(DialogsActivity.this, PremiumPreviewFragment.PREMIUM_FEATURE_ADVANCED_CHAT_MANAGEMENT, true)); filterTabsView.setIsEditing(false); @@ -3730,7 +3749,7 @@ public void onItemClick(int id) { filter.neverShow.add(selectedDialogs.get(a)); filter.alwaysShow.remove(selectedDialogs.get(a)); } - FilterCreateActivity.saveFilterToServer(filter, filter.flags, filter.name, filter.color, filter.alwaysShow, filter.neverShow, filter.pinnedDialogs, false, false, true, true, false, DialogsActivity.this, null); + FilterCreateActivity.saveFilterToServer(filter, filter.flags, filter.name, filter.entities, filter.title_noanimate, filter.color, filter.alwaysShow, filter.neverShow, filter.pinnedDialogs, false, false, true, true, false, DialogsActivity.this, null); long did; if (selectedDialogs.size() == 1) { did = selectedDialogs.get(0); @@ -3747,7 +3766,7 @@ public void onItemClick(int id) { filter.neverShow.remove(alwaysShow.get(a)); } filter.alwaysShow.addAll(alwaysShow); - FilterCreateActivity.saveFilterToServer(filter, filter.flags, filter.name, filter.color, filter.alwaysShow, filter.neverShow, filter.pinnedDialogs, false, false, true, true, false, DialogsActivity.this, null); + FilterCreateActivity.saveFilterToServer(filter, filter.flags, filter.name, filter.entities, filter.title_noanimate, filter.color, filter.alwaysShow, filter.neverShow, filter.pinnedDialogs, false, false, true, true, false, DialogsActivity.this, null); } long did; if (alwaysShow.size() == 1) { @@ -3790,7 +3809,7 @@ public void onItemClick(int id) { if (filter.isChatlist()) { filter.neverShow.clear(); } - FilterCreateActivity.saveFilterToServer(filter, filter.flags, filter.name, filter.color, filter.alwaysShow, filter.neverShow, filter.pinnedDialogs, false, false, true, false, false, DialogsActivity.this, null); + FilterCreateActivity.saveFilterToServer(filter, filter.flags, filter.name, filter.entities, filter.title_noanimate, filter.color, filter.alwaysShow, filter.neverShow, filter.pinnedDialogs, false, false, true, false, false, DialogsActivity.this, null); } long did; if (neverShow.size() == 1) { @@ -4062,7 +4081,9 @@ public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerVi if (canShowHiddenArchive != canShowInternal) { canShowHiddenArchive = canShowInternal; if (viewPage.archivePullViewState == ARCHIVE_ITEM_STATE_HIDDEN) { - viewPage.listView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + viewPage.listView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} if (viewPage.pullForegroundDrawable != null) { viewPage.pullForegroundDrawable.colorize(canShowInternal); } @@ -4951,7 +4972,9 @@ public void onUserLongPressed(View view, long dialogId) { BotWebViewVibrationEffect.APP_ERROR.vibrate(); return; } - view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} if (dialogId == UserConfig.getInstance(currentAccount).getClientUserId()) { if (!storiesEnabled) { if (dialogStoriesCell != null) { @@ -5406,7 +5429,9 @@ private void setStoriesOvercroll(ViewPage viewPage, float storiesOverscroll) { fragmentView.dispatchTouchEvent(AndroidUtilities.emptyMotionEvent()); }); dialogStoriesCell.openOverscrollSelectedStory(); - dialogStoriesCell.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + dialogStoriesCell.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} } } @@ -5600,19 +5625,50 @@ public void showSelectStatusDialog() { } SelectAnimatedEmojiDialog popupLayout = new SelectAnimatedEmojiDialog(this, getContext(), true, xoff, SelectAnimatedEmojiDialog.TYPE_EMOJI_STATUS, getResourceProvider()) { @Override - protected void onEmojiSelected(View emojiView, Long documentId, TLRPC.Document document, Integer until) { - TLRPC.EmojiStatus emojiStatus; + protected boolean willApplyEmoji(View view, Long documentId, TLRPC.Document document, TL_stars.TL_starGiftUnique gift, Integer until) { + if (gift != null) { + final TL_stars.SavedStarGift savedStarGift = StarsController.getInstance(currentAccount).findUserStarGift(gift.id); + return savedStarGift == null || MessagesController.getGlobalMainSettings().getInt("statusgiftpage", 0) >= 2; + } + return true; + } + + @Override + protected void onEmojiSelected(View emojiView, Long documentId, TLRPC.Document document, TL_stars.TL_starGiftUnique gift, Integer until) { + final TLRPC.EmojiStatus emojiStatus; if (documentId == null) { emojiStatus = new TLRPC.TL_emojiStatusEmpty(); - } else if (until != null) { - emojiStatus = new TLRPC.TL_emojiStatusUntil(); - ((TLRPC.TL_emojiStatusUntil) emojiStatus).document_id = documentId; - ((TLRPC.TL_emojiStatusUntil) emojiStatus).until = until; + } else if (gift != null) { + final TL_stars.SavedStarGift savedStarGift = StarsController.getInstance(currentAccount).findUserStarGift(gift.id); + if (savedStarGift != null && MessagesController.getGlobalMainSettings().getInt("statusgiftpage", 0) < 2) { + MessagesController.getGlobalMainSettings().edit().putInt("statusgiftpage", MessagesController.getGlobalMainSettings().getInt("statusgiftpage", 0) + 1).apply(); + new StarGiftSheet(getContext(), currentAccount, UserConfig.getInstance(currentAccount).getClientUserId(), resourceProvider) + .set(savedStarGift) + .setupWearPage() + .show(); + if (popup[0] != null) { + selectAnimatedEmojiDialog = null; + popup[0].dismiss(); + } + return; + } + final TLRPC.TL_inputEmojiStatusCollectible status = new TLRPC.TL_inputEmojiStatusCollectible(); + status.collectible_id = gift.id; + if (until != null) { + status.flags |= 1; + status.until = until; + } + emojiStatus = status; } else { - emojiStatus = new TLRPC.TL_emojiStatus(); - ((TLRPC.TL_emojiStatus) emojiStatus).document_id = documentId; + final TLRPC.TL_emojiStatus status = new TLRPC.TL_emojiStatus(); + status.document_id = documentId; + if (until != null) { + status.flags |= 1; + status.until = until; + } + emojiStatus = status; } - getMessagesController().updateEmojiStatus(emojiStatus); + getMessagesController().updateEmojiStatus(emojiStatus, gift); if (documentId != null) { animatedStatusView.animateChange(ReactionsLayoutInBubble.VisibleReaction.fromCustomEmoji(documentId)); } @@ -5625,7 +5681,11 @@ protected void onEmojiSelected(View emojiView, Long documentId, TLRPC.Document d if (user != null && DialogObject.getEmojiStatusUntil(user.emoji_status) > 0) { popupLayout.setExpireDateHint(DialogObject.getEmojiStatusUntil(user.emoji_status)); } - popupLayout.setSelected(statusDrawable.getDrawable() instanceof AnimatedEmojiDrawable ? ((AnimatedEmojiDrawable) statusDrawable.getDrawable()).getDocumentId() : null); + if (statusDrawableGiftId != null) { + popupLayout.setSelected(statusDrawableGiftId); + } else { + popupLayout.setSelected(statusDrawable.getDrawable() instanceof AnimatedEmojiDrawable ? ((AnimatedEmojiDrawable) statusDrawable.getDrawable()).getDocumentId() : null); + } popupLayout.setSaveState(1); popupLayout.setScrimDrawable(statusDrawable, actionBarTitle); popup[0] = selectAnimatedEmojiDialog = new SelectAnimatedEmojiDialog.SelectAnimatedEmojiDialogWindow(popupLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT) { @@ -5765,8 +5825,7 @@ private void updateDialogsHint() { return; } if (dialogsHintCell != null) { - dialogsHintCell.setCompact(false); - dialogsHintCell.setAvatars(currentAccount, null); + dialogsHintCell.clear(); } if (isInPreviewMode()) { dialogsHintCellVisible = false; @@ -5888,11 +5947,11 @@ private void updateDialogsHint() { dialogsHintCell.setCompact(true); dialogsHintCell.setOnClickListener(v -> { showDialog(AlertsCreator.createBirthdayPickerDialog(getContext(), getString(R.string.EditProfileBirthdayTitle), getString(R.string.EditProfileBirthdayButton), null, birthday -> { - TLRPC.TL_account_updateBirthday req = new TLRPC.TL_account_updateBirthday(); + TL_account.updateBirthday req = new TL_account.updateBirthday(); req.flags |= 1; req.birthday = birthday; TLRPC.UserFull userFull = getMessagesController().getUserFull(getUserConfig().getClientUserId()); - TLRPC.TL_birthday oldBirthday = userFull != null ? userFull.birthday : null; + TL_account.TL_birthday oldBirthday = userFull != null ? userFull.birthday : null; if (userFull != null) { userFull.flags2 |= 32; userFull.birthday = birthday; @@ -6043,62 +6102,85 @@ private void updateDialogsHint() { LocaleController.getString(R.string.ClearStorageHintMessage) ); updateAuthHintCellVisibility(false); - } else { - if (folderId == 0 && ApplicationLoader.applicationLoaderInstance != null) { - boolean found = false; - String foundSuggestion = null; - CharSequence[] output = new CharSequence[2]; - boolean[] closeable = new boolean[1]; - if (ApplicationLoader.applicationLoaderInstance.onSuggestionFill(null, output, closeable)) { - found = true; - foundSuggestion = null; - } else { - for (String suggestion : MessagesController.getInstance(currentAccount).pendingSuggestions) { - if (ApplicationLoader.applicationLoaderInstance.onSuggestionFill(suggestion, output, closeable)) { - found = true; - foundSuggestion = suggestion; - break; - } + } else if (folderId == 0 && getUserConfig().getCurrentUser() != null && (getUserConfig().getCurrentUser().photo == null || getUserConfig().getCurrentUser().photo instanceof TLRPC.TL_userProfilePhotoEmpty) && (BuildVars.DEBUG_PRIVATE_VERSION || MessagesController.getInstance(currentAccount).pendingSuggestions.contains("USERPIC_SETUP"))) { + dialogsHintCellVisible = true; + dialogsHintCell.setVisibility(View.VISIBLE); + dialogsHintCell.setOnClickListener(v -> { + openSetAvatar(); + }); + dialogsHintCell.showImage(); + AvatarDrawable avatarDrawable = new AvatarDrawable(); + avatarDrawable.setInfo(getUserConfig().getClientUserId()); + avatarDrawable.setCustomIcon(getContext().getResources().getDrawable(R.drawable.filled_add_photo)); + avatarDrawable.setScaleSize(.85f); + dialogsHintCell.imageView.setImageDrawable(avatarDrawable); + dialogsHintCell.setText( + Emoji.replaceWithRestrictedEmoji(LocaleController.getString(R.string.HintAddYourPhoto), dialogsHintCell.titleView, this::updateDialogsHint), + getString(R.string.HintAddYourPhotoText) + ); + dialogsHintCell.setOnCloseListener(v -> { + MessagesController.getInstance(currentAccount).removeSuggestion(0, "USERPIC_SETUP"); + ChangeBounds transition = new ChangeBounds(); + transition.setDuration(200); + TransitionManager.beginDelayedTransition((ViewGroup) dialogsHintCell.getParent(), transition); + updateDialogsHint(); + }); + dialogsHintCell.setCompact(false); + updateAuthHintCellVisibility(false); + } else if (folderId == 0 && ApplicationLoader.applicationLoaderInstance != null) { + boolean found = false; + String foundSuggestion = null; + CharSequence[] output = new CharSequence[2]; + boolean[] closeable = new boolean[1]; + if (ApplicationLoader.applicationLoaderInstance.onSuggestionFill(null, output, closeable)) { + found = true; + foundSuggestion = null; + } else { + for (String suggestion : MessagesController.getInstance(currentAccount).pendingSuggestions) { + if (ApplicationLoader.applicationLoaderInstance.onSuggestionFill(suggestion, output, closeable)) { + found = true; + foundSuggestion = suggestion; + break; } } - if (found) { - final String finalSuggestion = foundSuggestion; - dialogsHintCellVisible = true; - dialogsHintCell.setVisibility(View.VISIBLE); - dialogsHintCell.setCompact(false); - dialogsHintCell.setOnClickListener(v -> { - if (ApplicationLoader.applicationLoaderInstance != null) { - ApplicationLoader.applicationLoaderInstance.onSuggestionClick(finalSuggestion); - } - }); - dialogsHintCell.setText( - output[0] instanceof String ? AndroidUtilities.replaceSingleTag( - output[0].toString(), - Theme.key_windowBackgroundWhiteValueText, - AndroidUtilities.REPLACING_TAG_TYPE_LINKBOLD, - null - ) : output[0], - output[1] instanceof String ? AndroidUtilities.replaceTags(output[1].toString()) : output[1] - ); - if (closeable[0] && finalSuggestion != null) { - dialogsHintCell.setOnCloseListener(v -> { - AndroidUtilities.runOnUIThread(() -> { - MessagesController.getInstance(currentAccount).removeSuggestion(0, finalSuggestion); - updateDialogsHint(); - }, 250); - }); + } + if (found) { + final String finalSuggestion = foundSuggestion; + dialogsHintCellVisible = true; + dialogsHintCell.setVisibility(View.VISIBLE); + dialogsHintCell.setCompact(false); + dialogsHintCell.setOnClickListener(v -> { + if (ApplicationLoader.applicationLoaderInstance != null) { + ApplicationLoader.applicationLoaderInstance.onSuggestionClick(finalSuggestion); } - updateAuthHintCellVisibility(false); - } else { - dialogsHintCellVisible = false; - dialogsHintCell.setVisibility(View.GONE); - updateAuthHintCellVisibility(false); + }); + dialogsHintCell.setText( + output[0] instanceof String ? AndroidUtilities.replaceSingleTag( + output[0].toString(), + Theme.key_windowBackgroundWhiteValueText, + AndroidUtilities.REPLACING_TAG_TYPE_LINKBOLD, + null + ) : output[0], + output[1] instanceof String ? AndroidUtilities.replaceTags(output[1].toString()) : output[1] + ); + if (closeable[0] && finalSuggestion != null) { + dialogsHintCell.setOnCloseListener(v -> { + AndroidUtilities.runOnUIThread(() -> { + MessagesController.getInstance(currentAccount).removeSuggestion(0, finalSuggestion); + updateDialogsHint(); + }, 250); + }); } + updateAuthHintCellVisibility(false); } else { dialogsHintCellVisible = false; dialogsHintCell.setVisibility(View.GONE); updateAuthHintCellVisibility(false); } + } else { + dialogsHintCellVisible = false; + dialogsHintCell.setVisibility(View.GONE); + updateAuthHintCellVisibility(false); } } @@ -6631,9 +6713,10 @@ private void updateFilterTabs(boolean force, boolean animated) { filterTabsView.removeTabs(); for (int a = 0, N = filters.size(); a < N; a++) { if (filters.get(a).isDefault()) { - filterTabsView.addTab(a, 0, LocaleController.getString(R.string.FilterAllChats), true, filters.get(a).locked); + filterTabsView.addTab(a, 0, LocaleController.getString(R.string.FilterAllChats), null, false, true, filters.get(a).locked); } else { - filterTabsView.addTab(a, filters.get(a).localId, filters.get(a).name, false, filters.get(a).locked); + final MessagesController.DialogFilter filter = filters.get(a); + filterTabsView.addTab(a, filter.localId, filter.name, filter.entities, filter.title_noanimate, false, filters.get(a).locked); } } if (stableId >= 0) { @@ -8273,7 +8356,9 @@ private boolean onItemLongClick(RecyclerListView listView, View view, int positi } private void onArchiveLongPress(View view) { - view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} BottomSheet.Builder builder = new BottomSheet.Builder(getParentActivity()); final boolean hasUnread = getMessagesStorage().getArchiveUnreadCount() != 0; @@ -8389,7 +8474,12 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { } ActionBarMenuSubItem folderItem = lastItem = new ActionBarMenuSubItem(getParentActivity(), 2, !backButtonAtTop && linearLayout.getChildCount() == 0, false, null); folderItem.setChecked(contains); - folderItem.setTextAndIcon(Emoji.replaceEmoji(folder.name, null, false), 0, new FolderDrawable(getContext(), R.drawable.msg_folders, folder.color)); + CharSequence title = folder.name; + title = Emoji.replaceEmoji(title, folderItem.getTextView().getPaint().getFontMetricsInt(), false); + title = MessageObject.replaceAnimatedEmoji(title, folder.entities, folderItem.getTextView().getPaint().getFontMetricsInt()); + folderItem.setEmojiCacheType(folder.title_noanimate ? AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER : AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES); + folderItem.setTextAndIcon(title, 0, new FolderDrawable(getContext(), R.drawable.msg_folders, folder.color)); + folderItem.getTextView().setEmojiColor(Theme.getColor(Theme.key_featuredStickers_addButton, resourceProvider)); folderItem.setMinimumWidth(160); folderItem.setOnClickListener(e -> { if (!contains) { @@ -8398,13 +8488,13 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { folder.neverShow.remove(alwaysShow.get(a)); } folder.alwaysShow.addAll(alwaysShow); - FilterCreateActivity.saveFilterToServer(folder, folder.flags, folder.name, folder.color, folder.alwaysShow, folder.neverShow, folder.pinnedDialogs, false, false, true, true, false, DialogsActivity.this, null); + FilterCreateActivity.saveFilterToServer(folder, folder.flags, folder.name, folder.entities, folder.title_noanimate, folder.color, folder.alwaysShow, folder.neverShow, folder.pinnedDialogs, false, false, true, true, false, DialogsActivity.this, null); } getUndoView().showWithAction(dialogId, UndoView.ACTION_ADDED_TO_FOLDER, alwaysShow.size(), folder, null, null); } else { folder.alwaysShow.remove(dialogId); folder.neverShow.add(dialogId); - FilterCreateActivity.saveFilterToServer(folder, folder.flags, folder.name, folder.color, folder.alwaysShow, folder.neverShow, folder.pinnedDialogs, false, false, true, true, false, DialogsActivity.this, null); + FilterCreateActivity.saveFilterToServer(folder, folder.flags, folder.name, folder.entities, folder.title_noanimate, folder.color, folder.alwaysShow, folder.neverShow, folder.pinnedDialogs, false, false, true, true, false, DialogsActivity.this, null); getUndoView().showWithAction(dialogId, UndoView.ACTION_REMOVED_FROM_FOLDER, alwaysShow.size(), folder, null, null); } hideActionMode(true); @@ -8590,7 +8680,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { undoView.showWithAction(0, UndoView.ACTION_UNPIN_DIALOGS, 1, 1600, null, null); } if (filter != null) { - FilterCreateActivity.saveFilterToServer(filter, filter.flags, filter.name, filter.color, filter.alwaysShow, filter.neverShow, filter.pinnedDialogs, false, false, true, true, false, DialogsActivity.this, null); + FilterCreateActivity.saveFilterToServer(filter, filter.flags, filter.name, filter.entities, filter.title_noanimate, filter.color, filter.alwaysShow, filter.neverShow, filter.pinnedDialogs, false, false, true, true, false, DialogsActivity.this, null); } getMessagesController().reorderPinnedDialogs(folderId, null, 0); updateCounters(true); @@ -8788,8 +8878,7 @@ public void onTransitionAnimationEnd(boolean isOpen, boolean backward) { if (isOpen && afterSignup) { try { fragmentView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} if (getParentActivity() instanceof LaunchActivity) { ((LaunchActivity) getParentActivity()).getFireworksOverlay().start(); } @@ -8883,7 +8972,7 @@ public void onAnimationEnd(Animator animation) { if (!movingDialogFilters.isEmpty()) { for (int a = 0, N = movingDialogFilters.size(); a < N; a++) { MessagesController.DialogFilter filter = movingDialogFilters.get(a); - FilterCreateActivity.saveFilterToServer(filter, filter.flags, filter.name, filter.color, filter.alwaysShow, filter.neverShow, filter.pinnedDialogs, false, false, true, true, false, DialogsActivity.this, null); + FilterCreateActivity.saveFilterToServer(filter, filter.flags, filter.name, filter.entities, filter.title_noanimate, filter.color, filter.alwaysShow, filter.neverShow, filter.pinnedDialogs, false, false, true, true, false, DialogsActivity.this, null); } movingDialogFilters.clear(); } @@ -9295,7 +9384,7 @@ private void performSelectedDialogsAction(ArrayList selectedDialogs, int a } if (action == pin || action == pin2) { if (filter != null) { - FilterCreateActivity.saveFilterToServer(filter, filter.flags, filter.name, filter.color, filter.alwaysShow, filter.neverShow, filter.pinnedDialogs, false, false, true, true, false, DialogsActivity.this, null); + FilterCreateActivity.saveFilterToServer(filter, filter.flags, filter.name, filter.entities, filter.title_noanimate, filter.color, filter.alwaysShow, filter.neverShow, filter.pinnedDialogs, false, false, true, true, false, DialogsActivity.this, null); } else { getMessagesController().reorderPinnedDialogs(folderId, null, 0); } @@ -9708,7 +9797,7 @@ private void updateCounters(boolean hide) { } } if (addToFolderItem != null) { - if (filterTabsView != null && filterTabsView.getVisibility() == View.VISIBLE && filterTabsView.currentTabIsDefault() && !FiltersListBottomSheet.getCanAddDialogFilters(this, selectedDialogs).isEmpty()) { + if (folderId == 1 || filterTabsView != null && filterTabsView.getVisibility() == View.VISIBLE && filterTabsView.currentTabIsDefault() && !FiltersListBottomSheet.getCanAddDialogFilters(this, selectedDialogs).isEmpty()) { addToFolderItem.setVisibility(View.VISIBLE); } else { addToFolderItem.setVisibility(View.GONE); @@ -10833,6 +10922,7 @@ public DialogsHeader(int type) { public static final int DIALOGS_TYPE_IMPORT_HISTORY = 13; public static final int DIALOGS_TYPE_START_ATTACH_BOT = 14; public static final int DIALOGS_TYPE_BOT_REQUEST_PEER = 15; + public static final int DIALOGS_TYPE_BOT_SELECT_VERIFY = 16; private ArrayList botShareDialogs; @@ -10892,37 +10982,39 @@ public ArrayList getDialogsArray(int currentAccount, int dialogsTy } } else if (dialogsType == DIALOGS_TYPE_BLOCK) { return messagesController.dialogsForBlock; - } else if (dialogsType == DIALOGS_TYPE_BOT_SHARE || dialogsType == DIALOGS_TYPE_START_ATTACH_BOT) { + } else if (dialogsType == DIALOGS_TYPE_BOT_SHARE || dialogsType == DIALOGS_TYPE_BOT_SELECT_VERIFY || dialogsType == DIALOGS_TYPE_START_ATTACH_BOT) { if (botShareDialogs != null) { return botShareDialogs; } botShareDialogs = new ArrayList<>(); - if (allowUsers || allowBots) { + boolean allowSuper = dialogsType == DIALOGS_TYPE_BOT_SELECT_VERIFY; + if (allowUsers || allowBots || allowSuper) { for (TLRPC.Dialog d : messagesController.dialogsUsersOnly) { TLRPC.User user = messagesController.getUser(d.id); - if (user != null && !UserObject.isUserSelf(user) && (user.bot ? allowBots : allowUsers)) { + if (user != null && !UserObject.isDeleted(user) && (allowSuper ? !UserObject.isService(user.id) && !MessagesController.isSupportUser(user) : (user.bot ? allowBots : allowUsers) && !UserObject.isUserSelf(user))) { botShareDialogs.add(d); } } } - if (allowGroups || (allowLegacyGroups && allowMegagroups)) { + if (allowGroups || (allowLegacyGroups && allowMegagroups) || allowSuper) { for (TLRPC.Dialog d : messagesController.dialogsGroupsOnly) { TLRPC.Chat chat = messagesController.getChat(-d.id); - if (chat != null && !ChatObject.isChannelAndNotMegaGroup(chat) && messagesController.canAddToForward(d)) { + if (chat != null && !ChatObject.isChannelAndNotMegaGroup(chat) && (allowSuper ? ChatObject.isMegagroup(chat) : messagesController.canAddToForward(d))) { botShareDialogs.add(d); } } - } else if (allowLegacyGroups || allowMegagroups) { + } else if (allowLegacyGroups || allowMegagroups || allowSuper) { for (TLRPC.Dialog d : messagesController.dialogsGroupsOnly) { TLRPC.Chat chat = messagesController.getChat(-d.id); - if (chat != null && !ChatObject.isChannelAndNotMegaGroup(chat) && messagesController.canAddToForward(d) && (allowLegacyGroups && !ChatObject.isMegagroup(chat) || allowMegagroups && ChatObject.isMegagroup(chat))) { + if (chat != null && !ChatObject.isChannelAndNotMegaGroup(chat) && (allowSuper ? ChatObject.isMegagroup(chat) : messagesController.canAddToForward(d) && (allowLegacyGroups && !ChatObject.isMegagroup(chat) || allowMegagroups && ChatObject.isMegagroup(chat)))) { botShareDialogs.add(d); } } } - if (allowChannels) { + if (allowChannels || allowSuper) { for (TLRPC.Dialog d : messagesController.dialogsChannelsOnly) { - if (messagesController.canAddToForward(d)) { + TLRPC.Chat chat = messagesController.getChat(-d.id); + if (allowSuper ? chat instanceof TLRPC.TL_channel : messagesController.canAddToForward(d)) { botShareDialogs.add(d); } } @@ -11320,7 +11412,10 @@ public void setInitialSearchType(int type) { } private boolean checkCanWrite(final long dialogId) { - if (addToGroupAlertString == null && initialDialogsType != DIALOGS_TYPE_BOT_REQUEST_PEER && checkCanWrite) { + if (initialDialogsType == DIALOGS_TYPE_BOT_REQUEST_PEER || initialDialogsType == DIALOGS_TYPE_BOT_SELECT_VERIFY) { + return true; + } + if (addToGroupAlertString == null && checkCanWrite) { if (DialogObject.isChatDialog(dialogId)) { TLRPC.Chat chat = getMessagesController().getChat(-dialogId); if (ChatObject.isChannel(chat) && !chat.megagroup && ((cantSendToChannels || !ChatObject.isCanWriteToChannel(-dialogId, currentAccount)) || hasPoll == 2)) { @@ -11686,7 +11781,9 @@ public void didSelectDate(boolean notify, int scheduleDate) { int y = location[1] - layout.getMeasuredHeight() - dp(2); sendPopupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, location[0] + view.getMeasuredWidth() - layout.getMeasuredWidth() + dp(8), y); sendPopupWindow.dimBehind(); - view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} return false; } @@ -12914,12 +13011,7 @@ public long getSearchForumDialogId() { } }); searchViewPager.botsSearchListView.setOnItemClickListener((view, position, x, y) -> { - Object obj = searchViewPager.botsSearchAdapter.getTopPeerObject(position); - if (obj instanceof TLRPC.User) { - getMessagesController().openApp((TLRPC.User) obj, getClassGuid()); - return; - } - obj = searchViewPager.botsSearchAdapter.getObject(position); + Object obj = searchViewPager.botsSearchAdapter.getObject(position); if (obj instanceof TLRPC.User) { presentFragment(ProfileActivity.of(((TLRPC.User) obj).id)); } else if (obj instanceof MessageObject) { @@ -13016,4 +13108,212 @@ public boolean clickSelectsDialog() { return initialDialogsType == DIALOGS_TYPE_WIDGET; } + private ImageUpdater imageUpdater; + private int avatarUploadingRequest; + private TLRPC.FileLocation avatar; + private TLRPC.FileLocation avatarBig; + private ImageLocation uploadingImageLocation; + private Bulletin uploadingAvatarBulletin; + + public void openSetAvatar() { + if (imageUpdater == null) { + imageUpdater = new ImageUpdater(true, ImageUpdater.FOR_TYPE_USER, true); + imageUpdater.setOpenWithFrontfaceCamera(true); + imageUpdater.parentFragment = this; + imageUpdater.setDelegate(new ImageUpdater.ImageUpdaterDelegate() { + @Override + public void didStartUpload(boolean fromAvatarConstructor, boolean isVideo) { + if (uploadingAvatarBulletin != null) { + uploadingAvatarBulletin.hide(); + uploadingAvatarBulletin = null; + } + final Bulletin.ProgressLayout bulletinLayout = new Bulletin.ProgressLayout(getContext(), resourceProvider); + if (fromAvatarConstructor) { + bulletinLayout.imageView.setImageBitmap(imageUpdater.getPreviewBitmap()); + } else { + bulletinLayout.imageView.setImageBitmap(PhotoViewer.getInstance().centerImage.getBitmap()); + } + bulletinLayout.setButton(new Bulletin.UndoButton(getContext(), true, resourceProvider).setText(getString(R.string.ViewAction)).setUndoAction(this::openAvatarInProfile)); + bulletinLayout.getButton().setVisibility(View.GONE); + bulletinLayout.textView.setText(getString(isVideo ? R.string.YourProfileVideoUploading : R.string.YourProfilePhotoUploading), true); + uploadingAvatarBulletin = BulletinFactory.of(DialogsActivity.this).create(bulletinLayout, -1); + uploadingAvatarBulletin.hideAfterBottomSheet = false; + uploadingAvatarBulletin.setCanHide(false); + uploadingAvatarBulletin.skipShowAnimation(); + uploadingAvatarBulletin.show(); + } + + private void openAvatarInProfile() { + Bundle args = new Bundle(); + args.putLong("user_id", UserConfig.getInstance(currentAccount).getClientUserId()); + args.putBoolean("my_profile", true); + presentFragment(new ProfileActivity(args, null)); + } + + @Override + public PhotoViewer.PlaceProviderObject getCloseIntoObject() { + if (uploadingAvatarBulletin != null) { + final Bulletin.ProgressLayout layout = (Bulletin.ProgressLayout) uploadingAvatarBulletin.getLayout(); + PhotoViewer.PlaceProviderObject object = new PhotoViewer.PlaceProviderObject(); + int[] coords = new int[2]; + layout.imageView.getLocationInWindow(coords); + object.viewX = coords[0]; + object.viewY = coords[1]; + object.parentView = fragmentView; + object.imageReceiver = layout.imageView.getImageReceiver(); + object.thumb = object.imageReceiver.getBitmapSafe(); + object.clipBottomAddition = 0; + object.radius = object.imageReceiver.getRoundRadius(); + object.scale = layout.imageView.getScaleX(); + return object; + } + return null; + } + + @Override + public boolean supportsBulletin() { + return true; + } + + @Override + public void onUploadProgressChanged(float progress) { + if (uploadingAvatarBulletin != null) { + final Bulletin.ProgressLayout layout = (Bulletin.ProgressLayout) uploadingAvatarBulletin.getLayout(); + layout.setProgress(0.9f * progress); + } + } + + @Override + public void didUploadPhoto(TLRPC.InputFile photo, TLRPC.InputFile video, double videoStartTimestamp, String videoPath, TLRPC.PhotoSize bigSize, TLRPC.PhotoSize smallSize, boolean isVideo, TLRPC.VideoSize emojiMarkup) { + AndroidUtilities.runOnUIThread(() -> { + if (photo != null || video != null || emojiMarkup != null) { + if (avatar == null) { + return; + } + final TLRPC.TL_photos_uploadProfilePhoto req = new TLRPC.TL_photos_uploadProfilePhoto(); + if (photo != null) { + req.file = photo; + req.flags |= 1; + } + if (video != null) { + req.video = video; + req.flags |= 2; + req.video_start_ts = videoStartTimestamp; + req.flags |= 4; + } + if (emojiMarkup != null) { + req.video_emoji_markup = emojiMarkup; + req.flags |= 16; + } + avatarUploadingRequest = getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { + if (error == null) { + TLRPC.User user = getMessagesController().getUser(getUserConfig().getClientUserId()); + if (user == null) { + user = getUserConfig().getCurrentUser(); + if (user == null) { + return; + } + getMessagesController().putUser(user, false); + } else { + getUserConfig().setCurrentUser(user); + } + + final TLRPC.TL_photos_photo photos_photo = (TLRPC.TL_photos_photo) response; + ArrayList sizes = photos_photo.photo.sizes; + TLRPC.PhotoSize small = FileLoader.getClosestPhotoSizeWithSize(sizes, 150); + TLRPC.PhotoSize big = FileLoader.getClosestPhotoSizeWithSize(sizes, 800); + TLRPC.VideoSize videoSize = photos_photo.photo.video_sizes.isEmpty() ? null : FileLoader.getClosestVideoSizeWithSize(photos_photo.photo.video_sizes, 1000); + user.photo = new TLRPC.TL_userProfilePhoto(); + user.photo.photo_id = photos_photo.photo.id; + if (small != null) { + user.photo.photo_small = small.location; + } + if (big != null) { + user.photo.photo_big = big.location; + } + + if (small != null && avatar != null) { + final File destFile = FileLoader.getInstance(currentAccount).getPathToAttach(small, true); + final File src = FileLoader.getInstance(currentAccount).getPathToAttach(avatar, true); + src.renameTo(destFile); + final String oldKey = avatar.volume_id + "_" + avatar.local_id + "@50_50"; + final String newKey = small.location.volume_id + "_" + small.location.local_id + "@50_50"; + ImageLoader.getInstance().replaceImageInCache(oldKey, newKey, ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), false); + } + + if (videoSize != null && videoPath != null) { + final File destFile = FileLoader.getInstance(currentAccount).getPathToAttach(videoSize, "mp4", true); + final File src = new File(videoPath); + src.renameTo(destFile); + } else if (big != null && avatarBig != null) { + final File destFile = FileLoader.getInstance(currentAccount).getPathToAttach(big, true); + final File src = FileLoader.getInstance(currentAccount).getPathToAttach(avatarBig, true); + src.renameTo(destFile); + } + getMessagesController().getDialogPhotos(user.id).addPhotoAtStart(((TLRPC.TL_photos_photo) response).photo); + final ArrayList users = new ArrayList<>(); + users.add(user); + getMessagesStorage().putUsersAndChats(users, null, false, true); + final TLRPC.UserFull userFull = getMessagesController().getUserFull(getUserConfig().getClientUserId()); + if (userFull != null) { + userFull.profile_photo = photos_photo.photo; + getMessagesStorage().updateUserInfo(userFull, false); + } + } + + avatar = null; + avatarBig = null; + getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_ALL); + getNotificationCenter().postNotificationName(NotificationCenter.mainUserInfoChanged); + getUserConfig().saveConfig(true); + + MessagesController.getInstance(currentAccount).removeSuggestion(0, "USERPIC_SETUP"); + TransitionManager.beginDelayedTransition((ViewGroup) dialogsHintCell.getParent(), new ChangeBounds().setDuration(200)); + updateDialogsHint(); + + if (uploadingAvatarBulletin != null) { + final Bulletin.ProgressLayout layout = (Bulletin.ProgressLayout) uploadingAvatarBulletin.getLayout(); + layout.textView.setText(getString(isVideo ? R.string.YourProfileVideoDone : R.string.YourProfilePhotoDone), true); + layout.setProgress(1.0f); + final View button = layout.getButton(); + button.setScaleX(0.6f); + button.setScaleY(0.6f); + button.setAlpha(0.0f); + button.setVisibility(View.VISIBLE); + button.animate().scaleX(1.0f).scaleY(1.0f).alpha(1.0f).setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT).setDuration(360).start(); + uploadingAvatarBulletin.setDuration(Bulletin.DURATION_PROLONG); + uploadingAvatarBulletin.setCanHide(false); + uploadingAvatarBulletin.setCanHide(true); + } + })); + } else { + avatar = smallSize.location; + avatarBig = bigSize.location; + } + actionBar.createMenu().requestLayout(); + }); + } + }); + getMediaDataController().checkFeaturedStickers(); + getMessagesController().loadSuggestedFilters(); + getMessagesController().loadUserInfo(getUserConfig().getCurrentUser(), true, classGuid); + } + TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId()); + if (user == null) { + user = UserConfig.getInstance(currentAccount).getCurrentUser(); + } + if (user == null) { + return; + } + imageUpdater.updateColors(); + imageUpdater.openMenu(user.photo != null && user.photo.photo_big != null && !(user.photo instanceof TLRPC.TL_userProfilePhotoEmpty), () -> { + MessagesController.getInstance(currentAccount).deleteUserPhoto(null); + }, dialog -> { + if (imageUpdater.isUploadingImage()) { + MessagesController.getInstance(currentAccount).removeSuggestion(0, "USERPIC_SETUP"); + TransitionManager.beginDelayedTransition((ViewGroup) dialogsHintCell.getParent(), new ChangeBounds().setDuration(200)); + updateDialogsHint(); + } + }, 0); + } } \ No newline at end of file diff --git a/TMessagesProj/src/main/java/org/telegram/ui/EmojiAnimationsOverlay.java b/TMessagesProj/src/main/java/org/telegram/ui/EmojiAnimationsOverlay.java index fe1fd49f12..a1767fe737 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/EmojiAnimationsOverlay.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/EmojiAnimationsOverlay.java @@ -259,7 +259,9 @@ private void findViewAndShowAnimation(int messageId, int animation) { if (bestView != null && chatActivity != null) { chatActivity.restartSticker(bestView); if (!EmojiData.hasEmojiSupportVibration(bestView.getMessageObject().getStickerEmoji()) && !bestView.getMessageObject().isPremiumSticker() && !bestView.getMessageObject().isAnimatedAnimatedEmoji()) { - bestView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + bestView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} } showAnimationForCell(bestView, animation, false, true); } @@ -430,7 +432,9 @@ public boolean onTapItem(ChatMessageCell view, ChatActivity chatActivity, boolea boolean show = showAnimationForCell(view, -1, userTapped, false); if (userTapped && show && !EmojiData.hasEmojiSupportVibration(view.getMessageObject().getStickerEmoji()) && !view.getMessageObject().isPremiumSticker() && !view.getMessageObject().isAnimatedAnimatedEmoji()) { - view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} } if (view.getMessageObject().isPremiumSticker() || view.getEffect() != null || (!userTapped && view.getMessageObject().isAnimatedEmojiStickerSingle())) { view.getMessageObject().forcePlayEffect = false; @@ -746,8 +750,10 @@ public void didSetImage(ImageReceiver imageReceiver, boolean set, boolean thumb, @Override public void onAnimationReady(ImageReceiver imageReceiver) { - if (sendTap && messageObject.isAnimatedAnimatedEmoji() && imageReceiver.getLottieAnimation() != null && !imageReceiver.getLottieAnimation().hasVibrationPattern()) { - contentLayout.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); + if (sendTap && messageObject != null && messageObject.isAnimatedAnimatedEmoji() && imageReceiver.getLottieAnimation() != null && !imageReceiver.getLottieAnimation().hasVibrationPattern()) { + try { + contentLayout.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); + } catch (Exception ignored) {} } } }); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ExternalActionActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ExternalActionActivity.java index dd82a4d050..d2b77038ac 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ExternalActionActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ExternalActionActivity.java @@ -35,7 +35,7 @@ import org.telegram.messenger.SharedConfig; import org.telegram.messenger.UserConfig; import org.telegram.tgnet.ConnectionsManager; -import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.DrawerLayoutContainer; @@ -311,7 +311,7 @@ protected boolean handleIntent(final Intent intent, final boolean isNew, final b final long bot_id = intent.getLongExtra("bot_id", intent.getIntExtra("bot_id", 0)); final String nonce = intent.getStringExtra("nonce"); final String payload = intent.getStringExtra("payload"); - final TLRPC.TL_account_getAuthorizationForm req = new TLRPC.TL_account_getAuthorizationForm(); + final TL_account.getAuthorizationForm req = new TL_account.getAuthorizationForm(); req.bot_id = bot_id; req.scope = intent.getStringExtra("scope"); req.public_key = intent.getStringExtra("public_key"); @@ -328,9 +328,9 @@ protected boolean handleIntent(final Intent intent, final boolean isNew, final b progressDialog.show(); requestId[0] = ConnectionsManager.getInstance(intentAccount).sendRequest(req, (response, error) -> { - final TLRPC.TL_account_authorizationForm authorizationForm = (TLRPC.TL_account_authorizationForm) response; + final TL_account.authorizationForm authorizationForm = (TL_account.authorizationForm) response; if (authorizationForm != null) { - TLRPC.TL_account_getPassword req2 = new TLRPC.TL_account_getPassword(); + TL_account.getPassword req2 = new TL_account.getPassword(); requestId[0] = ConnectionsManager.getInstance(intentAccount).sendRequest(req2, (response1, error1) -> AndroidUtilities.runOnUIThread(() -> { try { progressDialog.dismiss(); @@ -338,7 +338,7 @@ protected boolean handleIntent(final Intent intent, final boolean isNew, final b FileLog.e(e); } if (response1 != null) { - TLRPC.account_Password accountPassword = (TLRPC.account_Password) response1; + TL_account.Password accountPassword = (TL_account.Password) response1; MessagesController.getInstance(intentAccount).putUsers(authorizationForm.users, false); PassportActivity fragment = new PassportActivity(PassportActivity.TYPE_PASSWORD, req.bot_id, req.scope, req.public_key, payload, nonce, null, authorizationForm, accountPassword); fragment.setNeedActivityResult(true); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/FastSpannableStringBuilder.java b/TMessagesProj/src/main/java/org/telegram/ui/FastSpannableStringBuilder.java new file mode 100644 index 0000000000..449b533f1d --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/FastSpannableStringBuilder.java @@ -0,0 +1,4 @@ +package org.telegram.ui; + +public class FastSpannableStringBuilder { +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/FilterChatlistActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/FilterChatlistActivity.java index c4cc52d66e..0a3c846a9f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/FilterChatlistActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/FilterChatlistActivity.java @@ -52,8 +52,10 @@ import org.telegram.messenger.BotWebViewVibrationEffect; import org.telegram.messenger.ChatObject; import org.telegram.messenger.DialogObject; +import org.telegram.messenger.Emoji; import org.telegram.messenger.FileLog; import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MessageObject; import org.telegram.messenger.MessagesController; import org.telegram.messenger.R; import org.telegram.messenger.UserObject; @@ -73,6 +75,7 @@ import org.telegram.ui.Cells.DialogCell; import org.telegram.ui.Cells.GroupCreateUserCell; import org.telegram.ui.Cells.TextInfoPrivacyCell; +import org.telegram.ui.Components.AnimatedEmojiDrawable; import org.telegram.ui.Components.Bulletin; import org.telegram.ui.Components.BulletinFactory; import org.telegram.ui.Components.CircularProgressDrawable; @@ -87,6 +90,7 @@ import org.telegram.ui.Components.RLottieImageView; import org.telegram.ui.Components.RecyclerListView; import org.telegram.ui.Components.TextStyleSpan; +import org.telegram.ui.Components.spoilers.SpoilersTextView; import java.util.ArrayList; @@ -410,9 +414,13 @@ private void updateHintCell(boolean animated) { } if (invite == null) { - hintCountCell.setText(LocaleController.getString(R.string.FilterInviteHeaderNo), animated); + hintCountCell.setText(LocaleController.getString(R.string.FilterInviteHeaderNo), false); } else { - hintCountCell.setText(AndroidUtilities.replaceTags(LocaleController.formatPluralString("FilterInviteHeader", selectedPeers.size(), filter.name)), animated); + final Paint.FontMetricsInt fontMetricsInt = hintCountCell.getSubtitleTextView().getPaint().getFontMetricsInt(); + CharSequence name = filter.name; + name = Emoji.replaceEmoji(name, fontMetricsInt, false); + name = MessageObject.replaceAnimatedEmoji(name, filter.entities, fontMetricsInt); + hintCountCell.setText(AndroidUtilities.replaceTags(LocaleController.formatPluralSpannable("FilterInviteHeader", selectedPeers.size(), name)), filter.title_noanimate); } } @@ -580,7 +588,9 @@ public void afterTextChanged(Editable s) { ignoreTextChange = true; s.delete(MAX_NAME_LENGTH, s.length()); AndroidUtilities.shakeView(editText); - editText.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + editText.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} ignoreTextChange = false; } } @@ -789,7 +799,7 @@ public void onPause() { public static class HintInnerCell extends FrameLayout { private RLottieImageView imageView; - private TextView subtitleTextView; + private SpoilersTextView subtitleTextView; public HintInnerCell(Context context, int resId) { super(context); @@ -801,7 +811,7 @@ public HintInnerCell(Context context, int resId) { imageView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); addView(imageView, LayoutHelper.createFrame(90, 90, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 14, 0, 0)); - subtitleTextView = new TextView(context); + subtitleTextView = new SpoilersTextView(context); subtitleTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText4)); subtitleTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); subtitleTextView.setGravity(Gravity.CENTER); @@ -809,8 +819,13 @@ public HintInnerCell(Context context, int resId) { addView(subtitleTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 40, 121, 40, 24)); } - public void setText(CharSequence text, boolean animated) { + public void setText(CharSequence text, boolean noanimate) { subtitleTextView.setText(text); + subtitleTextView.cacheType = noanimate ? AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER : AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES; + } + + public SpoilersTextView getSubtitleTextView() { + return subtitleTextView; } @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/FilterCreateActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/FilterCreateActivity.java index 78e56398e8..be907591e0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/FilterCreateActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/FilterCreateActivity.java @@ -53,6 +53,7 @@ import org.telegram.messenger.Emoji; import org.telegram.messenger.FileLog; import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MessageObject; import org.telegram.messenger.MessagesController; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; @@ -65,23 +66,27 @@ import org.telegram.ui.ActionBar.ActionBarMenuItem; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; -import org.telegram.ui.ActionBar.SimpleTextView; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.ActionBar.ThemeDescription; +import org.telegram.ui.Cells.EditEmojiTextCell; import org.telegram.ui.Cells.HeaderCell; -import org.telegram.ui.Cells.PollEditTextCell; import org.telegram.ui.Cells.ShadowSectionCell; import org.telegram.ui.Cells.TextCell; import org.telegram.ui.Cells.TextInfoPrivacyCell; import org.telegram.ui.Cells.UserCell; import org.telegram.ui.Components.AnimatedColor; +import org.telegram.ui.Components.AnimatedEmojiDrawable; +import org.telegram.ui.Components.AnimatedEmojiSpan; import org.telegram.ui.Components.AnimatedTextView; import org.telegram.ui.Components.BottomSheetWithRecyclerListView; import org.telegram.ui.Components.Bulletin; import org.telegram.ui.Components.BulletinFactory; import org.telegram.ui.Components.CombinedDrawable; import org.telegram.ui.Components.CubicBezierInterpolator; -import org.telegram.ui.Components.EditTextBoldCursor; +import org.telegram.ui.Components.EditTextCaption; +import org.telegram.ui.Components.EditTextEmoji; +import org.telegram.ui.Components.EditTextSuggestionsFix; +import org.telegram.ui.Components.EmojiView; import org.telegram.ui.Components.FolderBottomSheet; import org.telegram.ui.Components.HintView; import org.telegram.ui.Components.ItemOptions; @@ -92,7 +97,10 @@ import org.telegram.ui.Components.QRCodeBottomSheet; import org.telegram.ui.Components.RLottieImageView; import org.telegram.ui.Components.RecyclerListView; +import org.telegram.ui.Components.ScaleStateListAnimator; +import org.telegram.ui.Components.SizeNotifierFrameLayout; import org.telegram.ui.Components.UndoView; +import org.telegram.ui.Components.spoilers.SpoilersTextView; import java.util.ArrayList; import java.util.Collections; @@ -115,7 +123,8 @@ public class FilterCreateActivity extends BaseFragment { private MessagesController.DialogFilter filter; private boolean creatingNew; private boolean doNotCloseWhenSave; - private String newFilterName; + private CharSequence newFilterName; + private boolean newFilterAnimations = true; private int newFilterFlags; private int newFilterColor; private ArrayList newAlwaysShow; @@ -123,6 +132,9 @@ public class FilterCreateActivity extends BaseFragment { private LongSparseIntArray newPinned; private CreateLinkCell createLinkCell; private HeaderCellColorPreview folderTagsHeader; + private HeaderCellWithRight nameHeaderCell; + + private EditEmojiTextCell nameEditTextCell; private boolean canCreateLink() { return ( @@ -187,7 +199,13 @@ public FilterCreateActivity(MessagesController.DialogFilter dialogFilter, ArrayL filter.color = (int) (Math.random() * 8); creatingNew = true; } - newFilterName = filter.name; + TextPaint paint = new TextPaint(Paint.ANTI_ALIAS_FLAG); + paint.setTextSize(dp(17)); + newFilterName = new SpannableStringBuilder(filter.name); + newFilterName = Emoji.replaceEmoji(newFilterName, paint.getFontMetricsInt(), false); + newFilterName = MessageObject.replaceAnimatedEmoji(newFilterName, filter.entities, paint.getFontMetricsInt()); + newFilterAnimations = !filter.title_noanimate; + AnimatedEmojiDrawable.toggleAnimations(currentAccount, newFilterAnimations); newFilterFlags = filter.flags; newFilterColor = filter.color; newAlwaysShow = new ArrayList<>(filter.alwaysShow); @@ -253,8 +271,23 @@ private void updateRows(boolean animated) { oldItems.addAll(items); items.clear(); + items.add(ItemInner.asAnimatedHeader(LocaleController.getString(R.string.FilterNameHeader), hasAnimatedEmojis(newFilterName) ? LocaleController.getString(newFilterAnimations ? R.string.FilterNameAnimationsDisable : R.string.FilterNameAnimationsEnable) : null, v -> { + newFilterAnimations = !newFilterAnimations; + if (nameHeaderCell != null) { + nameHeaderCell.rightTextView.setText(hasAnimatedEmojis(newFilterName) ? LocaleController.getString(newFilterAnimations ? R.string.FilterNameAnimationsDisable : R.string.FilterNameAnimationsEnable) : null); + } + AnimatedEmojiDrawable.toggleAnimations(currentAccount, newFilterAnimations); + checkDoneButton(true); - items.add(new ItemInner(VIEW_TYPE_HINT, false)); + if (actionBar != null) { + if (actionBar.getTitleTextView() != null) { + actionBar.getTitleTextView().setEmojiCacheType(newFilterAnimations ? AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES : AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER); + } + if (actionBar.getTitleTextView2() != null) { + actionBar.getTitleTextView2().setEmojiCacheType(newFilterAnimations ? AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES : AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER); + } + } + })); nameRow = items.size(); items.add(ItemInner.asEdit()); items.add(ItemInner.asShadow(null)); @@ -370,9 +403,20 @@ public View createView(Context context) { if (creatingNew) { actionBar.setTitle(LocaleController.getString(R.string.FilterNew)); } else { - TextPaint paint = new TextPaint(Paint.ANTI_ALIAS_FLAG); - paint.setTextSize(dp(20)); - actionBar.setTitle(Emoji.replaceEmoji(filter.name, paint.getFontMetricsInt(), dp(20), false)); + Paint.FontMetricsInt fontMetricsInt = actionBar.getTitleFontMetricsInt(); + CharSequence title = filter.name; + title = Emoji.replaceEmoji(title, fontMetricsInt, false); + title = MessageObject.replaceAnimatedEmoji(title, filter.entities, fontMetricsInt); + actionBar.setTitle(title); + + if (actionBar != null) { + if (actionBar.getTitleTextView() != null) { + actionBar.getTitleTextView().setEmojiCacheType(newFilterAnimations ? AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES : AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER); + } + if (actionBar.getTitleTextView2() != null) { + actionBar.getTitleTextView2().setEmojiCacheType(newFilterAnimations ? AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES : AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER); + } + } } actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { @Override @@ -388,7 +432,95 @@ public void onItemClick(int id) { }); doneItem = menu.addItem(done_button, LocaleController.getString(R.string.Save).toUpperCase()); - fragmentView = new FrameLayout(context); + fragmentView = new SizeNotifierFrameLayout(context) { + @Override + public void addView(View child) { + if (child instanceof EmojiView) { + ViewGroup.LayoutParams lp = ((EmojiView) child).getLayoutParams(); + if (lp == null) { + lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + } + if (lp instanceof FrameLayout.LayoutParams) { + ((LayoutParams) lp).gravity = Gravity.BOTTOM | Gravity.FILL_HORIZONTAL; + } + child.setLayoutParams(lp); + } + super.addView(child); + } + + @Override + protected void onLayout(boolean changed, int l, int t, int r, int b) {final int count = getChildCount(); + + int keyboardSize = measureKeyboardHeight(); + final int parentLeft = getPaddingLeft(); + final int parentRight = r - l - getPaddingRight(); + + final int parentTop = getPaddingTop(); + final int parentBottom = b - t - getPaddingBottom(); + + for (int i = 0; i < count; i++) { + final View child = getChildAt(i); + if (child.getVisibility() != GONE) { + final LayoutParams lp = (LayoutParams) child.getLayoutParams(); + + final int width = child.getMeasuredWidth(); + final int height = child.getMeasuredHeight(); + + int childLeft; + int childTop; + + int gravity = lp.gravity; + if (gravity == -1) { + gravity = Gravity.TOP | Gravity.LEFT; + } + + final int layoutDirection = getLayoutDirection(); + final int absoluteGravity = Gravity.getAbsoluteGravity(gravity, layoutDirection); + final int verticalGravity = gravity & Gravity.VERTICAL_GRAVITY_MASK; + + switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) { + case Gravity.CENTER_HORIZONTAL: + childLeft = parentLeft + (parentRight - parentLeft - width) / 2 + + lp.leftMargin - lp.rightMargin; + break; + case Gravity.RIGHT: + childLeft = parentRight - width - lp.rightMargin; + break; + case Gravity.LEFT: + default: + childLeft = parentLeft + lp.leftMargin; + } + + switch (verticalGravity) { + case Gravity.TOP: + childTop = parentTop + lp.topMargin; + break; + case Gravity.CENTER_VERTICAL: + childTop = parentTop + (parentBottom - parentTop - height) / 2 + + lp.topMargin - lp.bottomMargin; + break; + case Gravity.BOTTOM: + childTop = parentBottom - height - lp.bottomMargin; + break; + default: + childTop = parentTop + lp.topMargin; + } + + if (child instanceof EmojiView) { + if (AndroidUtilities.isTablet()) { + childTop = b - t - height; + } else { + childTop = b - t + keyboardSize - height; + } + } + + child.layout(childLeft, childTop, childLeft + width, childTop + height); + } + } + + super.notifyHeightChanged(); + } + }; FrameLayout frameLayout = (FrameLayout) fragmentView; frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray)); @@ -439,9 +571,11 @@ public boolean requestFocus(int direction, Rect previouslyFocusedRect) { } else if (item.viewType == VIEW_TYPE_CREATE_LINK || item.viewType == VIEW_TYPE_BUTTON && item.iconResId == R.drawable.msg2_link2) { onClickCreateLink(view); } else if (item.viewType == VIEW_TYPE_EDIT) { - PollEditTextCell cell = (PollEditTextCell) view; - cell.getTextView().requestFocus(); - AndroidUtilities.showKeyboard(cell.getTextView()); +// PollEditTextCell cell = (PollEditTextCell) view; +// cell.getTextView().requestFocus(); +// AndroidUtilities.showKeyboard(cell.getTextView()); +// EditEmojiTextCell cell = (EditEmojiTextCell) view; +// cell.editTextEmoji.openKeyboard(); } }); listView.setOnItemLongClickListener((view, position) -> { @@ -462,6 +596,20 @@ public boolean requestFocus(int direction, Rect previouslyFocusedRect) { itemAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT); itemAnimator.setDurations(350); listView.setItemAnimator(itemAnimator); + listView.setOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + if (listView.scrollingByUser) { + if (nameEditTextCell != null && nameEditTextCell.editTextEmoji != null) { + if (nameEditTextCell.editTextEmoji.isPopupShowing()) { + nameEditTextCell.editTextEmoji.hidePopup(true); + } else { + nameEditTextCell.editTextEmoji.closeKeyboard(); + } + } + } + } + }); checkDoneButton(false); @@ -470,6 +618,12 @@ public boolean requestFocus(int direction, Rect previouslyFocusedRect) { return fragmentView; } + public boolean hasAnimatedEmojis(CharSequence cs) { + if (!(cs instanceof Spanned)) return false; + Spanned spanned = (Spanned) cs; + AnimatedEmojiSpan[] spans = spanned.getSpans(0, spanned.length(), AnimatedEmojiSpan.class); + return spans != null && spans.length > 0; + } public UndoView getUndoView() { if (getContext() == null) { @@ -761,6 +915,10 @@ public void onResume() { @Override public boolean onBackPressed() { + if (nameEditTextCell != null && nameEditTextCell.editTextEmoji != null && nameEditTextCell.editTextEmoji.isPopupShowing()) { + nameEditTextCell.editTextEmoji.hidePopup(true); + return false; + } return checkDiscard(); } @@ -807,7 +965,7 @@ private void fillFilterName() { } newFilterName = newName; if (folderTagsHeader != null) { - folderTagsHeader.setPreviewText((newFilterName == null ? "" : newFilterName).toUpperCase(), false); + folderTagsHeader.setPreviewText(AnimatedEmojiSpan.cloneSpans(newFilterName, -1, folderTagsHeader.getPreviewTextPaint().getFontMetricsInt(), .5f), false); } RecyclerView.ViewHolder holder = listView.findViewHolderForAdapterPosition(nameRow); if (holder != null) { @@ -839,20 +997,20 @@ private void showRemoveAlert(ItemInner item, CharSequence name, Object object, b if (include) { builder.setTitle(LocaleController.getString(R.string.FilterRemoveInclusionTitle)); if (object instanceof String) { - builder.setMessage(LocaleController.formatString("FilterRemoveInclusionText", R.string.FilterRemoveInclusionText, name)); + builder.setMessage(LocaleController.formatString(R.string.FilterRemoveInclusionText, name)); } else if (object instanceof TLRPC.User) { - builder.setMessage(LocaleController.formatString("FilterRemoveInclusionUserText", R.string.FilterRemoveInclusionUserText, name)); + builder.setMessage(LocaleController.formatString(R.string.FilterRemoveInclusionUserText, name)); } else { - builder.setMessage(LocaleController.formatString("FilterRemoveInclusionChatText", R.string.FilterRemoveInclusionChatText, name)); + builder.setMessage(LocaleController.formatString(R.string.FilterRemoveInclusionChatText, name)); } } else { builder.setTitle(LocaleController.getString(R.string.FilterRemoveExclusionTitle)); if (object instanceof String) { - builder.setMessage(LocaleController.formatString("FilterRemoveExclusionText", R.string.FilterRemoveExclusionText, name)); + builder.setMessage(LocaleController.formatString(R.string.FilterRemoveExclusionText, name)); } else if (object instanceof TLRPC.User) { - builder.setMessage(LocaleController.formatString("FilterRemoveExclusionUserText", R.string.FilterRemoveExclusionUserText, name)); + builder.setMessage(LocaleController.formatString(R.string.FilterRemoveExclusionUserText, name)); } else { - builder.setMessage(LocaleController.formatString("FilterRemoveExclusionChatText", R.string.FilterRemoveExclusionChatText, name)); + builder.setMessage(LocaleController.formatString(R.string.FilterRemoveExclusionChatText, name)); } } builder.setNegativeButton(LocaleController.getString(R.string.Cancel), null); @@ -886,9 +1044,11 @@ private void processDone() { save(true, () -> { if (doNotCloseWhenSave) { doNotCloseWhenSave = false; - TextPaint paint = new TextPaint(Paint.ANTI_ALIAS_FLAG); - paint.setTextSize(dp(20)); - actionBar.setTitleAnimated(Emoji.replaceEmoji(filter.name, paint.getFontMetricsInt(), dp(20), false), true, 220); + final Paint.FontMetricsInt fontMetricsInt = actionBar.getTitleFontMetricsInt(); + CharSequence title = filter.name; + title = Emoji.replaceEmoji(title, fontMetricsInt, false); + title = MessageObject.replaceAnimatedEmoji(title, filter.entities, fontMetricsInt); + actionBar.setTitleAnimated(title, true, 220); return; } finishFragment(); @@ -896,7 +1056,9 @@ private void processDone() { } private void save(boolean progress, Runnable after) { - saveFilterToServer(filter, newFilterFlags, newFilterName, newFilterColor, newAlwaysShow, newNeverShow, newPinned, creatingNew, false, hasUserChanged, true, progress, this, () -> { + final CharSequence[] parsedTitle = new CharSequence[] { newFilterName }; + final ArrayList entities = getMediaDataController().getEntities(parsedTitle, false); + saveFilterToServer(filter, newFilterFlags, parsedTitle[0].toString(), entities, !newFilterAnimations, newFilterColor, newAlwaysShow, newNeverShow, newPinned, creatingNew, false, hasUserChanged, true, progress, this, () -> { hasUserChanged = false; creatingNew = false; @@ -911,7 +1073,7 @@ private void save(boolean progress, Runnable after) { }); } - private static void processAddFilter(MessagesController.DialogFilter filter, int newFilterFlags, String newFilterName, int newFilterColor, ArrayList newAlwaysShow, ArrayList newNeverShow, boolean creatingNew, boolean atBegin, boolean hasUserChanged, boolean resetUnreadCounter, BaseFragment fragment, Runnable onFinish) { + private static void processAddFilter(MessagesController.DialogFilter filter, int newFilterFlags, String newFilterName, ArrayList newFilterNameEntities, boolean newFilterNoanimate, int newFilterColor, ArrayList newAlwaysShow, ArrayList newNeverShow, boolean creatingNew, boolean atBegin, boolean hasUserChanged, boolean resetUnreadCounter, BaseFragment fragment, Runnable onFinish) { if (filter.flags != newFilterFlags || hasUserChanged) { filter.pendingUnreadCount = -1; if (resetUnreadCounter) { @@ -920,9 +1082,11 @@ private static void processAddFilter(MessagesController.DialogFilter filter, int } filter.flags = newFilterFlags; filter.name = newFilterName; + filter.entities = newFilterNameEntities; filter.color = newFilterColor; filter.neverShow = newNeverShow; filter.alwaysShow = newAlwaysShow; + filter.title_noanimate = newFilterNoanimate; if (creatingNew) { fragment.getMessagesController().addFilter(filter, atBegin); } else { @@ -942,7 +1106,7 @@ private static void processAddFilter(MessagesController.DialogFilter filter, int } } - public static void saveFilterToServer(MessagesController.DialogFilter filter, int newFilterFlags, String newFilterName, int newFilterColor, ArrayList newAlwaysShow, ArrayList newNeverShow, LongSparseIntArray newPinned, boolean creatingNew, boolean atBegin, boolean hasUserChanged, boolean resetUnreadCounter, boolean progress, BaseFragment fragment, Runnable onFinish) { + public static void saveFilterToServer(MessagesController.DialogFilter filter, int newFilterFlags, String newFilterName, ArrayList newFilterNameEntities, boolean newFilterNoanimate, int newFilterColor, ArrayList newAlwaysShow, ArrayList newNeverShow, LongSparseIntArray newPinned, boolean creatingNew, boolean atBegin, boolean hasUserChanged, boolean resetUnreadCounter, boolean progress, BaseFragment fragment, Runnable onFinish) { if (fragment == null || fragment.getParentActivity() == null) { return; } @@ -967,7 +1131,10 @@ public static void saveFilterToServer(MessagesController.DialogFilter filter, in req.filter.exclude_read = (newFilterFlags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_READ) != 0; req.filter.exclude_archived = (newFilterFlags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) != 0; req.filter.id = filter.id; - req.filter.title = newFilterName; + req.filter.title = new TLRPC.TL_textWithEntities(); + req.filter.title.text = newFilterName; + req.filter.title.entities = newFilterNameEntities; + req.filter.title_noanimate = newFilterNoanimate; if (newFilterColor < 0) { req.filter.flags &=~ 134217728; req.filter.color = 0; @@ -1050,13 +1217,13 @@ public static void saveFilterToServer(MessagesController.DialogFilter filter, in } catch (Exception e) { FileLog.e(e); } - processAddFilter(filter, newFilterFlags, newFilterName, newFilterColor, newAlwaysShow, newNeverShow, creatingNew, atBegin, hasUserChanged, resetUnreadCounter, fragment, onFinish); + processAddFilter(filter, newFilterFlags, newFilterName, newFilterNameEntities, newFilterNoanimate, newFilterColor, newAlwaysShow, newNeverShow, creatingNew, atBegin, hasUserChanged, resetUnreadCounter, fragment, onFinish); } else if (onFinish != null) { onFinish.run(); } })); if (!progress) { - processAddFilter(filter, newFilterFlags, newFilterName, newFilterColor, newAlwaysShow, newNeverShow, creatingNew, atBegin, hasUserChanged, resetUnreadCounter, fragment, null); + processAddFilter(filter, newFilterFlags, newFilterName, newFilterNameEntities, newFilterNoanimate, newFilterColor, newAlwaysShow, newNeverShow, creatingNew, atBegin, hasUserChanged, resetUnreadCounter, fragment, null); } } @@ -1088,6 +1255,9 @@ private boolean hasChanges() { hasUserChanged = true; } } + if (filter.title_noanimate != (!newFilterAnimations)) { + return true; + } if (!TextUtils.equals(filter.name, newFilterName)) { return true; } @@ -1118,23 +1288,6 @@ private void checkDoneButton(boolean animated) { } } - private void setTextLeft(View cell) { - if (cell instanceof PollEditTextCell) { - PollEditTextCell textCell = (PollEditTextCell) cell; - int left = MAX_NAME_LENGTH - (newFilterName != null ? newFilterName.length() : 0); - if (left <= MAX_NAME_LENGTH - MAX_NAME_LENGTH * 0.7f) { - textCell.setText2(String.format("%d", left)); - SimpleTextView textView = textCell.getTextView2(); - int key = left < 0 ? Theme.key_text_RedRegular : Theme.key_windowBackgroundWhiteGrayText3; - textView.setTextColor(Theme.getColor(key)); - textView.setTag(key); - textView.setAlpha(((PollEditTextCell) cell).getTextView().isFocused() || left < 0 ? 1.0f : 0.0f); - } else { - textCell.setText2(""); - } - } - } - private static final int VIEW_TYPE_HEADER = 0; private static final int VIEW_TYPE_CHAT = 1; private static final int VIEW_TYPE_EDIT = 2; @@ -1146,12 +1299,14 @@ private void setTextLeft(View cell) { private static final int VIEW_TYPE_CREATE_LINK = 8; private static final int VIEW_TYPE_HEADER_COLOR_PREVIEW = 9; private static final int VIEW_TYPE_COLOR = 10; + private static final int VIEW_TYPE_HEADER_ANIMATED = 11; private static class ItemInner extends AdapterWithDiffUtils.Item { private View.OnClickListener onClickListener; private CharSequence text; + private CharSequence subtext; private boolean newSpan; private boolean include; // or exclude @@ -1181,6 +1336,14 @@ public static ItemInner asHeader(CharSequence text, boolean newSpan) { return item; } + public static ItemInner asAnimatedHeader(CharSequence text, CharSequence rightText, View.OnClickListener onRightTextClick) { + ItemInner item = new ItemInner(VIEW_TYPE_HEADER_ANIMATED, false); + item.text = text; + item.subtext = rightText; + item.onClickListener = onRightTextClick; + return item; + } + public static ItemInner asChat(boolean include, long did) { ItemInner item = new ItemInner(VIEW_TYPE_CHAT, false); item.include = include; @@ -1242,6 +1405,9 @@ public boolean equals(Object o) { if (this.viewType != other.viewType) { return false; } + if (viewType == VIEW_TYPE_HEADER_ANIMATED) { + return TextUtils.equals(text, other.text) && TextUtils.equals(subtext, other.subtext); + } if (viewType == VIEW_TYPE_HEADER || viewType == VIEW_TYPE_CHAT || viewType == VIEW_TYPE_SHADOW || viewType == VIEW_TYPE_BUTTON) { if (!TextUtils.equals(text, other.text)) { return false; @@ -1286,7 +1452,8 @@ public boolean isEnabled(RecyclerView.ViewHolder holder) { type != VIEW_TYPE_HEADER && type != VIEW_TYPE_EDIT && type != VIEW_TYPE_HINT && - type != VIEW_TYPE_HEADER_COLOR_PREVIEW + type != VIEW_TYPE_HEADER_COLOR_PREVIEW && + type != VIEW_TYPE_HEADER_ANIMATED ); } @@ -1303,6 +1470,10 @@ public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType view = new HeaderCell(mContext, 22); view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); break; + case VIEW_TYPE_HEADER_ANIMATED: + view = new HeaderCellWithRight(mContext, resourceProvider); + view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); + break; case VIEW_TYPE_CHAT: { UserCell cell = new UserCell(mContext, 6, 0, false); cell.setSelfAsSavedMessages(true); @@ -1311,44 +1482,44 @@ public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType break; } case VIEW_TYPE_EDIT: { - PollEditTextCell cell = new PollEditTextCell(mContext, null); - cell.createErrorTextView(); - cell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); - cell.addTextWatcher(new TextWatcher() { + EditEmojiTextCell cell = nameEditTextCell = new EditEmojiTextCell(mContext, (SizeNotifierFrameLayout) fragmentView, LocaleController.getString(R.string.FilterNameHint), false, MAX_NAME_LENGTH, EditTextEmoji.STYLE_GIFT, resourceProvider) { @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) { - + public int emojiCacheType() { + return AnimatedEmojiDrawable.CACHE_TYPE_TOGGLEABLE_EDIT; } - + }; + cell.setAllowEntities(false); + cell.editTextEmoji.getEditText().setEmojiColor(getThemedColor(Theme.key_featuredStickers_addButton)); + cell.editTextEmoji.setEmojiViewCacheType(AnimatedEmojiDrawable.CACHE_TYPE_TOGGLEABLE_EDIT); + cell.editTextEmoji.setText(newFilterName); + AnimatedEmojiDrawable.toggleAnimations(currentAccount, newFilterAnimations); + EditTextCaption editText = cell.editTextEmoji.getEditText(); + editText.addTextChangedListener(new EditTextSuggestionsFix()); + editText.addTextChangedListener(new TextWatcher() { @Override - public void onTextChanged(CharSequence s, int start, int before, int count) { - - } - + public void beforeTextChanged(CharSequence s, int start, int count, int after) {} + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) {} @Override public void afterTextChanged(Editable s) { - if (cell.getTag() != null) { - return; - } - String newName = s.toString(); + CharSequence newName = s; if (!TextUtils.equals(newName, newFilterName)) { nameChangedManually = !TextUtils.isEmpty(newName); - newFilterName = newName; + newFilterName = AnimatedEmojiSpan.onlyEmojiSpans(newName); if (folderTagsHeader != null) { - folderTagsHeader.setPreviewText((newFilterName == null ? "" : newFilterName).toUpperCase(), true); + folderTagsHeader.setPreviewText(AnimatedEmojiSpan.cloneSpans(newFilterName, -1, folderTagsHeader.getPreviewTextPaint().getFontMetricsInt(), .5f), true); } - } - RecyclerView.ViewHolder holder = listView.findViewHolderForAdapterPosition(nameRow); - if (holder != null) { - setTextLeft(holder.itemView); + if (nameHeaderCell != null) { + nameHeaderCell.rightTextView.setText(hasAnimatedEmojis(newFilterName) ? LocaleController.getString(newFilterAnimations ? R.string.FilterNameAnimationsDisable : R.string.FilterNameAnimationsEnable) : null); + } + actionBar.setTitle(AnimatedEmojiSpan.cloneSpans(newFilterName, -1, actionBar.getTitleFontMetricsInt())); } checkDoneButton(true); } }); - EditTextBoldCursor editText = cell.getTextView(); - cell.setShowNextButton(true); - editText.setOnFocusChangeListener((v, hasFocus) -> cell.getTextView2().setAlpha(hasFocus || newFilterName.length() > MAX_NAME_LENGTH ? 1.0f : 0.0f)); - editText.setImeOptions(EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI); + editText.setPadding(dp(23 - 16), editText.getPaddingTop(), editText.getPaddingRight(), editText.getPaddingBottom()); + cell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); + cell.editTextEmoji.getEditText().setImeOptions(EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI); view = cell; break; } @@ -1399,23 +1570,18 @@ protected void reload() { public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) { int viewType = holder.getItemViewType(); if (viewType == 2) { - setTextLeft(holder.itemView); - PollEditTextCell textCell = (PollEditTextCell) holder.itemView; - textCell.setTag(1); - textCell.setTextAndHint(newFilterName != null ? newFilterName : "", LocaleController.getString(R.string.FilterNameHint), false); - textCell.setTag(null); + + } else if (viewType == VIEW_TYPE_HEADER_COLOR_PREVIEW) { + ((HeaderCellColorPreview) holder.itemView).setPreviewText(AnimatedEmojiSpan.cloneSpans(newFilterName, -1, folderTagsHeader.getPreviewTextPaint().getFontMetricsInt(), .5f), true); } } @Override public void onViewDetachedFromWindow(RecyclerView.ViewHolder holder) { if (holder.getItemViewType() == 2) { - PollEditTextCell editTextCell = (PollEditTextCell) holder.itemView; - EditTextBoldCursor editText = editTextCell.getTextView(); - if (editText.isFocused()) { - editText.clearFocus(); - AndroidUtilities.hideKeyboard(editText); - } + EditEmojiTextCell editTextCell = (EditEmojiTextCell) holder.itemView; + editTextCell.editTextEmoji.hidePopup(true); + editTextCell.editTextEmoji.closeKeyboard(); } } @@ -1436,6 +1602,14 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { } break; } + case VIEW_TYPE_HEADER_ANIMATED: { + HeaderCellWithRight cell = (HeaderCellWithRight) holder.itemView; + nameHeaderCell = cell; + cell.setText(item.text); + cell.rightTextView.setText(item.subtext); + cell.rightTextView.setOnClickListener(item.onClickListener); + break; + } case VIEW_TYPE_CHAT: { UserCell userCell = (UserCell) holder.itemView; if (item.chatType != null) { @@ -1512,7 +1686,7 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { } case VIEW_TYPE_HEADER_COLOR_PREVIEW: { folderTagsHeader = (HeaderCellColorPreview) holder.itemView; - folderTagsHeader.setPreviewText((newFilterName == null ? "" : newFilterName).toUpperCase(), false); + folderTagsHeader.setPreviewText(AnimatedEmojiSpan.cloneSpans(newFilterName, -1, folderTagsHeader.getPreviewTextPaint().getFontMetricsInt(), .5f), false); folderTagsHeader.setPreviewColor(!getUserConfig().isPremium() ? -1 : newFilterColor, false); folderTagsHeader.setText(LocaleController.getString(R.string.FolderTagColor)); break; @@ -1563,7 +1737,7 @@ public ArrayList getThemeDescriptions() { } }; - themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{HeaderCell.class, TextCell.class, PollEditTextCell.class, UserCell.class}, null, null, null, Theme.key_windowBackgroundWhite)); + themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{HeaderCell.class, TextCell.class, UserCell.class}, null, null, null, Theme.key_windowBackgroundWhite)); themeDescriptions.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundGray)); themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_actionBarDefault)); @@ -2228,7 +2402,10 @@ public FilterInvitesBottomSheet(BaseFragment fragment, MessagesController.Dialog button.setText(LocaleController.getString(R.string.FolderLinkShareButton)); button.setGravity(Gravity.CENTER); button.setOnClickListener(e -> createLink()); - containerView.addView(button, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.BOTTOM | Gravity.FILL_HORIZONTAL, 16, 10, 16, 10)); + FrameLayout.LayoutParams buttonLayoutParams = LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.BOTTOM | Gravity.FILL_HORIZONTAL, 16, 10, 16, 10); + buttonLayoutParams.leftMargin += backgroundPaddingLeft; + buttonLayoutParams.rightMargin += backgroundPaddingLeft; + containerView.addView(button, buttonLayoutParams); bulletinContainer = new FrameLayout(getContext()); containerView.addView(bulletinContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 100, Gravity.BOTTOM, 6, 0, 6, 0)); @@ -2243,11 +2420,22 @@ private void updateCreateInviteButton() { @Override protected CharSequence getTitle() { - return LocaleController.formatString("FolderLinkShareTitle", R.string.FolderLinkShareTitle, filter == null ? "" : filter.name); + return getTitle(null); + } + + protected CharSequence getTitle(TextView textView) { + CharSequence name = ""; + if (filter != null) { + Paint.FontMetricsInt fontMetricsInt = textView == null ? null : textView.getPaint().getFontMetricsInt(); + name = new SpannableStringBuilder(filter.name); + name = Emoji.replaceEmoji(name, fontMetricsInt, false); + name = MessageObject.replaceAnimatedEmoji(name, filter.entities, fontMetricsInt); + } + return LocaleController.formatSpannable(R.string.FolderLinkShareTitle2, name); } - private ArrayList oldItems = new ArrayList<>(); - private ArrayList items = new ArrayList<>(); + private final ArrayList oldItems = new ArrayList<>(); + private final ArrayList items = new ArrayList<>(); private void updateRows(boolean animated) { oldItems.clear(); @@ -2434,7 +2622,7 @@ public int getItemCount() { private class HeaderView extends FrameLayout { private final ImageView imageView; - private final TextView titleView; + private final SpoilersTextView titleView; private final TextView subtitleView; private final ImageView closeImageView; @@ -2448,12 +2636,13 @@ public HeaderView(Context context) { imageView.setBackground(Theme.createRoundRectDrawable(dp(22), Theme.getColor(Theme.key_featuredStickers_addButton))); addView(imageView, LayoutHelper.createFrame(54, 44, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 0, 22, 0, 0)); - titleView = new TextView(context); - titleView.setText(getTitle()); + titleView = new SpoilersTextView(context); titleView.setTypeface(AndroidUtilities.bold()); titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); titleView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack)); titleView.setGravity(Gravity.CENTER_HORIZONTAL); + titleView.setText(getTitle(titleView)); + titleView.cacheType = filter != null && filter.title_noanimate ? AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER : AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES; addView(titleView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 20, 84, 20, 0)); subtitleView = new TextView(context); @@ -2620,6 +2809,9 @@ public void setPreviewColor(int colorId, boolean animated) { final boolean noTag = colorId < 0; currentColor = noTag ? 0 : FilterCreateActivity.this.getThemedColor(Theme.keys_avatar_nameInMessage[colorId % Theme.keys_avatar_nameInMessage.length]); + if (!noTag) { + previewView.setEmojiColor(currentColor); + } if (!animated) { this.animatedColor.set(currentColor, true); } @@ -2630,11 +2822,40 @@ public void setPreviewColor(int colorId, boolean animated) { } } - public void setPreviewText(String text, boolean animated) { + public void setPreviewText(CharSequence text, boolean animated) { + if (text == null) { + text = ""; + } if (text.length() > MAX_NAME_LENGTH) { - text = text.substring(0, MAX_NAME_LENGTH); + text = text.subSequence(0, MAX_NAME_LENGTH); } previewView.setText(Emoji.replaceEmoji(text, previewView.getPaint().getFontMetricsInt(), false), animated && !LocaleController.isRTL); } + + public TextPaint getPreviewTextPaint() { + return previewView.getPaint(); + } + } + + private class HeaderCellWithRight extends HeaderCell { + + private final AnimatedTextView rightTextView; + + public HeaderCellWithRight(Context context, Theme.ResourcesProvider resourcesProvider) { + super(context); + + rightTextView = new AnimatedTextView(context, true, true, true) { + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + setPivotX(getMeasuredWidth()); + } + }; + rightTextView.setGravity(LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT); + rightTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueHeader, resourcesProvider)); + rightTextView.setTextSize(dpf2(15)); + addView(rightTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 18, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, 22, 17, 22, 0)); + ScaleStateListAnimator.apply(rightTextView, 0.04f, 1.2f); + } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/FilteredSearchView.java b/TMessagesProj/src/main/java/org/telegram/ui/FilteredSearchView.java index 164048108a..74b388913f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/FilteredSearchView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/FilteredSearchView.java @@ -167,7 +167,7 @@ public boolean loadMore() { } @Override - public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { + public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview, boolean closing) { if (messageObject == null) { return null; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/FiltersSetupActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/FiltersSetupActivity.java index 17475a82f7..965d886b73 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/FiltersSetupActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/FiltersSetupActivity.java @@ -33,6 +33,7 @@ import org.telegram.messenger.Emoji; import org.telegram.messenger.FileLog; import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MessageObject; import org.telegram.messenger.MessagesController; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; @@ -49,6 +50,7 @@ import org.telegram.ui.Cells.ShadowSectionCell; import org.telegram.ui.Cells.TextCheckCell; import org.telegram.ui.Cells.TextInfoPrivacyCell; +import org.telegram.ui.Components.AnimatedEmojiDrawable; import org.telegram.ui.Components.Bulletin; import org.telegram.ui.Components.BulletinFactory; import org.telegram.ui.Components.CombinedDrawable; @@ -190,7 +192,7 @@ public void setFilter(TLRPC.TL_dialogFilterSuggested filter, boolean divider) { suggestedFilter = filter; setWillNotDraw(!needDivider); - textView.setText(filter.filter.title); + textView.setText(filter.filter.title.text); valueTextView.setText(filter.description); } @@ -287,6 +289,7 @@ public FilterCell(Context context) { addView(colorImageView, LayoutHelper.createFrame(20, 20, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, 22, 0, 22, 0)); textView = new SimpleTextView(context); + textView.setPadding(0, dp(4), 0, dp(4)); textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); textView.setTextSize(16); textView.setMaxLines(1); @@ -294,7 +297,8 @@ public FilterCell(Context context) { Drawable drawable = ContextCompat.getDrawable(getContext(), R.drawable.other_lockedfolders2); drawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_stickers_menu), PorterDuff.Mode.MULTIPLY)); textView.setRightDrawable(drawable); - addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 80 : 64, 14, LocaleController.isRTL ? 64 : 80, 0)); + textView.setEmojiColor(Theme.getColor(Theme.key_featuredStickers_addButton, resourceProvider)); + addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 80 : 64, 10, LocaleController.isRTL ? 64 : 80, 0)); valueTextView = new TextView(context); valueTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2)); @@ -472,7 +476,11 @@ public void setFilter(MessagesController.DialogFilter filter, boolean divider, i if (!animated) { progressToLock = currentFilter.locked ? 1f : 0; } - textView.setText(Emoji.replaceEmoji(name, textView.getPaint().getFontMetricsInt(), dp(20), false)); + CharSequence title = name; + title = Emoji.replaceEmoji(title, textView.getPaint().getFontMetricsInt(), false); + title = MessageObject.replaceAnimatedEmoji(title, filter.entities, textView.getPaint().getFontMetricsInt()); + textView.setEmojiCacheType(filter.title_noanimate ? AnimatedEmojiDrawable.CACHE_TYPE_NOANIMATE_FOLDER : AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES); + textView.setText(title); valueTextView.setText(info); needDivider = divider; @@ -955,7 +963,8 @@ public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType suggestedFilterCell.setAddOnClickListener(v -> { TLRPC.TL_dialogFilterSuggested suggested = suggestedFilterCell.getSuggestedFilter(); MessagesController.DialogFilter filter = new MessagesController.DialogFilter(); - filter.name = suggested.filter.title; + filter.name = suggested.filter.title.text; + filter.entities = suggested.filter.title.entities; filter.id = 2; while (getMessagesController().dialogFiltersById.get(filter.id) != null) { filter.id++; @@ -1002,7 +1011,7 @@ public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType if (suggested.filter.exclude_muted) { filter.flags |= MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED; } - FilterCreateActivity.saveFilterToServer(filter, filter.flags, filter.name, filter.color, filter.alwaysShow, filter.neverShow, filter.pinnedDialogs, true, true, true, true, true, FiltersSetupActivity.this, () -> { + FilterCreateActivity.saveFilterToServer(filter, filter.flags, filter.name, filter.entities, filter.title_noanimate, filter.color, filter.alwaysShow, filter.neverShow, filter.pinnedDialogs, true, true, true, true, true, FiltersSetupActivity.this, () -> { getMessagesController().suggestedFilters.remove(suggested); getNotificationCenter().postNotificationName(NotificationCenter.dialogFiltersUpdated); }); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Gifts/GiftSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Gifts/GiftSheet.java index 7b9a082829..0053c80424 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Gifts/GiftSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Gifts/GiftSheet.java @@ -1,23 +1,27 @@ package org.telegram.ui.Gifts; import static org.telegram.messenger.AndroidUtilities.dp; -import static org.telegram.messenger.LocaleController.formatPluralString; +import static org.telegram.messenger.AndroidUtilities.dpf2; +import static org.telegram.messenger.AndroidUtilities.lerp; import static org.telegram.messenger.LocaleController.formatPluralStringComma; import static org.telegram.messenger.LocaleController.getString; +import static org.telegram.ui.Stars.StarsController.findAttribute; import static org.telegram.ui.Stars.StarsIntroActivity.StarsTransactionView.getPlatformDrawable; -import android.app.Activity; import android.content.Context; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.CornerPathEffect; +import android.graphics.LinearGradient; +import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Path; import android.graphics.PixelFormat; +import android.graphics.RadialGradient; import android.graphics.Rect; import android.graphics.RectF; +import android.graphics.Shader; import android.graphics.drawable.Drawable; -import android.net.Uri; import android.os.Bundle; import android.text.TextUtils; import android.util.TypedValue; @@ -32,19 +36,18 @@ import androidx.annotation.Nullable; import androidx.recyclerview.widget.DefaultItemAnimator; import androidx.recyclerview.widget.GridLayoutManager; -import androidx.recyclerview.widget.RecyclerView; import com.android.billingclient.api.BillingClient; -import com.android.billingclient.api.BillingFlowParams; import com.android.billingclient.api.ProductDetails; import com.android.billingclient.api.QueryProductDetailsParams; -import org.telegram.messenger.AccountInstance; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.BillingController; import org.telegram.messenger.BirthdayController; import org.telegram.messenger.BuildVars; +import org.telegram.messenger.DialogObject; import org.telegram.messenger.DocumentObject; +import org.telegram.messenger.Emoji; import org.telegram.messenger.FileLoader; import org.telegram.messenger.ImageLocation; import org.telegram.messenger.ImageReceiver; @@ -57,8 +60,6 @@ import org.telegram.messenger.UserConfig; import org.telegram.messenger.UserObject; import org.telegram.messenger.Utilities; -import org.telegram.messenger.browser.Browser; -import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; import org.telegram.tgnet.tl.TL_stars; @@ -66,24 +67,24 @@ import org.telegram.ui.ActionBar.INavigationLayout; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.ChatActivity; -import org.telegram.ui.Components.AlertsCreator; +import org.telegram.ui.Components.AnimatedEmojiDrawable; import org.telegram.ui.Components.AnimatedFloat; import org.telegram.ui.Components.AvatarDrawable; import org.telegram.ui.Components.BackupImageView; import org.telegram.ui.Components.BottomSheetWithRecyclerListView; import org.telegram.ui.Components.BulletinFactory; import org.telegram.ui.Components.CombinedDrawable; +import org.telegram.ui.Components.CompatDrawable; import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.ExtendedGridLayoutManager; import org.telegram.ui.Components.FlickerLoadingView; +import org.telegram.ui.Components.ItemOptions; import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.LinkSpanDrawable; import org.telegram.ui.Components.Premium.GiftPremiumBottomSheet; import org.telegram.ui.Components.Premium.PremiumLockIconView; import org.telegram.ui.Components.Premium.StarParticlesView; -import org.telegram.ui.Components.Premium.boosts.BoostDialogs; import org.telegram.ui.Components.Premium.boosts.BoostRepository; -import org.telegram.ui.Components.Premium.boosts.PremiumPreviewGiftSentBottomSheet; import org.telegram.ui.Components.RLottieDrawable; import org.telegram.ui.Components.RecyclerListView; import org.telegram.ui.Components.ScaleStateListAnimator; @@ -94,14 +95,13 @@ import org.telegram.ui.PremiumPreviewFragment; import org.telegram.ui.ProfileActivity; import org.telegram.ui.Stars.ExplainStarsSheet; +import org.telegram.ui.Stars.StarGiftPatterns; import org.telegram.ui.Stars.StarsController; import org.telegram.ui.Stars.StarsIntroActivity; import org.telegram.ui.Stars.StarsReactionsSheet; import org.telegram.ui.Stories.recorder.HintView2; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Locale; @@ -115,6 +115,7 @@ public class GiftSheet extends BottomSheetWithRecyclerListView implements Notifi private final Runnable closeParentSheet; private final long dialogId; + private final boolean self; private final String name; private final FrameLayout premiumHeaderView; @@ -126,6 +127,7 @@ public class GiftSheet extends BottomSheetWithRecyclerListView implements Notifi private final int TAB_ALL = 0; private final int TAB_LIMITED = 1; + private final int TAB_IN_STOCK = 2; private final ArrayList tabs = new ArrayList<>(); private int selectedTab; @@ -135,11 +137,12 @@ public GiftSheet(Context context, int currentAccount, long userId, Runnable clos this(context, currentAccount, userId, null, closeParentSheet); } - public GiftSheet(Context context, int currentAccount, long userId, List options, Runnable closeParentSheet) { + public GiftSheet(Context context, int currentAccount, long dialogId, List options, Runnable closeParentSheet) { super(context, null, false, false, false, null); this.currentAccount = currentAccount; - this.dialogId = userId; + this.dialogId = dialogId; + this.self = UserConfig.getInstance(currentAccount).getClientUserId() == dialogId; this.options = options; this.closeParentSheet = closeParentSheet; setBackgroundColor(Theme.getColor(Theme.key_dialogGiftsBackground)); @@ -147,8 +150,20 @@ public GiftSheet(Context context, int currentAccount, long userId, List 0) { + final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(dialogId); + this.name = UserObject.getForcedFirstName(user); + avatarDrawable.setInfo(user); + avatarImageView.setForUserOrChat(user, avatarDrawable); + } else { + final TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-dialogId); + this.name = chat == null ? "" : chat.title; + avatarDrawable.setInfo(chat); + avatarImageView.setForUserOrChat(chat, avatarDrawable); + } topPadding = 0.15f; // Gift Premium header @@ -161,17 +176,22 @@ public GiftSheet(Context context, int currentAccount, long userId, List { + BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); + if (lastFragment == null) return; + dismiss(); + lastFragment.presentFragment(ProfileActivity.of(dialogId)); + }); final LinearLayout bottomView = new LinearLayout(context); bottomView.setOrientation(LinearLayout.VERTICAL); - premiumHeaderView.addView(topView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 150)); + if (!self && dialogId >= 0) { + premiumHeaderView.addView(topView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 150)); + } premiumHeaderView.addView(bottomView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.FILL_HORIZONTAL | Gravity.TOP, 0, 145, 0, 0)); final TextView titleView = new TextView(context); @@ -209,6 +229,10 @@ public GiftSheet(Context context, int currentAccount, long userId, List { - new ExplainStarsSheet(context).show(); - }), true) - )); + titleStarsView.setText(getString(dialogId < 0 ? R.string.Gift2StarsChannel : self ? R.string.Gift2StarsSelf : R.string.Gift2Stars)); + if (self) { + starsHeaderView.addView(subtitleStarsView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 26, 9, 26, 4)); + + final LinkSpanDrawable.LinksTextView subtitleStarsView2 = new LinkSpanDrawable.LinksTextView(context, resourcesProvider); + subtitleStarsView2.setLinkTextColor(Theme.getColor(Theme.key_chat_messageLinkIn, resourcesProvider)); + subtitleStarsView2.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + subtitleStarsView2.setTextColor(Theme.getColor(Theme.key_dialogTextBlack, resourcesProvider)); + subtitleStarsView2.setGravity(Gravity.CENTER); + starsHeaderView.addView(subtitleStarsView2, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 26, 4, 26, 10)); + + subtitleStarsView.setText(getString(R.string.Gift2StarsSelfInfo1)); + subtitleStarsView2.setText(getString(R.string.Gift2StarsSelfInfo2)); + } else if (dialogId < 0) { + starsHeaderView.addView(subtitleStarsView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 26, 9, 26, 4)); + NotificationCenter.listenEmojiLoading(subtitleStarsView); + subtitleStarsView.setText(Emoji.replaceEmoji(AndroidUtilities.replaceTags(LocaleController.formatString(R.string.Gift2StarsChannelInfo, name)), subtitleStarsView.getPaint().getFontMetricsInt(), false)); + } else { + starsHeaderView.addView(subtitleStarsView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 4, 9, 4, 10)); + + subtitleStarsView.setText(TextUtils.concat( + AndroidUtilities.replaceTags(LocaleController.formatString(R.string.Gift2StarsInfo, name)), + " ", + AndroidUtilities.replaceArrows(AndroidUtilities.makeClickable(getString(R.string.Gift2StarsInfoLink), () -> { + new ExplainStarsSheet(context).show(); + }), true) + )); + subtitleStarsView.setMaxWidth(HintView2.cutInFancyHalf(subtitleStarsView.getText(), subtitleStarsView.getPaint())); + } layoutManager = new ExtendedGridLayoutManager(context, 3); layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { @@ -245,21 +289,6 @@ public int getSpanSize(int position) { } }); recyclerListView.setPadding(dp(16), 0, dp(16), 0); -// recyclerListView.addItemDecoration(new RecyclerView.ItemDecoration() { -// @Override -// public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { -// int position = parent.getChildAdapterPosition(view); -// int spanIndex = layoutManager.getSpanSizeLookup().getSpanIndex(position, layoutManager.getSpanCount()); -// int spanSize = layoutManager.getSpanSizeLookup().getSpanSize(position); -// if (view instanceof Tabs) { -// outRect.left = 0; -// outRect.right = 0; -// } else { -// outRect.left = dp(spanIndex == 0 ? 16 : 0); -// outRect.right = dp(spanIndex + spanSize == layoutManager.getSpanCount() ? 16 : 0); -// } -// } -// }); recyclerListView.setClipToPadding(false); recyclerListView.setLayoutManager(layoutManager); recyclerListView.setSelectorType(9); @@ -283,7 +312,7 @@ protected float animateByScale(View view) { if (item.instanceOf(GiftCell.Factory.class)) { if (item.object instanceof GiftPremiumBottomSheet.GiftTier) { final GiftPremiumBottomSheet.GiftTier premiumTier = (GiftPremiumBottomSheet.GiftTier) item.object; - new SendGiftSheet(context, currentAccount, premiumTier, dialogId, () -> { + new SendGiftSheet(context, currentAccount, premiumTier, this.dialogId, () -> { if (closeParentSheet != null) { closeParentSheet.run(); } @@ -296,7 +325,7 @@ protected float animateByScale(View view) { StarsIntroActivity.showSoldOutGiftSheet(context, currentAccount, gift, resourcesProvider); return; } - new SendGiftSheet(context, currentAccount, gift, dialogId, () -> { + new SendGiftSheet(context, currentAccount, gift, this.dialogId, () -> { if (closeParentSheet != null) { closeParentSheet.run(); } @@ -310,7 +339,7 @@ protected float animateByScale(View view) { adapter.update(false); updateTitle(); - if (BirthdayController.getInstance(currentAccount).isToday(userId)) { + if (BirthdayController.getInstance(currentAccount).isToday(dialogId)) { setBirthday(); } @@ -318,6 +347,9 @@ protected float animateByScale(View view) { NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.starGiftsLoaded); NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.userInfoDidLoad); NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.starGiftSoldOut); + + actionBar.setTitle(getTitle()); + NotificationCenter.listenEmojiLoading(actionBar.getTitleTextView()); } public GiftSheet setBirthday() { @@ -541,7 +573,10 @@ private void updatePremiumTiers() { @Override protected CharSequence getTitle() { - return LocaleController.formatString(R.string.Gift2User, name); + if (self) { + return getString(R.string.Gift2TitleSelf1); + } + return Emoji.replaceEmoji(LocaleController.formatString(R.string.Gift2User, name), null, false); } @Override @@ -552,19 +587,21 @@ protected RecyclerListView.SelectionAdapter createAdapter(RecyclerListView listV } public void fillItems(ArrayList items, UniversalAdapter adapter) { - items.add(UItem.asCustom(premiumHeaderView)); - if (premiumTiers != null && !premiumTiers.isEmpty()) { - for (GiftPremiumBottomSheet.GiftTier tier : premiumTiers) { - items.add(GiftCell.Factory.asPremiumGift(tier)); + if (!self && dialogId >= 0) { + items.add(UItem.asCustom(premiumHeaderView)); + if (premiumTiers != null && !premiumTiers.isEmpty()) { + for (GiftPremiumBottomSheet.GiftTier tier : premiumTiers) { + items.add(GiftCell.Factory.asPremiumGift(tier)); + } + } else { + items.add(UItem.asFlicker(1, FlickerLoadingView.STAR_GIFT).setSpanCount(1)); + items.add(UItem.asFlicker(2, FlickerLoadingView.STAR_GIFT).setSpanCount(1)); + items.add(UItem.asFlicker(3, FlickerLoadingView.STAR_GIFT).setSpanCount(1)); } - } else { - items.add(UItem.asFlicker(1, FlickerLoadingView.STAR_GIFT).setSpanCount(1)); - items.add(UItem.asFlicker(2, FlickerLoadingView.STAR_GIFT).setSpanCount(1)); - items.add(UItem.asFlicker(3, FlickerLoadingView.STAR_GIFT).setSpanCount(1)); } final StarsController s = StarsController.getInstance(currentAccount); - final ArrayList gifts = birthday ? s.birthdaySortedGifts : s.gifts; + final ArrayList gifts = birthday ? s.birthdaySortedGifts : s.sortedGifts; if (!MessagesController.getInstance(currentAccount).stargiftsBlocked && !gifts.isEmpty()) { items.add(UItem.asCustom(starsHeaderView)); final TreeSet prices = new TreeSet<>(); @@ -576,6 +613,7 @@ public void fillItems(ArrayList items, UniversalAdapter adapter) { final ArrayList tabs = new ArrayList<>(); tabs.add(getString(R.string.Gift2TabAll)); tabs.add(getString(R.string.Gift2TabLimited)); + tabs.add(getString(R.string.Gift2TabInStock)); final Iterator priceIt = prices.iterator(); final ArrayList pricesArray = new ArrayList<>(); while (priceIt.hasNext()) { @@ -590,13 +628,14 @@ public void fillItems(ArrayList items, UniversalAdapter adapter) { adapter.update(true); })); - final long selectedPrice = selectedTab - 2 >= 0 && selectedTab - 2 < pricesArray.size() ? pricesArray.get(selectedTab - 2) : 0; + final long selectedPrice = selectedTab - 3 >= 0 && selectedTab - 3 < pricesArray.size() ? pricesArray.get(selectedTab - 3) : 0; for (int i = 0; i < gifts.size(); ++i) { final TL_stars.StarGift gift = gifts.get(i); if ( selectedTab == TAB_ALL || selectedTab == TAB_LIMITED && gift.limited || - selectedTab >= 2 && gift.stars == selectedPrice + selectedTab == TAB_IN_STOCK && !gift.sold_out || + selectedTab >= 3 && gift.stars == selectedPrice ) { items.add(GiftCell.Factory.asStarGift(selectedTab, gift)); } @@ -610,16 +649,18 @@ public void fillItems(ArrayList items, UniversalAdapter adapter) { } } - public static class GiftCell extends FrameLayout { + public static class GiftCell extends FrameLayout implements ItemOptions.ScrimView { private final int currentAccount; private final Theme.ResourcesProvider resourcesProvider; private final FrameLayout card; + private final CardBackground cardBackground; private final Ribbon ribbon; private final AvatarDrawable avatarDrawable; private final BackupImageView avatarView; private final BackupImageView imageView; + private final FrameLayout.LayoutParams imageViewLayoutParams; private final PremiumLockIconView lockView; private final TextView titleView; @@ -637,7 +678,7 @@ public GiftCell(Context context, int currentAccount, Theme.ResourcesProvider res ScaleStateListAnimator.apply(this, .04f, 1.5f); card = new FrameLayout(context); - card.setBackground(new CardBackground(resourcesProvider)); + card.setBackground(cardBackground = new CardBackground(card, resourcesProvider, true)); addView(card, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL)); ribbon = new Ribbon(context); @@ -645,7 +686,7 @@ public GiftCell(Context context, int currentAccount, Theme.ResourcesProvider res imageView = new BackupImageView(context); imageView.getImageReceiver().setAutoRepeat(0); - card.addView(imageView, LayoutHelper.createFrame(100, 100, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 0, 0, 0)); + card.addView(imageView, imageViewLayoutParams = LayoutHelper.createFrame(96, 96, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 2, 0, 2)); lockView = new PremiumLockIconView(context, PremiumLockIconView.TYPE_GIFT_LOCK, resourcesProvider); lockView.setImageReceiver(imageView.getImageReceiver()); @@ -669,7 +710,7 @@ public GiftCell(Context context, int currentAccount, Theme.ResourcesProvider res priceView.setTypeface(AndroidUtilities.bold()); priceView.setPadding(dp(10), 0, dp(10), 0); priceView.setGravity(Gravity.CENTER); - priceView.setBackground(new StarsBackground()); + priceView.setBackground(new StarsBackground(false)); priceView.setTextColor(0xFF3391D4); card.addView(priceView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 26, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 0, 133, 0, 11)); @@ -692,6 +733,9 @@ public void setPremiumGift(GiftPremiumBottomSheet.GiftTier tier) { cancel = null; } } + + cardBackground.setBackdrop(null); + cardBackground.setPattern(null); titleView.setText(LocaleController.formatPluralString("Gift2Months", months)); subtitleView.setText(getString(R.string.TelegramPremiumShort)); titleView.setVisibility(View.VISIBLE); @@ -702,13 +746,14 @@ public void setPremiumGift(GiftPremiumBottomSheet.GiftTier tier) { if (tier.getDiscount() > 0) { ribbon.setVisibility(View.VISIBLE); - ribbon.setColor(0xFFF55951); + ribbon.setColors(0xFFD94FFF, 0xFF826DFF); ribbon.setText(12, LocaleController.formatString(R.string.GiftPremiumOptionDiscount, tier.getDiscount()), true); } else { ribbon.setVisibility(View.GONE); } priceView.setPadding(dp(10), 0, dp(10), 0); + priceView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12); priceView.setText(tier.getFormattedPrice()); priceView.setBackground(Theme.createRoundRectDrawable(dp(13), 0x193391D4)); priceView.setTextColor(0xFF3391D4); @@ -719,15 +764,18 @@ public void setPremiumGift(GiftPremiumBottomSheet.GiftTier tier) { } private TLRPC.Document lastDocument; + private long lastDocumentId; private void setSticker(TLRPC.Document document, Object parentObject) { if (document == null) { imageView.clearImage(); lastDocument = null; + lastDocumentId = 0; return; } if (lastDocument == document) return; lastDocument = document; + lastDocumentId = document.id; TLRPC.PhotoSize photoSize = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, dp(100)); SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(document, Theme.key_windowBackgroundGray, 0.3f); @@ -740,13 +788,43 @@ private void setSticker(TLRPC.Document document, Object parentObject) { ); } + private void setSticker(long documentId, Object parentObject) { + if (documentId == 0) { + imageView.clearImage(); + lastDocument = null; + lastDocumentId = 0; + return; + } + + if (lastDocumentId == documentId) return; + lastDocumentId = documentId; + + AnimatedEmojiDrawable.getDocumentFetcher(currentAccount).fetchDocument(documentId, document -> { + if (document == null || lastDocumentId != document.id) { + return; + } + + TLRPC.PhotoSize photoSize = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, dp(100)); + SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(document, Theme.key_windowBackgroundGray, 0.3f); + + imageView.setImage( + ImageLocation.getForDocument(document), "100_100", + ImageLocation.getForDocument(photoSize, document), "100_100", + svgThumb, + parentObject + ); + }); + } + public void setStarsGift(TL_stars.StarGift gift) { if (cancel != null) { cancel.run(); cancel = null; } - setSticker(gift.sticker, gift); + setSticker(gift.getDocument(), gift); + cardBackground.setBackdrop(findAttribute(gift.attributes, TL_stars.starGiftAttributeBackdrop.class)); + cardBackground.setPattern(findAttribute(gift.attributes, TL_stars.starGiftAttributePattern.class)); titleView.setVisibility(View.GONE); subtitleView.setVisibility(View.GONE); imageView.setTranslationY(0); @@ -755,10 +833,12 @@ public void setStarsGift(TL_stars.StarGift gift) { if (gift.limited && gift.availability_remains <= 0) { ribbon.setVisibility(View.VISIBLE); ribbon.setColor(Theme.getColor(Theme.key_gift_ribbon_soldout, resourcesProvider)); + ribbon.setBackdrop(null); ribbon.setText(LocaleController.getString(R.string.Gift2SoldOut), true); } else if (gift.limited) { ribbon.setVisibility(View.VISIBLE); ribbon.setColor(Theme.getColor(Theme.key_gift_ribbon, resourcesProvider)); + ribbon.setBackdrop(null); ribbon.setText(getString(R.string.Gift2LimitedRibbon), false); } else { ribbon.setVisibility(View.GONE); @@ -767,27 +847,32 @@ public void setStarsGift(TL_stars.StarGift gift) { avatarView.setVisibility(View.GONE); priceView.setPadding(dp(8), 0, dp(10), 0); + priceView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12); priceView.setText(StarsIntroActivity.replaceStarsWithPlain("XTR " + LocaleController.formatNumber(gift.stars, ','), .71f)); - priceView.setBackground(new StarsBackground()); + priceView.setBackground(new StarsBackground(gift instanceof TL_stars.TL_starGiftUnique)); priceView.setTextColor(0xFFBF7600); ((MarginLayoutParams) priceView.getLayoutParams()).topMargin = dp(103); lastTier = null; } - private TL_stars.UserStarGift lastUserGift; + private TL_stars.SavedStarGift lastUserGift; - public void setStarsGift(TL_stars.UserStarGift userGift) { + public void setStarsGift(TL_stars.SavedStarGift userGift, boolean noprice) { if (cancel != null) { cancel.run(); cancel = null; } - setSticker(userGift.gift.sticker, userGift); + setSticker(userGift.gift.getDocument(), userGift); + final TL_stars.starGiftAttributeBackdrop backdrop = findAttribute(userGift.gift.attributes, TL_stars.starGiftAttributeBackdrop.class); + cardBackground.setBackdrop(backdrop); + cardBackground.setPattern(findAttribute(userGift.gift.attributes, TL_stars.starGiftAttributePattern.class)); titleView.setVisibility(View.GONE); subtitleView.setVisibility(View.GONE); imageView.setTranslationY(0); lockView.setWaitingImage(); + lockView.setBlendWithColor(backdrop != null ? Theme.multAlpha(backdrop.center_color | 0xFF000000, .75f) : null); lockView.setVisibility(View.VISIBLE); if (lastUserGift == userGift) { @@ -804,34 +889,71 @@ public void setStarsGift(TL_stars.UserStarGift userGift) { lockView.setScaleY(userGift.unsaved ? 1f : 0.4f); } - if (userGift.gift.limited) { + final boolean unique = userGift.gift instanceof TL_stars.TL_starGiftUnique; + if (unique) { ribbon.setVisibility(View.VISIBLE); ribbon.setColor(Theme.getColor(Theme.key_gift_ribbon, resourcesProvider)); + ribbon.setBackdrop(backdrop); + ribbon.setText(LocaleController.formatString(R.string.Gift2Limited1OfRibbon, AndroidUtilities.formatWholeNumber(userGift.gift.availability_total, 0)), true); + } else if (userGift.gift.limited) { + ribbon.setVisibility(View.VISIBLE); + ribbon.setColor(Theme.getColor(Theme.key_gift_ribbon, resourcesProvider)); + ribbon.setBackdrop(null); ribbon.setText(LocaleController.formatString(R.string.Gift2Limited1OfRibbon, AndroidUtilities.formatWholeNumber(userGift.gift.availability_total, 0)), true); } else { ribbon.setVisibility(View.GONE); } - if (userGift.name_hidden) { + if (unique) { + avatarView.setVisibility(View.GONE); + } else if (userGift.name_hidden) { avatarView.setVisibility(View.VISIBLE); CombinedDrawable iconDrawable = getPlatformDrawable("anonymous"); iconDrawable.setIconSize(dp(16), dp(16)); avatarView.setImageDrawable(iconDrawable); } else { - TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(userGift.from_id); - if (user != null) { - avatarView.setVisibility(View.VISIBLE); - avatarDrawable.setInfo(user); - avatarView.setForUserOrChat(user, avatarDrawable); + final long dialogId = DialogObject.getPeerDialogId(userGift.from_id); + if (dialogId > 0) { + final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(dialogId); + if (user != null) { + avatarView.setVisibility(View.VISIBLE); + avatarDrawable.setInfo(user); + avatarView.setForUserOrChat(user, avatarDrawable); + } else { + avatarView.setVisibility(View.GONE); + } } else { - avatarView.setVisibility(View.GONE); + final TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-dialogId); + if (chat != null) { + avatarView.setVisibility(View.VISIBLE); + avatarDrawable.setInfo(chat); + avatarView.setForUserOrChat(chat, avatarDrawable); + } else { + avatarView.setVisibility(View.GONE); + } } } - priceView.setPadding(dp(8), 0, dp(10), 0); - priceView.setText(StarsIntroActivity.replaceStarsWithPlain("XTR " + LocaleController.formatNumber(Math.max(userGift.gift.stars, userGift.convert_stars > 0 ? userGift.convert_stars : userGift.gift.convert_stars), ','), .66f)); - priceView.setBackground(new StarsBackground()); - priceView.setTextColor(0xFFBF7600); + if (noprice) { + priceView.setVisibility(View.GONE); + imageViewLayoutParams.topMargin = dp(8); + imageViewLayoutParams.bottomMargin = dp(8); + } else { + priceView.setVisibility(View.VISIBLE); + imageViewLayoutParams.topMargin = 0; + imageViewLayoutParams.bottomMargin = 0; + } + if (unique) { + priceView.setPadding(dp(8), 0, dp(8), 0); + priceView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12); + priceView.setText(getString(R.string.Gift2PriceUnique)); + } else { + priceView.setPadding(dp(8), 0, dp(10), 0); + priceView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12); + priceView.setText(StarsIntroActivity.replaceStarsWithPlain("XTR " + LocaleController.formatNumber(Math.max(userGift.gift.stars, userGift.convert_stars > 0 ? userGift.convert_stars : userGift.gift.convert_stars), ','), .66f)); + } + priceView.setBackground(new StarsBackground(unique)); + priceView.setTextColor(unique ? 0xFFFFFFFF : 0xFFBF7600); ((MarginLayoutParams) priceView.getLayoutParams()).topMargin = dp(103); lastUserGift = userGift; @@ -853,9 +975,9 @@ public void bindView(View view, UItem item, boolean divider) { } else if (item.object instanceof TL_stars.StarGift) { TL_stars.StarGift gift = (TL_stars.StarGift) item.object; ((GiftCell) view).setStarsGift(gift); - } else if (item.object instanceof TL_stars.UserStarGift) { - TL_stars.UserStarGift gift = (TL_stars.UserStarGift) item.object; - ((GiftCell) view).setStarsGift(gift); + } else if (item.object instanceof TL_stars.SavedStarGift) { + TL_stars.SavedStarGift gift = (TL_stars.SavedStarGift) item.object; + ((GiftCell) view).setStarsGift(gift, item.accent); } } @@ -872,15 +994,20 @@ public static UItem asStarGift(int tab, TL_stars.StarGift gift) { return item; } - public static UItem asStarGift(int tab, TL_stars.UserStarGift gift) { + public static UItem asStarGift(int tab, TL_stars.SavedStarGift gift) { + return asStarGift(tab, gift, false); + } + public static UItem asStarGift(int tab, TL_stars.SavedStarGift gift, boolean noprice) { final UItem item = UItem.ofFactory(Factory.class).setSpanCount(1); item.intValue = tab; item.object = gift; + item.accent = noprice; return item; } @Override public boolean equals(UItem a, UItem b) { + if (a.accent != b.accent) return false; if (a.object != null || b.object != null) { if (a.object instanceof GiftPremiumBottomSheet.GiftTier) { return a.object == b.object; @@ -888,9 +1015,9 @@ public boolean equals(UItem a, UItem b) { final TL_stars.StarGift ag = (TL_stars.StarGift) a.object; final TL_stars.StarGift bg = (TL_stars.StarGift) b.object; return ag.id == bg.id; - } else if (a.object instanceof TL_stars.UserStarGift && b.object instanceof TL_stars.UserStarGift) { - final TL_stars.UserStarGift ag = (TL_stars.UserStarGift) a.object; - final TL_stars.UserStarGift bg = (TL_stars.UserStarGift) b.object; + } else if (a.object instanceof TL_stars.SavedStarGift && b.object instanceof TL_stars.SavedStarGift) { + final TL_stars.SavedStarGift ag = (TL_stars.SavedStarGift) a.object; + final TL_stars.SavedStarGift bg = (TL_stars.SavedStarGift) b.object; return ag.gift.id == bg.gift.id; } } @@ -902,73 +1029,139 @@ public boolean equals(UItem a, UItem b) { ); } } + + private final Rect cardBackgroundPadding = new Rect(); + @Override + public void getBounds(RectF bounds) { + cardBackground.getPadding(cardBackgroundPadding); + bounds.set(cardBackgroundPadding.left, cardBackgroundPadding.top, getWidth() - cardBackgroundPadding.right, getHeight() - cardBackgroundPadding.bottom); + } } - public static class Ribbon extends View { + public static class RibbonDrawable extends CompatDrawable { - private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); - private Path path = new Path(); private Text text; + private Path path = new Path(); - public Ribbon(Context context) { - super(context); + public static void fillRibbonPath(Path path, float s) { + path.rewind(); + path.moveTo(dp(s * 46.83f), dp(s * 24.5f)); + path.lineTo(dp(s * 23.5f), dp(s * 1.17f)); + path.cubicTo(dp(s * 22.75f), dp(s * 0.42f), dp(s * 21.73f), 0f, dp(s * 20.68f), 0f); + path.cubicTo(dp(s * 19.62f), 0f, dp(s * 2.73f), dp(s * 0.05f), dp(s * 1.55f), dp(s * 0.05f)); + path.cubicTo(dp(s * 0.36f), dp(s * 0.05f), dp(s * -0.23f), dp(s * 1.4885f), dp(s * 0.6f), dp(s * 2.32f)); + path.lineTo(dp(s * 45.72f), dp(s * 47.44f)); + path.cubicTo(dp(s * 46.56f), dp(s * 48.28f), dp(s * 48f), dp(s * 47.68f), dp(s * 48f), dp(s * 46.5f)); + path.cubicTo(dp(s * 48f), dp(s * 45.31f), dp(s * 48f), dp(s * 28.38f), dp(s * 48f), dp(s * 27.32f)); + path.cubicTo(dp(s * 48f), dp(s * 26.26f), dp(s * 47.5f), dp(s * 25.24f), dp(s * 46.82f), dp(s * 24.5f)); + path.close(); + } + + public RibbonDrawable(View view, float scale) { + super(view); + fillRibbonPath(path, scale); paint.setColor(0xFFF55951); paint.setPathEffect(new CornerPathEffect(dp(2.33f))); } public void setColor(int color) { + paint.setShader(null); paint.setColor(color); } - public void setText(CharSequence text, boolean bold) { - setText(bold ? 10 : 11, text, bold); + public void setColors(int color1, int color2) { + paint.setShader(new LinearGradient(0, 0, dp(48), dp(48), new int[]{ color1, color2 }, new float[] { 0, 1 }, Shader.TileMode.CLAMP)); } - public void setText(int textSizeDp, CharSequence text, boolean bold) { - this.text = new Text(text, textSizeDp, bold ? AndroidUtilities.bold() : null); - invalidate(); + public void setBackdrop(TL_stars.starGiftAttributeBackdrop backdrop, boolean swap) { + if (backdrop == null) { + paint.setShader(null); + } else { + paint.setShader(new LinearGradient(0, 0, dp(48), dp(48), new int[]{ + Theme.adaptHSV(backdrop.center_color | 0xFF000000, swap ? +0.07f : +0.05f, swap ? -0.15f : -0.1f), + Theme.adaptHSV(backdrop.edge_color | 0xFF000000, swap ? +0.07f : +0.05f, swap ? -0.15f : -0.1f) + }, new float[] { swap ? 1 : 0, swap ? 0 : 1 }, Shader.TileMode.CLAMP)); + } } - public static void fillRibbonPath(Path path, float s) { - path.rewind(); - path.moveTo(dp(s * 46.83f), dp(s * 24.5f)); - path.lineTo(dp(s * 23.5f), dp(s * 1.17f)); - path.cubicTo(dp(s * 22.75f), dp(s * 0.42f), dp(s * 21.73f), 0f, dp(s * 20.68f), 0f); - path.cubicTo(dp(s * 19.62f), 0f, dp(s * 2.73f), dp(s * 0.05f), dp(s * 1.55f), dp(s * 0.05f)); - path.cubicTo(dp(s * 0.36f), dp(s * 0.05f), dp(s * -0.23f), dp(s * 1.4885f), dp(s * 0.6f), dp(s * 2.32f)); - path.lineTo(dp(s * 45.72f), dp(s * 47.44f)); - path.cubicTo(dp(s * 46.56f), dp(s * 48.28f), dp(s * 48f), dp(s * 47.68f), dp(s * 48f), dp(s * 46.5f)); - path.cubicTo(dp(s * 48f), dp(s * 45.31f), dp(s * 48f), dp(s * 28.38f), dp(s * 48f), dp(s * 27.32f)); - path.cubicTo(dp(s * 48f), dp(s * 26.26f), dp(s * 47.5f), dp(s * 25.24f), dp(s * 46.82f), dp(s * 24.5f)); - path.close(); + public void setText(int textSizeDp, CharSequence text, boolean bold) { + this.text = new Text(text, textSizeDp, bold ? AndroidUtilities.bold() : null); } - @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - fillRibbonPath(path, 1f); - setMeasuredDimension(dp(48), dp(48)); + private int textColor = 0xFFFFFFFF; + public void setTextColor(int textColor) { + this.textColor = textColor; } @Override - protected void dispatchDraw(@NonNull Canvas canvas) { + public void draw(@NonNull Canvas canvas) { + canvas.save(); + canvas.translate(getBounds().left, getBounds().top); canvas.drawPath(path, paint); if (text != null) { canvas.save(); - canvas.rotate(45, getWidth() / 2f + dp(6), getHeight() / 2f - dp(6)); + canvas.rotate(45, getBounds().width() / 2f + dp(6), getBounds().height() / 2f - dp(6)); final float scale = Math.min(1, dp(40) / text.getCurrentWidth()); - canvas.scale(scale, scale, getWidth() / 2f + dp(6), getHeight() / 2f - dp(6)); - text.draw(canvas, getWidth() / 2f + dp(6) - text.getWidth() / 2f, getHeight() / 2f - dp(5), 0xFFFFFFFF, 1f); + canvas.scale(scale, scale, getBounds().width() / 2f + dp(6), getBounds().height() / 2f - dp(6)); + text.draw(canvas, getBounds().width() / 2f + dp(6) - text.getWidth() / 2f, getBounds().height() / 2f - dp(5), textColor, 1f); canvas.restore(); } + canvas.restore(); + } + } + + public static class Ribbon extends View { + + private RibbonDrawable drawable = new RibbonDrawable(this, 1.0f); + + public Ribbon(Context context) { + super(context); + } + + public void setText(CharSequence text, boolean bold) { + drawable.setText(bold ? 10 : 11, text, bold); + } + + public void setText(int textSizeDp, CharSequence text, boolean bold) { + drawable.setText(textSizeDp, text, bold); + } + + public void setColor(int color) { + drawable.setColor(color); + } + + public void setColors(int color1, int color2) { + drawable.setColors(color1, color2); + } + + public void setBackdrop(TL_stars.starGiftAttributeBackdrop backdrop) { + drawable.setBackdrop(backdrop, false); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + setMeasuredDimension(dp(48), dp(48)); + } + + @Override + protected void dispatchDraw(@NonNull Canvas canvas) { + drawable.setBounds(0, 0, getWidth(), getHeight()); + drawable.draw(canvas); } } public static class StarsBackground extends Drawable { + private final boolean white; + public StarsBackground(boolean white) { + this.white = white; + backgroundPaint.setColor(white ? 0x40FFFFFF : 0x40E8AB02); + } + public final RectF rectF = new RectF(); public final Path path = new Path(); - public final Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); { backgroundPaint.setColor(0x40E8AB02); } + public final Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); public final StarsReactionsSheet.Particles particles = new StarsReactionsSheet.Particles(StarsReactionsSheet.Particles.TYPE_RADIAL, 25); @Override @@ -982,7 +1175,7 @@ public void draw(@NonNull Canvas canvas) { canvas.clipPath(path); particles.setBounds(rectF); particles.process(); - particles.draw(canvas, 0xFFF0981D); + particles.draw(canvas, white ? 0xFFFFFFFF : 0xFFF0981D); canvas.restore(); invalidateSelf(); } @@ -1099,20 +1292,94 @@ public void didSetImage(ImageReceiver imageReceiver, boolean set, boolean thumb, public static class CardBackground extends Drawable { + private final View view; + private final Theme.ResourcesProvider resourcesProvider; public final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); private final RectF rect = new RectF(); + private final Path clipPath = new Path(); + + private TL_stars.starGiftAttributeBackdrop backdrop; + + private int gradientRadius; + private RadialGradient gradient; + private final Matrix gradientMatrix = new Matrix(); + private AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable pattern; - public CardBackground(Theme.ResourcesProvider resourcesProvider) { + private boolean selected; + private final Paint selectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private AnimatedFloat animatedSelected = new AnimatedFloat(this::invalidate, 320, CubicBezierInterpolator.EASE_OUT_QUINT); + + public CardBackground(View view, Theme.ResourcesProvider resourcesProvider, boolean withShadow) { + this.view = view; + this.resourcesProvider = resourcesProvider; + pattern = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(view, dp(28)) { + @Override + public void invalidate() { + super.invalidate(); + if (CardBackground.this.getCallback() != null) { + CardBackground.this.getCallback().invalidateDrawable(CardBackground.this); + } + } + }; + view.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() { + @Override + public void onViewAttachedToWindow(@NonNull View v) { + pattern.attach(); + } + @Override + public void onViewDetachedFromWindow(@NonNull View v) { + pattern.detach(); + } + }); + if (view.isAttachedToWindow()) pattern.attach(); paint.setColor(Theme.getColor(Theme.key_windowBackgroundWhite, resourcesProvider)); - paint.setShadowLayer(dp(2.66f), 0, dp(1.66f), Theme.getColor(Theme.key_dialogCardShadow, resourcesProvider)); + if (withShadow) { + paint.setShadowLayer(dp(1.66f), 0, dp(.33f), Theme.getColor(Theme.key_dialogCardShadow, resourcesProvider)); + } + selectedPaint.setStyle(Paint.Style.STROKE); } @Override public void draw(@NonNull Canvas canvas) { Rect bounds = getBounds(); + final float selected = animatedSelected.set(this.selected); rect.set(bounds); rect.inset(dp(3.33f), dp(4)); + if (backdrop != null) { + final int radius = lerp(Math.min(bounds.width(), bounds.height()), Math.max(bounds.width(), bounds.height()), 0.35f); + if (gradient == null || gradientRadius != radius) { + gradient = new RadialGradient(0, 0, gradientRadius = radius, new int[] { backdrop.center_color | 0xFF000000, backdrop.edge_color | 0xFF000000 }, new float[] { 0, 1 }, Shader.TileMode.CLAMP); + } + gradientMatrix.reset(); + gradientMatrix.postTranslate(bounds.centerX(), Math.min(dp(50), bounds.centerY())); + gradient.setLocalMatrix(gradientMatrix); + paint.setShader(gradient); + } else { + paint.setShader(null); + } canvas.drawRoundRect(rect, dp(11), dp(11), paint); + if (backdrop != null && !pattern.isEmpty()) { + pattern.setColor(backdrop.pattern_color | 0xFF000000); + canvas.save(); + clipPath.rewind(); + clipPath.addRoundRect(rect, dp(11), dp(11), Path.Direction.CW); + canvas.clipPath(clipPath); + canvas.translate(bounds.centerX(), bounds.centerY()); + final float s = lerp(1.0f, 0.925f, selected); + canvas.scale(s, s); + StarGiftPatterns.drawPattern(canvas, StarGiftPatterns.TYPE_GIFT, pattern, bounds.width(), bounds.height(), 1.0f, 1.0f); + canvas.restore(); + } + + if (selected > 0) { + selectedPaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhite, resourcesProvider)); + selectedPaint.setStrokeWidth(dpf2(2.33f)); + AndroidUtilities.rectTmp.set(rect); + final float b = lerp(-dpf2(2.33f), dp(5.166f), selected); + AndroidUtilities.rectTmp.inset(b, b); + final float r = lerp(dpf2(11), dpf2(6.66f), selected); + canvas.drawRoundRect(AndroidUtilities.rectTmp, r, r, selectedPaint); + } } @Override @@ -1127,18 +1394,44 @@ public boolean getPadding(@NonNull Rect padding) { } @Override - public void setAlpha(int alpha) { + public void setAlpha(int alpha) {} + @Override + public void setColorFilter(@Nullable ColorFilter colorFilter) {} + @Override + public int getOpacity() { + return PixelFormat.TRANSPARENT; + } + public void invalidate() { + view.invalidate(); + if (getCallback() != null) { + getCallback().invalidateDrawable(this); + } } - @Override - public void setColorFilter(@Nullable ColorFilter colorFilter) { + public void setBackdrop(TL_stars.starGiftAttributeBackdrop backdrop) { + if (this.backdrop != backdrop) { + gradient = null; + } + this.backdrop = backdrop; + invalidate(); + } + public void setPattern(TL_stars.starGiftAttributePattern pattern) { + if (pattern == null) { + this.pattern.set((Drawable) null, false); + } else { + this.pattern.set(pattern.document, false); + } } - @Override - public int getOpacity() { - return PixelFormat.TRANSPARENT; + public void setSelected(boolean selected, boolean animated) { + if (this.selected == selected) return; + this.selected = selected; + if (!animated) { + animatedSelected.force(selected); + } + invalidate(); } } @@ -1182,7 +1475,7 @@ protected void dispatchDraw(@NonNull Canvas canvas) { } else { ceiledRect.set(0,0,0,0); } - AndroidUtilities.lerp(flooredRect, ceiledRect, selected - flooredIndex, selectedRect); + lerp(flooredRect, ceiledRect, selected - flooredIndex, selectedRect); final float r = selectedRect.height() / 2f; canvas.drawRoundRect(selectedRect, r, r, selectedPaint); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Gifts/ProfileGiftsContainer.java b/TMessagesProj/src/main/java/org/telegram/ui/Gifts/ProfileGiftsContainer.java index a3c6edbdd2..c03c34b38d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Gifts/ProfileGiftsContainer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Gifts/ProfileGiftsContainer.java @@ -1,7 +1,7 @@ package org.telegram.ui.Gifts; import static org.telegram.messenger.AndroidUtilities.dp; -import static org.telegram.messenger.MessagesController.getInstance; +import static org.telegram.messenger.LocaleController.getString; import android.content.Context; import android.graphics.Paint; @@ -11,83 +11,89 @@ import android.view.Gravity; import android.view.View; import android.widget.FrameLayout; +import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; -import org.checkerframework.checker.units.qual.A; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.BirthdayController; +import org.telegram.messenger.ChatObject; +import org.telegram.messenger.DialogObject; import org.telegram.messenger.LocaleController; import org.telegram.messenger.MessagesController; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; import org.telegram.messenger.UserConfig; -import org.telegram.messenger.Utilities; +import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; import org.telegram.tgnet.tl.TL_stars; +import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Components.AnimatedEmojiSpan; +import org.telegram.ui.Components.BackupImageView; +import org.telegram.ui.Components.Bulletin; +import org.telegram.ui.Components.BulletinFactory; +import org.telegram.ui.Components.CheckBox2; import org.telegram.ui.Components.ColoredImageSpan; import org.telegram.ui.Components.FlickerLoadingView; +import org.telegram.ui.Components.ItemOptions; import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.LinkSpanDrawable; import org.telegram.ui.Components.Premium.boosts.UserSelectorBottomSheet; +import org.telegram.ui.Components.RLottieDrawable; import org.telegram.ui.Components.RecyclerListView; +import org.telegram.ui.Components.ScaleStateListAnimator; import org.telegram.ui.Components.UItem; import org.telegram.ui.Components.UniversalAdapter; import org.telegram.ui.Components.UniversalRecyclerView; +import org.telegram.ui.Stars.StarGiftSheet; import org.telegram.ui.Stars.StarsController; -import org.telegram.ui.Stars.StarsIntroActivity; -import org.telegram.ui.Stories.bots.BotPreviewsEditContainer; import org.telegram.ui.Stories.recorder.ButtonWithCounterView; import java.util.ArrayList; import java.util.HashSet; -import java.util.Map; import java.util.Objects; -import java.util.concurrent.ConcurrentHashMap; public class ProfileGiftsContainer extends FrameLayout implements NotificationCenter.NotificationCenterDelegate { + private final BaseFragment fragment; private final int currentAccount; - private final long userId; + private final long dialogId; private final StarsController.GiftsList list; private final Theme.ResourcesProvider resourcesProvider; + private final FrameLayout emptyView; + private final TextView emptyViewTitle; + private final TextView emptyViewButton; + private final UniversalRecyclerView listView; private final FrameLayout buttonContainer; + private final View buttonShadow; private final ButtonWithCounterView button; + private int buttonContainerHeightDp; - private long getRandomUserId() { - final ConcurrentHashMap map = MessagesController.getInstance(currentAccount).getUsers(); - final int size = map.size(); - if (size == 0) { - return 0; - } - final int randomIndex = Utilities.fastRandom.nextInt(size); - int currentIndex = 0; - for (Map.Entry entry : map.entrySet()) { - if (currentIndex == randomIndex) { - return entry.getValue().id; - } - currentIndex++; - } - return 0; - } + private final LinearLayout checkboxLayout; + private final TextView checkboxTextView; + private final CheckBox2 checkbox; + private final FrameLayout bulletinContainer; + + private int checkboxRequestId = -1; protected int processColor(int color) { return color; } - public ProfileGiftsContainer(Context context, int currentAccount, long userId, Theme.ResourcesProvider resourcesProvider) { + public ProfileGiftsContainer(BaseFragment fragment, Context context, int currentAccount, long dialogId, Theme.ResourcesProvider resourcesProvider) { super(context); + this.fragment = fragment; this.currentAccount = currentAccount; - this.userId = userId; - this.list = StarsController.getInstance(currentAccount).getProfileGiftsList(userId); + this.dialogId = dialogId; + this.list = StarsController.getInstance(currentAccount).getProfileGiftsList(dialogId); this.list.shown = true; + this.list.resetFilters(); this.list.load(); this.resourcesProvider = resourcesProvider; @@ -111,29 +117,133 @@ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { } }); + emptyView = new FrameLayout(context); + + LinearLayout emptyViewLayout = new LinearLayout(context); + emptyViewLayout.setOrientation(LinearLayout.VERTICAL); + emptyView.addView(emptyViewLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER)); + + BackupImageView emptyViewImage = new BackupImageView(context); + emptyViewImage.setImageDrawable(new RLottieDrawable(R.raw.utyan_empty, "utyan_empty", dp(120), dp(120))); + emptyViewLayout.addView(emptyViewImage, LayoutHelper.createLinear(120, 120, Gravity.CENTER_HORIZONTAL, 0, 0, 0, 0)); + + emptyViewTitle = new TextView(context); + emptyViewTitle.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 17); + emptyViewTitle.setTypeface(AndroidUtilities.bold()); + emptyViewTitle.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText, resourcesProvider)); + emptyViewTitle.setText("No matching gifts"); + emptyViewLayout.addView(emptyViewTitle, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 0, 12, 0, 0)); + + emptyViewButton = new TextView(context); + emptyViewButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + emptyViewButton.setTextColor(Theme.getColor(Theme.key_featuredStickers_addButton, resourcesProvider)); + emptyViewButton.setText("View All Gifts"); + emptyViewButton.setOnClickListener(v -> { + list.resetFilters(); + }); + emptyViewButton.setPadding(dp(10), dp(4), dp(10), dp(4)); + emptyViewButton.setBackground(Theme.createRadSelectorDrawable(Theme.multAlpha(Theme.getColor(Theme.key_featuredStickers_addButton, resourcesProvider), .10f), 4, 4)); + ScaleStateListAnimator.apply(emptyViewButton); + emptyViewLayout.addView(emptyViewButton, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 0, 8, 0, 0)); + + addView(emptyView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL)); + listView.setEmptyView(emptyView); + buttonContainer = new FrameLayout(context); buttonContainer.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite, resourcesProvider)); addView(buttonContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.FILL_HORIZONTAL | Gravity.BOTTOM)); - final View buttonShadow = new View(context); + buttonShadow = new View(context); buttonShadow.setBackgroundColor(Theme.getColor(Theme.key_dialogGrayLine, resourcesProvider)); buttonContainer.addView(buttonShadow, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 1f / AndroidUtilities.density, Gravity.FILL_HORIZONTAL | Gravity.TOP)); + bulletinContainer = new FrameLayout(context); + + checkboxLayout = new LinearLayout(context); + checkboxLayout.setPadding(dp(12), dp(8), dp(12), dp(8)); + checkboxLayout.setClipToPadding(false); + checkboxLayout.setOrientation(LinearLayout.HORIZONTAL); + checkboxLayout.setBackground(Theme.createRadSelectorDrawable(Theme.getColor(Theme.key_listSelector, resourcesProvider), 6, 6)); + checkbox = new CheckBox2(context, 24, resourcesProvider); + checkbox.setColor(Theme.key_radioBackgroundChecked, Theme.key_checkboxDisabled, Theme.key_checkboxCheck); + checkbox.setDrawUnchecked(true); + checkbox.setChecked(false, false); + checkbox.setDrawBackgroundAsArc(10); + checkboxLayout.addView(checkbox, LayoutHelper.createLinear(26, 26, Gravity.CENTER_VERTICAL, 0, 0, 0, 0)); + checkboxTextView = new TextView(context); + checkboxTextView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack, resourcesProvider)); + checkboxTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + checkboxTextView.setText(LocaleController.getString(R.string.Gift2ChannelNotify)); + checkboxLayout.addView(checkboxTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, 9, 0, 0, 0)); + buttonContainer.addView(checkboxLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 38, Gravity.CENTER, 0, 1f / AndroidUtilities.density + 6, 0, 6)); + ScaleStateListAnimator.apply(checkboxLayout, 0.025f, 1.5f); + checkboxLayout.setOnClickListener(v -> { + checkbox.setChecked(!checkbox.isChecked(), true); + final boolean willBeNotified = checkbox.isChecked(); + BulletinFactory.of(bulletinContainer, resourcesProvider) + .createSimpleBulletinDetail(willBeNotified ? R.raw.silent_unmute : R.raw.silent_mute, getString(willBeNotified ? R.string.Gift2ChannelNotifyChecked : R.string.Gift2ChannelNotifyNotChecked)) + .show(); + + list.chat_notifications_enabled = willBeNotified; + if (checkboxRequestId >= 0) { + ConnectionsManager.getInstance(currentAccount).cancelRequest(checkboxRequestId, true); + checkboxRequestId = -1; + } + TL_stars.toggleChatStarGiftNotifications req = new TL_stars.toggleChatStarGiftNotifications(); + req.peer = MessagesController.getInstance(currentAccount).getInputPeer(dialogId); + req.enabled = willBeNotified; + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { + checkboxRequestId = -1; + if (err != null) { + BulletinFactory.of(bulletinContainer, resourcesProvider).showForError(err); + } + })); + }); + if (list.chat_notifications_enabled != null) { + checkbox.setChecked(list.chat_notifications_enabled, false); + } + button = new ButtonWithCounterView(context, resourcesProvider); - final SpannableStringBuilder sb = new SpannableStringBuilder("G " + LocaleController.getString(R.string.ProfileGiftsSend)); - final ColoredImageSpan span = new ColoredImageSpan(R.drawable.filled_gift_premium); + final SpannableStringBuilder sb = new SpannableStringBuilder("G " + LocaleController.getString(dialogId < 0 ? R.string.ProfileGiftsSendChannel : R.string.ProfileGiftsSend)); + final ColoredImageSpan span = new ColoredImageSpan(R.drawable.filled_gift_simple); sb.setSpan(span, 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); button.setText(sb, false); buttonContainer.addView(button, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.FILL, 10, 10 + 1f / AndroidUtilities.density, 10, 10)); button.setOnClickListener(v -> { UserSelectorBottomSheet.open(UserSelectorBottomSheet.TYPE_STAR_GIFT, 0, BirthdayController.getInstance(currentAccount).getState()); }); + + button.setVisibility(canSwitchNotify() ? View.GONE : View.VISIBLE); + checkboxLayout.setVisibility(canSwitchNotify() ? View.VISIBLE : View.GONE); + buttonContainerHeightDp = canSwitchNotify() ? 50 : 10 + 48 + 10; + + buttonContainer.setVisibility(dialogId >= 0 || ChatObject.canUserDoAction(MessagesController.getInstance(currentAccount).getChat(-dialogId), ChatObject.ACTION_POST) ? View.VISIBLE : View.GONE); + + addView(bulletinContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 200, Gravity.FILL_HORIZONTAL | Gravity.BOTTOM)); + } + + public boolean canFilter() { + if (dialogId >= 0) return false; + final TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-dialogId); + return ChatObject.canUserDoAction(chat, ChatObject.ACTION_POST); + } + + public boolean canSwitchNotify() { + if (dialogId >= 0) return false; + return list.chat_notifications_enabled != null; } @Override public void didReceivedNotification(int id, int account, Object... args) { if (id == NotificationCenter.starUserGiftsLoaded) { - if ((Long) args[0] == userId) { + if ((Long) args[0] == dialogId) { + button.setVisibility(canSwitchNotify() ? View.GONE : View.VISIBLE); + checkboxLayout.setVisibility(canSwitchNotify() ? View.VISIBLE : View.GONE); + buttonContainerHeightDp = canSwitchNotify() ? 50 : 10 + 48 + 10; + if (list.chat_notifications_enabled != null) { + checkbox.setChecked(list.chat_notifications_enabled, true); + } + if (listView != null && listView.adapter != null) { listView.adapter.update(true); } @@ -141,6 +251,11 @@ public void didReceivedNotification(int id, int account, Object... args) { list.load(); } } + } else if (id == NotificationCenter.updateInterfaces) { + button.setVisibility(canSwitchNotify() ? View.GONE : View.VISIBLE); + checkboxLayout.setVisibility(canSwitchNotify() ? View.VISIBLE : View.GONE); + buttonContainerHeightDp = canSwitchNotify() ? 50 : 10 + 48 + 10; + setVisibleHeight(visibleHeight); } } @@ -156,6 +271,7 @@ private boolean isLoadingVisible() { protected void onAttachedToWindow() { super.onAttachedToWindow(); NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.starUserGiftsLoaded); + NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.updateInterfaces); if (listView != null && listView.adapter != null) { listView.adapter.update(false); } @@ -169,15 +285,25 @@ protected void onAttachedToWindow() { protected void onDetachedFromWindow() { super.onDetachedFromWindow(); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.starUserGiftsLoaded); + NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.updateInterfaces); if (list != null) { list.shown = false; } } + public StarsController.GiftsList getList() { + return list; + } + public int getGiftsCount() { if (list != null && list.totalCount > 0) return list.totalCount; - final TLRPC.UserFull userFull = MessagesController.getInstance(currentAccount).getUserFull(userId); - return userFull != null ? userFull.stargifts_count : 0; + if (dialogId >= 0) { + final TLRPC.UserFull userFull = MessagesController.getInstance(currentAccount).getUserFull(dialogId); + return userFull != null ? userFull.stargifts_count : 0; + } else { + final TLRPC.ChatFull chatFull = MessagesController.getInstance(currentAccount).getChatFull(-dialogId); + return chatFull != null ? chatFull.stargifts_count : 0; + } } public CharSequence getLastEmojis(Paint.FontMetricsInt fontMetricsInt) { @@ -186,17 +312,21 @@ public CharSequence getLastEmojis(Paint.FontMetricsInt fontMetricsInt) { final HashSet giftsIds = new HashSet<>(); final ArrayList gifts = new ArrayList<>(); for (int i = 0; gifts.size() < 3 && i < list.gifts.size(); ++i) { - final TL_stars.UserStarGift gift = list.gifts.get(i); - if (giftsIds.contains(gift.gift.sticker.id)) continue; - giftsIds.add(gift.gift.sticker.id); - gifts.add(gift.gift.sticker); + final TL_stars.SavedStarGift gift = list.gifts.get(i); + final TLRPC.Document doc = gift.gift.getDocument(); + if (doc == null) continue; + if (giftsIds.contains(doc.id)) continue; + giftsIds.add(doc.id); + gifts.add(doc); } if (gifts.isEmpty()) return ""; - SpannableStringBuilder ssb = new SpannableStringBuilder(" "); + final SpannableStringBuilder ssb = new SpannableStringBuilder(" "); for (int i = 0; i < gifts.size(); ++i) { - SpannableStringBuilder emoji = new SpannableStringBuilder("x"); - emoji.setSpan(new AnimatedEmojiSpan(gifts.get(i), .9f, fontMetricsInt), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + final SpannableStringBuilder emoji = new SpannableStringBuilder("x"); + final TLRPC.Document sticker = gifts.get(i); + final AnimatedEmojiSpan span = new AnimatedEmojiSpan(sticker, .9f, fontMetricsInt); + emoji.setSpan(span, 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); ssb.append(emoji); } return ssb; @@ -209,10 +339,11 @@ public long getLastEmojisHash() { int giftsCount = 0; final HashSet giftsIds = new HashSet<>(); for (int i = 0; giftsCount < 3 && i < list.gifts.size(); ++i) { - final TL_stars.UserStarGift gift = list.gifts.get(i); - if (giftsIds.contains(gift.gift.sticker.id)) continue; - giftsIds.add(gift.gift.sticker.id); - hash = Objects.hash(hash, gift.gift.sticker.id); + final TL_stars.SavedStarGift gift = list.gifts.get(i); + final TLRPC.Document doc = gift.gift.getDocument(); + if (doc == null) continue; + giftsIds.add(doc.id); + hash = Objects.hash(hash, doc.id); giftsCount++; } @@ -222,10 +353,19 @@ public long getLastEmojisHash() { private int visibleHeight = AndroidUtilities.displaySize.y; public void setVisibleHeight(int height) { visibleHeight = height; -// buttonContainer.setTranslationY(-buttonContainer.getTop() + height - dp(48 + 10 + 10 + 1f / AndroidUtilities.density)); + if (canSwitchNotify()) { + bulletinContainer.setTranslationY(-bulletinContainer.getTop() + height - dp(buttonContainerHeightDp) - 1 - dp(200)); + buttonContainer.setTranslationY(-buttonContainer.getTop() + height - dp(buttonContainerHeightDp) - 1); + } else { + bulletinContainer.setTranslationY(0); + buttonContainer.setTranslationY(0); + } } public void fillItems(ArrayList items, UniversalAdapter adapter) { + if (list.hasFilters() && list.gifts.size() <= 0 && list.endReached && !list.loading) { + return; + } final int spanCount = Math.max(1, list == null || list.totalCount == 0 ? 3 : Math.min(3, list.totalCount)); if (listView != null) { listView.setSpanCount(spanCount); @@ -233,8 +373,8 @@ public void fillItems(ArrayList items, UniversalAdapter adapter) { items.add(UItem.asSpace(dp(12))); if (list != null) { int spanCountLeft = 3; - for (TL_stars.UserStarGift userGift : list.gifts) { - items.add(GiftSheet.GiftCell.Factory.asStarGift(0, userGift)); + for (TL_stars.SavedStarGift userGift : list.gifts) { + items.add(GiftSheet.GiftCell.Factory.asStarGift(0, userGift, true)); spanCountLeft--; if (spanCountLeft == 0) { spanCountLeft = 3; @@ -242,25 +382,76 @@ public void fillItems(ArrayList items, UniversalAdapter adapter) { } if (list.loading || !list.endReached) { for (int i = 0; i < (spanCountLeft <= 0 ? 3 : spanCountLeft); ++i) { - items.add(UItem.asFlicker(i, FlickerLoadingView.STAR_GIFT).setSpanCount(1)); + items.add(UItem.asFlicker(1 + i, FlickerLoadingView.STAR_GIFT).setSpanCount(1)); } } } items.add(UItem.asSpace(dp(20))); - if (userId == UserConfig.getInstance(currentAccount).getClientUserId()) { + if (dialogId == UserConfig.getInstance(currentAccount).getClientUserId()) { items.add(TextFactory.asText(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2, resourcesProvider), Gravity.CENTER, 14, LocaleController.getString(R.string.ProfileGiftsInfo), true, dp(24))); } items.add(UItem.asSpace(dp(24 + 48 + 10))); } public void onItemClick(UItem item, View view, int position, float x, float y) { - if (item.object instanceof TL_stars.UserStarGift) { - final TL_stars.UserStarGift userGift = (TL_stars.UserStarGift) item.object; - StarsIntroActivity.showGiftSheet(getContext(), currentAccount, userId, userId == UserConfig.getInstance(currentAccount).getClientUserId(), userGift, resourcesProvider); + if (item.object instanceof TL_stars.SavedStarGift) { + final TL_stars.SavedStarGift userGift = (TL_stars.SavedStarGift) item.object; + new StarGiftSheet(getContext(), currentAccount, dialogId, resourcesProvider) + .set(userGift) + .show(); } } public boolean onItemLongPress(UItem item, View view, int position, float x, float y) { + if (item.object instanceof TL_stars.SavedStarGift) { + final TL_stars.SavedStarGift savedStarGift = (TL_stars.SavedStarGift) item.object; + if (savedStarGift.gift instanceof TL_stars.TL_starGiftUnique) { + final String link; + if (savedStarGift.gift.slug != null) { + link = MessagesController.getInstance(currentAccount).linkPrefix + "/nft/" + savedStarGift.gift.slug; + } else { + link = null; + } + final TL_stars.TL_starGiftUnique gift = (TL_stars.TL_starGiftUnique) savedStarGift.gift; + final long selfId = UserConfig.getInstance(currentAccount).getClientUserId(); + final boolean canTransfer = DialogObject.getPeerDialogId(gift.owner_id) == selfId; + final boolean myProfile = dialogId == selfId; + final ItemOptions o = ItemOptions.makeOptions(fragment, view); + o.addIf(link != null, R.drawable.msg_link, getString(R.string.CopyLink), () -> { + AndroidUtilities.addToClipboard(link); + BulletinFactory.of(fragment) + .createCopyLinkBulletin(false) + .show(); + }); + o.addIf(link != null, R.drawable.msg_share, getString(R.string.ShareFile), () -> { + new StarGiftSheet(getContext(), currentAccount, dialogId, resourcesProvider) { + @Override + protected BulletinFactory getBulletinFactory() { + return BulletinFactory.of(fragment); + } + } + .set(savedStarGift) + .onSharePressed(null); + }); + o.addIf(canTransfer, R.drawable.menu_feature_transfer, getString(R.string.Gift2TransferOption), () -> { + new StarGiftSheet(getContext(), currentAccount, dialogId, resourcesProvider) { + @Override + protected BulletinFactory getBulletinFactory() { + return BulletinFactory.of(fragment); + } + } + .set(savedStarGift) + .openTransfer(); + }); + if (o.getItemsCount() <= 0) { + return false; + } + o.setGravity(Gravity.LEFT); + o.setBlur(true); + o.show(); + return true; + } + } return false; } @@ -316,9 +507,15 @@ public static UItem asText(int color, int gravity, float textSizeDp, CharSequenc } public void updateColors() { - if (button != null) { - button.setBackground(Theme.createRoundRectDrawable(dp(8), processColor(Theme.getColor(Theme.key_featuredStickers_addButton, resourcesProvider)))); - } + button.updateColors(); + button.setBackground(Theme.createRoundRectDrawable(dp(8), processColor(Theme.getColor(Theme.key_featuredStickers_addButton, resourcesProvider)))); + emptyViewTitle.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText, resourcesProvider)); + emptyViewButton.setTextColor(Theme.getColor(Theme.key_featuredStickers_addButton, resourcesProvider)); + emptyViewButton.setBackground(Theme.createRadSelectorDrawable(Theme.multAlpha(Theme.getColor(Theme.key_featuredStickers_addButton, resourcesProvider), .10f), 4, 4)); + buttonContainer.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite, resourcesProvider)); + buttonShadow.setBackgroundColor(Theme.getColor(Theme.key_dialogGrayLine, resourcesProvider)); + checkboxTextView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack, resourcesProvider)); + checkboxLayout.setBackground(Theme.createRadSelectorDrawable(Theme.getColor(Theme.key_listSelector, resourcesProvider), 6, 6)); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Gifts/SendGiftSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Gifts/SendGiftSheet.java index 1262caa886..61c98e4ee6 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Gifts/SendGiftSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Gifts/SendGiftSheet.java @@ -5,29 +5,14 @@ import static org.telegram.messenger.LocaleController.formatString; import static org.telegram.messenger.LocaleController.getString; -import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; -import android.animation.ValueAnimator; import android.app.Activity; import android.content.Context; import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.LinearGradient; -import android.graphics.Matrix; -import android.graphics.Paint; -import android.graphics.Path; -import android.graphics.PorterDuff; -import android.graphics.PorterDuffColorFilter; -import android.graphics.RectF; -import android.graphics.Shader; -import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.util.TypedValue; import android.view.Gravity; -import android.view.MotionEvent; import android.view.View; -import android.view.ViewConfiguration; import android.widget.FrameLayout; import android.widget.LinearLayout; import android.widget.TextView; @@ -38,7 +23,6 @@ import com.android.billingclient.api.BillingClient; import com.android.billingclient.api.BillingFlowParams; import com.android.billingclient.api.ProductDetails; -import com.google.zxing.common.detector.MathUtils; import org.telegram.messenger.AccountInstance; import org.telegram.messenger.AndroidUtilities; @@ -66,8 +50,6 @@ import org.telegram.ui.Cells.EditEmojiTextCell; import org.telegram.ui.ChatActivity; import org.telegram.ui.Components.AlertsCreator; -import org.telegram.ui.Components.AnimatedFloat; -import org.telegram.ui.Components.AnimatedTextView; import org.telegram.ui.Components.BottomSheetWithRecyclerListView; import org.telegram.ui.Components.ColoredImageSpan; import org.telegram.ui.Components.CubicBezierInterpolator; @@ -80,15 +62,13 @@ import org.telegram.ui.Components.Premium.boosts.PremiumPreviewGiftSentBottomSheet; import org.telegram.ui.Components.RecyclerListView; import org.telegram.ui.Components.SizeNotifierFrameLayout; -import org.telegram.ui.Components.Text; import org.telegram.ui.Components.UItem; import org.telegram.ui.Components.UniversalAdapter; import org.telegram.ui.LaunchActivity; import org.telegram.ui.ProfileActivity; +import org.telegram.ui.Stars.StarGiftSheet; import org.telegram.ui.Stars.StarsController; import org.telegram.ui.Stars.StarsIntroActivity; -import org.telegram.ui.Stars.StarsReactionsSheet; -import org.telegram.ui.Stories.bots.BotPreviewsEditContainer; import org.telegram.ui.Stories.recorder.ButtonWithCounterView; import org.telegram.ui.Stories.recorder.PreviewView; @@ -100,6 +80,7 @@ public class SendGiftSheet extends BottomSheetWithRecyclerListView { + private final boolean self; private final int currentAccount; private final long dialogId; private final TL_stars.StarGift starGift; @@ -123,6 +104,7 @@ public class SendGiftSheet extends BottomSheetWithRecyclerListView { private final TextView leftTextView, leftTextView2; public boolean anonymous; + public boolean upgrade = false; private EditEmojiTextCell messageEdit; @@ -141,11 +123,15 @@ public SendGiftSheet(Context context, int currentAccount, GiftPremiumBottomSheet private SendGiftSheet(Context context, int currentAccount, TL_stars.StarGift starGift, GiftPremiumBottomSheet.GiftTier premiumTier, long dialogId, Runnable closeParentSheet) { super(context, null, true, false, false, false, ActionBarType.SLIDING, null); + self = dialogId == UserConfig.getInstance(currentAccount).getClientUserId(); setImageReceiverNumLevel(0, 4); fixNavigationBar(); // setSlidingActionBar(); headerPaddingTop = dp(4); headerPaddingBottom = dp(-10); + if (self) { + anonymous = true; + } this.currentAccount = currentAccount; this.dialogId = dialogId; @@ -155,8 +141,13 @@ private SendGiftSheet(Context context, int currentAccount, TL_stars.StarGift sta topPadding = 0.2f; - final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(dialogId); - this.name = UserObject.getForcedFirstName((TLRPC.User) user); + if (dialogId >= 0) { + final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(dialogId); + this.name = UserObject.getForcedFirstName(user); + } else { + final TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-dialogId); + this.name = chat == null ? "" : chat.title; + } actionCell = new ChatActionCell(context, false, resourcesProvider); actionCell.setDelegate(new ChatActionCell.ChatActionCellDelegate() {}); @@ -233,6 +224,12 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) { } else { throw new RuntimeException("SendGiftSheet with no star gift and no premium tier"); } + if (action instanceof TLRPC.TL_messageActionStarGift) { + TLRPC.TL_messageActionStarGift thisAction = (TLRPC.TL_messageActionStarGift) action; + thisAction.can_upgrade = upgrade || self && starGift != null && starGift.can_upgrade; + thisAction.upgrade_stars = self ? 0 : upgrade ? this.starGift.upgrade_stars : 0; + thisAction.convert_stars = upgrade ? 0 : this.starGift.convert_stars; + } TLRPC.TL_messageService message = new TLRPC.TL_messageService(); message.id = 1; @@ -297,20 +294,6 @@ protected float animateByScale(View view) { recyclerListView.setPadding(backgroundPaddingLeft, 0, backgroundPaddingLeft, dp(48 + 10 + 10 + (starGift != null && starGift.limited ? 30 + 10 : 0))); adapter.update(false); - recyclerListView.setOnItemClickListener((view, position) -> { - final UItem item = adapter.getItem(reverseLayout ? position : position - 1); - if (item == null) return; - if (item.id == 1) { - anonymous = !anonymous; - if (action instanceof TLRPC.TL_messageActionStarGift) { - ((TLRPC.TL_messageActionStarGift) action).name_hidden = anonymous; - } - messageObject.updateMessageText(); - actionCell.setMessageObject(messageObject, true); - adapter.update(true); - } - }); - buttonContainer = new LinearLayout(context); buttonContainer.setOrientation(LinearLayout.VERTICAL); buttonContainer.setBackgroundColor(Theme.getColor(Theme.key_dialogBackground, resourcesProvider)); @@ -394,7 +377,7 @@ protected void dispatchDraw(@NonNull Canvas canvas) { button = new ButtonWithCounterView(context, resourcesProvider); if (starGift != null) { - button.setText(StarsIntroActivity.replaceStars(LocaleController.formatPluralStringComma("Gift2Send", (int) this.starGift.stars)), false); + button.setText(StarsIntroActivity.replaceStars(LocaleController.formatPluralStringComma(self ? "Gift2SendSelf" : "Gift2Send", (int) (this.starGift.stars + (upgrade ? this.starGift.upgrade_stars : 0))), cachedStarSpan), false); } else if (premiumTier != null) { button.setText(LocaleController.formatString(R.string.Gift2SendPremium, premiumTier.getFormattedPrice()), false); } @@ -417,8 +400,37 @@ protected void dispatchDraw(@NonNull Canvas canvas) { layoutManager.setReverseLayout(reverseLayout = true); adapter.update(false); layoutManager.scrollToPositionWithOffset(adapter.getItemCount(), dp(200)); + + recyclerListView.setOnItemClickListener((view, position) -> { + final UItem item = adapter.getItem(reverseLayout ? position : position - 1); + if (item == null) return; + if (item.id == 1) { + anonymous = !anonymous; + if (action instanceof TLRPC.TL_messageActionStarGift) { + ((TLRPC.TL_messageActionStarGift) action).name_hidden = anonymous; + } + messageObject.updateMessageText(); + actionCell.setMessageObject(messageObject, true); + adapter.update(true); + } else if (item.id == 2) { + upgrade = !upgrade; + if (action instanceof TLRPC.TL_messageActionStarGift) { + TLRPC.TL_messageActionStarGift thisAction = (TLRPC.TL_messageActionStarGift) action; + thisAction.can_upgrade = upgrade || self && starGift != null && starGift.can_upgrade; + thisAction.upgrade_stars = self ? 0 : upgrade ? this.starGift.upgrade_stars : 0; + thisAction.convert_stars = upgrade ? 0 : this.starGift.convert_stars; + } + messageObject.updateMessageText(); + actionCell.setMessageObject(messageObject, true); + adapter.update(true); + button.setText(StarsIntroActivity.replaceStars(LocaleController.formatPluralStringComma(self ? "Gift2SendSelf" : "Gift2Send", (int) (this.starGift.stars + (upgrade ? this.starGift.upgrade_stars : 0))), cachedStarSpan), true); + } + }); + actionBar.setTitle(getTitle()); } + private final ColoredImageSpan[] cachedStarSpan = new ColoredImageSpan[1]; + private TLRPC.TL_textWithEntities getMessage() { if (action instanceof TLRPC.TL_messageActionStarGift) { return ((TLRPC.TL_messageActionStarGift) action).message; @@ -433,9 +445,9 @@ private TLRPC.TL_textWithEntities getMessage() { private void buyStarGift() { StarsController.getInstance(currentAccount).buyStarGift( - AndroidUtilities.getActivity(getContext()), this.starGift, anonymous, + upgrade, dialogId, getMessage(), (status, err) -> { @@ -580,7 +592,7 @@ private void onGiftSuccess(boolean fromGooglePlay) { @Override protected CharSequence getTitle() { - return getString(R.string.Gift2Title); + return getString(self ? R.string.Gift2TitleSelf2 : R.string.Gift2Title); } @Override @@ -594,9 +606,18 @@ public void fillItems(ArrayList items, UniversalAdapter adapter) { items.add(UItem.asCustom(-1, chatView)); items.add(UItem.asCustom(-2, messageEdit)); if (starGift != null) { - items.add(UItem.asShadow(-3, null)); - items.add(UItem.asCheck(1, getString(R.string.Gift2Hide)).setChecked(anonymous)); - items.add(UItem.asShadow(-4, formatString(R.string.Gift2HideInfo, name))); + if (starGift.can_upgrade && !self) { + items.add(UItem.asShadow(-3, null)); + items.add(UItem.asCheck(2, StarsIntroActivity.replaceStarsWithPlain(formatString(self ? R.string.Gift2UpgradeSelf : R.string.Gift2Upgrade, (int) starGift.upgrade_stars), .78f)).setChecked(upgrade)); + items.add(UItem.asShadow(-5, AndroidUtilities.replaceArrows(AndroidUtilities.replaceSingleTag(self ? getString(R.string.Gift2UpgradeSelfInfo) : formatString(dialogId >= 0 ? R.string.Gift2UpgradeInfo : R.string.Gift2UpgradeChannelInfo, name), () -> { + new StarGiftSheet(getContext(), currentAccount, dialogId, resourcesProvider) + .openAsLearnMore(starGift.id, name); + }), true))); + } else { + items.add(UItem.asShadow(-5, null)); + } + items.add(UItem.asCheck(1, getString(self ? R.string.Gift2HideSelf : R.string.Gift2Hide)).setChecked(anonymous)); + items.add(UItem.asShadow(-6, self ? getString(R.string.Gift2HideSelfInfo) : dialogId < 0 ? getString(R.string.Gift2HideChannelInfo) : formatString(R.string.Gift2HideInfo, name))); } else { items.add(UItem.asShadow(-3, formatString(R.string.Gift2MessagePremiumInfo, name))); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/GroupCallActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/GroupCallActivity.java index 0ca593f9d2..a617b8d73d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/GroupCallActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/GroupCallActivity.java @@ -101,6 +101,7 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_phone; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenuItem; import org.telegram.ui.ActionBar.ActionBarMenuSubItem; @@ -441,7 +442,9 @@ public void run() { if (call == null || !scheduled || VoIPService.getSharedInstance() == null) { return; } - muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} updateMuteButton(MUTE_BUTTON_STATE_MUTE, true); AndroidUtilities.runOnUIThread(unmuteRunnable, 80); scheduled = false; @@ -1926,7 +1929,7 @@ public void onItemClick(int id) { chatFull.call = null; accountInstance.getNotificationCenter().postNotificationName(NotificationCenter.groupCallUpdated, currentChat.id, call.call.id, false); } - TLRPC.TL_phone_discardGroupCall req = new TLRPC.TL_phone_discardGroupCall(); + TL_phone.discardGroupCall req = new TL_phone.discardGroupCall(); req.call = call.getInputGroupCall(); accountInstance.getConnectionsManager().sendRequest(req, (response, error) -> { if (response instanceof TLRPC.TL_updates) { @@ -2127,7 +2130,9 @@ public void afterTextChanged(Editable s) { ignoreTextChange = true; s.delete(40, s.length()); AndroidUtilities.shakeView(editText); - editText.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + editText.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} ignoreTextChange = false; } } @@ -2184,7 +2189,7 @@ public void afterTextChanged(Editable s) { chatFull.flags |= 67108864; } } - TLRPC.TL_phone_saveDefaultGroupCallJoinAs req = new TLRPC.TL_phone_saveDefaultGroupCallJoinAs(); + TL_phone.saveDefaultGroupCallJoinAs req = new TL_phone.saveDefaultGroupCallJoinAs(); req.peer = MessagesController.getInputPeer(currentChat); req.join_as = peer1; accountInstance.getConnectionsManager().sendRequest(req, (response, error) -> { @@ -4312,7 +4317,9 @@ public boolean onTouchEvent(MotionEvent event) { updateMuteButton(MUTE_BUTTON_STATE_UNMUTE, true); if (VoIPService.getSharedInstance() != null) { VoIPService.getSharedInstance().setMicMute(true, true, false); - muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} } attachedRenderersTmp.clear(); attachedRenderersTmp.addAll(attachedRenderers); @@ -4393,9 +4400,11 @@ public void onClick(View v) { if (startingGroupCall) { return; } - v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} startingGroupCall = true; - TLRPC.TL_phone_startScheduledGroupCall req = new TLRPC.TL_phone_startScheduledGroupCall(); + TL_phone.startScheduledGroupCall req = new TL_phone.startScheduledGroupCall(); req.call = call.getInputGroupCall(); accountInstance.getConnectionsManager().sendRequest(req, (response, error) -> { if (response != null) { @@ -4408,7 +4417,7 @@ public void onClick(View v) { reminderHintView.hide(); } } - TLRPC.TL_phone_toggleGroupCallStartSubscription req = new TLRPC.TL_phone_toggleGroupCallStartSubscription(); + TL_phone.toggleGroupCallStartSubscription req = new TL_phone.toggleGroupCallStartSubscription(); req.call = call.getInputGroupCall(); call.call.schedule_start_subscribed = !call.call.schedule_start_subscribed; req.subscribed = call.call.schedule_start_subscribed; @@ -4428,7 +4437,9 @@ public void onClick(View v) { } playingHandAnimation = true; AndroidUtilities.shakeView(muteLabel[0]); - v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} int num = Utilities.random.nextInt(100); int endFrame; int startFrame; @@ -4476,11 +4487,15 @@ public void onClick(View v) { } updateMuteButton(MUTE_BUTTON_STATE_MUTE, true); VoIPService.getSharedInstance().setMicMute(false, false, true); - muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} } else { updateMuteButton(MUTE_BUTTON_STATE_UNMUTE, true); VoIPService.getSharedInstance().setMicMute(true, false, true); - muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + muteButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} } } } @@ -4852,7 +4867,9 @@ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { }); fullscreenUsersListView.setOnItemLongClickListener((view, position) -> { if (showMenuForCell(view)) { - listView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + listView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} } return false; }); @@ -5226,7 +5243,7 @@ public void onAnimationEnd(Animator animation) { scheduleStartAt = (int) (calendar.getTimeInMillis() / 1000); updateScheduleUI(false); - TLRPC.TL_phone_createGroupCall req = new TLRPC.TL_phone_createGroupCall(); + TL_phone.createGroupCall req = new TL_phone.createGroupCall(); req.peer = MessagesController.getInputPeer(chat); req.random_id = Utilities.random.nextInt(); req.schedule_date = scheduleStartAt; @@ -5332,9 +5349,7 @@ public void requestLayout() { final NumberPicker.OnValueChangeListener onValueChangeListener = (picker, oldVal, newVal) -> { try { container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - } catch (Exception ignore) { - - } + } catch (Exception ignore) {} AlertsCreator.checkScheduleDate(scheduleButtonTextView, scheduleInfoTextView, 7 * 24 * 60 * 60, 2, dayPicker, hourPicker, minutePicker); }; dayPicker.setOnValueChangedListener(onValueChangeListener); @@ -6128,12 +6143,12 @@ private void getLink(boolean copy) { } for (int a = 0; a < 2; a++) { int num = a; - TLRPC.TL_phone_exportGroupCallInvite req = new TLRPC.TL_phone_exportGroupCallInvite(); + TL_phone.exportGroupCallInvite req = new TL_phone.exportGroupCallInvite(); req.call = call.getInputGroupCall(); req.can_self_unmute = a == 1; accountInstance.getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { - if (response instanceof TLRPC.TL_phone_exportedGroupCallInvite) { - TLRPC.TL_phone_exportedGroupCallInvite invite = (TLRPC.TL_phone_exportedGroupCallInvite) response; + if (response instanceof TL_phone.exportedGroupCallInvite) { + TL_phone.exportedGroupCallInvite invite = (TL_phone.exportedGroupCallInvite) response; invites[num] = invite.link; } else { invites[num] = ""; @@ -6229,7 +6244,7 @@ private void inviteUserToCall(long id, boolean shouldAdd) { return; } final AlertDialog[] progressDialog = new AlertDialog[]{new AlertDialog(getContext(), AlertDialog.ALERT_TYPE_SPINNER)}; - TLRPC.TL_phone_inviteToGroupCall req = new TLRPC.TL_phone_inviteToGroupCall(); + TL_phone.inviteToGroupCall req = new TL_phone.inviteToGroupCall(); req.call = call.getInputGroupCall(); TLRPC.TL_inputUser inputUser = new TLRPC.TL_inputUser(); inputUser.user_id = user.id; @@ -8603,7 +8618,7 @@ public void onChanged(int position, int count, @Nullable Object payload) { } private void toggleAdminSpeak() { - TLRPC.TL_phone_toggleGroupCallSettings req = new TLRPC.TL_phone_toggleGroupCallSettings(); + TL_phone.toggleGroupCallSettings req = new TL_phone.toggleGroupCallSettings(); req.call = call.getInputGroupCall(); req.join_muted = call.call.join_muted; req.flags |= 1; @@ -8784,7 +8799,7 @@ public void didUploadPhoto(TLRPC.InputFile photo, TLRPC.InputFile video, double } @Override - public void didStartUpload(boolean isVideo) { + public void didStartUpload(boolean fromAvatarConstructor, boolean isVideo) { } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateFinalActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateFinalActivity.java index c3889d8867..18cbac80a8 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateFinalActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateFinalActivity.java @@ -740,7 +740,7 @@ public void onUploadProgressChanged(float progress) { } @Override - public void didStartUpload(boolean isVideo) { + public void didStartUpload(boolean fromAvatarConstructor, boolean isVideo) { if (avatarProgressView == null) { return; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/IdenticonActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/IdenticonActivity.java index 46c36111b7..02663deb0f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/IdenticonActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/IdenticonActivity.java @@ -313,7 +313,7 @@ public boolean onPreDraw() { @Override public void onTransitionAnimationEnd(boolean isOpen, boolean backward) { if (isOpen && !backward && emojiText != null) { - emojiTextView.setText(Emoji.replaceEmoji(emojiText, emojiTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(32), false)); + emojiTextView.setText(Emoji.replaceEmoji(emojiText, emojiTextView.getPaint().getFontMetricsInt(), false)); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/IntroActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/IntroActivity.java index 12cffc1b01..dba6ad3a3f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/IntroActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/IntroActivity.java @@ -61,6 +61,7 @@ import org.telegram.messenger.UserConfig; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.Theme; @@ -495,8 +496,8 @@ private void checkContinueText() { req.keys.add("ContinueOnThisLanguage"); String finalSystemLang = systemLang; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { - if (response != null) { - TLRPC.Vector vector = (TLRPC.Vector) response; + if (response instanceof Vector) { + Vector vector = (Vector) response; if (vector.objects.isEmpty()) { return; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java index d5034057ca..f51766e0ac 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java @@ -130,7 +130,10 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; +import org.telegram.tgnet.tl.TL_account; import org.telegram.tgnet.tl.TL_chatlists; +import org.telegram.tgnet.tl.TL_stars; import org.telegram.tgnet.tl.TL_stories; import org.telegram.ui.ActionBar.ActionBarLayout; import org.telegram.ui.ActionBar.AlertDialog; @@ -191,6 +194,7 @@ import org.telegram.ui.Components.spoilers.SpoilerEffect2; import org.telegram.ui.Components.voip.VoIPHelper; import org.telegram.ui.Stars.ISuperRipple; +import org.telegram.ui.Stars.StarGiftSheet; import org.telegram.ui.Stars.StarsController; import org.telegram.ui.Stars.SuperRipple; import org.telegram.ui.Stars.SuperRippleFallback; @@ -1219,14 +1223,16 @@ public void showSelectStatusDialog() { boolean hasEmoji = false; AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable scrimDrawable = null; View scrimDrawableParent = null; + DrawerProfileCell profileCellCasted = null; if (profileCell instanceof DrawerProfileCell) { - scrimDrawable = ((DrawerProfileCell) profileCell).getEmojiStatusDrawable(); + profileCellCasted = (DrawerProfileCell) profileCell; + scrimDrawable = profileCellCasted.getEmojiStatusDrawable(); if (scrimDrawable != null) { scrimDrawable.play(); } - scrimDrawableParent = ((DrawerProfileCell) profileCell).getEmojiStatusDrawableParent(); + scrimDrawableParent = profileCellCasted.getEmojiStatusDrawableParent(); hasEmoji = scrimDrawable != null && scrimDrawable.getDrawable() instanceof AnimatedEmojiDrawable; - ((DrawerProfileCell) profileCell).getEmojiStatusLocation(AndroidUtilities.rectTmp2); + profileCellCasted.getEmojiStatusLocation(AndroidUtilities.rectTmp2); yoff = -(profileCell.getHeight() - AndroidUtilities.rectTmp2.centerY()) - AndroidUtilities.dp(16); xoff = AndroidUtilities.rectTmp2.centerX(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && @@ -1244,21 +1250,51 @@ public void onSettings() { drawerLayoutContainer.closeDrawer(); } } + @Override + protected boolean willApplyEmoji(View view, Long documentId, TLRPC.Document document, TL_stars.TL_starGiftUnique gift, Integer until) { + if (gift != null) { + final TL_stars.SavedStarGift savedStarGift = StarsController.getInstance(currentAccount).findUserStarGift(gift.id); + return savedStarGift == null || MessagesController.getGlobalMainSettings().getInt("statusgiftpage", 0) >= 2; + } + return true; + } @Override - protected void onEmojiSelected(View emojiView, Long documentId, TLRPC.Document document, Integer until) { + protected void onEmojiSelected(View emojiView, Long documentId, TLRPC.Document document, TL_stars.TL_starGiftUnique gift, Integer until) { TLRPC.EmojiStatus emojiStatus; if (documentId == null) { emojiStatus = new TLRPC.TL_emojiStatusEmpty(); - } else if (until != null) { - emojiStatus = new TLRPC.TL_emojiStatusUntil(); - ((TLRPC.TL_emojiStatusUntil) emojiStatus).document_id = documentId; - ((TLRPC.TL_emojiStatusUntil) emojiStatus).until = until; + } else if (gift != null) { + final TL_stars.SavedStarGift savedStarGift = StarsController.getInstance(currentAccount).findUserStarGift(gift.id); + if (savedStarGift != null && MessagesController.getGlobalMainSettings().getInt("statusgiftpage", 0) < 2) { + MessagesController.getGlobalMainSettings().edit().putInt("statusgiftpage", MessagesController.getGlobalMainSettings().getInt("statusgiftpage", 0) + 1).apply(); + new StarGiftSheet(getContext(), currentAccount, UserConfig.getInstance(currentAccount).getClientUserId(), null) + .set(savedStarGift) + .setupWearPage() + .show(); + if (popup[0] != null) { + selectAnimatedEmojiDialog = null; + popup[0].dismiss(); + } + return; + } + final TLRPC.TL_inputEmojiStatusCollectible status = new TLRPC.TL_inputEmojiStatusCollectible(); + status.collectible_id = gift.id; + if (until != null) { + status.flags |= 1; + status.until = until; + } + emojiStatus = status; } else { - emojiStatus = new TLRPC.TL_emojiStatus(); - ((TLRPC.TL_emojiStatus) emojiStatus).document_id = documentId; + final TLRPC.TL_emojiStatus status = new TLRPC.TL_emojiStatus(); + if (until != null) { + status.flags |= 1; + status.until = until; + } + status.document_id = documentId; + emojiStatus = status; } - MessagesController.getInstance(currentAccount).updateEmojiStatus(emojiStatus); + MessagesController.getInstance(currentAccount).updateEmojiStatus(emojiStatus, gift); TLRPC.User user = UserConfig.getInstance(currentAccount).getCurrentUser(); if (user != null) { for (int i = 0; i < sideMenu.getChildCount(); ++i) { @@ -1290,7 +1326,11 @@ protected void onEmojiSelected(View emojiView, Long documentId, TLRPC.Document d if (user != null) { popupLayout.setExpireDateHint(DialogObject.getEmojiStatusUntil(user.emoji_status)); } - popupLayout.setSelected(scrimDrawable != null && scrimDrawable.getDrawable() instanceof AnimatedEmojiDrawable ? ((AnimatedEmojiDrawable) scrimDrawable.getDrawable()).getDocumentId() : null); + if (profileCellCasted != null && profileCellCasted.getEmojiStatusGiftId() != null) { + popupLayout.setSelected(profileCellCasted.getEmojiStatusGiftId()); + } else { + popupLayout.setSelected(scrimDrawable != null && scrimDrawable.getDrawable() instanceof AnimatedEmojiDrawable ? ((AnimatedEmojiDrawable) scrimDrawable.getDrawable()).getDocumentId() : null); + } popupLayout.setSaveState(2); popupLayout.setScrimDrawable(scrimDrawable, scrimDrawableParent); popup[0] = selectAnimatedEmojiDialog = new SelectAnimatedEmojiDialog.SelectAnimatedEmojiDialogWindow(popupLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT) { @@ -1657,7 +1697,7 @@ public void onDeclineTerms(int account) { } public void showPasscodeActivity(boolean fingerprint, boolean animated, int x, int y, Runnable onShow, Runnable onStart) { - if (drawerLayoutContainer == null) { + if (drawerLayoutContainer == null || isFinishing()) { return; } if (passcodeDialog == null) { @@ -2137,6 +2177,7 @@ private boolean handleIntent(Intent intent, boolean isNew, boolean restore, bool String chatLinkSlug = null; TLRPC.TL_wallPaper wallPaper = null; String inputInvoiceSlug = null; + String uniqueGiftSlug = null; Integer messageId = null; Long channelId = null; Long threadId = null; @@ -2178,6 +2219,8 @@ private boolean handleIntent(Intent intent, boolean isNew, boolean restore, bool inputInvoiceSlug = path.substring(1); } else if (path.startsWith("invoice/")) { inputInvoiceSlug = path.substring(path.indexOf('/') + 1); + } else if (path.startsWith("nft/")) { + uniqueGiftSlug = path.substring(path.indexOf('/') + 1); } else if (path.startsWith("bg/")) { wallPaper = new TLRPC.TL_wallPaper(); wallPaper.settings = new TLRPC.TL_wallPaperSettings(); @@ -2533,6 +2576,10 @@ private boolean handleIntent(Intent intent, boolean isNew, boolean restore, bool url = url.replace("tg:invoice", "tg://invoice"); data = Uri.parse(url); inputInvoiceSlug = data.getQueryParameter("slug"); + } else if (url.startsWith("tg:nft") || url.startsWith("tg://nft")) { + url = url.replace("tg:nft", "tg://nft"); + data = Uri.parse(url); + uniqueGiftSlug = data.getQueryParameter("slug"); } else if (url.startsWith("tg:contact") || url.startsWith("tg://contact")) { url = url.replace("tg:contact", "tg://contact"); data = Uri.parse(url); @@ -2869,7 +2916,7 @@ private boolean handleIntent(Intent intent, boolean isNew, boolean restore, bool cancelDeleteProgressDialog.setCanCancel(false); cancelDeleteProgressDialog.show(); - TLRPC.TL_account_sendConfirmPhoneCode req = new TLRPC.TL_account_sendConfirmPhoneCode(); + TL_account.sendConfirmPhoneCode req = new TL_account.sendConfirmPhoneCode(); req.hash = phoneHash; req.settings = new TLRPC.TL_codeSettings(); req.settings.allow_flashcall = false; @@ -2893,11 +2940,11 @@ private boolean handleIntent(Intent intent, boolean isNew, boolean restore, bool AlertsCreator.processError(currentAccount, error, getActionBarLayout().getLastFragment(), req); } }), ConnectionsManager.RequestFlagFailOnServerErrors); - } else if (username != null || group != null || sticker != null || emoji != null || contactToken != null || folderSlug != null || message != null || game != null || voicechat != null || videochat || auth != null || unsupportedUrl != null || lang != null || code != null || wallPaper != null || inputInvoiceSlug != null || channelId != null || theme != null || login != null || chatLinkSlug != null) { + } else if (username != null || group != null || sticker != null || emoji != null || contactToken != null || folderSlug != null || message != null || game != null || voicechat != null || videochat || auth != null || unsupportedUrl != null || lang != null || code != null || wallPaper != null || inputInvoiceSlug != null || uniqueGiftSlug != null || channelId != null || theme != null || login != null || chatLinkSlug != null) { if (message != null && message.startsWith("@")) { message = " " + message; } - runLinkRequest(intentAccount[0], username, group, sticker, emoji, botUser, botChat, botChannel, botChatAdminParams, message, contactToken, folderSlug, text, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, login, wallPaper, inputInvoiceSlug, theme, voicechat, videochat, livestream, 0, videoTimestamp, setAsAttachBot, attachMenuBotToOpen, attachMenuBotChoose, botAppMaybe, startApp, progress, forceNotInternalForApps, storyId, isBoost, chatLinkSlug, botCompact, botFullscreen, openedTelegram, openProfile, forceRequest, referrer); + runLinkRequest(intentAccount[0], username, group, sticker, emoji, botUser, botChat, botChannel, botChatAdminParams, message, contactToken, folderSlug, text, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, login, wallPaper, inputInvoiceSlug, uniqueGiftSlug, theme, voicechat, videochat, livestream, 0, videoTimestamp, setAsAttachBot, attachMenuBotToOpen, attachMenuBotChoose, botAppMaybe, startApp, progress, forceNotInternalForApps, storyId, isBoost, chatLinkSlug, botCompact, botFullscreen, openedTelegram, openProfile, forceRequest, referrer); } else { try (Cursor cursor = getContentResolver().query(intent.getData(), null, null, null, null)) { if (cursor != null) { @@ -3388,6 +3435,7 @@ private boolean handleIntent(Intent intent, boolean isNew, boolean restore, bool return pushOpened; } + private static Pattern timestampPattern; public static int getTimestampFromLink(Uri data) { List segments = data.getPathSegments(); String timestampStr = null; @@ -3396,26 +3444,45 @@ public static int getTimestampFromLink(Uri data) { } else if (data.getQueryParameter("t") != null) { timestampStr = data.getQueryParameter("t"); } - int videoTimestamp = -1; - if (timestampStr != null) { - try { - videoTimestamp = Integer.parseInt(timestampStr); - } catch (Throwable ignore) { - + if (!TextUtils.isEmpty(timestampStr)) { + if (timestampPattern == null) { + timestampPattern = Pattern.compile("^\\??(?:(\\d+)[dD])?(?:(\\d+)h)?(?:(\\d+)[mM])?(?:(\\d+)[sS])?$"); } - if (videoTimestamp == -1) { - DateFormat dateFormat = new SimpleDateFormat("mm:ss"); - Date reference = null; + try { + Matcher match = timestampPattern.matcher(timestampStr); + if (match.matches()) { + final String D = match.group(1); + final String H = match.group(2); + final String M = match.group(3); + final String S = match.group(4); + final int d = TextUtils.isEmpty(D) ? 0 : Integer.parseInt(D); + final int h = TextUtils.isEmpty(H) ? 0 : Integer.parseInt(H); + final int m = TextUtils.isEmpty(M) ? 0 : Integer.parseInt(M); + final int s = TextUtils.isEmpty(S) ? 0 : Integer.parseInt(S); + return s + 60 * m + 60 * 60 * h + 60 * 60 * 24 * d; + } + } catch (Throwable ignore) {} + try { + return Integer.parseInt(timestampStr); + } catch (Throwable ignore) {} + if (timestampStr.contains(":")) { + String[] parts = timestampStr.split(":"); + String ss = (parts.length - 1) < 0 ? "0" : parts[parts.length - 1]; + String ms = (parts.length - 2) < 0 ? "0" : parts[parts.length - 2]; + String hs = (parts.length - 3) < 0 ? "0" : parts[parts.length - 3]; + String ds = (parts.length - 4) < 0 ? "0" : parts[parts.length - 4]; try { - reference = dateFormat.parse("00:00"); - Date date = dateFormat.parse(timestampStr); - videoTimestamp = (int) ((date.getTime() - reference.getTime()) / 1000L); - } catch (ParseException e) { - e.printStackTrace(); + int s = Integer.parseInt(ss); + int m = Integer.parseInt(ms); + int h = Integer.parseInt(hs); + int d = Integer.parseInt(ds); + return s + 60 * m + 60 * 60 * h + 60 * 60 * 24 * d; + } catch (Exception e) { + FileLog.e(e); } } } - return videoTimestamp; + return -1; } private void openDialogsToSend(boolean animated) { @@ -3878,49 +3945,58 @@ public void openMessage(long dialogId, int messageId, String quote, final Browse } } - private void runLinkRequest(final int intentAccount, - final String username, - final String group, - final String sticker, - final String emoji, - final String botUser, - final String botChat, - final String botChannel, - final String botChatAdminParams, - final String message, - final String contactToken, - final String folderSlug, - String text, final boolean hasUrl, - final Integer messageId, - final Long channelId, - final Long threadId, - final Integer commentId, - final String game, - final HashMap auth, - final String lang, - final String unsupportedUrl, - final String code, - final String loginToken, - final TLRPC.TL_wallPaper wallPaper, - final String inputInvoiceSlug, - final String theme, - final String voicechat, - final boolean videochat, - final String livestream, - final int state, - final int videoTimestamp, - final String setAsAttachBot, - final String attachMenuBotToOpen, - final String attachMenuBotChoose, - final String botAppMaybe, - final String botAppStartParam, - final Browser.Progress progress, - final boolean forceNotInternalForApps, - final int storyId, - final boolean isBoost, - final String chatLinkSlug, boolean botCompact, boolean botFullscreen, boolean openedTelegram, boolean openProfile, boolean forceRequest, String referrer) { + private void runLinkRequest( + final int intentAccount, + final String username, + final String group, + final String sticker, + final String emoji, + final String botUser, + final String botChat, + final String botChannel, + final String botChatAdminParams, + final String message, + final String contactToken, + final String folderSlug, + String text, final boolean hasUrl, + final Integer messageId, + final Long channelId, + final Long threadId, + final Integer commentId, + final String game, + final HashMap auth, + final String lang, + final String unsupportedUrl, + final String code, + final String loginToken, + final TLRPC.TL_wallPaper wallPaper, + final String inputInvoiceSlug, + final String uniqueGiftSlug, + final String theme, + final String voicechat, + final boolean videochat, + final String livestream, + final int state, + final int videoTimestamp, + final String setAsAttachBot, + final String attachMenuBotToOpen, + final String attachMenuBotChoose, + final String botAppMaybe, + final String botAppStartParam, + final Browser.Progress progress, + final boolean forceNotInternalForApps, + final int storyId, + final boolean isBoost, + final String chatLinkSlug, + boolean botCompact, + boolean botFullscreen, + boolean openedTelegram, + boolean openProfile, + boolean forceRequest, + String referrer + ) { if (state == 0 && ChatActivity.SCROLL_DEBUG_DELAY && progress != null) { - Runnable runnable = () -> runLinkRequest(intentAccount, username, group, sticker, emoji, botUser, botChat, botChannel, botChatAdminParams, message, contactToken, folderSlug, text, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, loginToken, wallPaper, inputInvoiceSlug, theme, voicechat, videochat, livestream, 1, videoTimestamp, setAsAttachBot, attachMenuBotToOpen, attachMenuBotChoose, botAppMaybe, botAppStartParam, progress, forceNotInternalForApps, storyId, isBoost, chatLinkSlug, botCompact, botFullscreen, openedTelegram, openProfile, forceRequest, referrer); + Runnable runnable = () -> runLinkRequest(intentAccount, username, group, sticker, emoji, botUser, botChat, botChannel, botChatAdminParams, message, contactToken, folderSlug, text, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, loginToken, wallPaper, inputInvoiceSlug, uniqueGiftSlug, theme, voicechat, videochat, livestream, 1, videoTimestamp, setAsAttachBot, attachMenuBotToOpen, attachMenuBotChoose, botAppMaybe, botAppStartParam, progress, forceNotInternalForApps, storyId, isBoost, chatLinkSlug, botCompact, botFullscreen, openedTelegram, openProfile, forceRequest, referrer); progress.init(); progress.onCancel(() -> AndroidUtilities.cancelRunOnUIThread(runnable)); AndroidUtilities.runOnUIThread(runnable, 7500); @@ -3930,7 +4006,7 @@ private void runLinkRequest(final int intentAccount, if (account != intentAccount) { switchToAccount(account, true); } - runLinkRequest(account, username, group, sticker, emoji, botUser, botChat, botChannel, botChatAdminParams, message, contactToken, folderSlug, text, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, loginToken, wallPaper, inputInvoiceSlug, theme, voicechat, videochat, livestream, 1, videoTimestamp, setAsAttachBot, attachMenuBotToOpen, attachMenuBotChoose, botAppMaybe, botAppStartParam, progress, forceNotInternalForApps, storyId, isBoost, chatLinkSlug, botCompact, botFullscreen, openedTelegram, openProfile, forceRequest, referrer); + runLinkRequest(account, username, group, sticker, emoji, botUser, botChat, botChannel, botChatAdminParams, message, contactToken, folderSlug, text, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, loginToken, wallPaper, inputInvoiceSlug, uniqueGiftSlug, theme, voicechat, videochat, livestream, 1, videoTimestamp, setAsAttachBot, attachMenuBotToOpen, attachMenuBotChoose, botAppMaybe, botAppStartParam, progress, forceNotInternalForApps, storyId, isBoost, chatLinkSlug, botCompact, botFullscreen, openedTelegram, openProfile, forceRequest, referrer); }).show(); return; } else if (code != null) { @@ -4017,6 +4093,39 @@ private void runLinkRequest(final int intentAccount, BulletinFactory.of(fragment).createErrorBulletin(LocaleController.getString(R.string.NoFolderFound)).show(); } + try { + dismissLoading.run(); + } catch (Exception e) { + FileLog.e(e); + } + })); + } else if (uniqueGiftSlug != null) { + TL_stars.getUniqueStarGift req = new TL_stars.getUniqueStarGift(); + req.slug = uniqueGiftSlug; + requestId[0] = ConnectionsManager.getInstance(intentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { + if (error != null) { + BulletinFactory.of(mainFragmentsStack.get(mainFragmentsStack.size() - 1)) + .createSimpleBulletin(R.raw.error, getString(R.string.UniqueGiftNotFound)) + .show(); + } else if (response instanceof TL_stars.TL_payments_uniqueStarGift) { + final TL_stars.TL_payments_uniqueStarGift r = (TL_stars.TL_payments_uniqueStarGift) response; + MessagesController.getInstance(currentAccount).putUsers(r.users, false); + BaseFragment lastFragment = getSafeLastFragment(); + if (r.gift instanceof TL_stars.TL_starGiftUnique) { + final TL_stars.TL_starGiftUnique gift = (TL_stars.TL_starGiftUnique) r.gift; + final StarGiftSheet sheet = new StarGiftSheet(this, intentAccount, 0, null).set(uniqueGiftSlug, gift); + if (lastFragment != null) { + if (lastFragment.getLastStoryViewer() != null && lastFragment.getLastStoryViewer().isFullyVisible()) { + lastFragment.getLastStoryViewer().showDialog(sheet); + } else { + lastFragment.showDialog(sheet); + } + } else { + sheet.show(); + } + } + } + try { dismissLoading.run(); } catch (Exception e) { @@ -4138,7 +4247,7 @@ private void runLinkRequest(final int intentAccount, getAttachMenuBot.bot = MessagesController.getInstance(intentAccount).getInputUser(peerId); ConnectionsManager.getInstance(intentAccount).sendRequest(getAttachMenuBot, (response1, error1) -> AndroidUtilities.runOnUIThread(() -> { if (error1 != null) { - AndroidUtilities.runOnUIThread(() -> runLinkRequest(intentAccount, username, group, sticker, emoji, botUser, botChat, botChannel, botChatAdminParams, message, contactToken, folderSlug, text, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, loginToken, wallPaper, inputInvoiceSlug, theme, voicechat, videochat, livestream, state, videoTimestamp, setAsAttachBot, attachMenuBotToOpen, attachMenuBotChoose, null, null, progress, forceNotInternalForApps, storyId, isBoost, chatLinkSlug, botCompact, botFullscreen, openedTelegram, openProfile, forceRequest, referrer)); + AndroidUtilities.runOnUIThread(() -> runLinkRequest(intentAccount, username, group, sticker, emoji, botUser, botChat, botChannel, botChatAdminParams, message, contactToken, folderSlug, text, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, loginToken, wallPaper, inputInvoiceSlug, uniqueGiftSlug, theme, voicechat, videochat, livestream, state, videoTimestamp, setAsAttachBot, attachMenuBotToOpen, attachMenuBotChoose, null, null, progress, forceNotInternalForApps, storyId, isBoost, chatLinkSlug, botCompact, botFullscreen, openedTelegram, openProfile, forceRequest, referrer)); } else if (response1 instanceof TLRPC.TL_attachMenuBotsBot) { TLRPC.TL_attachMenuBotsBot bot = (TLRPC.TL_attachMenuBotsBot) response1; TLRPC.TL_attachMenuBot attachBot = bot.bot; @@ -4159,7 +4268,7 @@ private void runLinkRequest(final int intentAccount, } }), ConnectionsManager.RequestFlagInvokeAfter | ConnectionsManager.RequestFlagFailOnServerErrors); - processWebAppBot(intentAccount, username, group, sticker, emoji, botUser, botChat, botChannel, botChatAdminParams, message, contactToken, folderSlug, text, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, loginToken, wallPaper, inputInvoiceSlug, theme, voicechat, videochat, livestream, state, videoTimestamp, setAsAttachBot, attachMenuBotToOpen, attachMenuBotChoose, botAppMaybe, botAppStartParam, progress, forceNotInternalForApps, storyId, isBoost, chatLinkSlug, user, dismissLoading, botAttachable, true, botCompact, botFullscreen, openedTelegram, openProfile, forceRequest, referrer); + processWebAppBot(intentAccount, username, group, sticker, emoji, botUser, botChat, botChannel, botChatAdminParams, message, contactToken, folderSlug, text, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, loginToken, wallPaper, inputInvoiceSlug, uniqueGiftSlug, theme, voicechat, videochat, livestream, state, videoTimestamp, setAsAttachBot, attachMenuBotToOpen, attachMenuBotChoose, botAppMaybe, botAppStartParam, progress, forceNotInternalForApps, storyId, isBoost, chatLinkSlug, user, dismissLoading, botAttachable, true, botCompact, botFullscreen, openedTelegram, openProfile, forceRequest, referrer); }, null, progress != null ? progress::end : null); } else if (attachBot.request_write_access || forceNotInternalForApps) { AtomicBoolean allowWrite = new AtomicBoolean(true); @@ -4179,15 +4288,15 @@ private void runLinkRequest(final int intentAccount, } }), ConnectionsManager.RequestFlagInvokeAfter | ConnectionsManager.RequestFlagFailOnServerErrors); - processWebAppBot(intentAccount, username, group, sticker, emoji, botUser, botChat, botChannel, botChatAdminParams, message, contactToken, folderSlug, text, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, loginToken, wallPaper, inputInvoiceSlug, theme, voicechat, videochat, livestream, state, videoTimestamp, setAsAttachBot, attachMenuBotToOpen, attachMenuBotChoose, botAppMaybe, botAppStartParam, progress, forceNotInternalForApps, storyId, isBoost, chatLinkSlug, user, dismissLoading, false, false, botCompact, botFullscreen, openedTelegram, openProfile, forceRequest, referrer); + processWebAppBot(intentAccount, username, group, sticker, emoji, botUser, botChat, botChannel, botChatAdminParams, message, contactToken, folderSlug, text, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, loginToken, wallPaper, inputInvoiceSlug, uniqueGiftSlug, theme, voicechat, videochat, livestream, state, videoTimestamp, setAsAttachBot, attachMenuBotToOpen, attachMenuBotChoose, botAppMaybe, botAppStartParam, progress, forceNotInternalForApps, storyId, isBoost, chatLinkSlug, user, dismissLoading, false, false, botCompact, botFullscreen, openedTelegram, openProfile, forceRequest, referrer); }); } else { - processWebAppBot(intentAccount, username, group, sticker, emoji, botUser, botChat, botChannel, botChatAdminParams, message, contactToken, folderSlug, text, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, loginToken, wallPaper, inputInvoiceSlug, theme, voicechat, videochat, livestream, state, videoTimestamp, setAsAttachBot, attachMenuBotToOpen, attachMenuBotChoose, botAppMaybe, botAppStartParam, progress, forceNotInternalForApps, storyId, isBoost, chatLinkSlug, user, dismissLoading, false, false, botCompact, botFullscreen, openedTelegram, openProfile, forceRequest, referrer); + processWebAppBot(intentAccount, username, group, sticker, emoji, botUser, botChat, botChannel, botChatAdminParams, message, contactToken, folderSlug, text, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, loginToken, wallPaper, inputInvoiceSlug, uniqueGiftSlug, theme, voicechat, videochat, livestream, state, videoTimestamp, setAsAttachBot, attachMenuBotToOpen, attachMenuBotChoose, botAppMaybe, botAppStartParam, progress, forceNotInternalForApps, storyId, isBoost, chatLinkSlug, user, dismissLoading, false, false, botCompact, botFullscreen, openedTelegram, openProfile, forceRequest, referrer); } } })); } else { - processWebAppBot(intentAccount, username, group, sticker, emoji, botUser, botChat, botChannel, botChatAdminParams, message, contactToken, folderSlug, text, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, loginToken, wallPaper, inputInvoiceSlug, theme, voicechat, videochat, livestream, state, videoTimestamp, setAsAttachBot, attachMenuBotToOpen, attachMenuBotChoose, botAppMaybe, botAppStartParam, progress, forceNotInternalForApps, storyId, isBoost, chatLinkSlug, user, dismissLoading, false, false, botCompact, botFullscreen, openedTelegram, openProfile, forceRequest, referrer); + processWebAppBot(intentAccount, username, group, sticker, emoji, botUser, botChat, botChannel, botChatAdminParams, message, contactToken, folderSlug, text, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, loginToken, wallPaper, inputInvoiceSlug, uniqueGiftSlug, theme, voicechat, videochat, livestream, state, videoTimestamp, setAsAttachBot, attachMenuBotToOpen, attachMenuBotChoose, botAppMaybe, botAppStartParam, progress, forceNotInternalForApps, storyId, isBoost, chatLinkSlug, user, dismissLoading, false, false, botCompact, botFullscreen, openedTelegram, openProfile, forceRequest, referrer); } return; } @@ -4860,14 +4969,14 @@ public void onError() { final String payload = auth.get("payload"); final String nonce = auth.get("nonce"); final String callbackUrl = auth.get("callback_url"); - final TLRPC.TL_account_getAuthorizationForm req = new TLRPC.TL_account_getAuthorizationForm(); + final TL_account.getAuthorizationForm req = new TL_account.getAuthorizationForm(); req.bot_id = bot_id; req.scope = auth.get("scope"); req.public_key = auth.get("public_key"); requestId[0] = ConnectionsManager.getInstance(intentAccount).sendRequest(req, (response, error) -> { - final TLRPC.TL_account_authorizationForm authorizationForm = (TLRPC.TL_account_authorizationForm) response; + final TL_account.authorizationForm authorizationForm = (TL_account.authorizationForm) response; if (authorizationForm != null) { - TLRPC.TL_account_getPassword req2 = new TLRPC.TL_account_getPassword(); + TL_account.getPassword req2 = new TL_account.getPassword(); requestId[0] = ConnectionsManager.getInstance(intentAccount).sendRequest(req2, (response1, error1) -> AndroidUtilities.runOnUIThread(() -> { try { dismissLoading.run(); @@ -4875,7 +4984,7 @@ public void onError() { FileLog.e(e); } if (response1 != null) { - TLRPC.account_Password accountPassword = (TLRPC.account_Password) response1; + TL_account.Password accountPassword = (TL_account.Password) response1; MessagesController.getInstance(intentAccount).putUsers(authorizationForm.users, false); presentFragment(new PassportActivity(PassportActivity.TYPE_PASSWORD, req.bot_id, req.scope, req.public_key, payload, nonce, callbackUrl, authorizationForm, accountPassword)); } @@ -4949,7 +5058,7 @@ public void onError() { } } if (!ok) { - TLRPC.TL_account_getWallPaper req = new TLRPC.TL_account_getWallPaper(); + TL_account.getWallPaper req = new TL_account.getWallPaper(); TLRPC.TL_inputWallPaperSlug inputWallPaperSlug = new TLRPC.TL_inputWallPaperSlug(); inputWallPaperSlug.slug = wallPaper.slug; req.wallpaper = inputWallPaperSlug; @@ -4990,7 +5099,7 @@ public void onError() { progress.end(); } }; - TLRPC.TL_account_getTheme req = new TLRPC.TL_account_getTheme(); + TL_account.getTheme req = new TL_account.getTheme(); req.format = "android"; TLRPC.TL_inputThemeSlug inputThemeSlug = new TLRPC.TL_inputThemeSlug(); inputThemeSlug.slug = theme; @@ -5153,12 +5262,12 @@ public void onError() { } } } else if (chatLinkSlug != null) { - TLRPC.TL_account_resolveBusinessChatLink req = new TLRPC.TL_account_resolveBusinessChatLink(); + TL_account.resolveBusinessChatLink req = new TL_account.resolveBusinessChatLink(); req.slug = chatLinkSlug; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { - if (res instanceof TLRPC.TL_account_resolvedBusinessChatLinks) { - TLRPC.TL_account_resolvedBusinessChatLinks resolvedLink = (TLRPC.TL_account_resolvedBusinessChatLinks) res; + if (res instanceof TL_account.resolvedBusinessChatLinks) { + TL_account.resolvedBusinessChatLinks resolvedLink = (TL_account.resolvedBusinessChatLinks) res; MessagesController.getInstance(currentAccount).putUsers(resolvedLink.users, false); MessagesController.getInstance(currentAccount).putChats(resolvedLink.chats, false); @@ -5205,50 +5314,61 @@ public void onError() { } } - private void processWebAppBot(final int intentAccount, - final String username, - final String group, - final String sticker, - final String emoji, - final String botUser, - final String botChat, - final String botChannel, - final String botChatAdminParams, - final String message, - final String contactToken, - final String folderSlug, - final String text, - final boolean hasUrl, - final Integer messageId, - final Long channelId, - final Long threadId, - final Integer commentId, - final String game, - final HashMap auth, - final String lang, - final String unsupportedUrl, - final String code, - final String loginToken, - final TLRPC.TL_wallPaper wallPaper, - final String inputInvoiceSlug, - final String theme, - final String voicechat, - final boolean videochat, - final String livestream, - final int state, - final int videoTimestamp, - final String setAsAttachBot, - final String attachMenuBotToOpen, - final String attachMenuBotChoose, - final String botAppMaybe, - final String botAppStartParam, - final Browser.Progress progress, - final boolean forceNotInternalForApps, - final int storyId, - final boolean isBoost, - final String chatLinkSlug, - TLRPC.User user, - Runnable dismissLoading, boolean botAttachable, boolean ignoreInactive, boolean botCompact, boolean botFullscreen, boolean openedTelegram, boolean openProfile, boolean forceRequest, String referrer) { + private void processWebAppBot( + final int intentAccount, + final String username, + final String group, + final String sticker, + final String emoji, + final String botUser, + final String botChat, + final String botChannel, + final String botChatAdminParams, + final String message, + final String contactToken, + final String folderSlug, + final String text, + final boolean hasUrl, + final Integer messageId, + final Long channelId, + final Long threadId, + final Integer commentId, + final String game, + final HashMap auth, + final String lang, + final String unsupportedUrl, + final String code, + final String loginToken, + final TLRPC.TL_wallPaper wallPaper, + final String inputInvoiceSlug, + final String uniqueGiftSlug, + final String theme, + final String voicechat, + final boolean videochat, + final String livestream, + final int state, + final int videoTimestamp, + final String setAsAttachBot, + final String attachMenuBotToOpen, + final String attachMenuBotChoose, + final String botAppMaybe, + final String botAppStartParam, + final Browser.Progress progress, + final boolean forceNotInternalForApps, + final int storyId, + final boolean isBoost, + final String chatLinkSlug, + TLRPC.User user, + Runnable dismissLoading, + boolean botAttachable, + boolean ignoreInactive, + boolean botCompact, + boolean botFullscreen, + boolean openedTelegram, + boolean openProfile, + boolean forceRequest, + String referrer + ) { TLRPC.TL_messages_getBotApp getBotApp = new TLRPC.TL_messages_getBotApp(); TLRPC.TL_inputBotAppShortName app = new TLRPC.TL_inputBotAppShortName(); @@ -5260,7 +5380,7 @@ private void processWebAppBot(final int intentAccount, progress.end(); } if (error1 != null) { - AndroidUtilities.runOnUIThread(() -> runLinkRequest(intentAccount, username, group, sticker, emoji, botUser, botChat, botChannel, botChatAdminParams, message, contactToken, folderSlug, text, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, loginToken, wallPaper, inputInvoiceSlug, theme, voicechat, videochat, livestream, state, videoTimestamp, setAsAttachBot, attachMenuBotToOpen, attachMenuBotChoose, null, null, progress, forceNotInternalForApps, storyId, isBoost, chatLinkSlug, botCompact, botFullscreen, openedTelegram, openProfile, forceRequest, referrer)); + AndroidUtilities.runOnUIThread(() -> runLinkRequest(intentAccount, username, group, sticker, emoji, botUser, botChat, botChannel, botChatAdminParams, message, contactToken, folderSlug, text, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, loginToken, wallPaper, inputInvoiceSlug, uniqueGiftSlug, theme, voicechat, videochat, livestream, state, videoTimestamp, setAsAttachBot, attachMenuBotToOpen, attachMenuBotChoose, null, null, progress, forceNotInternalForApps, storyId, isBoost, chatLinkSlug, botCompact, botFullscreen, openedTelegram, openProfile, forceRequest, referrer)); } else { TLRPC.TL_messages_botApp botApp = (TLRPC.TL_messages_botApp) response1; AndroidUtilities.runOnUIThread(() -> { @@ -6992,7 +7112,7 @@ public void onAnimationEnd(Animator animation) { if (themeInfo.pathToWallpaper != null) { File file = new File(themeInfo.pathToWallpaper); if (!file.exists()) { - TLRPC.TL_account_getWallPaper req = new TLRPC.TL_account_getWallPaper(); + TL_account.getWallPaper req = new TL_account.getWallPaper(); TLRPC.TL_inputWallPaperSlug inputWallPaperSlug = new TLRPC.TL_inputWallPaperSlug(); inputWallPaperSlug.slug = themeInfo.slug; req.wallpaper = inputWallPaperSlug; @@ -7511,8 +7631,8 @@ private void showLanguageAlert(boolean force) { req.keys.add("ChangeLanguageLater"); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { final HashMap keys = new HashMap<>(); - if (response != null) { - TLRPC.Vector vector = (TLRPC.Vector) response; + if (response instanceof Vector) { + Vector vector = (Vector) response; for (int a = 0; a < vector.objects.size(); a++) { final TLRPC.LangPackString string = (TLRPC.LangPackString) vector.objects.get(a); keys.put(string.key, string.value); @@ -7534,8 +7654,8 @@ private void showLanguageAlert(boolean force) { req.keys.add("ChangeLanguageLater"); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { final HashMap keys = new HashMap<>(); - if (response != null) { - TLRPC.Vector vector = (TLRPC.Vector) response; + if (response instanceof Vector) { + final Vector vector = (Vector) response; for (int a = 0; a < vector.objects.size(); a++) { final TLRPC.LangPackString string = (TLRPC.LangPackString) vector.objects.get(a); keys.put(string.key, string.value); @@ -8174,6 +8294,9 @@ public void onRebuildAllFragments(INavigationLayout layout, boolean last) { } public static BaseFragment getLastFragment() { + if (BubbleActivity.instance != null && BubbleActivity.instance.actionBarLayout != null) { + return BubbleActivity.instance.actionBarLayout.getLastFragment(); + } if (instance != null && !instance.sheetFragmentsStack.isEmpty()) { return instance.sheetFragmentsStack.get(instance.sheetFragmentsStack.size() - 1).getLastFragment(); } @@ -8185,6 +8308,9 @@ public static BaseFragment getLastFragment() { // last fragment that is not finishing itself public static BaseFragment getSafeLastFragment() { + if (BubbleActivity.instance != null && BubbleActivity.instance.actionBarLayout != null) { + return BubbleActivity.instance.actionBarLayout.getSafeLastFragment(); + } if (instance != null && !instance.sheetFragmentsStack.isEmpty()) { return instance.sheetFragmentsStack.get(instance.sheetFragmentsStack.size() - 1).getSafeLastFragment(); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LinkEditActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LinkEditActivity.java index 5bd80c9c8e..2990a4121c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LinkEditActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LinkEditActivity.java @@ -570,7 +570,7 @@ public boolean onTouchEvent(MotionEvent event) { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { - Emoji.replaceEmoji(s, nameEditText.getPaint().getFontMetricsInt(), (int) nameEditText.getPaint().getTextSize(), false); + Emoji.replaceEmoji(s, nameEditText.getPaint().getFontMetricsInt(), false); } }); nameEditText.setCursorVisible(false); @@ -940,7 +940,7 @@ public void setInviteToEdit(TLRPC.TL_chatInviteExported invite) { setUsesVisible(!invite.request_needed); if (!TextUtils.isEmpty(invite.title)) { SpannableStringBuilder builder = new SpannableStringBuilder(invite.title); - Emoji.replaceEmoji(builder, nameEditText.getPaint().getFontMetricsInt(), (int) nameEditText.getPaint().getTextSize(), false); + Emoji.replaceEmoji(builder, nameEditText.getPaint().getFontMetricsInt(), false); nameEditText.setText(builder); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java index bd5f5f3da0..31834f7b52 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LoginActivity.java @@ -134,7 +134,7 @@ import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; -import org.telegram.tgnet.tl.TL_stats; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; @@ -1086,7 +1086,9 @@ private void needShowAlert(String title, String text) { } private void onFieldError(View view, boolean allowErrorSelection) { - view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} AndroidUtilities.shakeViewSpring(view, 3.5f); if (allowErrorSelection) { @@ -1684,7 +1686,7 @@ private void onAuthSuccess(TLRPC.TL_auth_authorization res, boolean afterSignup) needFinishActivity(afterSignup, res.setup_password_required, res.otherwise_relogin_days); } - private void fillNextCodeParams(Bundle params, TLRPC.TL_account_sentEmailCode res) { + private void fillNextCodeParams(Bundle params, TL_account.sentEmailCode res) { params.putString("emailPattern", res.email_pattern); params.putInt("length", res.length); setPage(VIEW_CODE_EMAIL_SETUP, true, params, false); @@ -2677,7 +2679,7 @@ public void draw(@NonNull Canvas canvas, CharSequence text, int start, int end, }, flag.length(), flag.length() + 1, 0); } sb.append(country.name); - setCountryButtonText(Emoji.replaceEmoji(sb, countryButton.getCurrentView().getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false)); + setCountryButtonText(Emoji.replaceEmoji(sb, countryButton.getCurrentView().getPaint().getFontMetricsInt(), false)); countryCodeForHint = code; wasCountryHintIndex = -1; invalidateCountryHint(); @@ -3072,7 +3074,7 @@ private void onConfirm(PhoneNumberConfirmView confirmView) { TLObject req; if (activityMode == MODE_CHANGE_PHONE_NUMBER) { - TLRPC.TL_account_sendChangePhoneCode changePhoneCode = new TLRPC.TL_account_sendChangePhoneCode(); + TL_account.sendChangePhoneCode changePhoneCode = new TL_account.sendChangePhoneCode(); changePhoneCode.phone_number = phone; changePhoneCode.settings = settings; req = changePhoneCode; @@ -3121,12 +3123,12 @@ private void onConfirm(PhoneNumberConfirmView confirmView) { } else { if (error.text != null) { if (error.text.contains("SESSION_PASSWORD_NEEDED")) { - TLRPC.TL_account_getPassword req2 = new TLRPC.TL_account_getPassword(); + TL_account.getPassword req2 = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(req2, (response1, error1) -> AndroidUtilities.runOnUIThread(() -> { nextPressed = false; showDoneButton(false, true); if (error1 == null) { - TLRPC.account_Password password = (TLRPC.account_Password) response1; + TL_account.Password password = (TL_account.Password) response1; if (!TwoStepVerificationActivity.canHandleCurrentPassword(password, true)) { AlertsCreator.showUpdateAppAlert(getParentActivity(), getString("UpdateAppAlert", R.string.UpdateAppAlert), true); return; @@ -4424,7 +4426,7 @@ public void onNextPressed(String code) { switch (activityMode) { case MODE_CHANGE_PHONE_NUMBER: { - TLRPC.TL_account_changePhone req = new TLRPC.TL_account_changePhone(); + TL_account.changePhone req = new TL_account.changePhone(); req.phone_number = requestPhone; req.phone_code = code; req.phone_code_hash = phoneHash; @@ -4517,7 +4519,7 @@ public void onNextPressed(String code) { } case MODE_CANCEL_ACCOUNT_DELETION: { requestPhone = cancelDeletionPhone; - TLRPC.TL_account_confirmPhone req = new TLRPC.TL_account_confirmPhone(); + TL_account.confirmPhone req = new TL_account.confirmPhone(); req.phone_code = code; req.phone_code_hash = phoneHash; destroyTimer(); @@ -4613,12 +4615,12 @@ public void onNextPressed(String code) { lastError = error.text; if (error.text.contains("SESSION_PASSWORD_NEEDED")) { ok = true; - TLRPC.TL_account_getPassword req2 = new TLRPC.TL_account_getPassword(); + TL_account.getPassword req2 = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(req2, (response1, error1) -> AndroidUtilities.runOnUIThread(() -> { nextPressed = false; showDoneButton(false, true); if (error1 == null) { - TLRPC.account_Password password = (TLRPC.account_Password) response1; + TL_account.Password password = (TL_account.Password) response1; if (!TwoStepVerificationActivity.canHandleCurrentPassword(password, true)) { AlertsCreator.showUpdateAppAlert(getParentActivity(), getString("UpdateAppAlert", R.string.UpdateAppAlert), true); return; @@ -5035,7 +5037,7 @@ public class LoginActivityPasswordView extends SlideView { private Bundle currentParams; private boolean nextPressed; - private TLRPC.account_Password currentPassword; + private TL_account.Password currentPassword; private String passwordString; private String requestPhone; private String phoneHash; @@ -5214,7 +5216,7 @@ public void setParams(Bundle params, boolean restore) { passwordString = currentParams.getString("password"); if (passwordString != null) { SerializedData data = new SerializedData(Utilities.hexToBytes(passwordString)); - currentPassword = TLRPC.account_Password.TLdeserialize(data, data.readInt32(false), false); + currentPassword = TL_account.Password.TLdeserialize(data, data.readInt32(false), false); } requestPhone = params.getString("phoneFormated"); @@ -5272,10 +5274,10 @@ public void onNextPressed(String code) { RequestDelegate requestDelegate = (response, error) -> AndroidUtilities.runOnUIThread(() -> { nextPressed = false; if (error != null && "SRP_ID_INVALID".equals(error.text)) { - TLRPC.TL_account_getPassword getPasswordReq = new TLRPC.TL_account_getPassword(); + TL_account.getPassword getPasswordReq = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(getPasswordReq, (response2, error2) -> AndroidUtilities.runOnUIThread(() -> { if (error2 == null) { - currentPassword = (TLRPC.account_Password) response2; + currentPassword = (TL_account.Password) response2; onNextPressed(null); } }), ConnectionsManager.RequestFlagWithoutLogin); @@ -5458,7 +5460,7 @@ public LoginActivityResetWaitView(Context context) { .setMessage(getString("ResetMyAccountWarningText", R.string.ResetMyAccountWarningText)) .setPositiveButton(getString("ResetMyAccountWarningReset", R.string.ResetMyAccountWarningReset), (dialogInterface, i) -> { needShowProgress(0); - TLRPC.TL_account_deleteAccount req = new TLRPC.TL_account_deleteAccount(); + TL_account.deleteAccount req = new TL_account.deleteAccount(); req.reason = "Forgot password"; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { needHideProgress(false); @@ -5802,7 +5804,7 @@ public void onNextPressed(String code) { params.putBoolean("setup", true); if (googleAccount != null) { - TLRPC.TL_account_verifyEmail verifyEmail = new TLRPC.TL_account_verifyEmail(); + TL_account.verifyEmail verifyEmail = new TL_account.verifyEmail(); if (activityMode == MODE_CHANGE_LOGIN_EMAIL) { verifyEmail.purpose = new TLRPC.TL_emailVerifyPurposeLoginChange(); } else { @@ -5817,11 +5819,11 @@ public void onNextPressed(String code) { googleAccount = null; ConnectionsManager.getInstance(currentAccount).sendRequest(verifyEmail, (response, error) -> AndroidUtilities.runOnUIThread(() -> { - if (response instanceof TLRPC.TL_account_emailVerified && activityMode == MODE_CHANGE_LOGIN_EMAIL) { + if (response instanceof TL_account.TL_emailVerified && activityMode == MODE_CHANGE_LOGIN_EMAIL) { finishFragment(); emailChangeFinishCallback.run(); - } else if (response instanceof TLRPC.TL_account_emailVerifiedLogin) { - TLRPC.TL_account_emailVerifiedLogin emailVerifiedLogin = (TLRPC.TL_account_emailVerifiedLogin) response; + } else if (response instanceof TL_account.TL_emailVerifiedLogin) { + TL_account.TL_emailVerifiedLogin emailVerifiedLogin = (TL_account.TL_emailVerifiedLogin) response; params.putString("email", emailVerifiedLogin.email); fillNextCodeParams(params, emailVerifiedLogin.sent_code); @@ -5845,7 +5847,7 @@ public void onNextPressed(String code) { } nextPressed = true; needShowProgress(0); - TLRPC.TL_account_sendVerifyEmailCode req = new TLRPC.TL_account_sendVerifyEmailCode(); + TL_account.sendVerifyEmailCode req = new TL_account.sendVerifyEmailCode(); if (activityMode == MODE_CHANGE_LOGIN_EMAIL) { req.purpose = new TLRPC.TL_emailVerifyPurposeLoginChange(); } else { @@ -5859,8 +5861,8 @@ public void onNextPressed(String code) { needHideProgress(false); nextPressed = false; - if (response instanceof TLRPC.TL_account_sentEmailCode) { - TLRPC.TL_account_sentEmailCode emailCode = (TLRPC.TL_account_sentEmailCode) response; + if (response instanceof TL_account.sentEmailCode) { + TL_account.sentEmailCode emailCode = (TL_account.sentEmailCode) response; fillNextCodeParams(params, emailCode); } else if (error.text != null) { if (error.text.contains("EMAIL_INVALID")) { @@ -6524,14 +6526,14 @@ public void onNextPressed(String code) { TLObject req; if (activityMode == MODE_CHANGE_LOGIN_EMAIL) { - TLRPC.TL_account_verifyEmail request = new TLRPC.TL_account_verifyEmail(); + TL_account.verifyEmail request = new TL_account.verifyEmail(); request.purpose = new TLRPC.TL_emailVerifyPurposeLoginChange(); TLRPC.TL_emailVerificationCode verification = new TLRPC.TL_emailVerificationCode(); verification.code = code; request.verification = verification; req = request; } else if (isFromSetup) { - TLRPC.TL_account_verifyEmail request = new TLRPC.TL_account_verifyEmail(); + TL_account.verifyEmail request = new TL_account.verifyEmail(); TLRPC.TL_emailVerifyPurposeLoginSetup setup = new TLRPC.TL_emailVerifyPurposeLoginSetup(); setup.phone_number = requestPhone; setup.phone_code_hash = phoneHash; @@ -6587,11 +6589,11 @@ public void onNextPressed(String code) { animateSuccess(() -> setPage(VIEW_REGISTER, true, params, false)); } else { animateSuccess(() -> { - if (response instanceof TLRPC.TL_account_emailVerified && activityMode == MODE_CHANGE_LOGIN_EMAIL) { + if (response instanceof TL_account.TL_emailVerified && activityMode == MODE_CHANGE_LOGIN_EMAIL) { finishFragment(); emailChangeFinishCallback.run(); - } else if (response instanceof TLRPC.TL_account_emailVerifiedLogin) { - fillNextCodeParams(params, ((TLRPC.TL_account_emailVerifiedLogin) response).sent_code); + } else if (response instanceof TL_account.TL_emailVerifiedLogin) { + fillNextCodeParams(params, ((TL_account.TL_emailVerifiedLogin) response).sent_code); } else if (response instanceof TLRPC.TL_auth_authorization) { onAuthSuccess((TLRPC.TL_auth_authorization) response); } @@ -6599,12 +6601,12 @@ public void onNextPressed(String code) { } } else { if (error.text.contains("SESSION_PASSWORD_NEEDED")) { - TLRPC.TL_account_getPassword req2 = new TLRPC.TL_account_getPassword(); + TL_account.getPassword req2 = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(req2, (response1, error1) -> AndroidUtilities.runOnUIThread(() -> { nextPressed = false; showDoneButton(false, true); if (error1 == null) { - TLRPC.account_Password password = (TLRPC.account_Password) response1; + TL_account.Password password = (TL_account.Password) response1; if (!TwoStepVerificationActivity.canHandleCurrentPassword(password, true)) { AlertsCreator.showUpdateAppAlert(getParentActivity(), getString("UpdateAppAlert", R.string.UpdateAppAlert), true); return; @@ -7058,7 +7060,7 @@ public class LoginActivityNewPasswordView extends SlideView { private String emailCode; private String newPassword; private String passwordString; - private TLRPC.account_Password currentPassword; + private TL_account.Password currentPassword; private Bundle currentParams; private boolean nextPressed; private int currentStage; @@ -7250,7 +7252,7 @@ public void setParams(Bundle params, boolean restore) { passwordString = currentParams.getString("password"); if (passwordString != null) { SerializedData data = new SerializedData(Utilities.hexToBytes(passwordString)); - currentPassword = TLRPC.account_Password.TLdeserialize(data, data.readInt32(false), false); + currentPassword = TL_account.Password.TLdeserialize(data, data.readInt32(false), false); TwoStepVerificationActivity.initPasswordNewAlgo(currentPassword); } newPassword = currentParams.getString("new_password"); @@ -7302,7 +7304,7 @@ private void recoverPassword(String password, String hint) { req.code = emailCode; if (!TextUtils.isEmpty(password)) { req.flags |= 1; - req.new_settings = new TLRPC.TL_account_passwordInputSettings(); + req.new_settings = new TL_account.passwordInputSettings(); req.new_settings.flags |= 1; req.new_settings.hint = hint != null ? hint : ""; req.new_settings.new_algo = currentPassword.new_algo; @@ -7317,10 +7319,10 @@ private void recoverPassword(String password, String hint) { RequestDelegate requestDelegate = (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (error != null && ("SRP_ID_INVALID".equals(error.text) || "NEW_SALT_INVALID".equals(error.text))) { - TLRPC.TL_account_getPassword getPasswordReq = new TLRPC.TL_account_getPassword(); + TL_account.getPassword getPasswordReq = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(getPasswordReq, (response2, error2) -> AndroidUtilities.runOnUIThread(() -> { if (error2 == null) { - currentPassword = (TLRPC.account_Password) response2; + currentPassword = (TL_account.Password) response2; TwoStepVerificationActivity.initPasswordNewAlgo(currentPassword); recoverPassword(password, hint); } @@ -8223,7 +8225,7 @@ private void tryResetAccount(String requestPhone, String phoneHash, String phone builder.setTitle(getString("ResetMyAccountWarning", R.string.ResetMyAccountWarning)); builder.setPositiveButton(getString("ResetMyAccountWarningReset", R.string.ResetMyAccountWarningReset), (dialogInterface, i) -> { needShowProgress(0); - TLRPC.TL_account_deleteAccount req = new TLRPC.TL_account_deleteAccount(); + TL_account.deleteAccount req = new TL_account.deleteAccount(); req.reason = "Forgot password"; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { needHideProgress(false); @@ -9157,12 +9159,12 @@ public void onNextPressed(String code) { lastError = error.text; if (error.text.contains("SESSION_PASSWORD_NEEDED")) { ok = true; - TLRPC.TL_account_getPassword req2 = new TLRPC.TL_account_getPassword(); + TL_account.getPassword req2 = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(req2, (response1, error1) -> AndroidUtilities.runOnUIThread(() -> { nextPressed = false; showDoneButton(false, true); if (error1 == null) { - TLRPC.account_Password password = (TLRPC.account_Password) response1; + TL_account.Password password = (TL_account.Password) response1; if (!TwoStepVerificationActivity.canHandleCurrentPassword(password, true)) { AlertsCreator.showUpdateAppAlert(getParentActivity(), getString("UpdateAppAlert", R.string.UpdateAppAlert), true); return; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ManageLinksActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ManageLinksActivity.java index 9bb5f9e6a9..dc31d7a199 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ManageLinksActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ManageLinksActivity.java @@ -5,7 +5,6 @@ import static org.telegram.messenger.LocaleController.getString; import android.content.Context; -import android.content.Intent; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; @@ -41,7 +40,6 @@ import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.ChatObject; import org.telegram.messenger.ContactsController; -import org.telegram.messenger.DialogObject; import org.telegram.messenger.DocumentObject; import org.telegram.messenger.Emoji; import org.telegram.messenger.FileLog; @@ -90,7 +88,7 @@ import java.util.HashMap; import java.util.Locale; -public class ManageLinksActivity extends BaseFragment { +public class ManageLinksActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate { private ListAdapter listViewAdapter; private RecyclerListView listView; @@ -663,7 +661,9 @@ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { if ((position >= linksStartRow && position < linksEndRow) || (position >= revokedLinksStartRow && position < revokedLinksEndRow)) { LinkCell cell = (LinkCell) view; cell.optionsView.callOnClick(); - view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} return true; } return false; @@ -1362,7 +1362,7 @@ public void setLink(TLRPC.TL_chatInviteExported invite, int position) { if (!TextUtils.isEmpty(invite.title)) { SpannableStringBuilder builder = new SpannableStringBuilder(invite.title); - Emoji.replaceEmoji(builder, titleView.getPaint().getFontMetricsInt(), (int) titleView.getPaint().getTextSize(), false); + Emoji.replaceEmoji(builder, titleView.getPaint().getFontMetricsInt(), false); titleView.setText(builder); } else if (invite.link.startsWith("https://t.me/+")) { titleView.setText(MessagesController.getInstance(currentAccount).linkPrefix + "/" + invite.link.substring("https://t.me/+".length())); @@ -1773,4 +1773,30 @@ public void onTransitionAnimationStart(boolean isOpen, boolean backward) { super.onTransitionAnimationStart(isOpen, backward); notificationsLocker.lock(); } + + @Override + public boolean onFragmentCreate() { + getNotificationCenter().addObserver(this, NotificationCenter.dialogDeleted); + return super.onFragmentCreate(); + } + + @Override + public void onFragmentDestroy() { + getNotificationCenter().removeObserver(this, NotificationCenter.dialogDeleted); + super.onFragmentDestroy(); + } + + @Override + public void didReceivedNotification(int id, int account, Object... args) { + if (id == NotificationCenter.dialogDeleted) { + long dialogId = (long) args[0]; + if (dialogId == -this.currentChatId) { + if (parentLayout != null && parentLayout.getLastFragment() == this) { + finishFragment(); + } else { + removeSelfFromStack(); + } + } + } + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/MessageSeenView.java b/TMessagesProj/src/main/java/org/telegram/ui/MessageSeenView.java index bbce646c97..6464c14512 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/MessageSeenView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/MessageSeenView.java @@ -34,6 +34,7 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import org.telegram.ui.ActionBar.SimpleTextView; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Components.AvatarDrawable; @@ -105,8 +106,8 @@ public MessageSeenView(@NonNull Context context, int currentAccount, MessageObje } long finalFromId = fromId; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { - if (error == null) { - TLRPC.Vector vector = (TLRPC.Vector) response; + if (error == null && response instanceof Vector) { + Vector vector = (Vector) response; ArrayList unknownUsers = new ArrayList<>(); ArrayList unknownChats = new ArrayList<>(); HashMap usersLocal = new HashMap<>(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/MessageStatisticActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/MessageStatisticActivity.java index 494e6e9236..ddbf60b798 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/MessageStatisticActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/MessageStatisticActivity.java @@ -494,7 +494,7 @@ protected void onDetachedFromWindow() { if (message.length() > 150) { message = message.subSequence(0, 150); } - message = Emoji.replaceEmoji(message, avatarContainer.getSubtitlePaint().getFontMetricsInt(), AndroidUtilities.dp(17), false); + message = Emoji.replaceEmoji(message, avatarContainer.getSubtitlePaint().getFontMetricsInt(), false); } else { message = messageObject.messageText; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/MultiContactsSelectorBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/MultiContactsSelectorBottomSheet.java index c8761049a1..e090c470e1 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/MultiContactsSelectorBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/MultiContactsSelectorBottomSheet.java @@ -30,6 +30,7 @@ import org.telegram.messenger.R; import org.telegram.messenger.UserConfig; import org.telegram.messenger.UserObject; +import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.Theme; @@ -60,7 +61,7 @@ public interface SelectorListener { void onUserSelected(List ids); } - public static void open(int maxCount, SelectorListener selectorListener) { + public static void open(Boolean bots, Boolean premium, int maxCount, SelectorListener selectorListener) { BaseFragment fragment = LaunchActivity.getLastFragment(); if (fragment == null) { return; @@ -68,7 +69,7 @@ public static void open(int maxCount, SelectorListener selectorListener) { if (instance != null) { return; } - MultiContactsSelectorBottomSheet sheet = new MultiContactsSelectorBottomSheet(fragment, true, maxCount, selectorListener); + MultiContactsSelectorBottomSheet sheet = new MultiContactsSelectorBottomSheet(fragment, true, maxCount, bots, premium, selectorListener); sheet.show(); instance = sheet; } @@ -86,19 +87,31 @@ public static void open(int maxCount, SelectorListener selectorListener) { private final HashSet selectedIds = new HashSet<>(); private final List contacts = new ArrayList<>(); private final List hints = new ArrayList<>(); - private final List foundedUsers = new ArrayList<>(); + private final List foundUsers = new ArrayList<>(); private final Map> contactsMap = new HashMap<>(); private final List contactsLetters = new ArrayList<>(); private final HashMap allSelectedObjects = new LinkedHashMap<>(); private String query; private SelectorAdapter selectorAdapter; private int listPaddingTop = AndroidUtilities.dp(56 + 64); - private int lastRequestId; + private int lastRequestId = -1; private float recipientsBtnExtraSpace; private ReplacementSpan recipientsBtnSpaceSpan; private int maxCount; private SelectorListener selectorListener; + private Boolean filterBots; + private Boolean filterPremium; + private boolean filter(TLRPC.User user) { + if (user == null) + return false; + if (filterBots != null && UserObject.isBot(user) != filterBots) + return false; + if (filterPremium != null && user != null && user.premium != filterPremium) + return false; + return true; + } + private final Runnable remoteSearchRunnable = new Runnable() { @Override public void run() { @@ -110,10 +123,36 @@ public void run() { }; private void loadData(String query) { - lastRequestId = BoostRepository.searchContacts(lastRequestId, query, arg -> { - foundedUsers.clear(); - foundedUsers.addAll(arg); - updateList(true, true); + if (lastRequestId >= 0) { + ConnectionsManager.getInstance(currentAccount).cancelRequest(lastRequestId, true); + lastRequestId = -1; + } + BoostRepository.searchContactsLocally(query, filterBots != null && filterBots, users -> { + HashSet foundUserIds = new HashSet<>(); + foundUsers.clear(); + if (users != null) { + for (TLRPC.User user : users) { + if (user != null && !foundUserIds.contains(user.id) && filter(user)) { + foundUsers.add(user); + foundUserIds.add(user.id); + } + } + } + if (filterBots != null && filterBots) { + lastRequestId = BoostRepository.searchContacts(query, true, newUsers -> { + if (newUsers != null) { + for (TLRPC.User user : newUsers) { + if (user != null && !foundUserIds.contains(user.id) && filter(user)) { + foundUsers.add(user); + foundUserIds.add(user.id); + } + } + } + updateList(true, true); + }); + } else { + updateList(true, true); + } }); } @@ -131,10 +170,14 @@ public void draw(@NonNull Canvas canvas, CharSequence text, int start, int end, }; } - public MultiContactsSelectorBottomSheet(BaseFragment fragment, boolean needFocus, int maxCount, SelectorListener selectorListener) { + public MultiContactsSelectorBottomSheet(BaseFragment fragment, boolean needFocus, int maxCount, Boolean bot, Boolean premium, SelectorListener selectorListener) { super(fragment, needFocus, false, false, fragment.getResourceProvider()); this.maxCount = maxCount; + this.filterBots = bot; + this.filterPremium = premium; this.selectorListener = selectorListener; + actionBar.setTitle(getTitle()); + headerView = new SelectorHeaderCell(getContext(), resourcesProvider) { @Override protected int getHeaderHeight() { @@ -265,6 +308,9 @@ public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull R contactsMap.putAll(ContactsController.getInstance(currentAccount).usersSectionsDict); contactsLetters.addAll(ContactsController.getInstance(currentAccount).sortedUsersSectionsArray); hints.addAll(MediaDataController.getInstance(currentAccount).hints); + if (filterBots != null && filterBots) { + hints.addAll(MediaDataController.getInstance(currentAccount).webapps); + } updateList(false, true); fixNavigationBar(); } @@ -363,7 +409,11 @@ private void updateActionButton(boolean animated) { SpannableStringBuilder stringBuilder = new SpannableStringBuilder(); if (selectedIds.size() == 0) { stringBuilder.append("d").setSpan(recipientsBtnSpaceSpan, 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - stringBuilder.append(LocaleController.getString(R.string.ChooseUsers)); + if (filterBots != null && filterBots) { + stringBuilder.append(LocaleController.getString(maxCount > 1 ? R.string.ChooseBots : R.string.ChooseBot)); + } else { + stringBuilder.append(LocaleController.getString(R.string.ChooseUsers)); + } } else { stringBuilder.append(LocaleController.getString(R.string.GiftPremiumProceedBtn)); } @@ -414,7 +464,7 @@ public void updateItems(boolean animated, boolean notify) { int h = 0; if (isSearching()) { - for (TLRPC.User foundedUser : foundedUsers) { + for (TLRPC.User foundedUser : foundUsers) { h += dp(56); items.add(SelectorAdapter.Item.asUser(foundedUser, selectedIds.contains(foundedUser.id))); } @@ -426,6 +476,9 @@ public void updateItems(boolean animated, boolean notify) { if (user.self || user.bot || UserObject.isService(user.id) || UserObject.isDeleted(user)) { continue; } + if (!filter(user)) { + continue; + } h += dp(56); userItems.add(SelectorAdapter.Item.asUser(user, selectedIds.contains(user.id))); } @@ -435,15 +488,38 @@ public void updateItems(boolean animated, boolean notify) { items.addAll(userItems); } } + final long self = UserConfig.getInstance(currentAccount).getClientUserId(); + if (filterBots != null && filterBots) { + List userItems = new ArrayList<>(); + for (TLRPC.Dialog dialog : MessagesController.getInstance(currentAccount).getAllDialogs()) { + if (dialog.id < 0) continue; + final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(dialog.id); + if (!filter(user)) { + continue; + } + h += dp(56); + userItems.add(SelectorAdapter.Item.asUser(user, selectedIds.contains(user.id))); + } + if (!userItems.isEmpty()) { + h += dp(32); + items.add(SelectorAdapter.Item.asTopSection(LocaleController.getString(R.string.SearchApps))); + items.addAll(userItems); + } + } for (String contactLetter : contactsLetters) { List userItems = new ArrayList<>(); - for (TLRPC.TL_contact contact : contactsMap.get(contactLetter)) { - long myUid = UserConfig.getInstance(currentAccount).getClientUserId(); - if (contact.user_id == myUid) { + List contacts = contactsMap.get(contactLetter); + if (contacts == null) continue; + + for (final TLRPC.TL_contact contact : contacts) { + if (contact.user_id == self) { + continue; + } + final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(contact.user_id); + if (!filter(user)) { continue; } h += dp(56); - TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(contact.user_id); userItems.add(SelectorAdapter.Item.asUser(user, selectedIds.contains(user.id))); } @@ -481,6 +557,9 @@ public void onConfigurationChanged(Configuration newConfig) { @Override protected CharSequence getTitle() { + if (filterBots != null && filterBots) { + return LocaleController.getString(maxCount > 1 ? R.string.ChooseBots : R.string.ChooseBot); + } return LocaleController.getString(R.string.ChooseUsers); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/NewContactBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/NewContactBottomSheet.java index d8410d7f2d..02fb3099af 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/NewContactBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/NewContactBottomSheet.java @@ -794,7 +794,7 @@ private void setCountryHint(String code, CountrySelectActivity.Country country) if (flag != null) { sb.append(flag); } - setCountryButtonText(Emoji.replaceEmoji(sb, countryFlag.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false)); + setCountryButtonText(Emoji.replaceEmoji(sb, countryFlag.getPaint().getFontMetricsInt(), false)); countryCodeForHint = code; wasCountryHintIndex = -1; invalidateCountryHint(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/NotificationsSettingsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/NotificationsSettingsActivity.java index fbb225f9d3..c4dd00f737 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/NotificationsSettingsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/NotificationsSettingsActivity.java @@ -48,6 +48,7 @@ import org.telegram.messenger.Utilities; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; @@ -563,7 +564,7 @@ public boolean supportsPredictiveItemAnimations() { return; } reseting = true; - TLRPC.TL_account_resetNotifySettings req = new TLRPC.TL_account_resetNotifySettings(); + TL_account.resetNotifySettings req = new TL_account.resetNotifySettings(); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { getMessagesController().enableJoined = true; reseting = false; @@ -626,7 +627,7 @@ public boolean supportsPredictiveItemAnimations() { MessagesController.getInstance(currentAccount).enableJoined = !enabled; editor.putBoolean("EnableContactJoined", !enabled); editor.commit(); - TLRPC.TL_account_setContactSignUpNotification req = new TLRPC.TL_account_setContactSignUpNotification(); + TL_account.setContactSignUpNotification req = new TL_account.setContactSignUpNotification(); req.silent = enabled; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/NotificationsSoundActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/NotificationsSoundActivity.java index 663d823efd..ebd68353d9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/NotificationsSoundActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/NotificationsSoundActivity.java @@ -46,6 +46,7 @@ import org.telegram.messenger.ringtone.RingtoneDataStore; import org.telegram.messenger.ringtone.RingtoneUploader; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenu; import org.telegram.ui.ActionBar.AlertDialog; @@ -68,7 +69,6 @@ import java.io.File; import java.io.IOException; -import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; @@ -272,7 +272,7 @@ private void deleteSelectedMessages() { for (int i = 0; i < documentsToRemove.size(); i++) { TLRPC.Document document = documentsToRemove.get(i); - TLRPC.TL_account_saveRingtone req = new TLRPC.TL_account_saveRingtone(); + TL_account.saveRingtone req = new TL_account.saveRingtone(); req.id = new TLRPC.TL_inputDocument(); req.id.id = document.id; req.id.access_hash = document.access_hash; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PassportActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PassportActivity.java index 790de47398..4b77817ef5 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PassportActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PassportActivity.java @@ -94,6 +94,8 @@ import org.telegram.tgnet.RequestDelegate; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenu; import org.telegram.ui.ActionBar.ActionBarMenuItem; @@ -205,14 +207,14 @@ public class PassportActivity extends BaseFragment implements NotificationCenter private String currentResidence = ""; private String currentGender; private int[] currentExpireDate = new int[3]; - private TLRPC.TL_account_authorizationForm currentForm; + private TL_account.authorizationForm currentForm; private TLRPC.TL_secureRequiredType currentType; private TLRPC.TL_secureRequiredType currentDocumentsType; private ArrayList availableDocumentTypes; private TLRPC.TL_secureValue currentTypeValue; private TLRPC.TL_secureValue currentDocumentsTypeValue; - private TLRPC.account_Password currentPassword; + private TL_account.Password currentPassword; private TLRPC.TL_auth_sentCode currentPhoneVerification; private ActionBarMenuItem doneItem; @@ -348,7 +350,7 @@ private interface ErrorRunnable { private PhotoViewer.PhotoViewerProvider provider = new PhotoViewer.EmptyPhotoViewerProvider() { @Override - public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { + public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview, boolean closing) { if (index < 0 || index >= currentPhotoViewerLayout.getChildCount()) { return null; } @@ -668,7 +670,7 @@ public int getObserverTag() { } } - public PassportActivity(int type, long botId, String scope, String publicKey, String payload, String nonce, String callbackUrl, TLRPC.TL_account_authorizationForm form, TLRPC.account_Password accountPassword) { + public PassportActivity(int type, long botId, String scope, String publicKey, String payload, String nonce, String callbackUrl, TL_account.authorizationForm form, TL_account.Password accountPassword) { this(type, form, accountPassword, null, null, null, null, null, null); currentBotId = botId; currentPayload = payload; @@ -846,7 +848,7 @@ public int compare(TLRPC.SecureValueError e1, TLRPC.SecureValueError e2) { } } - public PassportActivity(int type, TLRPC.TL_account_authorizationForm form, TLRPC.account_Password accountPassword, TLRPC.TL_secureRequiredType secureType, TLRPC.TL_secureValue secureValue, TLRPC.TL_secureRequiredType secureDocumentsType, TLRPC.TL_secureValue secureDocumentsValue, HashMap values, HashMap documentValues) { + public PassportActivity(int type, TL_account.authorizationForm form, TL_account.Password accountPassword, TLRPC.TL_secureRequiredType secureType, TLRPC.TL_secureValue secureValue, TLRPC.TL_secureRequiredType secureDocumentsType, TLRPC.TL_secureValue secureDocumentsValue, HashMap values, HashMap documentValues) { super(); currentActivityType = type; currentForm = form; @@ -1217,7 +1219,7 @@ public void onError(String error, String text) { return; } } else if (currentActivityType == TYPE_EMAIL_VERIFICATION) { - TLRPC.TL_account_verifyEmail req = new TLRPC.TL_account_verifyEmail(); + TL_account.verifyEmail req = new TL_account.verifyEmail(); req.purpose = new TLRPC.TL_emailVerifyPurposePassport(); TLRPC.TL_emailVerificationCode code = new TLRPC.TL_emailVerificationCode(); code.code = inputFields[FIELD_EMAIL].getText().toString(); @@ -1412,10 +1414,10 @@ private void createPhoneVerificationInterface(Context context) { } private void loadPasswordInfo() { - TLRPC.TL_account_getPassword req = new TLRPC.TL_account_getPassword(); + TL_account.getPassword req = new TL_account.getPassword(); int reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (response != null) { - currentPassword = (TLRPC.account_Password) response; + currentPassword = (TL_account.Password) response; if (!TwoStepVerificationActivity.canHandleCurrentPassword(currentPassword, false)) { AlertsCreator.showUpdateAppAlert(getParentActivity(), LocaleController.getString(R.string.UpdateAppAlert), true); return; @@ -1697,7 +1699,7 @@ private void onPasswordDone(final boolean saved) { } Utilities.globalQueue.postRunnable(() -> { - TLRPC.TL_account_getPasswordSettings req = new TLRPC.TL_account_getPasswordSettings(); + TL_account.getPasswordSettings req = new TL_account.getPasswordSettings(); final byte[] x_bytes; if (saved) { @@ -1743,12 +1745,12 @@ private void openRequestInterface() { } private void resetSecret() { - TLRPC.TL_account_updatePasswordSettings req2 = new TLRPC.TL_account_updatePasswordSettings(); + TL_account.updatePasswordSettings req2 = new TL_account.updatePasswordSettings(); if (currentPassword.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) { TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo = (TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) currentPassword.current_algo; req2.password = SRPHelper.startCheck(x_bytes, currentPassword.srp_id, currentPassword.srp_B, algo); } - req2.new_settings = new TLRPC.TL_account_passwordInputSettings(); + req2.new_settings = new TL_account.passwordInputSettings(); req2.new_settings.new_secure_settings = new TLRPC.TL_secureSecretSettings(); req2.new_settings.new_secure_settings.secure_secret = new byte[0]; req2.new_settings.new_secure_settings.secure_algo = new TLRPC.TL_securePasswordKdfAlgoUnknown(); @@ -1756,10 +1758,10 @@ private void resetSecret() { req2.new_settings.flags |= 4; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (error != null && "SRP_ID_INVALID".equals(error.text)) { - TLRPC.TL_account_getPassword getPasswordReq = new TLRPC.TL_account_getPassword(); + TL_account.getPassword getPasswordReq = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(getPasswordReq, (response2, error2) -> AndroidUtilities.runOnUIThread(() -> { if (error2 == null) { - currentPassword = (TLRPC.account_Password) response2; + currentPassword = (TL_account.Password) response2; TwoStepVerificationActivity.initPasswordNewAlgo(currentPassword); resetSecret(); } @@ -1774,12 +1776,12 @@ private void generateNewSecret() { Utilities.globalQueue.postRunnable(() -> { Utilities.random.setSeed(currentPassword.secure_random); - TLRPC.TL_account_updatePasswordSettings req1 = new TLRPC.TL_account_updatePasswordSettings(); + TL_account.updatePasswordSettings req1 = new TL_account.updatePasswordSettings(); if (currentPassword.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) { TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo = (TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) currentPassword.current_algo; req1.password = SRPHelper.startCheck(x_bytes, currentPassword.srp_id, currentPassword.srp_B, algo); } - req1.new_settings = new TLRPC.TL_account_passwordInputSettings(); + req1.new_settings = new TL_account.passwordInputSettings(); secureSecret = getRandomSecret(); secureSecretId = Utilities.bytesToLong(Utilities.computeSHA256(secureSecret)); @@ -1802,10 +1804,10 @@ private void generateNewSecret() { } ConnectionsManager.getInstance(currentAccount).sendRequest(req1, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (error != null && "SRP_ID_INVALID".equals(error.text)) { - TLRPC.TL_account_getPassword getPasswordReq = new TLRPC.TL_account_getPassword(); + TL_account.getPassword getPasswordReq = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(getPasswordReq, (response2, error2) -> AndroidUtilities.runOnUIThread(() -> { if (error2 == null) { - currentPassword = (TLRPC.account_Password) response2; + currentPassword = (TL_account.Password) response2; TwoStepVerificationActivity.initPasswordNewAlgo(currentPassword); generateNewSecret(); } @@ -1813,7 +1815,7 @@ private void generateNewSecret() { return; } if (currentForm == null) { - currentForm = new TLRPC.TL_account_authorizationForm(); + currentForm = new TL_account.authorizationForm(); } openRequestInterface(); })); @@ -1823,10 +1825,10 @@ private void generateNewSecret() { @Override public void run(final TLObject response, final TLRPC.TL_error error) { if (error != null && "SRP_ID_INVALID".equals(error.text)) { - TLRPC.TL_account_getPassword getPasswordReq = new TLRPC.TL_account_getPassword(); + TL_account.getPassword getPasswordReq = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(getPasswordReq, (response2, error2) -> AndroidUtilities.runOnUIThread(() -> { if (error2 == null) { - currentPassword = (TLRPC.account_Password) response2; + currentPassword = (TL_account.Password) response2; TwoStepVerificationActivity.initPasswordNewAlgo(currentPassword); onPasswordDone(saved); } @@ -1835,7 +1837,7 @@ public void run(final TLObject response, final TLRPC.TL_error error) { } if (error == null) { Utilities.globalQueue.postRunnable(() -> { - TLRPC.TL_account_passwordSettings settings = (TLRPC.TL_account_passwordSettings) response; + TL_account.passwordSettings settings = (TL_account.passwordSettings) response; byte[] secure_salt; if (settings.secure_settings != null) { secureSecret = settings.secure_settings.secure_secret; @@ -1888,13 +1890,13 @@ public void run(final TLObject response, final TLRPC.TL_error error) { } } } else if (currentBotId == 0) { - TLRPC.TL_account_getAllSecureValues req12 = new TLRPC.TL_account_getAllSecureValues(); + TL_account.getAllSecureValues req12 = new TL_account.getAllSecureValues(); ConnectionsManager.getInstance(currentAccount).sendRequest(req12, (response1, error1) -> AndroidUtilities.runOnUIThread(() -> { - if (response1 != null) { - currentForm = new TLRPC.TL_account_authorizationForm(); - TLRPC.Vector vector = (TLRPC.Vector) response1; + if (response1 instanceof Vector) { + currentForm = new TL_account.authorizationForm(); + Vector vector = (Vector) response1; for (int a = 0, size = vector.objects.size(); a < size; a++) { - currentForm.values.add((TLRPC.TL_secureValue) vector.objects.get(a)); + currentForm.values.add(vector.objects.get(a)); } openRequestInterface(); } else { @@ -2251,7 +2253,7 @@ public ValueToSend(TLRPC.TL_secureValue v, boolean s, boolean t) { valuesToSend.add(new ValueToSend(value, requiredType.selfie_required, requiredType.translation_required)); } showEditDoneProgress(false, true); - TLRPC.TL_account_acceptAuthorization req = new TLRPC.TL_account_acceptAuthorization(); + TL_account.acceptAuthorization req = new TL_account.acceptAuthorization(); req.bot_id = currentBotId; req.scope = currentScope; req.public_key = currentPublicKey; @@ -2450,7 +2452,7 @@ private void createManageInterface(Context context) { builder.setTitle(LocaleController.getString(R.string.TelegramPassportDeleteTitle)); builder.setMessage(LocaleController.getString(R.string.TelegramPassportDeleteAlert)); builder.setPositiveButton(LocaleController.getString(R.string.Delete), (dialog, which) -> { - TLRPC.TL_account_deleteSecureValue req = new TLRPC.TL_account_deleteSecureValue(); + TL_account.deleteSecureValue req = new TL_account.deleteSecureValue(); for (int a = 0; a < currentForm.values.size(); a++) { req.types.add(currentForm.values.get(a).type); } @@ -5627,7 +5629,7 @@ public void saveValue(final TLRPC.TL_secureRequiredType requiredType, final Stri final PassportActivityDelegate currentDelegate = this; final TLRPC.TL_inputSecureValue finalFileInputSecureValue = fileInputSecureValue; - final TLRPC.TL_account_saveSecureValue req = new TLRPC.TL_account_saveSecureValue(); + final TL_account.saveSecureValue req = new TL_account.saveSecureValue(); req.value = inputSecureValue; req.secure_secret_id = secureSecretId; ConnectionsManager.getInstance(currentAccount).sendRequest(req, new RequestDelegate() { @@ -5721,12 +5723,12 @@ private void onResult(final TLRPC.TL_error error, final TLRPC.TL_secureValue new public void run(final TLObject response, final TLRPC.TL_error error) { if (error != null) { if (error.text.equals("EMAIL_VERIFICATION_NEEDED")) { - TLRPC.TL_account_sendVerifyEmailCode req = new TLRPC.TL_account_sendVerifyEmailCode(); + TL_account.sendVerifyEmailCode req = new TL_account.sendVerifyEmailCode(); req.purpose = new TLRPC.TL_emailVerifyPurposePassport(); req.email = text; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response1, error1) -> AndroidUtilities.runOnUIThread(() -> { if (response1 != null) { - TLRPC.TL_account_sentEmailCode res = (TLRPC.TL_account_sentEmailCode) response1; + TL_account.sentEmailCode res = (TL_account.sentEmailCode) response1; HashMap values = new HashMap<>(); values.put("email", text); values.put("pattern", res.email_pattern); @@ -5752,7 +5754,7 @@ public void run(final TLObject response, final TLRPC.TL_error error) { } if (error == null && finalFileInputSecureValue != null) { final TLRPC.TL_secureValue pendingValue = (TLRPC.TL_secureValue) response; - final TLRPC.TL_account_saveSecureValue req = new TLRPC.TL_account_saveSecureValue(); + final TL_account.saveSecureValue req = new TL_account.saveSecureValue(); req.value = finalFileInputSecureValue; req.secure_secret_id = secureSecretId; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response12, error12) -> onResult(error12, (TLRPC.TL_secureValue) response12, pendingValue)); @@ -5807,7 +5809,7 @@ private void deleteValueInternal(final TLRPC.TL_secureRequiredType requiredType, if (requiredType == null) { return; } - TLRPC.TL_account_deleteSecureValue req = new TLRPC.TL_account_deleteSecureValue(); + TL_account.deleteSecureValue req = new TL_account.deleteSecureValue(); if (documentOnly && documentRequiredType != null) { req.types.add(documentRequiredType.type); } else { @@ -6298,7 +6300,7 @@ private void startPhoneVerification(boolean checkPermissions, final String phone } } } - final TLRPC.TL_account_sendVerifyPhoneCode req = new TLRPC.TL_account_sendVerifyPhoneCode(); + final TL_account.sendVerifyPhoneCode req = new TL_account.sendVerifyPhoneCode(); req.phone_number = phone; req.settings = new TLRPC.TL_codeSettings(); req.settings.allow_flashcall = simcardAvailable && allowCall; @@ -6539,7 +6541,7 @@ public void didReceivedNotification(int id, int account, Object... args) { inputFields[FIELD_PASSWORD].setText((String) args[7]); } if (args[6] == null) { - currentPassword = new TLRPC.TL_account_password(); + currentPassword = new TL_account.TL_password(); currentPassword.current_algo = (TLRPC.PasswordKdfAlgo) args[1]; currentPassword.new_secure_algo = (TLRPC.SecurePasswordKdfAlgo) args[2]; currentPassword.secure_random = (byte[]) args[3]; @@ -7790,7 +7792,7 @@ public void onNextPressed(String code) { } waitingForEvent = false; showEditDoneProgress(true, true); - final TLRPC.TL_account_verifyPhone req = new TLRPC.TL_account_verifyPhone(); + final TL_account.verifyPhone req = new TL_account.verifyPhone(); req.phone_number = phone; req.phone_code = code; req.phone_code_hash = phoneHash; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PaymentFormActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PaymentFormActivity.java index 63c6eb76d4..4fea2eb11e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PaymentFormActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PaymentFormActivity.java @@ -115,6 +115,7 @@ import org.telegram.tgnet.RequestDelegate; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenu; import org.telegram.ui.ActionBar.ActionBarMenuItem; @@ -144,7 +145,6 @@ import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.TypefaceSpan; import org.telegram.ui.Components.URLSpanNoUnderline; -import org.telegram.ui.Components.UndoView; import org.telegram.ui.Stars.StarsIntroActivity; import java.io.BufferedReader; @@ -256,7 +256,7 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen private float shiftDp = -4.5f; - private TLRPC.account_Password currentPassword; + private TL_account.Password currentPassword; private boolean waitingForEmail; private int emailCodeLength = 6; private Runnable shortPollRunnable; @@ -354,7 +354,7 @@ default void onFragmentDestroyed() { } - default void currentPasswordUpdated(TLRPC.account_Password password) { + default void currentPasswordUpdated(TL_account.Password password) { } } @@ -458,7 +458,7 @@ public void setPaymentFormCallback(PaymentFormCallback callback) { paymentFormCallback = callback; } - private void setCurrentPassword(TLRPC.account_Password password) { + private void setCurrentPassword(TL_account.Password password) { if (password != null && password.has_password) { if (getParentActivity() == null) { return; @@ -1181,15 +1181,20 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { webView.setWebViewClient(new WebViewClient() { @Override public boolean onRenderProcessGone(WebView view, RenderProcessGoneDetail detail) { - if (!AndroidUtilities.isSafeToShow(getContext())) { + try { + if (!AndroidUtilities.isSafeToShow(getContext())) { + return true; + } + new AlertDialog.Builder(getContext(), resourcesProvider) + .setTitle(getString(R.string.ChromeCrashTitle)) + .setMessage(AndroidUtilities.replaceSingleTag(getString(R.string.ChromeCrashMessage), () -> Browser.openUrl(getContext(), "https://play.google.com/store/apps/details?id=com.google.android.webview"))) + .setPositiveButton(getString(R.string.OK), null) + .show(); return true; + } catch (Exception e) { + FileLog.e(e); + return false; } - new AlertDialog.Builder(getContext(), resourcesProvider) - .setTitle(getString(R.string.ChromeCrashTitle)) - .setMessage(AndroidUtilities.replaceSingleTag(getString(R.string.ChromeCrashMessage), () -> Browser.openUrl(getContext(), "https://play.google.com/store/apps/details?id=com.google.android.webview"))) - .setPositiveButton(getString(R.string.OK), null) - .show(); - return true; } @Override @@ -2434,15 +2439,20 @@ public boolean onTouchEvent(MotionEvent event) { webView.setWebViewClient(new WebViewClient() { @Override public boolean onRenderProcessGone(WebView view, RenderProcessGoneDetail detail) { - if (!AndroidUtilities.isSafeToShow(getContext())) { + try { + if (!AndroidUtilities.isSafeToShow(getContext())) { + return true; + } + new AlertDialog.Builder(getContext(), resourcesProvider) + .setTitle(getString(R.string.ChromeCrashTitle)) + .setMessage(AndroidUtilities.replaceSingleTag(getString(R.string.ChromeCrashMessage), () -> Browser.openUrl(getContext(), "https://play.google.com/store/apps/details?id=com.google.android.webview"))) + .setPositiveButton(getString(R.string.OK), null) + .show(); return true; + } catch (Exception e) { + FileLog.e(e); + return false; } - new AlertDialog.Builder(getContext(), resourcesProvider) - .setTitle(getString(R.string.ChromeCrashTitle)) - .setMessage(AndroidUtilities.replaceSingleTag(getString(R.string.ChromeCrashMessage), () -> Browser.openUrl(getContext(), "https://play.google.com/store/apps/details?id=com.google.android.webview"))) - .setPositiveButton(getString(R.string.OK), null) - .show(); - return true; } @Override @@ -2577,7 +2587,7 @@ public void afterTextChanged(Editable s) { settingsCell[1].setText(LocaleController.getString(R.string.ResendCode), true); linearLayout2.addView(settingsCell[1], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); settingsCell[1].setOnClickListener(v -> { - TLRPC.TL_account_resendPasswordEmail req = new TLRPC.TL_account_resendPasswordEmail(); + TL_account.resendPasswordEmail req = new TL_account.resendPasswordEmail(); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { }); @@ -3007,11 +3017,11 @@ private void loadPasswordInfo() { return; } loadingPasswordInfo = true; - TLRPC.TL_account_getPassword req = new TLRPC.TL_account_getPassword(); + TL_account.getPassword req = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { loadingPasswordInfo = false; if (error == null) { - currentPassword = (TLRPC.account_Password) response; + currentPassword = (TL_account.Password) response; if (!TwoStepVerificationActivity.canHandleCurrentPassword(currentPassword, false)) { AlertsCreator.showUpdateAppAlert(getParentActivity(), LocaleController.getString(R.string.UpdateAppAlert), true); return; @@ -3419,7 +3429,7 @@ public void onFragmentDestroyed() { } @Override - public void currentPasswordUpdated(TLRPC.account_Password password) { + public void currentPasswordUpdated(TL_account.Password password) { currentPassword = password; } }); @@ -3600,7 +3610,7 @@ private void sendSavePassword(final boolean clear) { return; } showEditDoneProgress(true, true); - TLRPC.TL_account_confirmPasswordEmail req = new TLRPC.TL_account_confirmPasswordEmail(); + TL_account.confirmPasswordEmail req = new TL_account.confirmPasswordEmail(); req.code = code; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { showEditDoneProgress(true, false); @@ -3632,14 +3642,14 @@ private void sendSavePassword(final boolean clear) { } }), ConnectionsManager.RequestFlagFailOnServerErrors | ConnectionsManager.RequestFlagWithoutLogin); } else { - final TLRPC.TL_account_updatePasswordSettings req = new TLRPC.TL_account_updatePasswordSettings(); + final TL_account.updatePasswordSettings req = new TL_account.updatePasswordSettings(); final String email; final String firstPassword; if (clear) { doneItem.setVisibility(View.VISIBLE); email = null; firstPassword = null; - req.new_settings = new TLRPC.TL_account_passwordInputSettings(); + req.new_settings = new TL_account.passwordInputSettings(); req.new_settings.flags = 2; req.new_settings.email = ""; req.password = new TLRPC.TL_inputCheckPasswordEmpty(); @@ -3672,7 +3682,7 @@ private void sendSavePassword(final boolean clear) { } req.password = new TLRPC.TL_inputCheckPasswordEmpty(); - req.new_settings = new TLRPC.TL_account_passwordInputSettings(); + req.new_settings = new TL_account.passwordInputSettings(); req.new_settings.flags |= 1; req.new_settings.hint = ""; req.new_settings.new_algo = currentPassword.new_algo; @@ -3684,10 +3694,10 @@ private void sendSavePassword(final boolean clear) { Utilities.globalQueue.postRunnable(() -> { RequestDelegate requestDelegate = (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (error != null && "SRP_ID_INVALID".equals(error.text)) { - TLRPC.TL_account_getPassword getPasswordReq = new TLRPC.TL_account_getPassword(); + TL_account.getPassword getPasswordReq = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(getPasswordReq, (response2, error2) -> AndroidUtilities.runOnUIThread(() -> { if (error2 == null) { - currentPassword = (TLRPC.account_Password) response2; + currentPassword = (TL_account.Password) response2; TwoStepVerificationActivity.initPasswordNewAlgo(currentPassword); sendSavePassword(clear); } @@ -4436,10 +4446,10 @@ private void checkPassword() { final String password = inputFields[FIELD_SAVEDPASSWORD].getText().toString(); showEditDoneProgress(true, true); setDonePressed(true); - final TLRPC.TL_account_getPassword req = new TLRPC.TL_account_getPassword(); + final TL_account.getPassword req = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (error == null) { - TLRPC.account_Password currentPassword = (TLRPC.account_Password) response; + TL_account.Password currentPassword = (TL_account.Password) response; if (!TwoStepVerificationActivity.canHandleCurrentPassword(currentPassword, false)) { AlertsCreator.showUpdateAppAlert(getParentActivity(), LocaleController.getString(R.string.UpdateAppAlert), true); return; @@ -4459,7 +4469,7 @@ private void checkPassword() { x_bytes = null; } - final TLRPC.TL_account_getTmpPassword req1 = new TLRPC.TL_account_getTmpPassword(); + final TL_account.getTmpPassword req1 = new TL_account.getTmpPassword(); req1.period = 60 * 30; RequestDelegate requestDelegate = (response1, error1) -> AndroidUtilities.runOnUIThread(() -> { @@ -4467,7 +4477,7 @@ private void checkPassword() { setDonePressed(false); if (response1 != null) { passwordOk = true; - UserConfig.getInstance(currentAccount).tmpPassword = (TLRPC.TL_account_tmpPassword) response1; + UserConfig.getInstance(currentAccount).tmpPassword = (TL_account.tmpPassword) response1; UserConfig.getInstance(currentAccount).saveConfig(false); goToNextStep(); } else { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PeerColorActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PeerColorActivity.java index 659d9b45d8..834084b7d3 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PeerColorActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PeerColorActivity.java @@ -3,6 +3,8 @@ import static org.telegram.messenger.AndroidUtilities.dp; import static org.telegram.messenger.AndroidUtilities.dpf2; import static org.telegram.messenger.AndroidUtilities.lerp; +import static org.telegram.messenger.LocaleController.getString; +import static org.telegram.ui.Stars.StarsController.findAttribute; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -24,6 +26,7 @@ import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.PorterDuffXfermode; +import android.graphics.Rect; import android.graphics.RectF; import android.graphics.Shader; import android.graphics.drawable.Drawable; @@ -45,6 +48,7 @@ import androidx.annotation.Nullable; import androidx.core.graphics.ColorUtils; import androidx.recyclerview.widget.DefaultItemAnimator; +import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -52,17 +56,24 @@ import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.BuildVars; import org.telegram.messenger.ChatObject; +import org.telegram.messenger.DialogObject; +import org.telegram.messenger.DocumentObject; import org.telegram.messenger.Emoji; +import org.telegram.messenger.FileLoader; +import org.telegram.messenger.ImageLocation; import org.telegram.messenger.ImageReceiver; import org.telegram.messenger.LocaleController; import org.telegram.messenger.MessageObject; import org.telegram.messenger.MessagesController; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; +import org.telegram.messenger.SvgHelper; import org.telegram.messenger.UserConfig; import org.telegram.messenger.UserObject; import org.telegram.messenger.Utilities; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; +import org.telegram.tgnet.tl.TL_stars; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; @@ -70,6 +81,7 @@ import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.ActionBar.ThemeDescription; import org.telegram.ui.Cells.ChatMessageCell; +import org.telegram.ui.Cells.HeaderCell; import org.telegram.ui.Cells.TextCell; import org.telegram.ui.Cells.TextInfoPrivacyCell; import org.telegram.ui.Cells.ThemePreviewMessagesCell; @@ -77,6 +89,7 @@ import org.telegram.ui.Components.AnimatedEmojiDrawable; import org.telegram.ui.Components.AnimatedFloat; import org.telegram.ui.Components.AvatarDrawable; +import org.telegram.ui.Components.BackupImageView; import org.telegram.ui.Components.Bulletin; import org.telegram.ui.Components.BulletinFactory; import org.telegram.ui.Components.ButtonBounce; @@ -84,14 +97,20 @@ import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.Easings; import org.telegram.ui.Components.FilledTabsView; +import org.telegram.ui.Components.FlickerLoadingView; import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.Premium.PremiumFeatureBottomSheet; import org.telegram.ui.Components.Premium.PremiumGradient; import org.telegram.ui.Components.RLottieDrawable; import org.telegram.ui.Components.RecyclerListView; +import org.telegram.ui.Components.ScaleStateListAnimator; import org.telegram.ui.Components.SimpleThemeDescription; import org.telegram.ui.Components.Text; +import org.telegram.ui.Components.UItem; import org.telegram.ui.Components.ViewPagerFixed; +import org.telegram.ui.Gifts.GiftSheet; +import org.telegram.ui.Stars.StarGiftPatterns; +import org.telegram.ui.Stars.StarsController; import org.telegram.ui.Stories.StoriesUtilities; import org.telegram.ui.Stories.recorder.ButtonWithCounterView; @@ -104,6 +123,8 @@ public class PeerColorActivity extends BaseFragment implements NotificationCente private final boolean isChannel; private final long dialogId; + private final StarsController.GiftsList gifts; + private FrameLayout contentView; private ColoredActionBar colorBar; @@ -124,17 +145,20 @@ private class Page extends FrameLayout { private ProfilePreview profilePreview; private RecyclerListView listView; + private GridLayoutManager layoutManager; private RecyclerView.Adapter listAdapter; + private View buttonShadow; private FrameLayout buttonContainer; private ButtonWithCounterView button; private PeerColorGrid peerColorPicker; private int selectedColor = -1; private long selectedEmoji = 0; + private TLRPC.TL_emojiStatusCollectible selectedEmojiCollectible = null; private ThemePreviewMessagesCell messagesCellPreview; private SetReplyIconCell setReplyIconCell; - private CharSequence buttonLocked, buttonUnlocked; + private CharSequence buttonLocked, buttonUnlocked, buttonCollectible; int previewRow = -1; int colorPickerRow = -1; @@ -144,7 +168,15 @@ private class Page extends FrameLayout { int buttonRow = -1; int clearRow = -1; int shadowRow = -1; + int giftsHeaderRow = -1; + int giftsStartRow = -1; + int giftsEndRow = -1; + int giftsLoadingStartRow = -1; + int giftsLoadingEndRow = -1; + int giftsCount = 0; + int giftsInfoRow = -1; int rowCount; + final ArrayList uniqueGifts = new ArrayList<>(); private static final int VIEW_TYPE_MESSAGE = 0; private static final int VIEW_TYPE_COLOR_PICKER = 1; @@ -152,6 +184,9 @@ private class Page extends FrameLayout { private static final int VIEW_TYPE_ICON = 3; private static final int VIEW_TYPE_BUTTONPAD = 5; private static final int VIEW_TYPE_TEXT = 6; + private static final int VIEW_TYPE_HEADER = 7; + private static final int VIEW_TYPE_GIFT = 8; + private static final int VIEW_TYPE_FLICKER = 9; private final int type; public Page(Context context, int type) { @@ -163,22 +198,30 @@ public Page(Context context, int type) { TLRPC.Chat chat = getMessagesController().getChat(-dialogId); selectedColor = ChatObject.getProfileColorId(chat); selectedEmoji = ChatObject.getProfileEmojiId(chat); + selectedEmojiCollectible = chat != null && chat.emoji_status instanceof TLRPC.TL_emojiStatusCollectible ? (TLRPC.TL_emojiStatusCollectible) chat.emoji_status : null; } else { TLRPC.User user = getUserConfig().getCurrentUser(); selectedColor = UserObject.getProfileColorId(user); selectedEmoji = UserObject.getProfileEmojiId(user); + selectedEmojiCollectible = user != null && user.emoji_status instanceof TLRPC.TL_emojiStatusCollectible ? (TLRPC.TL_emojiStatusCollectible) user.emoji_status : null; } } else { if (dialogId < 0) { TLRPC.Chat chat = getMessagesController().getChat(-dialogId); selectedColor = ChatObject.getColorId(chat); selectedEmoji = ChatObject.getEmojiId(chat); + selectedEmojiCollectible = null; } else { TLRPC.User user = getUserConfig().getCurrentUser(); selectedColor = UserObject.getColorId(user); selectedEmoji = UserObject.getEmojiId(user); + selectedEmojiCollectible = null; } } + if (selectedEmojiCollectible != null) { + selectedColor = -1; + selectedEmoji = 0; + } listView = new RecyclerListView(getContext(), getResourceProvider()) { @Override @@ -191,14 +234,58 @@ protected void onMeasure(int widthSpec, int heightSpec) { protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); updateButtonY(); + if (gifts != null && seesLoading()) { + gifts.load(); + } + } + + @Override + public void onDraw(Canvas c) { + drawSectionBackground(c, giftsStartRow, Math.max(giftsLoadingEndRow, giftsEndRow) - 1, getThemedColor(Theme.key_windowBackgroundWhite), dp(8), dp(8)); + super.onDraw(c); + } + + @Override + public Integer getSelectorColor(int position) { + if (position >= giftsStartRow && position < giftsEndRow || position >= giftsLoadingStartRow && position < giftsLoadingEndRow) { + return 0x00000000; + } + return super.getSelectorColor(position); } }; ((DefaultItemAnimator) listView.getItemAnimator()).setSupportsChangeAnimations(false); - listView.setLayoutManager(new LinearLayoutManager(getContext())); + layoutManager = new GridLayoutManager(getContext(), 3); + layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { + @Override + public int getSpanSize(int position) { + if (position >= giftsStartRow && position < giftsEndRow) { + return 1; + } + if (position >= giftsLoadingStartRow && position < giftsLoadingEndRow) { + return 1; + } + return 3; + } + }); + listView.addItemDecoration(new RecyclerView.ItemDecoration() { + @Override + public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { + final int position = parent.getChildAdapterPosition(view); + if (position < giftsStartRow || position >= giftsStartRow + giftsCount) return; + final int index = position - giftsStartRow; + final boolean up = index / 3 == 0, down = index / 3 == (giftsCount - 1) / 3; + final boolean left = index % 3 == 0, right = index % 3 == 2; + outRect.top = up ? dp(8) : 0; + outRect.bottom = down ? dp(8) : 0; + outRect.left = left ? dp(8) : 0; + outRect.right = right ? dp(8) : 0; + } + }); + listView.setLayoutManager(layoutManager); listView.setAdapter(listAdapter = new RecyclerListView.SelectionAdapter() { @Override public boolean isEnabled(RecyclerView.ViewHolder holder) { - return holder.getItemViewType() == VIEW_TYPE_ICON || holder.getItemViewType() == VIEW_TYPE_TEXT; + return holder.getItemViewType() == VIEW_TYPE_ICON || holder.getItemViewType() == VIEW_TYPE_TEXT || holder.getItemViewType() == VIEW_TYPE_GIFT; } @NonNull @@ -214,6 +301,21 @@ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int messagesCell.fragment = PeerColorActivity.this; view = messagesCell; break; + case VIEW_TYPE_HEADER: + HeaderCell headerCell = new HeaderCell(getContext(), resourceProvider); + headerCell.setBackgroundColor(getThemedColor(Theme.key_windowBackgroundWhite)); + view = headerCell; + break; + case VIEW_TYPE_GIFT: + GiftCell giftCell = new GiftCell(getContext(), resourceProvider); + view = giftCell; + break; + case VIEW_TYPE_FLICKER: + FlickerLoadingView flickerLoadingView = new FlickerLoadingView(context, resourceProvider); + flickerLoadingView.setIsSingleCell(true); + flickerLoadingView.setViewType(FlickerLoadingView.STAR_GIFT_SELECT); + view = flickerLoadingView; + break; default: case VIEW_TYPE_INFO: TextInfoPrivacyCell cell = new TextInfoPrivacyCell(getContext(), getResourceProvider()); @@ -225,21 +327,15 @@ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int colorPicker.setSelected(selectedColor, false); colorPicker.setOnColorClick(colorId -> { selectedColor = colorId; - colorPicker.setSelected(colorId, true); + selectedEmojiCollectible = null; + updateProfilePreview(true); updateMessages(); if (setReplyIconCell != null) { setReplyIconCell.invalidate(); } - if (type == PAGE_PROFILE && colorBar != null) { - colorBar.setColor(currentAccount, selectedColor, true); - } - if (profilePreview != null) { - profilePreview.setColor(selectedColor, true); - } if (profilePage != null && profilePage.profilePreview != null && namePage != null) { profilePage.profilePreview.overrideAvatarColor(namePage.selectedColor); } - checkResetColorButton(); }); view = colorPicker; break; @@ -282,15 +378,20 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi switch (getItemViewType(position)) { case VIEW_TYPE_INFO: TextInfoPrivacyCell cell = (TextInfoPrivacyCell) holder.itemView; + cell.setFixedSize(0); if (position == infoRow) { if (type == PAGE_NAME) { - cell.setText(LocaleController.getString(isChannel ? R.string.ChannelColorHint : R.string.UserColorHint)); + cell.setText(getString(isChannel ? R.string.ChannelColorHint : R.string.UserColorHint)); } else { - cell.setText(LocaleController.getString(isChannel ? R.string.ChannelProfileHint : R.string.UserProfileHint)); + cell.setText(getString(isChannel ? R.string.ChannelProfileHint : R.string.UserProfileHint)); } cell.setBackground(Theme.getThemedDrawableByKey(getContext(), clearRow >= 0 ? R.drawable.greydivider : R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (position == shadowRow) { cell.setText(""); + cell.setFixedSize(12); + cell.setBackground(Theme.getThemedDrawableByKey(getContext(), giftsHeaderRow >= 0 ? R.drawable.greydivider : R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); + } else if (position == giftsInfoRow) { + cell.setText(getString(R.string.UserProfileCollectibleInfo)); cell.setBackground(Theme.getThemedDrawableByKey(getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } break; @@ -299,9 +400,36 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi textCell.updateColors(); textCell.setBackgroundColor(getThemedColor(Theme.key_windowBackgroundWhite)); if (position == clearRow) { - textCell.setText(LocaleController.getString(isChannel ? R.string.ChannelProfileColorReset : R.string.UserProfileColorReset), false); + textCell.setText(getString(isChannel ? R.string.ChannelProfileColorReset : R.string.UserProfileColorReset), false); } break; + case VIEW_TYPE_HEADER: + HeaderCell headerCell = (HeaderCell) holder.itemView; + if (position == giftsHeaderRow) { + headerCell.setText(getString(R.string.UserProfileCollectibleHeader), false); + } + break; + case VIEW_TYPE_GIFT: + GiftCell giftCell = (GiftCell) holder.itemView; + final int index = position - giftsStartRow; + if (index < 0 || index >= uniqueGifts.size()) return; + final TL_stars.TL_starGiftUnique gift = uniqueGifts.get(index); + giftCell.set(index, gift); + giftCell.setSelected(selectedEmojiCollectible != null && selectedEmojiCollectible.collectible_id == gift.id, false); + break; + } + } + + @Override + public void onViewAttachedToWindow(@NonNull RecyclerView.ViewHolder holder) { + super.onViewAttachedToWindow(holder); + if (holder.getItemViewType() == VIEW_TYPE_GIFT) { + GiftCell giftCell = (GiftCell) holder.itemView; + final int index = holder.getAdapterPosition() - giftsStartRow; + if (index < 0 || index >= uniqueGifts.size()) return; + final TL_stars.TL_starGiftUnique gift = uniqueGifts.get(index); + giftCell.set(index, gift); + giftCell.setSelected(selectedEmojiCollectible != null && selectedEmojiCollectible.collectible_id == gift.id, false); } } @@ -315,7 +443,7 @@ public int getItemViewType(int position) { if (position == previewRow) { return VIEW_TYPE_MESSAGE; } - if (position == infoRow || position == info2Row || position == shadowRow) { + if (position == infoRow || position == giftsInfoRow || position == info2Row || position == shadowRow) { return VIEW_TYPE_INFO; } if (position == colorPickerRow) { @@ -330,6 +458,15 @@ public int getItemViewType(int position) { if (position == clearRow) { return VIEW_TYPE_TEXT; } + if (position == giftsHeaderRow) { + return VIEW_TYPE_HEADER; + } + if (position >= giftsStartRow && position < giftsEndRow) { + return VIEW_TYPE_GIFT; + } + if (position >= giftsLoadingStartRow && position < giftsLoadingEndRow) { + return VIEW_TYPE_FLICKER; + } if (position == getItemCount() - 1) { return 4; } @@ -342,9 +479,7 @@ public int getItemViewType(int position) { } else if (position == clearRow) { selectedColor = -1; selectedEmoji = 0; - if (peerColorPicker != null) { - peerColorPicker.setSelected(selectedColor, true); - } + selectedEmojiCollectible = null; updateMessages(); if (type == PAGE_PROFILE) { namePage.updateMessages(); @@ -352,35 +487,53 @@ public int getItemViewType(int position) { if (setReplyIconCell != null) { setReplyIconCell.update(true); } - if (type == PAGE_PROFILE && colorBar != null) { - colorBar.setColor(currentAccount, selectedColor, true); - } - if (profilePreview != null) { - profilePreview.setColor(selectedColor, true); - profilePreview.setEmoji(selectedEmoji, true); - } + updateProfilePreview(true); if (profilePage != null && profilePage.profilePreview != null && namePage != null) { profilePage.profilePreview.overrideAvatarColor(namePage.selectedColor); } - checkResetColorButton(); + } else if (position >= giftsStartRow && position < giftsEndRow) { + final int index = position - giftsStartRow; + if (index < 0 || index >= uniqueGifts.size()) return; + final TL_stars.TL_starGiftUnique gift = uniqueGifts.get(index); + selectedEmoji = 0; + selectedColor = -1; + selectedEmojiCollectible = MessagesController.emojiStatusCollectibleFromGift(gift); + updateProfilePreview(true); + if (setReplyIconCell != null) { + setReplyIconCell.update(true); + } + } + }); + listView.setOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + super.onScrolled(recyclerView, dx, dy); + if (gifts != null && seesLoading()) { + gifts.load(); + } } }); addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); buttonContainer = new FrameLayout(getContext()); - buttonContainer.setPadding(dp(14), dp(14), dp(14), dp(14)); buttonContainer.setBackgroundColor(getThemedColor(Theme.key_windowBackgroundGray)); + buttonShadow = new View(getContext()); + buttonShadow.setBackgroundColor(getThemedColor(Theme.key_divider)); + buttonShadow.setAlpha(0.0f); + buttonContainer.addView(buttonShadow, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, .66f, Gravity.FILL_HORIZONTAL | Gravity.TOP, 0, 0, 0, 0)); + SpannableStringBuilder buttonLock = new SpannableStringBuilder("l"); buttonLock.setSpan(new ColoredImageSpan(R.drawable.msg_mini_lock2), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - buttonUnlocked = LocaleController.getString(isChannel ? R.string.ChannelColorApply : R.string.UserColorApplyIcon); + buttonUnlocked = getString(isChannel ? R.string.ChannelColorApply : R.string.UserColorApplyIcon); buttonLocked = new SpannableStringBuilder(buttonLock).append(" ").append(buttonUnlocked); + buttonCollectible = getString(R.string.UserColorApplyCollectible); button = new ButtonWithCounterView(getContext(), getResourceProvider()); button.text.setHacks(true, true, true); - button.setText(isChannel ? buttonUnlocked : (!getUserConfig().isPremium() ? buttonLocked : buttonUnlocked), false); + button.setText(isChannel ? buttonUnlocked : (!getUserConfig().isPremium() ? buttonLocked : (selectedEmojiCollectible != null ? buttonCollectible : buttonUnlocked)), false); button.setOnClickListener(v -> buttonClick()); - buttonContainer.addView(button, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48)); + buttonContainer.addView(button, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.FILL, 14, 14.66f, 14, 14)); addView(buttonContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM)); listView.setOnScrollListener(new RecyclerView.OnScrollListener() { @@ -398,8 +551,7 @@ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { if (type == PAGE_PROFILE) { profilePreview = new ProfilePreview(getContext(), currentAccount, dialogId, resourceProvider); - profilePreview.setColor(selectedColor, false); - profilePreview.setEmoji(selectedEmoji, false); + updateProfilePreview(false); addView(profilePreview, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.FILL_HORIZONTAL)); } @@ -439,7 +591,7 @@ public boolean hasUnsavedChanged() { if (type == PAGE_NAME) { return !(selectedColor == ChatObject.getColorId(chat) && selectedEmoji == ChatObject.getEmojiId(chat)); } else { - return !(selectedColor == ChatObject.getProfileColorId(chat) && selectedEmoji == ChatObject.getProfileEmojiId(chat)); + return !(selectedColor == ChatObject.getProfileColorId(chat) && selectedEmoji == ChatObject.getProfileEmojiId(chat) && eq(chat == null ? null : chat.emoji_status, selectedEmojiCollectible)); } } else { final TLRPC.User me = getUserConfig().getCurrentUser(); @@ -447,7 +599,7 @@ public boolean hasUnsavedChanged() { if (type == PAGE_NAME) { return !(selectedColor == UserObject.getColorId(me) && selectedEmoji == UserObject.getEmojiId(me)); } else { - return !(selectedColor == UserObject.getProfileColorId(me) && selectedEmoji == UserObject.getProfileEmojiId(me)); + return !(selectedColor == UserObject.getProfileColorId(me) && selectedEmoji == UserObject.getProfileEmojiId(me) && eq(me == null ? null : me.emoji_status, selectedEmojiCollectible)); } } } @@ -472,7 +624,12 @@ private void updateButtonY() { if (!foundLastPosition) { maxTop = listView.getMeasuredHeight(); } - buttonContainer.setTranslationY(Math.max(0, maxTop - (listView.getMeasuredHeight() - dp(14 + 48 + 14)))); + float buttonTy = Math.max(0, maxTop - (listView.getMeasuredHeight() - dp(14 + 48 + 14 + .66f))); + if (type == PAGE_PROFILE) { + buttonShadow.animate().alpha(buttonTy > 0 ? 0.0f : 1.0f).start(); + buttonTy = 0.0f; + } + buttonContainer.setTranslationY(buttonTy); } @@ -491,9 +648,9 @@ public SetReplyIconCell(Context context) { textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); textView.setTextColor(getThemedColor(Theme.key_windowBackgroundWhiteBlackText)); if (type == PAGE_NAME) { - textView.setText(LocaleController.getString(isChannel ? R.string.ChannelReplyIcon : R.string.UserReplyIcon)); + textView.setText(getString(isChannel ? R.string.ChannelReplyIcon : R.string.UserReplyIcon)); } else { - textView.setText(LocaleController.getString(isChannel ? R.string.ChannelProfileIcon : R.string.UserProfileIcon)); + textView.setText(getString(isChannel ? R.string.ChannelProfileIcon : R.string.UserProfileIcon)); } addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL | Gravity.FILL_HORIZONTAL, 20, 0, 20, 0)); @@ -511,7 +668,7 @@ public void update(boolean animated) { } else { imageDrawable.set((Drawable) null, animated); if (offText == null) { - offText = new Text(LocaleController.getString(isChannel ? R.string.ChannelReplyIconOff : R.string.UserReplyIconOff), 16); + offText = new Text(getString(isChannel ? R.string.ChannelReplyIconOff : R.string.UserReplyIconOff), 16); } } } @@ -610,14 +767,18 @@ public void showSelectStatusDialog(SetReplyIconCell cell) { } SelectAnimatedEmojiDialog popupLayout = new SelectAnimatedEmojiDialog(PeerColorActivity.this, getContext(), true, xoff, type == PAGE_NAME ? SelectAnimatedEmojiDialog.TYPE_SET_REPLY_ICON : SelectAnimatedEmojiDialog.TYPE_SET_REPLY_ICON_BOTTOM, true, getResourceProvider(), type == PAGE_NAME ? 24 : 16, cell.getColor()) { @Override - protected void onEmojiSelected(View emojiView, Long documentId, TLRPC.Document document, Integer until) { - selectedEmoji = documentId == null ? 0 : documentId; + protected void onEmojiSelected(View emojiView, Long documentId, TLRPC.Document document, TL_stars.TL_starGiftUnique gift, Integer until) { + if (gift != null) { + selectedEmojiCollectible = MessagesController.emojiStatusCollectibleFromGift(gift); + selectedColor = -1; + } else { + selectedEmoji = documentId == null ? 0 : documentId; + selectedEmojiCollectible = null; + } if (cell != null) { cell.update(true); } - if (profilePreview != null) { - profilePreview.setEmoji(selectedEmoji, true); - } + updateProfilePreview(true); updateMessages(); if (popup[0] != null) { selectAnimatedEmojiDialog = null; @@ -658,7 +819,28 @@ public void checkResetColorButton() { } } + public void updateSelectedGift() { + for (int i = 0; i < listView.getChildCount(); ++i) { + final View child = listView.getChildAt(i); + if (child instanceof GiftCell) { + final GiftCell cell = (GiftCell) child; + cell.setSelected(selectedEmojiCollectible != null && selectedEmojiCollectible.collectible_id == cell.getGiftId(), true); + } + } + } + private void updateRows() { + clearRow = -1; + shadowRow = -1; + giftsHeaderRow = -1; + giftsStartRow = -1; + giftsLoadingStartRow = -1; + giftsLoadingEndRow = -1; + giftsEndRow = -1; + giftsInfoRow = -1; + giftsCount = 0; + uniqueGifts.clear(); + rowCount = 0; if (type == PAGE_NAME) { previewRow = rowCount++; @@ -666,14 +848,86 @@ private void updateRows() { colorPickerRow = rowCount++; iconRow = rowCount++; infoRow = rowCount++; - if (type == PAGE_PROFILE && selectedColor >= 0) { + if (type == PAGE_PROFILE && (selectedColor >= 0 || selectedEmojiCollectible != null)) { clearRow = rowCount++; shadowRow = rowCount++; - } else { - clearRow = -1; - shadowRow = -1; + } + if (type == PAGE_PROFILE && gifts != null) { + int spanCountLeft = 3; + for (int i = 0; i < gifts.gifts.size(); ++i) { + TL_stars.SavedStarGift savedGift = gifts.gifts.get(i); + if (savedGift.gift instanceof TL_stars.TL_starGiftUnique) { + uniqueGifts.add((TL_stars.TL_starGiftUnique) savedGift.gift); + spanCountLeft--; + if (spanCountLeft == 0) { + spanCountLeft = 3; + } + } + } + if (!uniqueGifts.isEmpty()) { + giftsHeaderRow = rowCount++; + giftsStartRow = rowCount; + rowCount += uniqueGifts.size(); + giftsCount += uniqueGifts.size(); + giftsEndRow = rowCount; + if (gifts.loading || !gifts.endReached) { + giftsLoadingStartRow = rowCount; + final int loadingCells = spanCountLeft <= 0 ? 3 : spanCountLeft; + rowCount += loadingCells; + giftsCount += loadingCells; + giftsLoadingEndRow = rowCount; + } + giftsInfoRow = rowCount++; + } } buttonRow = rowCount++; + if (gifts != null && seesLoading()) { + gifts.load(); + } + } + + public boolean seesLoading() { + if (listView == null) return false; + for (int i = 0; i < listView.getChildCount(); ++i) { + View child = listView.getChildAt(i); + if (child instanceof FlickerLoadingView) { + return true; + } + } + return false; + } + + public void updateProfilePreview(boolean animated) { + if (peerColorPicker != null) { + peerColorPicker.setSelected(selectedColor, animated); + } + if (profilePreview != null) { + if (selectedEmojiCollectible != null) { + profilePreview.setStatusEmoji(selectedEmojiCollectible.document_id, true, animated); + profilePreview.setColor(MessagesController.PeerColor.fromCollectible(selectedEmojiCollectible), animated); + profilePreview.setEmoji(selectedEmojiCollectible.pattern_document_id, true, animated); + } else { + if (DialogObject.isEmojiStatusCollectible(dialogId)) { + profilePreview.setStatusEmoji(0, false, animated); + } else { + profilePreview.setStatusEmoji(DialogObject.getEmojiStatusDocumentId(dialogId), DialogObject.isEmojiStatusCollectible(dialogId), animated); + } + profilePreview.setColor(selectedColor, animated); + profilePreview.setEmoji(selectedEmoji, false, animated); + } + } + if (type == PAGE_PROFILE && colorBar != null) { + if (selectedEmojiCollectible != null) { + colorBar.setColor(MessagesController.PeerColor.fromCollectible(selectedEmojiCollectible), animated); + } else { + colorBar.setColor(currentAccount, selectedColor, animated); + } + } + if (button != null && !isChannel) { + button.setText(!getUserConfig().isPremium() ? buttonLocked : (selectedEmojiCollectible != null ? buttonCollectible : buttonUnlocked), true); + } + checkResetColorButton(); + updateSelectedGift(); } private void updateMessages() { @@ -695,21 +949,22 @@ private void updateMessages() { } } + public void update() { + updateRows(); + listAdapter.notifyDataSetChanged(); + } + public void updateColors() { listView.setBackgroundColor(getThemedColor(Theme.key_windowBackgroundGray)); - if (type == PAGE_PROFILE && colorBar != null) { - colorBar.setColor(currentAccount, selectedColor, true); - } if (button != null) { button.updateColors(); } if (messagesCellPreview != null) { messagesCellPreview.invalidate(); } - if (profilePreview != null) { - profilePreview.setColor(selectedColor, false); - } + updateProfilePreview(true); buttonContainer.setBackgroundColor(getThemedColor(Theme.key_windowBackgroundGray)); + buttonShadow.setBackgroundColor(getThemedColor(Theme.key_divider)); AndroidUtilities.forEachViews(listView, view -> { if (view instanceof PeerColorGrid) { view.setBackgroundColor(getThemedColor(Theme.key_windowBackgroundWhite)); @@ -720,13 +975,17 @@ public void updateColors() { } else if (view instanceof SetReplyIconCell) { view.setBackgroundColor(getThemedColor(Theme.key_windowBackgroundWhite)); ((SetReplyIconCell) view).updateColors(); + } else if (view instanceof HeaderCell) { + view.setBackgroundColor(getThemedColor(Theme.key_windowBackgroundWhite)); + } else if (view instanceof GiftCell) { + ((GiftCell) view).card.invalidate(); } }); } public void premiumChanged() { if (button != null && !isChannel) { - button.setText(!getUserConfig().isPremium() ? buttonLocked : buttonUnlocked, true); + button.setText(!getUserConfig().isPremium() ? buttonLocked : (selectedEmojiCollectible != null ? buttonCollectible : buttonUnlocked), true); } } } @@ -793,6 +1052,15 @@ public PeerColorActivity(long dialogId) { this.dialogId = dialogId; this.isChannel = dialogId != 0; + if (dialogId >= 0) { + this.gifts = new StarsController.GiftsList(currentAccount, dialogId, false); + this.gifts.include_limited = false; + this.gifts.include_unlimited = false; + this.gifts.include_unique = true; + this.gifts.load(); + } else { + this.gifts = null; + } resourceProvider = new Theme.ResourcesProvider() { @Override @@ -855,6 +1123,7 @@ public PeerColorActivity setOnApplied(BaseFragment bulletinFragment) { @Override public boolean onFragmentCreate() { getNotificationCenter().addObserver(this, NotificationCenter.currentUserPremiumStatusChanged); + getNotificationCenter().addObserver(this, NotificationCenter.starUserGiftsLoaded); Bulletin.addDelegate(this, new Bulletin.Delegate() { @Override public int getBottomOffset(int tag) { @@ -929,9 +1198,7 @@ public void updateActionBarButtonsColor() { } } }; - if (profilePage != null) { - colorBar.setColor(currentAccount, profilePage.selectedColor, false); - } + profilePage.updateProfilePreview(false); frameLayout.addView(colorBar, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.FILL_HORIZONTAL)); viewPager = new ViewPagerFixed(context) { @@ -972,8 +1239,8 @@ public void bindView(View view, int position, int viewType) { if (!isChannel) { tabsView = new FilledTabsView(context); tabsView.setTabs( - LocaleController.getString(isChannel ? R.string.ChannelColorTabName : R.string.UserColorTabName), - LocaleController.getString(isChannel ? R.string.ChannelColorTabProfile : R.string.UserColorTabProfile) + getString(isChannel ? R.string.ChannelColorTabName : R.string.UserColorTabName), + getString(isChannel ? R.string.ChannelColorTabProfile : R.string.UserColorTabProfile) ); tabsView.onTabSelected(tab -> { if (viewPager != null) { @@ -983,7 +1250,7 @@ public void bindView(View view, int position, int viewType) { actionBarContainer.addView(tabsView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 40, Gravity.CENTER)); } else { titleView = new SimpleTextView(context); - titleView.setText(LocaleController.getString(R.string.ChannelColorTitle2)); + titleView.setText(getString(R.string.ChannelColorTitle2)); titleView.setEllipsizeByGradient(true); titleView.setTextSize(20); titleView.setTextColor(getThemedColor(Theme.key_actionBarDefaultTitle)); @@ -1086,12 +1353,12 @@ private void showUnsavedAlert() { return; } AlertDialog alertDialog = new AlertDialog.Builder(getContext(), getResourceProvider()) - .setTitle(LocaleController.getString(isChannel ? R.string.ChannelColorUnsaved : R.string.UserColorUnsaved)) - .setMessage(LocaleController.getString(isChannel ? R.string.ChannelColorUnsavedMessage : R.string.UserColorUnsavedMessage)) - .setNegativeButton(LocaleController.getString(R.string.Dismiss), (di, w) -> { + .setTitle(getString(isChannel ? R.string.ChannelColorUnsaved : R.string.UserColorUnsaved)) + .setMessage(getString(isChannel ? R.string.ChannelColorUnsavedMessage : R.string.UserColorUnsavedMessage)) + .setNegativeButton(getString(R.string.Dismiss), (di, w) -> { finishFragment(); }) - .setPositiveButton(LocaleController.getString(R.string.ApplyTheme), (di, w) -> { + .setPositiveButton(getString(R.string.ApplyTheme), (di, w) -> { buttonClick(); }) .create(); @@ -1134,7 +1401,7 @@ private void apply() { } if (namePage.selectedColor != UserObject.getColorId(me) || namePage.selectedEmoji != UserObject.getEmojiId(me)) { applyingName = true; - TLRPC.TL_account_updateColor req = new TLRPC.TL_account_updateColor(); + TL_account.updateColor req = new TL_account.updateColor(); me.flags2 |= 256; me.color.flags |= 1; req.flags |= 4; @@ -1154,7 +1421,7 @@ private void apply() { if (me.profile_color == null) { me.profile_color = new TLRPC.TL_peerColor(); } - TLRPC.TL_account_updateColor req = new TLRPC.TL_account_updateColor(); + TL_account.updateColor req = new TL_account.updateColor(); req.for_profile = true; me.flags2 |= 512; if (profilePage.selectedColor < 0) { @@ -1174,6 +1441,26 @@ private void apply() { } getConnectionsManager().sendRequest(req, null); } + if (!eq(me.emoji_status, profilePage.selectedEmojiCollectible) && (profilePage.selectedEmojiCollectible != null || DialogObject.isEmojiStatusCollectible(me.emoji_status))) { + TLRPC.EmojiStatus new_emoji_status = new TLRPC.TL_emojiStatusEmpty(); + TL_stars.TL_starGiftUnique gift = null; + if (profilePage.selectedEmojiCollectible != null) { + final long id = profilePage.selectedEmojiCollectible.collectible_id; + for (int i = 0; i < profilePage.uniqueGifts.size(); ++i) { + final TL_stars.TL_starGiftUnique g = profilePage.uniqueGifts.get(i); + if (g.id == id) { + gift = g; + break; + } + } + } + if (gift != null) { + TLRPC.TL_inputEmojiStatusCollectible status = new TLRPC.TL_inputEmojiStatusCollectible(); + status.collectible_id = gift.id; + new_emoji_status = status; + } + getMessagesController().updateEmojiStatus(0, new_emoji_status, gift); + } getMessagesController().putUser(me, false); getUserConfig().saveConfig(true); finishFragment(); @@ -1188,25 +1475,25 @@ private void showBulletin() { if (applyingName && (!applyingProfile || getCurrentPage() == namePage)) { BulletinFactory.of(bulletinFragment).createSimpleBulletin( PeerColorDrawable.from(currentAccount, namePage.selectedColor), - LocaleController.getString(isChannel ? R.string.ChannelColorApplied : R.string.UserColorApplied) + getString(isChannel ? R.string.ChannelColorApplied : R.string.UserColorApplied) ).show(); } else if (applyingProfile && (!applyingName || getCurrentPage() == profilePage)) { if (profilePage.selectedColor < 0) { if (profilePage.selectedEmoji != 0) { BulletinFactory.of(bulletinFragment).createStaticEmojiBulletin( AnimatedEmojiDrawable.findDocument(currentAccount, profilePage.selectedEmoji), - LocaleController.getString(isChannel ? R.string.ChannelProfileColorEmojiApplied : R.string.UserProfileColorEmojiApplied) + getString(isChannel ? R.string.ChannelProfileColorEmojiApplied : R.string.UserProfileColorEmojiApplied) ).show(); } else { BulletinFactory.of(bulletinFragment).createSimpleBulletin( R.raw.contact_check, - LocaleController.getString(isChannel ? R.string.ChannelProfileColorResetApplied : R.string.UserProfileColorResetApplied) + getString(isChannel ? R.string.ChannelProfileColorResetApplied : R.string.UserProfileColorResetApplied) ).show(); } } else { BulletinFactory.of(bulletinFragment).createSimpleBulletin( PeerColorDrawable.fromProfile(currentAccount, profilePage.selectedColor), - LocaleController.getString(isChannel ? R.string.ChannelProfileColorApplied : R.string.UserProfileColorApplied) + getString(isChannel ? R.string.ChannelProfileColorApplied : R.string.UserProfileColorApplied) ).show(); } } @@ -1224,6 +1511,7 @@ public void onFragmentClosed() { public void onFragmentDestroy() { super.onFragmentDestroy(); getNotificationCenter().removeObserver(this, NotificationCenter.currentUserPremiumStatusChanged); + getNotificationCenter().removeObserver(this, NotificationCenter.starUserGiftsLoaded); } private List getAvailableReactions() { @@ -1270,6 +1558,8 @@ public void didReceivedNotification(int id, int account, Object... args) { if (id == NotificationCenter.currentUserPremiumStatusChanged) { namePage.premiumChanged(); profilePage.premiumChanged(); + } else if (id == NotificationCenter.starUserGiftsLoaded) { + profilePage.update(); } } @@ -1376,7 +1666,7 @@ public ChangeNameColorCell(int currentAccount, long dialogId, Context context, T drawable = context.getResources().getDrawable(R.drawable.menu_edit_appearance).mutate(); drawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4, resourcesProvider), PorterDuff.Mode.SRC_IN)); - CharSequence button = LocaleController.getString(isChannelOrGroup ? (isGroup ? R.string.ChangeGroupAppearance : R.string.ChangeChannelNameColor2) : R.string.ChangeUserNameColor); + CharSequence button = getString(isChannelOrGroup ? (isGroup ? R.string.ChangeGroupAppearance : R.string.ChangeChannelNameColor2) : R.string.ChangeUserNameColor); if (isChannelOrGroup && !isGroup && MessagesController.getInstance(currentAccount).getMainSettings().getInt("boostingappearance", 0) < 3) { int minlvl = Integer.MAX_VALUE, maxlvl = 0; if (mc.peerColors != null) { @@ -2084,13 +2374,20 @@ public ColoredActionBar(Context context, Theme.ResourcesProvider resourcesProvid } public void setColor(int currentAccount, int colorId, boolean animated) { + MessagesController.PeerColor peerColor = null; + if (colorId >= 0 && currentAccount >= 0) { + MessagesController.PeerColors peerColors = MessagesController.getInstance(currentAccount).profilePeerColors; + peerColor = peerColors == null ? null : peerColors.getColor(colorId); + } + setColor(peerColor, animated); + } + + public void setColor(MessagesController.PeerColor peerColor, boolean animated) { isDefault = false; - if (colorId < 0 || currentAccount < 0) { + if (peerColor == null) { isDefault = true; color1 = color2 = Theme.getColor(Theme.key_actionBarDefault, resourcesProvider); } else { - MessagesController.PeerColors peerColors = MessagesController.getInstance(currentAccount).profilePeerColors; - MessagesController.PeerColor peerColor = peerColors == null ? null : peerColors.getColor(colorId); if (peerColor != null) { final boolean isDark = resourcesProvider != null ? resourcesProvider.isDark() : Theme.isCurrentThemeDark(); color1 = peerColor.getBgColor1(isDark); @@ -2196,12 +2493,14 @@ public static class ProfilePreview extends FrameLayout { private boolean isForum; + private final AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable botVerificationEmoji; private final AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable statusEmoji; - private final AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable emoji = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(this, false, dp(20), AnimatedEmojiDrawable.CACHE_TYPE_ALERT_PREVIEW_STATIC); - private final StoriesUtilities.StoryGradientTools storyGradient = new StoriesUtilities.StoryGradientTools(this, false); + private boolean isEmojiCollectible; + private AnimatedFloat emojiCollectible = new AnimatedFloat(this, 320, CubicBezierInterpolator.EASE_OUT_QUINT); + public ProfilePreview(Context context, int currentAccount, long dialogId, Theme.ResourcesProvider resourcesProvider) { super(context); @@ -2223,9 +2522,10 @@ protected void onDetachedFromWindow() { statusEmoji.detach(); } }; - statusEmoji = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(titleView, true, dp(24)); - titleView.setDrawablePadding(dp(8)); - titleView.setRightDrawable(statusEmoji); + botVerificationEmoji = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(titleView, dp(17)); + statusEmoji = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(titleView, dp(24)); + titleView.setLeftDrawableOutside(true); + titleView.setRightDrawableOutside(true); titleView.setTextColor(0xFFFFFFFF); titleView.setTextSize(20); titleView.setTypeface(AndroidUtilities.bold()); @@ -2239,6 +2539,7 @@ protected void onDetachedFromWindow() { addView(subtitleView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.BOTTOM, 97, 0, 16, 30.66f)); imageReceiver.setRoundRadius(dp(54)); + long botVerificationId = 0, emojiStatusId = 0; CharSequence title; if (isChannel) { TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-dialogId); @@ -2246,18 +2547,32 @@ protected void onDetachedFromWindow() { avatarDrawable.setInfo(currentAccount, chat); imageReceiver.setForUserOrChat(chat, avatarDrawable); + + botVerificationId = DialogObject.getBotVerificationIcon(chat); + emojiStatusId = chat != null ? DialogObject.getEmojiStatusDocumentId(chat.emoji_status) : 0; } else { TLRPC.User user = UserConfig.getInstance(currentAccount).getCurrentUser(); title = UserObject.getUserName(user); avatarDrawable.setInfo(currentAccount, user); imageReceiver.setForUserOrChat(user, avatarDrawable); + + botVerificationId = DialogObject.getBotVerificationIcon(user); + emojiStatusId = user != null ? DialogObject.getEmojiStatusDocumentId(user.emoji_status) : 0; } try { title = Emoji.replaceEmoji(title, null, false); } catch (Exception ignore) {} titleView.setText(title); + if (botVerificationId != 0) { + botVerificationEmoji.set(botVerificationId, false); + titleView.setLeftDrawable(botVerificationEmoji); + } + if (emojiStatusId != 0) { + statusEmoji.set(emojiStatusId, false); + titleView.setRightDrawable(statusEmoji); + } if (isChannel) { TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-dialogId); @@ -2277,13 +2592,13 @@ protected void onDetachedFromWindow() { } else { final boolean isPublic = ChatObject.isPublic(chat); if (ChatObject.isChannelAndNotMegaGroup(chat)) { - subtitleView.setText(LocaleController.getString(isPublic ? R.string.ChannelPublic : R.string.ChannelPrivate).toLowerCase()); + subtitleView.setText(getString(isPublic ? R.string.ChannelPublic : R.string.ChannelPrivate).toLowerCase()); } else { - subtitleView.setText(LocaleController.getString(isPublic ? R.string.MegaPublic : R.string.MegaPrivate).toLowerCase()); + subtitleView.setText(getString(isPublic ? R.string.MegaPublic : R.string.MegaPrivate).toLowerCase()); } } } else { - subtitleView.setText(LocaleController.getString(R.string.Online)); + subtitleView.setText(getString(R.string.Online)); } setWillNotDraw(false); @@ -2335,14 +2650,24 @@ private int getThemedColor(int key) { return Theme.getColor(key, resourcesProvider); } - private int lastColorId = -1; + private MessagesController.PeerColor peerColor; public void setColor(int colorId, boolean animated) { MessagesController.PeerColors peerColors = MessagesController.getInstance(currentAccount).profilePeerColors; - MessagesController.PeerColor peerColor = peerColors == null ? null : peerColors.getColor(lastColorId = colorId); + MessagesController.PeerColor peerColor = peerColors == null ? null : peerColors.getColor(colorId); + setColor(peerColor, animated); + } + + public void setColor(MessagesController.PeerColor peerColor, boolean animated) { + this.peerColor = peerColor; final boolean isDark = resourcesProvider != null ? resourcesProvider.isDark() : Theme.isCurrentThemeDark(); if (peerColor != null) { - emoji.setColor(adaptProfileEmojiColor(peerColor.getBgColor1(isDark))); - statusEmoji.setColor(ColorUtils.blendARGB(peerColor.getColor(1, resourcesProvider), peerColor.hasColor6(isDark) ? peerColor.getColor(4, resourcesProvider) : peerColor.getColor(2, resourcesProvider), .5f)); + if (peerColor.patternColor != 0) { + emoji.setColor(peerColor.patternColor); + } else { + emoji.setColor(adaptProfileEmojiColor(peerColor.getBgColor1(isDark))); + } + statusEmoji.setColor(ColorUtils.blendARGB(peerColor.getStoryColor1(Theme.isCurrentThemeDark()), 0xFFFFFFFF, 0.25f)); + botVerificationEmoji.setColor(ColorUtils.blendARGB(peerColor.getStoryColor1(Theme.isCurrentThemeDark()), 0xFFFFFFFF, 0.25f)); final int accentColor = ColorUtils.blendARGB(peerColor.getStoryColor1(isDark), peerColor.getStoryColor2(isDark), .5f); if (!Theme.hasHue(getThemedColor(Theme.key_actionBarDefault))) { subtitleView.setTextColor(accentColor); @@ -2351,7 +2676,6 @@ public void setColor(int colorId, boolean animated) { } titleView.setTextColor(Color.WHITE); } else { - final int emojiColor; if (AndroidUtilities.computePerceivedBrightness(getThemedColor(Theme.key_actionBarDefault)) > .8f) { emoji.setColor(getThemedColor(Theme.key_windowBackgroundWhiteBlueText)); } else if (AndroidUtilities.computePerceivedBrightness(getThemedColor(Theme.key_actionBarDefault)) < .2f) { @@ -2360,25 +2684,28 @@ public void setColor(int colorId, boolean animated) { emoji.setColor(adaptProfileEmojiColor(getThemedColor(Theme.key_actionBarDefault))); } statusEmoji.setColor(Theme.getColor(Theme.key_profile_verifiedBackground, resourcesProvider)); + botVerificationEmoji.setColor(Theme.getColor(Theme.key_profile_verifiedBackground, resourcesProvider)); subtitleView.setTextColor(getThemedColor(Theme.key_actionBarDefaultSubtitle)); titleView.setTextColor(getThemedColor(Theme.key_actionBarDefaultTitle)); } - storyGradient.setColorId(colorId, animated); + storyGradient.setColor(peerColor, animated); invalidate(); } - public void setEmoji(long docId, boolean animated) { + public void setEmoji(long docId, boolean isCollectible, boolean animated) { if (docId == 0) { emoji.set((Drawable) null, animated); } else { emoji.set(docId, animated); } - MessagesController.PeerColors peerColors = MessagesController.getInstance(currentAccount).profilePeerColors; - MessagesController.PeerColor peerColor = peerColors == null ? null : peerColors.getColor(lastColorId); final boolean isDark = resourcesProvider != null ? resourcesProvider.isDark() : Theme.isCurrentThemeDark(); if (peerColor != null) { - emoji.setColor(adaptProfileEmojiColor(peerColor.getBgColor1(isDark))); + if (peerColor.patternColor != 0) { + emoji.setColor(peerColor.patternColor); + } else { + emoji.setColor(adaptProfileEmojiColor(peerColor.getBgColor1(isDark))); + } } else if (AndroidUtilities.computePerceivedBrightness(getThemedColor(Theme.key_actionBarDefault)) > .8f) { emoji.setColor(getThemedColor(Theme.key_windowBackgroundWhiteBlueText)); } else if (AndroidUtilities.computePerceivedBrightness(getThemedColor(Theme.key_actionBarDefault)) < .2f) { @@ -2391,12 +2718,16 @@ public void setEmoji(long docId, boolean animated) { } else { statusEmoji.setColor(Theme.getColor(Theme.key_profile_verifiedBackground, resourcesProvider)); } + isEmojiCollectible = isCollectible; + if (!animated) { + emojiCollectible.force(isEmojiCollectible); + } + invalidate(); } - public void setStatusEmoji(long docId, boolean animated) { + public void setStatusEmoji(long docId, boolean isCollectible, boolean animated) { statusEmoji.set(docId, animated); - MessagesController.PeerColors peerColors = MessagesController.getInstance(currentAccount).profilePeerColors; - MessagesController.PeerColor peerColor = peerColors == null ? null : peerColors.getColor(lastColorId); + statusEmoji.setParticles(isCollectible, animated); final boolean isDark = resourcesProvider != null ? resourcesProvider.isDark() : Theme.isCurrentThemeDark(); if (peerColor != null) { statusEmoji.setColor(ColorUtils.blendARGB(peerColor.getColor2(isDark), peerColor.hasColor6(isDark) ? peerColor.getColor5(isDark) : peerColor.getColor3(isDark), .5f)); @@ -2424,11 +2755,8 @@ protected void dispatchDraw(Canvas canvas) { storyGradient.getPaint(rectF) ); - drawProfileIconPattern(getWidth() - dp(46), getHeight(), 1f, (x, y, sz, alpha) -> { - emoji.setAlpha((int) (0xFF * alpha)); - emoji.setBounds((int) (x - sz * .45f), (int) (y - sz * .45f), (int) (x + sz * .45f), (int) (y + sz * .45f)); - emoji.draw(canvas); - }); + final float patternFull = emojiCollectible.set(isEmojiCollectible); + StarGiftPatterns.drawProfilePattern(canvas, emoji, getWidth(), getHeight(), 1.0f, patternFull); super.dispatchDraw(canvas); } @@ -2607,4 +2935,89 @@ public void setForceDark(boolean isDark, boolean playAnimation) { } } } + + public static class GiftCell extends FrameLayout { + + public long id; + public TL_stars.starGiftAttributeBackdrop backdrop; + public TL_stars.starGiftAttributePattern pattern; + + public final FrameLayout card; + public final GiftSheet.CardBackground cardBackground; + public final BackupImageView imageView; + + public GiftCell(Context context, Theme.ResourcesProvider resourcesProvider) { + super(context); + + card = new FrameLayout(context); + card.setBackground(cardBackground = new GiftSheet.CardBackground(card, resourcesProvider, false)); + addView(card, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL)); + ScaleStateListAnimator.apply(card, 0.025f, 1.25f); + + imageView = new BackupImageView(context); + card.addView(imageView, LayoutHelper.createFrame(80, 80, Gravity.CENTER, 0, 12, 0, 12)); + } + + public void set(int index, TL_stars.TL_starGiftUnique gift) { + id = gift.id; + final boolean center = index % 3 == 1; + setPadding(center ? dp(4) : 0, 0, center ? dp(4) : 0, 0); + + setSticker(gift.getDocument(), gift); + + backdrop = findAttribute(gift.attributes, TL_stars.starGiftAttributeBackdrop.class); + pattern = findAttribute(gift.attributes, TL_stars.starGiftAttributePattern.class); + + cardBackground.setBackdrop(backdrop); + cardBackground.setPattern(pattern); + } + + public long getGiftId() { + return id; + } + + public void setSelected(boolean selected, boolean animated) { + cardBackground.setSelected(selected, animated); + final float s = selected ? 0.9f : 1.0f; + if (animated) { + imageView.animate().scaleX(s).scaleY(s).start(); + } else { + imageView.animate().cancel(); + imageView.setScaleX(s); + imageView.setScaleY(s); + } + } + + private TLRPC.Document lastDocument; + private long lastDocumentId; + private void setSticker(TLRPC.Document document, Object parentObject) { + if (document == null) { + imageView.clearImage(); + lastDocument = null; + lastDocumentId = 0; + return; + } + + if (lastDocument == document) return; + lastDocument = document; + lastDocumentId = document.id; + + final TLRPC.PhotoSize photoSize = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, dp(100)); + final SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(document, Theme.key_windowBackgroundGray, 0.3f); + + imageView.setImage( + ImageLocation.getForDocument(document), "100_100", + ImageLocation.getForDocument(photoSize, document), "100_100", + svgThumb, + parentObject + ); + } + } + + public static boolean eq(TLRPC.EmojiStatus emoji_status, TLRPC.TL_emojiStatusCollectible b) { + if ((b != null) != (emoji_status instanceof TLRPC.TL_emojiStatusCollectible)) return false; + if (b == null || !(emoji_status instanceof TLRPC.TL_emojiStatusCollectible)) return false; + final TLRPC.TL_emojiStatusCollectible a = (TLRPC.TL_emojiStatusCollectible) emoji_status; + return a.collectible_id == b.collectible_id; + } } \ No newline at end of file diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PhotoAlbumPickerActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PhotoAlbumPickerActivity.java index 5ad0b3a464..3d99e60baf 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PhotoAlbumPickerActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PhotoAlbumPickerActivity.java @@ -517,7 +517,9 @@ public boolean onTouch(View v, MotionEvent event) { view.getLocationInWindow(location); sendPopupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, location[0] + view.getMeasuredWidth() - sendPopupLayout.getMeasuredWidth() + AndroidUtilities.dp(8), location[1] - sendPopupLayout.getMeasuredHeight() - AndroidUtilities.dp(2)); sendPopupWindow.dimBehind(); - view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} return false; }); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PhotoPickerActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PhotoPickerActivity.java index 554b8a6184..6a731032e8 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PhotoPickerActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PhotoPickerActivity.java @@ -206,7 +206,7 @@ public boolean scaleToFill() { } @Override - public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { + public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview, boolean closing) { PhotoAttachPhotoCell cell = getCellForIndex(index); if (cell != null) { BackupImageView imageView = cell.getImageView(); @@ -1151,7 +1151,9 @@ public boolean onTouch(View v, MotionEvent event) { view.getLocationInWindow(location); sendPopupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, location[0] + view.getMeasuredWidth() - sendPopupLayout.getMeasuredWidth() + AndroidUtilities.dp(8), location[1] - sendPopupLayout.getMeasuredHeight() - AndroidUtilities.dp(2)); sendPopupWindow.dimBehind(); - view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} return false; }); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java index 33e527b187..148e55e3aa 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java @@ -9,6 +9,7 @@ package org.telegram.ui; import static org.telegram.messenger.AndroidUtilities.dp; +import static org.telegram.messenger.AndroidUtilities.dpf2; import static org.telegram.messenger.AndroidUtilities.lerp; import static org.telegram.messenger.LocaleController.getString; @@ -82,7 +83,6 @@ import android.transition.TransitionSet; import android.transition.TransitionValues; import android.util.FloatProperty; -import android.util.Log; import android.util.Pair; import android.util.Property; import android.util.Range; @@ -226,6 +226,7 @@ import org.telegram.ui.Components.Crop.CropTransform; import org.telegram.ui.Components.Crop.CropView; import org.telegram.ui.Components.CubicBezierInterpolator; +import org.telegram.ui.Components.EditCoverButton; import org.telegram.ui.Components.FilterShaders; import org.telegram.ui.Components.FloatSeekBarAccessibilityDelegate; import org.telegram.ui.Components.Forum.ForumUtilities; @@ -235,10 +236,10 @@ import org.telegram.ui.Components.ImageUpdater; import org.telegram.ui.Components.ItemOptions; import org.telegram.ui.Components.LayoutHelper; -import org.telegram.ui.Components.LinkPath; import org.telegram.ui.Components.LinkSpanDrawable; import org.telegram.ui.Components.LoadingDrawable; import org.telegram.ui.Components.MediaActivity; +import org.telegram.ui.Components.MuteDrawable; import org.telegram.ui.Components.OtherDocumentPlaceholderDrawable; import org.telegram.ui.Components.Paint.Views.LPhotoPaintView; import org.telegram.ui.Components.Paint.Views.MaskPaintView; @@ -248,6 +249,8 @@ import org.telegram.ui.Components.PaintingOverlay; import org.telegram.ui.Components.PhotoCropView; import org.telegram.ui.Components.PhotoFilterView; +import org.telegram.ui.Components.PhotoViewerBlurDrawable; +import org.telegram.ui.Components.PhotoViewerCoverEditor; import org.telegram.ui.Components.PhotoViewerWebView; import org.telegram.ui.Components.PickerBottomLayoutViewer; import org.telegram.ui.Components.PipVideoOverlay; @@ -280,9 +283,11 @@ import org.telegram.ui.Components.VideoSeekPreviewImage; import org.telegram.ui.Components.VideoTimelinePlayView; import org.telegram.ui.Components.ViewHelper; +import org.telegram.ui.Components.WebPlayerView; import org.telegram.ui.Components.spoilers.SpoilersTextView; import org.telegram.ui.Stories.DarkThemeResourceProvider; import org.telegram.ui.Stories.recorder.CaptionContainerView; +import org.telegram.ui.Stories.recorder.HintView2; import org.telegram.ui.Stories.recorder.KeyboardNotifier; import org.telegram.ui.Stories.recorder.StoryEntry; @@ -324,7 +329,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat private int dateOverride; private AnimatorSet miniProgressAnimator; - private Runnable miniProgressShowRunnable = () -> toggleMiniProgressInternal(true); + private final Runnable miniProgressShowRunnable = () -> toggleMiniProgressInternal(true); private Activity parentActivity; private Context activityContext; @@ -336,6 +341,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat private PhotoViewerActionBarContainer actionBarContainer; private PhotoCountView countView; public boolean closePhotoAfterSelect = true; + public boolean closePhotoAfterSelectWithAnimation = false; private TextSelectionHelper.SimpleTextSelectionHelper textSelectionHelper; private boolean firstFrameRendered; private Paint surfaceBlackoutPaint; @@ -400,9 +406,9 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { } public void setTextShadows(boolean applyShadows) { - titleTextView[0].getPaint().setShadowLayer(AndroidUtilities.dpf2(0.66f), 0, 1, applyShadows ? 0x72000000 : 0); - titleTextView[1].getPaint().setShadowLayer(AndroidUtilities.dpf2(0.66f), 0, 1, applyShadows ? 0x72000000 : 0); - subtitleTextView.getDrawable().setShadowLayer(AndroidUtilities.dpf2(0.66f), 0, 1, applyShadows ? 0x72000000 : 0); + titleTextView[0].getPaint().setShadowLayer(dpf2(0.66f), 0, 1, applyShadows ? 0x72000000 : 0); + titleTextView[1].getPaint().setShadowLayer(dpf2(0.66f), 0, 1, applyShadows ? 0x72000000 : 0); + subtitleTextView.getDrawable().setShadowLayer(dpf2(0.66f), 0, 1, applyShadows ? 0x72000000 : 0); } public void setTitle(CharSequence title) { @@ -732,22 +738,22 @@ protected void onDraw(Canvas canvas) { AndroidUtilities.rectTmp.set( (getWidth() - width) / 2f, - marginTop + AndroidUtilities.dpf2(10), + marginTop + dpf2(10), (getWidth() + width) / 2f, - marginTop + AndroidUtilities.dpf2(10 + 23) + marginTop + dpf2(10 + 23) ); int wasAlpha = backgroundPaint.getAlpha(); backgroundPaint.setAlpha((int) (wasAlpha * show)); canvas.drawRoundRect( AndroidUtilities.rectTmp, - AndroidUtilities.dpf2(12), - AndroidUtilities.dpf2(12), + dpf2(12), + dpf2(12), backgroundPaint ); backgroundPaint.setAlpha(wasAlpha); canvas.save(); - canvas.translate((getWidth() - width) / 2f + dp(9), marginTop + dp(10)); + canvas.translate((getWidth() - width) / 2f + dp(9), marginTop + dp(9.5f)); left.setBounds(0, 0, (int) left.getCurrentWidth(), dp(23)); left.setAlpha((int) (0xFF * show)); left.draw(canvas); @@ -794,11 +800,12 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { public static final int EDIT_MODE_FILTER = 2; public static final int EDIT_MODE_PAINT = 3; public static final int EDIT_MODE_STICKER_MASK = 4; + public static final int EDIT_MODE_COVER = 5; private int videoWidth, videoHeight; private float inlineOutAnimationProgress; - private BlurringShader.BlurManager blurManager; + public BlurringShader.BlurManager blurManager; private BlurringShader.StoryBlurDrawer shadowBlurer; private WindowManager.LayoutParams windowLayoutParams; private FrameLayoutDrawer containerView; @@ -848,7 +855,10 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { private ImageView mirrorItem; private ImageView rotateItem; private ImageView tuneItem; - private ImageView muteItem; + private MuteDrawable muteDrawable; + private ImageView muteButton; + private EditCoverButton editCoverButton; + private ArrayList muteHints; private VideoCompressButton compressItem; private GroupedPhotosListView groupedPhotosListView; private Tooltip tooltip; @@ -985,7 +995,7 @@ public void run() { private float seekToProgressPending; private String shouldSavePositionForCurrentVideo; private String shouldSavePositionForCurrentVideoShortTerm; - private ArrayMap savedVideoPositions = new ArrayMap<>(); + private final HashMap savedVideoPositions = new HashMap<>(); private long lastSaveTime; private float seekToProgressPending2; private boolean streamingAlertShown; @@ -1236,28 +1246,33 @@ private void onLinkClick(ClickableSpan link, TextView widget) { } } - private void onLinkLongPress(URLSpan link, TextView widget, Runnable onDismiss) { + private void onLinkLongPress(ClickableSpan link, TextView widget, Runnable onDismiss) { + if (!(link instanceof URLSpan)) { + if (onDismiss != null) { + onDismiss.run(); + } + return; + } + final String url = ((URLSpan) link).getURL(); int timestamp = -1; BottomSheet.Builder builder = new BottomSheet.Builder(parentActivity, false, resourcesProvider, 0xff1C2229); - if (link.getURL().startsWith("video?")) { + if (url.startsWith("video?")) { try { - String timestampStr = link.getURL().substring(link.getURL().indexOf('?') + 1); + String timestampStr = url.substring(url.indexOf('?') + 1); timestamp = Integer.parseInt(timestampStr); - } catch (Throwable ignore) { - - } + } catch (Throwable ignore) {} } if (timestamp >= 0) { builder.setTitle(AndroidUtilities.formatDuration(timestamp, false)); } else { - builder.setTitle(link.getURL()); + builder.setTitle(url); } final int finalTimestamp = timestamp; builder.setItems(new CharSequence[]{getString("Open", R.string.Open), getString("Copy", R.string.Copy)}, (dialog, which) -> { if (which == 0) { onLinkClick(link, widget); } else if (which == 1) { - String url1 = link.getURL(); + String url1 = url; boolean tel = false; if (url1.startsWith("mailto:")) { url1 = url1.substring(7); @@ -1474,11 +1489,14 @@ public void run() { if (shouldSavePositionForCurrentVideo != null) { float value = progress; if (value >= 0 && SystemClock.elapsedRealtime() - lastSaveTime >= 1000) { - String saveFor = shouldSavePositionForCurrentVideo; + final String saveFor = shouldSavePositionForCurrentVideo; lastSaveTime = SystemClock.elapsedRealtime(); + if (currentMessageObject != null) { + currentMessageObject.cachedSavedTimestamp = value; + } Utilities.globalQueue.postRunnable(() -> { SharedPreferences.Editor editor = ApplicationLoader.applicationContext.getSharedPreferences("media_saved_pos", Activity.MODE_PRIVATE).edit(); - editor.putFloat(shouldSavePositionForCurrentVideo, value).commit(); + editor.putFloat(saveFor, value).commit(); }); } } @@ -1508,7 +1526,7 @@ public void run() { } }; - private Runnable switchToInlineRunnable = new Runnable() { + private final Runnable switchToInlineRunnable = new Runnable() { @Override public void run() { if (PipVideoOverlay.isVisible()) { @@ -1532,13 +1550,36 @@ public void run() { Drawable drawable = textureImageView.getDrawable(); if (drawable instanceof BitmapDrawable) { currentBitmap = ((BitmapDrawable) drawable).getBitmap(); + if (currentBitmap != null) { + if (textureImageView != null) { + textureImageView.setVisibility(View.VISIBLE); + textureImageView.setImageBitmap(currentBitmap); + } + textureViewContainer.imageReceiver.setImageBitmap(currentBitmap); + } } else { currentBitmap = Bitmaps.createBitmap(videoSurfaceView.getWidth(), videoSurfaceView.getHeight(), Bitmap.Config.ARGB_8888); - AndroidUtilities.getBitmapFromSurface(videoSurfaceView, currentBitmap); + AndroidUtilities.getBitmapFromSurface(videoSurfaceView, currentBitmap, () -> { + if (currentBitmap != null) { + if (textureImageView != null) { + textureImageView.setVisibility(View.VISIBLE); + textureImageView.setImageBitmap(currentBitmap); + } + textureViewContainer.imageReceiver.setImageBitmap(currentBitmap); + } + }); } } else { currentBitmap = Bitmaps.createBitmap(videoTextureView.getWidth(), videoTextureView.getHeight(), Bitmap.Config.ARGB_8888); videoTextureView.getBitmap(currentBitmap); + + if (currentBitmap != null) { + if (textureImageView != null) { + textureImageView.setVisibility(View.VISIBLE); + textureImageView.setImageBitmap(currentBitmap); + } + textureViewContainer.imageReceiver.setImageBitmap(currentBitmap); + } } } catch (Throwable e) { if (currentBitmap != null) { @@ -1548,14 +1589,6 @@ public void run() { FileLog.e(e); } - if (currentBitmap != null) { - if (textureImageView != null) { - textureImageView.setVisibility(View.VISIBLE); - textureImageView.setImageBitmap(currentBitmap); - } - textureViewContainer.imageReceiver.setImageBitmap(currentBitmap); - } - isInline = true; changedTextureView = textureViewContainer.textureView; if (PipVideoOverlay.show(false, parentActivity, textureViewContainer, videoWidth, videoHeight, pipVideoOverlayAnimateFlag)) { @@ -1858,7 +1891,7 @@ public void restore() { backgroundDrawable.setAlpha(255); containerView.setAlpha(1.0f); - onPhotoShow(null, null, null, null, messages, null, null, index, provider.getPlaceForPhoto(messages.get(index), null, index, true)); + onPhotoShow(null, null, null, null, messages, null, null, index, provider.getPlaceForPhoto(messages.get(index), null, index, true, false)); } } @@ -1868,7 +1901,7 @@ public void restore() { private PaintingOverlay leftPaintingOverlay; private PaintingOverlay rightPaintingOverlay; private ImageReceiver leftImage = new ImageReceiver(); - private ImageReceiver centerImage = new ImageReceiver() { + public ImageReceiver centerImage = new ImageReceiver() { @Override protected boolean setImageBitmapByKey(Drawable drawable, String key, int type, boolean memCache, int guid) { boolean result = super.setImageBitmapByKey(drawable, key, type, memCache, guid); @@ -1912,6 +1945,7 @@ protected boolean setImageBitmapByKey(Drawable drawable, String key, int type, b private boolean captionTranslated; private String captionDetectedLanguage; public StickerMakerView stickerMakerView; + public PhotoViewerCoverEditor coverEditor; private ArrayList selectedEmojis; private StickerMakerBackgroundView stickerMakerBackgroundView; private BlurButton cutOutBtn; @@ -1950,6 +1984,8 @@ protected boolean setImageBitmapByKey(Drawable drawable, String key, int type, b private float translationY; private float translateY; private float scale = 1; + private float currentCropScale = 1.0f; + private float currentCropX = 0.0f, currentCropY = 0.0f; private float rotate = 0; private float mirror = 0; private float animateToX; @@ -2302,7 +2338,7 @@ protected void onDraw(Canvas canvas) { if (staticLayout != null) { textPaint.setAlpha((int) ((1.0f - rotation) * 255)); canvas.save(); - canvas.translate((getMeasuredWidth() - width) / 2, (getMeasuredHeight() - height) / 2 + AndroidUtilities.dpf2(0.2f) + rotation * dp(5)); + canvas.translate((getMeasuredWidth() - width) / 2, (getMeasuredHeight() - height) / 2 + dpf2(0.2f) + rotation * dp(5)); staticLayout.draw(canvas); canvas.restore(); paint.setAlpha((int) (rotation * 255)); @@ -2582,6 +2618,7 @@ public static class PlaceProviderObject { public int viewY2; public View parentView; public ImageReceiver.BitmapHolder thumb; + public long dialogId; public int index; public long size; @@ -2599,7 +2636,7 @@ public static class PlaceProviderObject { public static class EmptyPhotoViewerProvider implements PhotoViewerProvider { @Override - public PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { + public PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview, boolean closing) { return null; } @@ -2785,7 +2822,7 @@ public void onClose() { } public interface PhotoViewerProvider { - PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview); + PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview, boolean closing); ImageReceiver.BitmapHolder getThumbForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index); void willSwitchFromPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index); void willHidePhotoViewer(); @@ -3055,16 +3092,22 @@ protected void onLayout(boolean changed, int _l, int t, int _r, int _b) { childTop = (_b - t) - height + (!inBubbleMode && !AndroidUtilities.isInMultiwindow ? AndroidUtilities.navigationBarHeight : 0); } else if (child == selectedPhotosListView) { childTop = actionBar.getMeasuredHeight() + dp(5); - } else if (child == muteItem) { + } else if (child == muteButton || child == editCoverButton) { final int top; - if (videoTimelineViewContainer != null && videoTimelineViewContainer.getVisibility() == VISIBLE) { top = videoTimelineViewContainer.getTop(); } else { top = pickerView.getTop(); } - - childTop = top - dp(sendPhotoType == 4 || sendPhotoType == 5 ? 40 : 15) - child.getMeasuredHeight(); + childTop = top - dp(sendPhotoType == 4 || sendPhotoType == 5 ? 40 : 15) + dp(12) - child.getMeasuredHeight(); + } else if (muteHints != null && muteHints.contains(child)) { + final int top; + if (videoTimelineViewContainer != null && videoTimelineViewContainer.getVisibility() == VISIBLE) { + top = videoTimelineViewContainer.getTop(); + } else { + top = pickerView.getTop(); + } + childTop = top - dp(sendPhotoType == 4 || sendPhotoType == 5 ? 40 : 15) + dp(12) - dp(32 + 4) - child.getMeasuredHeight(); } else if (child == videoTimelineViewContainer) { childTop -= pickerView.getHeight(); if (sendPhotoType == SELECT_TYPE_AVATAR) { @@ -3128,7 +3171,7 @@ protected void onDraw(Canvas canvas) { canvas.drawRect(0, 0, getPaddingLeft(), getMeasuredHeight(), paint); } if (getPaddingBottom() > 0) { - float offset = AndroidUtilities.dpf2(24) * (1f - actionBar.getAlpha()); + float offset = dpf2(24) * (1f - actionBar.getAlpha()); canvas.drawRect(0, getMeasuredHeight() - getPaddingBottom() + offset, getMeasuredWidth(), getMeasuredHeight() + offset, paint); } } @@ -3421,7 +3464,7 @@ private void onProgressChanged(float progress) { videoPlayerSeekbar.setTransitionProgress(1f - progress); } else { if (translationYAnimationEnabled) { - setTranslationY(AndroidUtilities.dpf2(24) * (1f - progress)); + setTranslationY(dpf2(24) * (1f - progress)); } videoPlayerSeekbarView.setAlpha(progress); } @@ -3862,6 +3905,7 @@ protected boolean isStatusBarVisible() { @SuppressLint("StaticFieldLeak") private static volatile PhotoViewer Instance = null; private static volatile PhotoViewer PipInstance = null; + private static volatile PhotoViewer Instance2 = null; public static PhotoViewer getPipInstance() { return PipInstance; @@ -3880,6 +3924,19 @@ public static PhotoViewer getInstance() { return localInstance; } + public static PhotoViewer getInstance2() { + PhotoViewer localInstance = Instance2; + if (localInstance == null) { + synchronized (PhotoViewer.class) { + localInstance = Instance2; + if (localInstance == null) { + Instance2 = localInstance = new PhotoViewer(); + } + } + } + return localInstance; + } + public boolean isOpenedFullScreenVideo() { return openedFullScreenVideo; } @@ -4240,6 +4297,40 @@ public void didReceivedNotification(int id, int account, Object... args) { preparePlayer(null, Uri.fromFile(new File(finalPath)), false, true, editState.savedFilterState); } } + } else if (id == NotificationCenter.replaceMessagesObjects) { + long dialogId = (long) args[0]; + if (currentDialogId != dialogId) return; + boolean updatedCurrent = false; + ArrayList editedMessages = (ArrayList) args[1]; + for (int i = 0; i < editedMessages.size(); ++i) { + MessageObject msg = editedMessages.get(i); + if (msg == null) continue; + MessageObject myMsg = null; + int myMsgIndex = -1; + if (imagesArr != null) { + for (int j = 0; j < imagesArr.size(); ++j) { + final MessageObject arrMsg = imagesArr.get(j); + if (arrMsg != null && arrMsg.getDialogId() == msg.getDialogId() && arrMsg.getId() == msg.getId()) { + myMsg = arrMsg; + myMsgIndex = j; + break; + } + } + } + if (myMsg != null) { + imagesArr.set(myMsgIndex, msg); + if (currentIndex == myMsgIndex) { + updatedCurrent = true; + } + } + } + if (updatedCurrent) { + setImageIndex(currentIndex, false, true, true); + } + } else if (id == NotificationCenter.dialogDeleted) { + long dialogId = (long) args[0]; + if (currentDialogId != dialogId) return; + closePhoto(true, false); } else if (id == NotificationCenter.messagesDeleted) { boolean scheduled = (Boolean) args[2]; if (scheduled) { @@ -6220,6 +6311,215 @@ public void didStopDragging(int type) { showVideoTimeline(false, false); containerView.addView(videoTimelineViewContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 54, Gravity.LEFT | Gravity.BOTTOM, 0, 8, 0, 0)); +// editCoverButton = new EditCoverButton(parentActivity, this, "Edit Cover", true); +// editCoverButton.setOnClickListener(v -> { +// switchToEditMode(EDIT_MODE_COVER); +// }); +// containerView.addView(editCoverButton, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 32, Gravity.FILL_HORIZONTAL | Gravity.BOTTOM, 60, 0, 60, 0)); + + coverEditor = new PhotoViewerCoverEditor(parentActivity, resourcesProvider, this, blurManager); + coverEditor.setVisibility(View.GONE); + coverEditor.setAlpha(0.0f); + containerView.addView(coverEditor, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | Gravity.FILL_HORIZONTAL)); + coverEditor.button.setOnClickListener(v -> { + if (coverEditor.button.isLoading() || currentIndex < 0 || currentIndex >= imagesArrLocals.size() || !(imagesArrLocals.get(currentIndex) instanceof MediaController.PhotoEntry)) { + return; + } + final MediaController.PhotoEntry entry = (MediaController.PhotoEntry) imagesArrLocals.get(currentIndex); + final long time = coverEditor.getTime(); + final String thumbPath = getTempFileAbsolutePath(); + coverEditor.button.setLoading(true); + Utilities.globalQueue.postRunnable(() -> { + final Bitmap frame = SendMessagesHelper.createVideoThumbnailAtTime(entry.path, time, null, true); + if (frame == null) { + AndroidUtilities.runOnUIThread(() -> { + coverEditor.button.setLoading(false); + switchToEditMode(EDIT_MODE_NONE); + }); + return; + } + try { + FileOutputStream stream = new FileOutputStream(new File(thumbPath)); + frame.compress(Bitmap.CompressFormat.JPEG, 90, stream); + stream.close(); + } catch (Exception e) { + FileLog.e(e); + AndroidUtilities.runOnUIThread(() -> { + coverEditor.button.setLoading(false); + switchToEditMode(EDIT_MODE_NONE); + }); + return; + } + final Bitmap bitmap = Bitmap.createBitmap(dp(26), dp(26), Bitmap.Config.ARGB_8888); + final Canvas canvas = new Canvas(bitmap); + final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG); + canvas.translate(bitmap.getWidth() / 2.0f, bitmap.getHeight() / 2.0f); + final float scale = Math.max((float) bitmap.getWidth() / frame.getWidth(), (float) bitmap.getHeight() / frame.getHeight()); + canvas.scale(scale, scale); + canvas.drawBitmap(frame, -frame.getWidth() / 2.0f, -frame.getHeight() / 2.0f, paint); + AndroidUtilities.runOnUIThread(() -> { + if (entry.thumbPath != null) { + try { + new File(entry.thumbPath).delete(); + } catch (Exception e) { + FileLog.e(e); + } + } + entry.customThumb = true; + entry.customThumbSavedPosition = time; + entry.thumbPath = thumbPath; + coverEditor.button.setLoading(false); + if (editCoverButton != null) { + editCoverButton.setImage(bitmap); + } + switchToEditMode(EDIT_MODE_NONE); + }); + }); + }); + coverEditor.setOnGalleryImage(fromEntry -> { + if (coverEditor.button.isLoading() || currentIndex < 0 || currentIndex >= imagesArrLocals.size() || !(imagesArrLocals.get(currentIndex) instanceof MediaController.PhotoEntry)) { + return; + } + coverEditor.closeGallery(); + coverEditor.button.setLoading(true); + final MediaController.PhotoEntry entry = (MediaController.PhotoEntry) imagesArrLocals.get(currentIndex); + final String thumbPath = getTempFileAbsolutePath(); + Utilities.globalQueue.postRunnable(() -> { + Bitmap frame = BitmapFactory.decodeFile(fromEntry.path); + if (frame == null) { + AndroidUtilities.runOnUIThread(() -> { + coverEditor.button.setLoading(false); + switchToEditMode(EDIT_MODE_NONE); + }); + return; + } + + float scale = Math.max((float) frame.getWidth() / entry.width, (float) frame.getHeight() / entry.height); + final Bitmap croppedFrame = Bitmap.createBitmap((int) (entry.width * scale), (int) (entry.height * scale), Bitmap.Config.ARGB_8888); + Canvas canvas = new Canvas(croppedFrame); + final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG); + canvas.translate(croppedFrame.getWidth() / 2, croppedFrame.getHeight() / 2); + scale = Math.max((float) croppedFrame.getWidth() / frame.getWidth(), (float) croppedFrame.getHeight() / frame.getHeight()); + canvas.scale(scale, scale); + canvas.drawBitmap(frame, -frame.getWidth() / 2, -frame.getHeight() / 2, paint); + + try { + FileOutputStream stream = new FileOutputStream(new File(thumbPath)); + croppedFrame.compress(Bitmap.CompressFormat.JPEG, 90, stream); + stream.close(); + } catch (Exception e) { + FileLog.e(e); + AndroidUtilities.runOnUIThread(() -> { + coverEditor.button.setLoading(false); + switchToEditMode(EDIT_MODE_NONE); + }); + return; + } + + final Bitmap bitmap = Bitmap.createBitmap(dp(26), dp(26), Bitmap.Config.ARGB_8888); + canvas = new Canvas(bitmap); + canvas.translate(bitmap.getWidth() / 2.0f, bitmap.getHeight() / 2.0f); + scale = Math.max((float) bitmap.getWidth() / croppedFrame.getWidth(), (float) bitmap.getHeight() / croppedFrame.getHeight()); + canvas.scale(scale, scale); + canvas.drawBitmap(croppedFrame, -croppedFrame.getWidth() / 2.0f, -croppedFrame.getHeight() / 2.0f, paint); + + AndroidUtilities.runOnUIThread(() -> { + if (entry.thumbPath != null) { + try { + new File(entry.thumbPath).delete(); + } catch (Exception e) { + FileLog.e(e); + } + } + entry.customThumb = true; + entry.customThumbSavedPosition = -1; + entry.thumbPath = thumbPath; + coverEditor.button.setLoading(false); + if (editCoverButton != null) { + editCoverButton.setImage(bitmap); + } + switchToEditMode(EDIT_MODE_NONE); + }); + }); + }); + + muteButton = new ImageView(parentActivity) { + @Override + public void setTranslationY(float translationY) { + super.setTranslationY(translationY); + if (muteHints != null) { + for (HintView2 hint : muteHints) { + hint.setTranslationY(translationY); + } + } + if (editCoverButton != null) { + editCoverButton.setTranslationY(translationY); + } + } + + @Override + public void setAlpha(float alpha) { + super.setAlpha(alpha); + if (editCoverButton != null) { + editCoverButton.setAlpha(alpha); + } + } + + @Override + public void setVisibility(int visibility) { + super.setVisibility(visibility); + if (editCoverButton != null) { + editCoverButton.setVisibility(visibility); + } + } + }; + muteButton.setScaleType(ImageView.ScaleType.CENTER); + muteButton.setImageDrawable(muteDrawable = new MuteDrawable(parentActivity)); + muteButton.setColorFilter(new PorterDuffColorFilter(0xFFFFFFFF, PorterDuff.Mode.SRC_IN)); + muteButton.setBackground(new PhotoViewerBlurDrawable(this, blurManager, muteButton)); + ScaleStateListAnimator.apply(muteButton); + containerView.addView(muteButton, LayoutHelper.createFrame(32, 32, Gravity.LEFT | Gravity.BOTTOM, 12, 0, 0, 0)); + muteButton.setOnClickListener(v -> { + if (isCaptionOpen()) { + return; + } + muteVideo = !muteVideo; + if (muteHints != null) { + for (HintView2 hint : muteHints) { + hint.hide(); + } + } + if (muteVideo) { + final HintView2 hint = new HintView2(parentActivity, HintView2.DIRECTION_BOTTOM); + hint.setMultilineText(true); + hint.setText(getString(R.string.EditorMuteHint)); + hint.setMaxWidthPx(HintView2.cutInFancyHalf(hint.getText(), hint.getTextPaint())); + hint.setPadding(dp(6), 0, dp(6), 0); + hint.setJoint(0, 12 + 16 - 6); + hint.setOnHiddenListener(() -> { + if (muteHints != null) { + muteHints.remove(hint); + } + }); + if (muteHints == null) { + muteHints = new ArrayList<>(); + } + containerView.addView(hint, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 200, Gravity.LEFT | Gravity.BOTTOM)); + muteHints.add(hint); + hint.show(); + } + updateMuteButton(); + updateVideoInfo(); + if (muteVideo && !checkImageView.isChecked()) { + checkImageView.callOnClick(); + } else { + Object object = imagesArrLocals.get(currentIndex); + if (object instanceof MediaController.MediaEditState) { + ((MediaController.MediaEditState) object).editedInfo = getCurrentVideoEditedInfo(); + } + } + }); + captionEdit = new CaptionPhotoViewer(containerView.getContext(), windowView, containerView, containerView, resourcesProvider, blurManager, this::applyCaption) { private final Path path = new Path(); @@ -6248,6 +6548,10 @@ public void updateKeyboard(int keyboardHeight) { .setInterpolator(AdjustPanLayoutHelper.keyboardInterpolator) .start(); } + actionBar.animate().alpha(isActionBarVisible && (getCaptionView() != topCaptionEdit || !topCaptionEdit.keyboardNotifier.keyboardVisible()) ? 1.0f : 0.0f).start(); + if (pickerView.getVisibility() == View.VISIBLE) { + toggleOnlyCheckImageView(isActionBarVisible && (getCaptionView() != topCaptionEdit || !topCaptionEdit.keyboardNotifier.keyboardVisible())); + } } @Override @@ -6310,7 +6614,7 @@ public void updateMentionsLayoutPosition() { @Override protected void onUpdateShowKeyboard(float keyboardT) { super.onUpdateShowKeyboard(keyboardT); - muteItem.setAlpha((1f - keyboardT) * (muteItem.getTag() != null ? 1 : 0)); + muteButton.setAlpha((1f - keyboardT) * (muteButton.getTag() != null ? 1 : 0)); videoTimelineViewContainer.setAlpha((1f - keyboardT) * (videoTimelineViewContainer.getTag() != null ? 1 : 0)); } @@ -6362,7 +6666,7 @@ protected void openedKeyboard() { if (videoTimelineViewContainer != null && videoTimelineViewContainer.getVisibility() != View.GONE) { videoTimelineViewContainer.setTranslationY(pickerView.getTranslationY() - Math.max(0, captionEdit.getEditTextHeight() - dp(46)) * captionEdit.getAlpha()); } - muteItem.setTranslationY(-Math.max(0, height - dp(46)) * captionEdit.getAlpha()); + muteButton.setTranslationY(-Math.max(0, height - dp(46)) * captionEdit.getAlpha()); if (captionEdit.mentionContainer != null) { captionEdit.mentionContainer.setTranslationY(-height); } @@ -6388,6 +6692,15 @@ protected boolean ignoreTouches(float x, float y) { return !keyboardShown && currentEditMode != EDIT_MODE_NONE; } + @Override + public void updateKeyboard(int keyboardHeight) { + super.updateKeyboard(keyboardHeight); + actionBar.animate().alpha(isActionBarVisible && (getCaptionView() != topCaptionEdit || !topCaptionEdit.keyboardNotifier.keyboardVisible()) ? 1.0f : 0.0f).start(); + if (pickerView.getVisibility() == View.VISIBLE) { + toggleOnlyCheckImageView(isActionBarVisible && (getCaptionView() != topCaptionEdit || !topCaptionEdit.keyboardNotifier.keyboardVisible())); + } + } + @Override protected void drawBlur(BlurringShader.StoryBlurDrawer blur, Canvas canvas, RectF rect, float r, boolean text, float ox, float oy, boolean thisView, float alpha) { canvas.save(); @@ -6911,7 +7224,9 @@ public void setTranslationY(float translationY) { int[] location = new int[2]; view.getLocationInWindow(location); sendPopupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, location[0] + view.getMeasuredWidth() - sendPopupLayout.getMeasuredWidth() + dp(14), location[1] - sendPopupLayout.getMeasuredHeight() - dp(18)); - view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} return false; }); @@ -7034,27 +7349,6 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { }); paintItem.setContentDescription(getString("AccDescrPhotoEditor", R.string.AccDescrPhotoEditor)); - muteItem = new ImageView(parentActivity); - muteItem.setScaleType(ImageView.ScaleType.CENTER); - muteItem.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.ACTION_BAR_WHITE_SELECTOR_COLOR)); - containerView.addView(muteItem, LayoutHelper.createFrame(48, 48, Gravity.LEFT | Gravity.BOTTOM, 16, 0, 0, 0)); - muteItem.setOnClickListener(v -> { - if (isCaptionOpen()) { - return; - } - muteVideo = !muteVideo; - updateMuteButton(); - updateVideoInfo(); - if (muteVideo && !checkImageView.isChecked()) { - checkImageView.callOnClick(); - } else { - Object object = imagesArrLocals.get(currentIndex); - if (object instanceof MediaController.MediaEditState) { - ((MediaController.MediaEditState) object).editedInfo = getCurrentVideoEditedInfo(); - } - } - }); - compressItem = new VideoCompressButton(parentActivity); compressItem.setTag(1); compressItem.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.ACTION_BAR_WHITE_SELECTOR_COLOR)); @@ -7162,7 +7456,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { resetButton.setGravity(Gravity.CENTER); resetButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR, 0)); resetButton.setPadding(dp(20), 0, dp(20), 0); - resetButton.setText(getString("Reset", R.string.CropReset).toUpperCase()); + resetButton.setText(getString(R.string.CropReset).toUpperCase()); resetButton.setTypeface(AndroidUtilities.bold()); editorDoneLayout.addView(resetButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.CENTER)); resetButton.setOnClickListener(v -> { @@ -7751,12 +8045,16 @@ public boolean isStickerEditor() { placeProvider.replaceButtonPressed(currentIndex, videoEditedInfo); } if (closePhotoAfterSelect) { - closePhoto(false, false); + if (closePhotoAfterSelectWithAnimation) { + AndroidUtilities.runOnUIThread(() -> closePhoto(true, false), 200); + } else { + closePhoto(false, false); + } } } } - private String getTempFileAbsolutePath() { + public static String getTempFileAbsolutePath() { File file = new File(FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE), SharedConfig.getLastLocalId() + "_temp.jpg"); return file.getAbsolutePath(); } @@ -7787,7 +8085,19 @@ private void showShareAlert(ArrayList messages) { parentChatActivity.getFragmentView().requestLayout(); } final boolean finalOpenKeyboardOnShareAlertClose = openKeyboardOnShareAlertClose; - ShareAlert alert = new ShareAlert(parentActivity, parentChatActivity, messages, null, null, false, null, null, false, true, false, null) { + String link = null; + Integer videoTimestamp = null; + if (messages != null && messages.size() == 1 && videoPlayer != null && videoPlayer.getCurrentPosition() > 1_500L && currentMessageObject != null && currentMessageObject.isVideo()) { + videoTimestamp = (int) (videoPlayer.getCurrentPosition() / 1000L); + } + if (messages != null && messages.size() == 1) { + MessageObject msg = messages.get(0); + String username = ChatObject.getPublicUsername(MessagesController.getInstance(currentAccount).getChat(-msg.getDialogId())); + if (!TextUtils.isEmpty(username)) { + link = "https://" + MessagesController.getInstance(currentAccount).linkPrefix + "/" + username + "/" + msg.getId(); + } + } + ShareAlert alert = new ShareAlert(parentActivity, parentChatActivity, messages, null, null, false, link, null, false, true, false, videoTimestamp, null) { @Override protected void onSend(LongSparseArray dids, int count, TLRPC.TL_forumTopic topic) { AndroidUtilities.runOnUIThread(() -> { @@ -7886,8 +8196,8 @@ private void updateQualityItems() { videoQualityLayout.removeAllViews(); videoQualityItems.clear(); - TextView header = new TextView(activityContext); - header.setText(LocaleController.getString(R.string.QualityList)); + final TextView header = new TextView(activityContext); + header.setText(getString(R.string.QualityList)); header.setTypeface(AndroidUtilities.bold()); header.setPadding(dp(16), dp(9), dp(16), dp(8)); header.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); @@ -8060,6 +8370,9 @@ private void updateQualityItems() { } } videoItemIcon.bottomText.setText(t, true); + if (videoPreviewFrame != null && currentMessageObject != null && videoPlayer != null) { + videoPreviewFrame.open(videoPlayer); + } } public float getCurrentVideoSpeed() { @@ -8122,9 +8435,6 @@ public static class CaptionTextView extends SpoilersTextView { private final PhotoViewer.CaptionScrollView scrollView; private final TextSelectionHelper.SimpleTextSelectionHelper textSelectionHelper; private LinkSpanDrawable pressedLink; - private final LinkSpanDrawable.LinkCollector links = new LinkSpanDrawable.LinkCollector(this); - private final Utilities.Callback3 onLinkLongPress; - private final Utilities.Callback2 onLinkClick; private ArrayList quoteBlocks; private boolean hasQuote; @@ -8133,12 +8443,17 @@ public CaptionTextView( PhotoViewer.CaptionScrollView scrollView, TextSelectionHelper.SimpleTextSelectionHelper textSelectionHelper, Utilities.Callback2 onLinkClick, - Utilities.Callback3 onLinkLongPress + Utilities.Callback3 onLinkLongPress ) { super(context); this.scrollView = scrollView; - this.onLinkClick = onLinkClick; - this.onLinkLongPress = onLinkLongPress; + setClearLinkOnLongPress(false); + this.onPressListener = span -> { + onLinkClick.run(span, this); + }; + this.onLongPressListener = span -> { + onLinkLongPress.run(span, this, this::clearLinks); + }; this.textSelectionHelper = textSelectionHelper; ViewHelper.setPadding(this, 16, 8, 16, 8); setLinkTextColor(0xff79c4fc); @@ -8153,69 +8468,6 @@ public CaptionTextView( }); } - @Override - public boolean onTouchEvent(MotionEvent event) { - if (getLayout() == null) { - return false; - } - if (textSelectionHelper != null && getStaticTextLayout() != null) { - textSelectionHelper.setSelectabeleView(this); - textSelectionHelper.setScrollingParent(scrollView); - textSelectionHelper.update(getPaddingLeft(), getPaddingTop()); - textSelectionHelper.onTouchEvent(event); - } - boolean linkResult = false; - if (event.getAction() == MotionEvent.ACTION_DOWN || pressedLink != null && event.getAction() == MotionEvent.ACTION_UP) { - int x = (int) (event.getX() - getPaddingLeft()); - int y = (int) (event.getY() - getPaddingTop()); - final int line = getLayout().getLineForVertical(y); - final int off = getLayout().getOffsetForHorizontal(line, x); - final float left = getLayout().getLineLeft(line); - - ClickableSpan touchLink = null; - if (left <= x && left + getLayout().getLineWidth(line) >= x && y >= 0 && y <= getLayout().getHeight()) { - Spannable buffer = new SpannableString(getText()); - ClickableSpan[] link = buffer.getSpans(off, off, ClickableSpan.class); - if (link.length != 0) { - touchLink = link[0]; - if (event.getAction() == MotionEvent.ACTION_DOWN) { - linkResult = true; - links.clear(); - pressedLink = new LinkSpanDrawable<>(link[0], null, event.getX(), event.getY()); - pressedLink.setColor(0x6662a9e3); - links.addLink(pressedLink); - int start = buffer.getSpanStart(pressedLink.getSpan()); - int end = buffer.getSpanEnd(pressedLink.getSpan()); - LinkPath path = pressedLink.obtainNewPath(); - path.setCurrentLayout(getLayout(), start, getPaddingTop()); - getLayout().getSelectionPath(start, end, path); - - final LinkSpanDrawable savedPressedLink = pressedLink; - postDelayed(() -> { - if (savedPressedLink == pressedLink && pressedLink != null && pressedLink.getSpan() instanceof URLSpan) { - onLinkLongPress.run((URLSpan) pressedLink.getSpan(), this, links::clear); - pressedLink = null; - } - }, ViewConfiguration.getLongPressTimeout()); - } - } - } - if (event.getAction() == MotionEvent.ACTION_UP) { - links.clear(); - if (pressedLink != null && pressedLink.getSpan() == touchLink) { - onLinkClick.run(pressedLink.getSpan(), this); - } - pressedLink = null; - linkResult = true; - } - } else if (event.getAction() == MotionEvent.ACTION_CANCEL) { - links.clear(); - pressedLink = null; - linkResult = true; - } - return linkResult || super.onTouchEvent(event); - } - @Override public void setPressed(boolean pressed) { final boolean needsRefresh = pressed != isPressed(); @@ -8238,12 +8490,6 @@ protected void onDraw(Canvas canvas) { canvas.restore(); } - canvas.save(); - canvas.translate(getPaddingLeft(), 0); - if (links.draw(canvas)) { - invalidate(); - } - canvas.restore(); super.onDraw(canvas); if (lastLayout != getLayout()) { animatedEmojiDrawables = AnimatedEmojiSpan.update(AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, this, animatedEmojiDrawables, getLayout()); @@ -8406,7 +8652,12 @@ private void switchToPip(boolean fromGesture) { if (bitmap != null) { try { if (usedSurfaceView) { - AndroidUtilities.getBitmapFromSurface(videoSurfaceView, bitmap); + Bitmap toBitmap = Bitmap.createBitmap(bitmap); + AndroidUtilities.getBitmapFromSurface(videoSurfaceView, toBitmap, () -> { + if (animation == null) return; + animation.replaceAnimatedBitmap(toBitmap); + animation.invalidateInternal(); + }); } else { Bitmap src = videoTextureView.getBitmap(bitmap.getWidth(), bitmap.getHeight()); Canvas canvas = new Canvas(bitmap); @@ -8459,25 +8710,71 @@ public void onAnimationEnd(Animator animation) { float toY = rect.y; float toY2 = rect.y - aspectRatioFrameLayout.getY(); + boolean awaitBeforeAnimation = false; + final ViewOutlineProvider outlineProvider = new ViewOutlineProvider() { + @Override + public void getOutline(View view, Outline outline) { + outline.setRoundRect(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight(), (float) valueAnimator.getAnimatedValue() * dp(PipVideoOverlay.ROUNDED_CORNERS_DP) * (1f / scale)); + } + }; + AnimatorSet animatorSet = new AnimatorSet(); + Runnable start = () -> { + textureView.setOutlineProvider(outlineProvider); + textureView.setClipToOutline(true); + textureImageView.setOutlineProvider(outlineProvider); + textureImageView.setClipToOutline(true); + if (firstFrameView != null) { + firstFrameView.setOutlineProvider(outlineProvider); + firstFrameView.setClipToOutline(true); + } + textureImageView.setTranslationY(fromY2); + textureView.setTranslationY(fromY); + if (firstFrameView != null) { + firstFrameView.setTranslationY(fromY); + } + + translationY = 0; + containerView.invalidate(); + animatorSet.start(); + }; + if (videoSurfaceView != null) { videoPlayer.player.pause(); - textureImageView.setVisibility(View.VISIBLE); if (usedSurfaceView) { Bitmap bitmap = Bitmaps.createBitmap(videoSurfaceView.getWidth(), videoSurfaceView.getHeight(), Bitmap.Config.ARGB_8888); - AndroidUtilities.getBitmapFromSurface(videoSurfaceView, bitmap); - textureImageView.setImageBitmap(bitmap); + awaitBeforeAnimation = true; + final boolean[] started = new boolean[1]; + AndroidUtilities.getBitmapFromSurface(videoSurfaceView, bitmap, () -> { + if (textureImageView != null) { + textureImageView.setImageBitmap(bitmap); + textureImageView.setVisibility(View.VISIBLE); + if (videoSurfaceView != null) { + videoSurfaceView.setVisibility(View.INVISIBLE); + } + if (!started[0]) { + started[0] = true; + start.run(); + } + } + }); + AndroidUtilities.runOnUIThread(() -> { + if (!started[0]) { + if (textureImageView != null) { + textureImageView.setVisibility(View.VISIBLE); + } + if (videoSurfaceView != null) { + videoSurfaceView.setVisibility(View.INVISIBLE); + } + started[0] = true; + start.run(); + } + }, 600); + } else { + textureImageView.setVisibility(View.VISIBLE); + videoSurfaceView.setVisibility(View.INVISIBLE); } - videoSurfaceView.setVisibility(View.INVISIBLE); - } - textureImageView.setTranslationY(fromY2); - textureView.setTranslationY(fromY); - if (firstFrameView != null) { - firstFrameView.setTranslationY(fromY); } - translationY = 0; - containerView.invalidate(); - CubicBezierInterpolator interpolator; if (fromGesture) { if (fromY < toY2) { @@ -8488,20 +8785,6 @@ public void onAnimationEnd(Animator animation) { } else { interpolator = null; } - ViewOutlineProvider outlineProvider = new ViewOutlineProvider() { - @Override - public void getOutline(View view, Outline outline) { - outline.setRoundRect(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight(), (float) valueAnimator.getAnimatedValue() * dp(PipVideoOverlay.ROUNDED_CORNERS_DP) * (1f / scale)); - } - }; - textureView.setOutlineProvider(outlineProvider); - textureView.setClipToOutline(true); - textureImageView.setOutlineProvider(outlineProvider); - textureImageView.setClipToOutline(true); - if (firstFrameView != null) { - firstFrameView.setOutlineProvider(outlineProvider); - firstFrameView.setClipToOutline(true); - } valueAnimator.addUpdateListener(animation -> { float xValue = (float) animation.getAnimatedValue(); @@ -8525,7 +8808,6 @@ public void getOutline(View view, Outline outline) { } }); - AnimatorSet animatorSet = new AnimatorSet(); ValueAnimator progressAnimator = ValueAnimator.ofFloat(0, 1); progressAnimator.addUpdateListener(animation -> clippingImageProgress = (float) animation.getAnimatedValue()); animatorSet.playTogether( @@ -8560,7 +8842,9 @@ public void onAnimationEnd(Animator animation) { }, 100); } }); - animatorSet.start(); + if (!awaitBeforeAnimation) { + start.run(); + } if (!fromGesture) { toggleActionBar(false, true, new ActionBarToggleParams().enableStatusBarAnimation(false).enableTranslationAnimation(false).animationDuration(250).animationInterpolator(new DecelerateInterpolator())); } @@ -9510,34 +9794,27 @@ private void updatePlayerState(boolean playWhenReady, int playbackState) { final long duration = getVideoDuration() / 1000L; final String name = currentMessageObject.messageOwner != null && currentMessageObject.messageOwner.media != null && currentMessageObject.messageOwner.media.webpage != null ? currentMessageObject.messageOwner.media.webpage.url : null; if (!TextUtils.isEmpty(name)) { - if (duration >= 10 * 60) { - if (currentMessageObject.forceSeekTo < 0) { - SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("media_saved_pos", Activity.MODE_PRIVATE); - float pos = preferences.getFloat(name, -1); + if (duration >= 10) { + SavedVideoPosition videoPosition = savedVideoPositions.get(name); + if (currentMessageObject.forceSeekTo < 0 && videoPosition != null) { + float pos = videoPosition.position; if (pos > 0 && pos < 0.999f) { currentMessageObject.forceSeekTo = pos; videoPlayerSeekbar.setProgress(pos); } } - shouldSavePositionForCurrentVideo = name; - } else if (duration >= 10) { - SavedVideoPosition videoPosition = null; - for (int i = savedVideoPositions.size() - 1; i >= 0; i--) { - final SavedVideoPosition item = savedVideoPositions.valueAt(i); - if (item.timestamp < SystemClock.elapsedRealtime() - 5 * 1000) { - savedVideoPositions.removeAt(i); - } else if (videoPosition == null && savedVideoPositions.keyAt(i).equals(name)) { - videoPosition = item; - } - } - if (currentMessageObject.forceSeekTo < 0 && videoPosition != null) { - float pos = videoPosition.position; + shouldSavePositionForCurrentVideoShortTerm = name; + } + if (duration >= 5 * 60) { + if (currentMessageObject.forceSeekTo < 0) { + SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("media_saved_pos", Activity.MODE_PRIVATE); + float pos = preferences.getFloat(name, -1); if (pos > 0 && pos < 0.999f) { currentMessageObject.forceSeekTo = pos; videoPlayerSeekbar.setProgress(pos); } } - shouldSavePositionForCurrentVideoShortTerm = name; + shouldSavePositionForCurrentVideo = name; } } } @@ -9582,7 +9859,7 @@ private void updatePlayerState(boolean playWhenReady, int playbackState) { } if (playbackState == ExoPlayer.STATE_READY || playbackState == ExoPlayer.STATE_IDLE) { if (currentMessageObject != null && videoPlayer != null) { - videoPreviewFrame.open(videoPlayer.getCurrentUri()); + videoPreviewFrame.open(videoPlayer); } if (seekToProgressPending != 0) { seekVideoOrWebToProgress(seekToProgressPending); @@ -9972,36 +10249,29 @@ public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) { if (currentMessageObject != null) { final int duration = (int) currentMessageObject.getDuration(); - final String name = currentMessageObject.getFileName(); + final String name = currentMessageObject.getFileNameFast(); if (!TextUtils.isEmpty(name)) { - if (duration >= 10 * 60) { - if (currentMessageObject.forceSeekTo < 0) { - SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("media_saved_pos", Activity.MODE_PRIVATE); - float pos = preferences.getFloat(name, -1); + if (duration >= 10) { + SavedVideoPosition videoPosition = savedVideoPositions.get(name); + if (currentMessageObject.forceSeekTo < 0 && videoPosition != null) { + float pos = videoPosition.position; if (pos > 0 && pos < 0.999f) { currentMessageObject.forceSeekTo = pos; videoPlayerSeekbar.setProgress(pos); } } - shouldSavePositionForCurrentVideo = name; - } else if (duration >= 10) { - SavedVideoPosition videoPosition = null; - for (int i = savedVideoPositions.size() - 1; i >= 0; i--) { - final SavedVideoPosition item = savedVideoPositions.valueAt(i); - if (item.timestamp < SystemClock.elapsedRealtime() - 5 * 1000) { - savedVideoPositions.removeAt(i); - } else if (videoPosition == null && savedVideoPositions.keyAt(i).equals(name)) { - videoPosition = item; - } - } - if (currentMessageObject != null && currentMessageObject.forceSeekTo < 0 && videoPosition != null) { - float pos = videoPosition.position; + shouldSavePositionForCurrentVideoShortTerm = name; + } + if (duration >= 5 * 60) { + if (currentMessageObject.forceSeekTo < 0) { + SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("media_saved_pos", Activity.MODE_PRIVATE); + float pos = preferences.getFloat(name, -1); if (pos > 0 && pos < 0.999f) { currentMessageObject.forceSeekTo = pos; videoPlayerSeekbar.setProgress(pos); } } - shouldSavePositionForCurrentVideoShortTerm = name; + shouldSavePositionForCurrentVideo = name; } } } @@ -10223,6 +10493,9 @@ private void releasePlayer(boolean onClose) { if (shouldSavePositionForCurrentVideoShortTerm != null) { final float progress = videoPlayer.getCurrentPosition() / (float) videoPlayer.getDuration(); savedVideoPositions.put(shouldSavePositionForCurrentVideoShortTerm, new SavedVideoPosition(progress, SystemClock.elapsedRealtime())); + if (currentMessageObject != null) { + currentMessageObject.cachedSavedTimestamp = progress; + } } videoPlayer.releasePlayer(true); videoPlayer = null; @@ -10234,6 +10507,9 @@ private void releasePlayer(boolean onClose) { if (shouldSavePositionForCurrentVideoShortTerm != null) { float progress = getCurrentVideoPosition() / (float) getVideoDuration(); savedVideoPositions.put(shouldSavePositionForCurrentVideoShortTerm, new SavedVideoPosition(progress, SystemClock.elapsedRealtime())); + if (currentMessageObject != null) { + currentMessageObject.cachedSavedTimestamp = progress; + } } } @@ -10593,12 +10869,16 @@ private void applyCurrentEditMode(Bitmap bitmap) { } else { mergeImages(entry.imagePath = getTempFileAbsolutePath(), null, croppedPaintBitmap, croppedBitmap, AndroidUtilities.getPhotoSize(), true); } - mergeImages(entry.thumbPath = getTempFileAbsolutePath(), null, croppedPaintBitmap, croppedBitmap, thumbSize, true); + if (!entry.customThumb) { + mergeImages(entry.thumbPath = getTempFileAbsolutePath(), null, croppedPaintBitmap, croppedBitmap, thumbSize, true); + } } else { TLRPC.PhotoSize size = ImageLoader.scaleAndSaveImage(croppedBitmap, getCompressFormat(), AndroidUtilities.getPhotoSize(), AndroidUtilities.getPhotoSize(), 87, false, 101, 101); entry.imagePath = currentImagePath = FileLoader.getInstance(currentAccount).getPathToAttach(size, true).toString(); - size = ImageLoader.scaleAndSaveImage(croppedBitmap, thumbSize, thumbSize, 70, false, 101, 101); - entry.thumbPath = FileLoader.getInstance(currentAccount).getPathToAttach(size, true).toString(); + if (!entry.customThumb) { + size = ImageLoader.scaleAndSaveImage(croppedBitmap, thumbSize, thumbSize, 70, false, 101, 101); + entry.thumbPath = FileLoader.getInstance(currentAccount).getPathToAttach(size, true).toString(); + } } } else if (entry.paintPath != null) { Bitmap paintBitmap = BitmapFactory.decodeFile(entry.fullPaintPath); @@ -10608,12 +10888,16 @@ private void applyCurrentEditMode(Bitmap bitmap) { } else { mergeImages(entry.imagePath = getTempFileAbsolutePath(), null, croppedBitmap, paintBitmap, AndroidUtilities.getPhotoSize(), false); } - mergeImages(entry.thumbPath = getTempFileAbsolutePath(), null, croppedBitmap, paintBitmap, thumbSize, false); + if (!entry.customThumb) { + mergeImages(entry.thumbPath = getTempFileAbsolutePath(), null, croppedBitmap, paintBitmap, thumbSize, false); + } } else { TLRPC.PhotoSize size = ImageLoader.scaleAndSaveImage(croppedBitmap, getCompressFormat(), AndroidUtilities.getPhotoSize(), AndroidUtilities.getPhotoSize(), 87, false, 101, 101); entry.imagePath = currentImagePath = FileLoader.getInstance(currentAccount).getPathToAttach(size, true).toString(); - size = ImageLoader.scaleAndSaveImage(croppedBitmap, thumbSize, thumbSize, 70, false, 101, 101); - entry.thumbPath = FileLoader.getInstance(currentAccount).getPathToAttach(size, true).toString(); + if (!entry.customThumb) { + size = ImageLoader.scaleAndSaveImage(croppedBitmap, thumbSize, thumbSize, 70, false, 101, 101); + entry.thumbPath = FileLoader.getInstance(currentAccount).getPathToAttach(size, true).toString(); + } } } if (recycleCropped && croppedBitmap != null) { @@ -10703,7 +10987,7 @@ private void applyCurrentEditMode() { return; } - if (entry.thumbPath != null) { + if (!entry.customThumb && entry.thumbPath != null) { new File(entry.thumbPath).delete(); entry.thumbPath = null; } @@ -10731,7 +11015,9 @@ private void applyCurrentEditMode() { mergeImages(entry.imagePath = getTempFileAbsolutePath(), null, croppedPaintBitmap, croppedBitmap, AndroidUtilities.getPhotoSize(), true); } } - mergeImages(entry.thumbPath = getTempFileAbsolutePath(), null, croppedPaintBitmap, croppedBitmap, thumbSize, true); + if (!entry.customThumb) { + mergeImages(entry.thumbPath = getTempFileAbsolutePath(), null, croppedPaintBitmap, croppedBitmap, thumbSize, true); + } if (croppedPaintBitmap != null) { croppedPaintBitmap.recycle(); } @@ -10743,8 +11029,10 @@ private void applyCurrentEditMode() { TLRPC.PhotoSize size = ImageLoader.scaleAndSaveImage(croppedBitmap, getCompressFormat(), AndroidUtilities.getPhotoSize(), AndroidUtilities.getPhotoSize(), 87, false, 101, 101); entry.imagePath = currentImagePath = FileLoader.getInstance(currentAccount).getPathToAttach(size, true).toString(); } - TLRPC.PhotoSize size = ImageLoader.scaleAndSaveImage(croppedBitmap, thumbSize, thumbSize, 70, false, 101, 101); - entry.thumbPath = FileLoader.getInstance(currentAccount).getPathToAttach(size, true).toString(); + if (!entry.customThumb) { + TLRPC.PhotoSize size = ImageLoader.scaleAndSaveImage(croppedBitmap, thumbSize, thumbSize, 70, false, 101, 101); + entry.thumbPath = FileLoader.getInstance(currentAccount).getPathToAttach(size, true).toString(); + } } if (currentEditMode == EDIT_MODE_NONE && isCurrentVideo) { bitmap.recycle(); @@ -10763,8 +11051,10 @@ private void applyCurrentEditMode() { size = ImageLoader.scaleAndSaveImage(b, getCompressFormat(), AndroidUtilities.getPhotoSize(), AndroidUtilities.getPhotoSize(), 87, false, 101, 101); entry.imagePath = currentImagePath = FileLoader.getInstance(currentAccount).getPathToAttach(size, true).toString(); } - size = ImageLoader.scaleAndSaveImage(b, getCompressFormat(), thumbSize, thumbSize, 83, false, 101, 101); - entry.thumbPath = FileLoader.getInstance(currentAccount).getPathToAttach(size, true).toString(); + if (!entry.customThumb) { + size = ImageLoader.scaleAndSaveImage(b, getCompressFormat(), thumbSize, thumbSize, 83, false, 101, 101); + entry.thumbPath = FileLoader.getInstance(currentAccount).getPathToAttach(size, true).toString(); + } } else { String path = entry.fullPaintPath; Bitmap fullPaintBitmap = entry.paintPath.equals(entry.fullPaintPath) ? paintingOverlay.getThumb() : null; @@ -10791,7 +11081,9 @@ private void applyCurrentEditMode() { mergeImages(entry.imagePath = getTempFileAbsolutePath(), path, paintBitmap, b, AndroidUtilities.getPhotoSize(), true); } } - mergeImages(entry.thumbPath = getTempFileAbsolutePath(), path, paintBitmap, b, thumbSize, true); + if (!entry.customThumb) { + mergeImages(entry.thumbPath = getTempFileAbsolutePath(), path, paintBitmap, b, thumbSize, true); + } if (recyclePaint) { paintBitmap.recycle(); } @@ -10905,7 +11197,9 @@ private void applyCurrentEditMode() { mergeImages(entry.imagePath = getTempFileAbsolutePath(), null, croppedBitmap, paintBitmap, AndroidUtilities.getPhotoSize(), false); } } - mergeImages(entry.thumbPath = getTempFileAbsolutePath(), null, croppedBitmap, paintBitmap, thumbSize, false); + if (!entry.customThumb) { + mergeImages(entry.thumbPath = getTempFileAbsolutePath(), null, croppedBitmap, paintBitmap, thumbSize, false); + } if (recycle && paintBitmap != null) { paintBitmap.recycle(); @@ -11368,6 +11662,9 @@ public void switchToEditMode(final int mode) { animators.add(ObjectAnimator.ofFloat(maskPaintView.buttonsLayout, View.ALPHA, 0)); animators.add(ObjectAnimator.ofFloat(maskPaintView.weightChooserView, View.TRANSLATION_X, dp(-18))); animators.add(ObjectAnimator.ofFloat(maskPaintView.weightChooserView, View.ALPHA, 0)); + } else if (currentEditMode == EDIT_MODE_COVER) { + coverEditor.setVisibility(View.VISIBLE); + animators.add(ObjectAnimator.ofFloat(coverEditor, View.ALPHA, 1, 0)); } animators.add(ObjectAnimator.ofObject(navigationBar, "backgroundColor", new ArgbEvaluator(), navigationBarColorFrom, navigationBarColorTo)); imageMoveAnimation.playTogether(animators); @@ -11412,6 +11709,9 @@ public void onAnimationEnd(Animator animation) { maskPaintView = null; eraseBtn.setActive(false, true); restoreBtn.setActive(false, true); + } else if (currentEditMode == EDIT_MODE_COVER) { + coverEditor.setVisibility(View.GONE); + coverEditor.destroy(); } imageMoveAnimation = null; final int fromEditMode = currentEditMode; @@ -11473,9 +11773,9 @@ public void onAnimationEnd(Animator animation) { } else if (sendPhotoType == SELECT_TYPE_AVATAR) { arrayList.add(ObjectAnimator.ofFloat(photoCropView, View.ALPHA, 1)); } - if (muteItem.getTag() != null) { - muteItem.setVisibility(View.VISIBLE); - arrayList.add(ObjectAnimator.ofFloat(muteItem, View.ALPHA, 1)); + if (muteButton.getTag() != null) { + muteButton.setVisibility(View.VISIBLE); + arrayList.add(ObjectAnimator.ofFloat(muteButton, View.ALPHA, 1)); } if (navigationBar != null) { navigationBar.setVisibility(View.VISIBLE); @@ -11526,7 +11826,7 @@ public void onAnimationEnd(Animator animation) { previousCropMirrored = cropTransform.isMirrored(); photoCropView.onAppear(); - editorDoneLayout.doneButton.setText(getString("Crop", R.string.Crop)); + editorDoneLayout.doneButton.setText(getString(R.string.Crop)); editorDoneLayout.doneButton.setTextColor(getThemedColor(Theme.key_chat_editMediaButton)); changeModeAnimation = new AnimatorSet(); @@ -11552,8 +11852,8 @@ public void onAnimationEnd(Animator animation) { if (selectedPhotosListView.getVisibility() == View.VISIBLE) { arrayList.add(ObjectAnimator.ofFloat(selectedPhotosListView, View.ALPHA, 1, 0)); } - if (muteItem.getTag() != null) { - arrayList.add(ObjectAnimator.ofFloat(muteItem, View.ALPHA, 1, 0)); + if (muteButton.getTag() != null) { + arrayList.add(ObjectAnimator.ofFloat(muteButton, View.ALPHA, 1, 0)); } if (navigationBar != null) { arrayList.add(ObjectAnimator.ofFloat(navigationBar, View.ALPHA, 1)); @@ -11567,7 +11867,7 @@ public void onAnimationEnd(Animator animation) { pickerView.setVisibility(View.GONE); pickerViewSendButton.setVisibility(View.GONE); doneButtonFullWidth.setVisibility(View.GONE); - muteItem.setVisibility(View.GONE); + muteButton.setVisibility(View.GONE); selectedPhotosListView.setVisibility(View.GONE); selectedPhotosListView.setAlpha(0.0f); selectedPhotosListView.setTranslationY(-dp(10)); @@ -11749,8 +12049,8 @@ public void onAnimationEnd(Animator animation) { if (selectedPhotosListView.getVisibility() == View.VISIBLE) { arrayList.add(ObjectAnimator.ofFloat(selectedPhotosListView, View.ALPHA, 1, 0)); } - if (muteItem.getTag() != null) { - arrayList.add(ObjectAnimator.ofFloat(muteItem, View.ALPHA, 1, 0)); + if (muteButton.getTag() != null) { + arrayList.add(ObjectAnimator.ofFloat(muteButton, View.ALPHA, 1, 0)); } arrayList.add(ObjectAnimator.ofObject(navigationBar, "backgroundColor", new ArgbEvaluator(), navigationBarColorFrom, navigationBarColorTo)); changeModeAnimation.playTogether(arrayList); @@ -11763,7 +12063,7 @@ public void onAnimationEnd(Animator animation) { pickerViewSendButton.setVisibility(View.GONE); doneButtonFullWidth.setVisibility(View.GONE); actionBar.setVisibility(View.GONE); - muteItem.setVisibility(View.GONE); + muteButton.setVisibility(View.GONE); if (photoCropView != null) { photoCropView.setVisibility(View.INVISIBLE); } @@ -11880,8 +12180,11 @@ public void onAnimationEnd(Animator animation) { if (selectedPhotosListView.getVisibility() == View.VISIBLE) { arrayList.add(ObjectAnimator.ofFloat(selectedPhotosListView, View.ALPHA, 1, 0)); } - if (muteItem.getTag() != null) { - arrayList.add(ObjectAnimator.ofFloat(muteItem, View.ALPHA, 1, 0)); + if (muteButton.getTag() != null) { + arrayList.add(ObjectAnimator.ofFloat(muteButton, View.ALPHA, 1, 0)); + if (editCoverButton != null) { + arrayList.add(ObjectAnimator.ofFloat(editCoverButton, View.ALPHA, 1, 0)); + } } changeModeAnimation.playTogether(arrayList); changeModeAnimation.setDuration(200); @@ -11920,8 +12223,11 @@ public void onAnimationEnd(Animator animation) { if (selectedPhotosListView.getVisibility() == View.VISIBLE) { arrayList.add(ObjectAnimator.ofFloat(selectedPhotosListView, View.ALPHA, 1, 0)); } - if (muteItem.getTag() != null) { - arrayList.add(ObjectAnimator.ofFloat(muteItem, View.ALPHA, 1, 0)); + if (muteButton.getTag() != null) { + arrayList.add(ObjectAnimator.ofFloat(muteButton, View.ALPHA, 1, 0)); + if (editCoverButton != null) { + arrayList.add(ObjectAnimator.ofFloat(editCoverButton, View.ALPHA, 1, 0)); + } } changeModeAnimation.playTogether(arrayList); changeModeAnimation.setDuration(200); @@ -11935,6 +12241,48 @@ public void onAnimationEnd(Animator animation) { } }); changeModeAnimation.start(); + } else if (mode == EDIT_MODE_COVER) { + if (coverEditor.button.isLoading() || currentIndex < 0 || currentIndex >= imagesArrLocals.size() || !(imagesArrLocals.get(currentIndex) instanceof MediaController.PhotoEntry)) { + return; + } + final MediaController.PhotoEntry entry = (MediaController.PhotoEntry) imagesArrLocals.get(currentIndex); + changeModeAnimation = new AnimatorSet(); + ArrayList arrayList = new ArrayList<>(); + arrayList.add(ObjectAnimator.ofFloat(pickerView, View.TRANSLATION_Y, pickerView.getHeight() + captionEdit.getEditTextHeight() + (isCurrentVideo ? dp(58) : 0))); + arrayList.add(ObjectAnimator.ofFloat(pickerView, View.ALPHA, 0)); + arrayList.add(ObjectAnimator.ofFloat(pickerViewSendButton, View.TRANSLATION_Y, dp(isCurrentVideo ? 154 : 96))); + arrayList.add(ObjectAnimator.ofFloat(actionBar, View.TRANSLATION_Y, -actionBar.getHeight())); + arrayList.add(ObjectAnimator.ofObject(navigationBar, "backgroundColor", new ArgbEvaluator(), navigationBarColorFrom, navigationBarColorTo)); + if (sendPhotoType == 0 || sendPhotoType == 4) { + arrayList.add(ObjectAnimator.ofFloat(checkImageView, View.ALPHA, 1, 0)); + arrayList.add(ObjectAnimator.ofFloat(photosCounterView, View.ALPHA, 1, 0)); + } else if (sendPhotoType == SELECT_TYPE_AVATAR) { + arrayList.add(ObjectAnimator.ofFloat(photoCropView, View.ALPHA, 1, 0)); + } + if (selectedPhotosListView.getVisibility() == View.VISIBLE) { + arrayList.add(ObjectAnimator.ofFloat(selectedPhotosListView, View.ALPHA, 1, 0)); + } + if (muteButton.getTag() != null) { + arrayList.add(ObjectAnimator.ofFloat(muteButton, View.ALPHA, 1, 0)); + if (editCoverButton != null) { + arrayList.add(ObjectAnimator.ofFloat(editCoverButton, View.ALPHA, 1, 0)); + } + } + coverEditor.setVisibility(View.VISIBLE); + arrayList.add(ObjectAnimator.ofFloat(coverEditor, View.ALPHA, 0, 1)); + changeModeAnimation.playTogether(arrayList); + changeModeAnimation.setDuration(200); + changeModeAnimation.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + currentEditMode = mode; + changeModeAnimation = null; + switchingToMode = -1; + } + }); + changeModeAnimation.start(); + pauseVideoOrWeb(); + coverEditor.set(entry, videoPlayer, resourcesProvider); } if (containerView != null) { @@ -12169,7 +12517,7 @@ private void switchToPaintMode() { pickerView.setVisibility(View.GONE); pickerViewSendButton.setVisibility(View.GONE); doneButtonFullWidth.setVisibility(View.GONE); - muteItem.setVisibility(View.GONE); + muteButton.setVisibility(View.GONE); if (photoCropView != null) { photoCropView.setVisibility(View.INVISIBLE); } @@ -12286,6 +12634,21 @@ public void onAnimationEnd(Animator animation) { imageMoveAnimation.start(); } + private void toggleOnlyCheckImageView(boolean show) { + final AnimatorSet animatorSet = new AnimatorSet(); + final ArrayList arrayList = new ArrayList<>(); + final float offsetY = dpf2(24); + if (sendPhotoType == 0 || sendPhotoType == 4) { + arrayList.add(ObjectAnimator.ofFloat(checkImageView, View.ALPHA, show ? 1.0f : 0.0f)); + arrayList.add(ObjectAnimator.ofFloat(checkImageView, View.TRANSLATION_Y, show ? 0.0f : -offsetY)); + arrayList.add(ObjectAnimator.ofFloat(photosCounterView, View.ALPHA, show ? 1.0f : 0.0f)); + arrayList.add(ObjectAnimator.ofFloat(photosCounterView, View.TRANSLATION_Y, show ? 0.0f : -offsetY)); + } + animatorSet.playTogether(arrayList); + animatorSet.setDuration(200); + animatorSet.start(); + } + private void toggleCheckImageView(boolean show) { AnimatorSet animatorSet = new AnimatorSet(); ArrayList arrayList = new ArrayList<>(); @@ -12471,14 +12834,14 @@ private void toggleActionBar(boolean show, final boolean animated, @NonNull fina Bulletin.hide(containerView); } - final float offsetY = AndroidUtilities.dpf2(24); + final float offsetY = dpf2(24); videoPlayerControlFrameLayout.setSeekBarTransitionEnabled(params.enableTranslationAnimation && playerLooping); videoPlayerControlFrameLayout.setTranslationYAnimationEnabled(params.enableTranslationAnimation); if (animated) { ArrayList arrayList = new ArrayList<>(); - arrayList.add(ObjectAnimator.ofFloat(actionBar, View.ALPHA, show ? 1.0f : 0.0f)); + arrayList.add(ObjectAnimator.ofFloat(actionBar, View.ALPHA, show && (getCaptionView() != topCaptionEdit || topCaptionEdit.keyboardNotifier.keyboardVisible()) ? 1.0f : 0.0f)); if (params.enableTranslationAnimation) { arrayList.add(ObjectAnimator.ofFloat(actionBar, View.TRANSLATION_Y, show ? 0 : -offsetY)); } else { @@ -12538,8 +12901,8 @@ private void toggleActionBar(boolean show, final boolean animated, @NonNull fina anim.addUpdateListener(a -> photoProgressViews[0].setIndexedAlpha(1, (float) a.getAnimatedValue(), false)); arrayList.add(anim); } - if (muteItem.getTag() != null) { - arrayList.add(ObjectAnimator.ofFloat(muteItem, View.ALPHA, show ? 1.0f : 0.0f)); + if (muteButton.getTag() != null) { + arrayList.add(ObjectAnimator.ofFloat(muteButton, View.ALPHA, show ? 1.0f : 0.0f)); } actionBarAnimator = new AnimatorSet(); actionBarAnimator.playTogether(arrayList); @@ -12571,7 +12934,7 @@ public void onAnimationCancel(Animator animation) { }); actionBarAnimator.start(); } else { - actionBar.setAlpha(show ? 1.0f : 0.0f); + actionBar.setAlpha(show && (getCaptionView() != topCaptionEdit || topCaptionEdit.keyboardNotifier.keyboardVisible()) ? 1.0f : 0.0f); if (fullscreenButton[0].getTranslationX() != 0) { if (allowShowFullscreenButton) { fullscreenButton[0].setAlpha(show ? 1.0f : 0.0f); @@ -12595,8 +12958,8 @@ public void onAnimationCancel(Animator animation) { captionScrollView.setTranslationY(show ? 0 : offsetY); } videoPlayerControlFrameLayout.setProgress(show ? 1.0f : 0.0f); - if (muteItem.getTag() != null) { - muteItem.setAlpha(show ? 1.0f : 0.0f); + if (muteButton.getTag() != null) { + muteButton.setAlpha(show ? 1.0f : 0.0f); } if (videoPlayerControlVisible && isPlaying) { photoProgressViews[0].setIndexedAlpha(1, show ? 1f : 0f, false); @@ -13142,14 +13505,12 @@ private void onPhotoShow(final MessageObject messageObject, final TLRPC.FileLoca showStickerMode(false, false); videoAvatarTooltip.setVisibility(View.GONE); compressItem.setVisibility(View.GONE); -// captionEditText.setVisibility(View.GONE); -// mentionListView.setVisibility(View.GONE); - AndroidUtilities.updateViewVisibilityAnimated(muteItem, false, 1f, false); + AndroidUtilities.updateViewVisibilityAnimated(muteButton, false, 1f, false); actionBarContainer.setSubtitle(null); setItemVisible(masksItem, false, true); muteVideo = false; - muteItem.setImageResource(R.drawable.video_send_unmute); + muteDrawable.setMuted(false, false); editorDoneLayout.setVisibility(View.GONE); captionTextViewSwitcher.setTag(null); captionTextViewSwitcher.setVisibility(View.INVISIBLE); @@ -13795,13 +14156,13 @@ private void setIsAboutToSwitchToIndex(int index, boolean init, boolean animated if (isEmbedVideo) { title = "YouTube"; } else if (newMessageObject.canPreviewDocument()) { - title = getString("AttachDocument", R.string.AttachDocument); + title = getString(R.string.AttachDocument); } else if (newMessageObject.isVideo()) { - title = getString("AttachVideo", R.string.AttachVideo); + title = getString(R.string.AttachVideo); } else if (newMessageObject.isGif()) { - title = getString("AttachGif", R.string.AttachGif); + title = getString(R.string.AttachGif); } else { - title = getString("AttachPhoto", R.string.AttachPhoto); + title = getString(R.string.AttachPhoto); } } else if (isInvoice) { if (countView != null) { @@ -13911,7 +14272,7 @@ private void setIsAboutToSwitchToIndex(int index, boolean init, boolean animated if (customTitle != null) { title = customTitle; } else if (isEvent) { - title = getString("AttachPhoto", R.string.AttachPhoto); + title = getString(R.string.AttachPhoto); } boolean noforwards = avatarsDialogId != 0 && MessagesController.getInstance(currentAccount).isChatNoForwards(-avatarsDialogId); if (noforwards) { @@ -13995,7 +14356,7 @@ private void setIsAboutToSwitchToIndex(int index, boolean init, boolean animated rotateItem.setTag(null); mirrorItem.setVisibility(View.GONE); mirrorItem.setTag(null); - AndroidUtilities.updateViewVisibilityAnimated(muteItem, false, 1f, animated); + AndroidUtilities.updateViewVisibilityAnimated(muteButton, false, 1f, animated); compressItem.setVisibility(View.GONE); } else { showVideoTimeline(true, animated); @@ -14007,7 +14368,7 @@ private void setIsAboutToSwitchToIndex(int index, boolean init, boolean animated rotateItem.setTag(null); mirrorItem.setVisibility(View.GONE); mirrorItem.setTag(null); - AndroidUtilities.updateViewVisibilityAnimated(muteItem, true, 1f, animated); + AndroidUtilities.updateViewVisibilityAnimated(muteButton, true, 1f, animated); compressItem.setVisibility(View.VISIBLE); } else { videoAvatarTooltip.setVisibility(View.VISIBLE); @@ -14017,7 +14378,7 @@ private void setIsAboutToSwitchToIndex(int index, boolean init, boolean animated rotateItem.setTag(1); mirrorItem.setVisibility(View.VISIBLE); mirrorItem.setTag(1); - AndroidUtilities.updateViewVisibilityAnimated(muteItem, false, 1f, animated); + AndroidUtilities.updateViewVisibilityAnimated(muteButton, false, 1f, animated); compressItem.setVisibility(View.GONE); } tuneItem.setVisibility(View.VISIBLE); @@ -14029,7 +14390,7 @@ private void setIsAboutToSwitchToIndex(int index, boolean init, boolean animated } else { showVideoTimeline(false, animated); videoAvatarTooltip.setVisibility(View.GONE); - AndroidUtilities.updateViewVisibilityAnimated(muteItem, false, 1f, animated); + AndroidUtilities.updateViewVisibilityAnimated(muteButton, false, 1f, animated); if (isCurrentVideo) { animateCaption = false; } @@ -14094,9 +14455,9 @@ private void setIsAboutToSwitchToIndex(int index, boolean init, boolean animated } if (fromCamera) { if (isVideo) { - title = getString("AttachVideo", R.string.AttachVideo); + title = getString(R.string.AttachVideo); } else { - title = getString("AttachPhoto", R.string.AttachPhoto); + title = getString(R.string.AttachPhoto); } } if (parentChatActivity != null) { @@ -14191,13 +14552,13 @@ private void setIsAboutToSwitchToIndex(int index, boolean init, boolean animated menuItem.hideSubItem(gallery_menu_savegif); } menuItem.checkHideMenuItem(); - title = getString("AttachGif", R.string.AttachGif); + title = getString(R.string.AttachGif); } else { if (size == 1) { if (isVideo) { - title = getString("AttachVideo", R.string.AttachVideo); + title = getString(R.string.AttachVideo); } else { - title = getString("AttachPhoto", R.string.AttachPhoto); + title = getString(R.string.AttachPhoto); } } galleryButton.setVisibility(View.VISIBLE); @@ -14254,7 +14615,7 @@ private CharSequence postProcessTranslated(MessageObject messageObject) { return ""; } CharSequence message = new SpannableStringBuilder(messageObject.messageOwner.translatedText.text); - message = Emoji.replaceEmoji(message, Theme.chat_msgTextPaint.getFontMetricsInt(), dp(20), false); + message = Emoji.replaceEmoji(message, Theme.chat_msgTextPaint.getFontMetricsInt(), false); message = MessageObject.replaceAnimatedEmoji(message, messageObject.messageOwner.translatedText.entities, Theme.chat_msgTextPaint.getFontMetricsInt(), false); if (MessageObject.containsUrls(message)) { try { @@ -14488,7 +14849,7 @@ private void showEditCaption(View view, boolean show, boolean animated, float[] if (videoTimelineViewContainer != null) { videoTimelineViewContainer.setTranslationY(pickerView.getTranslationY() - Math.max(0, captionEdit.getEditTextHeight() - dp(46)) * captionEdit.getAlpha()); } - muteItem.setTranslationY(-Math.max(0, captionEdit.getEditTextHeight() - dp(46)) * captionEdit.getAlpha()); + muteButton.setTranslationY(-Math.max(0, captionEdit.getEditTextHeight() - dp(46)) * captionEdit.getAlpha()); } invalidateBlur(); }) @@ -14504,7 +14865,7 @@ private void showEditCaption(View view, boolean show, boolean animated, float[] if (videoTimelineViewContainer != null) { videoTimelineViewContainer.setTranslationY(pickerView.getTranslationY() - Math.max(0, captionEdit.getEditTextHeight() - dp(46)) * captionEdit.getAlpha()); } - muteItem.setTranslationY(-Math.max(0, captionEdit.getEditTextHeight() - dp(46)) * captionEdit.getAlpha()); + muteButton.setTranslationY(-Math.max(0, captionEdit.getEditTextHeight() - dp(46)) * captionEdit.getAlpha()); } invalidateBlur(); }) @@ -14578,7 +14939,11 @@ private void setImageIndex(int index) { } private void setImageIndex(int index, boolean init, boolean animateCaption) { - if (currentIndex == index || placeProvider == null) { + setImageIndex(index, init, animateCaption, false); + } + + private void setImageIndex(int index, boolean init, boolean animateCaption, boolean force) { + if (!force && currentIndex == index || placeProvider == null) { return; } if (!init) { @@ -14618,6 +14983,9 @@ private void setImageIndex(int index, boolean init, boolean animateCaption) { newMessageObject.putInDownloadsStore = currentMessageObject.putInDownloadsStore; } currentMessageObject = newMessageObject; + if (newMessageObject != null) { + newMessageObject.openedInViewer = true; + } isVideo = newMessageObject.isVideo(); if (newMessageObject.isSponsored()) { AndroidUtilities.cancelRunOnUIThread(hideActionBarRunnable); @@ -14785,7 +15153,7 @@ private void setImageIndex(int index, boolean init, boolean animateCaption) { showAfterAnimation = currentPlaceObject; } } - currentPlaceObject = placeProvider.getPlaceForPhoto(currentMessageObject, getFileLocation(currentFileLocation), currentIndex, false); + currentPlaceObject = placeProvider.getPlaceForPhoto(currentMessageObject, getFileLocation(currentFileLocation), currentIndex, false, false); if (currentPlaceObject != null) { if (animationInProgress == 0) { currentPlaceObject.imageReceiver.setVisible(false, true); @@ -14851,7 +15219,7 @@ private void setImageIndex(int index, boolean init, boolean animateCaption) { centerImageIsVideo = isVideo; - if (prevIndex == -1) { + if (prevIndex == -1 || force) { setImages(); for (int a = 0; a < 3; a++) { checkProgress(a, false, false); @@ -15233,9 +15601,9 @@ public void onAnimationEnd(Animator animation) { if (messageObject.isVideo()) { MessageObject.addUrlsByPattern(messageObject.isOutOwner(), spannableString, false, 3, (int) messageObject.getDuration(), false); } - str = Emoji.replaceEmoji(spannableString, captionTextView.getPaint().getFontMetricsInt(), dp(20), false); + str = Emoji.replaceEmoji(spannableString, captionTextView.getPaint().getFontMetricsInt(), false); } else { - str = Emoji.replaceEmoji(new SpannableStringBuilder(caption), captionTextView.getPaint().getFontMetricsInt(), dp(20), false); + str = Emoji.replaceEmoji(new SpannableStringBuilder(caption), captionTextView.getPaint().getFontMetricsInt(), false); } if (messageObject != null && messageObject.isSponsored()) { str = sponsoredCaption(messageObject, str); @@ -15917,7 +16285,7 @@ public void checkCurrentImageVisibility() { if (currentPlaceObject != null) { currentPlaceObject.imageReceiver.setVisible(true, true); } - currentPlaceObject = placeProvider == null ? null : placeProvider.getPlaceForPhoto(currentMessageObject, getFileLocation(currentFileLocation), currentIndex, false); + currentPlaceObject = placeProvider == null ? null : placeProvider.getPlaceForPhoto(currentMessageObject, getFileLocation(currentFileLocation), currentIndex, false, false); if (currentPlaceObject != null) { currentPlaceObject.imageReceiver.setVisible(false, true); } @@ -16088,8 +16456,8 @@ private void openCurrentPhotoInPaintModeForSelect() { private final ImageReceiver.BitmapHolder thumbHolder = centerImage.getBitmapSafe(); @Override - public PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { - return chatPhotoProvider != null ? chatPhotoProvider.getPlaceForPhoto(finalMessageObject, null, 0, needPreview) : null; + public PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview, boolean closing) { + return chatPhotoProvider != null ? chatPhotoProvider.getPlaceForPhoto(finalMessageObject, null, 0, needPreview, false) : null; } @Override @@ -16243,7 +16611,7 @@ public boolean openPhoto(final MessageObject messageObject, final TLRPC.FileLoca return false; } - final PlaceProviderObject object = provider.getPlaceForPhoto(messageObject, fileLocation, index, true); + final PlaceProviderObject object = provider.getPlaceForPhoto(messageObject, fileLocation, index, true, false); if (Build.VERSION.SDK_INT < 21) { insets.top = AndroidUtilities.statusBarHeight; insets.bottom = AndroidUtilities.navigationBarHeight; @@ -16270,9 +16638,10 @@ public boolean openPhoto(final MessageObject messageObject, final TLRPC.FileLoca windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; } if (chatActivity != null && chatActivity.getCurrentEncryptedChat() != null || - avatarsDialogId != 0 && MessagesController.getInstance(currentAccount).isChatNoForwards(-avatarsDialogId) || - messageObject != null && (MessagesController.getInstance(currentAccount).isChatNoForwards(messageObject.getChatId()) || - (messageObject.messageOwner != null && messageObject.messageOwner.noforwards)) || messageObject != null && messageObject.hasRevealedExtendedMedia()) { + avatarsDialogId != 0 && MessagesController.getInstance(currentAccount).isChatNoForwards(-avatarsDialogId) || + messageObject != null && (MessagesController.getInstance(currentAccount).isChatNoForwards(messageObject.getChatId()) || + (messageObject.messageOwner != null && messageObject.messageOwner.noforwards)) || messageObject != null && messageObject.hasRevealedExtendedMedia() + ) { windowLayoutParams.flags |= WindowManager.LayoutParams.FLAG_SECURE; } else { windowLayoutParams.flags &=~ WindowManager.LayoutParams.FLAG_SECURE; @@ -16290,11 +16659,15 @@ public boolean openPhoto(final MessageObject messageObject, final TLRPC.FileLoca hasCaptionForAllMedia = false; doneButtonPressed = false; closePhotoAfterSelect = true; + closePhotoAfterSelectWithAnimation = false; allowShowFullscreenButton = true; usedSurfaceView = false; parentChatActivity = chatActivity; lastTitle = null; isEmbedVideo = embedSeekTime != null; + if (editCoverButton != null) { + editCoverButton.setImage(null); + } actionBarContainer.setTitle(""); actionBarContainer.setSubtitle("", false); @@ -16315,6 +16688,8 @@ public boolean openPhoto(final MessageObject messageObject, final TLRPC.FileLoca NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiLoaded); NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.filePreparingFailed); NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.fileNewChunkAvailable); + NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.replaceMessagesObjects); + NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.dialogDeleted); placeProvider = provider; mergeDialogId = mDialogId; @@ -16968,15 +17343,65 @@ public void closePhoto(boolean animated, boolean fromEditMode) { if (placeProvider != null) { placeProvider.onReleasePlayerBeforeClose(currentIndex); } - final PlaceProviderObject object = placeProvider.getPlaceForPhoto(currentMessageObject, getFileLocation(currentFileLocation), currentIndex, true); + final boolean[] allowStart = new boolean[] { true }; + final Runnable[] start = new Runnable[1]; + final PlaceProviderObject object = placeProvider == null ? null : placeProvider.getPlaceForPhoto(currentMessageObject, getFileLocation(currentFileLocation), currentIndex, true, true); if (videoPlayer != null && object != null) { AnimatedFileDrawable animation = object.imageReceiver.getAnimation(); if (animation != null) { + final long startTime = animation.getStartTime(); + final long seekTo = videoPlayer.getCurrentPosition() + (startTime > 0 ? startTime : 0); + final TLRPC.Document document = videoPlayer.getCurrentDocument() == null ? (currentMessageObject != null ? currentMessageObject.getDocument() : null) : videoPlayer.getCurrentDocument(); + boolean doSeek = true; + final Runnable seek = () -> { + if (animation != null && document != null) { + animation.seekTo(seekTo, !FileLoader.getInstance(currentAccount).isLoadingVideo(document, true)); + } + if (object != null && object.imageReceiver != null) { + object.imageReceiver.setAllowStartAnimation(true); + object.imageReceiver.startAnimation(); + } + }; if (textureUploaded) { Bitmap bitmap = animation.getAnimatedBitmap(); if (bitmap != null) { if (usedSurfaceView) { AndroidUtilities.getBitmapFromSurface(videoSurfaceView, bitmap); +// doSeek = false; +// object.imageReceiver.stopAnimation(); +// Bitmap toBitmap = Bitmap.createBitmap(bitmap); +// final boolean[] started = new boolean[1]; +// allowStart[0] = false; +// final long startTime2 = System.currentTimeMillis(); +// AndroidUtilities.getBitmapFromSurface(videoSurfaceView, toBitmap, () -> { +// Log.i("lolkek", "getBitmapFromSurface took " + (System.currentTimeMillis() - startTime2)); +// if (animation != null) { +// animation.replaceAnimatedBitmap(toBitmap); +// animation.invalidateInternal(); +// containerView.invalidate(); +// } +// if (!started[0]) { +// seek.run(); +// started[0] = true; +// if (start[0] != null) { +// start[0].run(); +// } else { +// allowStart[0] = true; +// } +// } +// }); +// AndroidUtilities.runOnUIThread(() -> { +// if (!started[0]) { +// seek.run(); +// started[0] = true; +// Log.i("lolkek", "didn't getBitmapFromSurface in time"); +// if (start[0] != null) { +// start[0].run(); +// } else { +// allowStart[0] = true; +// } +// } +// }, 600); } else { try { Bitmap src = videoTextureView.getBitmap(bitmap.getWidth(), bitmap.getHeight()); @@ -16989,18 +17414,11 @@ public void closePhoto(boolean animated, boolean fromEditMode) { } } } - if (currentMessageObject != null) { - long startTime = animation.getStartTime(); - long seekTo = videoPlayer.getCurrentPosition() + (startTime > 0 ? startTime : 0); - animation.seekTo(seekTo, !FileLoader.getInstance(currentMessageObject.currentAccount).isLoadingVideo(currentMessageObject.getDocument(), true)); + if (doSeek) { + seek.run(); } - object.imageReceiver.setAllowStartAnimation(true); - object.imageReceiver.startAnimation(); } } - if (!doneButtonPressed) { - releasePlayer(true); - } if (photoViewerWebView != null) { photoViewerWebView.release(); containerView.removeView(photoViewerWebView); @@ -17026,6 +17444,9 @@ public void closePhoto(boolean animated, boolean fromEditMode) { onPhotoClosed(object); containerView.setScaleX(1.0f); containerView.setScaleY(1.0f); + if (!doneButtonPressed) { + releasePlayer(true); + } } else { if (animated) { final ClippingImageView[] animatingImageViews = getAnimatingImageViews(object); @@ -17035,10 +17456,7 @@ public void closePhoto(boolean animated, boolean fromEditMode) { animatingImageViews[i].setVisibility(View.VISIBLE); } - animationInProgress = 3; - containerView.invalidate(); - - AnimatorSet animatorSet = new AnimatorSet(); + final AnimatorSet animatorSet = new AnimatorSet(); final ViewGroup.LayoutParams layoutParams = animatingImageView.getLayoutParams(); RectF drawRegion = null; @@ -17105,7 +17523,6 @@ public void closePhoto(boolean animated, boolean fromEditMode) { } if (object != null) { - object.imageReceiver.setVisible(false, true); int clipHorizontal = (int) Math.abs(drawRegion.left - object.imageReceiver.getImageX()); int clipVertical = (int) Math.abs(drawRegion.top - object.imageReceiver.getImageY()); @@ -17222,9 +17639,22 @@ public void onAnimationEnd(Animator animation) { }); } }); - transitionAnimationStartTime = System.currentTimeMillis(); - containerView.setLayerType(View.LAYER_TYPE_HARDWARE, null); - animatorSet.start(); + start[0] = () -> { + if (object != null) { + object.imageReceiver.setVisible(false, true); + } + if (!doneButtonPressed) { + releasePlayer(true); + } + animationInProgress = 3; + containerView.invalidate(); + transitionAnimationStartTime = System.currentTimeMillis(); + containerView.setLayerType(View.LAYER_TYPE_HARDWARE, null); + animatorSet.start(); + }; + if (allowStart[0]) { + start[0].run(); + } } else { AnimatorSet animatorSet = new AnimatorSet(); ValueAnimator progressAnimator = ValueAnimator.ofFloat(0, 1); @@ -17240,7 +17670,6 @@ public void onAnimationEnd(Animator animation) { if (placeProvider != null) { placeProvider.onPreClose(); } - animationInProgress = 2; animationEndRunnable = () -> { animationEndRunnable = null; if (containerView == null) { @@ -17283,11 +17712,20 @@ public void onAnimationEnd(Animator animation) { } } }); - transitionAnimationStartTime = System.currentTimeMillis(); - containerView.setLayerType(View.LAYER_TYPE_HARDWARE, null); - animatorSet.start(); - if (object != null) { - object.imageReceiver.setVisible(true, true); + start[0] = () -> { + if (!doneButtonPressed) { + releasePlayer(true); + } + animationInProgress = 2; + transitionAnimationStartTime = System.currentTimeMillis(); + containerView.setLayerType(View.LAYER_TYPE_HARDWARE, null); + animatorSet.start(); + if (object != null) { + object.imageReceiver.setVisible(true, true); + } + }; + if (allowStart[0]) { + start[0].run(); } } if (currentAnimation != null) { @@ -17336,6 +17774,8 @@ private void removeObservers() { NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiLoaded); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.filePreparingFailed); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.fileNewChunkAvailable); + NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.replaceMessagesObjects); + NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.dialogDeleted); ConnectionsManager.getInstance(currentAccount).cancelRequestsForGuid(classGuid); } @@ -17541,7 +17981,7 @@ private void updateMinMax(float scale) { private int getAdditionX(int mode) { if (mode == EDIT_MODE_CROP || mode == EDIT_MODE_NONE && sendPhotoType == SELECT_TYPE_AVATAR) { return dp(16); - } else if (mode != EDIT_MODE_NONE && mode != EDIT_MODE_STICKER_MASK && mode != EDIT_MODE_PAINT) { + } else if (mode != EDIT_MODE_NONE && mode != EDIT_MODE_COVER && mode != EDIT_MODE_STICKER_MASK && mode != EDIT_MODE_PAINT) { return dp(14); } return 0; @@ -17554,7 +17994,7 @@ private int getAdditionY(int mode) { return dp(16) + (isStatusBarVisible() ? AndroidUtilities.statusBarHeight : 0); } else if (mode == EDIT_MODE_PAINT && photoPaintView != null) { return dp(8) + (isStatusBarVisible() ? AndroidUtilities.statusBarHeight : 0) + photoPaintView.getAdditionalTop(); - } else if (mode != EDIT_MODE_NONE && mode != EDIT_MODE_STICKER_MASK) { + } else if (mode != EDIT_MODE_NONE && mode != EDIT_MODE_STICKER_MASK && mode != EDIT_MODE_COVER) { return dp(14) + (isStatusBarVisible() ? AndroidUtilities.statusBarHeight : 0); } return 0; @@ -17568,7 +18008,7 @@ private int getContainerViewWidth(int mode) { int width = containerView.getWidth(); if (mode == EDIT_MODE_CROP || mode == EDIT_MODE_NONE && sendPhotoType == SELECT_TYPE_AVATAR) { width -= dp(32); - } else if (mode != EDIT_MODE_NONE && mode != EDIT_MODE_STICKER_MASK && mode != EDIT_MODE_PAINT) { + } else if (mode != EDIT_MODE_NONE && mode != EDIT_MODE_STICKER_MASK && mode != EDIT_MODE_COVER && mode != EDIT_MODE_PAINT) { width -= dp(28); } return width; @@ -17588,7 +18028,7 @@ private int getContainerViewHeight(boolean trueHeight, int mode) { height = containerView.getMeasuredHeight(); } else { height = AndroidUtilities.displaySize.y; - if ((mode == EDIT_MODE_NONE || mode == EDIT_MODE_STICKER_MASK) && sendPhotoType != SELECT_TYPE_AVATAR && isStatusBarVisible()) { + if ((mode == EDIT_MODE_NONE || mode == EDIT_MODE_STICKER_MASK || mode == EDIT_MODE_COVER) && sendPhotoType != SELECT_TYPE_AVATAR && isStatusBarVisible()) { height += AndroidUtilities.statusBarHeight; } } @@ -18259,6 +18699,10 @@ private void onDraw(Canvas canvas) { canvas.translate(getLeftInset() / 2 - getRightInset() / 2, 0); } + currentCropScale = 1.0f; + currentCropX = 0.0f; + currentCropY = 0.0f; + float currentTranslationY; float currentTranslationX; float currentScale; @@ -18695,9 +19139,10 @@ public void onAnimationEnd(Animator animation) { canvas.translate(cropTransform.getCropAreaX() * cropAnimationValue, cropTransform.getCropAreaY() * cropAnimationValue); if (!centerImageTransformLocked) centerImageTransform.preTranslate(cropTransform.getCropAreaX() * cropAnimationValue, cropTransform.getCropAreaY() * cropAnimationValue); + currentCropScale = cropScale; canvas.scale(cropScale, cropScale); if (!centerImageTransformLocked) centerImageTransform.preScale(cropScale, cropScale); - canvas.translate(cropTransform.getCropPx() * rotatedWidth * scale * cropAnimationValue, cropTransform.getCropPy() * rotatedHeight * scale * cropAnimationValue); + canvas.translate(currentCropX = cropTransform.getCropPx() * rotatedWidth * scale * cropAnimationValue, currentCropY = cropTransform.getCropPy() * rotatedHeight * scale * cropAnimationValue); if (!centerImageTransformLocked) centerImageTransform.preTranslate(cropTransform.getCropPx() * rotatedWidth * scale * cropAnimationValue, cropTransform.getCropPy() * rotatedHeight * scale * cropAnimationValue); float rotation = (cropTransform.getRotation() + orientation); if (rotation > 180) { @@ -19057,7 +19502,7 @@ private void drawCenterImageInternal(Canvas canvas, float currentMirror, float a private void drawProgress(Canvas canvas, float translateX, float currentScale, float currentTranslationY, float alpha) { boolean drawProgress; if (isCurrentVideo) { - drawProgress = (videoTimelineView == null || !videoTimelineView.isDragging()) && (sendPhotoType != SELECT_TYPE_AVATAR || manuallyPaused) && (videoPlayer == null || !videoPlayer.isPlaying()); + drawProgress = (videoTimelineView == null || !videoTimelineView.isDragging()) && (sendPhotoType != SELECT_TYPE_AVATAR || manuallyPaused) && (videoPlayer == null || !videoPlayer.isPlaying()) && switchingToMode != EDIT_MODE_COVER && currentEditMode != EDIT_MODE_COVER; } else { drawProgress = true; } @@ -19072,7 +19517,7 @@ private void drawProgress(Canvas canvas, float translateX, float currentScale, f if (pipAnimationInProgress) { progressAlpha *= actionBar.getAlpha(); } else if (photoProgressViews[0].backgroundState == PROGRESS_PAUSE) { - ty += AndroidUtilities.dpf2(8) * (1f - actionBar.getAlpha()); + ty += dpf2(8) * (1f - actionBar.getAlpha()); } if (seekSpeedDrawable == null || !seekSpeedDrawable.isShown()) { canvas.save(); @@ -19774,8 +20219,8 @@ protected void onDraw(Canvas canvas) { if (a != 0) { int x = cx - circleSize / 2 - gapSize - lineSize; - float startPadding = a == (selectedCompression + 1) ? AndroidUtilities.dpf2(2) : 0; - float endPadding = a == selectedCompression ? AndroidUtilities.dpf2(2) : 0; + float startPadding = a == (selectedCompression + 1) ? dpf2(2) : 0; + float endPadding = a == selectedCompression ? dpf2(2) : 0; canvas.drawRect(x + startPadding, cy - dp(1), x + lineSize - endPadding, cy + dp(2), paint); } } @@ -19791,19 +20236,19 @@ public void updateMuteButton() { videoPlayer.setMute(muteVideo); } if (!videoConvertSupported) { - muteItem.setEnabled(false); - muteItem.setClickable(false); - muteItem.animate().alpha(0.5f).setDuration(180).start(); + muteButton.setEnabled(false); + muteButton.setClickable(false); + muteButton.animate().alpha(0.5f).setDuration(180).start(); videoTimelineView.setMode(VideoTimelinePlayView.MODE_VIDEO); } else { - muteItem.setEnabled(true); - muteItem.setClickable(true); - muteItem.animate().alpha(1f).setDuration(180).start(); + muteButton.setEnabled(true); + muteButton.setClickable(true); + muteButton.animate().alpha(1f).setDuration(180).start(); if (muteVideo) { if (customTitle == null) { actionBarContainer.setSubtitle(getString("SoundMuted", R.string.SoundMuted)); } - muteItem.setImageResource(R.drawable.video_send_mute); + muteDrawable.setMuted(true, true); if (compressItem.getTag() != null) { compressItem.setAlpha(0.5f); compressItem.setEnabled(false); @@ -19816,11 +20261,11 @@ public void updateMuteButton() { videoTimelineView.setMaxProgressDiff(1.0f); videoTimelineView.setMode(VideoTimelinePlayView.MODE_VIDEO); } - muteItem.setContentDescription(getString("NoSound", R.string.NoSound)); +// muteItem.setContentDescription(getString("NoSound", R.string.NoSound)); } else { actionBarContainer.setSubtitle(currentSubtitle); - muteItem.setImageResource(R.drawable.video_send_unmute); - muteItem.setContentDescription(getString("Sound", R.string.Sound)); + muteDrawable.setMuted(false, true); +// muteItem.setContentDescription(getString("Sound", R.string.Sound)); if (compressItem.getTag() != null) { compressItem.setAlpha(1.0f); compressItem.setEnabled(true); @@ -20165,8 +20610,8 @@ public void onAnimationCancel(Animator animation) { qualityChooseViewAnimation.setInterpolator(AndroidUtilities.accelerateInterpolator); qualityChooseViewAnimation.start(); - if (muteItem.getVisibility() == View.VISIBLE) { - muteItem.animate().scaleX(show ? 0.25f : 1f) + if (muteButton.getVisibility() == View.VISIBLE) { + muteButton.animate().scaleX(show ? 0.25f : 1f) .scaleY(show ? 0.25f : 1f) .alpha(show ? 0 : 1) .setDuration(200); @@ -20543,7 +20988,7 @@ public static boolean BLUR_RENDERNODE() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && SharedConfig.useNewBlur && SharedConfig.getDevicePerformanceClass() >= SharedConfig.PERFORMANCE_CLASS_HIGH && !AndroidUtilities.makingGlobalBlurBitmap; } - private void drawCaptionBlur(Canvas canvas, BlurringShader.StoryBlurDrawer drawer, int bgColor, int overlayColor, boolean clip, boolean allowTransparent, boolean allowCrossfade) { + public void drawCaptionBlur(Canvas canvas, BlurringShader.StoryBlurDrawer drawer, int bgColor, int overlayColor, boolean clip, boolean allowTransparent, boolean allowCrossfade) { if (BLUR_RENDERNODE()) { if (renderNode != null) { if (drawer.renderNode == null) { @@ -21740,6 +22185,11 @@ private void toggleCaptionAbove() { AndroidUtilities.removeFromParent(fromView.mentionContainer); fromView.mentionContainer = null; } + + actionBar.animate().alpha(isActionBarVisible && (getCaptionView() != topCaptionEdit || !topCaptionEdit.keyboardNotifier.keyboardVisible()) ? 1.0f : 0.0f).start(); + if (pickerView.getVisibility() == View.VISIBLE) { + toggleOnlyCheckImageView(isActionBarVisible && (getCaptionView() != topCaptionEdit || !topCaptionEdit.keyboardNotifier.keyboardVisible())); + } } if (MessagesController.getInstance(currentAccount).shouldShowMoveCaptionHint()) { MessagesController.getInstance(currentAccount).incrementMoveCaptionHint(); @@ -21752,5 +22202,52 @@ private void toggleCaptionAbove() { .setImageScale(.8f) .show(!above); } + + if (captionEdit != null) { + captionEdit.closeKeyboard(); + } + } + + public static float getSavedProgressFast(MessageObject msg) { + final int duration = (int) msg.getDuration(); + final String name = msg.isEmbedVideo() ? msg.messageOwner.media.webpage.url : msg.getFileNameFast(); + if (!TextUtils.isEmpty(name)) { + if (duration >= 10 && Instance != null) { + final SavedVideoPosition videoPosition = Instance.savedVideoPositions.get(name); + if (msg != null && msg.forceSeekTo < 0 && videoPosition != null) { + float pos = videoPosition.position; + if (pos > 0 && pos < 0.999f) { + return pos; + } + } + } + } + return 0; + } + + public static float getSavedProgress(MessageObject msg) { + final int duration = (int) msg.getDuration(); + final String name = msg.isEmbedVideo() ? msg.messageOwner.media.webpage.url : msg.getFileNameFast(); + if (!TextUtils.isEmpty(name)) { + if (duration >= 10 && Instance != null) { + SavedVideoPosition videoPosition = Instance.savedVideoPositions.get(name); + if (msg != null && msg.forceSeekTo < 0 && videoPosition != null) { + float pos = videoPosition.position; + if (pos > 0 && pos < 0.999f) { + return pos; + } + } + } + if (duration >= 2 * 60) { + if (msg.forceSeekTo < 0) { + SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("media_saved_pos", Activity.MODE_PRIVATE); + float pos = preferences.getFloat(name, -1); + if (pos > 0 && pos < 0.999f) { + return pos; + } + } + } + } + return 0; } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PollCreateActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PollCreateActivity.java index ba4587df9f..eb43a71b35 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PollCreateActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PollCreateActivity.java @@ -1203,7 +1203,7 @@ public void onEmojiSelected(String symbol) { i = 0; } try { - CharSequence localCharSequence = Emoji.replaceEmoji(symbol, editText.getPaint().getFontMetricsInt(), AndroidUtilities.dp(18), false); + CharSequence localCharSequence = Emoji.replaceEmoji(symbol, editText.getPaint().getFontMetricsInt(), false); editText.setText(editText.getText().insert(i, localCharSequence)); int j = i + localCharSequence.length(); editText.setSelection(j, j); @@ -1466,7 +1466,7 @@ public void afterTextChanged(Editable s) { for (ImageSpan span : spans) { s.removeSpan(span); } - Emoji.replaceEmoji(s, cell.getEditField().getPaint().getFontMetricsInt(), AndroidUtilities.dp(18), false); + Emoji.replaceEmoji(s, cell.getEditField().getPaint().getFontMetricsInt(), false); suggestEmojiPanel.setDirection(SuggestEmojiView.DIRECTION_TO_TOP); suggestEmojiPanel.setDelegate(cell); @@ -1536,7 +1536,7 @@ public void afterTextChanged(Editable s) { for (ImageSpan span : spans) { s.removeSpan(span); } - Emoji.replaceEmoji(s, cell.getEditField().getPaint().getFontMetricsInt(), AndroidUtilities.dp(18), false); + Emoji.replaceEmoji(s, cell.getEditField().getPaint().getFontMetricsInt(), false); suggestEmojiPanel.setDirection(SuggestEmojiView.DIRECTION_TO_TOP); suggestEmojiPanel.setDelegate(cell); @@ -1688,7 +1688,7 @@ public void afterTextChanged(Editable s) { for (ImageSpan span : spans) { s.removeSpan(span); } - Emoji.replaceEmoji(s, cell.getEditField().getPaint().getFontMetricsInt(), AndroidUtilities.dp(18), false); + Emoji.replaceEmoji(s, cell.getEditField().getPaint().getFontMetricsInt(), false); float y = holder.itemView.getY() - AndroidUtilities.dp(166) + holder.itemView.getMeasuredHeight(); if (y > 0) { suggestEmojiPanel.setDirection(SuggestEmojiView.DIRECTION_TO_BOTTOM); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PremiumPreviewFragment.java b/TMessagesProj/src/main/java/org/telegram/ui/PremiumPreviewFragment.java index 30bb7cfe3f..615a0019fd 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PremiumPreviewFragment.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PremiumPreviewFragment.java @@ -67,6 +67,8 @@ import org.telegram.messenger.browser.Browser; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; +import org.telegram.tgnet.tl.TL_stars; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.Theme; @@ -130,7 +132,7 @@ public class PremiumPreviewFragment extends BaseFragment implements Notification RecyclerListView listView; ArrayList premiumFeatures = new ArrayList<>(); ArrayList morePremiumFeatures = new ArrayList<>(); - ArrayList subscriptionTiers = new ArrayList<>(); + final ArrayList subscriptionTiers = new ArrayList<>(); int selectedTierIndex = 0; SubscriptionTier currentSubscriptionTier; @@ -756,7 +758,7 @@ public boolean onInterceptTouchEvent(MotionEvent ev) { cell.setChecked(!cell.isChecked()); userFull.sponsored_enabled = cell.isChecked(); - TLRPC.TL_account_toggleSponsoredMessages req = new TLRPC.TL_account_toggleSponsoredMessages(); + TL_account.toggleSponsoredMessages req = new TL_account.toggleSponsoredMessages(); req.enabled = userFull.sponsored_enabled; getConnectionsManager().sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { if (err != null) { @@ -792,16 +794,17 @@ public boolean onInterceptTouchEvent(MotionEvent ev) { presentFragment(new MediaActivity(args, null)); } else if (cell.data.type == PREMIUM_FEATURE_EMOJI_STATUS) { showSelectStatusDialog(cell, UserObject.getEmojiStatusDocumentId(getUserConfig().getCurrentUser()), (documentId, until) -> { - TLRPC.EmojiStatus emojiStatus; + final TLRPC.EmojiStatus emojiStatus; if (documentId == null) { emojiStatus = new TLRPC.TL_emojiStatusEmpty(); - } else if (until != null) { - emojiStatus = new TLRPC.TL_emojiStatusUntil(); - ((TLRPC.TL_emojiStatusUntil) emojiStatus).document_id = documentId; - ((TLRPC.TL_emojiStatusUntil) emojiStatus).until = until; } else { - emojiStatus = new TLRPC.TL_emojiStatus(); - ((TLRPC.TL_emojiStatus) emojiStatus).document_id = documentId; + final TLRPC.TL_emojiStatus status = new TLRPC.TL_emojiStatus(); + status.document_id = documentId; + if (until != null) { + status.flags |= 1; + status.until = until; + } + emojiStatus = status; } getMessagesController().updateEmojiStatus(emojiStatus); cell.setEmoji(documentId == null ? 0 : documentId, true); @@ -1089,8 +1092,7 @@ public static void buyPremium(BaseFragment fragment, SubscriptionTier tier, Stri if (fragment.getParentActivity() instanceof LaunchActivity) { try { fragment.getFragmentView().performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} ((LaunchActivity) fragment.getParentActivity()).getFireworksOverlay().start(); } }; @@ -1945,13 +1947,16 @@ public void onAnimationEnd(Animator animation) { } private void updateButtonText(boolean animated) { - if (premiumButtonView == null || getUserConfig().isPremium() && currentSubscriptionTier != null && subscriptionTiers.get(selectedTierIndex).getMonths() < currentSubscriptionTier.getMonths()) { + if (premiumButtonView == null) { + return; + } + if (getUserConfig().isPremium() && currentSubscriptionTier != null && selectedTierIndex < subscriptionTiers.size() && subscriptionTiers.get(selectedTierIndex).getMonths() < currentSubscriptionTier.getMonths()) { return; } if (LocaleController.isRTL) { animated = false; } - if (BuildVars.IS_BILLING_UNAVAILABLE) { + if (BuildVars.IS_BILLING_UNAVAILABLE && selectedTierIndex < subscriptionTiers.size()) { premiumButtonView.setButton(getPremiumButtonText(currentAccount, subscriptionTiers.get(selectedTierIndex)), v -> buyPremium(this), animated); return; } @@ -1960,7 +1965,7 @@ private void updateButtonText(boolean animated) { premiumButtonView.setFlickerDisabled(true); return; } - if (!subscriptionTiers.isEmpty()) { + if (!subscriptionTiers.isEmpty() && selectedTierIndex < subscriptionTiers.size()) { premiumButtonView.setButton(getPremiumButtonText(currentAccount, subscriptionTiers.get(selectedTierIndex)), v -> { SubscriptionTier tier = subscriptionTiers.get(selectedTierIndex); BillingFlowParams.SubscriptionUpdateParams updateParams = null; @@ -2350,7 +2355,7 @@ public void showSelectStatusDialog(PremiumFeatureCell cell, Long documentId, Uti int type = down ? SelectAnimatedEmojiDialog.TYPE_EMOJI_STATUS_TOP : SelectAnimatedEmojiDialog.TYPE_EMOJI_STATUS; SelectAnimatedEmojiDialog popupLayout = new SelectAnimatedEmojiDialog(PremiumPreviewFragment.this, getContext(), true, xoff, type, true, getResourceProvider(), down ? 24 : 16) { @Override - protected void onEmojiSelected(View emojiView, Long documentId, TLRPC.Document document, Integer until) { + protected void onEmojiSelected(View emojiView, Long documentId, TLRPC.Document document, TL_stars.TL_starGiftUnique gift, Integer until) { if (onSet != null) { onSet.run(documentId, until); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PrivacyControlActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PrivacyControlActivity.java index 74da5a9c96..1e451f18f8 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PrivacyControlActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PrivacyControlActivity.java @@ -54,6 +54,7 @@ import org.telegram.messenger.UserObject; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenu; import org.telegram.ui.ActionBar.AlertDialog; @@ -256,7 +257,7 @@ private void updateAvatarForRestInfo() { } @Override - public void didStartUpload(boolean isVideo) { + public void didStartUpload(boolean fromAvatarConstructor, boolean isVideo) { } @@ -719,7 +720,7 @@ private void updateDoneButton() { private void applyCurrentPrivacySettings() { if (rulesType == PRIVACY_RULES_TYPE_MESSAGES) { - TLRPC.TL_account_setGlobalPrivacySettings req2 = new TLRPC.TL_account_setGlobalPrivacySettings(); + TL_account.setGlobalPrivacySettings req2 = new TL_account.setGlobalPrivacySettings(); req2.settings = new TLRPC.TL_globalPrivacySettings(); TLRPC.TL_globalPrivacySettings settings = getContactsController().getGlobalPrivacySettings(); if (settings != null) { @@ -742,11 +743,11 @@ private void applyCurrentPrivacySettings() { })); return; } - TLRPC.TL_account_setPrivacy req = new TLRPC.TL_account_setPrivacy(); + TL_account.setPrivacy req = new TL_account.setPrivacy(); if (rulesType == PRIVACY_RULES_TYPE_PHONE) { req.key = new TLRPC.TL_inputPrivacyKeyPhoneNumber(); if (currentType == TYPE_NOBODY) { - TLRPC.TL_account_setPrivacy req2 = new TLRPC.TL_account_setPrivacy(); + TL_account.setPrivacy req2 = new TL_account.setPrivacy(); req2.key = new TLRPC.TL_inputPrivacyKeyAddedByPhone(); if (currentSubType == 0) { req2.rules.add(new TLRPC.TL_inputPrivacyValueAllowAll()); @@ -755,7 +756,7 @@ private void applyCurrentPrivacySettings() { } ConnectionsManager.getInstance(currentAccount).sendRequest(req2, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (error == null) { - TLRPC.TL_account_privacyRules privacyRules = (TLRPC.TL_account_privacyRules) response; + TL_account.privacyRules privacyRules = (TL_account.privacyRules) response; ContactsController.getInstance(currentAccount).setPrivacyRules(privacyRules.rules, PRIVACY_RULES_TYPE_ADDED_BY_PHONE); } }), ConnectionsManager.RequestFlagFailOnServerErrors); @@ -854,7 +855,7 @@ private void applyCurrentPrivacySettings() { FileLog.e(e); } if (error == null) { - TLRPC.TL_account_privacyRules privacyRules = (TLRPC.TL_account_privacyRules) response; + TL_account.privacyRules privacyRules = (TL_account.privacyRules) response; MessagesController.getInstance(currentAccount).putUsers(privacyRules.users, false); MessagesController.getInstance(currentAccount).putChats(privacyRules.chats, false); ContactsController.getInstance(currentAccount).setPrivacyRules(privacyRules.rules, rulesType); @@ -865,7 +866,7 @@ private void applyCurrentPrivacySettings() { }), ConnectionsManager.RequestFlagFailOnServerErrors); if (rulesType == PRIVACY_RULES_TYPE_LASTSEEN && selectedReadValue != currentReadValue) { - TLRPC.TL_account_setGlobalPrivacySettings req2 = new TLRPC.TL_account_setGlobalPrivacySettings(); + TL_account.setGlobalPrivacySettings req2 = new TL_account.setGlobalPrivacySettings(); req2.settings = new TLRPC.TL_globalPrivacySettings(); TLRPC.TL_globalPrivacySettings settings = getContactsController().getGlobalPrivacySettings(); req2.settings.archive_and_mute_new_noncontact_peers = settings.archive_and_mute_new_noncontact_peers; @@ -1474,11 +1475,11 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { } else if (position == setBirthdayRow) { privacyCell.setText(AndroidUtilities.replaceArrows(AndroidUtilities.replaceSingleTag(LocaleController.getString(R.string.PrivacyBirthdaySet), () -> { showDialog(AlertsCreator.createBirthdayPickerDialog(getContext(), getString(R.string.EditProfileBirthdayTitle), getString(R.string.EditProfileBirthdayButton), null, birthday -> { - TLRPC.TL_account_updateBirthday req = new TLRPC.TL_account_updateBirthday(); + TL_account.updateBirthday req = new TL_account.updateBirthday(); req.flags |= 1; req.birthday = birthday; TLRPC.UserFull userFull = getMessagesController().getUserFull(getUserConfig().getClientUserId()); - TLRPC.TL_birthday oldBirthday = userFull != null ? userFull.birthday : null; + TL_account.TL_birthday oldBirthday = userFull != null ? userFull.birthday : null; if (userFull != null) { userFull.flags2 |= 32; userFull.birthday = birthday; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PrivacySettingsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PrivacySettingsActivity.java index 1cb60841bd..16eaaeb6ba 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PrivacySettingsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PrivacySettingsActivity.java @@ -17,7 +17,6 @@ import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.drawable.Drawable; -import android.text.Spannable; import android.text.SpannableString; import android.text.SpannableStringBuilder; import android.text.Spanned; @@ -47,6 +46,7 @@ import org.telegram.messenger.SharedConfig; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; @@ -81,7 +81,7 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio @SuppressWarnings("FieldCanBeLocal") private LinearLayoutManager layoutManager; - private TLRPC.account_Password currentPassword; + private TL_account.Password currentPassword; private int privacySectionRow; private int blockedRow; @@ -224,7 +224,7 @@ public void onFragmentDestroy() { if (globalPrivacySettings != null && globalPrivacySettings.archive_and_mute_new_noncontact_peers != archiveChats) { globalPrivacySettings.archive_and_mute_new_noncontact_peers = archiveChats; save = true; - TLRPC.TL_account_setGlobalPrivacySettings req = new TLRPC.TL_account_setGlobalPrivacySettings(); + TL_account.setGlobalPrivacySettings req = new TL_account.setGlobalPrivacySettings(); req.settings = getContactsController().getGlobalPrivacySettings(); if (req.settings == null) { req.settings = new TLRPC.TL_globalPrivacySettings(); @@ -349,7 +349,7 @@ public boolean supportsPredictiveItemAnimations() { progressDialog.setCanCancel(false); progressDialog.show(); - final TLRPC.TL_account_setAccountTTL req = new TLRPC.TL_account_setAccountTTL(); + final TL_account.setAccountTTL req = new TL_account.setAccountTTL(); req.ttl = new TLRPC.TL_accountDaysTTL(); req.ttl.days = value; getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { @@ -634,7 +634,7 @@ public void didReceivedNotification(int id, int account, Object... args) { listAdapter.notifyItemChanged(blockedRow); } else if (id == NotificationCenter.didSetOrRemoveTwoStepPassword) { if (args.length > 0) { - currentPassword = (TLRPC.account_Password) args[0]; + currentPassword = (TL_account.Password) args[0]; if (listAdapter != null) { listAdapter.notifyItemChanged(passwordRow); } @@ -744,7 +744,7 @@ private void updateRows(boolean notify) { } } - public PrivacySettingsActivity setCurrentPassword(TLRPC.account_Password currentPassword) { + public PrivacySettingsActivity setCurrentPassword(TL_account.Password currentPassword) { this.currentPassword = currentPassword; if (currentPassword != null) { initPassword(); @@ -784,10 +784,10 @@ private void initPassword() { } private void loadPasswordSettings() { - TLRPC.TL_account_getPassword req = new TLRPC.TL_account_getPassword(); + TL_account.getPassword req = new TL_account.getPassword(); getConnectionsManager().sendRequest(req, (response, error) -> { if (response != null) { - TLRPC.account_Password password = (TLRPC.account_Password) response; + TL_account.Password password = (TL_account.Password) response; AndroidUtilities.runOnUIThread(() -> { currentPassword = password; initPassword(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java index 00ed59e33c..dc0da73825 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java @@ -10,6 +10,7 @@ import static androidx.core.view.ViewCompat.TYPE_TOUCH; import static org.telegram.messenger.AndroidUtilities.dp; +import static org.telegram.messenger.AndroidUtilities.lerp; import static org.telegram.messenger.ContactsController.PRIVACY_RULES_TYPE_ADDED_BY_PHONE; import static org.telegram.messenger.LocaleController.formatPluralString; import static org.telegram.messenger.LocaleController.formatString; @@ -73,6 +74,9 @@ import android.text.style.CharacterStyle; import android.text.style.ClickableSpan; import android.text.style.ForegroundColorSpan; +import android.text.style.URLSpan; +import android.text.util.Linkify; +import android.util.Log; import android.util.Property; import android.util.SparseArray; import android.util.SparseIntArray; @@ -161,9 +165,9 @@ import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.tgnet.tl.TL_bots; import org.telegram.tgnet.tl.TL_fragment; -import org.telegram.tgnet.tl.TL_payments; import org.telegram.tgnet.tl.TL_stars; import org.telegram.tgnet.tl.TL_stories; import org.telegram.ui.ActionBar.ActionBar; @@ -201,6 +205,7 @@ import org.telegram.ui.Components.AlertsCreator; import org.telegram.ui.Components.AnimatedColor; import org.telegram.ui.Components.AnimatedEmojiDrawable; +import org.telegram.ui.Components.AnimatedEmojiSpan; import org.telegram.ui.Components.AnimatedFileDrawable; import org.telegram.ui.Components.AnimatedFloat; import org.telegram.ui.Components.AnimatedTextView; @@ -264,6 +269,8 @@ import org.telegram.ui.Gifts.GiftSheet; import org.telegram.ui.Stars.BotStarsActivity; import org.telegram.ui.Stars.BotStarsController; +import org.telegram.ui.Stars.StarGiftPatterns; +import org.telegram.ui.Stars.StarGiftSheet; import org.telegram.ui.Stars.StarsController; import org.telegram.ui.Stars.StarsIntroActivity; import org.telegram.ui.Stories.ProfileStoriesView; @@ -272,6 +279,7 @@ import org.telegram.ui.Stories.StoryViewer; import org.telegram.ui.Stories.recorder.ButtonWithCounterView; import org.telegram.ui.Stories.recorder.DualCameraView; +import org.telegram.ui.Stories.recorder.HintView2; import org.telegram.ui.Stories.recorder.StoryRecorder; import org.telegram.ui.bots.AffiliateProgramFragment; import org.telegram.ui.bots.BotBiometry; @@ -328,7 +336,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. private Drawable lockIconDrawable; private final Drawable[] verifiedDrawable = new Drawable[2]; private final Drawable[] premiumStarDrawable = new Drawable[2]; - private AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable[] emojiStatusDrawable = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable[2]; + private Long emojiStatusGiftId; + private final AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable[] emojiStatusDrawable = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable[2]; + private final AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable[] botVerificationDrawable = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable[2]; private final Drawable[] verifiedCheckDrawable = new Drawable[2]; private final CrossfadeDrawable[] verifiedCrossfadeDrawable = new CrossfadeDrawable[2]; private final CrossfadeDrawable[] premiumCrossfadeDrawable = new CrossfadeDrawable[2]; @@ -497,7 +507,7 @@ public void setAlpha(int a) { private TLRPC.Chat currentChat; private TL_bots.BotInfo botInfo; private TLRPC.ChannelParticipant currentChannelParticipant; - private TLRPC.TL_account_password currentPassword; + private TL_account.TL_password currentPassword; private TLRPC.FileLocation avatar; private TLRPC.FileLocation avatarBig; @@ -699,7 +709,7 @@ public Float get(ProfileActivity object) { private PhotoViewer.PhotoViewerProvider provider = new PhotoViewer.EmptyPhotoViewerProvider() { @Override - public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { + public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview, boolean closing) { if (fileLocation == null) { return null; } @@ -943,13 +953,14 @@ public void setProgressToExpand(float animatedFracture) { } } - private class TopView extends View { + private class TopView extends FrameLayout { private int currentColor; private Paint paint = new Paint(); public TopView(Context context) { super(context); + setWillNotDraw(false); } @Override @@ -985,7 +996,11 @@ public void setBackgroundColorId(MessagesController.PeerColor peerColor, boolean color1 = peerColor.getBgColor1(Theme.isCurrentThemeDark()); color2 = peerColor.getBgColor2(Theme.isCurrentThemeDark()); actionBarBackgroundColor = ColorUtils.blendARGB(color1, color2, 0.25f); - emojiColor = PeerColorActivity.adaptProfileEmojiColor(color1); + if (peerColor.patternColor != 0) { + emojiColor = peerColor.patternColor; + } else { + emojiColor = PeerColorActivity.adaptProfileEmojiColor(color1); + } } else { actionBarBackgroundColor = currentColor; hasColorById = false; @@ -1020,11 +1035,17 @@ protected void onDetachedFromWindow() { } public final AnimatedFloat emojiLoadedT = new AnimatedFloat(this, 0, 440, CubicBezierInterpolator.EASE_OUT_QUINT); + public final AnimatedFloat emojiFullT = new AnimatedFloat(this, 0, 440, CubicBezierInterpolator.EASE_OUT_QUINT); private boolean hasEmoji; - public void setBackgroundEmojiId(long emojiId, boolean animated) { + private boolean emojiIsCollectible; + public void setBackgroundEmojiId(long emojiId, boolean isCollectible, boolean animated) { emoji.set(emojiId, animated); emoji.setColor(emojiColor); + emojiIsCollectible = isCollectible; + if (!animated) { + emojiFullT.force(isCollectible); + } hasEmoji = hasEmoji || emojiId != 0 && emojiId != -1; invalidate(); } @@ -1081,16 +1102,11 @@ protected void onDraw(Canvas canvas) { } if (hasEmoji) { final float loadedScale = emojiLoadedT.set(isEmojiLoaded()); + final float full = emojiFullT.set(emojiIsCollectible); if (loadedScale > 0) { canvas.save(); canvas.clipRect(0, 0, getMeasuredWidth(), y1); - final float cx = getMeasuredWidth() - dp(46); - final float cy = ((actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + dp(144)) - (1f - extraHeight / dp(88)) * dp(33); - PeerColorActivity.drawProfileIconPattern(cx, cy, 1f + (extraHeight / dp(88) - 1f) * .2f, (x, y, sz, alpha) -> { - emoji.setAlpha((int) (0xFF * alpha * Math.min(1f, extraHeight / dp(88)))); - emoji.setBounds((int) (x - sz * .45f), (int) (y - sz * .45f), (int) (x + sz * .45f), (int) (y + sz * .45f)); - emoji.draw(canvas); - }); + StarGiftPatterns.drawProfilePattern(canvas, emoji, getMeasuredWidth(), ((actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + dp(144)) - (1f - extraHeight / dp(88)) * dp(50), Math.min(1f, extraHeight / dp(88)), full); canvas.restore(); } } @@ -1454,7 +1470,7 @@ public void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUn } } if (dyConsumed != 0 && type == TYPE_TOUCH) { - hideFloatingButton(dyConsumed > 0); + hideFloatingButton(!(sharedMediaLayout == null || sharedMediaLayout.getClosestTab() == SharedMediaLayout.TAB_STORIES || sharedMediaLayout.getClosestTab() == SharedMediaLayout.TAB_ARCHIVED_STORIES) || dyConsumed > 0); } } catch (Throwable e) { FileLog.e(e); @@ -1929,6 +1945,9 @@ public boolean onFragmentCreate() { getNotificationCenter().addObserver(this, NotificationCenter.starBalanceUpdated); getNotificationCenter().addObserver(this, NotificationCenter.botStarsUpdated); getNotificationCenter().addObserver(this, NotificationCenter.botStarsTransactionsLoaded); + getNotificationCenter().addObserver(this, NotificationCenter.dialogDeleted); + getNotificationCenter().addObserver(this, NotificationCenter.channelRecommendationsLoaded); + getNotificationCenter().addObserver(this, NotificationCenter.starUserGiftsLoaded); NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiLoaded); updateRowsIds(); if (listAdapter != null) { @@ -1943,10 +1962,10 @@ public boolean onFragmentCreate() { TLRPC.User user = getMessagesController().getUser(userId); if (UserObject.isUserSelf(user)) { - TLRPC.TL_account_getPassword req = new TLRPC.TL_account_getPassword(); + TL_account.getPassword req = new TL_account.getPassword(); getConnectionsManager().sendRequest(req, (response, error) -> { - if (response instanceof TLRPC.TL_account_password) { - currentPassword = (TLRPC.TL_account_password) response; + if (response instanceof TL_account.TL_password) { + currentPassword = (TL_account.TL_password) response; } }); } @@ -1963,9 +1982,10 @@ public int getBottomOffset(int tag) { if (bottomButtonsContainer == null) { return 0; } - final float stories = Math.min(1f, 1f - Math.abs(sharedMediaLayout.getTabProgress() - SharedMediaLayout.TAB_STORIES)); - final float archivedStories = Math.min(1f, 1f - Math.abs(sharedMediaLayout.getTabProgress() - SharedMediaLayout.TAB_ARCHIVED_STORIES)); - return (int) (dp(72) - bottomButtonsContainer.getTranslationY() - archivedStories * bottomButtonContainer[1].getTranslationY() - stories * bottomButtonContainer[0].getTranslationY()); + final float gifts = Utilities.clamp01(1f - Math.abs(sharedMediaLayout.getTabProgress() - SharedMediaLayout.TAB_GIFTS)); + final float stories = Utilities.clamp01(1f - Math.abs(sharedMediaLayout.getTabProgress() - SharedMediaLayout.TAB_STORIES)); + final float archivedStories = Utilities.clamp01(1f - Math.abs(sharedMediaLayout.getTabProgress() - SharedMediaLayout.TAB_ARCHIVED_STORIES)); + return lerp((int) (dp(72) - bottomButtonsContainer.getTranslationY() - archivedStories * bottomButtonContainer[1].getTranslationY() - stories * bottomButtonContainer[0].getTranslationY()), 0, gifts); } @Override @@ -2032,6 +2052,9 @@ public void onFragmentDestroy() { getNotificationCenter().removeObserver(this, NotificationCenter.starBalanceUpdated); getNotificationCenter().removeObserver(this, NotificationCenter.botStarsUpdated); getNotificationCenter().removeObserver(this, NotificationCenter.botStarsTransactionsLoaded); + getNotificationCenter().removeObserver(this, NotificationCenter.dialogDeleted); + getNotificationCenter().removeObserver(this, NotificationCenter.channelRecommendationsLoaded); + getNotificationCenter().removeObserver(this, NotificationCenter.starUserGiftsLoaded); NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiLoaded); if (avatarsViewPager != null) { avatarsViewPager.onDestroy(); @@ -2277,36 +2300,28 @@ public void onItemClick(final int id) { builder.setTitle(LocaleController.getPluralString("DeleteTopics", 1)); TLRPC.TL_forumTopic topic = MessagesController.getInstance(currentAccount).getTopicsController().findTopic(chatId, topicId); builder.setMessage(formatString("DeleteSelectedTopic", R.string.DeleteSelectedTopic, topic == null ? "topic" : topic.title)); - builder.setPositiveButton(LocaleController.getString(R.string.Delete), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - ArrayList topicIds = new ArrayList<>(); - topicIds.add((int) topicId); - getMessagesController().getTopicsController().deleteTopics(chatId, topicIds); - playProfileAnimation = 0; - if (parentLayout != null && parentLayout.getFragmentStack() != null) { - for (int i = 0; i < parentLayout.getFragmentStack().size(); ++i) { - BaseFragment fragment = parentLayout.getFragmentStack().get(i); - if (fragment instanceof ChatActivity && ((ChatActivity) fragment).getTopicId() == topicId) { - fragment.removeSelfFromStack(); - } + builder.setPositiveButton(LocaleController.getString(R.string.Delete), (dialog, which) -> { + ArrayList topicIds = new ArrayList<>(); + topicIds.add((int) topicId); + getMessagesController().getTopicsController().deleteTopics(chatId, topicIds); + playProfileAnimation = 0; + if (parentLayout != null && parentLayout.getFragmentStack() != null) { + for (int i = 0; i < parentLayout.getFragmentStack().size(); ++i) { + BaseFragment fragment = parentLayout.getFragmentStack().get(i); + if (fragment instanceof ChatActivity && ((ChatActivity) fragment).getTopicId() == topicId) { + fragment.removeSelfFromStack(); } } - finishFragment(); - - Context context = getContext(); - if (context != null) { - BulletinFactory.of(Bulletin.BulletinWindow.make(context), resourcesProvider).createSimpleBulletin(R.raw.ic_delete, LocaleController.getPluralString("TopicsDeleted", 1)).show(); - } - dialog.dismiss(); } - }); - builder.setNegativeButton(LocaleController.getString(R.string.Cancel), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); + finishFragment(); + + Context context = getContext(); + if (context != null) { + BulletinFactory.of(Bulletin.BulletinWindow.make(context), resourcesProvider).createSimpleBulletin(R.raw.ic_delete, LocaleController.getPluralString("TopicsDeleted", 1)).show(); } + dialog.dismiss(); }); + builder.setNegativeButton(LocaleController.getString(R.string.Cancel), (dialog, which) -> dialog.dismiss()); AlertDialog alertDialog = builder.create(); alertDialog.show(); TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE); @@ -2478,7 +2493,10 @@ public void didChangeOwner(TLRPC.User user) { } else if (id == view_discussion) { openDiscussion(); } else if (id == gift_premium) { - showDialog(new GiftSheet(getContext(), currentAccount, userId, null, null)); + if (currentChat != null) { + MessagesController.getGlobalMainSettings().edit().putInt("channelgifthint", 3).apply(); + } + showDialog(new GiftSheet(getContext(), currentAccount, getDialogId(), null, null)); } else if (id == channel_stories) { Bundle args = new Bundle(); args.putInt("type", MediaActivity.TYPE_ARCHIVED_CHANNEL_STORIES); @@ -2608,10 +2626,10 @@ public void didChangeOwner(TLRPC.User user) { } if (location.imageType == FileLoader.IMAGE_TYPE_ANIMATION) { builder.setTitle(LocaleController.getString(R.string.AreYouSureDeleteVideoTitle)); - builder.setMessage(formatString("AreYouSureDeleteVideo", R.string.AreYouSureDeleteVideo)); + builder.setMessage(getString(R.string.AreYouSureDeleteVideo)); } else { builder.setTitle(LocaleController.getString(R.string.AreYouSureDeletePhotoTitle)); - builder.setMessage(formatString("AreYouSureDeletePhoto", R.string.AreYouSureDeletePhoto)); + builder.setMessage(getString(R.string.AreYouSureDeletePhoto)); } builder.setPositiveButton(LocaleController.getString(R.string.Delete), (dialogInterface, i) -> { int position = avatarsViewPager.getRealPosition(); @@ -2837,6 +2855,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { storyView.setExpandProgress(1f); } expandPhoto = false; + updateCollectibleHint(); } allowPullingDown = true; @@ -3142,6 +3161,11 @@ protected void onAttachedToWindow() { emojiStatusDrawable[i].attach(); } } + for (int i = 0; i < botVerificationDrawable.length; ++i) { + if (botVerificationDrawable[i] != null) { + botVerificationDrawable[i].attach(); + } + } } @Override @@ -3153,6 +3177,11 @@ protected void onDetachedFromWindow() { emojiStatusDrawable[i].detach(); } } + for (int i = 0; i < botVerificationDrawable.length; ++i) { + if (botVerificationDrawable[i] != null) { + botVerificationDrawable[i].detach(); + } + } } }; @@ -3279,13 +3308,13 @@ public StoryRecorder.SourceView getView(long dialogId) { final ArrayList users = chatInfo != null && chatInfo.participants != null && chatInfo.participants.participants.size() > 5 ? sortedUsers : null; int initialTab = -1; - if (openGifts && userInfo != null && userInfo.stargifts_count > 0) initialTab = SharedMediaLayout.TAB_GIFTS; + if (openGifts && (userInfo != null && userInfo.stargifts_count > 0 || chatInfo != null && chatInfo.stargifts_count > 0)) initialTab = SharedMediaLayout.TAB_GIFTS; else if (openSimilar) initialTab = SharedMediaLayout.TAB_RECOMMENDED_CHANNELS; else if (users != null) initialTab = SharedMediaLayout.TAB_GROUPUSERS; sharedMediaLayout = new SharedMediaLayout(context, did, sharedMediaPreloader, userInfo != null ? userInfo.common_chats_count : 0, sortedUsers, chatInfo, userInfo, initialTab, this, this, SharedMediaLayout.VIEW_TYPE_PROFILE_ACTIVITY, resourcesProvider) { @Override protected int processColor(int color) { - return applyPeerColor(color, false); + return dontApplyPeerColor(color, false); } @Override protected void onSelectedTabChanged() { @@ -3773,32 +3802,26 @@ public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerVi builder.setView(linearLayout); } - builder.setPositiveButton(LocaleController.getString(R.string.ReportChat), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - TLRPC.TL_messages_reportReaction req = new TLRPC.TL_messages_reportReaction(); - req.user_id = getMessagesController().getInputUser(userId); - req.peer = getMessagesController().getInputPeer(reportReactionFromDialogId); - req.id = reportReactionMessageId; - ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { + builder.setPositiveButton(LocaleController.getString(R.string.ReportChat), (dialog, which) -> { + TLRPC.TL_messages_reportReaction req = new TLRPC.TL_messages_reportReaction(); + req.user_id = getMessagesController().getInputUser(userId); + req.peer = getMessagesController().getInputPeer(reportReactionFromDialogId); + req.id = reportReactionMessageId; + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { - }); - - if (cells[0] != null && cells[0].isChecked()) { - TLRPC.User user = getMessagesController().getUser(userId); - getMessagesController().deleteParticipantFromChat(-reportReactionFromDialogId, user); - } + }); - reportReactionMessageId = 0; - updateListAnimated(false); - BulletinFactory.of(ProfileActivity.this).createReportSent(resourcesProvider).show(); + if (cells[0] != null && cells[0].isChecked()) { + TLRPC.User user = getMessagesController().getUser(userId); + getMessagesController().deleteParticipantFromChat(-reportReactionFromDialogId, user); } + + reportReactionMessageId = 0; + updateListAnimated(false); + BulletinFactory.of(ProfileActivity.this).createReportSent(resourcesProvider).show(); }); - builder.setNegativeButton(LocaleController.getString(R.string.Cancel), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - } + builder.setNegativeButton(LocaleController.getString(R.string.Cancel), (dialog, which) -> { + dialog.dismiss(); }); AlertDialog dialog = builder.show(); TextView button = (TextView) dialog.getButton(DialogInterface.BUTTON_POSITIVE); @@ -4239,7 +4262,7 @@ public boolean onItemClick(View view, int position) { getMessagesStorage().clearSentMedia(); SharedConfig.setNoSoundHintShowed(false); SharedPreferences.Editor editor = MessagesController.getGlobalMainSettings().edit(); - editor.remove("archivehint").remove("proximityhint").remove("archivehint_l").remove("speedhint").remove("gifhint").remove("reminderhint").remove("soundHint").remove("themehint").remove("bganimationhint").remove("filterhint").remove("n_0").remove("storyprvhint").remove("storyhint").remove("storyhint2").remove("storydualhint").remove("storysvddualhint").remove("stories_camera").remove("dualcam").remove("dualmatrix").remove("dual_available").remove("archivehint").remove("askNotificationsAfter").remove("askNotificationsDuration").remove("viewoncehint").remove("taptostorysoundhint").remove("nothanos").remove("voiceoncehint").remove("savedhint").remove("savedsearchhint").remove("savedsearchtaghint").remove("groupEmojiPackHintShown").remove("newppsms").remove("monetizationadshint").remove("seekSpeedHintShowed").remove("unsupport_video/av01").apply(); + editor.remove("archivehint").remove("proximityhint").remove("archivehint_l").remove("speedhint").remove("gifhint").remove("reminderhint").remove("soundHint").remove("themehint").remove("bganimationhint").remove("filterhint").remove("n_0").remove("storyprvhint").remove("storyhint").remove("storyhint2").remove("storydualhint").remove("storysvddualhint").remove("stories_camera").remove("dualcam").remove("dualmatrix").remove("dual_available").remove("archivehint").remove("askNotificationsAfter").remove("askNotificationsDuration").remove("viewoncehint").remove("taptostorysoundhint").remove("nothanos").remove("voiceoncehint").remove("savedhint").remove("savedsearchhint").remove("savedsearchtaghint").remove("groupEmojiPackHintShown").remove("newppsms").remove("monetizationadshint").remove("seekSpeedHintShowed").remove("unsupport_video/av01").remove("channelgifthint").apply(); MessagesController.getEmojiSettings(currentAccount).edit().remove("featured_hidden").remove("emoji_featured_hidden").commit(); SharedConfig.textSelectionHintShows = 0; SharedConfig.lockRecordAudioVideoHint = 0; @@ -4267,7 +4290,14 @@ public boolean onItemClick(View view, int position) { editor.remove(key); } } - editor.commit(); + editor.apply(); + editor = MessagesController.getNotificationsSettings(currentAccount).edit(); + for (String key : MessagesController.getNotificationsSettings(currentAccount).getAll().keySet()) { + if (key.startsWith("dialog_bar_botver")) { + editor.remove(key); + } + } + editor.apply(); } else if (which == 7) { // Call settings VoIPHelper.showCallDebugSettings(getParentActivity()); } else if (which == 8) { // ? @@ -4764,6 +4794,12 @@ protected void onDetachedFromWindow() { super.onDetachedFromWindow(); fallbackImage.onDetachedFromWindow(); } + + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + super.onLayout(changed, left, top, right, bottom); + updateCollectibleHint(); + } }; fallbackImage = new ImageReceiver(avatarContainer2); fallbackImage.setRoundRadius(AndroidUtilities.dp(11)); @@ -4956,6 +4992,14 @@ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { info.setText(s); } } + @Override + protected void onDraw(Canvas canvas) { + final int wasRightDrawableX = getRightDrawableX(); + super.onDraw(canvas); + if (wasRightDrawableX != getRightDrawableX()) { + updateCollectibleHint(); + } + } }; if (a == 1) { nameTextView[a].setTextColor(getThemedColor(Theme.key_profile_title)); @@ -5020,7 +5064,7 @@ public void setTextColor(int color) { } onlineTextView[a].setEllipsizeByGradient(true); - onlineTextView[a].setTextColor(applyPeerColor(getThemedColor(Theme.key_avatar_subtitleInProfileBlue), true)); + onlineTextView[a].setTextColor(applyPeerColor(getThemedColor(Theme.key_avatar_subtitleInProfileBlue), true, null)); onlineTextView[a].setTextSize(14); onlineTextView[a].setGravity(Gravity.LEFT); onlineTextView[a].setAlpha(a == 0 ? 0.0f : 1.0f); @@ -5321,7 +5365,7 @@ private void checkCanSendStoryForPosting() { storiesController.canSendStoryFor(getDialogId(), canSend -> { waitCanSendStoryRequest = false; showBoostsAlert = !canSend; - hideFloatingButton(false); + hideFloatingButton(!(sharedMediaLayout == null || sharedMediaLayout.getClosestTab() == SharedMediaLayout.TAB_STORIES || sharedMediaLayout.getClosestTab() == SharedMediaLayout.TAB_ARCHIVED_STORIES)); }, false, resourcesProvider); } @@ -5441,7 +5485,7 @@ private void updateFloatingButtonColor() { } Drawable drawable; if (floatingButtonContainer != null) { - drawable = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56), applyPeerColor(Theme.getColor(Theme.key_chats_actionBackground), false), applyPeerColor(Theme.getColor(Theme.key_chats_actionPressedBackground), false)); + drawable = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56), dontApplyPeerColor(Theme.getColor(Theme.key_chats_actionBackground), false), dontApplyPeerColor(Theme.getColor(Theme.key_chats_actionPressedBackground), false)); if (Build.VERSION.SDK_INT < 21) { Drawable shadowDrawable = ContextCompat.getDrawable(getParentActivity(), R.drawable.floating_shadow).mutate(); shadowDrawable.setColorFilter(new PorterDuffColorFilter(0xff000000, PorterDuff.Mode.MULTIPLY)); @@ -5618,6 +5662,8 @@ private void setAvatarExpandProgress(float animatedFracture) { params.height = (int) AndroidUtilities.lerp(AndroidUtilities.dpf2(42f), (extraHeight + newTop) / avatarScale, value); params.leftMargin = (int) AndroidUtilities.lerp(AndroidUtilities.dpf2(64f), 0f, value); avatarContainer.requestLayout(); + + updateCollectibleHint(); } private int getSmallAvatarRoundRadius() { @@ -5719,50 +5765,58 @@ public void showStatusSelect() { int ecenter = AndroidUtilities.rectTmp2.centerX(); xoff = MathUtils.clamp(ecenter - popupWidth / 2, 0, AndroidUtilities.displaySize.x - popupWidth); ecenter -= xoff; - boolean hasEmoji = emojiStatusDrawable[1] != null && emojiStatusDrawable[1].getDrawable() instanceof AnimatedEmojiDrawable; SelectAnimatedEmojiDialog popupLayout = new SelectAnimatedEmojiDialog(this, getContext(), true, Math.max(0, ecenter), currentChat == null ? SelectAnimatedEmojiDialog.TYPE_EMOJI_STATUS : SelectAnimatedEmojiDialog.TYPE_EMOJI_STATUS_CHANNEL, true, resourcesProvider, topMarginDp) { @Override - protected void onEmojiSelected(View emojiView, Long documentId, TLRPC.Document document, Integer until) { - TLObject request; - if (currentChat == null) { - TLRPC.TL_account_updateEmojiStatus req = new TLRPC.TL_account_updateEmojiStatus(); - if (documentId == null) { - req.emoji_status = new TLRPC.TL_emojiStatusEmpty(); - } else if (until != null) { - req.emoji_status = new TLRPC.TL_emojiStatusUntil(); - ((TLRPC.TL_emojiStatusUntil) req.emoji_status).document_id = documentId; - ((TLRPC.TL_emojiStatusUntil) req.emoji_status).until = until; - } else { - req.emoji_status = new TLRPC.TL_emojiStatus(); - ((TLRPC.TL_emojiStatus) req.emoji_status).document_id = documentId; + protected boolean willApplyEmoji(View view, Long documentId, TLRPC.Document document, TL_stars.TL_starGiftUnique gift, Integer until) { + if (gift != null) { + final TL_stars.SavedStarGift savedStarGift = StarsController.getInstance(currentAccount).findUserStarGift(gift.id); + return savedStarGift == null || MessagesController.getGlobalMainSettings().getInt("statusgiftpage", 0) >= 2; + } + return true; + } + + @Override + public long getDialogId() { + return ProfileActivity.this.getDialogId(); + } + + @Override + protected void onEmojiSelected(View emojiView, Long documentId, TLRPC.Document document, TL_stars.TL_starGiftUnique gift, Integer until) { + final TLRPC.EmojiStatus emojiStatus; + if (gift != null) { + final TL_stars.SavedStarGift savedStarGift = StarsController.getInstance(currentAccount).findUserStarGift(gift.id); + if (savedStarGift != null && MessagesController.getGlobalMainSettings().getInt("statusgiftpage", 0) < 2) { + MessagesController.getGlobalMainSettings().edit().putInt("statusgiftpage", MessagesController.getGlobalMainSettings().getInt("statusgiftpage", 0) + 1).apply(); + new StarGiftSheet(getContext(), currentAccount, UserConfig.getInstance(currentAccount).getClientUserId(), resourcesProvider) + .set(savedStarGift) + .setupWearPage() + .show(); + if (popup[0] != null) { + selectAnimatedEmojiDialog = null; + popup[0].dismiss(); + } + return; } - TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId()); - if (user != null) { - user.emoji_status = req.emoji_status; - MessagesController.getInstance(currentAccount).updateEmojiStatusUntilUpdate(user.id, user.emoji_status); - NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.userEmojiStatusUpdated, user); + final TLRPC.TL_inputEmojiStatusCollectible status = new TLRPC.TL_inputEmojiStatusCollectible(); + status.collectible_id = gift.id; + if (until != null) { + status.flags |= 1; + status.until = until; } - request = req; + emojiStatus = status; + } else if (documentId == null) { + emojiStatus = new TLRPC.TL_emojiStatusEmpty(); } else { - TLRPC.TL_channels_updateEmojiStatus req = new TLRPC.TL_channels_updateEmojiStatus(); - req.channel = MessagesController.getInputChannel(currentChat); - if (documentId == null) { - req.emoji_status = new TLRPC.TL_emojiStatusEmpty(); - } else if (until != null) { - req.emoji_status = new TLRPC.TL_emojiStatusUntil(); - ((TLRPC.TL_emojiStatusUntil) req.emoji_status).document_id = documentId; - ((TLRPC.TL_emojiStatusUntil) req.emoji_status).until = until; - } else { - req.emoji_status = new TLRPC.TL_emojiStatus(); - ((TLRPC.TL_emojiStatus) req.emoji_status).document_id = documentId; + final TLRPC.TL_emojiStatus status = new TLRPC.TL_emojiStatus(); + status.document_id = documentId; + if (until != null) { + status.flags |= 1; + status.until = until; } - if (currentChat != null) { - currentChat.emoji_status = req.emoji_status; - MessagesController.getInstance(currentAccount).updateEmojiStatusUntilUpdate(-currentChat.id, currentChat.emoji_status); - NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_EMOJI_STATUS); - } - request = req; + emojiStatus = status; } + emojiStatusGiftId = gift != null ? gift.id : null; + getMessagesController().updateEmojiStatus(currentChat == null ? 0 : -currentChat.id, emojiStatus, gift); for (int a = 0; a < 2; ++a) { if (emojiStatusDrawable[a] != null) { if (documentId == null && currentChat == null) { @@ -5772,6 +5826,7 @@ protected void onEmojiSelected(View emojiView, Long documentId, TLRPC.Document d } else { emojiStatusDrawable[a].set((Drawable) null, true); } + emojiStatusDrawable[a].setParticles(gift != null, true); } } if (documentId != null) { @@ -5779,7 +5834,6 @@ protected void onEmojiSelected(View emojiView, Long documentId, TLRPC.Document d } updateEmojiStatusDrawableColor(); updateEmojiStatusEffectPosition(); - ConnectionsManager.getInstance(currentAccount).sendRequest(request, null); if (popup[0] != null) { selectAnimatedEmojiDialog = null; popup[0].dismiss(); @@ -5790,7 +5844,11 @@ protected void onEmojiSelected(View emojiView, Long documentId, TLRPC.Document d if (user != null) { popupLayout.setExpireDateHint(DialogObject.getEmojiStatusUntil(user.emoji_status)); } - popupLayout.setSelected(emojiStatusDrawable[1] != null && emojiStatusDrawable[1].getDrawable() instanceof AnimatedEmojiDrawable ? ((AnimatedEmojiDrawable) emojiStatusDrawable[1].getDrawable()).getDocumentId() : null); + if (emojiStatusGiftId != null) { + popupLayout.setSelected(emojiStatusGiftId); + } else { + popupLayout.setSelected(emojiStatusDrawable[1] != null && emojiStatusDrawable[1].getDrawable() instanceof AnimatedEmojiDrawable ? ((AnimatedEmojiDrawable) emojiStatusDrawable[1].getDrawable()).getDocumentId() : null); + } popupLayout.setSaveState(3); popupLayout.setScrimDrawable(emojiStatusDrawable[1], nameTextView[1]); popup[0] = selectAnimatedEmojiDialog = new SelectAnimatedEmojiDialog.SelectAnimatedEmojiDialogWindow(popupLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT) { @@ -6709,7 +6767,7 @@ public void setValue(ActionBar object, float value) { verifiedCheckDrawable[0].setColorFilter(AndroidUtilities.getOffsetColor(color1, color2, value, 1.0f), PorterDuff.Mode.MULTIPLY); } if (verifiedCheckDrawable[1] != null) { - color1 = peerColor != null ? Color.WHITE : applyPeerColor(getThemedColor(Theme.key_profile_verifiedCheck)); + color1 = peerColor != null ? Color.WHITE : dontApplyPeerColor(getThemedColor(Theme.key_profile_verifiedCheck)); color2 = getThemedColor(Theme.key_windowBackgroundWhite); verifiedCheckDrawable[1].setColorFilter(AndroidUtilities.getOffsetColor(color1, color2, value, 1.0f), PorterDuff.Mode.MULTIPLY); } @@ -6721,8 +6779,8 @@ public void setValue(ActionBar object, float value) { premiumStarDrawable[0].setColorFilter(AndroidUtilities.getOffsetColor(color1, color2, value, 1.0f), PorterDuff.Mode.MULTIPLY); } if (premiumStarDrawable[1] != null) { - color1 = applyPeerColor(getThemedColor(Theme.key_profile_verifiedBackground)); - color2 = applyPeerColor(getThemedColor(Theme.key_player_actionBarTitle)); + color1 = dontApplyPeerColor(getThemedColor(Theme.key_profile_verifiedBackground)); + color2 = dontApplyPeerColor(getThemedColor(Theme.key_player_actionBarTitle)); premiumStarDrawable[1].setColorFilter(AndroidUtilities.getOffsetColor(color1, color2, value, 1.0f), PorterDuff.Mode.MULTIPLY); } @@ -7043,8 +7101,8 @@ public void updateSelectedMediaTabText() { } else if (id == SharedMediaLayout.TAB_ARCHIVED_STORIES) { mediaCounterTextView.setText(LocaleController.formatPluralString("ProfileStoriesArchiveCount", sharedMediaLayout.getStoriesCount(id))); } else if (id == SharedMediaLayout.TAB_RECOMMENDED_CHANNELS) { - MessagesController.ChannelRecommendations rec = MessagesController.getInstance(currentAccount).getChannelRecommendations(chatId); - mediaCounterTextView.setText(LocaleController.formatPluralString("Channels", rec == null ? 0 : rec.chats.size() + rec.more)); + final MessagesController.ChannelRecommendations rec = MessagesController.getInstance(currentAccount).getChannelRecommendations(getDialogId()); + mediaCounterTextView.setText(LocaleController.formatPluralString(isBot ? "Bots" : "Channels", rec == null ? 0 : rec.chats.size() + rec.more)); } else if (id == SharedMediaLayout.TAB_SAVED_MESSAGES) { int messagesCount = getMessagesController().getSavedMessagesController().getMessagesCount(getDialogId()); mediaCounterTextView.setText(LocaleController.formatPluralString("SavedMessagesCount", Math.max(1, messagesCount))); @@ -7226,6 +7284,7 @@ public void onAnimationEnd(Animator animation) { onlineTextView[1].setTranslationY(newTop + h - AndroidUtilities.dpf2(18f) - onlineTextView[1].getBottom() + additionalTranslationY); mediaCounterTextView.setTranslationX(onlineTextView[1].getTranslationX()); mediaCounterTextView.setTranslationY(onlineTextView[1].getTranslationY()); + updateCollectibleHint(); } } else { if (isPulledDown) { @@ -7290,6 +7349,7 @@ public void onAnimationEnd(Animator animation) { onlineTextView[1].setTranslationY(onlineY); mediaCounterTextView.setTranslationX(onlineX); mediaCounterTextView.setTranslationY(onlineY); + updateCollectibleHint(); } } } @@ -7350,6 +7410,8 @@ public void onAnimationEnd(Animator animation) { params.width = params.height = (int) AndroidUtilities.lerp(AndroidUtilities.dpf2(42f), (extraHeight + newTop) / avatarScale, avatarAnimationProgress); params.leftMargin = (int) AndroidUtilities.lerp(AndroidUtilities.dpf2(64f), 0f, avatarAnimationProgress); avatarContainer.requestLayout(); + + updateCollectibleHint(); } else if (extraHeight <= AndroidUtilities.dp(88f)) { avatarScale = (42 + 18 * diff) / 42.0f; if (storyView != null) { @@ -7394,6 +7456,7 @@ public void onAnimationEnd(Animator animation) { nameTextView[a].setScaleX(nameScale); nameTextView[a].setScaleY(nameScale); } + updateCollectibleHint(); } if (!openAnimationInProgress && (expandAnimator == null || !expandAnimator.isRunning())) { @@ -7698,17 +7761,20 @@ public void didReceivedNotification(int id, int account, final Object... args) { if (avatarImage != null) { avatarImage.setHasStories(needInsetForStories()); } + if (chatId != 0) { + otherItem.setSubItemShown(gift_premium, !BuildVars.IS_BILLING_UNAVAILABLE && !getMessagesController().premiumPurchaseBlocked() && chatInfo != null && chatInfo.stargifts_available); + } } } else if (id == NotificationCenter.chatInfoDidLoad) { - TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0]; + final TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0]; if (chatFull.id == chatId) { - boolean byChannelUsers = (Boolean) args[2]; + final boolean byChannelUsers = (Boolean) args[2]; if (chatInfo instanceof TLRPC.TL_channelFull) { if (chatFull.participants == null) { chatFull.participants = chatInfo.participants; } } - boolean loadChannelParticipants = chatInfo == null && chatFull instanceof TLRPC.TL_channelFull; + final boolean loadChannelParticipants = chatInfo == null && chatFull instanceof TLRPC.TL_channelFull; chatInfo = chatFull; if (mergeDialogId == 0 && chatInfo.migrated_from_chat_id != 0) { mergeDialogId = -chatInfo.migrated_from_chat_id; @@ -7730,6 +7796,7 @@ public void didReceivedNotification(int id, int account, final Object... args) { if (currentChat.megagroup && (loadChannelParticipants || !byChannelUsers)) { getChannelParticipants(true); } + updateAutoDeleteItem(); updateTtlIcon(); if (storyView != null && chatInfo != null) { @@ -7745,13 +7812,13 @@ public void didReceivedNotification(int id, int account, final Object... args) { } else if (id == NotificationCenter.closeChats) { removeSelfFromStack(true); } else if (id == NotificationCenter.botInfoDidLoad) { - TL_bots.BotInfo info = (TL_bots.BotInfo) args[0]; + final TL_bots.BotInfo info = (TL_bots.BotInfo) args[0]; if (info.user_id == userId) { botInfo = info; updateListAnimated(false); } } else if (id == NotificationCenter.userInfoDidLoad) { - long uid = (Long) args[0]; + final long uid = (Long) args[0]; if (uid == userId) { userInfo = (TLRPC.UserFull) args[1]; if (storyView != null) { @@ -7811,11 +7878,11 @@ public void didReceivedNotification(int id, int account, final Object... args) { updateQrItemVisibility(true); } } else if (id == NotificationCenter.didReceiveNewMessages) { - boolean scheduled = (Boolean) args[2]; + final boolean scheduled = (Boolean) args[2]; if (scheduled) { return; } - long did = getDialogId(); + final long did = getDialogId(); if (did == (Long) args[0]) { boolean enc = DialogObject.isEncryptedDialog(did); ArrayList arr = (ArrayList) args[1]; @@ -7834,12 +7901,11 @@ public void didReceivedNotification(int id, int account, final Object... args) { listView.invalidateViews(); } } else if (id == NotificationCenter.reloadInterface) { - int prevEmptyRow = emptyRow; updateListAnimated(false); } else if (id == NotificationCenter.newSuggestionsAvailable) { - int prevRow1 = passwordSuggestionRow; - int prevRow2 = phoneSuggestionRow; - int prevRow3 = graceSuggestionRow; + final int prevRow1 = passwordSuggestionRow; + final int prevRow2 = phoneSuggestionRow; + final int prevRow3 = graceSuggestionRow; updateRowsIds(); if (prevRow1 != passwordSuggestionRow || prevRow2 != phoneSuggestionRow || prevRow3 != graceSuggestionRow) { listAdapter.notifyDataSetChanged(); @@ -7882,6 +7948,33 @@ public void didReceivedNotification(int id, int account, final Object... args) { updateListAnimated(false); } else if (id == NotificationCenter.botStarsTransactionsLoaded) { updateListAnimated(false); + } else if (id == NotificationCenter.dialogDeleted) { + final long dialogId = (long) args[0]; + if (getDialogId() == dialogId) { + if (parentLayout != null && parentLayout.getLastFragment() == this) { + finishFragment(); + } else { + removeSelfFromStack(); + } + } + } else if (id == NotificationCenter.channelRecommendationsLoaded) { + final long dialogId = (long) args[0]; + if (sharedMediaRow < 0 && dialogId == getDialogId()) { + updateRowsIds(); + updateSelectedMediaTabText(); + if (listAdapter != null) { + listAdapter.notifyDataSetChanged(); + } + } + } else if (id == NotificationCenter.starUserGiftsLoaded) { + final long dialogId = (long) args[0]; + if (sharedMediaRow < 0 && dialogId == getDialogId()) { + updateRowsIds(); + updateSelectedMediaTabText(); + if (listAdapter != null) { + listAdapter.notifyDataSetChanged(); + } + } } } @@ -8612,6 +8705,9 @@ public void setChatInfo(TLRPC.ChatFull value) { avatarImage.setHasStories(needInsetForStories()); } fetchUsersFromChannelInfo(); + if (chatId != 0) { + otherItem.setSubItemShown(gift_premium, !BuildVars.IS_BILLING_UNAVAILABLE && !getMessagesController().premiumPurchaseBlocked() && chatInfo != null && chatInfo.stargifts_available); + } } private boolean needInsetForStories() { @@ -8831,14 +8927,16 @@ private void updateRowsIds() { if (!hasMedia && userInfo != null && userInfo.bot_info != null) { hasMedia = userInfo.bot_info.has_preview_medias; } - if (!hasMedia && userInfo != null && userInfo.stargifts_count > 0) { + if (!hasMedia && (userInfo != null && userInfo.stargifts_count > 0 || chatInfo != null && chatInfo.stargifts_count > 0)) { hasMedia = true; } if (!hasMedia && chatInfo != null) { hasMedia = chatInfo.stories_pinned_available; } if (!hasMedia) { - if (chatId != 0 && MessagesController.ChannelRecommendations.hasRecommendations(currentAccount, chatId)) { + if (chatId != 0 && MessagesController.ChannelRecommendations.hasRecommendations(currentAccount, -chatId)) { + hasMedia = true; + } else if (isBot && userId != 0 && MessagesController.ChannelRecommendations.hasRecommendations(currentAccount, userId)) { hasMedia = true; } } @@ -8924,7 +9022,7 @@ private void updateRowsIds() { boolean hasPhone = user != null && (!TextUtils.isEmpty(user.phone) || !TextUtils.isEmpty(vcardPhone)); if (userInfo != null && (userInfo.flags2 & 64) != 0 && (profileChannelMessageFetcher == null || !profileChannelMessageFetcher.loaded || profileChannelMessageFetcher.messageObject != null)) { - TLRPC.Chat channel = getMessagesController().getChat(userInfo.personal_channel_id); + final TLRPC.Chat channel = getMessagesController().getChat(userInfo.personal_channel_id); if (channel != null && (ChatObject.isPublic(channel) || !ChatObject.isNotInChat(channel))) { channelRow = rowCount++; channelDividerRow = rowCount++; @@ -9247,13 +9345,29 @@ private Drawable getPremiumCrossfadeDrawable(int a) { premiumStarDrawable[a] = ContextCompat.getDrawable(getParentActivity(), R.drawable.msg_premium_liststar).mutate(); int color = getThemedColor(Theme.key_profile_verifiedBackground); if (a == 1) { - color = applyPeerColor(color); + color = dontApplyPeerColor(color); } premiumStarDrawable[a].setColorFilter(color, PorterDuff.Mode.MULTIPLY); premiumCrossfadeDrawable[a] = new CrossfadeDrawable(premiumStarDrawable[a], ContextCompat.getDrawable(getParentActivity(), R.drawable.msg_premium_prolfilestar).mutate()); } return premiumCrossfadeDrawable[a]; } + private Drawable getBotVerificationDrawable(long icon, boolean animated, int a) { + if (botVerificationDrawable[a] == null) { + botVerificationDrawable[a] = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(nameTextView[a], AndroidUtilities.dp(17), a == 0 ? AnimatedEmojiDrawable.CACHE_TYPE_EMOJI_STATUS : AnimatedEmojiDrawable.CACHE_TYPE_KEYBOARD); + botVerificationDrawable[a].offset(0, dp(1)); + if (fragmentViewAttached) { + botVerificationDrawable[a].attach(); + } + } + if (icon != 0) { + botVerificationDrawable[a].set(icon, animated); + } else { + botVerificationDrawable[a].set((Drawable) null, animated); + } + updateEmojiStatusDrawableColor(); + return botVerificationDrawable[a]; + } private Drawable getEmojiStatusDrawable(TLRPC.EmojiStatus emojiStatus, boolean switchable, boolean animated, int a) { if (emojiStatusDrawable[a] == null) { @@ -9262,12 +9376,33 @@ private Drawable getEmojiStatusDrawable(TLRPC.EmojiStatus emojiStatus, boolean s emojiStatusDrawable[a].attach(); } } - if (emojiStatus instanceof TLRPC.TL_emojiStatus) { - emojiStatusDrawable[a].set(((TLRPC.TL_emojiStatus) emojiStatus).document_id, animated); - } else if (emojiStatus instanceof TLRPC.TL_emojiStatusUntil && ((TLRPC.TL_emojiStatusUntil) emojiStatus).until > (int) (System.currentTimeMillis() / 1000) && !reportSpam) { - emojiStatusDrawable[a].set(((TLRPC.TL_emojiStatusUntil) emojiStatus).document_id, animated); + if (a == 1) { + emojiStatusGiftId = null; + } + if (emojiStatus instanceof TLRPC.TL_emojiStatus && !reportSpam) { + final TLRPC.TL_emojiStatus status = (TLRPC.TL_emojiStatus) emojiStatus; + if ((status.flags & 1) == 0 || status.until > (int) (System.currentTimeMillis() / 1000)) { + emojiStatusDrawable[a].set(status.document_id, animated); + emojiStatusDrawable[a].setParticles(false, animated); + } else { + emojiStatusDrawable[a].set(getPremiumCrossfadeDrawable(a), animated); + emojiStatusDrawable[a].setParticles(false, animated); + } + } else if (emojiStatus instanceof TLRPC.TL_emojiStatusCollectible) { + final TLRPC.TL_emojiStatusCollectible status = (TLRPC.TL_emojiStatusCollectible) emojiStatus; + if ((status.flags & 1) == 0 || status.until > (int) (System.currentTimeMillis() / 1000)) { + if (a == 1) { + emojiStatusGiftId = status.collectible_id; + } + emojiStatusDrawable[a].set(status.document_id, animated); + emojiStatusDrawable[a].setParticles(true, animated); + } else { + emojiStatusDrawable[a].set(getPremiumCrossfadeDrawable(a), animated); + emojiStatusDrawable[a].setParticles(false, animated); + } } else { emojiStatusDrawable[a].set(getPremiumCrossfadeDrawable(a), animated); + emojiStatusDrawable[a].setParticles(false, animated); } updateEmojiStatusDrawableColor(); return emojiStatusDrawable[a]; @@ -9281,11 +9416,7 @@ private void updateEmojiStatusDrawableColor(float progress) { for (int a = 0; a < 2; ++a) { final int fromColor; if (peerColor != null && a == 1) { - fromColor = ColorUtils.blendARGB( - peerColor.getColor2(), - peerColor.hasColor6(Theme.isCurrentThemeDark()) ? peerColor.getColor5() : peerColor.getColor3(), - .5f - ); + fromColor = ColorUtils.blendARGB(peerColor.getStoryColor1(Theme.isCurrentThemeDark()), 0xFFFFFFFF, 0.25f); } else { fromColor = AndroidUtilities.getOffsetColor(getThemedColor(Theme.key_profile_verifiedBackground), getThemedColor(Theme.key_player_actionBarTitle), mediaHeaderAnimationProgress, 1.0f); } @@ -9293,6 +9424,9 @@ private void updateEmojiStatusDrawableColor(float progress) { if (emojiStatusDrawable[a] != null) { emojiStatusDrawable[a].setColor(color); } + if (botVerificationDrawable[a] != null) { + botVerificationDrawable[a].setColor(ColorUtils.blendARGB(ColorUtils.blendARGB(fromColor, 0x99ffffff, progress), getThemedColor(Theme.key_player_actionBarTitle), mediaHeaderAnimationProgress)); + } if (a == 1) { animatedStatusView.setColor(color); } @@ -9346,16 +9480,20 @@ private void updateProfileData(boolean reload) { } avatarDrawable.setInfo(currentAccount, user); - final int colorId = UserObject.getProfileColorId(user); - MessagesController.PeerColors peerColors = MessagesController.getInstance(currentAccount).profilePeerColors; final MessagesController.PeerColor wasPeerColor = peerColor; - peerColor = peerColors == null ? null : peerColors.getColor(colorId); + peerColor = MessagesController.PeerColor.fromCollectible(user.emoji_status); + if (peerColor == null) { + final int colorId = UserObject.getProfileColorId(user); + final MessagesController.PeerColors peerColors = MessagesController.getInstance(currentAccount).profilePeerColors; + peerColor = peerColors == null ? null : peerColors.getColor(colorId); + } if (wasPeerColor != peerColor) { updatedPeerColor(); } if (topView != null) { - topView.setBackgroundEmojiId(UserObject.getProfileEmojiId(user), true); + topView.setBackgroundEmojiId(UserObject.getProfileEmojiId(user), user != null && user.emoji_status instanceof TLRPC.TL_emojiStatusCollectible, true); } + setCollectibleGiftStatus(user.emoji_status instanceof TLRPC.TL_emojiStatusCollectible ? (TLRPC.TL_emojiStatusCollectible) user.emoji_status : null); final ImageLocation imageLocation = ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_BIG); final ImageLocation thumbLocation = ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL); @@ -9432,7 +9570,7 @@ private void updateProfileData(boolean reload) { } hasCustomPhoto = user.photo != null && user.photo.personal; try { - newString = Emoji.replaceEmoji(newString, nameTextView[1].getPaint().getFontMetricsInt(), AndroidUtilities.dp(24), false); + newString = Emoji.replaceEmoji(newString, nameTextView[1].getPaint().getFontMetricsInt(), false); } catch (Exception ignore) { } for (int a = 0; a < 2; a++) { @@ -9475,7 +9613,7 @@ private void updateProfileData(boolean reload) { nameTextView[a].setRightDrawable2(null); nameTextViewRightDrawable2ContentDescription = null; } - if (!getMessagesController().premiumFeaturesBlocked() && !MessagesController.isSupportUser(user) && (user.emoji_status instanceof TLRPC.TL_emojiStatus || user.emoji_status instanceof TLRPC.TL_emojiStatusUntil && ((TLRPC.TL_emojiStatusUntil) user.emoji_status).until > (int) (System.currentTimeMillis() / 1000))) { + if (user != null && !getMessagesController().premiumFeaturesBlocked() && !MessagesController.isSupportUser(user) && DialogObject.getEmojiStatusDocumentId(user.emoji_status) != 0) { rightIconIsStatus = true; rightIconIsPremium = false; nameTextView[a].setRightDrawable(getEmojiStatusDrawable(user.emoji_status, false, false, a)); @@ -9497,7 +9635,7 @@ private void updateProfileData(boolean reload) { } else { nameTextView[a].setRightDrawable2(null); } - if (!getMessagesController().premiumFeaturesBlocked() && !MessagesController.isSupportUser(user) && (user.emoji_status instanceof TLRPC.TL_emojiStatus || user.emoji_status instanceof TLRPC.TL_emojiStatusUntil && ((TLRPC.TL_emojiStatusUntil) user.emoji_status).until > (int) (System.currentTimeMillis() / 1000))) { + if (!getMessagesController().premiumFeaturesBlocked() && user != null && !MessagesController.isSupportUser(user) && DialogObject.getEmojiStatusDocumentId(user.emoji_status) != 0) { rightIconIsStatus = true; rightIconIsPremium = false; nameTextView[a].setRightDrawable(getEmojiStatusDrawable(user.emoji_status, true, true, a)); @@ -9509,6 +9647,12 @@ private void updateProfileData(boolean reload) { nameTextView[a].setRightDrawable(null); } } + if (leftIcon == null && currentEncryptedChat == null && user.bot_verification_icon != 0) { + nameTextView[a].setLeftDrawableOutside(true); + leftIcon = getBotVerificationDrawable(user.bot_verification_icon, false, a); + } else { + nameTextView[a].setLeftDrawableOutside(false); + } nameTextView[a].setLeftDrawable(leftIcon); if (a == 1 && (rightIconIsStatus || rightIconIsPremium)) { nameTextView[a].setRightDrawableOutside(true); @@ -9521,6 +9665,13 @@ private void updateProfileData(boolean reload) { if (!user.self && getMessagesController().isPremiumUser(user)) { final SimpleTextView textView = nameTextView[a]; nameTextView[a].setRightDrawableOnClick(v -> { + if (user.emoji_status instanceof TLRPC.TL_emojiStatusCollectible) { + TLRPC.TL_emojiStatusCollectible status = (TLRPC.TL_emojiStatusCollectible) user.emoji_status; + if (status != null) { + Browser.openUrl(getContext(), "https://" + getMessagesController().linkPrefix + "/nft/" + status.slug); + } + return; + } PremiumPreviewBottomSheet premiumPreviewBottomSheet = new PremiumPreviewBottomSheet(ProfileActivity.this, currentAccount, user, resourcesProvider); int[] coords = new int[2]; textView.getLocationOnScreen(coords); @@ -9612,16 +9763,20 @@ private void updateProfileData(boolean reload) { flagSecure.invalidate(); } - final int colorId = ChatObject.getProfileColorId(chat); - MessagesController.PeerColors peerColors = MessagesController.getInstance(currentAccount).profilePeerColors; final MessagesController.PeerColor wasPeerColor = peerColor; - peerColor = peerColors == null ? null : peerColors.getColor(colorId); + peerColor = MessagesController.PeerColor.fromCollectible(chat.emoji_status); + if (peerColor == null) { + final int colorId = ChatObject.getProfileColorId(chat); + MessagesController.PeerColors peerColors = MessagesController.getInstance(currentAccount).profilePeerColors; + peerColor = peerColors == null ? null : peerColors.getColor(colorId); + } if (wasPeerColor != peerColor) { updatedPeerColor(); } if (topView != null) { - topView.setBackgroundEmojiId(ChatObject.getProfileEmojiId(chat), true); + topView.setBackgroundEmojiId(ChatObject.getProfileEmojiId(chat), chat != null && chat.emoji_status instanceof TLRPC.TL_emojiStatusCollectible, true); } + setCollectibleGiftStatus(chat.emoji_status instanceof TLRPC.TL_emojiStatusCollectible ? (TLRPC.TL_emojiStatusCollectible) chat.emoji_status : null); if (isTopic) { topic = getMessagesController().getTopicsController().findTopic(chatId, topicId); @@ -9712,7 +9867,7 @@ private void updateProfileData(boolean reload) { if (isTopic) { CharSequence title = topic == null ? "" : topic.title; try { - title = Emoji.replaceEmoji(title, nameTextView[a].getPaint().getFontMetricsInt(), AndroidUtilities.dp(24), false); + title = Emoji.replaceEmoji(title, nameTextView[a].getPaint().getFontMetricsInt(), false); } catch (Exception ignore) { } if (nameTextView[a].setText(title)) { @@ -9721,13 +9876,14 @@ private void updateProfileData(boolean reload) { } else if (chat.title != null) { CharSequence title = chat.title; try { - title = Emoji.replaceEmoji(title, nameTextView[a].getPaint().getFontMetricsInt(), AndroidUtilities.dp(24), false); + title = Emoji.replaceEmoji(title, nameTextView[a].getPaint().getFontMetricsInt(), false); } catch (Exception ignore) { } if (nameTextView[a].setText(title)) { changed = true; } } + nameTextView[a].setLeftDrawableOutside(false); nameTextView[a].setLeftDrawable(null); nameTextView[a].setRightDrawableOutside(a == 0); nameTextView[a].setRightDrawableOnClick(null); @@ -9754,6 +9910,11 @@ private void updateProfileData(boolean reload) { preloadedChannelEmojiStatuses = true; getMediaDataController().loadRestrictedStatusEmojis(); } + } else if (chat.emoji_status instanceof TLRPC.TL_emojiStatusCollectible) { + final String slug = ((TLRPC.TL_emojiStatusCollectible) chat.emoji_status).slug; + nameTextView[a].setRightDrawableOnClick(v -> { + Browser.openUrl(getContext(), "https://" + getMessagesController().linkPrefix + "/nft/" + slug); + }); } } } else { @@ -9773,6 +9934,12 @@ private void updateProfileData(boolean reload) { nameTextView[a].setRightDrawable(null); } } + if (chat.bot_verification_icon != 0) { + nameTextView[a].setLeftDrawableOutside(true); + nameTextView[a].setLeftDrawable(getBotVerificationDrawable(chat.bot_verification_icon, false, a)); + } else { + nameTextView[a].setLeftDrawable(null); + } if (a == 0 && onlineTextOverride != null) { onlineTextView[a].setText(onlineTextOverride); } else { @@ -9881,31 +10048,28 @@ private void updatedPeerColor() { showStatusButton.setBackgroundColor(ColorUtils.blendARGB(Theme.multAlpha(Theme.adaptHSV(actionBarBackgroundColor, +0.18f, -0.1f), 0.5f), 0x23ffffff, currentExpandAnimatorValue)); } if (actionBar != null) { - actionBar.setItemsBackgroundColor(peerColor != null ? 0x20ffffff : getThemedColor(Theme.key_avatar_actionBarSelectorBlue), false); - - final int color = AvatarDrawable.getIconColorForId(userId != 0 || ChatObject.isChannel(chatId, currentAccount) && !currentChat.megagroup ? 5 : chatId, resourcesProvider); - final int iconColor = peerColor != null ? Color.WHITE : getThemedColor(Theme.key_actionBarDefaultIcon); - actionBar.setItemsColor(ColorUtils.blendARGB(iconColor, color, avatarAnimationProgress), false); + actionBar.setItemsColor(ColorUtils.blendARGB(peerColor != null ? Color.WHITE : getThemedColor(Theme.key_actionBarDefaultIcon), getThemedColor(Theme.key_actionBarActionModeDefaultIcon), mediaHeaderAnimationProgress), false); + actionBar.setItemsBackgroundColor(ColorUtils.blendARGB(peerColor != null ? Theme.ACTION_BAR_WHITE_SELECTOR_COLOR : peerColor != null ? 0x20ffffff : getThemedColor(Theme.key_avatar_actionBarSelectorBlue), getThemedColor(Theme.key_actionBarActionModeDefaultSelector), mediaHeaderAnimationProgress), false); } if (verifiedDrawable[1] != null) { - int color1 = peerColor != null ? Theme.adaptHSV(ColorUtils.blendARGB(peerColor.getColor2(), peerColor.hasColor6(Theme.isCurrentThemeDark()) ? peerColor.getColor5() : peerColor.getColor3(), .4f), +.1f, Theme.isCurrentThemeDark() ? -.1f : -.08f) : getThemedColor(Theme.key_profile_verifiedBackground); - int color2 = getThemedColor(Theme.key_player_actionBarTitle); + final int color1 = peerColor != null ? Theme.adaptHSV(ColorUtils.blendARGB(peerColor.getColor2(), peerColor.hasColor6(Theme.isCurrentThemeDark()) ? peerColor.getColor5() : peerColor.getColor3(), .4f), +.1f, Theme.isCurrentThemeDark() ? -.1f : -.08f) : getThemedColor(Theme.key_profile_verifiedBackground); + final int color2 = getThemedColor(Theme.key_player_actionBarTitle); verifiedDrawable[1].setColorFilter(AndroidUtilities.getOffsetColor(color1, color2, mediaHeaderAnimationProgress, 1.0f), PorterDuff.Mode.MULTIPLY); } if (verifiedCheckDrawable[1] != null) { - int color1 = peerColor != null ? Color.WHITE : applyPeerColor(getThemedColor(Theme.key_profile_verifiedCheck)); - int color2 = getThemedColor(Theme.key_windowBackgroundWhite); + final int color1 = peerColor != null ? Color.WHITE : dontApplyPeerColor(getThemedColor(Theme.key_profile_verifiedCheck)); + final int color2 = getThemedColor(Theme.key_windowBackgroundWhite); verifiedCheckDrawable[1].setColorFilter(AndroidUtilities.getOffsetColor(color1, color2, mediaHeaderAnimationProgress, 1.0f), PorterDuff.Mode.MULTIPLY); } if (nameTextView[1] != null) { - nameTextView[1].setTextColor(ColorUtils.blendARGB(peerColor != null ? Color.WHITE : getThemedColor(Theme.key_profile_title), Color.WHITE, currentExpandAnimatorValue)); + nameTextView[1].setTextColor(ColorUtils.blendARGB(ColorUtils.blendARGB(peerColor != null ? Color.WHITE : getThemedColor(Theme.key_profile_title), getThemedColor(Theme.key_player_actionBarTitle), mediaHeaderAnimationProgress), Color.WHITE, currentExpandAnimatorValue)); } if (autoDeletePopupWrapper != null && autoDeletePopupWrapper.textView != null) { autoDeletePopupWrapper.textView.invalidate(); } AndroidUtilities.forEachViews(listView, view -> { if (view instanceof HeaderCell) { - ((HeaderCell) view).setTextColor(applyPeerColor(getThemedColor(Theme.key_windowBackgroundWhiteBlueHeader), false)); + ((HeaderCell) view).setTextColor(dontApplyPeerColor(getThemedColor(Theme.key_windowBackgroundWhiteBlueHeader), false)); } else if (view instanceof TextDetailCell) { ((TextDetailCell) view).updateColors(); } else if (view instanceof TextCell) { @@ -9930,15 +10094,19 @@ private void updatedPeerColor() { updateEmojiStatusDrawableColor(); } - private int applyPeerColor(int color) { - return applyPeerColor(color, true, null); + private int dontApplyPeerColor(int color) { + return dontApplyPeerColor(color, true, null); } - private int applyPeerColor(int color, boolean actionBar) { - return applyPeerColor(color, actionBar, null); + private int dontApplyPeerColor(int color, boolean actionBar) { + return dontApplyPeerColor(color, actionBar, null); } private final SparseIntArray adaptedColors = new SparseIntArray(); + private int dontApplyPeerColor(int color, boolean actionBar, Boolean online) { + return color; + } + private int applyPeerColor(int color, boolean actionBar, Boolean online) { if (!actionBar && isSettings()) return color; if (peerColor != null) { @@ -10054,7 +10222,6 @@ private void createActionBarMenu(boolean animated) { if (currentEncryptedChat == null) { createAutoDeleteItem(context); } - if (!TextUtils.isEmpty(user.phone)) { otherItem.addSubItem(share_contact, R.drawable.msg_share, LocaleController.getString(R.string.ShareContact)); } @@ -10120,6 +10287,11 @@ private void createActionBarMenu(boolean animated) { if (ChatObject.isPublic(chat)) { otherItem.addSubItem(share, R.drawable.msg_share, LocaleController.getString(R.string.BotShare)); } + if (!BuildVars.IS_BILLING_UNAVAILABLE && !getMessagesController().premiumPurchaseBlocked()) { + StarsController.getInstance(currentAccount).loadStarGifts(); + otherItem.addSubItem(gift_premium, R.drawable.msg_gift_premium, LocaleController.getString(R.string.ProfileSendAGiftToChannel)); + otherItem.setSubItemShown(gift_premium, chatInfo != null && chatInfo.stargifts_available); + } if (chatInfo != null && chatInfo.linked_chat_id != 0) { otherItem.addSubItem(view_discussion, R.drawable.msg_discussion, LocaleController.getString(R.string.ViewDiscussion)); } @@ -10260,7 +10432,7 @@ public void showGlobalAutoDeleteScreen() { } }, false, 0, resourcesProvider); if (dialogId > 0 || userId > 0) { - int linkColor = applyPeerColor(getThemedColor(Theme.key_windowBackgroundWhiteBlueText), false); + int linkColor = dontApplyPeerColor(getThemedColor(Theme.key_windowBackgroundWhiteBlueText), false); autoDeletePopupWrapper.allowExtendedHint(linkColor); } int ttl = 0; @@ -10578,7 +10750,7 @@ public void onUploadProgressChanged(float progress) { } @Override - public void didStartUpload(boolean isVideo) { + public void didStartUpload(boolean fromAvatarConstructor, boolean isVideo) { if (avatarProgressView == null) { return; } @@ -10927,7 +11099,7 @@ public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType final TextDetailCell textDetailCell = new TextDetailCell(mContext, resourcesProvider, viewType == VIEW_TYPE_TEXT_DETAIL_MULTILINE) { @Override protected int processColor(int color) { - return applyPeerColor(color, false); + return dontApplyPeerColor(color, false); } }; textDetailCell.setContentDescriptionValueFirst(true); @@ -10953,7 +11125,7 @@ protected void didResizeStart() { @Override protected int processColor(int color) { - return applyPeerColor(color, false); + return dontApplyPeerColor(color, false); } }; view.setBackgroundColor(getThemedColor(Theme.key_windowBackgroundWhite)); @@ -10963,7 +11135,7 @@ protected int processColor(int color) { view = new TextCell(mContext, resourcesProvider) { @Override protected int processColor(int color) { - return applyPeerColor(color, false); + return dontApplyPeerColor(color, false); } }; view.setBackgroundColor(getThemedColor(Theme.key_windowBackgroundWhite)); @@ -10979,7 +11151,7 @@ protected int processColor(int color) { view = new NotificationsCheckCell(mContext, 23, 70, false, resourcesProvider) { @Override protected int processColor(int color) { - return applyPeerColor(color, false); + return dontApplyPeerColor(color, false); } }; view.setBackgroundColor(getThemedColor(Theme.key_windowBackgroundWhite)); @@ -11075,7 +11247,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { view = new ProfileHoursCell(mContext, resourcesProvider) { @Override protected int processColor(int color) { - return applyPeerColor(color, false); + return dontApplyPeerColor(color, false); } }; view.setBackgroundColor(getThemedColor(Theme.key_windowBackgroundWhite)); @@ -11155,7 +11327,7 @@ protected void onNoClick(int type) { view = new ProfileChannelCell(ProfileActivity.this) { @Override public int processColor(int color) { - return applyPeerColor(color, false); + return dontApplyPeerColor(color, false); } }; view.setBackgroundColor(getThemedColor(Theme.key_windowBackgroundWhite)); @@ -11221,7 +11393,7 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { } else if (position == botPermissionsHeader) { headerCell.setText(LocaleController.getString(R.string.BotProfilePermissions)); } - headerCell.setTextColor(applyPeerColor(getThemedColor(Theme.key_windowBackgroundWhiteBlueHeader), false)); + headerCell.setTextColor(dontApplyPeerColor(getThemedColor(Theme.key_windowBackgroundWhiteBlueHeader), false)); break; case VIEW_TYPE_TEXT_DETAIL_MULTILINE: case VIEW_TYPE_TEXT_DETAIL: @@ -11378,12 +11550,12 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { } if (containsGift) { Drawable drawable = ContextCompat.getDrawable(detailCell.getContext(), R.drawable.msg_input_gift); - drawable.setColorFilter(new PorterDuffColorFilter(applyPeerColor(getThemedColor(Theme.key_switch2TrackChecked), false), PorterDuff.Mode.MULTIPLY)); + drawable.setColorFilter(new PorterDuffColorFilter(dontApplyPeerColor(getThemedColor(Theme.key_switch2TrackChecked), false), PorterDuff.Mode.MULTIPLY)); detailCell.setImage(drawable, LocaleController.getString(R.string.GiftPremium)); detailCell.setImageClickListener(ProfileActivity.this::onTextDetailCellImageClicked); } else if (containsQr) { Drawable drawable = ContextCompat.getDrawable(detailCell.getContext(), R.drawable.msg_qr_mini); - drawable.setColorFilter(new PorterDuffColorFilter(applyPeerColor(getThemedColor(Theme.key_switch2TrackChecked), false), PorterDuff.Mode.MULTIPLY)); + drawable.setColorFilter(new PorterDuffColorFilter(dontApplyPeerColor(getThemedColor(Theme.key_switch2TrackChecked), false), PorterDuff.Mode.MULTIPLY)); detailCell.setImage(drawable, LocaleController.getString(R.string.GetQRCode)); detailCell.setImageClickListener(ProfileActivity.this::onTextDetailCellImageClicked); } else { @@ -11614,7 +11786,7 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { } else if (position == botPermissionEmojiStatus) { textCell.setTextAndCheckAndColorfulIcon(LocaleController.getString(R.string.BotProfilePermissionEmojiStatus), userInfo != null && userInfo.bot_can_manage_emoji_status, R.drawable.filled_access_sleeping, getThemedColor(Theme.key_color_lightblue), botPermissionLocation != -1 || botPermissionBiometry != -1); } - textCell.valueTextView.setTextColor(applyPeerColor(getThemedColor(Theme.key_windowBackgroundWhiteValueText), false)); + textCell.valueTextView.setTextColor(dontApplyPeerColor(getThemedColor(Theme.key_windowBackgroundWhiteValueText), false)); break; case VIEW_TYPE_NOTIFICATIONS_CHECK: NotificationsCheckCell checkCell = (NotificationsCheckCell) holder.itemView; @@ -11691,14 +11863,59 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { break; case VIEW_TYPE_SHADOW_TEXT: { TextInfoPrivacyCell cell = (TextInfoPrivacyCell) holder.itemView; + cell.setLinkTextRippleColor(null); if (position == infoSectionRow) { - if (botAppRow >= 0) { + final long did = getDialogId(); + TLObject obj = getMessagesController().getUserOrChat(did); + TL_bots.botVerification bot_verification = userInfo != null ? userInfo.bot_verification : chatInfo != null ? chatInfo.bot_verification : null; + if (botAppRow >= 0 || bot_verification != null) { + cell.setFixedSize(0); final TLRPC.User user = getMessagesController().getUser(userId); final boolean botOwner = user != null && user.bot && user.bot_can_edit; - cell.setFixedSize(0); - cell.setText(AndroidUtilities.replaceSingleTag(getString(botOwner ? R.string.ProfileBotOpenAppInfoOwner : R.string.ProfileBotOpenAppInfo), () -> { - Browser.openUrl(getContext(), getString(botOwner ? R.string.ProfileBotOpenAppInfoOwnerLink : R.string.ProfileBotOpenAppInfoLink)); - })); + SpannableStringBuilder sb = new SpannableStringBuilder(); + + if (botAppRow >= 0) { + sb.append(AndroidUtilities.replaceSingleTag(getString(botOwner ? R.string.ProfileBotOpenAppInfoOwner : R.string.ProfileBotOpenAppInfo), () -> { + Browser.openUrl(getContext(), getString(botOwner ? R.string.ProfileBotOpenAppInfoOwnerLink : R.string.ProfileBotOpenAppInfoLink)); + })); + if (bot_verification != null) { + sb.append("\n\n\n"); + } + } + if (bot_verification != null) { + sb.append("x"); + sb.setSpan(new AnimatedEmojiSpan(bot_verification.icon, cell.getTextView().getPaint().getFontMetricsInt()), sb.length() - 1, sb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + sb.append(" "); + SpannableString description = new SpannableString(bot_verification.description); + try { + AndroidUtilities.addLinksSafe(description, Linkify.WEB_URLS, false, false); + URLSpan[] spans = description.getSpans(0, description.length(), URLSpan.class); + for (int i = 0; i < spans.length; ++i) { + URLSpan span = spans[i]; + int start = description.getSpanStart(span); + int end = description.getSpanEnd(span); + final String url = span.getURL(); + + description.removeSpan(span); + description.setSpan(new URLSpan(url) { + @Override + public void onClick(View widget) { + Browser.openUrl(getContext(), url); + } + @Override + public void updateDrawState(@NonNull TextPaint ds) { + ds.setUnderlineText(true); + } + }, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + } + } catch (Exception e) { + FileLog.e(e); + } + sb.append(description); + } + + cell.setLinkTextRippleColor(Theme.multAlpha(getThemedColor(Theme.key_windowBackgroundWhiteGrayText4), 0.2f)); + cell.setText(sb); } else { cell.setFixedSize(14); cell.setText(null); @@ -11840,7 +12057,7 @@ private CharSequence alsoUsernamesString(String originalUsername, ArrayList { - TLRPC.TL_account_updateBusinessWorkHours req = new TLRPC.TL_account_updateBusinessWorkHours(); + TL_account.updateBusinessWorkHours req = new TL_account.updateBusinessWorkHours(); if (userFull != null) { userFull.business_work_hours = null; userFull.flags2 &=~ 1; @@ -13845,7 +14060,7 @@ private boolean editRow(View view, int position) { builder.setTitle(LocaleController.getString(R.string.BusinessLocationClearTitle)); builder.setMessage(LocaleController.getString(R.string.BusinessLocationClearMessage)); builder.setPositiveButton(LocaleController.getString(R.string.Remove), (di, w) -> { - TLRPC.TL_account_updateBusinessLocation req = new TLRPC.TL_account_updateBusinessLocation(); + TL_account.updateBusinessLocation req = new TL_account.updateBusinessLocation(); if (userFull != null) { userFull.business_location = null; userFull.flags2 &=~ 2; @@ -13879,10 +14094,10 @@ private boolean editRow(View view, int position) { } else if (position == birthdayRow) { itemOptions.add(R.drawable.msg_edit, getString(R.string.ProfileBirthdayChange), () -> { showDialog(AlertsCreator.createBirthdayPickerDialog(getContext(), getString(R.string.EditProfileBirthdayTitle), getString(R.string.EditProfileBirthdayButton), userFull.birthday, birthday -> { - TLRPC.TL_account_updateBirthday req = new TLRPC.TL_account_updateBirthday(); + TL_account.updateBirthday req = new TL_account.updateBirthday(); req.flags |= 1; req.birthday = birthday; - TLRPC.TL_birthday oldBirthday = userFull != null ? userFull.birthday : null; + TL_account.TL_birthday oldBirthday = userFull != null ? userFull.birthday : null; if (userFull != null) { userFull.flags2 |= 32; userFull.birthday = birthday; @@ -13932,7 +14147,7 @@ private boolean editRow(View view, int position) { builder.setTitle(LocaleController.getString(R.string.BirthdayClearTitle)); builder.setMessage(LocaleController.getString(R.string.BirthdayClearMessage)); builder.setPositiveButton(LocaleController.getString(R.string.Remove), (di, w) -> { - TLRPC.TL_account_updateBirthday req = new TLRPC.TL_account_updateBirthday(); + TL_account.updateBirthday req = new TL_account.updateBirthday(); if (userFull != null) { userFull.birthday = null; userFull.flags2 &=~ 32; @@ -13966,7 +14181,7 @@ private boolean editRow(View view, int position) { builder.setTitle(LocaleController.getString(R.string.ProfileChannelClearTitle)); builder.setMessage(LocaleController.getString(R.string.ProfileChannelClearMessage)); builder.setPositiveButton(LocaleController.getString(R.string.Remove), (di, w) -> { - TLRPC.TL_account_updatePersonalChannel req = new TLRPC.TL_account_updatePersonalChannel(); + TL_account.updatePersonalChannel req = new TL_account.updatePersonalChannel(); req.channel = new TLRPC.TL_inputChannelEmpty(); if (userFull != null) { userFull.personal_channel_id = 0; @@ -13998,7 +14213,7 @@ private boolean editRow(View view, int position) { } private void updateItemsUsername() { - if (!myProfile) return; + if (!myProfile || setUsernameItem == null || linkItem == null) return; TLRPC.User user = getMessagesController().getUser(userId); if (user == null) { return; @@ -14038,4 +14253,58 @@ public boolean hasPrivacyCommand() { return true; } + + private HintView2 collectibleHint; + private int collectibleHintBackgroundColor; + private Boolean collectibleHintVisible; + private TLRPC.TL_emojiStatusCollectible collectibleStatus; + + public void setCollectibleGiftStatus(TLRPC.TL_emojiStatusCollectible status) { + if (avatarContainer2 == null) return; + if (collectibleStatus == status) return; + if (collectibleStatus != null && status != null && collectibleStatus.collectible_id == status.collectible_id) return; + collectibleStatus = status; + if (collectibleHint != null) { + collectibleHint.hide(); + } + if (status != null && !TextUtils.isEmpty(status.slug)) { + collectibleHintVisible = null; + collectibleHint = new HintView2(getContext(), HintView2.DIRECTION_BOTTOM); + collectibleHintBackgroundColor = Theme.blendOver(status.center_color | 0xFF000000, Theme.multAlpha(status.pattern_color | 0xFF000000, .5f)); + collectibleHint.setPadding(dp(4), 0, dp(4), dp(2)); + collectibleHint.setFlicker(.66f, Theme.multAlpha(status.text_color | 0xFF000000, 0.5f)); + avatarContainer2.addView(collectibleHint, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 24)); + collectibleHint.setTextSize(9.33f); + collectibleHint.setTextTypeface(AndroidUtilities.bold()); + collectibleHint.setText(status.title); + collectibleHint.setDuration(-1); + collectibleHint.setInnerPadding(4.66f + 1, 2.66f, 4.66f + 1, 2.66f); + collectibleHint.setArrowSize(4, 2.66f); + collectibleHint.setRoundingWithCornerEffect(false); + collectibleHint.setRounding(16); + collectibleHint.show(); + final String slug = status.slug; + collectibleHint.setOnClickListener(v -> { + Browser.openUrl(getContext(), "https://" + getMessagesController().linkPrefix + "/nft/" + slug); + }); + if (extraHeight < dp(82)) { + collectibleHintVisible = false; + collectibleHint.setAlpha(0.0f); + } + updateCollectibleHint(); + } + } + + public void updateCollectibleHint() { + if (collectibleHint == null) return; + collectibleHint.setJointPx(0, -collectibleHint.getPaddingLeft() + nameTextView[1].getX() + (nameTextView[1].getRightDrawableX() - nameTextView[1].getRightDrawableWidth() * lerp(0.45f, 0.25f, currentExpandAnimatorValue)) * nameTextView[1].getScaleX()); + final float expanded = AndroidUtilities.lerp(expandAnimatorValues, currentExpanAnimatorFracture); + collectibleHint.setTranslationY(-collectibleHint.getPaddingBottom() + nameTextView[1].getY() - dp(24) + lerp(dp(6), -dp(12), expanded)); + collectibleHint.setBgColor(ColorUtils.blendARGB(collectibleHintBackgroundColor, 0x50000000, expanded)); + final boolean visible = extraHeight >= dp(82); + if (collectibleHintVisible == null || collectibleHintVisible != visible) { + collectibleHint.animate().alpha((collectibleHintVisible = visible) ? 1.0f : 0.0f).setInterpolator(CubicBezierInterpolator.EASE_OUT).setDuration(200).start(); + } + } + } \ No newline at end of file diff --git a/TMessagesProj/src/main/java/org/telegram/ui/QrActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/QrActivity.java index 7ee83921c2..c773e11395 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/QrActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/QrActivity.java @@ -858,7 +858,7 @@ public void setForShare(boolean enable) { shareUsernameLayoutPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rcondensedbold.ttf")); shareUsernameLayoutPaint.setTextSize(AndroidUtilities.dp(25)); CharSequence text = this.username == null ? "" : this.username; - text = Emoji.replaceEmoji(text, shareUsernameLayoutPaint.getFontMetricsInt(), AndroidUtilities.dp(20), false); + text = Emoji.replaceEmoji(text, shareUsernameLayoutPaint.getFontMetricsInt(), false); shareUsernameLayout = StaticLayoutEx.createStaticLayout(text, shareUsernameLayoutPaint, getWidth(), Layout.Alignment.ALIGN_CENTER, 1f, 0, false, TextUtils.TruncateAt.END, getWidth() - AndroidUtilities.dp(60), 1); } else { shareUsernameLayout = null; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ReactionsDoubleTapManageActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ReactionsDoubleTapManageActivity.java index 07e1c1b8df..79af6329d9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ReactionsDoubleTapManageActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ReactionsDoubleTapManageActivity.java @@ -24,6 +24,7 @@ import org.telegram.messenger.R; import org.telegram.messenger.UserConfig; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_stars; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.Theme; @@ -285,7 +286,7 @@ public void showSelectStatusDialog(SetDefaultReactionCell cell) { } SelectAnimatedEmojiDialog popupLayout = new SelectAnimatedEmojiDialog(this, getContext(), false, xoff, SelectAnimatedEmojiDialog.TYPE_SET_DEFAULT_REACTION, null) { @Override - protected void onEmojiSelected(View emojiView, Long documentId, TLRPC.Document document, Integer until) { + protected void onEmojiSelected(View emojiView, Long documentId, TLRPC.Document document, TL_stars.TL_starGiftUnique gift, Integer until) { if (documentId == null) { return; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SecretMediaViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/SecretMediaViewer.java index 29cdee73d6..b7d22d07c5 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SecretMediaViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SecretMediaViewer.java @@ -32,7 +32,6 @@ import android.graphics.SurfaceTexture; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.ColorDrawable; -import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; import androidx.annotation.Keep; @@ -49,19 +48,15 @@ import android.text.TextPaint; import android.text.TextUtils; import android.text.style.ClickableSpan; -import android.text.style.URLSpan; -import android.transition.ChangeBounds; import android.transition.Fade; import android.transition.Transition; import android.transition.TransitionManager; import android.transition.TransitionSet; import android.transition.TransitionValues; -import android.util.Log; import android.util.Property; import android.util.SparseArray; import android.view.GestureDetector; import android.view.Gravity; -import android.view.HapticFeedbackConstants; import android.view.MotionEvent; import android.view.TextureView; import android.view.VelocityTracker; @@ -80,8 +75,6 @@ import com.google.android.exoplayer2.ui.AspectRatioFrameLayout; import org.telegram.messenger.AndroidUtilities; -import org.telegram.messenger.ChatObject; -import org.telegram.messenger.DialogObject; import org.telegram.messenger.Emoji; import org.telegram.messenger.ImageLocation; import org.telegram.messenger.ImageReceiver; @@ -94,36 +87,28 @@ import org.telegram.messenger.R; import org.telegram.messenger.SharedConfig; import org.telegram.messenger.UserConfig; -import org.telegram.messenger.UserObject; -import org.telegram.messenger.Utilities; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.ActionBar; -import org.telegram.ui.ActionBar.BottomSheet; import org.telegram.ui.ActionBar.SimpleTextView; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Cells.TextSelectionHelper; -import org.telegram.ui.Components.AlertsCreator; import org.telegram.ui.Components.AnimatedEmojiDrawable; import org.telegram.ui.Components.AnimatedEmojiSpan; import org.telegram.ui.Components.AnimationProperties; -import org.telegram.ui.Components.BulletinFactory; import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.PlayPauseDrawable; import org.telegram.ui.Components.RLottieDrawable; -import org.telegram.ui.Components.RadialProgressView; import org.telegram.ui.Components.Scroller; import org.telegram.ui.Components.TimerParticles; import org.telegram.ui.Components.TranslateAlert2; -import org.telegram.ui.Components.URLSpanReplacement; import org.telegram.ui.Components.VideoPlayer; import org.telegram.ui.Components.VideoPlayerSeekBar; import org.telegram.ui.Stories.DarkThemeResourceProvider; import org.telegram.ui.Stories.recorder.HintView2; import java.io.File; -import java.net.URLEncoder; import java.util.ArrayList; import java.util.Arrays; import java.util.Locale; @@ -1202,9 +1187,9 @@ public void onAnimationEnd(Animator animation) { if (messageObject.isVideo()) { MessageObject.addUrlsByPattern(messageObject.isOutOwner(), spannableString, false, 3, (int) messageObject.getDuration(), false); } - str = Emoji.replaceEmoji(spannableString, captionTextView.getPaint().getFontMetricsInt(), dp(20), false); + str = Emoji.replaceEmoji(spannableString, captionTextView.getPaint().getFontMetricsInt(), false); } else { - str = Emoji.replaceEmoji(new SpannableStringBuilder(caption), captionTextView.getPaint().getFontMetricsInt(), dp(20), false); + str = Emoji.replaceEmoji(new SpannableStringBuilder(caption), captionTextView.getPaint().getFontMetricsInt(), false); } captionTextViewSwitcher.setTag(str); try { @@ -1260,7 +1245,7 @@ private void onLinkClick(ClickableSpan link, TextView widget) { // } } - private void onLinkLongPress(URLSpan link, TextView widget, Runnable onDismiss) { + private void onLinkLongPress(ClickableSpan link, TextView widget, Runnable onDismiss) { // int timestamp = -1; // BottomSheet.Builder builder = new BottomSheet.Builder(parentActivity, false, resourcesProvider, 0xff1C2229); // if (link.getURL().startsWith("video?")) { @@ -1403,7 +1388,7 @@ public void openMedia(MessageObject messageObject, PhotoViewer.PhotoViewerProvid if (parentActivity == null || messageObject == null || !messageObject.needDrawBluredPreview() || provider == null) { return; } - final PhotoViewer.PlaceProviderObject object = provider.getPlaceForPhoto(messageObject, null, 0, true); + final PhotoViewer.PlaceProviderObject object = provider.getPlaceForPhoto(messageObject, null, 0, true, false); if (object == null) { return; } @@ -2031,7 +2016,7 @@ public boolean closePhoto(boolean animated, boolean byDelete) { if (currentProvider == null || currentMessageObject.messageOwner.media.photo instanceof TLRPC.TL_photoEmpty || currentMessageObject.messageOwner.media.document instanceof TLRPC.TL_documentEmpty) { object = null; } else { - object = currentProvider.getPlaceForPhoto(currentMessageObject, null, 0, true); + object = currentProvider.getPlaceForPhoto(currentMessageObject, null, 0, true, false); } if (videoPlayer != null) { videoPlayer.pause(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SelectAnimatedEmojiDialog.java b/TMessagesProj/src/main/java/org/telegram/ui/SelectAnimatedEmojiDialog.java index da7e9a0acf..f2968cd411 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SelectAnimatedEmojiDialog.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SelectAnimatedEmojiDialog.java @@ -2,6 +2,7 @@ import static org.telegram.messenger.AndroidUtilities.dp; import static org.telegram.messenger.AndroidUtilities.translitSafe; +import static org.telegram.ui.Stars.StarsController.findAttribute; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -92,6 +93,8 @@ import org.telegram.messenger.Utilities; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; +import org.telegram.tgnet.tl.TL_stars; import org.telegram.ui.ActionBar.ActionBarMenuItem; import org.telegram.ui.ActionBar.ActionBarPopupWindow; import org.telegram.ui.ActionBar.AlertDialog; @@ -124,6 +127,8 @@ import org.telegram.ui.Components.RecyclerListView; import org.telegram.ui.Components.SearchStateDrawable; import org.telegram.ui.Components.StickerCategoriesListView; +import org.telegram.ui.Stars.StarsController; +import org.telegram.ui.Stars.StarsReactionsSheet; import java.lang.reflect.Field; import java.util.ArrayList; @@ -170,6 +175,9 @@ public boolean isBottom() { private int topReactionsEndRow; private int recentReactionsSectionRow; private int popularSectionRow; + private int giftsSectionRow; + private int giftsStartRow; + private int giftsEndRow; private int longtapHintRow; private int defaultTopicIconRow; private int topicEmojiHeaderRow; @@ -430,6 +438,7 @@ public void dismiss() { private ArrayList installedEmojiSets = new ArrayList<>(); private boolean recentExpanded = false; private ArrayList recent = new ArrayList<>(); + private ArrayList gifts = new ArrayList<>(); private ArrayList recentStickers = new ArrayList<>(); private ArrayList standardEmojis = new ArrayList<>(); private ArrayList topReactions = new ArrayList<>(); @@ -525,12 +534,11 @@ protected void onDraw(Canvas canvas) { } }; - boolean needBackgroundShadow = type == TYPE_TOPIC_ICON || type == TYPE_AVATAR_CONSTRUCTOR; - + final boolean needBackgroundShadow = type == TYPE_TOPIC_ICON || type == TYPE_AVATAR_CONSTRUCTOR; + final boolean clipWithPath = Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP || needBackgroundShadow; contentView = new FrameLayout(context) { private final Path pathApi20 = new Path(); private final Paint paintApi20 = new Paint(Paint.ANTI_ALIAS_FLAG); - private final boolean beforeLollipop = Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP; @Override protected void dispatchDraw(Canvas canvas) { @@ -538,7 +546,7 @@ protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); return; } - if (beforeLollipop) { + if (clipWithPath) { canvas.save(); if (needBackgroundShadow) { Theme.applyDefaultShadow(paintApi20); @@ -575,7 +583,7 @@ protected void dispatchDraw(Canvas canvas) { } }; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && type != TYPE_AVATAR_CONSTRUCTOR) { + if (!clipWithPath) { contentView.setOutlineProvider(new ViewOutlineProvider() { private final Rect rect = new Rect(); @@ -632,7 +640,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { boolean showSettings = baseFragment != null && type != TYPE_TOPIC_ICON && type != TYPE_CHAT_REACTIONS && type != TYPE_SET_REPLY_ICON && type != TYPE_SET_REPLY_ICON_BOTTOM && type != TYPE_AVATAR_CONSTRUCTOR && type != TYPE_EMOJI_STATUS_CHANNEL && type != TYPE_EMOJI_STATUS_CHANNEL_TOP && shouldDrawBackground; for (int i = 0; i < 2; i++) { - EmojiTabsStrip emojiTabs = new EmojiTabsStrip(context, resourcesProvider, true, false, true, type, showSettings ? () -> { + EmojiTabsStrip emojiTabs = new EmojiTabsStrip(context, resourcesProvider, true, type == TYPE_EMOJI_STATUS || type == TYPE_EMOJI_STATUS_TOP || type == TYPE_EMOJI_STATUS_CHANNEL || type == TYPE_EMOJI_STATUS_CHANNEL_TOP, false, true, type, showSettings ? () -> { search(null, false, false); onSettings(); baseFragment.presentFragment(new StickersActivity(MediaDataController.TYPE_EMOJIPACKS, frozenEmojiPacks)); @@ -665,8 +673,11 @@ protected boolean onTabClick(int index) { index--; } int position = 0; - if (index > 0 && sectionToPosition.indexOfKey(index - 1) >= 0) { - position = sectionToPosition.get(index - 1); + int f = 1 + (isGiftsVisible() ? 1 : 0); + if (isGiftsVisible() && index == 1) { + position = giftsSectionRow; + } else if (index > 0 && sectionToPosition.indexOfKey(index - f) >= 0) { + position = sectionToPosition.get(index - f); } scrollToPosition(position, AndroidUtilities.dp(-2 + (type == TYPE_CHAT_REACTIONS ? 7 : 0))); SelectAnimatedEmojiDialog.this.emojiTabs.select(index); @@ -786,7 +797,7 @@ public void onEnd() { layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { @Override public int getSpanSize(int position) { - if (positionToSection.indexOfKey(position) >= 0 || positionToButton.indexOfKey(position) >= 0 || position == recentReactionsSectionRow || position == stickersSectionRow || position == popularSectionRow || position == longtapHintRow || position == searchRow || position == topicEmojiHeaderRow) { + if (positionToSection.indexOfKey(position) >= 0 || positionToButton.indexOfKey(position) >= 0 || position == recentReactionsSectionRow || position == stickersSectionRow || position == giftsSectionRow || position == popularSectionRow || position == longtapHintRow || position == searchRow || position == topicEmojiHeaderRow) { return layoutManager.getSpanCount(); } else if (position >= stickersStartRow && position < stickersEndRow) { return 8; @@ -948,14 +959,16 @@ public boolean onItemClick(View view, int position, float x, float y) { if (type == TYPE_TAGS || type == TYPE_STICKER_SET_EMOJI) return false; if (view instanceof ImageViewEmoji && (type == TYPE_REACTIONS || type == TYPE_EXPANDABLE_REACTIONS)) { incrementHintUse(); - performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} ImageViewEmoji imageViewEmoji = (ImageViewEmoji) view; if (!imageViewEmoji.isDefaultReaction && !UserConfig.getInstance(currentAccount).isPremium()) { TLRPC.Document document = imageViewEmoji.span.document; if (document == null) { document = AnimatedEmojiDrawable.findDocument(currentAccount, imageViewEmoji.span.documentId); } - onEmojiSelected(imageViewEmoji, imageViewEmoji.span.documentId, document, null); + onEmojiSelected(imageViewEmoji, imageViewEmoji.span.documentId, document, imageViewEmoji.starGift, null); return true; } selectedReactionView = imageViewEmoji; @@ -975,6 +988,7 @@ public boolean onItemClick(View view, int position, float x, float y) { return true; } if (view instanceof ImageViewEmoji && ((ImageViewEmoji) view).span != null && (type == TYPE_EMOJI_STATUS || type == TYPE_EMOJI_STATUS_TOP || type == TYPE_EMOJI_STATUS_CHANNEL || type == TYPE_EMOJI_STATUS_CHANNEL_TOP)) { + final TL_stars.TL_starGiftUnique gift = ((ImageViewEmoji) view).starGift; SelectStatusDurationDialog dialog = selectStatusDateDialog = new SelectStatusDurationDialog(context, dismiss, SelectAnimatedEmojiDialog.this, (ImageViewEmoji) view, resourcesProvider) { @Override protected boolean getOutBounds(Rect rect) { @@ -990,8 +1004,10 @@ protected void onEndPartly(Integer date) { incrementHintUse(); TLRPC.TL_emojiStatus status = new TLRPC.TL_emojiStatus(); status.document_id = ((ImageViewEmoji) view).span.documentId; - onEmojiSelected(view, status.document_id, ((ImageViewEmoji) view).span.document, date); - MediaDataController.getInstance(currentAccount).pushRecentEmojiStatus(status); + onEmojiSelected(view, status.document_id, ((ImageViewEmoji) view).span.document, gift, date); + if (gift == null) { + MediaDataController.getInstance(currentAccount).pushRecentEmojiStatus(status); + } } @Override @@ -1143,9 +1159,9 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { private void onStickerClick(ImageViewEmoji viewEmoji, TLRPC.Document document) { if (type == TYPE_CHAT_REACTIONS) { - onEmojiSelected(viewEmoji, document.id, document, null); + onEmojiSelected(viewEmoji, document.id, document, viewEmoji.starGift, null); } else { - onEmojiSelected(viewEmoji, null, document, null); + onEmojiSelected(viewEmoji, null, document, viewEmoji.starGift, null); } } @@ -1182,7 +1198,7 @@ private void onRecentLongClick() { builder.setTitle(LocaleController.getString(R.string.ClearRecentEmojiStatusesTitle)); builder.setMessage(LocaleController.getString(R.string.ClearRecentEmojiStatusesText)); builder.setPositiveButton(LocaleController.getString(R.string.Clear), (dialogInterface, i) -> { - ConnectionsManager.getInstance(currentAccount).sendRequest(new TLRPC.TL_account_clearRecentEmojiStatuses(), null); + ConnectionsManager.getInstance(currentAccount).sendRequest(new TL_account.clearRecentEmojiStatuses(), null); MediaDataController.getInstance(currentAccount).clearRecentEmojiStatuses(); updateRows(false, true); }); @@ -1235,19 +1251,19 @@ private void setDim(float dim, boolean animated) { private void updateTabsPosition(int position) { if (position != RecyclerView.NO_POSITION) { final int recentmaxlen = SPAN_COUNT_FOR_EMOJI * RECENT_MAX_LINES; - int recentSize = recent.size() > recentmaxlen && !recentExpanded ? recentmaxlen : recent.size() + (includeEmpty ? 1 : 0); + final int recentSize = recent.size() > recentmaxlen && !recentExpanded ? recentmaxlen : recent.size() + (includeEmpty ? 1 : 0); if (position <= recentSize || position <= recentReactions.size()) { emojiTabs.select(0); // recent } else { final int maxlen = SPAN_COUNT_FOR_EMOJI * EXPAND_MAX_LINES; for (int i = 0; i < positionToSection.size(); ++i) { - int startPosition = positionToSection.keyAt(i); - int index = i - (defaultStatuses.isEmpty() ? 0 : 1); - EmojiView.EmojiPack pack = index >= 0 ? packs.get(index) : null; + final int startPosition = positionToSection.keyAt(i); + final int index = i - (defaultStatuses.isEmpty() ? 0 : 1); + final EmojiView.EmojiPack pack = index >= 0 ? packs.get(index) : null; if (pack == null) { continue; } - int count = pack.expanded ? pack.documents.size() : Math.min(maxlen, pack.documents.size()); + final int count = pack.expanded ? pack.documents.size() : Math.min(maxlen, pack.documents.size()); if (position > startPosition && position <= startPosition + 1 + count) { emojiTabs.select(1 + i); return; @@ -2524,23 +2540,21 @@ public int getItemViewType(int position) { return VIEW_TYPE_SEARCH; } else if ((position >= recentReactionsStartRow && position < recentReactionsEndRow) || (position >= topReactionsStartRow && position < topReactionsEndRow) || (position >= stickersStartRow && position < stickersEndRow)) { return VIEW_TYPE_REACTION; + } else if ((position >= giftsStartRow && position < giftsEndRow)) { + return VIEW_TYPE_EMOJI; } else if (positionToExpand.indexOfKey(position) >= 0) { return VIEW_TYPE_EXPAND; } else if (positionToButton.indexOfKey(position) >= 0) { return VIEW_TYPE_BUTTON; } else if (position == longtapHintRow) { return VIEW_TYPE_HINT; - } else if (positionToSection.indexOfKey(position) >= 0 || position == recentReactionsSectionRow || position == stickersSectionRow || position == popularSectionRow || position == topicEmojiHeaderRow) { + } else if (positionToSection.indexOfKey(position) >= 0 || position == recentReactionsSectionRow || position == stickersSectionRow || position == giftsSectionRow || position == popularSectionRow || position == topicEmojiHeaderRow) { return VIEW_TYPE_HEADER; } if (position == defaultTopicIconRow) { return VIEW_TYPE_TOPIC_ICON; } else { - if (showStickers) { - return VIEW_TYPE_EMOJI; - } else { - return VIEW_TYPE_EMOJI; - } + return VIEW_TYPE_EMOJI; } } @@ -2584,6 +2598,10 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi header.setText(LocaleController.getString(R.string.PopularReactions), false); return; } + if (position == giftsSectionRow) { + header.setText("Collectibles", false); + return; + } int index = positionToSection.get(position); if (index >= 0) { @@ -2738,6 +2756,8 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi } else { ImageViewEmoji imageView = (ImageViewEmoji) holder.itemView; + imageView.starGift = null; + imageView.particlesColor = null; imageView.empty = false; imageView.position = position; imageView.setPadding(AndroidUtilities.dp(1), AndroidUtilities.dp(1), AndroidUtilities.dp(1), AndroidUtilities.dp(1)); @@ -2790,8 +2810,24 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi imageView.imageReceiver.clearImage(); } } - } else if (!defaultStatuses.isEmpty() && position - (searchRow != -1 ? 1 : 0) - (longtapHintRow != -1 ? 1 : 0) - recentSize - 1 >= 0 && position - (searchRow != -1 ? 1 : 0) - (longtapHintRow != -1 ? 1 : 0) - recentSize - 1 < defaultStatuses.size()) { - int index = position - (searchRow != -1 ? 1 : 0) - (longtapHintRow != -1 ? 1 : 0) - recentSize - 1; + } else if (!gifts.isEmpty() && position - giftsStartRow >= 0 && position - giftsStartRow < gifts.size()) { + final int index = position - giftsStartRow; + final TL_stars.TL_starGiftUnique gift = gifts.get(index); + final TLRPC.Document doc = gift.getDocument(); + imageView.span = new AnimatedEmojiSpan(doc, null); + imageView.document = doc; + imageView.starGift = gift; + final TL_stars.starGiftAttributeBackdrop backdrop = findAttribute(gift.attributes, TL_stars.starGiftAttributeBackdrop.class); + if (backdrop != null) { + imageView.particlesColor = backdrop.pattern_color | 0x90000000; + } + selected = imageView.span != null && selectedDocumentIds.contains(gift.id); + imageView.isStaticIcon = false; + if (imageView.imageReceiver != null) { + imageView.imageReceiver.clearImage(); + } + } else if (!defaultStatuses.isEmpty() && position - (searchRow != -1 ? 1 : 0) - (longtapHintRow != -1 ? 1 : 0) - recentSize - 1 - (gifts.isEmpty() ? 0 : 1 + gifts.size()) >= 0 && position - (searchRow != -1 ? 1 : 0) - (longtapHintRow != -1 ? 1 : 0) - recentSize - 1 - (gifts.isEmpty() ? 0 : 1 + gifts.size()) < defaultStatuses.size()) { + int index = position - (searchRow != -1 ? 1 : 0) - (longtapHintRow != -1 ? 1 : 0) - recentSize - 1 - (gifts.isEmpty() ? 0 : 1 + gifts.size()); imageView.span = defaultStatuses.get(index); imageView.document = imageView.span == null ? null : imageView.span.document; selected = imageView.span != null && selectedDocumentIds.contains(imageView.span.getDocumentId()); @@ -2830,7 +2866,11 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi if (imageView.span != null) { AnimatedEmojiDrawable drawable = emojiGridView.animatedEmojiDrawables.get(imageView.span.getDocumentId()); if (drawable == null) { - drawable = AnimatedEmojiDrawable.make(currentAccount, getCacheType(), imageView.span.getDocumentId()); + if (imageView.span.document != null) { + drawable = AnimatedEmojiDrawable.make(currentAccount, getCacheType(), imageView.span.document); + } else { + drawable = AnimatedEmojiDrawable.make(currentAccount, getCacheType(), imageView.span.getDocumentId()); + } emojiGridView.animatedEmojiDrawables.put(imageView.span.getDocumentId(), drawable); } imageView.setDrawable(drawable); @@ -3114,6 +3154,14 @@ public EmojiPackExpand(Context context, Theme.ResourcesProvider resourcesProvide private int animateExpandFromPosition = -1, animateExpandToPosition = -1; private long animateExpandStartTime = -1; + private StarsReactionsSheet.Particles collectionParticles; + public StarsReactionsSheet.Particles getCollectionParticles() { + if (collectionParticles == null) { + collectionParticles = new StarsReactionsSheet.Particles(StarsReactionsSheet.Particles.TYPE_RADIAL, 8); + } + return collectionParticles; + } + public long animateExpandDuration() { return animateExpandAppearDuration() + animateExpandCrossfadeDuration() + 16; } @@ -3139,6 +3187,8 @@ public class ImageViewEmoji extends View { public ImageReceiver preloadEffectImageReceiver = new ImageReceiver(); public ImageReceiver imageReceiverToDraw; public boolean isDefaultReaction; + public TL_stars.TL_starGiftUnique starGift; + public Integer particlesColor; public ReactionsLayoutInBubble.VisibleReaction reaction; public boolean isFirstReactions; public Drawable drawable; @@ -3459,25 +3509,30 @@ public void setEmojicon(String emojicon) { public void onEmojiClick(View view, AnimatedEmojiSpan span) { incrementHintUse(); if (span == null || (type == TYPE_EMOJI_STATUS || type == TYPE_EMOJI_STATUS_TOP || type == TYPE_EMOJI_STATUS_CHANNEL || type == TYPE_EMOJI_STATUS_CHANNEL_TOP) && selectedDocumentIds.contains(span.documentId)) { - onEmojiSelected(view, null, null, null); + onEmojiSelected(view, null, null, null, null); } else { TLRPC.TL_emojiStatus status = new TLRPC.TL_emojiStatus(); status.document_id = span.getDocumentId(); TLRPC.Document document = span.document == null ? AnimatedEmojiDrawable.findDocument(currentAccount, span.documentId) : span.document; if (view instanceof ImageViewEmoji) { - if (type == TYPE_EMOJI_STATUS || type == TYPE_EMOJI_STATUS_TOP || type == TYPE_EMOJI_STATUS_CHANNEL || type == TYPE_EMOJI_STATUS_CHANNEL_TOP) { + ImageViewEmoji imageView = (ImageViewEmoji) view; + if (imageView.starGift == null && (type == TYPE_EMOJI_STATUS || type == TYPE_EMOJI_STATUS_TOP || type == TYPE_EMOJI_STATUS_CHANNEL || type == TYPE_EMOJI_STATUS_CHANNEL_TOP)) { MediaDataController.getInstance(currentAccount).pushRecentEmojiStatus(status); } if (type == TYPE_EMOJI_STATUS || type == TYPE_EMOJI_STATUS_TOP || type == TYPE_EMOJI_STATUS_CHANNEL || type == TYPE_EMOJI_STATUS_CHANNEL_TOP || type == TYPE_SET_DEFAULT_REACTION) { - animateEmojiSelect((ImageViewEmoji) view, () -> { - onEmojiSelected(view, span.documentId, document, null); + if (!willApplyEmoji(view, span.documentId, document, imageView.starGift, null)) { + onEmojiSelected(view, span.documentId, document, imageView.starGift, null); + return; + } + animateEmojiSelect(imageView, () -> { + onEmojiSelected(view, span.documentId, document, imageView.starGift, null); }); } else { - onEmojiSelected(view, span.documentId, document, null); + onEmojiSelected(view, span.documentId, document, imageView.starGift, null); } } else { - onEmojiSelected(view, span.documentId, document, null); + onEmojiSelected(view, span.documentId, document, null, null); } } } @@ -3497,7 +3552,11 @@ protected void onReactionClick(ImageViewEmoji emoji, ReactionsLayoutInBubble.Vis } - protected void onEmojiSelected(View view, Long documentId, TLRPC.Document document, Integer until) { + protected boolean willApplyEmoji(View view, Long documentId, TLRPC.Document document, TL_stars.TL_starGiftUnique gift, Integer until) { + return true; + } + + protected void onEmojiSelected(View view, Long documentId, TLRPC.Document document, TL_stars.TL_starGiftUnique gift, Integer until) { } @@ -3570,8 +3629,11 @@ private void updateRows(boolean updateEmojipacks, boolean animated, boolean diff totalCount = 0; recentReactionsSectionRow = -1; recentReactionsStartRow = -1; + giftsStartRow = -1; + giftsEndRow = -1; recentReactionsEndRow = -1; popularSectionRow = -1; + giftsSectionRow = -1; longtapHintRow = -1; defaultTopicIconRow = -1; topicEmojiHeaderRow = -1; @@ -3591,6 +3653,7 @@ private void updateRows(boolean updateEmojipacks, boolean animated, boolean diff stickerSets.clear(); recentStickers.clear(); standardEmojis.clear(); + gifts.clear(); if ((!installedEmojipacks.isEmpty() || type == TYPE_AVATAR_CONSTRUCTOR) && type != TYPE_SET_REPLY_ICON && type != TYPE_SET_REPLY_ICON_BOTTOM && type != TYPE_EXPANDABLE_REACTIONS) { searchRow = totalCount++; @@ -3856,6 +3919,31 @@ private void updateRows(boolean updateEmojipacks, boolean animated, boolean diff } } } + gifts.clear(); + if (type == TYPE_EMOJI_STATUS || type == TYPE_EMOJI_STATUS_TOP || type == TYPE_EMOJI_STATUS_CHANNEL || type == TYPE_EMOJI_STATUS_CHANNEL_TOP) { + final StarsController.GiftsList profileGifts = StarsController.getInstance(currentAccount).getProfileGiftsList(getDialogId()); + profileGifts.load(); + final ArrayList uniqueGifts = new ArrayList<>(); + for (TL_stars.SavedStarGift gift : profileGifts.gifts) { + if (gift.gift instanceof TL_stars.TL_starGiftUnique) { + uniqueGifts.add((TL_stars.TL_starGiftUnique) gift.gift); + } + } + if (!uniqueGifts.isEmpty()) { + giftsSectionRow = totalCount++; + rowHashCodes.add(22L); + giftsStartRow = totalCount; + for (final TL_stars.TL_starGiftUnique gift : uniqueGifts) { + rowHashCodes.add(13334 + 322L * gift.id); + totalCount++; + gifts.add(gift); + } + giftsEndRow = totalCount; + emojiTabs.showGifts(true); + } else { + emojiTabs.showGifts(false); + } + } if (type == TYPE_STICKER_SET_EMOJI) { for (String[] section : EmojiData.dataColored) { for (String emoji : section) { @@ -4212,6 +4300,7 @@ public void dispatchDraw(Canvas canvas) { unusedArrays.add(arrayList); } viewsGroupedByLines.clear(); + boolean particlesUpdated = false; final boolean animatedExpandIn = animateExpandStartTime > 0 && (SystemClock.elapsedRealtime() - animateExpandStartTime) < animateExpandDuration(); final boolean drawButton = animatedExpandIn && animateExpandFromButton != null && animateExpandFromPosition >= 0; if (animatedEmojiDrawables != null) { @@ -4220,10 +4309,24 @@ public void dispatchDraw(Canvas canvas) { if (child instanceof ImageViewEmoji) { ImageViewEmoji imageViewEmoji = (ImageViewEmoji) child; imageViewEmoji.updatePressedProgress(); + final int position = imageViewEmoji.position; int top = smoothScrolling ? (int) child.getY() : child.getTop(); ArrayList arrayList = viewsGroupedByLines.get(top); canvas.save(); canvas.translate(imageViewEmoji.getX(), imageViewEmoji.getY()); + if (imageViewEmoji.particlesColor != null) { + StarsReactionsSheet.Particles particles = getCollectionParticles(); + particles.setBounds(0, 0, imageViewEmoji.getWidth(), imageViewEmoji.getHeight()); + if (!particlesUpdated) { + particles.process(); + particlesUpdated = true; + } + canvas.save(); + canvas.scale(position % 6 == 2 ? -1 : +1, position % 6 == 2 ? -1 : +1, imageViewEmoji.getWidth() / 2.0f, imageViewEmoji.getHeight() / 2.0f); + canvas.rotate(position % 4 * 90, imageViewEmoji.getWidth() / 2.0f, imageViewEmoji.getHeight() / 2.0f); + particles.draw(canvas, imageViewEmoji.particlesColor); + canvas.restore(); + } imageViewEmoji.drawSelected(canvas, this); canvas.restore(); @@ -4780,6 +4883,9 @@ protected void onAttachedToWindow() { NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.recentEmojiStatusesUpdate); NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.groupStickersDidLoad); NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiLoaded); + if (type == TYPE_EMOJI_STATUS || type == TYPE_EMOJI_STATUS_TOP) { + NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.starUserGiftsLoaded); + } if (scrimDrawable != null) { scrimDrawable.setSecondParent(this); @@ -4796,6 +4902,9 @@ protected void onDetachedFromWindow() { NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.recentEmojiStatusesUpdate); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.groupStickersDidLoad); NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiLoaded); + if (type == TYPE_EMOJI_STATUS || type == TYPE_EMOJI_STATUS_TOP) { + NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.starUserGiftsLoaded); + } if (scrimDrawable != null) { scrimDrawable.setSecondParent(null); @@ -4830,6 +4939,11 @@ public void didReceivedNotification(int id, int account, Object... args) { if (emojiGridView != null) { emojiGridView.invalidate(); } + } else if (id == NotificationCenter.starUserGiftsLoaded) { + final long did = (long) args[0]; + if (did == UserConfig.getInstance(currentAccount).getClientUserId()) { + updateRowsDelayed(); + } } } @@ -6263,4 +6377,8 @@ public TLRPC.Document getEffectDocument(long effectId) { } return null; } + + public long getDialogId() { + return UserConfig.getInstance(currentAccount).getClientUserId(); + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SessionBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/SessionBottomSheet.java index bac72e9773..ef207cc4d7 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SessionBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SessionBottomSheet.java @@ -25,6 +25,7 @@ import org.telegram.messenger.R; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.BottomSheet; @@ -278,7 +279,7 @@ private boolean secretChatsEnabled(TLRPC.TL_authorization session) { } private void uploadSessionSettings() { - TLRPC.TL_account_changeAuthorizationSettings req = new TLRPC.TL_account_changeAuthorizationSettings(); + TL_account.changeAuthorizationSettings req = new TL_account.changeAuthorizationSettings(); req.encrypted_requests_disabled = session.encrypted_requests_disabled; req.call_requests_disabled = session.call_requests_disabled; req.flags = 1 | 2; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SessionsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/SessionsActivity.java index 19ada959ef..5948cc1401 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SessionsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SessionsActivity.java @@ -50,6 +50,7 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; @@ -270,7 +271,7 @@ public boolean supportsPredictiveItemAnimations() { value = 365; } - final TLRPC.TL_account_setAuthorizationTTL req = new TLRPC.TL_account_setAuthorizationTTL(); + final TL_account.setAuthorizationTTL req = new TL_account.setAuthorizationTTL(); req.authorization_ttl_days = value; ttlDays = value; if (listAdapter != null) { @@ -324,7 +325,7 @@ public boolean supportsPredictiveItemAnimations() { } }); } else { - TLRPC.TL_account_resetWebAuthorizations req = new TLRPC.TL_account_resetWebAuthorizations(); + TL_account.resetWebAuthorizations req = new TL_account.resetWebAuthorizations(); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (getParentActivity() == null) { return; @@ -418,7 +419,7 @@ public boolean supportsPredictiveItemAnimations() { } else { authorization = (TLRPC.TL_authorization) passwordSessions.get(position - passwordSessionsStartRow); } - TLRPC.TL_account_resetAuthorization req = new TLRPC.TL_account_resetAuthorization(); + TL_account.resetAuthorization req = new TL_account.resetAuthorization(); req.hash = authorization.hash; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { try { @@ -437,7 +438,7 @@ public boolean supportsPredictiveItemAnimations() { })); } else { final TLRPC.TL_webAuthorization authorization = (TLRPC.TL_webAuthorization) sessions.get(position - otherSessionsStartRow); - TLRPC.TL_account_resetWebAuthorization req = new TLRPC.TL_account_resetWebAuthorization(); + TL_account.resetWebAuthorization req = new TL_account.resetWebAuthorization(); req.hash = authorization.hash; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { try { @@ -474,7 +475,7 @@ public boolean supportsPredictiveItemAnimations() { public void hide(boolean apply, int animated) { if (!apply) { TLRPC.TL_authorization authorization = (TLRPC.TL_authorization) getCurrentInfoObject(); - TLRPC.TL_account_resetAuthorization req = new TLRPC.TL_account_resetAuthorization(); + TL_account.resetAuthorization req = new TL_account.resetAuthorization(); req.hash = authorization.hash; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (error == null) { @@ -521,7 +522,7 @@ private void showSessionBottomSheet(TLRPC.TL_authorization authorization, boolea SessionBottomSheet bottomSheet = new SessionBottomSheet(this, authorization, isCurrentSession, new SessionBottomSheet.Callback() { @Override public void onSessionTerminated(TLRPC.TL_authorization authorization) { - TLRPC.TL_account_resetAuthorization req = new TLRPC.TL_account_resetAuthorization(); + TL_account.resetAuthorization req = new TL_account.resetAuthorization(); req.hash = authorization.hash; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (error == null) { @@ -577,14 +578,14 @@ public void loadSessions(boolean silent) { loading = true; } if (currentType == 0) { - TLRPC.TL_account_getAuthorizations req = new TLRPC.TL_account_getAuthorizations(); + TL_account.getAuthorizations req = new TL_account.getAuthorizations(); int reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { loading = false; int oldItemsCount = listAdapter != null ? listAdapter.getItemCount() : 0; if (error == null) { sessions.clear(); passwordSessions.clear(); - TLRPC.TL_account_authorizations res = (TLRPC.TL_account_authorizations) response; + TL_account.authorizations res = (TL_account.authorizations) response; for (int a = 0, N = res.authorizations.size(); a < N; a++) { TLRPC.TL_authorization authorization = res.authorizations.get(a); if ((authorization.flags & 1) != 0) { @@ -619,12 +620,12 @@ public void loadSessions(boolean silent) { })); ConnectionsManager.getInstance(currentAccount).bindRequestToGuid(reqId, classGuid); } else { - TLRPC.TL_account_getWebAuthorizations req = new TLRPC.TL_account_getWebAuthorizations(); + TL_account.getWebAuthorizations req = new TL_account.getWebAuthorizations(); int reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { loading = false; if (error == null) { sessions.clear(); - TLRPC.TL_account_webAuthorizations res = (TLRPC.TL_account_webAuthorizations) response; + TL_account.webAuthorizations res = (TL_account.webAuthorizations) response; MessagesController.getInstance(currentAccount).putUsers(res.users, false); sessions.addAll(res.authorizations); updateRows(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stars/BagRandomizer.java b/TMessagesProj/src/main/java/org/telegram/ui/Stars/BagRandomizer.java new file mode 100644 index 0000000000..933aa9d744 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stars/BagRandomizer.java @@ -0,0 +1,50 @@ +package org.telegram.ui.Stars; + +import androidx.annotation.Nullable; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Random; + +public class BagRandomizer { + + private final List bag; + private final List shuffledBag; + private int currentIndex; + private final Random random; + + private T next; + + public BagRandomizer(List items) { + if (items == null) items = new ArrayList<>(); + this.bag = new ArrayList<>(items); + this.shuffledBag = new ArrayList<>(this.bag); + this.currentIndex = 0; + this.random = new Random(); + reshuffle(); + next(); + } + + @Nullable + public T next() { + if (this.bag.isEmpty()) return null; + T result = next; + if (currentIndex >= shuffledBag.size()) { + reshuffle(); + } + next = shuffledBag.get(currentIndex++); + return result; + } + + @Nullable + public T getNext() { + return next; + } + + private void reshuffle() { + Collections.shuffle(shuffledBag, random); + currentIndex = 0; + } + +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stars/BotStarsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/Stars/BotStarsActivity.java index 41199aaa1f..d4a16864de 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stars/BotStarsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stars/BotStarsActivity.java @@ -50,6 +50,7 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.tgnet.tl.TL_stars; import org.telegram.tgnet.tl.TL_stats; import org.telegram.ui.ActionBar.ActionBar; @@ -997,10 +998,10 @@ private void initWithdraw(boolean stars, long stars_amount, TLRPC.InputCheckPass showDialog(builder.create()); } } else if ("SRP_ID_INVALID".equals(error.text)) { - TLRPC.TL_account_getPassword getPasswordReq = new TLRPC.TL_account_getPassword(); + TL_account.getPassword getPasswordReq = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(getPasswordReq, (response2, error2) -> AndroidUtilities.runOnUIThread(() -> { if (error2 == null) { - TLRPC.account_Password currentPassword = (TLRPC.account_Password) response2; + TL_account.Password currentPassword = (TL_account.Password) response2; passwordFragment.setCurrentPasswordInfo(null, currentPassword); TwoStepVerificationActivity.initPasswordNewAlgo(currentPassword); initWithdraw(stars, stars_amount, passwordFragment.getNewSrpPassword(), passwordFragment); @@ -1025,126 +1026,4 @@ private void initWithdraw(boolean stars, long stars_amount, TLRPC.InputCheckPass } })); } - - - private void initWithdraw(long stars, TLRPC.InputCheckPasswordSRP password, TwoStepVerificationActivity passwordFragment) { - Activity parentActivity = getParentActivity(); - TLRPC.User currentUser = UserConfig.getInstance(currentAccount).getCurrentUser(); - if (parentActivity == null || currentUser == null) return; - - TLRPC.TL_payments_getStarsRevenueWithdrawalUrl req = new TLRPC.TL_payments_getStarsRevenueWithdrawalUrl(); - req.peer = MessagesController.getInstance(currentAccount).getInputPeer(bot_id); - req.stars = stars; - req.password = password != null ? password : new TLRPC.TL_inputCheckPasswordEmpty(); - ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { - if (error != null) { - if ("PASSWORD_MISSING".equals(error.text) || error.text.startsWith("PASSWORD_TOO_FRESH_") || error.text.startsWith("SESSION_TOO_FRESH_")) { - if (passwordFragment != null) { - passwordFragment.needHideProgress(); - } - AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity); - builder.setTitle(LocaleController.getString(R.string.EditAdminTransferAlertTitle)); - - LinearLayout linearLayout = new LinearLayout(parentActivity); - linearLayout.setPadding(AndroidUtilities.dp(24), AndroidUtilities.dp(2), AndroidUtilities.dp(24), 0); - linearLayout.setOrientation(LinearLayout.VERTICAL); - builder.setView(linearLayout); - - TextView messageTextView = new TextView(parentActivity); - messageTextView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack)); - messageTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); - messageTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP); - messageTextView.setText(AndroidUtilities.replaceTags(LocaleController.getString(R.string.WithdrawChannelAlertText))); - linearLayout.addView(messageTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); - - LinearLayout linearLayout2 = new LinearLayout(parentActivity); - linearLayout2.setOrientation(LinearLayout.HORIZONTAL); - linearLayout.addView(linearLayout2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 11, 0, 0)); - - ImageView dotImageView = new ImageView(parentActivity); - dotImageView.setImageResource(R.drawable.list_circle); - dotImageView.setPadding(LocaleController.isRTL ? AndroidUtilities.dp(11) : 0, AndroidUtilities.dp(9), LocaleController.isRTL ? 0 : AndroidUtilities.dp(11), 0); - dotImageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_dialogTextBlack), PorterDuff.Mode.MULTIPLY)); - - messageTextView = new TextView(parentActivity); - messageTextView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack)); - messageTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); - messageTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP); - messageTextView.setText(AndroidUtilities.replaceTags(LocaleController.getString(R.string.EditAdminTransferAlertText1))); - if (LocaleController.isRTL) { - linearLayout2.addView(messageTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); - linearLayout2.addView(dotImageView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.RIGHT)); - } else { - linearLayout2.addView(dotImageView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT)); - linearLayout2.addView(messageTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); - } - - linearLayout2 = new LinearLayout(parentActivity); - linearLayout2.setOrientation(LinearLayout.HORIZONTAL); - linearLayout.addView(linearLayout2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 11, 0, 0)); - - dotImageView = new ImageView(parentActivity); - dotImageView.setImageResource(R.drawable.list_circle); - dotImageView.setPadding(LocaleController.isRTL ? AndroidUtilities.dp(11) : 0, AndroidUtilities.dp(9), LocaleController.isRTL ? 0 : AndroidUtilities.dp(11), 0); - dotImageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_dialogTextBlack), PorterDuff.Mode.MULTIPLY)); - - messageTextView = new TextView(parentActivity); - messageTextView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack)); - messageTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); - messageTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP); - messageTextView.setText(AndroidUtilities.replaceTags(LocaleController.getString(R.string.EditAdminTransferAlertText2))); - if (LocaleController.isRTL) { - linearLayout2.addView(messageTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); - linearLayout2.addView(dotImageView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.RIGHT)); - } else { - linearLayout2.addView(dotImageView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT)); - linearLayout2.addView(messageTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); - } - - if ("PASSWORD_MISSING".equals(error.text)) { - builder.setPositiveButton(LocaleController.getString(R.string.EditAdminTransferSetPassword), (dialogInterface, i) -> presentFragment(new TwoStepVerificationSetupActivity(TwoStepVerificationSetupActivity.TYPE_INTRO, null))); - builder.setNegativeButton(LocaleController.getString(R.string.Cancel), null); - } else { - messageTextView = new TextView(parentActivity); - messageTextView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack)); - messageTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); - messageTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP); - messageTextView.setText(LocaleController.getString(R.string.EditAdminTransferAlertText3)); - linearLayout.addView(messageTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 11, 0, 0)); - - builder.setNegativeButton(LocaleController.getString(R.string.OK), null); - } - if (passwordFragment != null) { - passwordFragment.showDialog(builder.create()); - } else { - showDialog(builder.create()); - } - } else if ("SRP_ID_INVALID".equals(error.text)) { - TLRPC.TL_account_getPassword getPasswordReq = new TLRPC.TL_account_getPassword(); - ConnectionsManager.getInstance(currentAccount).sendRequest(getPasswordReq, (response2, error2) -> AndroidUtilities.runOnUIThread(() -> { - if (error2 == null) { - TLRPC.account_Password currentPassword = (TLRPC.account_Password) response2; - passwordFragment.setCurrentPasswordInfo(null, currentPassword); - TwoStepVerificationActivity.initPasswordNewAlgo(currentPassword); - initWithdraw(stars, passwordFragment.getNewSrpPassword(), passwordFragment); - } - }), ConnectionsManager.RequestFlagWithoutLogin); - } else { - if (passwordFragment != null) { - passwordFragment.needHideProgress(); - passwordFragment.finishFragment(); - } - BulletinFactory.showError(error); - } - } else { - passwordFragment.needHideProgress(); - passwordFragment.finishFragment(); - if (response instanceof TLRPC.TL_payments_starsRevenueWithdrawalUrl) { - balanceEditTextAll = true; - Browser.openUrl(getContext(), ((TLRPC.TL_payments_starsRevenueWithdrawalUrl) response).url); - } - } - })); - } - } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stars/BotStarsController.java b/TMessagesProj/src/main/java/org/telegram/ui/Stars/BotStarsController.java index 8a0e8ce467..7180a9a2b0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stars/BotStarsController.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stars/BotStarsController.java @@ -16,6 +16,7 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import org.telegram.tgnet.tl.TL_bots; import org.telegram.tgnet.tl.TL_payments; import org.telegram.tgnet.tl.TL_stars; @@ -67,6 +68,10 @@ public TL_stars.StarsAmount getBotStarsBalance(long did) { return botStats == null ? new TL_stars.StarsAmount(0) : botStats.status.current_balance; } + public void invalidateStarsBalance(long did) { + getStarsRevenueStats(did, true); + } + public long getTONBalance(long did) { TL_stats.TL_broadcastRevenueStats botStats = getTONRevenueStats(did, false); return botStats == null || botStats.balances == null ? 0 : botStats.balances.current_balance; @@ -330,6 +335,7 @@ public void load() { if (loading || error || endReached) return; lastRequestTime = System.currentTimeMillis(); + loading = true; TL_payments.getConnectedStarRefBots req = new TL_payments.getConnectedStarRefBots(); req.peer = MessagesController.getInstance(currentAccount).getInputPeer(dialogId); req.limit = 20; @@ -481,6 +487,7 @@ public void load() { if (loading || error || endReached) return; lastRequestTime = System.currentTimeMillis(); + loading = true; TL_payments.getSuggestedStarRefBots req = new TL_payments.getSuggestedStarRefBots(); req.peer = MessagesController.getInstance(currentAccount).getInputPeer(dialogId); req.limit = 20; @@ -554,8 +561,8 @@ public void loadAdmined() { ConnectionsManager.getInstance(currentAccount).sendRequest(req1, (res, err) -> AndroidUtilities.runOnUIThread(() -> { adminedBots = new ArrayList<>(); loadingAdminedBots = false; - if (res instanceof TLRPC.Vector) { - TLRPC.Vector vector = (TLRPC.Vector) res; + if (res instanceof Vector) { + Vector vector = (Vector) res; for (int i = 0; i < vector.objects.size(); ++i) { adminedBots.add((TLRPC.User) vector.objects.get(i)); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarGiftPatterns.java b/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarGiftPatterns.java new file mode 100644 index 0000000000..befade6202 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarGiftPatterns.java @@ -0,0 +1,212 @@ +package org.telegram.ui.Stars; + +import static org.telegram.messenger.AndroidUtilities.dp; +import static org.telegram.messenger.AndroidUtilities.dpf2; + +import android.graphics.Canvas; +import android.graphics.drawable.Drawable; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.ui.ActionBar.Theme; + +public class StarGiftPatterns { + + public static final int TYPE_DEFAULT = 0; + public static final int TYPE_ACTION = 1; + public static final int TYPE_GIFT = 2; + public static final int TYPE_LINK_PREVIEW = 3; + + private static final float[][] patternLocations = new float[][] { + { + 83.33f, 24, 27.33f, .22f, + 68.66f, 75.33f, 25.33f, .21f, + 0, 86, 25.33f, .12f, + -68.66f, 75.33f, 25.33f, .21f, + -82.66f, 13.66f, 27.33f, .22f, + -80, -33.33f, 20, .24f, + -46.5f, -63.16f, 27, .21f, + 1, -82.66f, 20, .15f, + 46.5f, -63.16f, 27, .21f, + 80, -33.33f, 19.33f, .24f, + + 115.66f, -63, 20, .15f, + 134, -10.66f, 20, .18f, + 118.66f, 55.66f, 20, .15f, + 124.33f, 98.33f, 20, .11f, + + -128, 98.33f, 20, .11f, + -108, 55.66f, 20, .15f, + -123.33f, -10.66f, 20, .18f, + -116, -63.33f, 20, .15f + }, + { + 27.33f, -57.66f, 20, .12f, + 59, -32, 19.33f, .22f, + 77, 4.33f, 22.66f, .2f, + 100, 40.33f, 18, .12f, + 58.66f, 59, 20, .18f, + 73.33f, 100.33f, 22.66f, .15f, + 75, 155, 22, .11f, + + -27.33f, -57.33f, 20, .12f, + -59, -32.33f, 19.33f, .2f, + -77, 4.66f, 23.33f, .2f, + -98.66f, 41, 18.66f, .12f, + -58, 59.33f, 19.33f, .18f, + -73.33f, 100, 22, .15f, + -75.66f, 155, 22, .11f + }, + { + -0.83f, -52.16f, 12.33f, .2f, + 26.66f, -40.33f, 16, .2f, + 44.16f, -20.5f, 12.33f, .2f, + 53, 7.33f, 16, .2f, + 31, 23.66f, 14.66f, .2f, + 0, 32, 13.33f, .2f, + -29, 23.66f, 14, .2f, + -53, 7.33f, 16, .2f, + -44.5f, -20.16f, 12.33f, .2f, + -27.33f, -40.33f, 16, .2f, + 43.66f, 50, 14.66f, .2f, + -41.66f, 48, 14.66f, .2f + }, + { + -0.16f, -103.5f, 20.33f, .15f, + 39.66f, -77.33f, 26.66f, .15f, + 70.66f, -46.33f, 21.33f, .15f, + 84.5f, -3.83f, 29.66f, .15f, + 65.33f, 56.33f, 24.66f, .15f, + 0, 67.66f, 24.66f, .15f, + -65.66f, 56.66f, 24.66f, .15f, + -85, -4, 29.33f, .15f, + -70.66f, -46.33f, 21.33f, .15f, + -40.33f, -77.66f, 26.66f, .15f, + + 62.66f, -109.66f, 21.33f, .11f, + 103.166f, -67.5f, 20.33f, .11f, + 110.33f, 37.66f, 20.66f, .11f, + 94.166f, 91.16f, 20.33f, .11f, + 38.83f, 91.16f, 20.33f, .11f, + 0, 112.5f, 20.33f, .11f, + -38.83f, 91.16f, 20.33f, .11f, + -94.166f, 91.16f, 20.33f, .11f, + -110.33f, 37.66f, 20.66f, .11f, + -103.166f, -67.5f, 20.33f, .11f, + -62.66f, -109.66f, 21.33f, .11f + } + }; + + public static void drawPattern(Canvas canvas, Drawable pattern, float w, float h, float alpha, float scale) { + drawPattern(canvas, TYPE_DEFAULT, pattern, w, h, alpha, scale); + } + + public static void drawPattern(Canvas canvas, int type, Drawable pattern, float w, float h, float alpha, float scale) { + if (alpha <= 0.0f) return; + for (int i = 0; i < patternLocations[type].length; i += 4) { + final float x = patternLocations[type][i]; + final float y = patternLocations[type][i + 1]; + final float size = patternLocations[type][i + 2]; + final float thisAlpha = patternLocations[type][i + 3]; + + float cx = x, cy = y, sz = size; + if (w < h && type == TYPE_DEFAULT) { + cx = y; + cy = x; + } + cx *= scale; + cy *= scale; + sz *= scale; + pattern.setBounds((int) (dp(cx) - dp(sz) / 2.0f), (int) (dp(cy) - dp(sz) / 2.0f), (int) (dp(cx) + dp(sz) / 2.0f), (int) (dp(cy) + dp(sz) / 2.0f)); + + pattern.setAlpha((int) (0xFF * alpha * thisAlpha)); + pattern.draw(canvas); + } + } + + private static final float[] profileRight = new float[] { + -35.66f, -5, 24, .2388f, + -14.33f, -29.33f, 20.66f, .32f, + -15, -73.66f, 19.33f, .32f, + -2, -99.66f, 18, .1476f, + -64.33f, -24.66f, 23.33f, .3235f, + -40.66f, -53.33f, 24, .3654f, + -50.33f, -85.66f, 20, .172f, + -96, -1.33f, 19.33f, .3343f, + -136.66f, -13, 18.66f, .2569f, + -104.66f, -33.66f, 20.66f, .2216f, + -82, -62.33f, 22.66f, .2562f, + -131.66f, -60, 18, .1316f, + -105.66f, -88.33f, 18, .1487f + }; + private static final float[] profileLeft = new float[] { + 0, -107.33f, 16, .1505f, + 14.33f, -84, 18, .1988f, + 0, -50.66f, 18.66f, .3225f, + 13, -15, 18.66f, .37f, + 43.33f, 1, 18.66f, .3186f + }; + + public static void drawProfilePattern(Canvas canvas, Drawable pattern, float w, float h, float alpha, float full) { + if (alpha <= 0.0f) return; + + final float b = h; + final float l = 0, r = w; + + if (full > 0) { + for (int i = 0; i < profileLeft.length; i += 4) { + final float x = profileLeft[i]; + final float y = profileLeft[i + 1]; + final float size = profileLeft[i + 2]; + final float thisAlpha = profileLeft[i + 3]; + + pattern.setBounds( + (int) (l + dpf2(x) - dpf2(size) / 2.0f), + (int) (b + dpf2(y) - dpf2(size) / 2.0f), + (int) (l + dpf2(x) + dpf2(size) / 2.0f), + (int) (b + dpf2(y) + dpf2(size) / 2.0f) + ); + pattern.setAlpha((int) (0xFF * alpha * thisAlpha * full)); + pattern.draw(canvas); + } + + final float sl = 77.5f, sr = 173.33f; + final float space = w / AndroidUtilities.density - sl - sr; + int count = Math.max(0, Math.round(space / 27.25f)); + if (count % 2 == 0) { + count++; + } + for (int i = 0; i < count; ++i) { + final float x = sl + space * ((float) i / (count - 1)); + final float y = i % 2 == 0 ? 0 : -12.5f; + final float size = 17; + final float thisAlpha = .21f; + + pattern.setBounds( + (int) (l + dpf2(x) - dpf2(size) / 2.0f), + (int) (b + dpf2(y) - dpf2(size) / 2.0f), + (int) (l + dpf2(x) + dpf2(size) / 2.0f), + (int) (b + dpf2(y) + dpf2(size) / 2.0f) + ); + pattern.setAlpha((int) (0xFF * alpha * thisAlpha * full)); + pattern.draw(canvas); + } + } + + for (int i = 0; i < profileRight.length; i += 4) { + final float x = profileRight[i]; + final float y = profileRight[i + 1]; + final float size = profileRight[i + 2]; + final float thisAlpha = profileRight[i + 3]; + + pattern.setBounds( + (int) (r + dpf2(x) - dpf2(size) / 2.0f), + (int) (b + dpf2(y) - dpf2(size) / 2.0f), + (int) (r + dpf2(x) + dpf2(size) / 2.0f), + (int) (b + dpf2(y) + dpf2(size) / 2.0f) + ); + pattern.setAlpha((int) (0xFF * alpha * thisAlpha)); + pattern.draw(canvas); + } + } + +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarGiftSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarGiftSheet.java new file mode 100644 index 0000000000..dedab010a2 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarGiftSheet.java @@ -0,0 +1,3679 @@ +package org.telegram.ui.Stars; + +import static org.telegram.messenger.AndroidUtilities.dp; +import static org.telegram.messenger.AndroidUtilities.dpf2; +import static org.telegram.messenger.AndroidUtilities.lerp; +import static org.telegram.messenger.LocaleController.formatPluralString; +import static org.telegram.messenger.LocaleController.formatPluralStringComma; +import static org.telegram.messenger.LocaleController.formatSpannable; +import static org.telegram.messenger.LocaleController.formatString; +import static org.telegram.messenger.LocaleController.getString; +import static org.telegram.ui.Stars.StarsController.findAttribute; +import static org.telegram.ui.Stars.StarsController.findAttributes; +import static org.telegram.ui.Stars.StarsController.showNoSupportDialog; +import static org.telegram.ui.Stars.StarsIntroActivity.StarsTransactionView.getPlatformDrawable; +import static org.telegram.ui.Stars.StarsIntroActivity.addAvailabilityRow; +import static org.telegram.ui.Stars.StarsIntroActivity.replaceStars; +import static org.telegram.ui.Stars.StarsIntroActivity.replaceStarsWithPlain; +import static org.telegram.ui.Stars.StarsIntroActivity.setGiftImage; +import static org.telegram.ui.bots.AffiliateProgramFragment.percents; + +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ValueAnimator; +import android.app.Activity; +import android.app.Dialog; +import android.content.Context; +import android.content.ContextWrapper; +import android.graphics.Canvas; +import android.graphics.LinearGradient; +import android.graphics.Matrix; +import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; +import android.graphics.RadialGradient; +import android.graphics.RectF; +import android.graphics.Shader; +import android.os.Bundle; +import android.text.Layout; +import android.text.SpannableString; +import android.text.SpannableStringBuilder; +import android.text.Spanned; +import android.text.TextPaint; +import android.text.TextUtils; +import android.text.style.ClickableSpan; +import android.util.TypedValue; +import android.view.Gravity; +import android.view.HapticFeedbackConstants; +import android.view.View; +import android.widget.FrameLayout; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TableRow; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.collection.LongSparseArray; +import androidx.core.graphics.ColorUtils; + +import org.json.JSONObject; +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.ApplicationLoader; +import org.telegram.messenger.BirthdayController; +import org.telegram.messenger.BuildVars; +import org.telegram.messenger.ChatObject; +import org.telegram.messenger.DialogObject; +import org.telegram.messenger.Emoji; +import org.telegram.messenger.ImageReceiver; +import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MessageObject; +import org.telegram.messenger.MessagesController; +import org.telegram.messenger.R; +import org.telegram.messenger.UserConfig; +import org.telegram.messenger.UserObject; +import org.telegram.messenger.Utilities; +import org.telegram.messenger.browser.Browser; +import org.telegram.tgnet.ConnectionsManager; +import org.telegram.tgnet.TLObject; +import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; +import org.telegram.tgnet.tl.TL_stars; +import org.telegram.ui.ActionBar.AlertDialog; +import org.telegram.ui.ActionBar.BaseFragment; +import org.telegram.ui.ActionBar.BottomSheet; +import org.telegram.ui.ActionBar.SimpleTextView; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.Cells.SessionCell; +import org.telegram.ui.Cells.ShareDialogCell; +import org.telegram.ui.ChatActivity; +import org.telegram.ui.Components.AnimatedEmojiDrawable; +import org.telegram.ui.Components.AvatarDrawable; +import org.telegram.ui.Components.BackupImageView; +import org.telegram.ui.Components.Bulletin; +import org.telegram.ui.Components.BulletinFactory; +import org.telegram.ui.Components.ButtonSpan; +import org.telegram.ui.Components.CheckBox2; +import org.telegram.ui.Components.ColoredImageSpan; +import org.telegram.ui.Components.CompatDrawable; +import org.telegram.ui.Components.CubicBezierInterpolator; +import org.telegram.ui.Components.FireworksOverlay; +import org.telegram.ui.Components.ItemOptions; +import org.telegram.ui.Components.LayoutHelper; +import org.telegram.ui.Components.LinkSpanDrawable; +import org.telegram.ui.Components.LoadingSpan; +import org.telegram.ui.Components.Premium.LimitReachedBottomSheet; +import org.telegram.ui.Components.Premium.PremiumFeatureBottomSheet; +import org.telegram.ui.Components.Premium.boosts.UserSelectorBottomSheet; +import org.telegram.ui.Components.RLottieDrawable; +import org.telegram.ui.Components.ScaleStateListAnimator; +import org.telegram.ui.Components.ShareAlert; +import org.telegram.ui.Components.TableView; +import org.telegram.ui.Components.spoilers.SpoilersTextView; +import org.telegram.ui.Gifts.GiftSheet; +import org.telegram.ui.LaunchActivity; +import org.telegram.ui.PremiumPreviewFragment; +import org.telegram.ui.ProfileActivity; +import org.telegram.ui.StatisticActivity; +import org.telegram.ui.Stories.recorder.ButtonWithCounterView; +import org.telegram.ui.Stories.recorder.HintView2; +import org.telegram.ui.Stories.recorder.StoryEntry; +import org.telegram.ui.Stories.recorder.StoryRecorder; +import org.telegram.ui.TwoStepVerificationActivity; +import org.telegram.ui.TwoStepVerificationSetupActivity; +import org.telegram.ui.bots.AffiliateProgramFragment; +import org.telegram.ui.bots.BotWebViewSheet; + +import java.util.ArrayList; +import java.util.Date; + +public class StarGiftSheet extends BottomSheet { + + private final long dialogId; + private ContainerView container; + private FireworksOverlay fireworksOverlay; + + private final TopView topView; + + private final LinearLayout infoLayout; + private final LinkSpanDrawable.LinksTextView beforeTableTextView; + private final TableView tableView; + private final LinkSpanDrawable.LinksTextView afterTableTextView; + private final ButtonWithCounterView button; + private final FrameLayout bottomBulletinContainer; + + private final LinearLayout upgradeLayout; + private final AffiliateProgramFragment.FeatureCell[] upgradeFeatureCells; + private final View checkboxSeparator; + private final LinearLayout checkboxLayout; + private final CheckBox2 checkbox; + private final TextView checkboxTextView; + + private boolean onlyWearInfo; + private final LinearLayout wearLayout; + private final TextView wearTitle; + private final TextView wearSubtitle; + private final AffiliateProgramFragment.FeatureCell[] wearFeatureCells; + + private boolean myProfile; + private TL_stars.SavedStarGift savedStarGift; + private MessageObject messageObject; + private String slug; + private TL_stars.TL_starGiftUnique slugStarGift; + private boolean messageObjectRepolling; + private boolean messageObjectRepolled; + private boolean userStarGiftRepolling; + private boolean userStarGiftRepolled; + + public StarGiftSheet(Context context, int currentAccount, long dialogId, Theme.ResourcesProvider resourcesProvider) { + super(context, false, resourcesProvider); + this.currentAccount = currentAccount; + this.dialogId = dialogId; + + containerView = container = new ContainerView(context); + + fixNavigationBar(getThemedColor(Theme.key_dialogBackground)); + + infoLayout = new LinearLayout(context); + infoLayout.setOrientation(LinearLayout.VERTICAL); + infoLayout.setPadding(backgroundPaddingLeft + dp(14), dp(16), backgroundPaddingLeft + dp(14), dp(48 + 8)); + containerView.addView(infoLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL_HORIZONTAL | Gravity.BOTTOM)); + + beforeTableTextView = new LinkSpanDrawable.LinksTextView(context, resourcesProvider); + beforeTableTextView.setTextColor(Theme.getColor(Theme.key_dialogTextGray2, resourcesProvider)); + beforeTableTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + beforeTableTextView.setGravity(Gravity.CENTER); + beforeTableTextView.setLineSpacing(dp(2), 1f); + beforeTableTextView.setLinkTextColor(Theme.getColor(Theme.key_chat_messageLinkIn, resourcesProvider)); + beforeTableTextView.setDisablePaddingsOffsetY(true); + infoLayout.addView(beforeTableTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 5, -4, 5, 10)); + beforeTableTextView.setVisibility(View.GONE); + + tableView = new TableView(context, resourcesProvider); + infoLayout.addView(tableView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 0, 0, 12)); + + afterTableTextView = new LinkSpanDrawable.LinksTextView(context, resourcesProvider); + afterTableTextView.setTextColor(Theme.getColor(Theme.key_dialogTextGray2, resourcesProvider)); + afterTableTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + afterTableTextView.setGravity(Gravity.CENTER); + afterTableTextView.setLineSpacing(dp(2), 1f); + afterTableTextView.setLinkTextColor(Theme.getColor(Theme.key_chat_messageLinkIn, resourcesProvider)); + afterTableTextView.setDisablePaddingsOffsetY(true); + afterTableTextView.setPadding(dp(5), 0, dp(5), 0); + infoLayout.addView(afterTableTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 5, 6, 5, 16)); + afterTableTextView.setVisibility(View.GONE); + + button = new ButtonWithCounterView(context, resourcesProvider); + button.setText(getString(R.string.OK), false); + FrameLayout.LayoutParams buttonLayoutParams = LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.BOTTOM | Gravity.FILL_HORIZONTAL, 0, 0, 0, 4); + buttonLayoutParams.leftMargin = backgroundPaddingLeft + dp(14); + buttonLayoutParams.rightMargin = backgroundPaddingLeft + dp(14); + containerView.addView(button, buttonLayoutParams); + + upgradeLayout = new LinearLayout(context); + upgradeLayout.setOrientation(LinearLayout.VERTICAL); + upgradeLayout.setPadding(dp(4) + backgroundPaddingLeft, dp(24), dp(4) + backgroundPaddingLeft, dp(8 + 48)); + containerView.addView(upgradeLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL_HORIZONTAL | Gravity.BOTTOM)); + + upgradeFeatureCells = new AffiliateProgramFragment.FeatureCell[3]; + upgradeFeatureCells[0] = new AffiliateProgramFragment.FeatureCell(context, resourcesProvider); + upgradeFeatureCells[0].set(R.drawable.menu_feature_unique, getString(R.string.Gift2UpgradeFeature1Title), getString(R.string.Gift2UpgradeFeature1Text)); + upgradeLayout.addView(upgradeFeatureCells[0], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + + upgradeFeatureCells[1] = new AffiliateProgramFragment.FeatureCell(context, resourcesProvider); + upgradeFeatureCells[1].set(R.drawable.menu_feature_transfer, getString(R.string.Gift2UpgradeFeature2Title), getString(R.string.Gift2UpgradeFeature2Text)); + upgradeLayout.addView(upgradeFeatureCells[1], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + + upgradeFeatureCells[2] = new AffiliateProgramFragment.FeatureCell(context, resourcesProvider); + upgradeFeatureCells[2].set(R.drawable.menu_feature_tradable, getString(R.string.Gift2UpgradeFeature3Title), getString(R.string.Gift2UpgradeFeature3Text)); + upgradeLayout.addView(upgradeFeatureCells[2], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + + checkboxSeparator = new View(context); + checkboxSeparator.setBackgroundColor(Theme.getColor(Theme.key_divider, resourcesProvider)); + upgradeLayout.addView(checkboxSeparator, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 1.0f / AndroidUtilities.density, Gravity.FILL_HORIZONTAL, 17, -4, 17, 6)); + + checkboxLayout = new LinearLayout(context); + checkboxLayout.setPadding(dp(12), dp(8), dp(12), dp(8)); + checkboxLayout.setOrientation(LinearLayout.HORIZONTAL); + checkboxLayout.setBackground(Theme.createRadSelectorDrawable(Theme.getColor(Theme.key_listSelector, resourcesProvider), 6, 6)); + checkbox = new CheckBox2(context, 24, resourcesProvider); + checkbox.setColor(Theme.key_radioBackgroundChecked, Theme.key_checkboxDisabled, Theme.key_checkboxCheck); + checkbox.setDrawUnchecked(true); + checkbox.setChecked(false, false); + checkbox.setDrawBackgroundAsArc(10); + checkboxLayout.addView(checkbox, LayoutHelper.createLinear(26, 26, Gravity.CENTER_VERTICAL, 0, 0, 0, 0)); + checkboxTextView = new TextView(context); + checkboxTextView.setTextColor(getThemedColor(Theme.key_dialogTextBlack)); + checkboxTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + checkboxTextView.setText(LocaleController.getString(R.string.Gift2AddSenderName)); + checkboxLayout.addView(checkboxTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, 9, 0, 0, 0)); + upgradeLayout.addView(checkboxLayout, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 0, 0, 0, 4)); + ScaleStateListAnimator.apply(checkboxLayout, 0.025f, 1.5f); + checkboxLayout.setOnClickListener(v -> { + if (button.isLoading()) return; + checkbox.setChecked(!checkbox.isChecked(), true); + }); + + wearLayout = new LinearLayout(context); + wearLayout.setOrientation(LinearLayout.VERTICAL); + wearLayout.setPadding(dp(4) + backgroundPaddingLeft, dp(20), dp(4) + backgroundPaddingLeft, dp(8 + 48)); + containerView.addView(wearLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL_HORIZONTAL | Gravity.BOTTOM)); + + wearTitle = new TextView(context); + wearTitle.setTextColor(Theme.getColor(Theme.key_dialogTextBlack, resourcesProvider)); + wearTitle.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); + wearTitle.setGravity(Gravity.CENTER); + wearTitle.setTypeface(AndroidUtilities.bold()); + wearLayout.addView(wearTitle, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.FILL_HORIZONTAL, 20, 0, 20, 0)); + + wearSubtitle = new TextView(context); + wearSubtitle.setTextColor(Theme.getColor(Theme.key_dialogTextBlack, resourcesProvider)); + wearSubtitle.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + wearSubtitle.setGravity(Gravity.CENTER); + wearSubtitle.setText(LocaleController.getString(R.string.Gift2WearSubtitle)); + wearLayout.addView(wearSubtitle, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.FILL_HORIZONTAL, 20, 6, 20, 24)); + + wearFeatureCells = new AffiliateProgramFragment.FeatureCell[3]; + wearFeatureCells[0] = new AffiliateProgramFragment.FeatureCell(context, resourcesProvider); + wearFeatureCells[0].set(R.drawable.menu_feature_unique, getString(R.string.Gift2WearFeature1Title), getString(R.string.Gift2WearFeature1Text)); + wearLayout.addView(wearFeatureCells[0], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + + wearFeatureCells[1] = new AffiliateProgramFragment.FeatureCell(context, resourcesProvider); + wearFeatureCells[1].set(R.drawable.menu_feature_cover, getString(R.string.Gift2WearFeature2Title), getString(R.string.Gift2WearFeature2Text)); + wearLayout.addView(wearFeatureCells[1], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + + wearFeatureCells[2] = new AffiliateProgramFragment.FeatureCell(context, resourcesProvider); + wearFeatureCells[2].set(R.drawable.menu_verification, getString(R.string.Gift2WearFeature3Title), getString(R.string.Gift2WearFeature3Text)); + wearLayout.addView(wearFeatureCells[2], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + + infoLayout.setAlpha(1.0f); + upgradeLayout.setAlpha(0.0f); + wearLayout.setAlpha(0.0f); + + topView = new TopView(context, resourcesProvider, this::onBackPressed, this::onMenuPressed, v -> openTransfer(), this::onWearPressed, this::onSharePressed); + topView.setPadding(backgroundPaddingLeft, 0, backgroundPaddingLeft, 0); + containerView.addView(topView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.FILL_HORIZONTAL | Gravity.BOTTOM)); + + fireworksOverlay = new FireworksOverlay(context); + container.addView(fireworksOverlay, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); + + bottomBulletinContainer = new FrameLayout(context); + bottomBulletinContainer.setPadding(backgroundPaddingLeft + dp(14 - 8), 0, backgroundPaddingLeft + dp(14 - 8), 0); + containerView.addView(bottomBulletinContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 200, Gravity.FILL_HORIZONTAL | Gravity.BOTTOM, 0, 0, 0, 4 + 48)); + } + + public static boolean isMine(int currentAccount, long dialogId) { + if (dialogId >= 0) { + return UserConfig.getInstance(currentAccount).getClientUserId() == dialogId; + } else { + final TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-dialogId); + return ChatObject.canUserDoAction(chat, ChatObject.ACTION_POST); + } + } + + public static boolean isMineWithActions(int currentAccount, long dialogId) { + if (dialogId >= 0) { + return UserConfig.getInstance(currentAccount).getClientUserId() == dialogId; + } else { + final TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-dialogId); + return chat != null && chat.creator; + } + } + + private void onMenuPressed(View btn) { + final String link = getLink(); + ItemOptions.makeOptions(container, resourcesProvider, btn) + .addIf(link != null, R.drawable.msg_link, getString(R.string.CopyLink), () -> { + AndroidUtilities.addToClipboard(link); + getBulletinFactory() + .createCopyLinkBulletin(false) + .show(); + }) + .addIf(link != null, R.drawable.msg_share, getString(R.string.ShareFile), () -> { + onSharePressed(null); + }) + .addIf(canTransfer(), R.drawable.menu_feature_transfer, getString(R.string.Gift2TransferOption), this::openTransfer) + .addIf(savedStarGift == null && getDialogId() != 0, R.drawable.msg_view_file, getString(R.string.Gift2ViewInProfile), this::openInProfile) + .setDrawScrim(false) + .setOnTopOfScrim() + .setDimAlpha(0) + .translate(0, -dp(2)) + .show(); + } + + private ColoredImageSpan lockSpan; + private boolean shownWearInfo; + private void onWearPressed(View v) { + if (UserConfig.getInstance(currentAccount).isPremium() && (isWorn() || shownWearInfo)) { + toggleWear(); + return; + } + final TL_stars.TL_starGiftUnique gift = getUniqueGift(); + if (gift == null) return; + final long owner_id = DialogObject.getPeerDialogId(gift.owner_id); + final String product = gift.title + " #" + LocaleController.formatNumber(gift.num, ','); + wearTitle.setText(LocaleController.formatString(R.string.Gift2WearTitle, product)); + SpannableStringBuilder buttonText = new SpannableStringBuilder(getString(R.string.Gift2WearStart)); + if (!UserConfig.getInstance(currentAccount).isPremium()) { + buttonText.append(" l"); + if (lockSpan == null) { + lockSpan = new ColoredImageSpan(R.drawable.msg_mini_lock3); + } + buttonText.setSpan(lockSpan, buttonText.length() - 1, buttonText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + } + button.setText(buttonText, true); + button.setOnClickListener(v2 -> { + shownWearInfo = true; + toggleWear(); + }); + topView.setWearPreview(MessagesController.getInstance(currentAccount).getUserOrChat(owner_id)); + switchPage(PAGE_WEAR, true); + } + + public StarGiftSheet setupWearPage() { + final TL_stars.TL_starGiftUnique gift = getUniqueGift(); + if (gift == null) return this; + final long owner_id = DialogObject.getPeerDialogId(gift.owner_id); + final String product = gift.title + " #" + LocaleController.formatNumber(gift.num, ','); + wearTitle.setText(LocaleController.formatString(R.string.Gift2WearTitle, product)); + SpannableStringBuilder buttonText = new SpannableStringBuilder(getString(R.string.Gift2WearStart)); + if (owner_id == UserConfig.getInstance(currentAccount).getClientUserId() && !UserConfig.getInstance(currentAccount).isPremium()) { + buttonText.append(" l"); + if (lockSpan == null) { + lockSpan = new ColoredImageSpan(R.drawable.msg_mini_lock3); + } + buttonText.setSpan(lockSpan, buttonText.length() - 1, buttonText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + } + button.setText(buttonText, true); + button.setOnClickListener(v2 -> { + shownWearInfo = true; + toggleWear(); + }); + topView.setWearPreview(MessagesController.getInstance(currentAccount).getUserOrChat(owner_id)); + switchPage(PAGE_WEAR, false); + onlyWearInfo = true; + return this; + } + + public boolean isWorn() { + final TL_stars.TL_starGiftUnique gift = getUniqueGift(); + if (gift == null) return false; + final long owner_id = DialogObject.getPeerDialogId(gift.owner_id); + if (owner_id == 0) return false; + if (owner_id > 0) { + final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(owner_id); + if (user != null && user.emoji_status instanceof TLRPC.TL_emojiStatusCollectible) { + final TLRPC.TL_emojiStatusCollectible status = (TLRPC.TL_emojiStatusCollectible) user.emoji_status; + return status.collectible_id == gift.id; + } + } else { + final TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-owner_id); + if (chat != null && chat.emoji_status instanceof TLRPC.TL_emojiStatusCollectible) { + final TLRPC.TL_emojiStatusCollectible status = (TLRPC.TL_emojiStatusCollectible) chat.emoji_status; + return status.collectible_id == gift.id; + } + } + return false; + } + + public void toggleWear() { + toggleWear(false); + } + public void toggleWear(boolean checkedLevel) { + final TL_stars.TL_starGiftUnique gift = getUniqueGift(); + if (gift == null) return; + MessagesController.getGlobalMainSettings().edit().putInt("statusgiftpage", 3).apply(); + final boolean worn = !isWorn(); + if (isWorn()) { + MessagesController.getInstance(currentAccount).updateEmojiStatus(getDialogId(), new TLRPC.TL_emojiStatusEmpty(), null); + } else { + final long did = getDialogId(); + if (did >= 0) { + if (!UserConfig.getInstance(currentAccount).isPremium()) { + BulletinFactory.of(bottomBulletinContainer, resourcesProvider) + .createSimpleBulletinDetail(R.raw.star_premium_2, AndroidUtilities.premiumText(getString(R.string.Gift2ActionWearNeededPremium), () -> { + new PremiumFeatureBottomSheet(getDummyFragment(), PremiumPreviewFragment.PREMIUM_FEATURE_EMOJI_STATUS, false).show(); + })) + .show(); + return; + } + } else if (!checkedLevel) { + final MessagesController m = MessagesController.getInstance(currentAccount); + button.setLoading(true); + MessagesController.getInstance(currentAccount).getBoostsController().getBoostsStats(did, boostsStatus -> { + if (boostsStatus == null || boostsStatus.level >= m.channelEmojiStatusLevelMin) { + button.setLoading(false); + toggleWear(true); + } else { + m.getBoostsController().userCanBoostChannel(did, boostsStatus, canApplyBoost -> { + button.setLoading(false); + LimitReachedBottomSheet limitReachedBottomSheet = new LimitReachedBottomSheet(getDummyFragment(), getContext(), LimitReachedBottomSheet.TYPE_BOOSTS_FOR_WEAR_COLLECTIBLE, currentAccount, resourcesProvider); + limitReachedBottomSheet.setCanApplyBoost(canApplyBoost); + limitReachedBottomSheet.setBoostsStats(boostsStatus, true); + limitReachedBottomSheet.setDialogId(did); + final TLRPC.Chat channel = m.getChat(-did); + if (channel != null) { + limitReachedBottomSheet.showStatisticButtonInLink(() -> { + presentFragment(StatisticActivity.create(channel)); + }); + } + limitReachedBottomSheet.show(); + }); + } + }); + return; + } + final TLRPC.TL_inputEmojiStatusCollectible status = new TLRPC.TL_inputEmojiStatusCollectible(); + status.collectible_id = gift.id; + MessagesController.getInstance(currentAccount).updateEmojiStatus(getDialogId(), status, gift); + } + topView.buttons[1].set(worn ? R.drawable.filled_crown_off : R.drawable.filled_crown_on, getString(worn ? R.string.Gift2ActionWearOff : R.string.Gift2ActionWear), true); + if (onlyWearInfo) { + dismiss(); + return; + } + final Runnable showHint = () -> showHint(AndroidUtilities.replaceTags(formatString(worn ? R.string.Gift2ActionWearDone : R.string.Gift2ActionWearOffDone, getGiftName())), ownerTextView, true); + if (currentPage.is(PAGE_INFO)) { + showHint.run(); + } else { + switchPage(PAGE_INFO, true, showHint); + } + button.setText(getString(R.string.OK), true); + button.setOnClickListener(v -> onBackPressed()); + } + + private BaseFragment getDummyFragment() { + return new BaseFragment() { + @Override + public int getCurrentAccount() { + return currentAccount; + } + + @Override + public Context getContext() { + return StarGiftSheet.this.getContext(); + } + + @Override + public Activity getParentActivity() { + Context context = getContext(); + while (context instanceof ContextWrapper) { + if (context instanceof Activity) { + return (Activity) context; + } + context = ((ContextWrapper) context).getBaseContext(); + } + return null; + } + + @Override + public Dialog showDialog(Dialog dialog) { + dialog.show(); + return dialog; + } + }; + } + + private ShareAlert shareAlert; + public void onSharePressed(View btn) { + if (shareAlert != null && shareAlert.isShown()) { + shareAlert.dismiss(); + } + final String link = getLink(); + shareAlert = new ShareAlert(getContext(), null, null, link, null, false, link, null, false, false, true, null, resourcesProvider) { + { includeStoryFromMessage = true; } + + @Override + protected void onShareStory(View cell) { + repostStory(cell); + } + + @Override + protected void onSend(LongSparseArray dids, int count, TLRPC.TL_forumTopic topic) { + super.onSend(dids, count, topic); + BulletinFactory bulletinFactory = getBulletinFactory(); + if (bulletinFactory != null) { + if (dids.size() == 1) { + long did = dids.keyAt(0); + if (did == UserConfig.getInstance(currentAccount).clientUserId) { + bulletinFactory.createSimpleBulletin(R.raw.saved_messages, AndroidUtilities.replaceTags(LocaleController.formatString(R.string.LinkSharedToSavedMessages)), Bulletin.DURATION_PROLONG).hideAfterBottomSheet(false).show(); + } else if (did < 0) { + TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-did); + bulletinFactory.createSimpleBulletin(R.raw.forward, AndroidUtilities.replaceTags(LocaleController.formatString(R.string.LinkSharedTo, topic != null ? topic.title : chat.title)), Bulletin.DURATION_PROLONG).hideAfterBottomSheet(false).show(); + } else { + TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(did); + bulletinFactory.createSimpleBulletin(R.raw.forward, AndroidUtilities.replaceTags(LocaleController.formatString(R.string.LinkSharedTo, user.first_name)), Bulletin.DURATION_PROLONG).hideAfterBottomSheet(false).show(); + } + } else { + bulletinFactory.createSimpleBulletin(R.raw.forward, AndroidUtilities.replaceTags(LocaleController.formatPluralString("LinkSharedToManyChats", dids.size(), dids.size()))).hideAfterBottomSheet(false).show(); + } + try { + container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} + } + } + }; + shareAlert.setDelegate(new ShareAlert.ShareAlertDelegate() { + @Override + public boolean didCopy() { + getBulletinFactory() + .createCopyLinkBulletin(false) + .show(); + return true; + } + }); + shareAlert.show(); + } + + private void repostStory(View cell) { + Activity activity = LaunchActivity.instance; + if (activity == null) { + return; + } + StoryRecorder.SourceView sourceView = null; + if (cell instanceof ShareDialogCell) { + sourceView = StoryRecorder.SourceView.fromShareCell((ShareDialogCell) cell); + } + final ArrayList messageObjects = new ArrayList<>(); + if (messageObject != null) { + messageObjects.add(messageObject); + } else if (getGift() instanceof TL_stars.TL_starGiftUnique) { + final long selfId = UserConfig.getInstance(currentAccount).getClientUserId(); + final TL_stars.TL_starGiftUnique gift = (TL_stars.TL_starGiftUnique) getGift(); + + final TLRPC.TL_messageService message = new TLRPC.TL_messageService(); + message.peer_id = MessagesController.getInstance(currentAccount).getPeer(selfId); + message.from_id = MessagesController.getInstance(currentAccount).getPeer(selfId); + message.date = ConnectionsManager.getInstance(currentAccount).getCurrentTime(); + final TLRPC.TL_messageActionStarGiftUnique action = new TLRPC.TL_messageActionStarGiftUnique(); + action.gift = gift; + action.upgrade = true; + message.action = action; + + final MessageObject msg = new MessageObject(currentAccount, message, false, false); + msg.setType(); + messageObjects.add(msg); + } else { + return; + } + StoryRecorder editor = StoryRecorder.getInstance(activity, currentAccount); + editor.setOnPrepareCloseListener((t, close, sent, did) -> { + if (sent) { + AndroidUtilities.runOnUIThread(() -> { + String chatTitle = ""; + if (did < 0) { + TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-did); + if (chat != null) { + chatTitle = chat.title; + } + } + getBulletinFactory() + .createSimpleBulletin(R.raw.contact_check, AndroidUtilities.replaceTags( + TextUtils.isEmpty(chatTitle) ? + LocaleController.getString(R.string.GiftRepostedToProfile) : + LocaleController.formatString(R.string.GiftRepostedToChannelProfile, chatTitle) + )).show(); + }); + editor.replaceSourceView(null); + if (shareAlert != null) { + shareAlert.dismiss(); + shareAlert = null; + } + } else { + StoryRecorder.SourceView sourceView2 = null; + if (cell instanceof ShareDialogCell && cell.isAttachedToWindow()) { + sourceView2 = StoryRecorder.SourceView.fromShareCell((ShareDialogCell) cell); + } + editor.replaceSourceView(sourceView2); + } + AndroidUtilities.runOnUIThread(close); + }); + editor.openRepost(sourceView, StoryEntry.repostMessage(messageObjects)); + } + + private class ContainerView extends FrameLayout { + + private final RectF rect = new RectF(); + private final Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private final Path path = new Path(); + + public ContainerView(Context context) { + super(context); + setWillNotDraw(false); + setClipChildren(false); + setClipToPadding(false); + } + + @Override + protected void dispatchDraw(@NonNull Canvas canvas) { + canvas.save(); + + final float top = top(); + final float r = dp(12); + rect.set(backgroundPaddingLeft, top, getWidth() - backgroundPaddingLeft, getHeight() + r); + backgroundPaint.setColor(getThemedColor(Theme.key_dialogBackground)); + path.rewind(); + path.addRoundRect(rect, r, r, Path.Direction.CW); + canvas.drawPath(path, backgroundPaint); + canvas.clipPath(path); + + super.dispatchDraw(canvas); + updateTopViewTranslation(); + + canvas.restore(); + } + + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + super.onLayout(changed, left, top, right, bottom); + onSwitchedPage(); + } + + public void updateTopViewTranslation() { + topView.setTranslationY(topView.getMeasuredHeight() - height()); + if (topBulletinContainer != null) { + topBulletinContainer.setTranslationY(getTranslationY() - height() - AndroidUtilities.navigationBarHeight); + } + } + + @Override + public void setTranslationY(float translationY) { + super.setTranslationY(translationY); + if (topBulletinContainer != null) { + topBulletinContainer.setTranslationY(getTranslationY() - height() - AndroidUtilities.navigationBarHeight); + } + } + + public float height() { + float h = 0; + h += topView.getRealHeight(); + h += currentPage.at(PAGE_INFO) * infoLayout.getMeasuredHeight(); + h += currentPage.at(PAGE_UPGRADE) * upgradeLayout.getMeasuredHeight(); + h += currentPage.at(PAGE_WEAR) * wearLayout.getMeasuredHeight(); + return h; + } + + public float top() { + return Math.max(0, getHeight() - height()); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + int width = MeasureSpec.getSize(widthMeasureSpec); + for (int i = 0; i < getChildCount(); ++i) { + View child = getChildAt(i); + if (child == button) { + button.measure(MeasureSpec.makeMeasureSpec(width - backgroundPaddingLeft * 2 - dp(14) * 2, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(dp(48), MeasureSpec.EXACTLY)); + } else if (child instanceof HintView2) { + child.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(dp(100), MeasureSpec.EXACTLY)); + } else { + child.measure(widthMeasureSpec, heightMeasureSpec); + } + } + int height = Math.max(infoLayout.getMeasuredHeight(), upgradeLayout.getMeasuredHeight()) + topView.getMeasuredHeight(); + setMeasuredDimension(width, height); + } + } + + public static class TopView extends FrameLayout { + + private final Theme.ResourcesProvider resourcesProvider; + private final FrameLayout imageLayout; + private final BackupImageView[] imageView = new BackupImageView[3]; + private int currentImageIndex = 0; + + private final LinearLayout[] layout = new LinearLayout[3]; + private final FrameLayout.LayoutParams[] layoutLayoutParams = new FrameLayout.LayoutParams[3]; + + private final LinkSpanDrawable.LinksTextView[] titleView = new LinkSpanDrawable.LinksTextView[3]; + private LinkSpanDrawable.LinksTextView priceView; + private final LinkSpanDrawable.LinksTextView[] subtitleView = new LinkSpanDrawable.LinksTextView[3]; + private final LinearLayout.LayoutParams[] subtitleViewLayoutParams = new LinearLayout.LayoutParams[3]; + private final LinearLayout buttonsLayout; + private int buttonsBackgroundColor; + public final Button[] buttons; + + private FrameLayout userLayout; + private BackupImageView avatarView; + + private final ImageView closeView; + private final ImageView optionsView; + + public static class Button extends FrameLayout { + + public ImageView imageView; + public TextView textView; + + public Button(Context context) { + super(context); + + imageView = new ImageView(context); + imageView.setScaleType(ImageView.ScaleType.CENTER); + imageView.setColorFilter(new PorterDuffColorFilter(0xFFFFFFFF, PorterDuff.Mode.SRC_IN)); + addView(imageView, LayoutHelper.createFrame(24, 24, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 0, 8, 0, 0)); + + textView = new TextView(context); + textView.setTypeface(AndroidUtilities.bold()); + textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12); + textView.setTextColor(0xFFFFFFFF); + textView.setGravity(Gravity.CENTER); + addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 4, 35, 4, 0)); + } + + public void set(int iconResId, CharSequence text, boolean animated) { + if (animated) { + AndroidUtilities.updateImageViewImageAnimated(imageView, iconResId); + } else { + imageView.setImageResource(iconResId); + } + textView.setText(text); + } + } + + public TopView(Context context, Theme.ResourcesProvider resourcesProvider, Runnable dismiss, View.OnClickListener onMenuClick, View.OnClickListener onTransferClick, View.OnClickListener onWearClick, View.OnClickListener onShareClick) { + super(context); + this.resourcesProvider = resourcesProvider; + + setWillNotDraw(false); + + imageLayout = new FrameLayout(context); + for (int i = 0; i < 3; ++i) { + imageView[i] = new BackupImageView(context); + imageView[i].setLayerNum(4 | 6656); + if (i > 0) { + imageView[i].getImageReceiver().setCrossfadeDuration(1); + } + imageLayout.addView(imageView[i], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL)); + imageView[i].setAlpha(i == currentImageIndex ? 1.0f : 0.0f); + } + + buttonsLayout = new LinearLayout(context); + buttonsLayout.setOrientation(LinearLayout.HORIZONTAL); + buttons = new Button[3]; + for (int i = 0; i < buttons.length; ++i) { + buttons[i] = new Button(context); + switch (i) { + case 0: + buttons[i].set(R.drawable.filled_gift_transfer, getString(R.string.Gift2ActionTransfer), false); + buttons[i].setOnClickListener(onTransferClick); + break; + case 1: + buttons[i].set(R.drawable.filled_crown_on, getString(R.string.Gift2ActionWear), false); + buttons[i].setOnClickListener(onWearClick); + break; + case 2: + buttons[i].set(R.drawable.filled_share, getString(R.string.Gift2ActionShare), false); + buttons[i].setOnClickListener(onShareClick); + break; + } + ScaleStateListAnimator.apply(buttons[i], .075f, 1.5f); + buttonsLayout.addView(buttons[i], LayoutHelper.createLinear(0, 56, 1, Gravity.FILL, i == 0 ? 0 : 11, 0, 0, 0)); + } + + for (int i = 0; i < 3; ++i) { + layout[i] = new LinearLayout(context); + layout[i].setOrientation(LinearLayout.VERTICAL); + addView(layout[i], layoutLayoutParams[i] = LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.FILL, 16, i == 2 ? 64 : 8 + 160 + 2, 16, 0)); + + if (i == 2) { + userLayout = new FrameLayout(context); + layout[i].addView(userLayout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 104, Gravity.FILL)); + + avatarView = new BackupImageView(context); + avatarView.setRoundRadius(dp(30)); + userLayout.addView(avatarView, LayoutHelper.createFrame(60, 60, Gravity.CENTER_VERTICAL | Gravity.LEFT, 1, 0, 0, 0)); + + titleView[i] = new LinkSpanDrawable.LinksTextView(context); + titleView[i].setTextColor(0xFFFFFFFF); + titleView[i].setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); + titleView[i].setTypeface(AndroidUtilities.bold()); + titleView[i].setSingleLine(); + titleView[i].setEllipsize(TextUtils.TruncateAt.END); + userLayout.addView(titleView[i], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.FILL_HORIZONTAL | Gravity.TOP, 81, 30.33f, 36 + 4, 0)); + + subtitleView[i] = new LinkSpanDrawable.LinksTextView(context); + subtitleView[i].setTextColor(Theme.getColor(Theme.key_dialogTextBlack, resourcesProvider)); + subtitleView[i].setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + subtitleView[i].setLinkTextColor(Theme.getColor(Theme.key_chat_messageLinkIn, resourcesProvider)); + subtitleView[i].setLineSpacing(dp(2), 1f); + subtitleView[i].setDisablePaddingsOffsetY(true); + subtitleView[i].setSingleLine(); + titleView[i].setEllipsize(TextUtils.TruncateAt.END); + userLayout.addView(subtitleView[i], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.FILL_HORIZONTAL | Gravity.TOP, 81, 57, 4, 0)); + + } else { + + titleView[i] = new LinkSpanDrawable.LinksTextView(context); + titleView[i].setTextColor(Theme.getColor(Theme.key_dialogTextBlack, resourcesProvider)); + titleView[i].setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); + titleView[i].setTypeface(AndroidUtilities.bold()); + titleView[i].setGravity(Gravity.CENTER); + layout[i].addView(titleView[i], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 24, 0, 24, 0)); + + if (i == 0) { + priceView = new LinkSpanDrawable.LinksTextView(context); + priceView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); + priceView.setTypeface(AndroidUtilities.bold()); + priceView.setGravity(Gravity.CENTER); + priceView.setTextColor(Theme.getColor(Theme.key_color_green, resourcesProvider)); + layout[i].addView(priceView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 24, 0, 24, 4)); + } + + subtitleView[i] = new LinkSpanDrawable.LinksTextView(context); + subtitleView[i].setTextColor(Theme.getColor(Theme.key_dialogTextBlack, resourcesProvider)); + subtitleView[i].setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + subtitleView[i].setGravity(Gravity.CENTER); + subtitleView[i].setLinkTextColor(Theme.getColor(Theme.key_chat_messageLinkIn, resourcesProvider)); + subtitleView[i].setLineSpacing(dp(2), 1f); + subtitleView[i].setDisablePaddingsOffsetY(true); + layout[i].addView(subtitleView[i], subtitleViewLayoutParams[i] = LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 24, 0, 24, 0)); + subtitleViewLayoutParams[i].topMargin = dp(i == 1 ? 7.33f : (backdrop[0] == null ? 9 : 5.66f)); + } + + if (i == 0) { + layout[i].addView(buttonsLayout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.FILL_HORIZONTAL, 0, 15, 0, 0)); + } + } + addView(imageLayout, LayoutHelper.createFrame(160, 160, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 0, 8, 0, 0)); + + closeView = new ImageView(context); + closeView.setBackground(Theme.createCircleDrawable(dp(28), 0x24FFFFFF)); + closeView.setImageResource(R.drawable.msg_close); + ScaleStateListAnimator.apply(closeView); + addView(closeView, LayoutHelper.createFrame(28, 28, Gravity.RIGHT | Gravity.TOP, 0, 12, 12, 0)); + closeView.setOnClickListener(v -> dismiss.run()); + closeView.setVisibility(View.GONE); + + optionsView = new ImageView(context); + optionsView.setImageResource(R.drawable.media_more); + optionsView.setScaleType(ImageView.ScaleType.CENTER); + optionsView.setBackground(Theme.createSelectorDrawable(0x20ffffff, Theme.RIPPLE_MASK_CIRCLE_20DP)); + ScaleStateListAnimator.apply(optionsView); + addView(optionsView, LayoutHelper.createFrame(42, 42, Gravity.TOP | Gravity.RIGHT, 0, 5, 5, 0)); + optionsView.setOnClickListener(onMenuClick); + optionsView.setVisibility(View.GONE); + } + + public void setText(int page, CharSequence title, long amount, CharSequence subtitle) { + titleView[page].setText(title); + if (page == 0) { + priceView.setTextColor(Theme.getColor(Theme.key_color_green, resourcesProvider)); + priceView.setText(replaceStarsWithPlain(LocaleController.formatNumber((int) amount, ' ') + " ⭐️", .8f)); + priceView.setVisibility(amount != 0 ? View.VISIBLE : View.GONE); + } + subtitleView[page].setText(subtitle); + subtitleView[page].setVisibility(TextUtils.isEmpty(subtitle) ? View.GONE : View.VISIBLE); + } + + private PageTransition currentPage = new PageTransition(PAGE_INFO, PAGE_INFO, 1.0f); + public void onSwitchPage(PageTransition p) { + currentPage = p; + for (int i = 0; i < layout.length; ++i) { + layout[i].setAlpha(p.at(i)); + } + closeView.setAlpha(Math.max(backdrop[0] != null ? p.at(PAGE_WEAR) : 0.0f, backdrop[1] != null ? p.at(PAGE_UPGRADE) : 0.0f)); + closeView.setVisibility(backdrop[0] != null && p.to == PAGE_WEAR || backdrop[1] != null && p.to == PAGE_UPGRADE ? View.VISIBLE : View.GONE); + optionsView.setAlpha(lerp(false, backdrop[0] != null, p.at(PAGE_INFO))); + optionsView.setVisibility(backdrop[0] != null && p.to == PAGE_INFO ? View.VISIBLE : View.GONE); + final int black = Theme.getColor(Theme.key_dialogTextBlack, resourcesProvider); + for (int i = 0; i < 2; ++i) { + titleView[i].setTextColor(backdrop[Math.min(1, i)] == null ? black : 0xFFFFFFFF); + subtitleView[i].setTextColor(i == 0 || i == 2 ? (backdrop[i] == null ? black : backdrop[i].text_color | 0xFF000000) : ColorUtils.blendARGB(backdrop[1] == null ? black : backdrop[1].text_color | 0xFF000000, backdrop[2] == null ? black : backdrop[2].text_color | 0xFF000000, toggleBackdrop)); + + boolean changed; + if (backdrop[i] != null) { + changed = dp(24 + 160) != layoutLayoutParams[i].topMargin; + if (changed) { + layout[i].setPadding(0, 0, 0, dp(18)); + layoutLayoutParams[i].topMargin = dp(24 + 160); + } + } else { + changed = dp(8 + 160 + 2) != layoutLayoutParams[i].topMargin; + if (changed) { + layout[i].setPadding(0, 0, 0, dp(3)); + layoutLayoutParams[i].topMargin = dp(8 + 160 + 2); + } + } + subtitleViewLayoutParams[i].topMargin = dp(i == 1 ? 7.33f : (backdrop[0] == null ? 9 : 5.66f)); + if (changed) { + layout[i].setLayoutParams(layoutLayoutParams[i]); + subtitleView[i].setLayoutParams(subtitleViewLayoutParams[i]); + } + } + subtitleView[2].setTextColor(backdrop[0] == null ? black : backdrop[0].text_color | 0xFF000000); + imageView[0].setAlpha(currentPage.at(PAGE_INFO, PAGE_WEAR)); + imageView[1].setAlpha(p.at(1) * (1.0f - toggleBackdrop)); + imageView[2].setAlpha(p.at(1) * toggleBackdrop); + imageLayout.setScaleX(lerp(1.0f, wearImageScale, p.at(PAGE_WEAR))); + imageLayout.setScaleY(lerp(1.0f, wearImageScale, p.at(PAGE_WEAR))); + imageLayout.setTranslationX(wearImageTx * p.at(PAGE_WEAR)); + imageLayout.setTranslationY(dp(16) * p.at(PAGE_UPGRADE) + wearImageTy * p.at(PAGE_WEAR)); + layout[2].setTranslationY(p.from != PAGE_WEAR || p.to != PAGE_WEAR ? -(layout[p.from == PAGE_WEAR ? p.to : p.from].getMeasuredHeight() - layout[2].getMeasuredHeight()) * (1.0f - p.at(PAGE_WEAR)) : 0); + invalidate(); + } + + public void prepareSwitchPage(final PageTransition t) { + if (t.from != t.to) { + final RLottieDrawable fromAnimation = imageView[t.from].getImageReceiver().getLottieAnimation(); + final RLottieDrawable toAnimation = imageView[t.to].getImageReceiver().getLottieAnimation(); + if (toAnimation != null && fromAnimation != null) { + toAnimation.setProgress(fromAnimation.getProgress(), false); + } + } + } + + private final TL_stars.starGiftAttributeBackdrop[] backdrop = new TL_stars.starGiftAttributeBackdrop[3]; + + private ArrayList sampleAttributes; + private BagRandomizer models; + private BagRandomizer patterns; + private BagRandomizer backdrops; + + private boolean hasLink; + + public void setGift(TL_stars.StarGift gift, boolean withButtons, boolean worn, boolean hasLink) { + final int page = 0; + if (gift instanceof TL_stars.TL_starGiftUnique) { + backdrop[page] = findAttribute(gift.attributes, TL_stars.starGiftAttributeBackdrop.class); + setPattern(page, findAttribute(gift.attributes, TL_stars.starGiftAttributePattern.class)); + subtitleView[page].setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13); + buttonsLayout.setVisibility(withButtons ? View.VISIBLE : View.GONE); + if (withButtons) { + buttons[1].set(worn ? R.drawable.filled_crown_off : R.drawable.filled_crown_on, getString(worn ? R.string.Gift2ActionWearOff : R.string.Gift2ActionWear), false); + } + } else { + backdrop[page] = null; + setPattern(page, null); + subtitleView[page].setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + buttonsLayout.setVisibility(View.GONE); + } + this.hasLink = hasLink; + setBackdropPaint(page, backdrop[page]); + setGiftImage(imageView[page].getImageReceiver(), gift, 160); + onSwitchPage(currentPage); + } + + public void setPreviewingAttributes(/* int page = 1, */ArrayList sampleAttributes) { + final int page = 1; + + this.sampleAttributes = sampleAttributes; + models = new BagRandomizer(findAttributes(sampleAttributes, TL_stars.starGiftAttributeModel.class)); + patterns = new BagRandomizer(findAttributes(sampleAttributes, TL_stars.starGiftAttributePattern.class)); + backdrops = new BagRandomizer(findAttributes(sampleAttributes, TL_stars.starGiftAttributeBackdrop.class)); + + subtitleView[page].setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + buttonsLayout.setVisibility(View.GONE); + + toggleBackdrop = 0.0f; + toggled = 0; + setPattern(1, patterns.next()); + setGiftImage(imageView[page].getImageReceiver(), models.next().document, 160); + setBackdropPaint(1, backdrop[1] = backdrops.next()); + + setGiftImage(imageView[page + 1].getImageReceiver(), models.getNext().document, 160); + + AndroidUtilities.cancelRunOnUIThread(checkToRotateRunnable); + AndroidUtilities.runOnUIThread(checkToRotateRunnable, 2500); + + invalidate(); + } + + private TLObject wearPreviewObject; + private float wearImageTx, wearImageTy, wearImageScale; + public void setWearPreview(TLObject object) { + wearPreviewObject = object; + String title, subtitle; + if (object instanceof TLRPC.User) { + final TLRPC.User user = (TLRPC.User) object; + title = UserObject.getUserName(user); + subtitle = getString(R.string.Online); + } else if (object instanceof TLRPC.Chat) { + final TLRPC.Chat chat = (TLRPC.Chat) object; + title = chat == null ? "" : chat.title; + if (ChatObject.isChannelAndNotMegaGroup(chat)) { + if (chat.participants_count > 1) { + subtitle = LocaleController.formatPluralStringComma("Subscribers", chat.participants_count); + } else { + subtitle = LocaleController.getString(R.string.DiscussChannel); + } + } else { + if (chat.participants_count > 1) { + subtitle = LocaleController.formatPluralStringComma("Members", chat.participants_count); + } else { + subtitle = LocaleController.getString(R.string.AccDescrGroup).toLowerCase(); + } + } + } else { + return; + } + + final AvatarDrawable avatarDrawable = new AvatarDrawable(); + avatarDrawable.setInfo(object); + avatarView.setForUserOrChat(object, avatarDrawable); + titleView[PAGE_WEAR].setText(title); + subtitleView[PAGE_WEAR].setText(subtitle); + + updateWearImageTranslation(); + onSwitchPage(currentPage); + } + + private void updateWearImageTranslation() { + wearImageScale = dpf2(33.33f) / dpf2(160.0f); + wearImageTx = -imageLayout.getLeft() + dp(97) + Math.min(titleView[PAGE_WEAR].getPaint().measureText(titleView[PAGE_WEAR].getText().toString()) + dp(12), titleView[PAGE_WEAR].getWidth()) - dp(160 - 33.33f) / 2.0f; + wearImageTy = -imageLayout.getTop() + dp(88.66f) - dp(160 - 33.33f) / 2.0f; + } + + private ValueAnimator rotationAnimator; + private final Runnable checkToRotateRunnable = () -> { + BackupImageView imageView = this.imageView[1 + (1 - this.toggled)]; + if (imageView.getImageReceiver().hasImageLoaded()) { + rotateAttributes(); + } else { + AndroidUtilities.cancelRunOnUIThread(this.checkToRotateRunnable); + AndroidUtilities.runOnUIThread(this.checkToRotateRunnable, 150); + } + }; + private void rotateAttributes() { + if (currentPage == null || currentPage.to != PAGE_UPGRADE || !isAttachedToWindow()) { + return; + } + AndroidUtilities.cancelRunOnUIThread(checkToRotateRunnable); + if (rotationAnimator != null) { + rotationAnimator.cancel(); + rotationAnimator = null; + } + + toggled = 1 - toggled; + + final RLottieDrawable fromAnimation = imageView[1 + (1 - toggled)].getImageReceiver().getLottieAnimation(); + final RLottieDrawable toAnimation = imageView[1 + toggled].getImageReceiver().getLottieAnimation(); + if (toAnimation != null && fromAnimation != null) { + toAnimation.setProgress(fromAnimation.getProgress(), false); + } + + models.next(); + setBackdropPaint(1 + toggled, backdrop[1 + toggled] = backdrops.next()); + setPattern(1, patterns.next()); + animateSwitch(); + + rotationAnimator = ValueAnimator.ofFloat(1.0f - toggled, toggled); + rotationAnimator.addUpdateListener(anm -> { + toggleBackdrop = (float) anm.getAnimatedValue(); + onSwitchPage(currentPage); + }); + rotationAnimator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + toggleBackdrop = toggled; + onSwitchPage(currentPage); + setGiftImage(imageView[1 + (1 - toggled)].getImageReceiver(), models.getNext().document, 160); + + AndroidUtilities.cancelRunOnUIThread(checkToRotateRunnable); + AndroidUtilities.runOnUIThread(checkToRotateRunnable, 2500); + } + }); + rotationAnimator.setDuration(320); + rotationAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT); + rotationAnimator.start(); + } + + private final Paint[] backgroundPaint = new Paint[3]; + private final RadialGradient[] backgroundGradient = new RadialGradient[3]; + private final Matrix[] backgroundMatrix = new Matrix[3]; + private LinearGradient profileBackgroundGradient; + private final Matrix profileBackgroundMatrix = new Matrix(); + private Paint profileBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + + private final AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable[] pattern = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable[2]; + { + for (int i = 0; i < backgroundPaint.length; ++i) { + backgroundPaint[i] = new Paint(Paint.ANTI_ALIAS_FLAG); + } + for (int i = 0; i < pattern.length; ++i) { + pattern[i] = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(this, dp(28)); + } + } + + private int toggled; + private float toggleBackdrop; + + private void setBackdropPaint(int p, TL_stars.starGiftAttributeBackdrop backdrop) { + if (backdrop == null) return; + backgroundGradient[p] = new RadialGradient(0, 0, dp(200), new int[] { backdrop.center_color | 0xFF000000, backdrop.edge_color | 0xFF000000 }, new float[] { 0, 1 }, Shader.TileMode.CLAMP); + if (p == 0) { + profileBackgroundGradient = new LinearGradient(0, 0, 0, dp(168), new int[] { backdrop.center_color | 0xFF000000, backdrop.edge_color | 0xFF000000 }, new float[] { 0, 1 }, Shader.TileMode.CLAMP); + profileBackgroundPaint.setShader(profileBackgroundGradient); + } + if (backgroundMatrix[p] == null) { + backgroundMatrix[p] = new Matrix(); + } + backgroundPaint[p].setShader(backgroundGradient[p]); + } + + private void setPattern(int p, TL_stars.starGiftAttributePattern pattern) { + if (pattern == null) return; + this.pattern[p].set(pattern.document, true); + } + + private boolean attached; + @Override + protected void onAttachedToWindow() { + attached = true; + super.onAttachedToWindow(); + this.pattern[0].attach(); + this.pattern[1].attach(); + } + + @Override + protected void onDetachedFromWindow() { + attached = false; + super.onDetachedFromWindow(); + this.pattern[0].detach(); + this.pattern[1].detach(); + AndroidUtilities.cancelRunOnUIThread(checkToRotateRunnable); + } + + private float switchScale = 1; + private ValueAnimator switchAnimator; + private void animateSwitch() { + if (switchAnimator != null) { + switchAnimator.cancel(); + switchAnimator = null; + } + + switchAnimator = ValueAnimator.ofFloat(0, 1); + switchAnimator.addUpdateListener(anm -> { + final float x = (float) anm.getAnimatedValue(); + switchScale = 1.0f + 0.6f * .125f * (float) Math.pow(2 * x - 2, 2) * x; + imageLayout.setScaleX(switchScale); + imageLayout.setScaleY(switchScale); + invalidate(); + }); + switchAnimator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + switchScale = 1; + imageLayout.setScaleX(switchScale); + imageLayout.setScaleY(switchScale); + invalidate(); + } + }); + switchAnimator.setDuration(320); + switchAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT); + switchAnimator.start(); + } + + private final RectF particlesBounds = new RectF(); + private StarsReactionsSheet.Particles particles; + + @Override + protected void dispatchDraw(@NonNull Canvas canvas) { + final float height = getRealHeight(); + + canvas.save(); + canvas.clipRect(0, 0, getWidth(), height); + + final float cx = getWidth() / 2.0f; + final float cy = lerp(dp(8), dp(24), currentPage.at(PAGE_UPGRADE)) + dp(160 / 2); + + final float infoBackdrop = currentPage.at(PAGE_INFO, PAGE_WEAR); + if (infoBackdrop > 0 && backdrop[0] != null) { + if (profileBackgroundGradient == null || currentPage.at(PAGE_WEAR) < 1) { + backgroundPaint[0].setAlpha((int) (0xFF * infoBackdrop)); + backgroundMatrix[0].reset(); + backgroundMatrix[0].postTranslate(cx, cy); + backgroundGradient[0].setLocalMatrix(backgroundMatrix[0]); + canvas.drawRect(0, 0, getWidth(), height, backgroundPaint[0]); + } + + if (profileBackgroundGradient != null && currentPage.at(PAGE_WEAR) > 0) { + profileBackgroundPaint.setAlpha((int) (0xFF * currentPage.at(PAGE_WEAR))); + profileBackgroundMatrix.reset(); + profileBackgroundMatrix.postTranslate(0, 0); + profileBackgroundGradient.setLocalMatrix(profileBackgroundMatrix); + canvas.drawRect(0, 0, getWidth(), height, profileBackgroundPaint); + } + + final int patternColor = backdrop[0].pattern_color | 0xFF000000; + if (currentPage.at(PAGE_INFO) > 0) { + canvas.save(); + canvas.translate(cx, cy); + pattern[0].setColor(patternColor); + StarGiftPatterns.drawPattern(canvas, pattern[0], getWidth(), height, currentPage.at(PAGE_INFO), 1.0f); + canvas.restore(); + } + if (currentPage.at(PAGE_WEAR) > 0) { + canvas.save(); + pattern[0].setColor(patternColor); + StarGiftPatterns.drawProfilePattern(canvas, pattern[0], getWidth(), height, currentPage.at(PAGE_WEAR), 1.0f); + canvas.restore(); + } + + if (patternColor != buttonsBackgroundColor) { + for (Button btn : buttons) { + btn.setBackground(Theme.createRadSelectorDrawable(ColorUtils.blendARGB(backdrop[0].edge_color | 0xFF000000, buttonsBackgroundColor = patternColor, .25f), 0x10FFFFFF, 10, 10)); + } + } + + if (currentPage.at(PAGE_WEAR) > 0) { + if (particles == null) { + particles = new StarsReactionsSheet.Particles(StarsReactionsSheet.Particles.TYPE_RADIAL, 12); + } + final float imageCx = imageLayout.getX() + imageLayout.getMeasuredWidth() / 2.0f, imageHw = imageLayout.getMeasuredWidth() * imageLayout.getScaleX() / 2.0f; + final float imageCy = imageLayout.getY() + imageLayout.getMeasuredHeight() / 2.0f, imageHh = imageLayout.getMeasuredHeight() * imageLayout.getScaleY() / 2.0f; + particlesBounds.set(imageCx - imageHw, imageCy - imageHh, imageCx + imageHw, imageCy + imageHh); + particles.setBounds(particlesBounds); + particles.process(); + particles.draw(canvas, Theme.multAlpha(0xFFFFFFFF, currentPage.at(PAGE_WEAR))); + invalidate(); + } + } + + if (currentPage.at(PAGE_UPGRADE) > 0) { + if (toggled == 0) { + if (toggleBackdrop > 0.0f && backdrop[2] != null) { + backgroundPaint[2].setAlpha((int) (0xFF * currentPage.at(PAGE_UPGRADE))); + backgroundMatrix[2].reset(); + backgroundMatrix[2].postTranslate(cx, cy); + backgroundGradient[2].setLocalMatrix(backgroundMatrix[2]); + canvas.drawRect(0, 0, getWidth(), height, backgroundPaint[2]); + } + if (toggleBackdrop < 1.0f && backdrop[1] != null) { + backgroundPaint[1].setAlpha((int) (0xFF * currentPage.at(PAGE_UPGRADE) * (1.0f - toggleBackdrop))); + backgroundMatrix[1].reset(); + backgroundMatrix[1].postTranslate(cx, cy); + backgroundGradient[1].setLocalMatrix(backgroundMatrix[1]); + canvas.drawRect(0, 0, getWidth(), height, backgroundPaint[1]); + } + } else { + if (toggleBackdrop < 1.0f && backdrop[1] != null) { + backgroundPaint[1].setAlpha((int) (0xFF * currentPage.at(PAGE_UPGRADE))); + backgroundMatrix[1].reset(); + backgroundMatrix[1].postTranslate(cx, cy); + backgroundGradient[1].setLocalMatrix(backgroundMatrix[1]); + canvas.drawRect(0, 0, getWidth(), height, backgroundPaint[1]); + } + if (toggleBackdrop > 0.0f && backdrop[2] != null) { + backgroundPaint[2].setAlpha((int) (0xFF * currentPage.at(PAGE_UPGRADE) * toggleBackdrop)); + backgroundMatrix[2].reset(); + backgroundMatrix[2].postTranslate(cx, cy); + backgroundGradient[2].setLocalMatrix(backgroundMatrix[2]); + canvas.drawRect(0, 0, getWidth(), height, backgroundPaint[2]); + } + } + + canvas.save(); + canvas.translate(cx, cy); + final int patternColor = ColorUtils.blendARGB(backdrop[1] == null ? 0 : backdrop[1].pattern_color | 0xFF000000, backdrop[2] == null ? 0 : backdrop[2].pattern_color | 0xFF000000, toggleBackdrop); + pattern[1].setColor(patternColor); + StarGiftPatterns.drawPattern(canvas, pattern[1], getWidth(), getRealHeight(), currentPage.at(PAGE_UPGRADE), switchScale); + canvas.restore(); + } + + super.dispatchDraw(canvas); + canvas.restore(); + } + + public float getRealHeight() { + float h = 0; + h += (dp(backdrop[0] != null ? 24 : 10) + dp(160) + layout[0].getMeasuredHeight()) * currentPage.at(PAGE_INFO); + h += (dp(backdrop[1] != null ? 24 : 10) + dp(160) + layout[1].getMeasuredHeight()) * currentPage.at(PAGE_UPGRADE); + h += (dp(64) + layout[2].getMeasuredHeight()) * currentPage.at(PAGE_WEAR); + return h; + } + + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + super.onLayout(changed, left, top, right, bottom); + if (currentPage.contains(PAGE_WEAR)) { + updateWearImageTranslation(); + onSwitchPage(currentPage); + } + } + } + + public static final int PAGE_INFO = 0; + public static final int PAGE_UPGRADE = 1; + public static final int PAGE_WEAR = 2; + + private PageTransition currentPage = new PageTransition(PAGE_INFO, PAGE_INFO, 1.0f); + private ValueAnimator switchingPagesAnimator; + public void switchPage(int page, boolean animated) { + switchPage(page, animated, null); + } + public void switchPage(int page, boolean animated, Runnable done) { + if (switchingPagesAnimator != null) { + switchingPagesAnimator.cancel(); + switchingPagesAnimator = null; + } + + if (page != PAGE_UPGRADE) { + AndroidUtilities.cancelRunOnUIThread(topView.checkToRotateRunnable); + } + + currentPage = new PageTransition(currentPage == null ? PAGE_INFO : currentPage.to, page, 0.0f); + if (animated) { + infoLayout.setVisibility(currentPage.contains(PAGE_INFO) ? View.VISIBLE : View.GONE); + upgradeLayout.setVisibility(currentPage.contains(PAGE_UPGRADE) ? View.VISIBLE : View.GONE); + wearLayout.setVisibility(currentPage.contains(PAGE_WEAR) ? View.VISIBLE : View.GONE); + switchingPagesAnimator = ValueAnimator.ofFloat(0.0f, 1.0f); + switchingPagesAnimator.addUpdateListener(a -> { + currentPage.setProgress((float) a.getAnimatedValue()); + onSwitchedPage(); + }); + switchingPagesAnimator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + onSwitchedPage(); + infoLayout.setVisibility(page == PAGE_INFO ? View.VISIBLE : View.GONE); + upgradeLayout.setVisibility(page == PAGE_UPGRADE ? View.VISIBLE : View.GONE); + wearLayout.setVisibility(page == PAGE_WEAR ? View.VISIBLE : View.GONE); + switchingPagesAnimator = null; + if (done != null) { + done.run(); + } + } + }); + switchingPagesAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT); + switchingPagesAnimator.setDuration(320); + switchingPagesAnimator.start(); + topView.prepareSwitchPage(currentPage); + } else { + currentPage.setProgress(1.0f); + onSwitchedPage(); + infoLayout.setVisibility(page == PAGE_INFO ? View.VISIBLE : View.GONE); + upgradeLayout.setVisibility(page == PAGE_UPGRADE ? View.VISIBLE : View.GONE); + wearLayout.setVisibility(page == PAGE_WEAR ? View.VISIBLE : View.GONE); + if (done != null) { + done.run(); + } + } + + if (currentHintView != null) { + currentHintView.hide(); + currentHintView = null; + } + } + + private void onSwitchedPage() { + infoLayout.setAlpha(currentPage.at(PAGE_INFO)); + upgradeLayout.setAlpha(currentPage.at(PAGE_UPGRADE)); + wearLayout.setAlpha(currentPage.at(PAGE_WEAR)); + topView.onSwitchPage(currentPage); + container.updateTopViewTranslation(); + container.invalidate(); + } + + public boolean canTransfer() { + if (getInputStarGift() == null) return false; + TL_stars.TL_starGiftUnique gift; + if (messageObject != null && messageObject.messageOwner != null && messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGiftUnique) { + TLRPC.TL_messageActionStarGiftUnique action = (TLRPC.TL_messageActionStarGiftUnique) messageObject.messageOwner.action; + if ((action.flags & 16) == 0) { + return false; + } + if (!(action.gift instanceof TL_stars.TL_starGiftUnique)) { + return false; + } + gift = (TL_stars.TL_starGiftUnique) action.gift; + } else if (savedStarGift != null && savedStarGift.gift instanceof TL_stars.TL_starGiftUnique) { + gift = (TL_stars.TL_starGiftUnique) savedStarGift.gift; + } else if (slugStarGift != null) { + gift = slugStarGift; + } else { + return false; + } + return isMineWithActions(currentAccount, DialogObject.getPeerDialogId(gift.owner_id)); + } + + private void addAttributeRow(TL_stars.StarGiftAttribute attr) { + String name; + if (attr instanceof TL_stars.starGiftAttributeModel) { + name = getString(R.string.Gift2AttributeModel); + } else if (attr instanceof TL_stars.starGiftAttributeBackdrop) { + name = getString(R.string.Gift2AttributeBackdrop); + } else if (attr instanceof TL_stars.starGiftAttributePattern) { + name = getString(R.string.Gift2AttributeSymbol); + } else return; + final ButtonSpan.TextViewButtons[] textView = new ButtonSpan.TextViewButtons[1]; + TableRow row = tableView.addRow(name, attr.name, percents(attr.rarity_permille), () -> showHint(LocaleController.formatString(R.string.Gift2RarityHint, percents(attr.rarity_permille)), textView[0], false)); + textView[0] = (ButtonSpan.TextViewButtons) ((TableView.TableRowContent) row.getChildAt(1)).getChildAt(0); + } + + private ColoredImageSpan upgradeIconSpan; + private boolean firstSet = true; + + public StarGiftSheet set(String slug, TL_stars.TL_starGiftUnique gift) { + this.slug = slug; + this.slugStarGift = gift; + + set(gift, true, false); + + beforeTableTextView.setVisibility(View.GONE); + afterTableTextView.setVisibility(View.GONE); + + if (firstSet) { + switchPage(PAGE_INFO, false); + firstSet = false; + } + + return this; + } + + private View ownerTextView; + public void set(TL_stars.TL_starGiftUnique gift, boolean canTransfer, boolean refunded) { + long owner_id = DialogObject.getPeerDialogId(gift.owner_id); + topView.setGift(gift, isMineWithActions(currentAccount, owner_id), isWorn(), getLink() != null); + topView.setText(0, gift.title, 0, LocaleController.formatPluralStringComma("Gift2CollectionNumber", gift.num)); + + ownerTextView = null; + tableView.clear(); + if (!refunded) { + if (!TextUtils.isEmpty(gift.owner_address)) { + tableView.addWalletAddressRow(getString(R.string.Gift2Owner), gift.owner_address, () -> { + getBulletinFactory().createSimpleBulletin(R.raw.copy, getString(R.string.WalletAddressCopied)).show(false); + }); + } else if (owner_id == 0 && gift.owner_name != null) { + tableView.addRow(getString(R.string.Gift2Owner), gift.owner_name); + } else if (owner_id != 0) { + TableRow row = tableView.addRowUserWithEmojiStatus(getString(R.string.Gift2Owner), currentAccount, owner_id, () -> openProfile(owner_id)); + ownerTextView = ((TableView.TableRowContent) row.getChildAt(1)).getChildAt(0); + } + } + addAttributeRow(findAttribute(gift.attributes, TL_stars.starGiftAttributeModel.class)); + addAttributeRow(findAttribute(gift.attributes, TL_stars.starGiftAttributeBackdrop.class)); + addAttributeRow(findAttribute(gift.attributes, TL_stars.starGiftAttributePattern.class)); + if (!refunded) { + if (messageObject != null) { + if (!messageObjectRepolled) { + final TableRow row = tableView.addRow(getString(R.string.Gift2Quantity), ""); + final TextView rowTextView = (TextView) ((TableView.TableRowContent) row.getChildAt(1)).getChildAt(0); + final SpannableStringBuilder sb = new SpannableStringBuilder("x "); + final LoadingSpan span = new LoadingSpan(rowTextView, dp(90), 0, resourcesProvider); + span.setColors( + Theme.multAlpha(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText, resourcesProvider), .21f), + Theme.multAlpha(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText, resourcesProvider), .08f) + ); + sb.setSpan(span, 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + rowTextView.setText(sb, TextView.BufferType.SPANNABLE); + + repollMessage(); + } else { + tableView.addRow(getString(R.string.Gift2Quantity), formatPluralStringComma("Gift2QuantityIssued1", gift.availability_issued) + formatPluralStringComma("Gift2QuantityIssued2", gift.availability_total)); + } + } else { + tableView.addRow(getString(R.string.Gift2Quantity), formatPluralStringComma("Gift2QuantityIssued1", gift.availability_issued) + formatPluralStringComma("Gift2QuantityIssued2", gift.availability_total)); + } + } + final TL_stars.starGiftAttributeOriginalDetails details = findAttribute(gift.attributes, TL_stars.starGiftAttributeOriginalDetails.class); + if (details != null) { + SpannableString from = null; + if ((details.flags & 1) != 0) { + final long sender_id = DialogObject.getPeerDialogId(details.sender_id); + from = new SpannableString(DialogObject.getName(sender_id)); + from.setSpan(new ClickableSpan() { + @Override + public void onClick(@NonNull View widget) { + openProfile(sender_id); + } + @Override + public void updateDrawState(@NonNull TextPaint ds) { + ds.setColor(ds.linkColor); + } + }, 0, from.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + } + final long recipient_id = DialogObject.getPeerDialogId(details.recipient_id); + SpannableString to = new SpannableString(DialogObject.getName(recipient_id)); + to.setSpan(new ClickableSpan() { + @Override + public void onClick(@NonNull View widget) { + openProfile(recipient_id); + } + @Override + public void updateDrawState(@NonNull TextPaint ds) { + ds.setColor(ds.linkColor); + } + }, 0, to.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + CharSequence comment = null; + if (details.message != null) { + TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); + textPaint.setTextSize(dp(14)); + + comment = new SpannableStringBuilder(details.message.text); + MessageObject.addEntitiesToText(comment, details.message.entities, false, false, false, false); + comment = Emoji.replaceEmoji(comment, textPaint.getFontMetricsInt(), false); + comment = MessageObject.replaceAnimatedEmoji(comment, details.message.entities, textPaint.getFontMetricsInt()); + } + CharSequence date = LocaleController.getInstance().getFormatterYear().format(details.date * 1000L).replaceAll("\\.", "/"); + TableView.TableRowFullContent tableRow; + if (details.sender_id == details.recipient_id) { + if (comment == null) { + tableRow = tableView.addFullRow(formatSpannable(R.string.Gift2AttributeOriginalDetailsSelf, from, date)); + } else { + tableRow = tableView.addFullRow(formatSpannable(R.string.Gift2AttributeOriginalDetailsSelfComment, from, date, comment)); + } + } else if (from != null) { + if (comment == null) { + tableRow = tableView.addFullRow(formatSpannable(R.string.Gift2AttributeOriginalDetails, from, to, date)); + } else { + tableRow = tableView.addFullRow(formatSpannable(R.string.Gift2AttributeOriginalDetailsComment, from, to, date, comment)); + } + } else { + if (comment == null) { + tableRow = tableView.addFullRow(formatSpannable(R.string.Gift2AttributeOriginalDetailsNoSender, to, date)); + } else { + tableRow = tableView.addFullRow(formatSpannable(R.string.Gift2AttributeOriginalDetailsNoSenderComment, to, date, comment)); + } + } + tableRow.setFilled(true); + SpoilersTextView textView = (SpoilersTextView) tableRow.getChildAt(0); + textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12); + textView.setGravity(Gravity.CENTER); + } + + button.setText(getString(R.string.OK), true); + button.setOnClickListener(v -> onBackPressed()); + } + + public boolean isSaved() { + if (messageObject != null && messageObject.messageOwner != null) { + TLRPC.MessageAction _action = messageObject.messageOwner.action; + if (_action instanceof TLRPC.TL_messageActionStarGift) { + return ((TLRPC.TL_messageActionStarGift) _action).saved; + } else if (_action instanceof TLRPC.TL_messageActionStarGiftUnique) { + return ((TLRPC.TL_messageActionStarGiftUnique) _action).saved; + } + } else if (savedStarGift != null) { + return !savedStarGift.unsaved; + } + return false; + } + + public StarGiftSheet set(TL_stars.SavedStarGift savedStarGift) { + if (savedStarGift == null) { + return this; + } + + this.myProfile = isMine(currentAccount, dialogId); + this.savedStarGift = savedStarGift; + this.messageObject = null; + + final String name = DialogObject.getShortName(dialogId); + + final long from_id = DialogObject.getPeerDialogId(savedStarGift.from_id); + final boolean fromBot = UserObject.isBot(MessagesController.getInstance(currentAccount).getUser(from_id)); + final int within = MessagesController.getInstance(currentAccount).stargiftsConvertPeriodMax - (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - savedStarGift.date); + final long selfId = UserConfig.getInstance(currentAccount).getClientUserId(); + final long fromId = (savedStarGift.flags & 2) != 0 && !savedStarGift.name_hidden ? from_id : UserObject.ANONYMOUS; + final boolean isForChannel = dialogId < 0; + final String owner_address; + + boolean refunded = savedStarGift.refunded, self = false; + + if (savedStarGift.gift instanceof TL_stars.TL_starGiftUnique) { + owner_address = savedStarGift.gift.owner_address; + set((TL_stars.TL_starGiftUnique) savedStarGift.gift, (savedStarGift.flags & 256) != 0, refunded); + } else { + self = myProfile && selfId == fromId && dialogId >= 0; + owner_address = null; + + topView.setGift(savedStarGift.gift, false, isWorn(), getLink() != null); + tableView.clear(); + if (self) { + topView.setText(0, getString(R.string.Gift2TitleSaved), 0, refunded ? null : + savedStarGift.can_upgrade ? AndroidUtilities.replaceTags(getString(R.string.Gift2SelfInfoUpgrade)) : + savedStarGift.convert_stars > 0 ? AndroidUtilities.replaceTags(formatPluralStringComma("Gift2SelfInfoConvert", (int) savedStarGift.convert_stars)) : + AndroidUtilities.replaceTags(getString(R.string.Gift2SelfInfo)) + ); + } else if (isForChannel && !myProfile) { + topView.setText(0, getString(R.string.Gift2TitleProfile), 0, null); + } else if ((!myProfile || savedStarGift.can_upgrade) && savedStarGift.upgrade_stars > 0) { + topView.setText(0, + getString(myProfile ? R.string.Gift2TitleReceived : R.string.Gift2TitleProfile), 0, + refunded ? null : myProfile ? getString(R.string.Gift2InfoInFreeUpgrade) : formatString(R.string.Gift2InfoFreeUpgrade, name) + ); + } else { + topView.setText( + 0, + getString(selfId == fromId && !isForChannel ? R.string.Gift2TitleSaved : myProfile ? R.string.Gift2TitleReceived : R.string.Gift2TitleProfile), + refunded || isForChannel ? 0 : Math.abs(Math.max(savedStarGift.gift.convert_stars, savedStarGift.convert_stars)), + refunded ? null : + TextUtils.concat( + AndroidUtilities.replaceTags(fromBot || !canConvert() ? ( + myProfile ? + savedStarGift.unsaved ? LocaleController.getString(isForChannel ? R.string.Gift2Info2ChannelKeep : R.string.Gift2Info2BotKeep) : LocaleController.getString(isForChannel ? R.string.Gift2Info2ChannelRemove : R.string.Gift2Info2BotRemove) : + formatString(savedStarGift.can_upgrade && savedStarGift.upgrade_stars > 0 ? R.string.Gift2Info2OutUpgrade : R.string.Gift2Info2OutExpired, name) + ) : myProfile ? + formatPluralStringComma(within <= 0 ? (isForChannel ? "Gift2Info2ChannelExpired" : "Gift2Info2Expired") : (isForChannel ? "Gift2Info3Channel" : "Gift2Info3"), (int) savedStarGift.convert_stars) : + formatPluralStringComma("Gift2Info2Out", (int) savedStarGift.convert_stars, name) + ), + " ", + ((fromBot || !canConvert()) ? "" : + AndroidUtilities.replaceArrows(AndroidUtilities.replaceSingleTag(getString(R.string.Gift2More).replace(' ', ' '), () -> { + new ExplainStarsSheet(getContext()).show(); + }), true) + ) + ) + ); + } + + if (selfId != fromId || isForChannel) { + final TLRPC.User fromUser = MessagesController.getInstance(currentAccount).getUser(fromId); + tableView.addRowUser(getString(R.string.Gift2From), currentAccount, fromId, () -> openProfile(fromId), fromId != selfId && fromId != UserObject.ANONYMOUS && !fromBot && !UserObject.isDeleted(fromUser) && !isForChannel ? getString(R.string.Gift2ButtonSendGift) : null, () -> { + new GiftSheet(getContext(), currentAccount, fromId, this::dismiss).show(); + }); + } + tableView.addRow(getString(R.string.StarsTransactionDate), LocaleController.formatString(R.string.formatDateAtTime, LocaleController.getInstance().getFormatterGiveawayCard().format(new Date(savedStarGift.date * 1000L)), LocaleController.getInstance().getFormatterDay().format(new Date(savedStarGift.date * 1000L)))); + tableView.addRow(getString(R.string.Gift2Value), replaceStarsWithPlain(TextUtils.concat("⭐️ " + LocaleController.formatNumber(savedStarGift.gift.stars + savedStarGift.upgrade_stars, ','), " ", canConvert() && !refunded ? ButtonSpan.make(formatPluralStringComma("Gift2ButtonSell", (int) savedStarGift.convert_stars), this::convert, resourcesProvider) : ""), .8f)); + if (savedStarGift.gift.limited && !refunded) { + addAvailabilityRow(tableView, currentAccount, savedStarGift.gift, resourcesProvider); + } + if (!refunded && savedStarGift.can_upgrade) { + tableView.addRow(getString(R.string.Gift2Status), getString(R.string.Gift2StatusNonUnique), getString(R.string.Gift2StatusUpgrade), this::openUpgrade); + } + if (savedStarGift.message != null && !TextUtils.isEmpty(savedStarGift.message.text) && !refunded) { + tableView.addFullRow(savedStarGift.message.text, savedStarGift.message.entities); + } + + if (myProfile && savedStarGift.can_upgrade && savedStarGift.upgrade_stars > 0) { + SpannableStringBuilder sb = new SpannableStringBuilder(getString(R.string.Gift2UpgradeButtonFree)); + sb.append(" ^"); + if (upgradeIconSpan == null) { + upgradeIconSpan = new ColoredImageSpan(new UpgradeIcon(button, Theme.getColor(Theme.key_featuredStickers_addButton, resourcesProvider))); + } + sb.setSpan(upgradeIconSpan, sb.length() - 1, sb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + button.setText(sb, true); + button.setOnClickListener(v -> openUpgrade()); + } else { + button.setText(getString(R.string.OK), true); + button.setOnClickListener(v -> onBackPressed()); + } + } + + if (TextUtils.isEmpty(owner_address)) { + beforeTableTextView.setVisibility(View.GONE); + } else if (savedStarGift.refunded) { + beforeTableTextView.setVisibility(View.VISIBLE); + beforeTableTextView.setText(getString(R.string.Gift2Refunded)); + beforeTableTextView.setTextColor(Theme.getColor(Theme.key_text_RedBold, resourcesProvider)); + } else if (myProfile && savedStarGift.gift instanceof TL_stars.TL_starGift && savedStarGift.name_hidden && !self && fromId != UserObject.ANONYMOUS) { + beforeTableTextView.setVisibility(View.VISIBLE); + beforeTableTextView.setText(getString(R.string.Gift2SenderHidden)); + beforeTableTextView.setTextColor(Theme.getColor(Theme.key_dialogTextGray2, resourcesProvider)); + } else { + beforeTableTextView.setVisibility(View.GONE); + } + + if (!TextUtils.isEmpty(owner_address)) { + afterTableTextView.setText(AndroidUtilities.replaceArrows(AndroidUtilities.replaceSingleTag(getString(R.string.Gift2InBlockchain), () -> { + Browser.openUrlInSystemBrowser(getContext(), MessagesController.getInstance(currentAccount).tonBlockchainExplorerUrl + owner_address); + }), true, dp(8f / 3f), dp(.66f))); + afterTableTextView.setVisibility(View.VISIBLE); + } else if (myProfile && isMine(currentAccount, dialogId)) { + if (dialogId >= 0) { + afterTableTextView.setText(AndroidUtilities.replaceArrows(AndroidUtilities.replaceSingleTag(getString(!savedStarGift.unsaved ? R.string.Gift2ProfileVisible3 : R.string.Gift2ProfileInvisible3), this::toggleShow), true, dp(8f / 3f), dp(.66f))); + } else { + afterTableTextView.setText(AndroidUtilities.replaceArrows(AndroidUtilities.replaceSingleTag(getString(!savedStarGift.unsaved ? R.string.Gift2ChannelProfileVisible3 : R.string.Gift2ChannelProfileInvisible3), this::toggleShow), true, dp(8f / 3f), dp(.66f))); + } + afterTableTextView.setVisibility(View.VISIBLE); + } else { + afterTableTextView.setVisibility(View.GONE); + } + + if (firstSet) { + switchPage(PAGE_INFO, false); + firstSet = false; + } + + return this; + } + + public TL_stars.TL_starGiftUnique getUniqueGift() { + final TL_stars.StarGift gift = getGift(); + if (gift instanceof TL_stars.TL_starGiftUnique) { + return (TL_stars.TL_starGiftUnique) gift; + } + return null; + } + + public String getGiftName() { + final TL_stars.StarGift gift = getGift(); + if (gift instanceof TL_stars.TL_starGiftUnique) { + final TL_stars.TL_starGiftUnique uniqueGift = (TL_stars.TL_starGiftUnique) gift; + return uniqueGift.title + " #" + LocaleController.formatNumber(uniqueGift.num, ','); + } + return ""; + } + + public TL_stars.StarGift getGift() { + if (messageObject != null) { + if (messageObject.messageOwner == null) return null; + if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGift) { + return ((TLRPC.TL_messageActionStarGift) messageObject.messageOwner.action).gift; + } else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGiftUnique) { + return ((TLRPC.TL_messageActionStarGiftUnique) messageObject.messageOwner.action).gift; + } + } else if (savedStarGift != null) { + return savedStarGift.gift; + } else if (slugStarGift != null) { + return slugStarGift; + } + return null; + } + + public StarGiftSheet set(MessageObject messageObject) { + if (messageObject == null || messageObject.messageOwner == null) { + return this; + } + + this.myProfile = false; + this.savedStarGift = null; + this.messageObject = messageObject; + boolean converted, saved, out, refunded, name_hidden; + + final long selfId = UserConfig.getInstance(currentAccount).getClientUserId(); + final boolean self = messageObject.getDialogId() == selfId; + TL_stars.StarGift stargift; + if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGift || messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGiftUnique && ((TLRPC.TL_messageActionStarGiftUnique) messageObject.messageOwner.action).gift instanceof TL_stars.TL_starGift) { + out = messageObject.isOutOwner(); + if (self) { + out = false; + } + final int date = messageObject.messageOwner.date; + boolean can_upgrade, upgraded; + long convert_stars, upgrade_stars; + TLRPC.TL_textWithEntities message; + TLRPC.Peer from_id, peer; + if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGift) { + final TLRPC.TL_messageActionStarGift action = (TLRPC.TL_messageActionStarGift) messageObject.messageOwner.action; + converted = action.converted; + saved = action.saved; + refunded = action.refunded; + name_hidden = action.name_hidden; + stargift = action.gift; + can_upgrade = action.can_upgrade; + convert_stars = action.convert_stars; + upgrade_stars = action.upgrade_stars; + message = action.message; + upgraded = action.upgraded; + from_id = action.from_id; + peer = action.peer; + } else { + final TLRPC.TL_messageActionStarGiftUnique action = (TLRPC.TL_messageActionStarGiftUnique) messageObject.messageOwner.action; + converted = false; + saved = action.saved; + refunded = action.refunded; + name_hidden = false; + stargift = action.gift; + can_upgrade = false; + convert_stars = 0; + upgrade_stars = 0; + message = null; + upgraded = true; + from_id = action.from_id; + peer = action.peer; + } + + final String name = DialogObject.getShortName(dialogId); + final boolean fromBot = UserObject.isBot(MessagesController.getInstance(currentAccount).getUser(dialogId)); + final boolean isForChannel = peer != null && DialogObject.getPeerDialogId(peer) < 0; + + topView.setGift(stargift, false, isWorn(), getLink() != null); + if (self) { + topView.setText(0, getString(R.string.Gift2TitleSaved), 0, refunded ? null : + can_upgrade ? AndroidUtilities.replaceTags(getString(R.string.Gift2SelfInfoUpgrade)) : + convert_stars > 0 ? AndroidUtilities.replaceTags(formatPluralStringComma(converted ? "Gift2SelfInfoConverted" : "Gift2SelfInfoConvert", (int) convert_stars)) : + AndroidUtilities.replaceTags(getString(R.string.Gift2SelfInfo)) + ); + } else if (isForChannel && !myProfile) { + topView.setText(0, getString(R.string.Gift2TitleProfile), 0, null); + } else if ((out || can_upgrade) && upgrade_stars > 0) { + topView.setText(0, + getString(out ? R.string.Gift2TitleSent : R.string.Gift2TitleReceived), 0, + refunded ? null : !out ? getString(R.string.Gift2InfoInFreeUpgrade) : formatString(R.string.Gift2InfoFreeUpgrade, name) + ); + } else { + topView.setText( + 0, + getString(out ? R.string.Gift2TitleSent : R.string.Gift2TitleReceived), + 0, + refunded ? null : TextUtils.concat( + AndroidUtilities.replaceTags(fromBot || !canConvert() ? ( + out ? + formatString(can_upgrade && upgrade_stars > 0 ? R.string.Gift2Info2OutUpgrade : R.string.Gift2Info2OutExpired, name) : + getString(!saved ? (isForChannel ? R.string.Gift2Info2ChannelKeep : R.string.Gift2Info2BotKeep) : (isForChannel ? R.string.Gift2Info2ChannelRemove : R.string.Gift2Info2BotRemove)) + ) : out ? + saved && !converted ? formatString(R.string.Gift2InfoOutPinned, name) : formatPluralStringComma(converted ? "Gift2InfoOutConverted" : "Gift2InfoOut", (int) convert_stars, name) : + formatPluralStringComma(converted ? (isForChannel ? "Gift2InfoChannelConverted" : "Gift2InfoConverted") : (isForChannel ? "Gift2Info3Channel" : "Gift2Info3"), (int) convert_stars) + ), + " ", + ((fromBot || !canConvert()) ? "" : + AndroidUtilities.replaceArrows(AndroidUtilities.replaceSingleTag(getString(R.string.Gift2More).replace(' ', ' '), () -> { + new ExplainStarsSheet(getContext()).show(); + }), true) + ) + ) + ); + } + tableView.clear(); + final long fromId = from_id != null ? DialogObject.getPeerDialogId(from_id) : out ? selfId : dialogId; + final long toId = peer != null ? DialogObject.getPeerDialogId(peer) : out ? dialogId : selfId; + final TLRPC.User fromUser = MessagesController.getInstance(currentAccount).getUser(fromId); + if (fromId != selfId || isForChannel) { + tableView.addRowUser(getString(R.string.Gift2From), currentAccount, fromId, () -> openProfile(fromId), fromId != selfId && fromId != UserObject.ANONYMOUS && !UserObject.isDeleted(fromUser) && !fromBot && !isForChannel ? getString(R.string.Gift2ButtonSendGift) : null, isForChannel ? null : () -> { + new GiftSheet(getContext(), currentAccount, fromId, this::dismiss).show(); + }); + } + if (toId != selfId || isForChannel) { + tableView.addRowUser(getString(R.string.Gift2To), currentAccount, toId, () -> openProfile(toId), null, isForChannel ? null : () -> { + new GiftSheet(getContext(), currentAccount, toId, this::dismiss).show(); + }); + } + tableView.addRowDateTime(getString(R.string.StarsTransactionDate), date); + if (stargift.stars > 0) { + tableView.addRow(getString(R.string.Gift2Value), replaceStarsWithPlain(TextUtils.concat("⭐️ " + LocaleController.formatNumber(stargift.stars + upgrade_stars, ','), " ", canConvert() && !refunded ? ButtonSpan.make(formatPluralStringComma("Gift2ButtonSell", (int) convert_stars), this::convert, resourcesProvider) : ""), .8f)); + } + if (stargift != null && stargift.limited && !refunded) { + addAvailabilityRow(tableView, currentAccount, stargift, resourcesProvider); + } + if (!out && !refunded) { + if (!messageObjectRepolled && !upgraded) { + final TableRow row = tableView.addRow(getString(R.string.Gift2Status), ""); + final TextView rowTextView = (TextView) ((TableView.TableRowContent) row.getChildAt(1)).getChildAt(0); + final SpannableStringBuilder sb = new SpannableStringBuilder("x "); + final LoadingSpan span = new LoadingSpan(rowTextView, dp(90), 0, resourcesProvider); + span.setColors( + Theme.multAlpha(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText, resourcesProvider), .21f), + Theme.multAlpha(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText, resourcesProvider), .08f) + ); + sb.setSpan(span, 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + rowTextView.setText(sb, TextView.BufferType.SPANNABLE); + + repollMessage(); + } else { + if (can_upgrade) { + SpannableStringBuilder ssb = new SpannableStringBuilder(); + ssb.append(getString(R.string.Gift2StatusNonUnique)); + ssb.append(" "); + ssb.append(ButtonSpan.make(getString(R.string.Gift2StatusUpgrade), this::openUpgrade, resourcesProvider)); + tableView.addRow(getString(R.string.Gift2Status), ssb); + } else { + tableView.addRow(getString(R.string.Gift2Status), getString(R.string.Gift2StatusNonUnique)); + } + } + } + if (message != null && !TextUtils.isEmpty(message.text) && !refunded) { + tableView.addFullRow(message.text, message.entities); + } + + if (!out && can_upgrade && upgrade_stars > 0 && !refunded) { + SpannableStringBuilder sb = new SpannableStringBuilder(getString(R.string.Gift2UpgradeButtonFree)); + sb.append(" ^"); + if (upgradeIconSpan == null) { + upgradeIconSpan = new ColoredImageSpan(new UpgradeIcon(button, Theme.getColor(Theme.key_featuredStickers_addButton, resourcesProvider))); + } + sb.setSpan(upgradeIconSpan, sb.length() - 1, sb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + button.setText(sb, true); + button.setOnClickListener(v -> openUpgrade()); + } else { + button.setText(getString(R.string.OK), true); + button.setOnClickListener(v -> onBackPressed()); + } + } else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGiftUnique) { + final TLRPC.TL_messageActionStarGiftUnique action = (TLRPC.TL_messageActionStarGiftUnique) messageObject.messageOwner.action; + if (!(action.gift instanceof TL_stars.TL_starGiftUnique)) { + return this; + } + set((TL_stars.TL_starGiftUnique) action.gift, (action.flags & 16) != 0, refunded = action.refunded); + converted = false; + saved = action.saved; + stargift = action.gift; + out = (!action.upgrade == messageObject.isOutOwner()); + if (messageObject.getDialogId() == selfId) { + out = false; + } + name_hidden = false; + repollSavedStarGift(); + } else { + return this; + } + + final String owner_address; + if (stargift != null) { + owner_address = stargift.owner_address; + } else { + owner_address = null; + } + + if (TextUtils.isEmpty(owner_address)) { + beforeTableTextView.setVisibility(View.GONE); + } else if (refunded) { + beforeTableTextView.setVisibility(View.VISIBLE); + beforeTableTextView.setText(getString(R.string.Gift2Refunded)); + beforeTableTextView.setTextColor(Theme.getColor(Theme.key_text_RedBold, resourcesProvider)); + } else if (!out && name_hidden && !self) { + beforeTableTextView.setVisibility(View.VISIBLE); + beforeTableTextView.setText(getString(R.string.Gift2SenderHidden)); + beforeTableTextView.setTextColor(Theme.getColor(Theme.key_dialogTextGray2, resourcesProvider)); + } else { + beforeTableTextView.setVisibility(View.GONE); + } + + if (!TextUtils.isEmpty(owner_address)) { + afterTableTextView.setVisibility(View.VISIBLE); + afterTableTextView.setText(AndroidUtilities.replaceArrows(AndroidUtilities.replaceSingleTag(getString(R.string.Gift2InBlockchain), () -> { + Browser.openUrlInSystemBrowser(getContext(), MessagesController.getInstance(currentAccount).tonBlockchainExplorerUrl + owner_address); + }), true, dp(8f / 3f), dp(.66f))); + } else if (!converted && !refunded && stargift != null && isMine(currentAccount, getDialogId())) { + afterTableTextView.setVisibility(View.VISIBLE); + afterTableTextView.setText(AndroidUtilities.replaceArrows(AndroidUtilities.replaceSingleTag(getString(saved ? R.string.Gift2ProfileVisible3 : R.string.Gift2ProfileInvisible3), this::toggleShow), true, dp(8f / 3f), dp(.66f))); + } else { + afterTableTextView.setVisibility(View.GONE); + } + + if (firstSet) { + switchPage(PAGE_INFO, false); + firstSet = false; + } + + return this; + } + + private void repollMessage() { + if (messageObjectRepolling || messageObjectRepolled || messageObject == null) { + return; + } + messageObjectRepolling = true; + final int id = messageObject.getId(); + final TLRPC.TL_messages_getMessages req = new TLRPC.TL_messages_getMessages(); + req.id.add(id); + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> { + MessageObject newMessageObject = null; + if (res instanceof TLRPC.messages_Messages) { + TLRPC.messages_Messages messages = (TLRPC.messages_Messages) res; + for (int i = 0; i < messages.messages.size(); ++i) { + TLRPC.Message msg = messages.messages.get(i); + if (msg != null && msg.id == id && (msg.action instanceof TLRPC.TL_messageActionStarGift || msg.action instanceof TLRPC.TL_messageActionStarGiftUnique)) { + newMessageObject = new MessageObject(currentAccount, msg, false, false); + newMessageObject.setType(); + break; + } + } + } + if (newMessageObject != null) { + final MessageObject msg = newMessageObject; + AndroidUtilities.runOnUIThread(() -> { + messageObjectRepolled = true; + if (unsavedFromSavedStarGift != null && msg != null && msg.messageOwner != null) { + if (msg.messageOwner.action instanceof TLRPC.TL_messageActionStarGift) { + ((TLRPC.TL_messageActionStarGift) msg.messageOwner.action).saved = !unsavedFromSavedStarGift; + } else if (msg.messageOwner.action instanceof TLRPC.TL_messageActionStarGiftUnique) { + ((TLRPC.TL_messageActionStarGiftUnique) msg.messageOwner.action).saved = !unsavedFromSavedStarGift; + } + } + set(msg); + }); + } + }); + } + + private Boolean unsavedFromSavedStarGift; + private void repollSavedStarGift() { + if (userStarGiftRepolling || userStarGiftRepolled || messageObject == null) return; + final TL_stars.InputSavedStarGift inputSavedStarGift = getInputStarGift(); + if (inputSavedStarGift == null) return; + userStarGiftRepolling = true; + StarsController.getInstance(currentAccount).getUserStarGift(inputSavedStarGift, upgradedGift -> { + userStarGiftRepolling = false; + userStarGiftRepolled = true; + if (upgradedGift != null) { + unsavedFromSavedStarGift = upgradedGift.unsaved; + if (messageObject != null && messageObject.messageOwner != null) { + if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGiftUnique) { + TLRPC.TL_messageActionStarGiftUnique action = (TLRPC.TL_messageActionStarGiftUnique) messageObject.messageOwner.action; + if (action.saved == !upgradedGift.unsaved) return; + action.saved = !upgradedGift.unsaved; + } else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGift) { + TLRPC.TL_messageActionStarGift action = (TLRPC.TL_messageActionStarGift) messageObject.messageOwner.action; + if (action.saved == !upgradedGift.unsaved) return; + action.saved = !upgradedGift.unsaved; + } + set(messageObject); + } + } + }); + } + + private boolean isLearnMore; + public void openAsLearnMore(long gift_id, String username) { + isLearnMore = true; + StarsController.getInstance(currentAccount).getStarGiftPreview(gift_id, preview -> { + if (preview == null) return; + + topView.setPreviewingAttributes(preview.sample_attributes); + switchPage(PAGE_UPGRADE, false); + + topView.setText(1, getString(R.string.Gift2LearnMoreTitle), 0, formatString(R.string.Gift2LearnMoreText, username)); + + upgradeFeatureCells[0].setText(getString(R.string.Gift2UpgradeFeature1TextLearn)); + upgradeFeatureCells[1].setText(getString(R.string.Gift2UpgradeFeature2TextLearn)); + upgradeFeatureCells[2].setText(getString(R.string.Gift2UpgradeFeature3TextLearn)); + checkboxLayout.setVisibility(View.GONE); + checkboxSeparator.setVisibility(View.GONE); + + button.setText(getString(R.string.OK), false); + button.setOnClickListener(v -> dismiss()); + + show(); + }); + } + + private long getDialogId() { + if (messageObject != null) { + if (messageObject.messageOwner == null) return 0; + if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGift) { + final TLRPC.TL_messageActionStarGift action = (TLRPC.TL_messageActionStarGift) messageObject.messageOwner.action; + if (action.peer != null) { + return DialogObject.getPeerDialogId(action.peer); + } + return messageObject.isOutOwner() ? messageObject.getDialogId() : UserConfig.getInstance(currentAccount).getClientUserId(); + } else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGiftUnique) { + final TLRPC.TL_messageActionStarGiftUnique action = (TLRPC.TL_messageActionStarGiftUnique) messageObject.messageOwner.action; + if (action.gift instanceof TL_stars.TL_starGiftUnique && action.gift.owner_id != null) { + return DialogObject.getPeerDialogId(action.gift.owner_id); + } + if (action.peer != null) { + return DialogObject.getPeerDialogId(action.peer); + } + } + } else if (savedStarGift != null) { + if (savedStarGift.gift instanceof TL_stars.TL_starGiftUnique) { + final TL_stars.TL_starGiftUnique gift = (TL_stars.TL_starGiftUnique) savedStarGift.gift; + return DialogObject.getPeerDialogId(gift.owner_id); + } + return dialogId; + } else if (slugStarGift != null) { + if (slugStarGift instanceof TL_stars.TL_starGiftUnique) { + final TL_stars.TL_starGiftUnique gift = (TL_stars.TL_starGiftUnique) slugStarGift; + return DialogObject.getPeerDialogId(gift.owner_id); + } + } + return 0; + } + + private String getLink() { + final TL_stars.StarGift starGift = getGift(); + if (starGift instanceof TL_stars.TL_starGiftUnique && starGift.slug != null) { + return MessagesController.getInstance(currentAccount).linkPrefix + "/nft/" + starGift.slug; + } + return null; + } + + private void openInProfile() { + final long dialogId = getDialogId(); + if (dialogId == 0) return; + openProfile(dialogId); + } + + private void openProfile(long did) { + if (currentHintView != null) { + currentHintView.hide(); + currentHintView = null; + } + dismiss(); + final BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); + if (lastFragment != null) { + if (UserObject.isService(did)) return; + Bundle args = new Bundle(); + if (did > 0) { + args.putLong("user_id", did); + if (did == UserConfig.getInstance(currentAccount).getClientUserId()) { + args.putBoolean("my_profile", true); + } + } else { + args.putLong("chat_id", -did); + } + args.putBoolean("open_gifts", true); + lastFragment.presentFragment(new ProfileActivity(args)); + } + } + + private boolean canConvert() { + if (getInputStarGift() == null) return false; + if (messageObject != null) { + if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGift) { + final TLRPC.TL_messageActionStarGift action = (TLRPC.TL_messageActionStarGift) messageObject.messageOwner.action; + final boolean out = messageObject.isOutOwner(); + final boolean self = messageObject.getDialogId() == UserConfig.getInstance(currentAccount).getClientUserId(); + final int date = messageObject.messageOwner.date; + final int within = MessagesController.getInstance(currentAccount).stargiftsConvertPeriodMax - (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - date); + return (!out || self || action.peer != null && isMineWithActions(currentAccount, DialogObject.getPeerDialogId(action.peer))) && !action.converted && action.convert_stars > 0 && within > 0; + } + } else if (savedStarGift != null) { + final int date = savedStarGift.date; + final int within = MessagesController.getInstance(currentAccount).stargiftsConvertPeriodMax - (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - date); + return isMineWithActions(currentAccount, dialogId) && (savedStarGift.flags & (dialogId < 0 ? 2048 : 8)) != 0 && (savedStarGift.flags & 16) != 0 && (savedStarGift.flags & 2) != 0 && within > 0; + } + return false; + } + + private void convert() { + final long selfId = UserConfig.getInstance(currentAccount).getClientUserId(); + final long fromId; + final long dialogId; + final long convert_stars; + final int date; + final TL_stars.InputSavedStarGift inputStarGift = getInputStarGift(); + if (inputStarGift == null) { + return; + } + if (messageObject != null) { + date = messageObject.messageOwner.date; + final boolean out = messageObject.isOutOwner(); + if (messageObject.messageOwner != null && messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGift) { + final TLRPC.TL_messageActionStarGift action = (TLRPC.TL_messageActionStarGift) messageObject.messageOwner.action; + if (action.peer != null) { + dialogId = DialogObject.getPeerDialogId(action.peer); + } else { + dialogId = out ? messageObject.getDialogId() : selfId; + } + if (action.from_id != null) { + fromId = DialogObject.getPeerDialogId(action.from_id); + } else { + fromId = out ? selfId : messageObject.getDialogId(); + } + convert_stars = action.convert_stars; + } else { + return; + } + } else if (savedStarGift != null) { + date = savedStarGift.date; + fromId = (savedStarGift.flags & 2) != 0 && !savedStarGift.name_hidden ? DialogObject.getPeerDialogId(savedStarGift.from_id) : UserObject.ANONYMOUS; + convert_stars = savedStarGift.convert_stars; + dialogId = this.dialogId; + } else { + return; + } + final int within = MessagesController.getInstance(currentAccount).stargiftsConvertPeriodMax - (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - date); + final int withinDays = Math.max(1, within / (60 * 60 * 24)); + new AlertDialog.Builder(getContext(), resourcesProvider) + .setTitle(getString(R.string.Gift2ConvertTitle)) + .setMessage(AndroidUtilities.replaceTags(formatPluralString("Gift2ConvertText2", withinDays, UserObject.isService(fromId) ? getString(R.string.StarsTransactionHidden) : DialogObject.getShortName(fromId), formatPluralStringComma("Gift2ConvertStars", (int) convert_stars)))) + .setPositiveButton(getString(R.string.Gift2ConvertButton), (di, w) -> { + final AlertDialog progressDialog = new AlertDialog(ApplicationLoader.applicationContext, AlertDialog.ALERT_TYPE_SPINNER); + progressDialog.showDelayed(500); + final TL_stars.convertStarGift req = new TL_stars.convertStarGift(); + req.stargift = inputStarGift; + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { + progressDialog.dismissUnless(400); + BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); + if (lastFragment == null) return; + if (res instanceof TLRPC.TL_boolTrue) { + dismiss(); + StarsController.getInstance(currentAccount).invalidateProfileGifts(dialogId); + if (dialogId >= 0) { + final TLRPC.UserFull userFull = MessagesController.getInstance(currentAccount).getUserFull(selfId); + if (userFull != null) { + userFull.stargifts_count = Math.max(0, userFull.stargifts_count - 1); + if (userFull.stargifts_count <= 0) { + userFull.flags2 &= ~256; + } + } + StarsController.getInstance(currentAccount).invalidateBalance(); + StarsController.getInstance(currentAccount).invalidateTransactions(true); + if (!(lastFragment instanceof StarsIntroActivity)) { + final StarsIntroActivity fragment = new StarsIntroActivity(); + fragment.whenFullyVisible(() -> { + BulletinFactory.of(fragment) + .createSimpleBulletin( + R.raw.stars_topup, + LocaleController.getString(R.string.Gift2ConvertedTitle), + LocaleController.formatPluralStringComma("Gift2Converted", (int) convert_stars) + ) + .show(true); + }); + lastFragment.presentFragment(fragment); + } else { + BulletinFactory.of(lastFragment) + .createSimpleBulletin( + R.raw.stars_topup, + LocaleController.getString(R.string.Gift2ConvertedTitle), + LocaleController.formatPluralStringComma("Gift2Converted", (int) convert_stars) + ) + .show(true); + } + } else { + Bundle args = new Bundle(); + args.putLong("chat_id", -dialogId); + args.putBoolean("start_from_monetization", true); + final StatisticActivity fragment = new StatisticActivity(args); + BotStarsController.getInstance(currentAccount).invalidateStarsBalance(dialogId); + BotStarsController.getInstance(currentAccount).invalidateTransactions(dialogId, true); + fragment.whenFullyVisible(() -> { + BulletinFactory.of(fragment) + .createSimpleBulletin( + R.raw.stars_topup, + LocaleController.getString(R.string.Gift2ConvertedTitle), + LocaleController.formatPluralStringComma("Gift2ConvertedChannel", (int) convert_stars) + ) + .show(true); + }); + lastFragment.presentFragment(fragment); + } + } else if (err != null) { + getBulletinFactory().createErrorBulletin(formatString(R.string.UnknownErrorCode, err.text)).show(false); + } else { + getBulletinFactory().createErrorBulletin(getString(R.string.UnknownError)).show(false); + } + })); + }) + .setNegativeButton(getString(R.string.Cancel), null) + .show(); + } + + private void toggleShow() { + if (button.isLoading()) return; + + final boolean saved; + final TLRPC.Document sticker; + final TL_stars.InputSavedStarGift inputStarGift = getInputStarGift(); + if (messageObject != null && messageObject.messageOwner != null) { + final TLRPC.MessageAction _action = messageObject.messageOwner.action; + if (_action instanceof TLRPC.TL_messageActionStarGift) { + final TLRPC.TL_messageActionStarGift action = (TLRPC.TL_messageActionStarGift) messageObject.messageOwner.action; + saved = action.saved; + sticker = action.gift.getDocument(); + } else if (_action instanceof TLRPC.TL_messageActionStarGiftUnique) { + final TLRPC.TL_messageActionStarGiftUnique action = (TLRPC.TL_messageActionStarGiftUnique) messageObject.messageOwner.action; + saved = action.saved; + sticker = action.gift.getDocument(); + } else { + return; + } + } else if (savedStarGift != null) { + saved = !savedStarGift.unsaved; + sticker = savedStarGift.gift.getDocument(); + } else { + return; + } + + button.setLoading(true); + + final TL_stars.saveStarGift req = new TL_stars.saveStarGift(); + final boolean unsave = req.unsave = saved; + req.stargift = inputStarGift; + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { + BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); + if (lastFragment == null) return; + if (res instanceof TLRPC.TL_boolTrue) { + dismiss(); + final long did = getDialogId(); + StarsController.getInstance(currentAccount).invalidateProfileGifts(did); + if (did >= 0) { + BulletinFactory.of(lastFragment) + .createEmojiBulletin( + sticker, + LocaleController.getString(unsave ? R.string.Gift2MadePrivateTitle : R.string.Gift2MadePublicTitle), + AndroidUtilities.replaceSingleTag(LocaleController.getString(unsave ? R.string.Gift2MadePrivate : R.string.Gift2MadePublic), lastFragment instanceof ProfileActivity ? null : () -> { + final Bundle args = new Bundle(); + if (did >= 0) { + args.putLong("user_id", did); + } else { + args.putLong("chat_id", -did); + } + args.putBoolean("my_profile", true); + args.putBoolean("open_gifts", true); + final ProfileActivity profileActivity = new ProfileActivity(args); + lastFragment.presentFragment(profileActivity); + }) + ) + .show(true); + } else { + BulletinFactory.of(lastFragment) + .createEmojiBulletin( + sticker, + LocaleController.getString(unsave ? R.string.Gift2ChannelMadePrivateTitle : R.string.Gift2ChannelMadePublicTitle), + LocaleController.getString(unsave ? R.string.Gift2ChannelMadePrivate : R.string.Gift2ChannelMadePublic) + ) + .show(); + } + } else if (err != null) { + getBulletinFactory().createErrorBulletin(formatString(R.string.UnknownErrorCode, err.text)).show(false); + } + })); + } + + @Override + public void show() { + if (slug != null && slugStarGift == null) { + final AlertDialog progressDialog = new AlertDialog(getContext(), AlertDialog.ALERT_TYPE_SPINNER); + progressDialog.showDelayed(500); + + TL_stars.getUniqueStarGift req = new TL_stars.getUniqueStarGift(); + req.slug = slug; + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> { + if (res instanceof TL_stars.TL_payments_uniqueStarGift) { + final TL_stars.TL_payments_uniqueStarGift r = (TL_stars.TL_payments_uniqueStarGift) res; + MessagesController.getInstance(currentAccount).putUsers(r.users, false); + if (r.gift instanceof TL_stars.TL_starGiftUnique) { + AndroidUtilities.runOnUIThread(() -> { + slugStarGift = (TL_stars.TL_starGiftUnique) r.gift; + set(slugStarGift, true, false); + super.show(); + }); + return; + } + } + AndroidUtilities.runOnUIThread(() -> { + progressDialog.dismiss(); + BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); + if (lastFragment != null) { + BulletinFactory.of(lastFragment) + .createSimpleBulletin(R.raw.error, getString(R.string.UniqueGiftNotFound)) + .show(); + } + }); + }); + } else if (savedStarGift == null && messageObject != null && messageObject.messageOwner != null && messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGift) { + TLRPC.TL_messageActionStarGift action = (TLRPC.TL_messageActionStarGift) messageObject.messageOwner.action; + if (action.upgraded) { + if (action.upgrade_msg_id != 0) { + final AlertDialog progressDialog = new AlertDialog(getContext(), AlertDialog.ALERT_TYPE_SPINNER); + progressDialog.showDelayed(500); + + TLRPC.TL_messages_getMessages req = new TLRPC.TL_messages_getMessages(); + req.id.add(action.upgrade_msg_id); + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> { + MessageObject newMessageObject = null; + if (res instanceof TLRPC.messages_Messages) { + TLRPC.messages_Messages messages = (TLRPC.messages_Messages) res; + MessagesController.getInstance(currentAccount).putUsers(messages.users, false); + for (int i = 0; i < messages.messages.size(); ++i) { + TLRPC.Message msg = messages.messages.get(i); + if (msg != null && !(msg instanceof TLRPC.TL_messageEmpty) && msg.id == action.upgrade_msg_id) { + newMessageObject = new MessageObject(currentAccount, msg, false, false); + newMessageObject.setType(); + break; + } + } + } + if (newMessageObject != null) { + final MessageObject msg = newMessageObject; + AndroidUtilities.runOnUIThread(() -> { + progressDialog.dismiss(); + messageObjectRepolled = true; + set(msg); + super.show(); + }); + } else { + AndroidUtilities.runOnUIThread(() -> { + progressDialog.dismiss(); + BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); + if (lastFragment != null) { + BulletinFactory.of(lastFragment) + .createSimpleBulletin(R.raw.error, getString(R.string.MessageNotFound)) + .show(); + } + }); + } + }); + return; + } else if (getInputStarGift() != null) { + final AlertDialog progressDialog = new AlertDialog(getContext(), AlertDialog.ALERT_TYPE_SPINNER); + progressDialog.showDelayed(500); + + StarsController.getInstance(currentAccount).getUserStarGift(getInputStarGift(), savedGift -> { + if (savedGift != null) { + progressDialog.dismiss(); + userStarGiftRepolled = true; + set(savedGift); + super.show(); + } else { + progressDialog.dismiss(); + BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); + if (lastFragment != null) { + BulletinFactory.of(lastFragment) + .createSimpleBulletin(R.raw.error, getString(R.string.MessageNotFound)) + .show(); + } + } + }); + return; + } + } + } + super.show(); + } + + private ArrayList sample_attributes; + private TLRPC.PaymentForm upgrade_form; + private void openUpgrade() { + if (currentHintView != null) { + currentHintView.hide(); + currentHintView = null; + } + if (switchingPagesAnimator != null) { + return; + } + + long stars; + long gift_id; + boolean name_hidden; + boolean hasMessage; + final TL_stars.InputSavedStarGift inputStarGift = getInputStarGift(); + if (inputStarGift == null) return; + final boolean isForChannel; + if (messageObject != null) { + TLRPC.MessageAction _action = messageObject.messageOwner.action; + if (_action instanceof TLRPC.TL_messageActionStarGift) { + TLRPC.TL_messageActionStarGift action = (TLRPC.TL_messageActionStarGift) _action; + gift_id = action.gift.id; + stars = action.upgrade_stars; + name_hidden = action.name_hidden; + hasMessage = action.message != null && !TextUtils.isEmpty(action.message.text); + isForChannel = action.peer != null; + } else { + return; + } + } else if (savedStarGift != null) { + gift_id = savedStarGift.gift.id; + stars = savedStarGift.upgrade_stars; + name_hidden = savedStarGift.gift instanceof TL_stars.TL_starGift && savedStarGift.name_hidden; + hasMessage = savedStarGift.message != null && !TextUtils.isEmpty(savedStarGift.message.text); + isForChannel = dialogId < 0; + } else { + return; + } + + if (name_hidden) { + checkboxTextView.setText(getString(isForChannel ? R.string.Gift2AddMyNameNameChannel : R.string.Gift2AddMyNameName)); + } else { + if (hasMessage) { + checkboxTextView.setText(getString(R.string.Gift2AddSenderNameComment)); + } else { + checkboxTextView.setText(getString(R.string.Gift2AddSenderName)); + } + } + checkbox.setChecked(!name_hidden && stars > 0, false); + + if (sample_attributes == null || stars <= 0 && upgrade_form == null) { + if (sample_attributes == null) { + StarsController.getInstance(currentAccount).getStarGiftPreview(gift_id, preview -> { + if (preview == null) return; + sample_attributes = preview.sample_attributes; + openUpgradeAfter(); + }); + } + + if (stars <= 0 && upgrade_form == null) { + final TLRPC.TL_inputInvoiceStarGiftUpgrade invoice = new TLRPC.TL_inputInvoiceStarGiftUpgrade(); + invoice.keep_original_details = checkbox.isChecked(); + invoice.stargift = inputStarGift; + + final TLRPC.TL_payments_getPaymentForm req = new TLRPC.TL_payments_getPaymentForm(); + req.invoice = invoice; + final JSONObject themeParams = BotWebViewSheet.makeThemeParams(resourcesProvider); + if (themeParams != null) { + req.theme_params = new TLRPC.TL_dataJSON(); + req.theme_params.data = themeParams.toString(); + req.flags |= 1; + } + + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { + if (res instanceof TLRPC.PaymentForm) { + TLRPC.PaymentForm form = (TLRPC.PaymentForm) res; + MessagesController.getInstance(currentAccount).putUsers(form.users, false); + upgrade_form = form; + openUpgradeAfter(); + } else { + getBulletinFactory().makeForError(err).show(); + } + })); + } + } else { + openUpgradeAfter(); + } + } + + private void openUpgradeAfter() { + long stars; + if (messageObject != null) { + TLRPC.MessageAction action = messageObject.messageOwner.action; + if (action instanceof TLRPC.TL_messageActionStarGift) { + stars = ((TLRPC.TL_messageActionStarGift) action).upgrade_stars; + } else { + return; + } + } else if (savedStarGift != null) { + stars = savedStarGift.upgrade_stars; + } else { + return; + } + + if (sample_attributes == null || stars <= 0 && upgrade_form == null) { + return; + } + + long price = 0; + if (upgrade_form != null) { + for (int i = 0; i < upgrade_form.invoice.prices.size(); ++i) { + price += upgrade_form.invoice.prices.get(i).amount; + } + } + + topView.setPreviewingAttributes(sample_attributes); + topView.setText(1, getString(R.string.Gift2UpgradeTitle), 0, getString(R.string.Gift2UpgradeText)); + + if (price > 0) { + button.setText(StarsIntroActivity.replaceStars(LocaleController.formatString(R.string.Gift2UpgradeButton, price)), true); + } else { + button.setText(getString(R.string.Confirm), true); + } + button.setOnClickListener(v -> doUpgrade()); + + switchPage(PAGE_UPGRADE, true); + } + + private boolean applyNewGiftFromUpdates(TLRPC.Updates updates) { + if (updates == null) { + return false; + } + TLRPC.TL_updateNewMessage upd = null; + if (updates.update instanceof TLRPC.TL_updateNewMessage) { + upd = (TLRPC.TL_updateNewMessage) updates.update; + } else if (updates.updates != null) { + for (int i = 0; i < updates.updates.size(); ++i) { + final TLRPC.Update update = updates.updates.get(i); + if (update instanceof TLRPC.TL_updateNewMessage) { + upd = (TLRPC.TL_updateNewMessage) update; + break; + } + } + } + + if (upd != null) { + savedStarGift = null; + myProfile = false; + final MessageObject messageObject = new MessageObject(currentAccount, upd.message, false, false); + messageObject.setType(); + set(messageObject); + return true; + } + return false; + } + + private void doUpgrade() { + if (button.isLoading()) return; + + long stars; + final TL_stars.InputSavedStarGift inputStarGift = getInputStarGift(); + if (inputStarGift == null) { + return; + } + if (messageObject != null) { + TLRPC.MessageAction action = messageObject.messageOwner.action; + if (action instanceof TLRPC.TL_messageActionStarGift) { + stars = ((TLRPC.TL_messageActionStarGift) action).upgrade_stars; + } else { + return; + } + } else if (savedStarGift != null) { + stars = savedStarGift.upgrade_stars; + } else { + return; + } + + if (stars <= 0 && upgrade_form == null) { + return; + } + + button.setLoading(true); + if (stars > 0) { + final TL_stars.upgradeStarGift req = new TL_stars.upgradeStarGift(); + req.keep_original_details = checkbox.isChecked(); + req.stargift = inputStarGift; + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> { + if (res instanceof TLRPC.Updates) { + MessagesController.getInstance(currentAccount).putUsers(((TLRPC.Updates) res).users, false); + MessagesController.getInstance(currentAccount).putChats(((TLRPC.Updates) res).chats, false); + } + AndroidUtilities.runOnUIThread(() -> { + if (err != null || !(res instanceof TLRPC.Updates)) { + getBulletinFactory() + .showForError(err); + return; + } + + StarsController.getInstance(currentAccount).invalidateProfileGifts(getDialogId()); + + if (!applyNewGiftFromUpdates((TLRPC.Updates) res)) { + dismiss(); + return; + } + button.setLoading(false); + fireworksOverlay.start(true); + switchPage(PAGE_INFO, true); + + String product = ""; + if (getGift() != null) { + product = getGift().title + " #" + LocaleController.formatNumber(getGift().num, ','); + } + getBulletinFactory() + .createSimpleBulletin(R.raw.gift_upgrade, getString(R.string.Gift2UpgradedTitle), AndroidUtilities.replaceTags(formatString(R.string.Gift2UpgradedText, product))) + .setDuration(Bulletin.DURATION_PROLONG) + .show(); + + Utilities.stageQueue.postRunnable(() -> { + MessagesController.getInstance(currentAccount).processUpdates((TLRPC.Updates) res, false); + }); + }); + }); + } else { + + StarsController s = StarsController.getInstance(currentAccount); + if (!s.balanceAvailable()) { + s.getBalance(() -> { + if (!s.balanceAvailable()) { + getBulletinFactory() + .createSimpleBulletin(R.raw.error, formatString(R.string.UnknownErrorCode, "NO_BALANCE")) + .show(); + return; + } + button.setLoading(false); + doUpgrade(); + }); + return; + } + + final TLRPC.TL_inputInvoiceStarGiftUpgrade invoice = new TLRPC.TL_inputInvoiceStarGiftUpgrade(); + invoice.keep_original_details = checkbox.isChecked(); + invoice.stargift = inputStarGift; + + final TL_stars.TL_payments_sendStarsForm req2 = new TL_stars.TL_payments_sendStarsForm(); + req2.form_id = upgrade_form.form_id; + req2.invoice = invoice; + + ConnectionsManager.getInstance(currentAccount).sendRequest(req2, (res2, err2) -> AndroidUtilities.runOnUIThread(() -> { + if (res2 instanceof TLRPC.TL_payments_paymentResult) { + TLRPC.TL_payments_paymentResult r = (TLRPC.TL_payments_paymentResult) res2; + MessagesController.getInstance(currentAccount).putUsers(r.updates.users, false); + MessagesController.getInstance(currentAccount).putChats(r.updates.chats, false); + + StarsController.getInstance(currentAccount).invalidateTransactions(false); + StarsController.getInstance(currentAccount).invalidateProfileGifts(getDialogId()); + StarsController.getInstance(currentAccount).invalidateBalance(); + + if (!applyNewGiftFromUpdates(r.updates)) { + dismiss(); + return; + } + button.setLoading(false); + fireworksOverlay.start(true); + switchPage(PAGE_INFO, true); + + String product = ""; + if (getGift() != null) { + product = getGift().title + " #" + LocaleController.formatNumber(getGift().num, ','); + } + getBulletinFactory() + .createSimpleBulletin(R.raw.gift_upgrade, getString(R.string.Gift2UpgradedTitle), AndroidUtilities.replaceTags(formatString(R.string.Gift2UpgradedText, product))) + .setDuration(Bulletin.DURATION_PROLONG) + .show(); + + Utilities.stageQueue.postRunnable(() -> { + MessagesController.getInstance(currentAccount).processUpdates(r.updates, false); + }); + + } else if (err2 != null && "BALANCE_TOO_LOW".equals(err2.text)) { + if (!MessagesController.getInstance(currentAccount).starsPurchaseAvailable()) { + button.setLoading(false); + showNoSupportDialog(getContext(), resourcesProvider); + return; + } + StarsController.getInstance(currentAccount).invalidateBalance(() -> { + final boolean[] purchased = new boolean[] { false }; + StarsIntroActivity.StarsNeededSheet sheet = new StarsIntroActivity.StarsNeededSheet(getContext(), resourcesProvider, stars, StarsIntroActivity.StarsNeededSheet.TYPE_STAR_GIFT_UPGRADE, null, () -> { + purchased[0] = true; + button.setLoading(false); + doUpgrade(); + }); + sheet.setOnDismissListener(d -> { + button.setLoading(false); + }); + sheet.show(); + }); + } else { + getBulletinFactory() + .showForError(err2); + } + })); + + } + } + + public void openTransfer() { + if (currentHintView != null) { + currentHintView.hide(); + currentHintView = null; + } + + final TL_stars.TL_starGiftUnique gift; + final int can_export_at; + final long transfer_stars; + if (savedStarGift != null && savedStarGift.gift instanceof TL_stars.TL_starGiftUnique) { + gift = (TL_stars.TL_starGiftUnique) savedStarGift.gift; + can_export_at = savedStarGift.can_export_at; + transfer_stars = savedStarGift.transfer_stars; + } else if (messageObject != null && messageObject.messageOwner != null && messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGiftUnique) { + TLRPC.TL_messageActionStarGiftUnique action = (TLRPC.TL_messageActionStarGiftUnique) messageObject.messageOwner.action; + if (!(action.gift instanceof TL_stars.TL_starGiftUnique)) { + return; + } + gift = (TL_stars.TL_starGiftUnique) action.gift; + can_export_at = action.can_export_at; + transfer_stars = action.transfer_stars; + } else { + return; + } + final int now = ConnectionsManager.getInstance(currentAccount).getCurrentTime(); + + final UserSelectorBottomSheet[] sheet = new UserSelectorBottomSheet[1]; + sheet[0] = new UserSelectorBottomSheet(new BaseFragment() { + @Override + public Context getContext() { + return StarGiftSheet.this.getContext(); + } + @Override + public Activity getParentActivity() { + Activity activity = LaunchActivity.instance; + if (activity == null) activity = AndroidUtilities.findActivity(StarGiftSheet.this.getContext()); + return activity; + } + @Override + public Theme.ResourcesProvider getResourceProvider() { + return StarGiftSheet.this.resourcesProvider; + } + @Override + public boolean presentFragment(BaseFragment fragment) { + sheet[0].dismiss(); + dismiss(); + BaseFragment baseFragment = LaunchActivity.getSafeLastFragment(); + if (baseFragment != null) { + return baseFragment.presentFragment(baseFragment); + } + return false; + } + }, 0, BirthdayController.getInstance(currentAccount).getState(), UserSelectorBottomSheet.TYPE_TRANSFER, true); + sheet[0].setTitle(LocaleController.formatString(R.string.Gift2Transfer, getGiftName())); + final int days = now > can_export_at ? 0 : (int) Math.max(1, Math.round((float) Math.max(0, can_export_at - now) / (60 * 60 * 24f))); + sheet[0].addTONOption(days); + sheet[0].setOnUserSelector(dialogId -> { + if (dialogId == -99) { + if (now < can_export_at) { + new AlertDialog.Builder(getContext(), resourcesProvider) + .setTitle(getString(R.string.Gift2ExportTONUnlocksAlertTitle)) + .setMessage(formatPluralString("Gift2ExportTONUnlocksAlertText", Math.max(1, days))) + .setPositiveButton(getString(R.string.OK), null) + .show(); + } else if (!BuildVars.DEBUG_PRIVATE_VERSION && BuildVars.DEBUG_VERSION) { + new AlertDialog.Builder(getContext(), resourcesProvider) + .setTitle(getString(R.string.Gift2ExportTONUpdateRequiredTitle)) + .setMessage(getString(R.string.Gift2ExportTONUpdateRequiredText)) + .setPositiveButton(getString(R.string.OK), null) + .show(); + } else { + LinearLayout topView = new LinearLayout(getContext()); + topView.setOrientation(LinearLayout.VERTICAL); + topView.addView(new GiftTransferTopView(getContext(), gift), LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP, 0, -4, 0, 0)); + TextView titleView = new TextView(getContext()); + titleView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack, resourcesProvider)); + titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); + titleView.setTypeface(AndroidUtilities.bold()); + titleView.setText(getString(R.string.Gift2ExportTONFragmentTitle)); + topView.addView(titleView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP, 24, 4, 24, 14)); + TextView textView = new TextView(getContext()); + textView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack, resourcesProvider)); + textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); + textView.setText(AndroidUtilities.replaceTags(formatString(R.string.Gift2ExportTONFragmentText, getGiftName()))); + topView.addView(textView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP, 24, 0, 24, 4)); + new AlertDialog.Builder(getContext(), resourcesProvider) + .setView(topView) + .setPositiveButton(getString(R.string.Gift2ExportTONFragmentOpen), (di, w) -> { + final Browser.Progress progress = di.makeButtonLoading(w); + final TwoStepVerificationActivity passwordFragment = new TwoStepVerificationActivity(); + passwordFragment.setDelegate(2, password -> initTONTransfer(password, passwordFragment)); + passwordFragment.setDelegateString(getGiftName()); + progress.init(); + passwordFragment.preload(() -> { + sheet[0].dismiss(); + progress.end(); + presentFragment(passwordFragment); + }); + }) + .setNegativeButton(getString(R.string.Cancel), null) + .show(); + } + return; + } + Runnable showAlert = () -> { + final String name; + final TLObject obj; + if (dialogId >= 0) { + final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(dialogId); + name = UserObject.getForcedFirstName(user); + obj = user; + } else { + final TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-dialogId); + name = chat == null ? "" : chat.title; + obj = chat; + } + LinearLayout topView = new LinearLayout(getContext()); + topView.setOrientation(LinearLayout.VERTICAL); + topView.addView(new GiftTransferTopView(getContext(), gift, obj), LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP, 0, -4, 0, 0)); + TextView textView = new TextView(getContext()); + textView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack, resourcesProvider)); + textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); + textView.setText(AndroidUtilities.replaceTags( + transfer_stars > 0 ? + formatPluralString("Gift2TransferPriceText", (int) transfer_stars, getGiftName(), DialogObject.getShortName(dialogId)) : + formatString(R.string.Gift2TransferText, getGiftName(), name) + )); + topView.addView(textView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP, 24, 4, 24, 4)); + new AlertDialog.Builder(getContext(), resourcesProvider) + .setView(topView) + .setPositiveButton(transfer_stars > 0 ? replaceStars(formatString(R.string.Gift2TransferDoPrice, (int) transfer_stars)) : getString(R.string.Gift2TransferDo), (di, w) -> { + final Browser.Progress progress = di.makeButtonLoading(w); + progress.init(); + doTransfer(dialogId, err -> { + progress.end(); + sheet[0].dismiss(); + if (err != null) { + bottomBulletinContainer.post(() -> getBulletinFactory().showForError(err)); + return; + } + dismiss(); + }); + }) + .setNegativeButton(getString(R.string.Cancel), null) + .show(); + }; + + if (dialogId < 0) { + TLRPC.ChatFull chatFull = MessagesController.getInstance(currentAccount).getChatFull(-dialogId); + if (chatFull == null) { + TLRPC.TL_channels_getFullChannel req = new TLRPC.TL_channels_getFullChannel(); + req.channel = MessagesController.getInstance(currentAccount).getInputChannel(-dialogId); + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { + if (res instanceof TLRPC.TL_messages_chatFull) { + TLRPC.TL_messages_chatFull r = (TLRPC.TL_messages_chatFull) res; + MessagesController.getInstance(currentAccount).putUsers(r.users, false); + MessagesController.getInstance(currentAccount).putChats(r.chats, false); + MessagesController.getInstance(currentAccount).putChatFull(r.full_chat); + + if (!r.full_chat.stargifts_available) { + new AlertDialog.Builder(getContext(), resourcesProvider) + .setTitle(getString(R.string.Gift2ChannelDoesntSupportGiftsTitle)) + .setMessage(getString(R.string.Gift2ChannelDoesntSupportGiftsText)) + .setPositiveButton(getString(R.string.OK), null) + .show(); + return; + } + + showAlert.run(); + } else { + getBulletinFactory().makeForError(err).show(); + } + })); + return; + } + + if (!chatFull.stargifts_available) { + new AlertDialog.Builder(getContext(), resourcesProvider) + .setTitle(getString(R.string.Gift2ChannelDoesntSupportGiftsTitle)) + .setMessage(getString(R.string.Gift2ChannelDoesntSupportGiftsText)) + .setPositiveButton(getString(R.string.OK), null) + .show(); + return; + } + } + showAlert.run(); + }); + sheet[0].show(); + } + + private void initTONTransfer(TLRPC.InputCheckPasswordSRP password, TwoStepVerificationActivity passwordFragment) { + TL_stars.getStarGiftWithdrawalUrl req = new TL_stars.getStarGiftWithdrawalUrl(); + req.stargift = getInputStarGift(); + if (req.stargift == null) { + return; + } + req.password = password; + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { + if (getContext() == null) return; + if (error != null) { + if ("PASSWORD_MISSING".equals(error.text) || error.text.startsWith("PASSWORD_TOO_FRESH_") || error.text.startsWith("SESSION_TOO_FRESH_")) { + if (passwordFragment != null) { + passwordFragment.needHideProgress(); + } + AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); + builder.setTitle(LocaleController.getString(R.string.Gift2TransferToTONAlertTitle)); + + LinearLayout linearLayout = new LinearLayout(getContext()); + linearLayout.setPadding(AndroidUtilities.dp(24), AndroidUtilities.dp(2), AndroidUtilities.dp(24), 0); + linearLayout.setOrientation(LinearLayout.VERTICAL); + builder.setView(linearLayout); + + TextView messageTextView = new TextView(getContext()); + messageTextView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack)); + messageTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); + messageTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP); + messageTextView.setText(AndroidUtilities.replaceTags(LocaleController.getString(R.string.Gift2TransferToTONAlertText))); + linearLayout.addView(messageTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + + LinearLayout linearLayout2 = new LinearLayout(getContext()); + linearLayout2.setOrientation(LinearLayout.HORIZONTAL); + linearLayout.addView(linearLayout2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 11, 0, 0)); + + ImageView dotImageView = new ImageView(getContext()); + dotImageView.setImageResource(R.drawable.list_circle); + dotImageView.setPadding(LocaleController.isRTL ? AndroidUtilities.dp(11) : 0, AndroidUtilities.dp(9), LocaleController.isRTL ? 0 : AndroidUtilities.dp(11), 0); + dotImageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_dialogTextBlack), PorterDuff.Mode.MULTIPLY)); + + messageTextView = new TextView(getContext()); + messageTextView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack)); + messageTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); + messageTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP); + messageTextView.setText(AndroidUtilities.replaceTags(LocaleController.getString(R.string.Gift2TransferToTONAlertText1))); + if (LocaleController.isRTL) { + linearLayout2.addView(messageTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + linearLayout2.addView(dotImageView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.RIGHT)); + } else { + linearLayout2.addView(dotImageView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT)); + linearLayout2.addView(messageTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + } + + linearLayout2 = new LinearLayout(getContext()); + linearLayout2.setOrientation(LinearLayout.HORIZONTAL); + linearLayout.addView(linearLayout2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 11, 0, 0)); + + dotImageView = new ImageView(getContext()); + dotImageView.setImageResource(R.drawable.list_circle); + dotImageView.setPadding(LocaleController.isRTL ? AndroidUtilities.dp(11) : 0, AndroidUtilities.dp(9), LocaleController.isRTL ? 0 : AndroidUtilities.dp(11), 0); + dotImageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_dialogTextBlack), PorterDuff.Mode.MULTIPLY)); + + messageTextView = new TextView(getContext()); + messageTextView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack)); + messageTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); + messageTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP); + messageTextView.setText(AndroidUtilities.replaceTags(LocaleController.getString(R.string.Gift2TransferToTONAlertText2))); + if (LocaleController.isRTL) { + linearLayout2.addView(messageTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + linearLayout2.addView(dotImageView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.RIGHT)); + } else { + linearLayout2.addView(dotImageView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT)); + linearLayout2.addView(messageTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + } + + if ("PASSWORD_MISSING".equals(error.text)) { + builder.setPositiveButton(LocaleController.getString(R.string.Gift2TransferToTONSetPassword), (dialogInterface, i) -> presentFragment(new TwoStepVerificationSetupActivity(TwoStepVerificationSetupActivity.TYPE_INTRO, null))); + builder.setNegativeButton(LocaleController.getString(R.string.Cancel), null); + } else { + messageTextView = new TextView(getContext()); + messageTextView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack)); + messageTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); + messageTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP); + messageTextView.setText(LocaleController.getString(R.string.Gift2TransferToTONAlertText3)); + linearLayout.addView(messageTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 11, 0, 0)); + + builder.setNegativeButton(LocaleController.getString(R.string.OK), null); + } + if (passwordFragment != null) { + passwordFragment.showDialog(builder.create()); + } else { + builder.show(); + } + } else if ("SRP_ID_INVALID".equals(error.text)) { + TL_account.getPassword getPasswordReq = new TL_account.getPassword(); + ConnectionsManager.getInstance(currentAccount).sendRequest(getPasswordReq, (response2, error2) -> AndroidUtilities.runOnUIThread(() -> { + if (error2 == null) { + TL_account.Password currentPassword = (TL_account.Password) response2; + passwordFragment.setCurrentPasswordInfo(null, currentPassword); + TwoStepVerificationActivity.initPasswordNewAlgo(currentPassword); + initTONTransfer(passwordFragment.getNewSrpPassword(), passwordFragment); + } + }), ConnectionsManager.RequestFlagWithoutLogin); + } else { + if (passwordFragment != null) { + passwordFragment.needHideProgress(); + passwordFragment.finishFragment(); + } + BulletinFactory.showError(error); + } + } else { + passwordFragment.needHideProgress(); + passwordFragment.finishFragment(); + if (response instanceof TL_stars.starGiftWithdrawalUrl) { + Browser.openUrlInSystemBrowser(getContext(), ((TL_stars.starGiftWithdrawalUrl) response).url); + } + } + })); + } + + private void presentFragment(BaseFragment fragment) { + final BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); + if (lastFragment == null) return; + + final BaseFragment.BottomSheetParams params = new BaseFragment.BottomSheetParams(); + params.transitionFromLeft = true; + params.allowNestedScroll = false; + lastFragment.showAsSheet(fragment, params); + } + + private TL_stars.InputSavedStarGift getInputStarGift() { + if (dialogId < 0) { + final TL_stars.TL_inputSavedStarGiftChat stargift = new TL_stars.TL_inputSavedStarGiftChat(); + stargift.peer = MessagesController.getInstance(currentAccount).getInputPeer(dialogId); + if (messageObject != null && messageObject.messageOwner != null) { + if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGift) { + final TLRPC.TL_messageActionStarGift action = (TLRPC.TL_messageActionStarGift) messageObject.messageOwner.action; + if ((action.flags & 4096) == 0) { + return null; + } + stargift.saved_id = action.saved_id; + } else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGiftUnique) { + final TLRPC.TL_messageActionStarGiftUnique action = (TLRPC.TL_messageActionStarGiftUnique) messageObject.messageOwner.action; + if ((action.flags & 128) == 0) { + return null; + } + stargift.saved_id = action.saved_id; + } else return null; + } else if (savedStarGift != null) { + if ((savedStarGift.flags & 2048) == 0) { + return null; + } + stargift.saved_id = savedStarGift.saved_id; + } else return null; + return stargift; + } else if (messageObject != null && messageObject.messageOwner != null && messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGift && (messageObject.messageOwner.action.flags & 4096) != 0) { + final TLRPC.TL_messageActionStarGift action = (TLRPC.TL_messageActionStarGift) messageObject.messageOwner.action; + final TL_stars.TL_inputSavedStarGiftChat stargift = new TL_stars.TL_inputSavedStarGiftChat(); + stargift.peer = MessagesController.getInstance(currentAccount).getInputPeer(action.peer); + stargift.saved_id = action.saved_id; + return stargift; + } else if (messageObject != null && messageObject.messageOwner != null && messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGiftUnique && (messageObject.messageOwner.action.flags & 128) != 0) { + final TLRPC.TL_messageActionStarGiftUnique action = (TLRPC.TL_messageActionStarGiftUnique) messageObject.messageOwner.action; + final TL_stars.TL_inputSavedStarGiftChat stargift = new TL_stars.TL_inputSavedStarGiftChat(); + stargift.peer = MessagesController.getInstance(currentAccount).getInputPeer(action.peer); + stargift.saved_id = action.saved_id; + return stargift; + } else { + final TL_stars.TL_inputSavedStarGiftUser stargift = new TL_stars.TL_inputSavedStarGiftUser(); + if (messageObject != null) { + stargift.msg_id = messageObject.getId(); + } else if (savedStarGift != null) { + stargift.msg_id = savedStarGift.msg_id; + } else return null; + return stargift; + } + } + + private void doTransfer(long dialogId, Utilities.Callback done) { + final long transfer_stars; + final TL_stars.InputSavedStarGift inputStarGift = getInputStarGift(); + final long fromDialogId; + if (inputStarGift == null) return; + if (savedStarGift != null && savedStarGift.gift instanceof TL_stars.TL_starGiftUnique) { + fromDialogId = this.dialogId; + transfer_stars = savedStarGift.transfer_stars; + } else if (messageObject != null && messageObject.messageOwner != null && messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGiftUnique) { + TLRPC.TL_messageActionStarGiftUnique action = (TLRPC.TL_messageActionStarGiftUnique) messageObject.messageOwner.action; + fromDialogId = DialogObject.getPeerDialogId(action.gift.owner_id); + transfer_stars = action.transfer_stars; + } else { + return; + } + + if (transfer_stars <= 0) { + final TL_stars.transferStarGift req = new TL_stars.transferStarGift(); + req.stargift = inputStarGift; + req.to_id = MessagesController.getInstance(currentAccount).getInputPeer(dialogId); + + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> { + if (res instanceof TLRPC.Updates) { + MessagesController.getInstance(currentAccount).processUpdates((TLRPC.Updates) res, false); + } + AndroidUtilities.runOnUIThread(() -> { + if (done != null) { + done.run(err); + } + BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); + if (lastFragment != null) { + if (res instanceof TLRPC.Updates) { + if (dialogId >= 0 && fromDialogId >= 0) { + ChatActivity chat = ChatActivity.of(dialogId); + chat.whenFullyVisible(() -> { + BulletinFactory.of(chat) + .createSimpleBulletin(R.raw.forward, getString(R.string.Gift2TransferredTitle), AndroidUtilities.replaceTags(formatString(R.string.Gift2TransferredText, getGiftName(), DialogObject.getShortName(dialogId)))) + .show(); + }); + lastFragment.presentFragment(chat); + } else { + BulletinFactory.of(lastFragment) + .createSimpleBulletin(R.raw.forward, getString(R.string.Gift2TransferredTitle), AndroidUtilities.replaceTags(formatString(R.string.Gift2TransferredText, getGiftName(), DialogObject.getShortName(dialogId)))) + .show(); + } + } else { + BulletinFactory.of(lastFragment).showForError(err); + } + } + StarsController.getInstance(currentAccount).invalidateProfileGifts(dialogId); + StarsController.getInstance(currentAccount).invalidateProfileGifts(fromDialogId); + }); + }); + } else { + + StarsController s = StarsController.getInstance(currentAccount); + if (!s.balanceAvailable()) { + s.getBalance(() -> { + if (!s.balanceAvailable()) { + getBulletinFactory() + .createSimpleBulletin(R.raw.error, formatString(R.string.UnknownErrorCode, "NO_BALANCE")) + .show(); + return; + } + doTransfer(dialogId, done); + }); + return; + } + + final TLRPC.TL_inputInvoiceStarGiftTransfer invoice = new TLRPC.TL_inputInvoiceStarGiftTransfer(); + invoice.stargift = inputStarGift; + invoice.to_id = MessagesController.getInstance(currentAccount).getInputPeer(dialogId); + + TLRPC.TL_payments_getPaymentForm req = new TLRPC.TL_payments_getPaymentForm(); + req.invoice = invoice; + final JSONObject themeParams = BotWebViewSheet.makeThemeParams(resourcesProvider); + if (themeParams != null) { + req.theme_params = new TLRPC.TL_dataJSON(); + req.theme_params.data = themeParams.toString(); + req.flags |= 1; + } + + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { + if (res instanceof TLRPC.PaymentForm) { + TLRPC.PaymentForm form = (TLRPC.PaymentForm) res; + MessagesController.getInstance(currentAccount).putUsers(form.users, false); + + TL_stars.TL_payments_sendStarsForm req2 = new TL_stars.TL_payments_sendStarsForm(); + req2.form_id = form.form_id; + req2.invoice = invoice; + + long _stars = 0; + for (TLRPC.TL_labeledPrice price : form.invoice.prices) { + _stars += price.amount; + } + final long stars = _stars; + + ConnectionsManager.getInstance(currentAccount).sendRequest(req2, (res2, err2) -> AndroidUtilities.runOnUIThread(() -> { + if (res2 instanceof TLRPC.TL_payments_paymentResult) { + TLRPC.TL_payments_paymentResult r = (TLRPC.TL_payments_paymentResult) res2; + MessagesController.getInstance(currentAccount).putUsers(r.updates.users, false); + MessagesController.getInstance(currentAccount).putChats(r.updates.chats, false); + + StarsController.getInstance(currentAccount).invalidateTransactions(false); + StarsController.getInstance(currentAccount).invalidateProfileGifts(dialogId); + StarsController.getInstance(currentAccount).invalidateProfileGifts(fromDialogId); + StarsController.getInstance(currentAccount).invalidateBalance(); + if (done != null) { + done.run(null); + } + + BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); + if (lastFragment != null) { + if (dialogId >= 0 && fromDialogId >= 0) { + ChatActivity chat = ChatActivity.of(dialogId); + chat.whenFullyVisible(() -> { + BulletinFactory.of(chat) + .createSimpleBulletin(R.raw.forward, getString(R.string.Gift2TransferredTitle), AndroidUtilities.replaceTags(formatString(R.string.Gift2TransferredText, getGiftName(), DialogObject.getShortName(dialogId)))) + .show(); + }); + lastFragment.presentFragment(chat); + } else { + BulletinFactory.of(lastFragment) + .createSimpleBulletin(R.raw.forward, getString(R.string.Gift2TransferredTitle), AndroidUtilities.replaceTags(formatString(R.string.Gift2TransferredText, getGiftName(), DialogObject.getShortName(dialogId)))) + .show(); + } + } + + Utilities.stageQueue.postRunnable(() -> { + MessagesController.getInstance(currentAccount).processUpdates(r.updates, false); + }); + + } else if (err2 != null && "BALANCE_TOO_LOW".equals(err2.text)) { + if (!MessagesController.getInstance(currentAccount).starsPurchaseAvailable()) { + button.setLoading(false); + showNoSupportDialog(getContext(), resourcesProvider); + return; + } + StarsController.getInstance(currentAccount).invalidateBalance(() -> { + final boolean[] purchased = new boolean[]{false}; + StarsIntroActivity.StarsNeededSheet sheet = new StarsIntroActivity.StarsNeededSheet(getContext(), resourcesProvider, stars, StarsIntroActivity.StarsNeededSheet.TYPE_STAR_GIFT_TRANSFER, null, () -> { + purchased[0] = true; + button.setLoading(false); + doTransfer(dialogId, done); + }); + sheet.setOnDismissListener(d -> { + button.setLoading(false); + }); + sheet.show(); + }); + } else { + if (done != null) { + done.run(err2); + } + getBulletinFactory().showForError(err2); + } + })); + } else { + if (done != null) { + done.run(err); + } + getBulletinFactory().makeForError(err).show(); + } + })); + } + } + + protected BulletinFactory getBulletinFactory() { + return BulletinFactory.of(bottomBulletinContainer, resourcesProvider); + } + + @Override + public void onBackPressed() { + if (!onlyWearInfo && currentPage.to > 0 && !button.isLoading() && !isLearnMore) { + if (messageObject != null) { + set(messageObject); + } else if (savedStarGift != null) { + set(savedStarGift); + } + switchPage(PAGE_INFO, true); + return; + } + super.onBackPressed(); + } + + @Override + protected void onSwipeStarts() { + if (currentHintView != null) { + currentHintView.hide(); + currentHintView = null; + } + } + + private HintView2 currentHintView; + private View currentHintViewTextView; + public void showHint(CharSequence hintText, View textView, boolean onRightDrawable) { + if (currentHintView != null && currentHintView.shown() && currentHintViewTextView == textView) { + return; + } + if (textView == null) return; + + final float cx; + if (onRightDrawable) { + if (textView instanceof SimpleTextView) { + cx = ((SimpleTextView) textView).getRightDrawableX() + ((SimpleTextView) textView).getRightDrawableWidth() / 2.0f; + } else { + return; + } + } else { + final Layout layout; + if (textView instanceof TextView) { + layout = ((TextView) textView).getLayout(); + } else if (textView instanceof SimpleTextView) { + layout = ((SimpleTextView) textView).getLayout(); + } else { + return; + } + if (layout == null) return; + final CharSequence text = layout.getText(); + if (!(text instanceof Spanned)) return; + final Spanned spanned = (Spanned) text; + + final ButtonSpan[] buttons = spanned.getSpans(0, spanned.length(), ButtonSpan.class); + if (buttons == null || buttons.length <= 0) return; + + final ButtonSpan span = buttons[buttons.length - 1]; + final int start = spanned.getSpanStart(span); + cx = textView.getPaddingLeft() + layout.getPrimaryHorizontal(start) + span.getSize() / 2.0f; + } + + final int[] loc = new int[2]; + final int[] loc2 = new int[2]; + textView.getLocationOnScreen(loc); + container.getLocationOnScreen(loc2); + loc[0] -= loc2[0]; + loc[1] -= loc2[1]; + + if (currentHintView != null) { + currentHintView.hide(); + currentHintView = null; + } + final HintView2 hintView = new HintView2(getContext(), HintView2.DIRECTION_BOTTOM); + hintView.setMultilineText(!onRightDrawable); + hintView.setText(hintText); + hintView.setJointPx(0, loc[0] + cx - (dp(16) + backgroundPaddingLeft)); + hintView.setTranslationY(loc[1] - dp(100) - textView.getHeight() / 2.0f + dp(4.33f + (onRightDrawable ? 18 : 0))); + hintView.setDuration(3000); + hintView.setPadding(dp(16) + backgroundPaddingLeft, 0, dp(16) + backgroundPaddingLeft, 0); + hintView.setOnHiddenListener(() -> AndroidUtilities.removeFromParent(hintView)); + hintView.show(); + container.addView(hintView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 100)); + currentHintView = hintView; + currentHintViewTextView = textView; + } + + public static class GiftTransferTopView extends View { + + private final StarGiftDrawableIcon giftDrawable; + private final ImageReceiver userImageReceiver; + + private final Path arrowPath = new Path(); + private final Paint arrowPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + + public GiftTransferTopView(Context context, TL_stars.StarGift gift, TLObject obj) { + super(context); + + giftDrawable = new StarGiftDrawableIcon(this, gift, 60, .27f); + giftDrawable.setPatternsType(StarGiftPatterns.TYPE_LINK_PREVIEW); + AvatarDrawable avatarDrawable = new AvatarDrawable(); + avatarDrawable.setInfo(obj); + userImageReceiver = new ImageReceiver(this); + userImageReceiver.setRoundRadius(dp(30)); + userImageReceiver.setForUserOrChat(obj, avatarDrawable); + + arrowPaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText7)); + arrowPaint.setStyle(Paint.Style.STROKE); + arrowPaint.setStrokeCap(Paint.Cap.ROUND); + arrowPaint.setStrokeJoin(Paint.Join.ROUND); + arrowPaint.setStrokeWidth(dp(2)); + + arrowPath.rewind(); + arrowPath.moveTo(0, -dp(8)); + arrowPath.lineTo(dp(6.166f), 0); + arrowPath.lineTo(0, dp(8)); + } + + public GiftTransferTopView(Context context, TL_stars.StarGift gift) { + super(context); + + giftDrawable = new StarGiftDrawableIcon(this, gift, 60, .27f); + giftDrawable.setPatternsType(StarGiftPatterns.TYPE_LINK_PREVIEW); + userImageReceiver = new ImageReceiver(this); + userImageReceiver.setRoundRadius(dp(30)); + userImageReceiver.setImageBitmap(SessionCell.createDrawable(60, "fragment")); + + arrowPaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText7)); + arrowPaint.setStyle(Paint.Style.STROKE); + arrowPaint.setStrokeCap(Paint.Cap.ROUND); + arrowPaint.setStrokeJoin(Paint.Join.ROUND); + arrowPaint.setStrokeWidth(dp(2.33f)); + + arrowPath.rewind(); + arrowPath.moveTo(0, -dp(8)); + arrowPath.lineTo(dp(6.166f), 0); + arrowPath.lineTo(0, dp(8)); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure( + MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), + MeasureSpec.makeMeasureSpec(dp(100), MeasureSpec.EXACTLY) + ); + } + + @Override + protected void onDraw(@NonNull Canvas canvas) { + final int width = dp(60 + 36 + 60); + int left = getWidth() / 2 - width / 2, top = getHeight() / 2 - dp(30); + giftDrawable.setBounds(left, top, left + dp(60), top + dp(60)); + giftDrawable.draw(canvas); + + canvas.save(); + canvas.translate(getWidth() / 2.0f - dp(6.166f) / 2.0f, getHeight() / 2.0f); + canvas.drawPath(arrowPath, arrowPaint); + canvas.restore(); + + userImageReceiver.setImageCoords(left + dp(60 + 36), top, dp(60), dp(60)); + userImageReceiver.draw(canvas); + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + userImageReceiver.onAttachedToWindow(); + } + + @Override + protected void onDetachedFromWindow() { + super.onDetachedFromWindow(); + userImageReceiver.onDetachedFromWindow(); + } + } + + public static class StarGiftDrawableIcon extends CompatDrawable { + + private final Path path = new Path(); + private final RectF rect = new RectF(); + private final int sizeDp; + + private final ImageReceiver imageReceiver; + private final AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable pattern; + private RadialGradient gradient; + private final Matrix matrix = new Matrix(); + + private float patternsScale; + + public StarGiftDrawableIcon(View view, TL_stars.StarGift gift, int sizeDp, float patternsScale) { + super(view); + + this.patternsScale = patternsScale; + imageReceiver = new ImageReceiver(view); + pattern = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(view, false, dp(sizeDp > 180 ? 24 : 18)); + this.sizeDp = sizeDp; + + if (gift != null) { + final TL_stars.starGiftAttributeBackdrop backdrop = findAttribute(gift.attributes, TL_stars.starGiftAttributeBackdrop.class); + final TL_stars.starGiftAttributePattern pattern = findAttribute(gift.attributes, TL_stars.starGiftAttributePattern.class); + final TL_stars.starGiftAttributeModel model = findAttribute(gift.attributes, TL_stars.starGiftAttributeModel.class); + + if (pattern != null) { + this.pattern.set(pattern.document, false); + } + if (backdrop != null) { + gradient = new RadialGradient(0, 0, dpf2(sizeDp) / 2, new int[]{ backdrop.center_color | 0xFF000000, backdrop.edge_color | 0xFF000000 }, new float[] { 0, 1 }, Shader.TileMode.CLAMP); + this.pattern.setColor(backdrop.pattern_color | 0xFF000000); + } + if (model != null) { + setGiftImage(imageReceiver, model.document, (int) (sizeDp * .75f)); + } + } + paint.setShader(gradient); + + if (view.isAttachedToWindow()) { + onAttachedToWindow(); + } + } + + private int rounding = dp(16); + public StarGiftDrawableIcon setRounding(int r) { + this.rounding = r; + return this; + } + + private int patternsType = StarGiftPatterns.TYPE_DEFAULT; + public StarGiftDrawableIcon setPatternsType(int type) { + this.patternsType = type; + return this; + } + + @Override + public void draw(@NonNull Canvas canvas) { + rect.set(getBounds()); + + canvas.save(); + path.rewind(); + path.addRoundRect(rect, rounding, rounding, Path.Direction.CW); + canvas.clipPath(path); + + if (gradient != null) { + matrix.reset(); + matrix.postTranslate(rect.centerX(), rect.centerY()); + gradient.setLocalMatrix(matrix); + paint.setShader(gradient); + } + canvas.drawPaint(paint); + + canvas.save(); + canvas.translate(rect.centerX(), rect.centerY()); + StarGiftPatterns.drawPattern(canvas, patternsType, pattern, rect.width(), rect.height(), 1.0f, patternsScale); + canvas.restore(); + + final float imageSize = Math.min(rect.width(), rect.height()) * 0.75f; + imageReceiver.setImageCoords(rect.centerX() - imageSize / 2, rect.centerY() - imageSize / 2, imageSize, imageSize); + imageReceiver.draw(canvas); + + canvas.restore(); + } + + @Override + public void onAttachedToWindow() { + pattern.attach(); + imageReceiver.onAttachedToWindow(); + } + + @Override + public void onDetachedToWindow() { + pattern.detach(); + imageReceiver.onDetachedFromWindow(); + } + + @Override + public int getIntrinsicWidth() { + return dp(sizeDp); + } + + @Override + public int getIntrinsicHeight() { + return dp(sizeDp); + } + } + + public static class UpgradeIcon extends CompatDrawable { + + private final View view; + private final Paint strokePaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private final Path arrow = new Path(); + private final long start = System.currentTimeMillis(); + + public UpgradeIcon(View view, int color) { + super(view); + this.view = view; + + paint.setColor(0xFFFFFFFF); + strokePaint.setStyle(Paint.Style.STROKE); + strokePaint.setStrokeJoin(Paint.Join.ROUND); + strokePaint.setStrokeCap(Paint.Cap.ROUND); + strokePaint.setColor(color); + + arrow.rewind(); + arrow.moveTo(-dpf2(2.91f), dpf2(1.08f)); + arrow.lineTo(0, -dpf2(1.08f)); + arrow.lineTo(dpf2(2.91f), dpf2(1.08f)); + } + + @Override + public void draw(@NonNull Canvas canvas) { + canvas.drawCircle(getBounds().centerX(), getBounds().centerY(), getBounds().width() / 2.0f, paint); + + final float t = (System.currentTimeMillis() - start) % 400 / 400.0f; + + strokePaint.setStrokeWidth(dpf2(1.33f)); + canvas.save(); + final float arrowsHeight = dpf2(2.16f) * 3 + dpf2(1.166f) * 2; + canvas.translate(getBounds().centerX(), getBounds().centerY() - (arrowsHeight) / 2.0f); + for (int i = 0; i < 4; ++i) { + float alpha = 1.0f; + if (i == 0) { + alpha = 1.0f - t; + } else if (i == 3) { + alpha = t; + } + strokePaint.setAlpha((int) (0xFF * alpha)); + canvas.save(); + final float s = lerp(0.5f, 1.0f, alpha); + canvas.scale(s, s); + canvas.drawPath(arrow, strokePaint); + canvas.restore(); + canvas.translate(0, dpf2(2.16f + 1.166f) * alpha); + } + canvas.restore(); + + if (view != null) { + view.invalidate(); + } + } + + @Override + public int getIntrinsicWidth() { + return dp(18); + } + + @Override + public int getIntrinsicHeight() { + return dp(18); + } + } + + private static class PageTransition { + public int from, to; + public float progress; + + public PageTransition(int from, int to, float t) { + this.from = from; + this.to = to; + } + + public void setProgress(float t) { + this.progress = t; + } + + public float at(int page) { + if (to == page && from == page) { + return 1.0f; + } + if (to == page) { + return progress; + } + if (from == page) { + return 1.0f - progress; + } + return 0.0f; + } + + public float at(int page1, int page2) { + if (contains(page1) && contains(page2)) { + return 1.0f; + } + return Math.max(at(page1), at(page2)); + } + + public boolean contains(int page) { + return from == page || to == page; + } + + public boolean is(int page) { + return to == page; + } + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarGiftUniqueActionLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarGiftUniqueActionLayout.java new file mode 100644 index 0000000000..c7992abe2e --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarGiftUniqueActionLayout.java @@ -0,0 +1,404 @@ +package org.telegram.ui.Stars; + +import static org.telegram.messenger.AndroidUtilities.dp; +import static org.telegram.messenger.LocaleController.formatPluralStringComma; +import static org.telegram.messenger.LocaleController.getString; +import static org.telegram.ui.Stars.StarsController.findAttribute; +import static org.telegram.ui.Stars.StarsIntroActivity.setGiftImage; + +import android.graphics.Canvas; +import android.graphics.Matrix; +import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.RadialGradient; +import android.graphics.RectF; +import android.graphics.Shader; +import android.graphics.drawable.Drawable; +import android.view.MotionEvent; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.DialogObject; +import org.telegram.messenger.ImageReceiver; +import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MessageObject; +import org.telegram.messenger.MessagesController; +import org.telegram.messenger.R; +import org.telegram.messenger.UserConfig; +import org.telegram.messenger.UserObject; +import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_stars; +import org.telegram.ui.ActionBar.ActionBar; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.Cells.ChatActionCell; +import org.telegram.ui.Components.AnimatedEmojiDrawable; +import org.telegram.ui.Components.ButtonBounce; +import org.telegram.ui.Components.Text; +import org.telegram.ui.Gifts.GiftSheet; + +import java.util.ArrayList; + +public class StarGiftUniqueActionLayout { + + private final int currentAccount; + private final ChatActionCell view; + private final Theme.ResourcesProvider resourcesProvider; + public final ImageReceiver imageReceiver; + private final AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable emoji; + + private final Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private int gradientRadius; + private RadialGradient gradient; + private final Matrix matrix = new Matrix(); + + private final GiftSheet.RibbonDrawable ribbon; + + private TL_stars.starGiftAttributeBackdrop backdrop; + private TL_stars.starGiftAttributePattern pattern; + private TL_stars.starGiftAttributeModel model; + + private final RectF backgroundRect = new RectF(); + private final Path backgroundPath = new Path(); + + public boolean repost; + + private float titleY; + private Text title; + + private float subtitleY; + private Text subtitle; + + private float nameWidth, valueWidth; + private final ArrayList table = new ArrayList<>(); + + private float buttonY, buttonHeight; + private Text buttonText; + private final RectF buttonRect = new RectF(); + private final Path buttonPath = new Path(); + private final Paint buttonBackgroundPaint = new Paint(); + private final StarsReactionsSheet.Particles buttonParticles = new StarsReactionsSheet.Particles(StarsReactionsSheet.Particles.TYPE_RADIAL, 25); + private final ButtonBounce buttonBounce; + + private final ButtonBounce bounce; + + private static final class Row { + public final float y; + public final Text name, value; + public Row(float y, CharSequence name, CharSequence value) { + this.name = new Text(name, 12); + this.value = new Text(value, 12, AndroidUtilities.bold()); + this.y = y + getHeight() / 2.0f; + } + public float getHeight() { + return Math.max(name.getHeight(), value.getHeight()); + } + } + + public StarGiftUniqueActionLayout(int currentAccount, ChatActionCell view, Theme.ResourcesProvider resourcesProvider) { + this.currentAccount = currentAccount; + this.view = view; + this.resourcesProvider = resourcesProvider; + + ribbon = new GiftSheet.RibbonDrawable(view, 1.0f); + buttonBounce = new ButtonBounce(view); + bounce = new ButtonBounce(view); + imageReceiver = new ImageReceiver(view); + emoji = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(view, dp(28)); + } + + int width, height; + TLRPC.TL_messageActionStarGiftUnique action; + MessageObject currentMessageObject; + + public void set(MessageObject messageObject, boolean animated) { + currentMessageObject = messageObject; + + TLRPC.TL_messageActionStarGiftUnique action = null; + if (messageObject != null && messageObject.messageOwner != null && messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGiftUnique) { + action = ((TLRPC.TL_messageActionStarGiftUnique) messageObject.messageOwner.action); + } + + if (action == null || action.refunded || !(action.gift instanceof TL_stars.TL_starGiftUnique)) { + action = null; + } + if (attached && action != null && this.action == null) { + imageReceiver.onAttachedToWindow(); + emoji.attach(); + } + this.action = action; + this.repost = messageObject != null && messageObject.isRepostPreview; + if (action == null) { + return; + } + + final TL_stars.TL_starGiftUnique gift = (TL_stars.TL_starGiftUnique) action.gift; + backdrop = findAttribute(gift.attributes, TL_stars.starGiftAttributeBackdrop.class); + pattern = findAttribute(gift.attributes, TL_stars.starGiftAttributePattern.class); + TL_stars.starGiftAttributeModel prevModel = model; + model = findAttribute(gift.attributes, TL_stars.starGiftAttributeModel.class); + + backgroundPaint.setShader(gradient = null); + if (pattern != null) { + emoji.set(pattern.document, animated); + } else { + emoji.set((Drawable) null, animated); + } + if (model != null && (prevModel == null || prevModel.document.id != model.document.id)) { + if (repost) { + imageReceiver.setAllowStartLottieAnimation(true); + imageReceiver.setAllowStartAnimation(true); + imageReceiver.setAutoRepeat(1); + } else { + imageReceiver.setAutoRepeatCount(0); + imageReceiver.clearDecorators(); + imageReceiver.setAutoRepeat(0); + } + setGiftImage(imageReceiver, model.document, 110); + } + ribbon.setBackdrop(backdrop, true); + ribbon.setText(11, getString(R.string.Gift2UniqueRibbon), true); + + if (repost) { + width = dp(200); + } else { + width = Math.min((int) (AndroidUtilities.isTablet() ? AndroidUtilities.getMinTabletSide() * 0.6f : AndroidUtilities.displaySize.x * 0.62f - dp(34)), AndroidUtilities.displaySize.y - ActionBar.getCurrentActionBarHeight() - AndroidUtilities.statusBarHeight - dp(64)); + if (!AndroidUtilities.isTablet()) { + width = (int) (width * 1.2f); + } + width -= dp(8); + } + + final float w = width; + float h = 0; + + boolean out = messageObject.isOutOwner(); + long from_id = (!action.upgrade == out) ? UserConfig.getInstance(currentAccount).getClientUserId() : messageObject.getDialogId(); + if (action.from_id != null) { + from_id = DialogObject.getPeerDialogId(action.from_id); + } + final String fromName = DialogObject.getShortName(from_id); + + h += dp(10); + h += dp(110); + h += dp(9.33f); + if (repost) { + title = new Text(gift.title, 14, AndroidUtilities.bold()); + } else if (action.peer != null || UserObject.isService(messageObject.getDialogId())) { + title = new Text(LocaleController.getString(R.string.Gift2UniqueTitle2), 14, AndroidUtilities.bold()); + } else { + title = new Text(LocaleController.formatString(R.string.Gift2UniqueTitle, fromName), 14, AndroidUtilities.bold()); + } + titleY = h + title.getHeight() / 2.0f; + h += title.getHeight(); + h += dp(3); + if (repost) { + subtitle = new Text(formatPluralStringComma("Gift2CollectionNumber", gift.num), 12, AndroidUtilities.bold()); + } else { + subtitle = new Text(gift.title + " #" + LocaleController.formatNumber(gift.num, ','), 12); + } + subtitleY = h + subtitle.getHeight() / 2.0f; + h += subtitle.getHeight(); + h += dp(repost ? 14 : 11); + + table.clear(); + nameWidth = 0.0f; + valueWidth = 0.0f; + + if (model != null) { + if (!table.isEmpty()) { + h += dp(6); + } + final Row row = new Row(h, getString(R.string.Gift2AttributeModel), model.name); + table.add(row); + row.name.ellipsize(w * .5f); + nameWidth = Math.max(nameWidth, row.name.getCurrentWidth()); + row.value.ellipsize(w * .5f); + valueWidth = Math.max(valueWidth, row.value.getCurrentWidth()); + h += row.getHeight(); + } + if (backdrop != null) { + if (!table.isEmpty()) { + h += dp(6); + } + final Row row = new Row(h, getString(R.string.Gift2AttributeBackdrop), backdrop.name); + table.add(row); + row.name.ellipsize(w * .5f); + nameWidth = Math.max(nameWidth, row.name.getCurrentWidth()); + row.value.ellipsize(w * .5f); + valueWidth = Math.max(valueWidth, row.value.getCurrentWidth()); + h += row.getHeight(); + } + if (pattern != null) { + if (!table.isEmpty()) { + h += dp(6); + } + final Row row = new Row(h, getString(R.string.Gift2AttributeSymbol), pattern.name); + table.add(row); + row.name.ellipsize(w * .5f); + nameWidth = Math.max(nameWidth, row.name.getCurrentWidth()); + row.value.ellipsize(w * .5f); + valueWidth = Math.max(valueWidth, row.value.getCurrentWidth()); + h += row.getHeight(); + } + + h += dp(11.66f); + if (!repost) { + buttonY = h; + buttonText = new Text(LocaleController.getString(R.string.Gift2UniqueView), 14, AndroidUtilities.bold()); + h += (buttonHeight = dp(30)); + h += dp(11); + } else { + h += dp(10); + } + this.height = (int) h; + } + + public boolean has() { + return this.action != null; + } + + public float getWidth() { + return width; + } + + public float getHeight() { + return height; + } + + private boolean attached; + public void attach() { + attached = true; + if (action != null) { + imageReceiver.onAttachedToWindow(); + emoji.attach(); + } + } + + public void detach() { + attached = false; + imageReceiver.onDetachedFromWindow(); + emoji.detach(); + } + + public void draw(Canvas canvas) { + final float cx = getWidth() / 2.0f; + + backgroundRect.set(0, 0, getWidth(), getHeight()); + final int gradientRadius = (int) (backgroundRect.width() + backgroundRect.height()) / 2; + if (backdrop != null && (gradient == null || this.gradientRadius != gradientRadius)) { + gradient = new RadialGradient(0, 0, this.gradientRadius = gradientRadius, new int[] { backdrop.center_color | 0xFF000000, backdrop.edge_color | 0xFF000000 }, new float[] { 0, 1 }, Shader.TileMode.CLAMP); + } + if (gradient != null) { + matrix.reset(); + matrix.postTranslate(cx, cx); + gradient.setLocalMatrix(matrix); + backgroundPaint.setShader(gradient); + } + backgroundPath.rewind(); + backgroundPath.addRoundRect(backgroundRect, dp(14), dp(14), Path.Direction.CW); + canvas.save(); + float s = bounce.getScale(0.0125f); + canvas.scale(s, s, backgroundRect.centerX(), backgroundRect.centerY()); + canvas.save(); + canvas.clipPath(backgroundPath); + canvas.drawPaint(backgroundPaint); + + canvas.save(); + canvas.translate(cx, dp(10 + 55)); + if (backdrop != null) { + emoji.setColor(backdrop.pattern_color | 0xFF000000); + } + StarGiftPatterns.drawPattern(canvas, StarGiftPatterns.TYPE_ACTION, emoji, backgroundRect.width(), backgroundRect.height(), 1.0f, 1.1f); + canvas.restore(); + + imageReceiver.setImageCoords(cx - dp(110) / 2.0f, dp(10), dp(110), dp(110)); + imageReceiver.draw(canvas); + + int text_color = Theme.multAlpha(0xFFFFFFFF, .60f); + if (backdrop != null) { + text_color = backdrop.text_color | 0xFF000000; + } + + title.ellipsize(getWidth() - dp(12)); + title.draw(canvas, cx - title.getCurrentWidth() / 2.0f, titleY, 0xFFFFFFFF, 1.0f); + + subtitle.ellipsize(getWidth() - dp(12)); + subtitle.draw(canvas, cx - subtitle.getCurrentWidth() / 2.0f, subtitleY, text_color, 1.0f); + + final float tableWidth = nameWidth + dp(9) + valueWidth; + for (Row row : table) { + row.name.draw(canvas, cx - tableWidth / 2.0f + nameWidth - row.name.getCurrentWidth(), row.y, text_color, 1.0f); + row.value.draw(canvas, cx - tableWidth / 2.0f + nameWidth + dp(9), row.y, 0xFFFFFFFF, 1.0f); + } + + if (!repost) { + buttonRect.set(cx - (buttonText.getCurrentWidth() + dp(30)) / 2, buttonY, cx + (buttonText.getCurrentWidth() + dp(30)) / 2, buttonY + buttonHeight); + buttonPath.rewind(); + buttonPath.addRoundRect(buttonRect, buttonHeight / 2, buttonHeight / 2, Path.Direction.CW); + + buttonBackgroundPaint.setColor(Theme.multAlpha(0xFF000000, .13f)); + + s = buttonBounce.getScale(0.075f); + canvas.scale(s, s, buttonRect.centerX(), buttonRect.centerY()); + canvas.drawPath(buttonPath, buttonBackgroundPaint); + canvas.restore(); + + ribbon.setBounds((int) backgroundRect.right - dp(48 - 1.33f), (int) backgroundRect.top - dp(1.33f), (int) backgroundRect.right + dp(1.33f), (int) backgroundRect.top + dp(48 - 1.33f)); + ribbon.setTextColor(text_color); + ribbon.draw(canvas); + } + + canvas.restore(); + } + + public void drawOutbounds(Canvas canvas) { + if (repost) { + return; + } + + + canvas.save(); + + float s = bounce.getScale(0.0125f); + canvas.scale(s, s, backgroundRect.centerX(), backgroundRect.centerY()); + + s = buttonBounce.getScale(0.075f); + canvas.scale(s, s, buttonRect.centerX(), buttonRect.centerY()); + + canvas.clipPath(buttonPath); + buttonParticles.setBounds(buttonRect); + buttonParticles.process(); + buttonParticles.draw(canvas, Theme.multAlpha(0xFFFFFFFF, 0.7f)); + buttonText.draw(canvas, buttonRect.left + dp(15), buttonRect.centerY(), 0xFFFFFFFF, 1.0f); + canvas.restore(); + + view.invalidateOutbounds(); + } + + public boolean onTouchEvent(float ox, float oy, MotionEvent e) { + final boolean buttonHit = buttonRect.contains(e.getX() - ox, e.getY() - oy); + final boolean hit = backgroundRect.contains(e.getX() - ox, e.getY() - oy); + if (e.getAction() == MotionEvent.ACTION_DOWN) { + bounce.setPressed(hit && !buttonHit); + buttonBounce.setPressed(buttonHit); + } else if (e.getAction() == MotionEvent.ACTION_MOVE) { + if (buttonBounce.isPressed() && !buttonHit) { + buttonBounce.setPressed(false); + } else if (bounce.isPressed() && !hit) { + bounce.setPressed(false); + } + } else if (e.getAction() == MotionEvent.ACTION_UP && (buttonBounce.isPressed() || bounce.isPressed())) { + new StarGiftSheet(view.getContext(), currentAccount, currentMessageObject.getDialogId(), resourcesProvider) + .set(currentMessageObject) + .show(); + buttonBounce.setPressed(false); + bounce.setPressed(false); + return true; + } else if (e.getAction() == MotionEvent.ACTION_CANCEL && (buttonBounce.isPressed() || bounce.isPressed())) { + buttonBounce.setPressed(false); + bounce.setPressed(false); + return true; + } + return buttonBounce.isPressed() || bounce.isPressed(); + } + +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarReactionsOverlay.java b/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarReactionsOverlay.java index 4c3712430b..748cf8cae4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarReactionsOverlay.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarReactionsOverlay.java @@ -22,6 +22,8 @@ import org.telegram.messenger.Utilities; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.Cells.BaseCell; +import org.telegram.ui.Cells.ChatActionCell; import org.telegram.ui.Cells.ChatMessageCell; import org.telegram.ui.ChatActivity; import org.telegram.ui.Components.AnimatedFloat; @@ -38,7 +40,7 @@ public class StarReactionsOverlay extends View { private final ChatActivity chatActivity; - private ChatMessageCell cell; + private BaseCell cell; private int messageId; // private final Camera camera = new Camera(); @@ -79,15 +81,29 @@ public StarReactionsOverlay(ChatActivity chatActivity) { longPressRunnable = () -> { if (cell == null) return; - cell.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + cell.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} onTouchEvent(MotionEvent.obtain(0, 0, MotionEvent.ACTION_CANCEL, 0, 0, 0)); ArrayList reactors = null; - final MessageObject msg = cell.getPrimaryMessageObject(); - if (msg == null) return; - - if (msg != null && msg.messageOwner != null && msg.messageOwner.reactions != null) { - reactors = msg.messageOwner.reactions.top_reactors; + final MessageObject msg; + if (cell instanceof ChatMessageCell) { + final ChatMessageCell messageCell = (ChatMessageCell) cell; + msg = messageCell.getPrimaryMessageObject(); + if (msg == null) return; + if (msg != null && msg.messageOwner != null && msg.messageOwner.reactions != null) { + reactors = msg.messageOwner.reactions.top_reactors; + } + } else if (cell instanceof ChatActionCell) { + final ChatActionCell actionCell = (ChatActionCell) cell; + msg = actionCell.getMessageObject(); + if (msg == null) return; + if (msg != null && msg.messageOwner != null && msg.messageOwner.reactions != null) { + reactors = msg.messageOwner.reactions.top_reactors; + } + } else { + return; } StarsController.getInstance(msg.currentAccount).commitPaidReaction(); @@ -99,9 +115,19 @@ public StarReactionsOverlay(ChatActivity chatActivity) { }; } + private MessageObject getMessageObject() { + if (cell instanceof ChatMessageCell) { + return ((ChatMessageCell) cell).getPrimaryMessageObject(); + } else if (cell instanceof ChatActionCell) { + return ((ChatActionCell) cell).getMessageObject(); + } else { + return null; + } + } + private void checkBalance() { - if (cell != null && cell.getPrimaryMessageObject() != null) { - final MessageObject msg = cell.getPrimaryMessageObject(); + if (getMessageObject() != null) { + final MessageObject msg = getMessageObject(); final StarsController starsController = StarsController.getInstance(chatActivity.getCurrentAccount()); final long totalStars = starsController.getPendingPaidReactions(msg); if (starsController.balanceAvailable() && starsController.getBalance(false) < totalStars) { @@ -122,30 +148,50 @@ private void checkBalance() { } } - public void setMessageCell(ChatMessageCell cell) { + public void setMessageCell(BaseCell cell) { if (this.cell == cell) return; - if (this.cell != null) { - this.cell.setScrimReaction(null); - this.cell.setInvalidateListener(null); + if (this.cell instanceof ChatMessageCell) { + ((ChatMessageCell) this.cell).setScrimReaction(null); + ((ChatMessageCell) this.cell).setInvalidateListener(null); + this.cell.invalidate(); + } else if (this.cell instanceof ChatActionCell) { + ((ChatActionCell) this.cell).setScrimReaction(null); + ((ChatActionCell) this.cell).setInvalidateListener(null); this.cell.invalidate(); } this.cell = cell; - this.messageId = cell != null && cell.getPrimaryMessageObject() != null ? cell.getPrimaryMessageObject().getId() : 0; - if (this.cell != null) { + this.messageId = getMessageObject() == null ? 0 : getMessageObject().getId(); + if (this.cell instanceof ChatMessageCell) { this.cell.invalidate(); - this.cell.setInvalidateListener(this::invalidate); + ((ChatMessageCell) this.cell).setInvalidateListener(this::invalidate); + } else if (this.cell instanceof ChatActionCell) { + this.cell.invalidate(); + ((ChatActionCell) this.cell).setInvalidateListener(this::invalidate); } invalidate(); } @Override protected void dispatchDraw(Canvas canvas) { - if (cell == null || !cell.isCellAttachedToWindow()) return; - final MessageObject msg = cell.getPrimaryMessageObject(); + if (cell instanceof ChatMessageCell) { + if (!((ChatMessageCell) cell).isCellAttachedToWindow()) { + return; + } + } else if (cell instanceof ChatActionCell) { + if (!((ChatActionCell) cell).isCellAttachedToWindow()) { + return; + } + } + final MessageObject msg = getMessageObject(); if ((msg != null ? msg.getId() : 0) != messageId) { setMessageCell(null); return; } + final ReactionsLayoutInBubble reactionsLayoutInBubble = getReactionsLayoutInBubble(); + if (reactionsLayoutInBubble == null) { + setMessageCell(null); + return; + } final float s = AndroidUtilities.lerp(1, 1.8f, focus); @@ -158,11 +204,12 @@ protected void dispatchDraw(Canvas canvas) { pos[1] += (int) chatActivity.drawingChatListViewYoffset; canvas.save(); // canvas.saveLayerAlpha(cell.getBackgroundDrawableLeft(), 0, cell.getBackgroundDrawableRight(), cell.getHeight(), 0xFF, Canvas.ALL_SAVE_FLAG); - ReactionsLayoutInBubble.ReactionButton btn = cell.reactionsLayoutInBubble.getReactionButton("stars"); + + ReactionsLayoutInBubble.ReactionButton btn = reactionsLayoutInBubble.getReactionButton("stars"); Integer hash = null; if (btn != null) { - final int btnX = pos[0] - pos2[0] + cell.reactionsLayoutInBubble.x + btn.x; - final int btnY = pos[1] - pos2[1] + cell.reactionsLayoutInBubble.y + btn.y; + final int btnX = pos[0] - pos2[0] + reactionsLayoutInBubble.x + btn.x; + final int btnY = pos[1] - pos2[1] + reactionsLayoutInBubble.y + btn.y; reactionBounds.set(btnX, btnY, btnX + btn.width, btnY + btn.height); scaleRect(reactionBounds, s, btnX + btn.width * .1f, btnY + btn.height / 2f); @@ -176,13 +223,19 @@ protected void dispatchDraw(Canvas canvas) { hash = btn.reaction.hashCode(); } canvas.translate(pos[0] - pos2[0], pos[1] - pos2[1]); - cell.setScrimReaction(null); - cell.drawReactionsLayout(canvas, 1f, hash); - cell.drawReactionsLayoutOverlay(canvas, 1f); - cell.setScrimReaction(hash); -// AndroidUtilities.rectTmp.set(cell.getBackgroundDrawableRight() - dp(24), 0, cell.getBackgroundDrawableRight(), cell.getHeight()); -// clip.draw(canvas, AndroidUtilities.rectTmp, GradientClip.RIGHT, 1f); -// canvas.restore(); + if (cell instanceof ChatMessageCell) { + final ChatMessageCell messageCell = (ChatMessageCell) cell; + messageCell.setScrimReaction(null); + messageCell.drawReactionsLayout(canvas, 1f, hash); + messageCell.drawReactionsLayoutOverlay(canvas, 1f); + messageCell.setScrimReaction(hash); + } else if (cell instanceof ChatActionCell) { + final ChatActionCell actionCell = (ChatActionCell) cell; + actionCell.setScrimReaction(null); + actionCell.drawReactionsLayout(canvas, true, hash); + actionCell.drawReactionsLayoutOverlay(canvas, true); + actionCell.setScrimReaction(hash); + } canvas.restore(); canvas.restore(); @@ -241,21 +294,33 @@ protected void dispatchDraw(Canvas canvas) { invalidate(); } + public ReactionsLayoutInBubble getReactionsLayoutInBubble() { + if (this.cell instanceof ChatMessageCell) { + return ((ChatMessageCell) this.cell).reactionsLayoutInBubble; + } else if (this.cell instanceof ChatActionCell) { + return ((ChatActionCell) this.cell).reactionsLayoutInBubble; + } else { + return null; + } + } + private boolean pressed; @Override public boolean onTouchEvent(MotionEvent event) { if (cell == null || hidden) return false; + final ReactionsLayoutInBubble reactionsLayoutInBubble = getReactionsLayoutInBubble(); + if (reactionsLayoutInBubble == null) return false; if (event.getAction() == MotionEvent.ACTION_DOWN) { if (clickBounds.contains(event.getX(), event.getY())) { pressed = true; - ReactionsLayoutInBubble.ReactionButton btn = cell.reactionsLayoutInBubble.getReactionButton("stars"); + final ReactionsLayoutInBubble.ReactionButton btn = reactionsLayoutInBubble.getReactionButton("stars"); if (btn != null) btn.bounce.setPressed(true); AndroidUtilities.cancelRunOnUIThread(longPressRunnable); AndroidUtilities.runOnUIThread(longPressRunnable, ViewConfiguration.getLongPressTimeout()); } } else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) { - ReactionsLayoutInBubble.ReactionButton btn = cell.reactionsLayoutInBubble.getReactionButton("stars"); + final ReactionsLayoutInBubble.ReactionButton btn = reactionsLayoutInBubble.getReactionButton("stars"); if (event.getAction() == MotionEvent.ACTION_UP) { tap(event.getX(), event.getY(), true, true); } @@ -299,17 +364,19 @@ public void onAnimationEnd(Animator animation) { public void tap(float x, float y, boolean send, boolean ripple) { if (cell == null || hidden) return; - final MessageObject msg = cell.getPrimaryMessageObject(); + final MessageObject msg = getMessageObject(); + final ReactionsLayoutInBubble reactionsLayoutInBubble = getReactionsLayoutInBubble(); + if (msg == null || reactionsLayoutInBubble == null) return; final StarsController starsController = StarsController.getInstance(chatActivity.getCurrentAccount()); playEffect(); - ReactionsLayoutInBubble.ReactionButton btn = cell.reactionsLayoutInBubble.getReactionButton("stars"); + ReactionsLayoutInBubble.ReactionButton btn = reactionsLayoutInBubble.getReactionButton("stars"); if (btn != null) btn.startAnimation(); if (send) { try { performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); } catch (Exception ignore) {} - StarsController.getInstance(chatActivity.getCurrentAccount()).sendPaidReaction(cell.getPrimaryMessageObject(), chatActivity, +1, true, false, null); + StarsController.getInstance(chatActivity.getCurrentAccount()).sendPaidReaction(msg, chatActivity, +1, true, false, null); } counter.cancelAnimation(); counter.setText("+" + starsController.getPendingPaidReactions(msg)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarsController.java b/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarsController.java index d7fe3d9e25..46cdef5853 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarsController.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarsController.java @@ -8,6 +8,7 @@ import android.app.Activity; import android.content.Context; import android.graphics.drawable.Drawable; +import android.os.Bundle; import android.text.TextUtils; import android.util.LongSparseArray; import android.view.Gravity; @@ -46,6 +47,7 @@ import org.telegram.tgnet.NativeByteBuffer; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import org.telegram.tgnet.tl.TL_stars; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; @@ -54,16 +56,20 @@ import org.telegram.ui.Components.Bulletin; import org.telegram.ui.Components.BulletinFactory; import org.telegram.ui.Components.LayoutHelper; +import org.telegram.ui.Components.SharedMediaLayout; import org.telegram.ui.LaunchActivity; import org.telegram.ui.PaymentFormActivity; +import org.telegram.ui.ProfileActivity; import org.telegram.ui.bots.BotWebViewSheet; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; import java.util.Collections; +import java.util.Comparator; import java.util.List; import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; public class StarsController { @@ -114,15 +120,15 @@ public TL_stars.StarsAmount getBalance() { } public long getBalance(boolean withMinus) { - return getBalance(withMinus, null).amount; + return getBalance(withMinus, null, false).amount; } public TL_stars.StarsAmount getBalance(Runnable loaded) { - return getBalance(true, loaded); + return getBalance(true, loaded, false); } - public TL_stars.StarsAmount getBalance(boolean withMinus, Runnable loaded) { - if ((!balanceLoaded || System.currentTimeMillis() - lastBalanceLoaded > 1000 * 60) && !balanceLoading) { + public TL_stars.StarsAmount getBalance(boolean withMinus, Runnable loaded, boolean force) { + if ((!balanceLoaded || System.currentTimeMillis() - lastBalanceLoaded > 1000 * 60) && !balanceLoading || force) { balanceLoading = true; TL_stars.TL_payments_getStarsStatus req = new TL_stars.TL_payments_getStarsStatus(); req.peer = new TLRPC.TL_inputPeerSelf(); @@ -198,6 +204,12 @@ public void invalidateBalance() { balanceLoaded = true; } + public void invalidateBalance(Runnable loaded) { + balanceLoaded = false; + getBalance(false, loaded, true); + balanceLoaded = true; + } + public void updateBalance(TL_stars.StarsAmount balance) { if (!this.balance.equals(balance)) { this.balance = balance; @@ -227,9 +239,8 @@ public ArrayList getOptions() { ConnectionsManager.getInstance(currentAccount).sendRequest(new TL_stars.TL_payments_getStarsTopupOptions(), (res, err) -> AndroidUtilities.runOnUIThread(() -> { ArrayList loadedOptions = new ArrayList<>(); ArrayList toLoadStorePrice = new ArrayList<>(); - if (res instanceof TLRPC.Vector) { - TLRPC.Vector vector = (TLRPC.Vector) res; - for (Object object : vector.objects) { + if (res instanceof Vector) { + for (Object object : ((Vector) res).objects) { if (object instanceof TL_stars.TL_starsTopupOption) { TL_stars.TL_starsTopupOption option = (TL_stars.TL_starsTopupOption) object; loadedOptions.add(option); @@ -315,9 +326,8 @@ public ArrayList getGiftOptions() { ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { ArrayList loadedOptions = new ArrayList<>(); ArrayList toLoadStorePrice = new ArrayList<>(); - if (res instanceof TLRPC.Vector) { - TLRPC.Vector vector = (TLRPC.Vector) res; - for (Object object : vector.objects) { + if (res instanceof Vector) { + for (Object object : ((Vector) res).objects) { if (object instanceof TL_stars.TL_starsGiftOption) { TL_stars.TL_starsGiftOption option = (TL_stars.TL_starsGiftOption) object; loadedOptions.add(option); @@ -403,9 +413,8 @@ public ArrayList getGiveawayOptions() { ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { ArrayList loadedOptions = new ArrayList<>(); ArrayList toLoadStorePrice = new ArrayList<>(); - if (res instanceof TLRPC.Vector) { - TLRPC.Vector vector = (TLRPC.Vector) res; - for (Object object : vector.objects) { + if (res instanceof Vector) { + for (Object object : ((Vector) res).objects) { if (object instanceof TL_stars.TL_starsGiveawayOption) { TL_stars.TL_starsGiveawayOption option = (TL_stars.TL_starsGiveawayOption) object; loadedOptions.add(option); @@ -1346,7 +1355,7 @@ public void subscribeTo(String hash, TLRPC.ChatInvite chatInvite, Utilities.Call }); } - private void showNoSupportDialog(Context context, Theme.ResourcesProvider resourcesProvider) { + public static void showNoSupportDialog(Context context, Theme.ResourcesProvider resourcesProvider) { new AlertDialog.Builder(context, resourcesProvider) .setTitle(getString(R.string.StarsNotAvailableTitle)) .setMessage(getString(R.string.StarsNotAvailableText)) @@ -1354,7 +1363,7 @@ private void showNoSupportDialog(Context context, Theme.ResourcesProvider resour .show(); } - private void payAfterConfirmed(MessageObject messageObject, TLRPC.InputInvoice inputInvoice, TLRPC.TL_payments_paymentFormStars form, Utilities.Callback whenDone) { + public void payAfterConfirmed(MessageObject messageObject, TLRPC.InputInvoice inputInvoice, TLRPC.TL_payments_paymentFormStars form, Utilities.Callback whenDone) { if (form == null) { return; } @@ -1412,7 +1421,9 @@ private void payAfterConfirmed(MessageObject messageObject, TLRPC.InputInvoice i } TLRPC.TL_payments_paymentResult result = (TLRPC.TL_payments_paymentResult) res2; - MessagesController.getInstance(currentAccount).processUpdates(result.updates, false); + Utilities.stageQueue.postRunnable(() -> { + MessagesController.getInstance(currentAccount).processUpdates(result.updates, false); + }); final boolean media = messageObject != null && messageObject.messageOwner != null && messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaPaidMedia; if (media) { @@ -1523,7 +1534,9 @@ private void payAfterConfirmed(String hash, TLRPC.ChatInvite chatInvite, Utiliti BulletinFactory b = !AndroidUtilities.hasDialogOnTop(fragment) ? BulletinFactory.of(fragment) : BulletinFactory.global(); if (res2 instanceof TLRPC.TL_payments_paymentResult) { TLRPC.TL_payments_paymentResult result = (TLRPC.TL_payments_paymentResult) res2; - MessagesController.getInstance(currentAccount).processUpdates(result.updates, false); + Utilities.stageQueue.postRunnable(() -> { + MessagesController.getInstance(currentAccount).processUpdates(result.updates, false); + }); long dialogId = 0; if (result.updates.update instanceof TLRPC.TL_updateChannel) { @@ -1639,7 +1652,9 @@ private void updateMediaPrice(MessageObject msg, long price, Runnable done, bool ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { if (res instanceof TLRPC.Updates) { - MessagesController.getInstance(currentAccount).processUpdates((TLRPC.Updates) res, false); + Utilities.stageQueue.postRunnable(() -> { + MessagesController.getInstance(currentAccount).processUpdates((TLRPC.Updates) res, false); + }); done.run(); } else if (err != null && FileRefController.isFileRefError(err.text) && !afterFileRef) { TLRPC.TL_messages_getScheduledMessages req2 = new TLRPC.TL_messages_getScheduledMessages(); @@ -1957,7 +1972,9 @@ public void commit() { connectionsManager.sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (response != null) { - messagesController.processUpdates((TLRPC.Updates) response, false); + Utilities.stageQueue.postRunnable(() -> { + messagesController.processUpdates((TLRPC.Updates) response, false); + }); } else if (error != null) { messageObject.addPaidReactions((int) -amount, wasChosen, isAnonymous()); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.didUpdateReactions, messageObject.getDialogId(), messageObject.getId(), messageObject.messageOwner.reactions); @@ -2107,6 +2124,7 @@ public long getPendingPaidReactions(long dialogId, int messageId) { public int giftsHash; public long giftsRemoteTime; public final ArrayList gifts = new ArrayList<>(); + public final ArrayList sortedGifts = new ArrayList<>(); public final ArrayList birthdaySortedGifts = new ArrayList<>(); public void invalidateStarGifts() { @@ -2127,7 +2145,10 @@ public void loadStarGifts() { gifts.addAll(giftsCached); birthdaySortedGifts.clear(); birthdaySortedGifts.addAll(gifts); - Collections.sort(birthdaySortedGifts, (a, b) -> (b.birthday ? 1 : 0) - (a.birthday ? 1 : 0)); + Collections.sort(birthdaySortedGifts, Comparator.comparingInt((TL_stars.StarGift a) -> (a.birthday ? -1 : 0)).thenComparingInt((TL_stars.StarGift a) -> (a.sold_out ? 1 : 0))); + sortedGifts.clear(); + sortedGifts.addAll(gifts); + Collections.sort(sortedGifts, Comparator.comparingInt((TL_stars.StarGift a) -> (a.sold_out ? 1 : 0))); giftsHash = hash; giftsRemoteTime = time; giftsLoading = false; @@ -2145,7 +2166,10 @@ public void loadStarGifts() { gifts.addAll(res.gifts); birthdaySortedGifts.clear(); birthdaySortedGifts.addAll(gifts); - Collections.sort(birthdaySortedGifts, (a, b) -> (b.birthday ? 1 : 0) - (a.birthday ? 1 : 0)); + Collections.sort(birthdaySortedGifts, Comparator.comparingInt((TL_stars.StarGift a) -> (a.birthday ? -1 : 0)).thenComparingInt((TL_stars.StarGift a) -> (a.sold_out ? 1 : 0))); + sortedGifts.clear(); + sortedGifts.addAll(gifts); + Collections.sort(sortedGifts, Comparator.comparingInt((TL_stars.StarGift a) -> (a.sold_out ? 1 : 0))); giftsHash = res.hash; giftsRemoteTime = System.currentTimeMillis(); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.starGiftsLoaded); @@ -2290,7 +2314,7 @@ public Runnable getStarGift(long gift_id, Utilities.Callback }; } - public void buyStarGift(Activity activity, TL_stars.StarGift gift, boolean anonymous, long user_id, TLRPC.TL_textWithEntities text, Utilities.Callback2 whenDone) { + public void buyStarGift(TL_stars.StarGift gift, boolean anonymous, boolean upgraded, long dialogId, TLRPC.TL_textWithEntities text, Utilities.Callback2 whenDone) { final Context context = LaunchActivity.instance != null ? LaunchActivity.instance : ApplicationLoader.applicationContext; final Theme.ResourcesProvider resourcesProvider = getResourceProvider(); @@ -2307,29 +2331,30 @@ public void buyStarGift(Activity activity, TL_stars.StarGift gift, boolean anony } return; } - buyStarGift(activity, gift, anonymous, user_id, text, whenDone); + buyStarGift(gift, anonymous, upgraded, dialogId, text, whenDone); }); return; } - final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(user_id); - if (user == null) { - if (whenDone != null) { - whenDone.run(false, null); - } - return; + final String name; + if (dialogId >= 0) { + name = UserObject.getUserName(MessagesController.getInstance(currentAccount).getUser(dialogId)); + } else { + final TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-dialogId); + name = chat == null ? "" : chat.title; } - TLRPC.TL_inputInvoiceStarGift inputInvoice = new TLRPC.TL_inputInvoiceStarGift(); + final TLRPC.TL_inputInvoiceStarGift inputInvoice = new TLRPC.TL_inputInvoiceStarGift(); inputInvoice.hide_name = anonymous; - inputInvoice.user_id = MessagesController.getInstance(currentAccount).getInputPeer(user); + inputInvoice.peer = MessagesController.getInstance(currentAccount).getInputPeer(dialogId); inputInvoice.gift_id = gift.id; + inputInvoice.include_upgrade = upgraded; if (text != null && !TextUtils.isEmpty(text.text)) { inputInvoice.flags |= 2; inputInvoice.message = text; } - TLRPC.TL_payments_getPaymentForm req = new TLRPC.TL_payments_getPaymentForm(); + final TLRPC.TL_payments_getPaymentForm req = new TLRPC.TL_payments_getPaymentForm(); final JSONObject themeParams = BotWebViewSheet.makeThemeParams(resourcesProvider); if (themeParams != null) { req.theme_params = new TLRPC.TL_dataJSON(); @@ -2349,6 +2374,11 @@ public void buyStarGift(Activity activity, TL_stars.StarGift gift, boolean anony TL_stars.TL_payments_sendStarsForm req2 = new TL_stars.TL_payments_sendStarsForm(); req2.form_id = form.form_id; req2.invoice = inputInvoice; + long _stars = 0; + for (TLRPC.TL_labeledPrice price : form.invoice.prices) { + _stars += price.amount; + } + final long stars = _stars; ConnectionsManager.getInstance(currentAccount).sendRequest(req2, (res2, err2) -> AndroidUtilities.runOnUIThread(() -> { final BaseFragment fragment = LaunchActivity.getLastFragment(); BulletinFactory b = fragment != null && fragment.visibleDialog == null ? BulletinFactory.of(fragment) : BulletinFactory.global(); @@ -2363,9 +2393,9 @@ public void buyStarGift(Activity activity, TL_stars.StarGift gift, boolean anony return; } final boolean[] purchased = new boolean[] { false }; - StarsIntroActivity.StarsNeededSheet sheet = new StarsIntroActivity.StarsNeededSheet(context, resourcesProvider, gift.stars, StarsIntroActivity.StarsNeededSheet.TYPE_STAR_GIFT_BUY, UserObject.getForcedFirstName(user), () -> { + StarsIntroActivity.StarsNeededSheet sheet = new StarsIntroActivity.StarsNeededSheet(context, resourcesProvider, stars, StarsIntroActivity.StarsNeededSheet.TYPE_STAR_GIFT_BUY, name, () -> { purchased[0] = true; - buyStarGift(activity, gift, anonymous, user_id, text, whenDone); + buyStarGift(gift, anonymous, upgraded, dialogId, text, whenDone); }); sheet.setOnDismissListener(d -> { if (whenDone != null && !purchased[0]) { @@ -2387,32 +2417,61 @@ public void buyStarGift(Activity activity, TL_stars.StarGift gift, boolean anony } final TLRPC.TL_payments_paymentResult result = (TLRPC.TL_payments_paymentResult) res2; - MessagesController.getInstance(currentAccount).processUpdates(result.updates, false); + Utilities.stageQueue.postRunnable(() -> { + MessagesController.getInstance(currentAccount).processUpdates(result.updates, false); + }); + + invalidateStarGifts(); + invalidateProfileGifts(dialogId); + invalidateTransactions(true); if (whenDone != null) { whenDone.run(true, null); } - if (fragment instanceof ChatActivity && ((ChatActivity) fragment).getDialogId() == user_id) { - BulletinFactory.of(fragment).createEmojiBulletin(gift.sticker, getString(R.string.StarsGiftCompleted), AndroidUtilities.replaceTags(formatPluralString("StarsGiftCompletedText", (int) gift.stars/*, UserObject.getForcedFirstName(user)*/))).show(true); + if (dialogId < 0) { + if (fragment instanceof ProfileActivity && ((ProfileActivity) fragment).getDialogId() == dialogId) { + if (((ProfileActivity) fragment).sharedMediaLayout != null) { + ((ProfileActivity) fragment).sharedMediaLayout.updateTabs(true); + ((ProfileActivity) fragment).sharedMediaLayout.scrollToPage(SharedMediaLayout.TAB_GIFTS); + ((ProfileActivity) fragment).scrollToSharedMedia(); + } + BulletinFactory.of(fragment).createEmojiBulletin(gift.sticker, getString(R.string.StarsGiftCompleted), AndroidUtilities.replaceTags(formatPluralString("StarsGiftCompletedChannelText", (int) stars, name))).show(false); + } else { + final Bundle args = new Bundle(); + args.putLong("chat_id", -dialogId); + args.putBoolean("open_gifts", true); + final ProfileActivity profileActivity = new ProfileActivity(args); + profileActivity.whenFullyVisible(() -> { + AndroidUtilities.runOnUIThread(() -> { + if (profileActivity.sharedMediaLayout != null) { + profileActivity.sharedMediaLayout.scrollToPage(SharedMediaLayout.TAB_GIFTS); + profileActivity.scrollToSharedMedia(); + } + }, 200); + BulletinFactory.of(profileActivity).createEmojiBulletin(gift.sticker, getString(R.string.StarsGiftCompleted), AndroidUtilities.replaceTags(formatPluralString("StarsGiftCompletedChannelText", (int) stars, name))).show(false); + }); + fragment.presentFragment(profileActivity); + } } else { - final ChatActivity chatActivity = ChatActivity.of(user_id); - chatActivity.whenFullyVisible(() -> { - BulletinFactory.of(chatActivity).createEmojiBulletin(gift.sticker, getString(R.string.StarsGiftCompleted), AndroidUtilities.replaceTags(formatPluralString("StarsGiftCompletedText", (int) gift.stars/*, UserObject.getForcedFirstName(user)*/))).show(true); - }); - fragment.presentFragment(chatActivity); + if (fragment instanceof ChatActivity && ((ChatActivity) fragment).getDialogId() == dialogId) { + BulletinFactory.of(fragment).createEmojiBulletin(gift.sticker, getString(R.string.StarsGiftCompleted), AndroidUtilities.replaceTags(formatPluralString("StarsGiftCompletedText", (int) stars/*, UserObject.getForcedFirstName(user)*/))).show(true); + } else { + final ChatActivity chatActivity = ChatActivity.of(dialogId); + chatActivity.whenFullyVisible(() -> { + BulletinFactory.of(chatActivity).createEmojiBulletin(gift.sticker, getString(R.string.StarsGiftCompleted), AndroidUtilities.replaceTags(formatPluralString("StarsGiftCompletedText", (int) stars/*, UserObject.getForcedFirstName(user)*/))).show(true); + }); + fragment.presentFragment(chatActivity); + } } MessagesController.getInstance(currentAccount).getMainSettings().edit() - .putBoolean("show_gift_for_" + user_id, true) - .putBoolean(Calendar.getInstance().get(Calendar.YEAR) + "show_gift_for_" + user_id, true) + .putBoolean("show_gift_for_" + dialogId, true) + .putBoolean(Calendar.getInstance().get(Calendar.YEAR) + "show_gift_for_" + dialogId, true) .apply(); if (LaunchActivity.instance != null && LaunchActivity.instance.getFireworksOverlay() != null) { LaunchActivity.instance.getFireworksOverlay().start(true); } - - invalidateStarGifts(); - invalidateTransactions(true); })); })); } @@ -2424,7 +2483,7 @@ public GiftsList getProfileGiftsList(long dialogId) { public GiftsList getProfileGiftsList(long dialogId, boolean create) { GiftsList list = giftLists.get(dialogId); if (list == null && create) { - giftLists.put(dialogId, list = new GiftsList(dialogId)); + giftLists.put(dialogId, list = new GiftsList(currentAccount, dialogId)); } return list; } @@ -2445,18 +2504,50 @@ public void invalidateProfileGifts(TLRPC.UserFull userFull) { } } - public class GiftsList { + public static class GiftsList { + public final int currentAccount; public final long dialogId; - public GiftsList(long dialogId) { + + public GiftsList(int currentAccount, long dialogId) { + this(currentAccount, dialogId, true); + } + public GiftsList(int currentAccount, long dialogId, boolean load) { + this.currentAccount = currentAccount; this.dialogId = dialogId; - load(); + if (load) load(); + } + + public boolean sort_by_date = true; // false => sort_by_value + + public boolean include_unlimited = true; + public boolean include_limited = true; + public boolean include_unique = true; + + public boolean include_displayed = true; + public boolean include_hidden = true; + + public Boolean chat_notifications_enabled; + + public void resetFilters() { + if (!hasFilters()) return; + sort_by_date = true; + include_unlimited = true; + include_limited = true; + include_unique = true; + include_displayed = true; + include_hidden = true; + invalidate(true); + } + + public boolean hasFilters() { + return !(sort_by_date && include_unlimited && include_limited && include_unique && include_displayed && include_hidden); } public boolean loading; public boolean endReached; public String lastOffset; - public ArrayList gifts = new ArrayList<>(); + public ArrayList gifts = new ArrayList<>(); public int currentRequestId = -1; public int totalCount; @@ -2479,8 +2570,18 @@ public void load() { boolean first = lastOffset == null; loading = true; - TL_stars.getUserStarGifts req = new TL_stars.getUserStarGifts(); - req.user_id = MessagesController.getInstance(currentAccount).getInputUser(dialogId); + final TL_stars.getSavedStarGifts req = new TL_stars.getSavedStarGifts(); + req.sort_by_value = !sort_by_date; + req.exclude_limited = !include_limited; + req.exclude_unlimited = !include_unlimited; + req.exclude_unique = !include_unique; + req.exclude_saved = !include_displayed; + req.exclude_unsaved = !include_hidden; + if (dialogId == 0) { + req.peer = new TLRPC.TL_inputPeerSelf(); + } else { + req.peer = MessagesController.getInstance(currentAccount).getInputPeer(dialogId); + } req.offset = first ? "" : lastOffset; req.limit = first ? 15 : 30; final int[] reqId = new int[1]; @@ -2488,9 +2589,10 @@ public void load() { if (reqId[0] != currentRequestId) return; loading = false; currentRequestId = -1; - if (res instanceof TL_stars.TL_userStarGifts) { - TL_stars.TL_userStarGifts rez = (TL_stars.TL_userStarGifts) res; + if (res instanceof TL_stars.TL_payments_savedStarGifts) { + final TL_stars.TL_payments_savedStarGifts rez = (TL_stars.TL_payments_savedStarGifts) res; MessagesController.getInstance(currentAccount).putUsers(rez.users, false); + MessagesController.getInstance(currentAccount).putChats(rez.chats, false); if (first) { gifts.clear(); @@ -2498,6 +2600,7 @@ public void load() { gifts.addAll(rez.gifts); lastOffset = rez.next_offset; totalCount = rez.count; + chat_notifications_enabled = (rez.flags & 2) != 0 ? rez.chat_notifications_enabled : null; endReached = gifts.size() > totalCount || lastOffset == null; } else { endReached = true; @@ -2505,7 +2608,96 @@ public void load() { NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.starUserGiftsLoaded, dialogId, GiftsList.this); })); } + + public void cancel() { + if (currentRequestId != -1) { + ConnectionsManager.getInstance(currentAccount).cancelRequest(currentRequestId, true); + currentRequestId = -1; + } + loading = false; + } } + public TL_stars.SavedStarGift findUserStarGift(long collection_id) { + for (int i = 0; i < giftLists.size(); ++i) { + final GiftsList list = giftLists.valueAt(i); + for (int j = 0; j < list.gifts.size(); ++j) { + final TL_stars.SavedStarGift gift = list.gifts.get(j); + if (gift != null && gift.gift != null && gift.gift.id == collection_id) { + return gift; + } + } + } + return null; + } + + public static T findAttribute(ArrayList attributes, Class clazz) { + if (attributes == null) { + return null; + } + for (TL_stars.StarGiftAttribute attribute : attributes) { + if (clazz.isInstance(attribute)) { + return clazz.cast(attribute); + } + } + return null; + } + public static ArrayList findAttributes(ArrayList attributes, Class clazz) { + final ArrayList result = new ArrayList<>(); + for (TL_stars.StarGiftAttribute attribute : attributes) { + if (clazz.isInstance(attribute)) { + result.add(clazz.cast(attribute)); + } + } + return result; + } + + private ConcurrentHashMap giftPreviews = new ConcurrentHashMap<>(); + + public void getStarGiftPreview(long gift_id, Utilities.Callback got) { + if (got == null) return; + TL_stars.starGiftUpgradePreview cached = giftPreviews.get(gift_id); + if (cached != null) { + got.run(cached); + return; + } + + TL_stars.getStarGiftUpgradePreview req = new TL_stars.getStarGiftUpgradePreview(); + req.gift_id = gift_id; + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { + if (res instanceof TL_stars.starGiftUpgradePreview) { + giftPreviews.put(gift_id, (TL_stars.starGiftUpgradePreview) res); + got.run((TL_stars.starGiftUpgradePreview) res); + } else { + got.run(null); + } + })); + } + + public void getUserStarGift(TL_stars.InputSavedStarGift inputSavedStarGift, Utilities.Callback got) { + if (got == null) return; + final AlertDialog progressDialog = new AlertDialog(ApplicationLoader.applicationContext, AlertDialog.ALERT_TYPE_SPINNER); + progressDialog.showDelayed(200); + final TL_stars.getSavedStarGift req = new TL_stars.getSavedStarGift(); + req.stargift.add(inputSavedStarGift); + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { + progressDialog.dismiss(); + TL_stars.SavedStarGift upgradedGift = null; + if (res instanceof TL_stars.TL_payments_savedStarGifts) { + TL_stars.TL_payments_savedStarGifts r = (TL_stars.TL_payments_savedStarGifts) res; + for (int i = 0; i < r.gifts.size(); ++i) { + TL_stars.SavedStarGift savedStarGift = r.gifts.get(i); + if ( + inputSavedStarGift instanceof TL_stars.TL_inputSavedStarGiftUser && ((TL_stars.TL_inputSavedStarGiftUser) inputSavedStarGift).msg_id == savedStarGift.msg_id || + inputSavedStarGift instanceof TL_stars.TL_inputSavedStarGiftChat && ((TL_stars.TL_inputSavedStarGiftChat) inputSavedStarGift).saved_id == savedStarGift.saved_id + ) { + upgradedGift = savedStarGift; + break; + } + } + } + got.run(upgradedGift); + })); + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarsIntroActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarsIntroActivity.java index b8b26162c7..d0608dcd8f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarsIntroActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarsIntroActivity.java @@ -61,7 +61,6 @@ import androidx.recyclerview.widget.RecyclerView; import org.telegram.messenger.AndroidUtilities; -import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.BillingController; import org.telegram.messenger.BirthdayController; import org.telegram.messenger.ChatObject; @@ -87,11 +86,9 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; -import org.telegram.tgnet.tl.TL_payments; import org.telegram.tgnet.tl.TL_stars; import org.telegram.tgnet.tl.TL_stories; import org.telegram.ui.ActionBar.ActionBar; -import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.BottomSheet; import org.telegram.ui.ActionBar.SimpleTextView; @@ -139,7 +136,6 @@ import org.telegram.ui.ImageReceiverSpan; import org.telegram.ui.LaunchActivity; import org.telegram.ui.PhotoViewer; -import org.telegram.ui.PremiumFeatureCell; import org.telegram.ui.ProfileActivity; import org.telegram.ui.Stories.recorder.ButtonWithCounterView; import org.telegram.ui.Stories.recorder.HintView2; @@ -664,6 +660,8 @@ public void onItemClick(UItem item, int position) { public static class StarsBalanceView extends LinearLayout implements NotificationCenter.NotificationCenterDelegate { + private long dialogId; + private final int currentAccount; private final TextView headerTextView; private final AnimatedTextView amountTextView; @@ -672,6 +670,8 @@ public StarsBalanceView(Context context, int currentAccount) { super(context); this.currentAccount = currentAccount; + this.dialogId = UserConfig.getInstance(currentAccount).getClientUserId(); + setOrientation(VERTICAL); setGravity(Gravity.CENTER_VERTICAL | Gravity.RIGHT); @@ -707,23 +707,36 @@ protected void dispatchDraw(Canvas canvas) { setPadding(dp(15), dp(4), dp(15), dp(4)); } + public void setDialogId(long dialogId) { + if (this.dialogId != dialogId) { + this.dialogId = dialogId; + updateBalance(true); + } + } + @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); updateBalance(false); NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.starBalanceUpdated); + NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.botStarsUpdated); } @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.starBalanceUpdated); + NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.botStarsUpdated); } @Override public void didReceivedNotification(int id, int account, Object... args) { if (id == NotificationCenter.starBalanceUpdated) { updateBalance(true); + } else if (id == NotificationCenter.botStarsUpdated) { + if ((long) args[0] == dialogId) { + updateBalance(true); + } } } @@ -734,11 +747,20 @@ public void updateBalance(boolean animated) { StarsController c = StarsController.getInstance(currentAccount); amountTextView.cancelAnimation(); - long balance = StarsController.getInstance(currentAccount).getBalance().amount; + boolean loading; + long balance; + if (dialogId == UserConfig.getInstance(currentAccount).getClientUserId()) { + loading = !c.balanceAvailable(); + balance = c.getBalance().amount; + } else { + TLRPC.TL_payments_starsRevenueStats stats = BotStarsController.getInstance(currentAccount).getStarsRevenueStats(dialogId); + loading = stats == null || stats.status == null; + balance = stats != null && stats.status != null ? stats.status.current_balance.amount : 0; + } if (balance > lastBalance && lastBalance != -1) { bounce(); } - if (!c.balanceAvailable()) { + if (loading) { if (loadingString == null) { loadingString = new SpannableString("x"); loadingString.setSpan(new LoadingSpan(amountTextView, dp(48)), 0, loadingString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); @@ -1399,7 +1421,7 @@ public void set(TL_stars.StarsTransaction transaction, boolean bot, boolean divi final boolean affiliate_to_bot = (transaction.flags & 131072) != 0; final boolean affiliate_to_channel = !affiliate_to_bot && (transaction.flags & 65536) != 0; - threeLines = did != 0 || transaction.subscription || transaction.floodskip || transaction.stargift != null || transaction.gift && transaction.peer instanceof TL_stars.TL_starsTransactionPeerFragment; + threeLines = did != 0 && !transaction.stargift_upgrade || transaction.subscription || transaction.floodskip || transaction.stargift != null && !transaction.stargift_upgrade || transaction.gift && transaction.peer instanceof TL_stars.TL_starsTransactionPeerFragment; titleTextViewParams.bottomMargin = threeLines ? 0 : dp(4.33f); subtitleTextView.setVisibility(threeLines ? View.VISIBLE : View.GONE); dateTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, threeLines ? 13 : 14); @@ -1422,7 +1444,11 @@ public void set(TL_stars.StarsTransaction transaction, boolean bot, boolean divi imageView.setTranslationY(0); imageView2.setVisibility(GONE); imageView.setRoundRadius(dp(46)); - if (did != 0) { + if (transaction.stargift_upgrade && transaction.stargift != null) { + imageView.setImageDrawable(new StarGiftSheet.StarGiftDrawableIcon(imageView, transaction.stargift, 46, .25f)); + titleTextView.setText(getString(R.string.Gift2TransactionUpgraded)); + subtitleTextView.setVisibility(GONE); + } else if (did != 0) { boolean deleted = false; String username; if (UserObject.isService(did)) { @@ -1449,10 +1475,12 @@ public void set(TL_stars.StarsTransaction transaction, boolean bot, boolean divi spanString.setSpan(span, 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); setGiftImage(span.imageReceiver, transaction.stargift, 16); titleTextView.setText(username); - if (transaction.refund) { - subtitleTextView.setText(TextUtils.concat(spanString, " ", LocaleController.getString(transaction.stars.amount > 0 ? R.string.Gift2TransactionRefundedSent : R.string.Gift2TransactionRefundedConverted))); + if (transaction.stargift instanceof TL_stars.TL_starGiftUnique) { + subtitleTextView.setText(getString(transaction.refund ? R.string.StarGiftTransactionGiftTransferRefund : R.string.StarGiftTransactionGiftTransfer)); + } else if (transaction.refund) { + subtitleTextView.setText(TextUtils.concat(spanString, " ", LocaleController.getString(transaction.stars.amount > 0 ? (transaction.stargift_upgrade ? R.string.Gift2TransactionRefundedUpgrade : R.string.Gift2TransactionRefundedSent) : R.string.Gift2TransactionRefundedConverted))); } else { - subtitleTextView.setText(TextUtils.concat(spanString, " ", LocaleController.getString(transaction.stars.amount > 0 ? R.string.Gift2TransactionConverted : R.string.Gift2TransactionSent))); + subtitleTextView.setText(TextUtils.concat(spanString, " ", LocaleController.getString(transaction.stars.amount > 0 ? R.string.Gift2TransactionConverted : (transaction.stargift_upgrade ? R.string.Gift2TransactionUpgraded : R.string.Gift2TransactionSent)))); } } else if (transaction.subscription) { titleTextView.setText(username); @@ -2462,6 +2490,9 @@ public void dismissInternal() { public static final int TYPE_BOT_SUBSCRIPTION_KEEP = 7; public static final int TYPE_BIZ_SUBSCRIPTION_KEEP = 8; public static final int TYPE_BIZ = 9; + public static final int TYPE_STAR_GIFT_UPGRADE = 10; + public static final int TYPE_STAR_GIFT_TRANSFER = 11; + public static final int TYPE_STAR_GIFT_BUY_CHANNEL = 12; public StarsNeededSheet( Context context, @@ -2517,6 +2548,12 @@ public StarsNeededSheet( stringRes = "StarsNeededTextReactions"; } else if (type == TYPE_STAR_GIFT_BUY) { stringRes = "StarsNeededTextGift"; + } else if (type == TYPE_STAR_GIFT_BUY_CHANNEL) { + stringRes = "StarsNeededTextGiftChannel"; + } else if (type == TYPE_STAR_GIFT_UPGRADE) { + stringRes = "StarsNeededTextGiftUpgrade"; + } else if (type == TYPE_STAR_GIFT_TRANSFER) { + stringRes = "StarsNeededTextGiftTransfer"; } else if (type == TYPE_BIZ) { stringRes = "StarsNeededBizText"; } else { @@ -2988,6 +3025,10 @@ public static SpannableStringBuilder replaceStars(CharSequence cs) { } public static SpannableStringBuilder replaceStars(CharSequence cs, final float scale) { + return replaceStars(cs, scale, null); + } + + public static SpannableStringBuilder replaceStars(CharSequence cs, final float scale, ColoredImageSpan[] cache) { if (cs == null) return null; SpannableStringBuilder ssb; if (!(cs instanceof SpannableStringBuilder)) { @@ -2996,7 +3037,15 @@ public static SpannableStringBuilder replaceStars(CharSequence cs, final float s ssb = (SpannableStringBuilder) cs; } SpannableString spacedStar = new SpannableString("⭐ "); - ColoredImageSpan span = new ColoredImageSpan(R.drawable.msg_premium_liststar); + ColoredImageSpan span; + if (cache != null && cache[0] != null) { + span = cache[0]; + } else { + span = new ColoredImageSpan(R.drawable.msg_premium_liststar); + if (cache != null) { + cache[0] = span; + } + } span.setScale(scale, scale); spacedStar.setSpan(span, 0, spacedStar.length() - 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); AndroidUtilities.replaceMultipleCharSequence("⭐️", ssb, "⭐"); @@ -3070,9 +3119,9 @@ public static CharSequence getTransactionTitle(int currentAccount, boolean bot, } if (t.stargift != null) { if (t.refund) { - return LocaleController.getString(t.stars.amount > 0 ? R.string.Gift2TransactionRefundedSent : R.string.Gift2TransactionRefundedConverted); + return LocaleController.getString(t.stars.amount > 0 ? (t.stargift_upgrade ? R.string.Gift2TransactionRefundedUpgrade : R.string.Gift2TransactionRefundedSent) : R.string.Gift2TransactionRefundedConverted); } else { - return LocaleController.getString(t.stars.amount > 0 ? R.string.Gift2TransactionConverted : R.string.Gift2TransactionSent); + return LocaleController.getString(t.stars.amount > 0 ? R.string.Gift2TransactionConverted : (t.stargift_upgrade ? R.string.Gift2TransactionUpgraded : R.string.Gift2TransactionSent)); } } if (t.subscription) { @@ -3291,8 +3340,13 @@ public static BottomSheet showTransactionSheet(Context context, boolean bot, lon BackupImageView imageView = new BackupImageView(context); if (transaction.stargift != null) { - setGiftImage(imageView.getImageReceiver(), transaction.stargift, 160); - linearLayout.addView(imageView, LayoutHelper.createLinear(160, 160, Gravity.CENTER, 0, -8, 0, 10)); + if (transaction.stargift instanceof TL_stars.TL_starGiftUnique) { + imageView.setImageDrawable(new StarGiftSheet.StarGiftDrawableIcon(imageView, transaction.stargift, 94, .44f)); + linearLayout.addView(imageView, LayoutHelper.createLinear(94, 94, Gravity.CENTER, 0, 2, 0, 10)); + } else { + setGiftImage(imageView.getImageReceiver(), transaction.stargift, 160); + linearLayout.addView(imageView, LayoutHelper.createLinear(160, 160, Gravity.CENTER, 0, -8, 0, 10)); + } } else if (giveaway || transaction.gift) { setGiftImage(imageView, imageView.getImageReceiver(), transaction.stars.amount); linearLayout.addView(imageView, LayoutHelper.createLinear(160, 160, Gravity.CENTER, 0, -8, 0, 10)); @@ -3333,7 +3387,7 @@ public static BottomSheet showTransactionSheet(Context context, boolean bot, lon PhotoViewer.getInstance().openPhoto(messages, 0, did, 0, 0, new PhotoViewer.EmptyPhotoViewerProvider() { @Override - public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview) { + public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index, boolean needPreview, boolean closing) { final ImageReceiver imageReceiver = imageView.getImageReceiver(); int[] coords = new int[2]; imageView.getLocationInWindow(coords); @@ -3470,36 +3524,83 @@ public boolean validateGroupId(long groupId) { TableView tableView = new TableView(context, resourcesProvider); if (transaction.stargift != null) { - if (!transaction.refund) { - final long did = DialogObject.getPeerDialogId(transaction.peer.peer); - final TLRPC.User didUser = MessagesController.getInstance(currentAccount).getUser(did); - if (transaction.stars.amount > 0) { // converted - tableView.addRowUser(getString(R.string.StarGiveawayPrizeFrom), currentAccount, did, () -> { - sheet[0].dismiss(); - final BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); - if (lastFragment != null) { - if ((transaction.flags & 8192) != 0) { - lastFragment.presentFragment(ChatActivity.of(did, transaction.giveaway_post_id)); - } else { - lastFragment.presentFragment(ChatActivity.of(did)); - } + if (transaction.stargift_upgrade) { + if ((transaction.flags & 256) != 0 && transaction.msg_id > 0) { + final TableRow row = tableView.addRow(getString(R.string.StarGiftReason), getString(R.string.StarGiftReasonUpgrade)); + final ButtonSpan.TextViewButtons rowTextView = (ButtonSpan.TextViewButtons) ((TableView.TableRowContent) row.getChildAt(1)).getChildAt(0); + final TL_stars.TL_inputSavedStarGiftUser stargift = new TL_stars.TL_inputSavedStarGiftUser(); + stargift.msg_id = transaction.msg_id; + StarsController.getInstance(currentAccount).getUserStarGift(stargift, gift -> { + if (gift != null) { + SpannableStringBuilder sb = new SpannableStringBuilder(rowTextView.getText()); + sb.append(" ").append(ButtonSpan.make(getString(R.string.StarGiftReasonUpgradeView), () -> { + final long selfId = UserConfig.getInstance(currentAccount).getClientUserId(); + new StarGiftSheet(context, currentAccount, selfId, resourcesProvider) + .set(gift) + .show(); + }, resourcesProvider)); + rowTextView.setText(sb); } - }, !UserObject.isDeleted(didUser) ? getString(R.string.Gift2ButtonSendGift) : null, () -> { - new GiftSheet(context, currentAccount, did, sheet[0]::dismiss).show(); }); - tableView.addRowUser(getString(R.string.StarGiveawayPrizeTo), currentAccount, UserConfig.getInstance(currentAccount).getClientUserId(), () -> { + } + if (transaction.peer instanceof TL_stars.TL_starsTransactionPeer) { + final TL_stars.TL_starsTransactionPeer peer = (TL_stars.TL_starsTransactionPeer) transaction.peer; + final long from_id = DialogObject.getPeerDialogId(peer.peer); + tableView.addRowUser(getString(R.string.StarGiftUpgradeGiftFrom), currentAccount, from_id, () -> { sheet[0].dismiss(); final BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); if (lastFragment != null) { - final Bundle args = new Bundle(); - args.putLong("user_id", UserConfig.getInstance(currentAccount).getClientUserId()); - args.putBoolean("my_profile", true); - args.putBoolean("open_gifts", true); - lastFragment.presentFragment(new ProfileActivity(args)); + lastFragment.presentFragment(ChatActivity.of(from_id)); } }); - } else { // sent - tableView.addRowUser(getString(R.string.StarGiveawayPrizeFrom), currentAccount, UserConfig.getInstance(currentAccount).getClientUserId(), () -> { + } + } else if (transaction.stargift instanceof TL_stars.TL_starGiftUnique) { + tableView.addRow(getString(R.string.StarGiftReason), getString(R.string.StarGiftReasonTransfer)); + final long selfId = UserConfig.getInstance(currentAccount).getClientUserId(); + final TL_stars.TL_starsTransactionPeer peer = (TL_stars.TL_starsTransactionPeer) transaction.peer; + final long to_id = DialogObject.getPeerDialogId(peer.peer); + tableView.addRowUser(getString(R.string.Gift2From), currentAccount, selfId, () -> { + sheet[0].dismiss(); + final BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); + if (lastFragment != null) { + final Bundle args = new Bundle(); + args.putLong("user_id", selfId); + args.putBoolean("my_profile", true); + args.putBoolean("open_gifts", true); + lastFragment.presentFragment(new ProfileActivity(args)); + } + }); + tableView.addRowUser(getString(R.string.Gift2To), currentAccount, to_id, () -> { + sheet[0].dismiss(); + final BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); + if (lastFragment != null) { + final Bundle args = new Bundle(); + args.putLong("user_id", to_id); + args.putBoolean("open_gifts", true); + lastFragment.presentFragment(new ProfileActivity(args)); + } + }); + } else if (!transaction.refund) { + final long selfId = dialogId == 0 ? UserConfig.getInstance(currentAccount).getClientUserId() : dialogId; + final long did = DialogObject.getPeerDialogId(transaction.peer.peer); + final TLRPC.User didUser = MessagesController.getInstance(currentAccount).getUser(did); + if (transaction.stars.amount > 0) { // converted + if (did != selfId) { + tableView.addRowUser(getString(R.string.StarGiveawayPrizeFrom), currentAccount, did, () -> { + sheet[0].dismiss(); + final BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); + if (lastFragment != null) { + if ((transaction.flags & 8192) != 0) { + lastFragment.presentFragment(ChatActivity.of(did, transaction.giveaway_post_id)); + } else { + lastFragment.presentFragment(ChatActivity.of(did)); + } + } + }, didUser != null && !UserObject.isDeleted(didUser) ? getString(R.string.Gift2ButtonSendGift) : null, () -> { + new GiftSheet(context, currentAccount, did, sheet[0]::dismiss).show(); + }); + } + tableView.addRowUser(getString(R.string.StarGiveawayPrizeTo), currentAccount, selfId, () -> { sheet[0].dismiss(); final BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); if (lastFragment != null) { @@ -3510,6 +3611,20 @@ public boolean validateGroupId(long groupId) { lastFragment.presentFragment(new ProfileActivity(args)); } }); + } else { // sent + if (did != selfId) { + tableView.addRowUser(getString(R.string.StarGiveawayPrizeFrom), currentAccount, selfId, () -> { + sheet[0].dismiss(); + final BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); + if (lastFragment != null) { + final Bundle args = new Bundle(); + args.putLong("user_id", UserConfig.getInstance(currentAccount).getClientUserId()); + args.putBoolean("my_profile", true); + args.putBoolean("open_gifts", true); + lastFragment.presentFragment(new ProfileActivity(args)); + } + }); + } tableView.addRowUser(getString(R.string.StarGiveawayPrizeTo), currentAccount, did, () -> { sheet[0].dismiss(); final BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); @@ -3520,7 +3635,7 @@ public boolean validateGroupId(long groupId) { lastFragment.presentFragment(ChatActivity.of(did)); } } - }, !UserObject.isDeleted(didUser) ? getString(R.string.Gift2ButtonSendGift) : null, () -> { + }, didUser != null && !UserObject.isDeleted(didUser) ? getString(R.string.Gift2ButtonSendGift) : null, () -> { new GiftSheet(context, currentAccount, did, sheet[0]::dismiss).show(); }); } @@ -3746,29 +3861,9 @@ public void updateDrawState(@NonNull TextPaint ds) { } if (!TextUtils.isEmpty(transaction.id) && !giveaway) { - FrameLayout idLayout = new FrameLayout(context); - idLayout.setPadding(dp(12.66f), dp(9.33f), dp(10.66f), dp(9.33f)); - textView = new TextView(context); - textView.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MONO)); - textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, transaction.id.length() > 25 ? 9 : 10); - textView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack, resourcesProvider)); - textView.setMaxLines(4); - textView.setSingleLine(false); - textView.setText(transaction.id); - idLayout.addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL, 0, 0, 34, 0)); - ImageView copyView = new ImageView(context); - copyView.setImageResource(R.drawable.msg_copy); - copyView.setScaleType(ImageView.ScaleType.CENTER); - copyView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteBlueIcon, resourcesProvider), PorterDuff.Mode.SRC_IN)); - copyView.setOnClickListener(v -> { - AndroidUtilities.addToClipboard(transaction.id); + tableView.addRowMonospaced(getString(R.string.StarsTransactionID), transaction.id, transaction.id.length() > 25 ? 9 : 10, () -> { BulletinFactory.of(sheet[0].topBulletinContainer, resourcesProvider).createSimpleBulletin(R.raw.copy, getString(R.string.StarsTransactionIDCopied)).show(false); }); - ScaleStateListAnimator.apply(copyView); - copyView.setBackground(Theme.createSelectorDrawable(Theme.multAlpha(Theme.getColor(Theme.key_windowBackgroundWhiteBlueIcon, resourcesProvider), .10f), Theme.RIPPLE_MASK_ROUNDRECT_6DP)); - idLayout.addView(copyView, LayoutHelper.createFrame(30, 30, Gravity.RIGHT | Gravity.CENTER_VERTICAL)); - - tableView.addRowUnpadded(getString(R.string.StarsTransactionID), idLayout); } if (transaction.floodskip && transaction.floodskip_number > 0) { @@ -4499,7 +4594,7 @@ public void afterTextChanged(Editable s) { button.setOnClickListener(v -> { if (loading[0]) return; if (whenDone != null) { - String s = editText.getText().toString(); + final String s = editText.getText().toString(); button.setLoading(loading[0] = true); whenDone.run(TextUtils.isEmpty(s) ? 0 : Long.parseLong(s), () -> { AndroidUtilities.hideKeyboard(editText); @@ -4547,567 +4642,28 @@ public void afterTextChanged(Editable s) { return sheet[0]; } - public static void setGiftImage(ImageReceiver imageReceiver, TL_stars.StarGift gift, int size) { - if (gift == null || gift.sticker == null) { + public static void setGiftImage(ImageReceiver imageReceiver, TLRPC.Document document, int size) { + if (document == null) { imageReceiver.clearImage(); return; } - - final TLRPC.PhotoSize photoSize = FileLoader.getClosestPhotoSizeWithSize(gift.sticker.thumbs, size); - final SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(gift.sticker.thumbs, Theme.key_windowBackgroundGray, 0.35f); + final TLRPC.PhotoSize photoSize = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, size); + final SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(document.thumbs, Theme.key_windowBackgroundGray, 0.35f); imageReceiver.setImage( - ImageLocation.getForDocument(gift.sticker), + ImageLocation.getForDocument(document), size + "_" + size, - ImageLocation.getForDocument(photoSize, gift.sticker), + ImageLocation.getForDocument(photoSize, document), size + "_" + size, svgThumb, 0, null, - gift, + null, 0 ); } - public static BottomSheet showActionGiftSheet(Context context, int currentAccount, long dialogId, boolean out, int date, int msg_id, TLRPC.TL_messageActionStarGift action, Theme.ResourcesProvider resourcesProvider) { - if (action == null || context == null) - return null; - - final TL_stars.StarGift gift = action.gift; - if (gift == null) - return null; - - BottomSheet.Builder b = new BottomSheet.Builder(context, false, resourcesProvider); - BottomSheet[] sheet = new BottomSheet[1]; - - LinearLayout linearLayout = new LinearLayout(context); - linearLayout.setOrientation(LinearLayout.VERTICAL); - linearLayout.setPadding(dp(16), dp(20), dp(16), dp(8)); - linearLayout.setClipChildren(false); - linearLayout.setClipToPadding(false); - - BackupImageView imageView = new BackupImageView(context); - setGiftImage(imageView.getImageReceiver(), gift, 160); - linearLayout.addView(imageView, LayoutHelper.createLinear(160, 160, Gravity.CENTER, 0, -8, 0, 10)); - - TextView textView = new TextView(context); - textView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack, resourcesProvider)); - textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); - textView.setTypeface(AndroidUtilities.bold()); - textView.setGravity(Gravity.CENTER); - textView.setText(getString(out ? R.string.Gift2TitleSent : R.string.Gift2TitleReceived)); - linearLayout.addView(textView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 20, 0, 20, 4)); - - final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(dialogId); - final boolean fromBot = UserObject.isBot(user); - - textView = new LinkSpanDrawable.LinksTextView(context, resourcesProvider); - textView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack, resourcesProvider)); - textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); - textView.setGravity(Gravity.CENTER); - textView.setLinkTextColor(Theme.getColor(Theme.key_chat_messageLinkIn, resourcesProvider)); - textView.setLineSpacing(dp(2), 1f); - ((LinkSpanDrawable.LinksTextView) textView).setDisablePaddingsOffsetY(true); - final int within = MessagesController.getInstance(currentAccount).stargiftsConvertPeriodMax - (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - date); - final int withinDays = Math.max(1, within / (60 * 60 * 24)); - textView.setText(TextUtils.concat( - AndroidUtilities.replaceTags(fromBot ? ( - action.saved ? LocaleController.getString(R.string.Gift2Info2BotRemove) : LocaleController.getString(R.string.Gift2Info2BotKeep) - ) : out ? - action.saved && !action.converted ? formatString(R.string.Gift2InfoOutPinned, UserObject.getForcedFirstName(user)) : formatPluralStringComma(action.converted ? "Gift2InfoOutConverted" : "Gift2InfoOut", (int) action.convert_stars, UserObject.getForcedFirstName(user)) : - action.converted ? formatPluralStringComma("Gift2InfoConverted", (int) action.convert_stars) : formatPluralStringComma("Gift2Info", (int) action.convert_stars) - ), - " ", - AndroidUtilities.replaceArrows(AndroidUtilities.replaceSingleTag(getString(R.string.Gift2More).replace(' ', ' '), () -> { - new ExplainStarsSheet(context).show(); - }), true) - )); - linearLayout.addView(textView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 5, 5, 5, 4)); - - if (action.name_hidden) { - textView = new TextView(context); - textView.setTextColor(Theme.getColor(Theme.key_dialogTextGray2, resourcesProvider)); - textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); - textView.setGravity(Gravity.CENTER); - textView.setText(getString(R.string.Gift2SenderHidden)); - linearLayout.addView(textView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 20, 13, 20, 2)); - } - - TableView tableView = new TableView(context, resourcesProvider); - final long selfId = UserConfig.getInstance(currentAccount).getClientUserId(); - final long fromId = out ? selfId : dialogId; - final long toId = out ? dialogId : selfId; - final TLRPC.User fromUser = MessagesController.getInstance(currentAccount).getUser(fromId); - if (fromId != selfId) { - tableView.addRowUser(getString(R.string.Gift2From), currentAccount, fromId, () -> { - sheet[0].dismiss(); - final BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); - if (lastFragment != null) { - if (UserObject.isService(fromId)) return; - Bundle args = new Bundle(); - if (fromId > 0) { - args.putLong("user_id", fromId); - if (fromId == selfId) { - args.putBoolean("my_profile", true); - args.putBoolean("open_gifts", true); - } - } else { - args.putLong("chat_id", -fromId); - } - lastFragment.presentFragment(new ProfileActivity(args)); - } - }, fromId != selfId && fromId != UserObject.ANONYMOUS && !UserObject.isDeleted(fromUser) && !fromBot ? getString(R.string.Gift2ButtonSendGift) : null, () -> { - new GiftSheet(context, currentAccount, fromId, sheet[0]::dismiss).show(); - }); - } - if (toId != selfId) { - tableView.addRowUser(getString(R.string.Gift2To), currentAccount, toId, () -> { - sheet[0].dismiss(); - final BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); - if (lastFragment != null) { - if (UserObject.isService(toId)) return; - Bundle args = new Bundle(); - if (toId > 0) { - args.putLong("user_id", toId); - if (toId == selfId) { - args.putBoolean("my_profile", true); - args.putBoolean("open_gifts", true); - } - } else { - args.putLong("chat_id", -toId); - } - lastFragment.presentFragment(new ProfileActivity(args)); - } - }, null, () -> { - new GiftSheet(context, currentAccount, toId, sheet[0]::dismiss).show(); - }); - } - tableView.addRowDateTime(getString(R.string.StarsTransactionDate), date); - Runnable convert = null; - if (!out && !action.converted && action.convert_stars > 0 && within > 0) { - convert = () -> { - new AlertDialog.Builder(context, resourcesProvider) - .setTitle(getString(R.string.Gift2ConvertTitle)) - .setMessage(AndroidUtilities.replaceTags(formatPluralString("Gift2ConvertText2", withinDays, UserObject.getForcedFirstName(user), formatPluralStringComma("Gift2ConvertStars", (int) action.convert_stars)))) - .setPositiveButton(getString(R.string.Gift2ConvertButton), (di, w) -> { - final AlertDialog progressDialog = new AlertDialog(ApplicationLoader.applicationContext, AlertDialog.ALERT_TYPE_SPINNER); - progressDialog.showDelayed(500); - TL_stars.convertStarGift req = new TL_stars.convertStarGift(); - req.msg_id = msg_id; - req.user_id = MessagesController.getInstance(currentAccount).getInputUser(dialogId); - ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { - progressDialog.dismissUnless(400); - BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); - if (lastFragment == null) return; - if (res instanceof TLRPC.TL_boolTrue) { - sheet[0].dismiss(); - StarsController.getInstance(currentAccount).invalidateProfileGifts(dialogId); - final TLRPC.UserFull userFull = MessagesController.getInstance(currentAccount).getUserFull(selfId); - if (userFull != null) { - userFull.stargifts_count = Math.max(0, userFull.stargifts_count - 1); - if (userFull.stargifts_count <= 0) { - userFull.flags2 &=~ 256; - } - } - StarsController.getInstance(currentAccount).invalidateBalance(); - StarsController.getInstance(currentAccount).invalidateTransactions(true); - if (!(lastFragment instanceof StarsIntroActivity)) { - final StarsIntroActivity fragment = new StarsIntroActivity(); - fragment.whenFullyVisible(() -> { - BulletinFactory.of(fragment) - .createSimpleBulletin( - R.raw.stars_topup, - LocaleController.getString(R.string.Gift2ConvertedTitle), - LocaleController.formatPluralStringComma("Gift2Converted", (int) action.convert_stars) - ) - .show(true); - }); - lastFragment.presentFragment(fragment); - } else { - BulletinFactory.of(lastFragment) - .createSimpleBulletin( - R.raw.stars_topup, - LocaleController.getString(R.string.Gift2ConvertedTitle), - LocaleController.formatPluralStringComma("Gift2Converted", (int) action.convert_stars) - ) - .show(true); - } - } else if (err != null) { - BulletinFactory.of(sheet[0].topBulletinContainer, resourcesProvider).createErrorBulletin(formatString(R.string.UnknownErrorCode, err.text)).show(false); - } else { - BulletinFactory.of(sheet[0].topBulletinContainer, resourcesProvider).createErrorBulletin(getString(R.string.UnknownError)).show(false); - } - })); - }) - .setNegativeButton(getString(R.string.Cancel), null) - .show(); - }; - } - tableView.addRow(getString(R.string.Gift2Value), replaceStarsWithPlain(TextUtils.concat("⭐️ " + LocaleController.formatNumber(gift.stars, ','), " ", convert == null ? "" : ButtonSpan.make(formatPluralStringComma("Gift2ButtonSell", (int) action.convert_stars), convert, resourcesProvider)), .8f)); - final ButtonWithCounterView button1 = new ButtonWithCounterView(context, resourcesProvider); - final Runnable toggleShow = () -> { - if (button1.isLoading()) return; - button1.setLoading(true); - - TL_stars.saveStarGift req = new TL_stars.saveStarGift(); - final boolean unsave = req.unsave = action.saved; - req.msg_id = msg_id; - req.user_id = MessagesController.getInstance(currentAccount).getInputUser(dialogId); - ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { - BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); - if (lastFragment == null) return; - if (res instanceof TLRPC.TL_boolTrue) { - sheet[0].dismiss(); - StarsController.getInstance(currentAccount).invalidateProfileGifts(selfId); - BulletinFactory.of(lastFragment) - .createEmojiBulletin( - gift.sticker, - LocaleController.getString(unsave ? R.string.Gift2MadePrivateTitle : R.string.Gift2MadePublicTitle), - AndroidUtilities.replaceSingleTag(LocaleController.getString(unsave ? R.string.Gift2MadePrivate : R.string.Gift2MadePublic), lastFragment instanceof ProfileActivity ? null : () -> { - final Bundle args = new Bundle(); - args.putLong("user_id", UserConfig.getInstance(currentAccount).getClientUserId()); - args.putBoolean("my_profile", true); - args.putBoolean("open_gifts", true); - final ProfileActivity profileActivity = new ProfileActivity(args); - lastFragment.presentFragment(profileActivity); - }) - ) - .show(true); - } else if (err != null) { - BulletinFactory.of(sheet[0].topBulletinContainer, resourcesProvider).createErrorBulletin(formatString(R.string.UnknownErrorCode, err.text)).show(false); - } - })); - }; - if (!out && !action.converted) { - tableView.addRow(getString(R.string.Gift2Visibility), getString(action.saved ? R.string.Gift2Visible : R.string.Gift2Invisible), getString(action.saved ? R.string.Gift2VisibleHide : R.string.Gift2InvisibleShow), toggleShow); - } - - if (gift.limited) { - addAvailabilityRow(tableView, currentAccount, gift, resourcesProvider); - } - if (action.message != null && !TextUtils.isEmpty(action.message.text)) { - tableView.addFullRow(action.message.text, action.message.entities); - } - linearLayout.addView(tableView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 17, 0, 12)); - - if (!out && !action.converted) { - textView = new LinkSpanDrawable.LinksTextView(context, resourcesProvider); - textView.setTextColor(Theme.getColor(Theme.key_dialogTextGray2, resourcesProvider)); - textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); - textView.setGravity(Gravity.CENTER); - textView.setLineSpacing(dp(2), 1f); - textView.setLinkTextColor(Theme.getColor(Theme.key_chat_messageLinkIn, resourcesProvider)); - ((LinkSpanDrawable.LinksTextView) textView).setDisablePaddingsOffsetY(true); - textView.setText(AndroidUtilities.replaceArrows(AndroidUtilities.replaceSingleTag(getString(action.saved ? R.string.Gift2ProfileVisible2 : R.string.Gift2ProfileInvisible), () -> { - BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); - if (lastFragment == null) return; - sheet[0].dismiss(); - if (!(lastFragment instanceof ProfileActivity && ((ProfileActivity) lastFragment).myProfile)) { - final Bundle args = new Bundle(); - args.putLong("user_id", selfId); - args.putBoolean("my_profile", true); - args.putBoolean("open_gifts", true); - lastFragment.presentFragment(new ProfileActivity(args)); - } - }), true, dp(8f / 3f), dp(.66f))); - linearLayout.addView(textView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 5, 6, 5, 16)); - } - -// if (out || action.converted) { - button1.setText(getString(R.string.OK), false); - linearLayout.addView(button1, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48)); - - b.setCustomView(linearLayout); - sheet[0] = b.create(); - sheet[0].useBackgroundTopPadding = false; - - button1.setOnClickListener(v -> { - sheet[0].dismiss(); - }); - - sheet[0].fixNavigationBar(); - BaseFragment fragment = LaunchActivity.getSafeLastFragment(); - if (!AndroidUtilities.isTablet() && !AndroidUtilities.hasDialogOnTop(fragment)) { - sheet[0].makeAttached(fragment); - } - sheet[0].show(); - return sheet[0]; -// } else { -// button1.setText(getString(action.saved ? R.string.Gift2ProfileMakeInvisible : R.string.Gift2ProfileMakeVisible), false); -// linearLayout.addView(button1, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48, 0, 0, 0, 4)); -// -// button1.setOnClickListener(v -> toggleShow.run()); -// -// b.setCustomView(linearLayout); -// sheet[0] = b.create(); -// sheet[0].useBackgroundTopPadding = false; -// -// sheet[0].fixNavigationBar(); -// BaseFragment fragment = LaunchActivity.getSafeLastFragment(); -// if (!AndroidUtilities.isTablet() && !AndroidUtilities.hasDialogOnTop(fragment)) { -// sheet[0].makeAttached(fragment); -// } -// sheet[0].show(); -// return sheet[0]; -// } - } - - public static BottomSheet showGiftSheet(Context context, int currentAccount, long dialogId, boolean myProfile, TL_stars.UserStarGift userGift, Theme.ResourcesProvider resourcesProvider) { - if (userGift == null || context == null) - return null; - - final TL_stars.StarGift gift = userGift.gift; - if (gift == null) - return null; - - final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(dialogId); - final boolean fromBot = UserObject.isBot(MessagesController.getInstance(currentAccount).getUser(userGift.from_id)); - - BottomSheet.Builder b = new BottomSheet.Builder(context, false, resourcesProvider); - BottomSheet[] sheet = new BottomSheet[1]; - - LinearLayout linearLayout = new LinearLayout(context); - linearLayout.setOrientation(LinearLayout.VERTICAL); - linearLayout.setPadding(dp(16), dp(20), dp(16), dp(8)); - linearLayout.setClipChildren(false); - linearLayout.setClipToPadding(false); - - BackupImageView imageView = new BackupImageView(context); - setGiftImage(imageView.getImageReceiver(), gift, 160); - linearLayout.addView(imageView, LayoutHelper.createLinear(160, 160, Gravity.CENTER, 0, -8, 0, 10)); - - TextView textView = new TextView(context); - textView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack, resourcesProvider)); - textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); - textView.setTypeface(AndroidUtilities.bold()); - textView.setGravity(Gravity.CENTER); - textView.setText(getString(myProfile ? R.string.Gift2TitleReceived : R.string.Gift2TitleProfile)); - linearLayout.addView(textView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 20, 0, 20, 9)); - - if (!fromBot) { - textView = new TextView(context); - textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); - textView.setTypeface(AndroidUtilities.bold()); - textView.setGravity(Gravity.CENTER); - textView.setTextColor(Theme.getColor(Theme.key_color_green, resourcesProvider)); - textView.setText(replaceStarsWithPlain(LocaleController.formatNumber((int) Math.abs(Math.max(userGift.gift.convert_stars, userGift.convert_stars)), ' ') + " ⭐️", .8f)); - linearLayout.addView(textView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 20, 0, 20, 4)); - } - - int within = 0; - if (myProfile) { - textView = new LinkSpanDrawable.LinksTextView(context, resourcesProvider); - textView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack, resourcesProvider)); - textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); - textView.setGravity(Gravity.CENTER); - textView.setLinkTextColor(Theme.getColor(Theme.key_chat_messageLinkIn, resourcesProvider)); - textView.setLineSpacing(dp(2), 1f); - ((LinkSpanDrawable.LinksTextView) textView).setDisablePaddingsOffsetY(true); - within = MessagesController.getInstance(currentAccount).stargiftsConvertPeriodMax - (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - userGift.date); - textView.setText(TextUtils.concat( - AndroidUtilities.replaceTags(fromBot ? ( - userGift.unsaved ? LocaleController.getString(R.string.Gift2Info2BotKeep) : LocaleController.getString(R.string.Gift2Info2BotRemove) - ) : myProfile ? - within <= 0 ? formatPluralStringComma("Gift2Info2Expired", (int) userGift.convert_stars) : formatPluralStringComma("Gift2Info", (int) userGift.convert_stars) : - formatPluralStringComma("Gift2Info2Out", (int) userGift.convert_stars, UserObject.getForcedFirstName(user)) - ), - " ", - AndroidUtilities.replaceArrows(AndroidUtilities.replaceSingleTag(getString(R.string.Gift2More).replace(' ', ' '), () -> { - new ExplainStarsSheet(context).show(); - }), true) - )); - linearLayout.addView(textView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 5, 5, 5, 4)); - } - int withinDays = Math.max(1, within / (60 * 60 * 24)); - - TableView tableView = new TableView(context, resourcesProvider); - final long selfId = UserConfig.getInstance(currentAccount).getClientUserId(); - final long fromId = (userGift.flags & 2) != 0 && !userGift.name_hidden ? userGift.from_id : UserObject.ANONYMOUS; - final TLRPC.User fromUser = MessagesController.getInstance(currentAccount).getUser(fromId); - tableView.addRowUser(getString(R.string.Gift2From), currentAccount, fromId, () -> { - sheet[0].dismiss(); - final BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); - if (lastFragment != null) { - if (UserObject.isService(fromId)) return; - if ((userGift.flags & 8) != 0) { - lastFragment.presentFragment(ChatActivity.of(fromId, userGift.msg_id)); - } else { - Bundle args = new Bundle(); - if (fromId > 0) { - args.putLong("user_id", fromId); - if (fromId == selfId) { - args.putBoolean("my_profile", true); - args.putBoolean("open_gifts", true); - } - } else { - args.putLong("chat_id", -fromId); - } - lastFragment.presentFragment(new ProfileActivity(args)); - } - } - }, fromId != selfId && fromId != UserObject.ANONYMOUS && !fromBot && !UserObject.isDeleted(fromUser) ? getString(R.string.Gift2ButtonSendGift) : null, () -> { - new GiftSheet(context, currentAccount, fromId, sheet[0]::dismiss).show(); - }); - tableView.addRow(getString(R.string.StarsTransactionDate), LocaleController.formatString(R.string.formatDateAtTime, LocaleController.getInstance().getFormatterGiveawayCard().format(new Date(userGift.date * 1000L)), LocaleController.getInstance().getFormatterDay().format(new Date(userGift.date * 1000L)))); - Runnable convert = null; - if (myProfile && (userGift.flags & 8) != 0 && (userGift.flags & 16) != 0 && (userGift.flags & 2) != 0 && within > 0) { - convert = () -> { - new AlertDialog.Builder(context, resourcesProvider) - .setTitle(getString(R.string.Gift2ConvertTitle)) - .setMessage(AndroidUtilities.replaceTags(formatPluralString("Gift2ConvertText2", withinDays, fromUser == null || UserObject.isService(fromId) ? getString(R.string.StarsTransactionHidden) : UserObject.getForcedFirstName(fromUser), formatPluralStringComma("Gift2ConvertStars", (int) userGift.convert_stars)))) - .setPositiveButton(getString(R.string.Gift2ConvertButton), (di, w) -> { - final AlertDialog progressDialog = new AlertDialog(ApplicationLoader.applicationContext, AlertDialog.ALERT_TYPE_SPINNER); - progressDialog.showDelayed(500); - TL_stars.convertStarGift req = new TL_stars.convertStarGift(); - req.msg_id = userGift.msg_id; - req.user_id = MessagesController.getInstance(currentAccount).getInputUser(userGift.from_id); - ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { - progressDialog.dismissUnless(400); - BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); - if (lastFragment == null) return; - if (res instanceof TLRPC.TL_boolTrue) { - sheet[0].dismiss(); - StarsController.getInstance(currentAccount).invalidateProfileGifts(dialogId); - final TLRPC.UserFull userFull = MessagesController.getInstance(currentAccount).getUserFull(selfId); - if (userFull != null) { - userFull.stargifts_count = Math.max(0, userFull.stargifts_count - 1); - if (userFull.stargifts_count <= 0) { - userFull.flags2 &=~ 256; - } - } - StarsController.getInstance(currentAccount).invalidateBalance(); - StarsController.getInstance(currentAccount).invalidateTransactions(true); - if (!(lastFragment instanceof StarsIntroActivity)) { - final StarsIntroActivity fragment = new StarsIntroActivity(); - fragment.whenFullyVisible(() -> { - BulletinFactory.of(fragment) - .createSimpleBulletin( - R.raw.stars_topup, - LocaleController.getString(R.string.Gift2ConvertedTitle), - LocaleController.formatPluralStringComma("Gift2Converted", (int) userGift.convert_stars) - ) - .show(true); - }); - lastFragment.presentFragment(fragment); - } else { - BulletinFactory.of(lastFragment) - .createSimpleBulletin( - R.raw.stars_topup, - LocaleController.getString(R.string.Gift2ConvertedTitle), - LocaleController.formatPluralStringComma("Gift2Converted", (int) userGift.convert_stars) - ) - .show(true); - } - } else if (err != null) { - BulletinFactory.of(sheet[0].topBulletinContainer, resourcesProvider).createErrorBulletin(formatString(R.string.UnknownErrorCode, err.text)).show(false); - } else { - BulletinFactory.of(sheet[0].topBulletinContainer, resourcesProvider).createErrorBulletin(getString(R.string.UnknownError)).show(false); - } - })); - }) - .setNegativeButton(getString(R.string.Cancel), null) - .show(); - }; - } - tableView.addRow(getString(R.string.Gift2Value), replaceStarsWithPlain(TextUtils.concat("⭐️ " + LocaleController.formatNumber(gift.stars, ','), " ", convert == null ? "" : ButtonSpan.make(formatPluralStringComma("Gift2ButtonSell", (int) userGift.convert_stars), convert, resourcesProvider)), .8f)); - if (gift.limited) { - addAvailabilityRow(tableView, currentAccount, gift, resourcesProvider); - } - final ButtonWithCounterView button1 = new ButtonWithCounterView(context, resourcesProvider); - final Runnable toggleShow = () -> { - if (button1.isLoading()) return; - button1.setLoading(true); - - TL_stars.saveStarGift req = new TL_stars.saveStarGift(); - final boolean unsave = req.unsave = !userGift.unsaved; - req.msg_id = userGift.msg_id; - req.user_id = MessagesController.getInstance(currentAccount).getInputUser(userGift.from_id); - ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { - BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); - if (lastFragment == null) return; - if (res instanceof TLRPC.TL_boolTrue) { - sheet[0].dismiss(); - StarsController.getInstance(currentAccount).invalidateProfileGifts(selfId); - BulletinFactory.of(lastFragment) - .createEmojiBulletin( - gift.sticker, - LocaleController.getString(unsave ? R.string.Gift2MadePrivateTitle : R.string.Gift2MadePublicTitle), - AndroidUtilities.replaceSingleTag(LocaleController.getString(unsave ? R.string.Gift2MadePrivate : R.string.Gift2MadePublic), lastFragment instanceof ProfileActivity ? null : () -> { - final Bundle args = new Bundle(); - args.putLong("user_id", UserConfig.getInstance(currentAccount).getClientUserId()); - args.putBoolean("my_profile", true); - args.putBoolean("open_gifts", true); - final ProfileActivity profileActivity = new ProfileActivity(args); - lastFragment.presentFragment(profileActivity); - }) - ) - .show(true); - } else if (err != null) { - BulletinFactory.of(sheet[0].topBulletinContainer, resourcesProvider).createErrorBulletin(formatString(R.string.UnknownErrorCode, err.text)).show(false); - } else { - BulletinFactory.of(sheet[0].topBulletinContainer, resourcesProvider).createErrorBulletin(getString(R.string.UnknownError)).show(false); - } - button1.setLoading(false); - })); - }; - if (myProfile && (userGift.flags & 8) != 0 && (userGift.flags & 2) != 0) { - tableView.addRow(getString(R.string.Gift2Visibility), getString(!userGift.unsaved ? R.string.Gift2Visible : R.string.Gift2Invisible), getString(!userGift.unsaved ? R.string.Gift2VisibleHide : R.string.Gift2InvisibleShow), toggleShow); - } - - if (userGift.message != null && !TextUtils.isEmpty(userGift.message.text)) { - tableView.addFullRow(userGift.message.text, userGift.message.entities); - } - linearLayout.addView(tableView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 17, 0, 12)); - - if (dialogId == UserConfig.getInstance(currentAccount).getClientUserId()) { - textView = new LinkSpanDrawable.LinksTextView(context, resourcesProvider); - textView.setTextColor(Theme.getColor(Theme.key_dialogTextGray2, resourcesProvider)); - textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); - textView.setGravity(Gravity.CENTER); - textView.setLineSpacing(dp(2), 1f); - textView.setLinkTextColor(Theme.getColor(Theme.key_chat_messageLinkIn, resourcesProvider)); - ((LinkSpanDrawable.LinksTextView) textView).setDisablePaddingsOffsetY(true); - textView.setText(getString(!userGift.unsaved ? R.string.Gift2ProfileVisible : R.string.Gift2ProfileInvisible)); - linearLayout.addView(textView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 5, 6, 5, 16)); - } - -// if (!myProfile || (userGift.flags & 8) == 0 || (userGift.flags & 2) == 0) { - ButtonWithCounterView button = new ButtonWithCounterView(context, resourcesProvider); - button.setText(getString(R.string.OK), false); - linearLayout.addView(button, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48)); - - b.setCustomView(linearLayout); - sheet[0] = b.create(); - sheet[0].useBackgroundTopPadding = false; - - button.setOnClickListener(v -> { - sheet[0].dismiss(); - }); - - sheet[0].fixNavigationBar(); - BaseFragment fragment = LaunchActivity.getSafeLastFragment(); - if (!AndroidUtilities.isTablet() && !AndroidUtilities.hasDialogOnTop(fragment)) { - sheet[0].makeAttached(fragment); - } - sheet[0].show(); - return sheet[0]; -// } else { -// button1.setText(getString(!userGift.unsaved ? R.string.Gift2ProfileMakeInvisible : R.string.Gift2ProfileMakeVisible), false); -// linearLayout.addView(button1, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48, 0, 0, 0, 4)); -// -// button1.setOnClickListener(v -> toggleShow.run()); -// -// b.setCustomView(linearLayout); -// sheet[0] = b.create(); -// sheet[0].useBackgroundTopPadding = false; -// -// sheet[0].fixNavigationBar(); -// BaseFragment fragment = LaunchActivity.getSafeLastFragment(); -// if (!AndroidUtilities.isTablet() && !AndroidUtilities.hasDialogOnTop(fragment)) { -// sheet[0].makeAttached(fragment); -// } -// sheet[0].show(); -// return sheet[0]; -// } + public static void setGiftImage(ImageReceiver imageReceiver, TL_stars.StarGift gift, int size) { + setGiftImage(imageReceiver, gift == null ? null : gift.getDocument(), size); } public static BottomSheet showSoldOutGiftSheet(Context context, int currentAccount, TL_stars.StarGift gift, Theme.ResourcesProvider resourcesProvider) { @@ -5184,21 +4740,68 @@ public static void addAvailabilityRow(TableView tableView, int currentAccount, T final SpannableStringBuilder sb = new SpannableStringBuilder("x "); final LoadingSpan span = new LoadingSpan(rowTextView, dp(90), 0, resourcesProvider); span.setColors( - Theme.multAlpha(rowTextView.getPaint().getColor(), .21f), - Theme.multAlpha(rowTextView.getPaint().getColor(), .08f) + Theme.multAlpha(rowTextView.getPaint().getColor(), .21f), + Theme.multAlpha(rowTextView.getPaint().getColor(), .08f) ); sb.setSpan(span, 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); rowTextView.setText(sb, TextView.BufferType.SPANNABLE); if (!gift.sold_out) { StarsController.getInstance(currentAccount).getStarGift(gift.id, remoteGift -> { if (remoteGift == null) return; - rowTextView.setText(remoteGift.availability_remains <= 0 ? formatPluralStringComma("Gift2Availability2ValueNone", remoteGift.availability_total) : formatPluralStringComma("Gift2Availability4Value", remoteGift.availability_remains, LocaleController.formatNumber(remoteGift.availability_total, ','))); + if (remoteGift instanceof TL_stars.TL_starGiftUnique) { + rowTextView.setText(remoteGift.availability_remains <= 0 ? formatPluralStringComma("Gift2QuantityIssuedNone", remoteGift.availability_total) : formatPluralStringComma("Gift2QuantityIssued1", remoteGift.availability_issued) + formatPluralStringComma("Gift2QuantityIssued2", remoteGift.availability_total)); + } else { + rowTextView.setText(remoteGift.availability_remains <= 0 ? formatPluralStringComma("Gift2Availability2ValueNone", remoteGift.availability_total) : formatPluralStringComma("Gift2Availability4Value", remoteGift.availability_remains, LocaleController.formatNumber(remoteGift.availability_total, ','))); + } }); } else { - rowTextView.setText(gift.availability_remains <= 0 ? formatPluralStringComma("Gift2Availability2ValueNone", gift.availability_total) : formatPluralStringComma("Gift2Availability4Value", gift.availability_remains, LocaleController.formatNumber(gift.availability_total, ','))); + if (gift instanceof TL_stars.TL_starGiftUnique) { + rowTextView.setText(gift.availability_remains <= 0 ? formatPluralStringComma("Gift2QuantityIssuedNone", gift.availability_total) : formatPluralStringComma("Gift2QuantityIssued1", gift.availability_issued) + formatPluralStringComma("Gift2QuantityIssued2", gift.availability_total)); + } else { + rowTextView.setText(gift.availability_remains <= 0 ? formatPluralStringComma("Gift2Availability2ValueNone", gift.availability_total) : formatPluralStringComma("Gift2Availability4Value", gift.availability_remains, LocaleController.formatNumber(gift.availability_total, ','))); + } } } + public static void addStatusRow(TableView tableView, int currentAccount, long user_id, int msg_id, Theme.ResourcesProvider resourcesProvider, Runnable openUpgrade) { + final TableRow row = tableView.addRow(getString(R.string.Gift2Status), ""); + final TextView rowTextView = (TextView) ((TableView.TableRowContent) row.getChildAt(1)).getChildAt(0); + final SpannableStringBuilder sb = new SpannableStringBuilder("x "); + final LoadingSpan span = new LoadingSpan(rowTextView, dp(90), 0, resourcesProvider); + span.setColors( + Theme.multAlpha(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText, resourcesProvider), .21f), + Theme.multAlpha(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText, resourcesProvider), .08f) + ); + sb.setSpan(span, 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + rowTextView.setText(sb, TextView.BufferType.SPANNABLE); + + TLRPC.TL_messages_getMessages req = new TLRPC.TL_messages_getMessages(); + req.id.add(msg_id); + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> { + TLRPC.TL_messageActionStarGift action = null; + if (res instanceof TLRPC.messages_Messages) { + TLRPC.messages_Messages messages = (TLRPC.messages_Messages) res; + for (int i = 0; i < messages.messages.size(); ++i) { + TLRPC.Message msg = messages.messages.get(i); + if (msg != null && msg.action instanceof TLRPC.TL_messageActionStarGift) { + action = (TLRPC.TL_messageActionStarGift) msg.action; + break; + } + } + } + + if (action != null && action.can_upgrade) { + SpannableStringBuilder ssb = new SpannableStringBuilder(); + ssb.append(getString(R.string.Gift2StatusNonUnique)); + ssb.append(" "); + ssb.append(ButtonSpan.make(getString(R.string.Gift2StatusUpgrade), openUpgrade)); + rowTextView.setText(ssb); + } else { + rowTextView.setText(getString(R.string.Gift2StatusNonUnique)); + } + }); + } + private static DecimalFormat floatFormat; public static CharSequence formatStarsAmount(TL_stars.StarsAmount starsAmount) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarsReactionsSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarsReactionsSheet.java index 76f0d4183f..c56b1fab40 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarsReactionsSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stars/StarsReactionsSheet.java @@ -4,6 +4,7 @@ import static org.telegram.messenger.AndroidUtilities.lerp; import static org.telegram.messenger.AndroidUtilities.rectTmp; import static org.telegram.messenger.LocaleController.getString; +import static org.telegram.ui.ActionBar.Theme.key_dialogBackgroundGray; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -32,6 +33,7 @@ import android.view.ViewConfiguration; import android.view.animation.Interpolator; import android.widget.FrameLayout; +import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; @@ -43,6 +45,7 @@ import org.checkerframework.checker.units.qual.A; import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.ChatObject; import org.telegram.messenger.DialogObject; import org.telegram.messenger.ImageReceiver; import org.telegram.messenger.LocaleController; @@ -56,20 +59,24 @@ import org.telegram.messenger.Utilities; import org.telegram.messenger.browser.Browser; import org.telegram.tgnet.ConnectionsManager; +import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.BottomSheet; import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.Cells.ChatActionCell; import org.telegram.ui.Cells.ChatMessageCell; import org.telegram.ui.ChatActivity; import org.telegram.ui.Components.AnimatedFloat; import org.telegram.ui.Components.AnimatedTextView; import org.telegram.ui.Components.AvatarDrawable; +import org.telegram.ui.Components.BackupImageView; import org.telegram.ui.Components.ButtonBounce; import org.telegram.ui.Components.CheckBox2; import org.telegram.ui.Components.ColoredImageSpan; import org.telegram.ui.Components.CubicBezierInterpolator; +import org.telegram.ui.Components.ItemOptions; import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.LinkSpanDrawable; import org.telegram.ui.Components.Premium.GLIcon.GLIconRenderer; @@ -92,9 +99,16 @@ public class StarsReactionsSheet extends BottomSheet { private final Theme.ResourcesProvider resourcesProvider; private final int currentAccount; + private long selectedDialogId; + private final LinearLayout layout; private final FrameLayout topLayout; private final StarsSlider slider; +// private final FrameLayout dialogSelectorLayout; +// private final FrameLayout dialogSelectorInnerLayout; +// private final AvatarDrawable dialogAvatarDrawable; +// private final BackupImageView dialogImageView; +// private final ImageView dialogSelectorIconView; private final TextView titleView; private final StarsIntroActivity.StarsBalanceView balanceView; private final TextView statusView; @@ -131,6 +145,7 @@ public StarsReactionsSheet( this.currentAccount = currentAccount; this.messageObject = messageObject; this.reactors = reactors; + this.selectedDialogId = UserConfig.getInstance(currentAccount).getClientUserId(); TLRPC.MessageReactor me = null; final long selfId = UserConfig.getInstance(currentAccount).getClientUserId(); @@ -183,6 +198,71 @@ public void onValueChanged(int value) { topLayout.addView(slider, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); } + LinearLayout toptopLayout = new LinearLayout(context); + toptopLayout.setOrientation(LinearLayout.HORIZONTAL); + topLayout.addView(toptopLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.FILL_HORIZONTAL, 0, 0, 0, 0)); + + balanceView = new StarsIntroActivity.StarsBalanceView(context, currentAccount); + balanceView.setDialogId(selectedDialogId); + +// dialogSelectorLayout = new FrameLayout(context); +// dialogSelectorInnerLayout = new FrameLayout(context); +// dialogSelectorInnerLayout.setBackground(Theme.createRoundRectDrawable(dp(14), Theme.getColor(Theme.key_dialogBackgroundGray, resourcesProvider))); +// dialogImageView = new BackupImageView(context); +// dialogImageView.setRoundRadius(dp(14)); +// TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId()); +// dialogAvatarDrawable = new AvatarDrawable(); +// dialogAvatarDrawable.setInfo(user); +// dialogImageView.setForUserOrChat(user, dialogAvatarDrawable); +// dialogSelectorInnerLayout.addView(dialogImageView, LayoutHelper.createFrame(28, 28, Gravity.LEFT | Gravity.FILL_VERTICAL)); +// dialogSelectorIconView = new ImageView(context); +// dialogSelectorIconView.setScaleType(ImageView.ScaleType.CENTER); +// dialogSelectorIconView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_dialogTextGray3, resourcesProvider), PorterDuff.Mode.SRC_IN)); +// dialogSelectorIconView.setImageResource(R.drawable.arrows_select); +// dialogSelectorInnerLayout.addView(dialogSelectorIconView, LayoutHelper.createFrame(18, 18, Gravity.RIGHT | Gravity.CENTER_VERTICAL, 0, 0, 4, 0)); +// dialogSelectorLayout.addView(dialogSelectorInnerLayout, LayoutHelper.createFrame(52, 28)); +// dialogSelectorLayout.setPadding(dp(8), dp(8), dp(8), dp(8)); +// toptopLayout.addView(dialogSelectorLayout, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, Gravity.TOP | Gravity.LEFT, 6, 4, 6, 0)); +// ScaleStateListAnimator.apply(dialogSelectorLayout); +// BotStarsController.getInstance(currentAccount).loadAdmined(); +// dialogSelectorLayout.setOnClickListener(v -> { +// final ArrayList chats = BotStarsController.getInstance(currentAccount).getAdmined(); +// chats.add(0, UserConfig.getInstance(currentAccount).getCurrentUser()); +// +// ItemOptions i = ItemOptions.makeOptions(containerView, resourcesProvider, dialogSelectorInnerLayout); +// for (TLObject obj : chats) { +// long did; +// if (obj instanceof TLRPC.User) { +// did = ((TLRPC.User) obj).id; +// } else if (obj instanceof TLRPC.Chat) { +// TLRPC.Chat chat = (TLRPC.Chat) obj; +// if (!ChatObject.isChannelAndNotMegaGroup(chat)) +// continue; +// did = -chat.id; +// } else continue; +// if (did == dialogId) continue; +// i.addChat(obj, did == selectedDialogId, () -> { +// selectedDialogId = did; +// if (did >= 0) { +// TLRPC.User _user = MessagesController.getInstance(currentAccount).getUser(did); +// dialogAvatarDrawable.setInfo(_user); +// dialogImageView.setForUserOrChat(_user, dialogAvatarDrawable); +// } else { +// TLRPC.Chat _chat = MessagesController.getInstance(currentAccount).getChat(-did); +// dialogAvatarDrawable.setInfo(_chat); +// dialogImageView.setForUserOrChat(_chat, dialogAvatarDrawable); +// } +// balanceView.setDialogId(selectedDialogId); +// }); +// } +// i +// .setDrawScrim(false) +// .setOnTopOfScrim() +// .setDimAlpha(0) +// .setGravity(Gravity.RIGHT) +// .show(); +// }); + titleView = new TextView(context) { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { @@ -191,12 +271,14 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { }; titleView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); +// titleView.setText(getString(R.string.StarsReactionTitle2)); +// titleView.setGravity(Gravity.CENTER); + titleView.setGravity(Gravity.LEFT); titleView.setText(getString(R.string.StarsReactionTitle)); - titleView.setGravity(Gravity.CENTER_VERTICAL); titleView.setTypeface(AndroidUtilities.bold()); - topLayout.addView(titleView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 22, 0, 22,0)); + titleView.setMaxLines(2); + toptopLayout.addView(titleView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 1, Gravity.TOP | Gravity.LEFT, 6, 0, 6, 0)); - balanceView = new StarsIntroActivity.StarsBalanceView(context, currentAccount); ScaleStateListAnimator.apply(balanceView); balanceView.setOnClickListener(v -> { dismiss(); @@ -210,7 +292,7 @@ public void onFragmentDestroy() { } }); }); - topLayout.addView(balanceView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.RIGHT, 6, 0, 6, 0)); + toptopLayout.addView(balanceView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, Gravity.TOP | Gravity.RIGHT, 6, 0, 6, 0)); LinearLayout topLayoutTextLayout = new LinearLayout(context); topLayoutTextLayout.setOrientation(LinearLayout.VERTICAL); @@ -460,9 +542,9 @@ public void dismiss() { private ChatActivity chatActivity; private int messageId; - private ChatMessageCell messageCell; + private View messageCell; - public void setMessageCell(ChatActivity chatActivity, int id, ChatMessageCell cell) { + public void setMessageCell(ChatActivity chatActivity, int id, View cell) { this.chatActivity = chatActivity; this.messageId = id; this.messageCell = cell; @@ -479,8 +561,16 @@ public void setValue(int value) { private ValueAnimator iconAnimator; private void animate3dIcon(Runnable pushed) { if (messageObject == null || chatActivity.fragmentView == null || !chatActivity.fragmentView.isAttachedToWindow()) return; - ChatMessageCell _cell = messageCell; - ReactionsLayoutInBubble.ReactionButton _button = _cell != null ? _cell.reactionsLayoutInBubble.getReactionButton(ReactionsLayoutInBubble.VisibleReaction.asStar()) : null; + View _cell = messageCell; + ReactionsLayoutInBubble.ReactionButton _button = null; + ReactionsLayoutInBubble reactionsLayoutInBubble; + if (_cell instanceof ChatMessageCell) { + reactionsLayoutInBubble = ((ChatMessageCell) _cell).reactionsLayoutInBubble; + _button = reactionsLayoutInBubble.getReactionButton(ReactionsLayoutInBubble.VisibleReaction.asStar()); + } else if (_cell instanceof ChatActionCell) { + reactionsLayoutInBubble = ((ChatActionCell) _cell).reactionsLayoutInBubble; + _button = reactionsLayoutInBubble.getReactionButton(ReactionsLayoutInBubble.VisibleReaction.asStar()); + } else return; if (_button == null) { MessageObject.GroupedMessages group = chatActivity.getValidGroupedMessage(messageObject); if (group != null && !group.posArray.isEmpty()) { @@ -497,12 +587,16 @@ private void animate3dIcon(Runnable pushed) { } } if (_cell == null) return; - _button = _cell.reactionsLayoutInBubble.getReactionButton(ReactionsLayoutInBubble.VisibleReaction.asStar()); + if (_cell instanceof ChatMessageCell) { + reactionsLayoutInBubble = ((ChatMessageCell) _cell).reactionsLayoutInBubble; + _button = reactionsLayoutInBubble.getReactionButton(ReactionsLayoutInBubble.VisibleReaction.asStar()); + } } if (_button == null) { return; } - final ChatMessageCell cell = _cell; + final View cell = _cell; + final ReactionsLayoutInBubble reactionsLayout = reactionsLayoutInBubble; final ReactionsLayoutInBubble.ReactionButton button = _button; final int[] loc = new int[2]; @@ -523,10 +617,10 @@ private void animate3dIcon(Runnable pushed) { final Runnable updateTo = () -> { cell.getLocationInWindow(loc); to.set( - loc[0] + cell.reactionsLayoutInBubble.x + button.x + dp(4), - loc[1] + cell.reactionsLayoutInBubble.y + button.y + (button.height - dp(22)) / 2f, - loc[0] + cell.reactionsLayoutInBubble.x + button.x + dp(4 + 22), - loc[1] + cell.reactionsLayoutInBubble.y + button.y + (button.height + dp(22)) / 2f + loc[0] + reactionsLayout.x + button.x + dp(4), + loc[1] + reactionsLayout.y + button.y + (button.height - dp(22)) / 2f, + loc[0] + reactionsLayout.x + button.x + dp(4 + 22), + loc[1] + reactionsLayout.y + button.y + (button.height + dp(22)) / 2f ); }; updateTo.run(); @@ -629,7 +723,7 @@ public static class StarsSlider extends View { private final Paint textBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); private final Particles sliderParticles = new Particles(Particles.TYPE_RIGHT, 300); - private final Particles textParticles = new Particles(Particles.TYPE_RADIAL, 30); + private final Particles textParticles = new Particles(Particles.TYPE_RADIAL_INSIDE, 30); private final LinearGradient gradient = new LinearGradient(0, 0, 255, 0, new int[] {0xFFEEAC0D, 0xFFF9D316}, new float[] {0, 1}, Shader.TileMode.CLAMP); private final Matrix gradientMatrix = new Matrix(); @@ -988,6 +1082,7 @@ public static class Particles { public static final int TYPE_RIGHT = 0; public static final int TYPE_RADIAL = 1; + public static final int TYPE_RADIAL_INSIDE = 2; public final int type; public final ArrayList particles; @@ -1039,11 +1134,25 @@ public void setVisible(float x) { public void setBounds(RectF bounds) { this.bounds.set(bounds); - if (type == TYPE_RADIAL) { + removeParticlesOutside(); + } + + public void setBounds(Rect bounds) { + this.bounds.set(bounds); + removeParticlesOutside(); + } + + public void setBounds(int l, int t, int r, int b) { + this.bounds.set(l, t, r, b); + removeParticlesOutside(); + } + + public void removeParticlesOutside() { + if (type == TYPE_RADIAL_INSIDE) { final long now = System.currentTimeMillis(); for (int i = 0; i < particles.size(); ++i) { final Particle p = particles.get(i); - if (!bounds.contains(p.x, p.y)) gen(p, now, firstDraw); + if (!bounds.contains((int) p.x, (int) p.y)) gen(p, now, firstDraw); } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/DarkThemeResourceProvider.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/DarkThemeResourceProvider.java index 282bdd0095..d62d1c781d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/DarkThemeResourceProvider.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/DarkThemeResourceProvider.java @@ -17,14 +17,17 @@ public class DarkThemeResourceProvider implements Theme.ResourcesProvider { - HashSet debugUnknownKeys = new HashSet<>(); - SparseIntArray sparseIntArray = new SparseIntArray(); + protected HashSet debugUnknownKeys = new HashSet<>(); + protected SparseIntArray sparseIntArray = new SparseIntArray(); Paint dividerPaint = new Paint(); Paint actionPaint; ColorFilter animatedEmojiColorFilter; public DarkThemeResourceProvider() { + sparseIntArray.put(Theme.key_chat_BlurAlpha, -1308622848); + sparseIntArray.put(Theme.key_chat_BlurAlphaSlow, -1056964608); + sparseIntArray.put(Theme.key_statisticChartSignature, -1214008894); sparseIntArray.put(Theme.key_statisticChartSignatureAlpha, -1946157057); sparseIntArray.put(Theme.key_statisticChartHintLine, 452984831); @@ -63,6 +66,7 @@ public DarkThemeResourceProvider() { sparseIntArray.put(Theme.key_chat_emojiSearchBackground, ColorUtils.setAlphaComponent(Color.WHITE, 30)); sparseIntArray.put(Theme.key_chat_emojiPanelBackground, 0xc0000000); + sparseIntArray.put(Theme.key_actionBarActionModeDefaultIcon, Color.WHITE); sparseIntArray.put(Theme.key_dialogSearchHint, ColorUtils.blendARGB(Color.BLACK, Color.WHITE, 0.5f)); sparseIntArray.put(Theme.key_dialogSearchBackground, ColorUtils.setAlphaComponent(Color.WHITE, 17)); @@ -116,6 +120,7 @@ public DarkThemeResourceProvider() { sparseIntArray.put(Theme.key_windowBackgroundWhiteGrayText4, 0xFF808080); sparseIntArray.put(Theme.key_voipgroup_nameText, 0xffffffff); sparseIntArray.put(Theme.key_voipgroup_inviteMembersBackground, 0xff222A33); + sparseIntArray.put(Theme.key_dialogScrollGlow, 0xff222A33); sparseIntArray.put(Theme.key_chats_secretName, -9316522); sparseIntArray.put(Theme.key_chats_name, -1446156); sparseIntArray.put(Theme.key_chat_serviceBackground, -2110438831); @@ -160,6 +165,17 @@ public DarkThemeResourceProvider() { sparseIntArray.put(Theme.key_chat_outBubbleGradient3, 0); sparseIntArray.put(Theme.key_chat_textSelectBackground, ColorUtils.setAlphaComponent(Color.WHITE, 75)); + sparseIntArray.put(Theme.key_radioBackgroundChecked, -10177041); + sparseIntArray.put(Theme.key_checkboxDisabled, -12237499); + sparseIntArray.put(Theme.key_checkboxCheck, 0xFFFFFFFF); + + sparseIntArray.put(Theme.key_avatar_backgroundSaved, 0xFF5CADF6); + sparseIntArray.put(Theme.key_avatar_background2Saved, 0xFF408BCF); + + sparseIntArray.put(Theme.key_share_icon, -1); + sparseIntArray.put(Theme.key_share_linkText, 0xB7FFFFFF); + sparseIntArray.put(Theme.key_share_linkBackground, 352321535); + appendColors(); dividerPaint.setColor(getColor(Theme.key_divider)); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/MessageMediaStoryFull.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/MessageMediaStoryFull.java index deddc5b953..d05f9850aa 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/MessageMediaStoryFull.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/MessageMediaStoryFull.java @@ -3,6 +3,8 @@ import org.telegram.messenger.MessagesController; import org.telegram.messenger.UserConfig; import org.telegram.tgnet.AbstractSerializedData; +import org.telegram.tgnet.InputSerializedData; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.TLRPC; import org.telegram.tgnet.tl.TL_stories; @@ -10,7 +12,7 @@ public class MessageMediaStoryFull extends TLRPC.TL_messageMediaStory { public static int constructor = 0xc79aee1d; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); id = stream.readInt32(exception); storyItem = TL_stories.StoryItem.TLdeserialize(stream, stream.readInt32(exception), exception); @@ -18,7 +20,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { peer = MessagesController.getInstance(UserConfig.selectedAccount).getPeer(user_id); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); stream.writeInt32(id); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/MessageMediaStoryFull_old.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/MessageMediaStoryFull_old.java index 25659bcc58..444ed8fb20 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/MessageMediaStoryFull_old.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/MessageMediaStoryFull_old.java @@ -1,6 +1,8 @@ package org.telegram.ui.Stories; import org.telegram.tgnet.AbstractSerializedData; +import org.telegram.tgnet.InputSerializedData; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.TLRPC; import org.telegram.tgnet.tl.TL_stories; @@ -12,13 +14,13 @@ public MessageMediaStoryFull_old() { public static int constructor = 0xc79aee1f; - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception); id = stream.readInt32(exception); storyItem = TL_stories.StoryItem.TLdeserialize(stream, stream.readInt32(exception), exception); } - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt64(user_id); stream.writeInt32(id); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/PeerStoriesView.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/PeerStoriesView.java index 2bd278f717..1bbc1f8608 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/PeerStoriesView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/PeerStoriesView.java @@ -10,7 +10,6 @@ import android.app.Dialog; import android.content.ClipData; import android.content.Context; -import android.content.DialogInterface; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.Canvas; @@ -179,7 +178,6 @@ import java.io.File; import java.io.UnsupportedEncodingException; -import java.net.IDN; import java.net.URLDecoder; import java.net.URLEncoder; import java.util.ArrayList; @@ -2145,7 +2143,9 @@ private void likeStory(ReactionsLayoutInBubble.VisibleReaction visibleReaction) counterChanged = true; } storiesLikeButton.setReaction(ReactionsLayoutInBubble.VisibleReaction.fromTL(currentStory.storyItem.sent_reaction)); - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} added = true; } if (isChannel && counterChanged) { @@ -3168,7 +3168,7 @@ public void appendColors() { }; TLRPC.Chat chat = isChannel ? MessagesController.getInstance(currentAccount).getChat(-dialogId) : null; final boolean canRepost = !DISABLE_STORY_REPOSTING && MessagesController.getInstance(currentAccount).storiesEnabled() && (!isChannel && !UserObject.isService(dialogId) || ChatObject.isPublic(chat)); - shareAlert = new ShareAlert(storyViewer.fragment.getContext(), null, null, link, null, false, link, null, false, false, canRepost, shareResourceProvider) { + shareAlert = new ShareAlert(storyViewer.fragment.getContext(), null, null, link, null, false, link, null, false, false, canRepost, null, shareResourceProvider) { @Override public void dismissInternal() { @@ -3189,18 +3189,20 @@ protected void onSend(LongSparseArray dids, int count, TLRPC.TL_fo if (dids.size() == 1) { long did = dids.keyAt(0); if (did == UserConfig.getInstance(currentAccount).clientUserId) { - bulletinFactory.createSimpleBulletin(R.raw.saved_messages, AndroidUtilities.replaceTags(LocaleController.formatString("StorySharedToSavedMessages", R.string.StorySharedToSavedMessages)), Bulletin.DURATION_PROLONG).hideAfterBottomSheet(false).show(); + bulletinFactory.createSimpleBulletin(R.raw.saved_messages, AndroidUtilities.replaceTags(LocaleController.formatString(R.string.StorySharedToSavedMessages)), Bulletin.DURATION_PROLONG).hideAfterBottomSheet(false).show(); } else if (did < 0) { TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-did); - bulletinFactory.createSimpleBulletin(R.raw.forward, AndroidUtilities.replaceTags(LocaleController.formatString("StorySharedTo", R.string.StorySharedTo, topic != null ? topic.title : chat.title)), Bulletin.DURATION_PROLONG).hideAfterBottomSheet(false).show(); + bulletinFactory.createSimpleBulletin(R.raw.forward, AndroidUtilities.replaceTags(LocaleController.formatString(R.string.StorySharedTo, topic != null ? topic.title : chat.title)), Bulletin.DURATION_PROLONG).hideAfterBottomSheet(false).show(); } else { TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(did); - bulletinFactory.createSimpleBulletin(R.raw.forward, AndroidUtilities.replaceTags(LocaleController.formatString("StorySharedTo", R.string.StorySharedTo, user.first_name)), Bulletin.DURATION_PROLONG).hideAfterBottomSheet(false).show(); + bulletinFactory.createSimpleBulletin(R.raw.forward, AndroidUtilities.replaceTags(LocaleController.formatString(R.string.StorySharedTo, user.first_name)), Bulletin.DURATION_PROLONG).hideAfterBottomSheet(false).show(); } } else { bulletinFactory.createSimpleBulletin(R.raw.forward, AndroidUtilities.replaceTags(LocaleController.formatPluralString("StorySharedToManyChats", dids.size(), dids.size()))).hideAfterBottomSheet(false).show(); } - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} } } }; @@ -3805,7 +3807,7 @@ private void deleteStory() { storyViewer.checkSelfStoriesView(); } }); - builder.setNegativeButton(LocaleController.getString(R.string.Cancel), (DialogInterface.OnClickListener) (dialog, which) -> { + builder.setNegativeButton(LocaleController.getString(R.string.Cancel), (dialog, which) -> { dialog.dismiss(); }); AlertDialog dialog = builder.create(); @@ -5805,7 +5807,7 @@ public void updateCaption() { captionTranslated = false; if (currentStory.uploadingStory != null) { caption = currentStory.uploadingStory.entry.caption; - caption = Emoji.replaceEmoji(caption, storyCaptionView.captionTextview.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false); + caption = Emoji.replaceEmoji(caption, storyCaptionView.captionTextview.getPaint().getFontMetricsInt(), false); SpannableStringBuilder spannableStringBuilder = SpannableStringBuilder.valueOf(caption); TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(dialogId); if (dialogId < 0 || MessagesController.getInstance(currentAccount).storyEntitiesAllowed(user)) { @@ -5816,7 +5818,7 @@ public void updateCaption() { captionTranslated = true; TLRPC.TL_textWithEntities text = currentStory.storyItem.translatedText; caption = text.text; - caption = Emoji.replaceEmoji(caption, storyCaptionView.captionTextview.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false); + caption = Emoji.replaceEmoji(caption, storyCaptionView.captionTextview.getPaint().getFontMetricsInt(), false); if (caption != null && text.entities != null) { SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(text.text); spannableStringBuilder = SpannableStringBuilder.valueOf(MessageObject.replaceAnimatedEmoji(spannableStringBuilder, text.entities, storyCaptionView.captionTextview.getPaint().getFontMetricsInt(), false)); @@ -5831,7 +5833,7 @@ public void updateCaption() { } } else { caption = currentStory.storyItem.caption; - caption = Emoji.replaceEmoji(caption, storyCaptionView.captionTextview.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false); + caption = Emoji.replaceEmoji(caption, storyCaptionView.captionTextview.getPaint().getFontMetricsInt(), false); if (caption != null && currentStory.storyItem.entities != null) { SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(currentStory.storyItem.caption); spannableStringBuilder = SpannableStringBuilder.valueOf(MessageObject.replaceAnimatedEmoji(spannableStringBuilder, currentStory.storyItem.entities, storyCaptionView.captionTextview.getPaint().getFontMetricsInt(), false)); @@ -6649,7 +6651,9 @@ void onReactionClickedInternal(View view, ReactionsLayoutInBubble.VisibleReactio } ReactionsEffectOverlay effectOverlay; if (longpress && visibleReaction.emojicon != null) { - performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} effectOverlay = new ReactionsEffectOverlay( view.getContext(), null, reactionsContainerLayout, null, @@ -6832,7 +6836,9 @@ public void onAnimationEnd(Animator animation) { if (movingReactionProgress > 0.8f && !effectStarted[0]) { effectStarted[0] = true; drawReactionEffect = true; - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} } }); animator.addListener(new AnimatorListenerAdapter() { @@ -6844,7 +6850,9 @@ public void onAnimationEnd(Animator animation) { if (!effectStarted[0]) { effectStarted[0] = true; drawReactionEffect = true; - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} } storiesLikeButtonFinal.setAllowDrawReaction(true); storiesLikeButtonFinal.animateVisibleReaction(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/SelfStoryViewsPage.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/SelfStoryViewsPage.java index 88613a8cbb..bd583c612d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/SelfStoryViewsPage.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/SelfStoryViewsPage.java @@ -394,8 +394,7 @@ public Theme.ResourcesProvider getResourceProvider() { try { performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); - } catch (Exception ignore) { - } + } catch (Exception ignore) {} return true; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/StealthModeAlert.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/StealthModeAlert.java index 569e37c2ae..2adc095aa2 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/StealthModeAlert.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/StealthModeAlert.java @@ -171,7 +171,9 @@ protected void onDetachedFromWindow() { ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { })); - containerView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + containerView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} dismiss(); if (type == TYPE_FROM_STORIES) { showStealthModeEnabledBulletin(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoriesController.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoriesController.java index 17c50d5251..95bc06c4b6 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoriesController.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoriesController.java @@ -48,6 +48,7 @@ import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import org.telegram.tgnet.tl.TL_bots; import org.telegram.tgnet.tl.TL_stories; import org.telegram.ui.ActionBar.BaseFragment; @@ -57,7 +58,6 @@ import org.telegram.ui.Components.Premium.LimitReachedBottomSheet; import org.telegram.ui.Components.Reactions.ReactionImageHolder; import org.telegram.ui.Components.Reactions.ReactionsLayoutInBubble; -import org.telegram.ui.Components.Text; import org.telegram.ui.LaunchActivity; import org.telegram.ui.StatisticActivity; import org.telegram.ui.Stories.bots.BotPreviewsEditContainer; @@ -1205,7 +1205,7 @@ public void deleteStories(long dialogId, ArrayList storyIt } public void updateStoriesPinned(long dialogId, ArrayList storyItems, boolean pinned, Utilities.Callback whenDone) { - TL_stories.TL_stories_togglePinned req = new TL_stories.TL_stories_togglePinned(); + TL_stories.togglePinned req = new TL_stories.togglePinned(); TL_stories.PeerStories peerStories = getStories(dialogId); for (int i = 0; i < storyItems.size(); ++i) { TL_stories.StoryItem storyItem = storyItems.get(i); @@ -1276,7 +1276,7 @@ public boolean markStoryAsRead(TL_stories.PeerStories userStories, TL_stories.St TL_stories.TL_stories_readStories req = new TL_stories.TL_stories_readStories(); req.peer = MessagesController.getInstance(currentAccount).getInputPeer(dialogId); req.max_id = storyItem.id; - ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {}); + ConnectionsManager.getInstance(currentAccount).sendRequest(req, null); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.storiesReadUpdated); return true; } @@ -2558,8 +2558,8 @@ public boolean loadInternal(Runnable callback) { this.done = true; final ArrayList medias = new ArrayList<>(); - if (res instanceof TLRPC.Vector) { - ArrayList objects = ((TLRPC.Vector) res).objects; + if (res instanceof Vector) { + ArrayList objects = ((Vector) res).objects; for (Object o : objects) { TL_bots.botPreviewMedia media = (TL_bots.botPreviewMedia) o; medias.add(media); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoriesUtilities.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoriesUtilities.java index 98278e429c..69564aac6a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoriesUtilities.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoriesUtilities.java @@ -860,12 +860,12 @@ public static void applyUploadingStr(AnimatedTextView textView, boolean medium, } public static CharSequence createExpiredStoryString() { - return createExpiredStoryString(false, "ExpiredStory", R.string.ExpiredStory); + return createExpiredStoryString(false, R.string.ExpiredStory); } - public static CharSequence createExpiredStoryString(boolean useScale, String strKey, int strRes, Object... args) { + public static CharSequence createExpiredStoryString(boolean useScale, int strRes, Object... args) { SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(); - spannableStringBuilder.append("d ").append(LocaleController.formatString(strKey, strRes, args)); + spannableStringBuilder.append("d ").append(LocaleController.formatString(strRes, args)); ColoredImageSpan coloredImageSpan = new ColoredImageSpan(R.drawable.msg_mini_bomb); if (useScale) { coloredImageSpan.setScale(0.8f, 0.8f); @@ -1173,7 +1173,9 @@ public boolean checkOnTouchEvent(MotionEvent event, View view) { AndroidUtilities.cancelRunOnUIThread(longPressRunnable); } AndroidUtilities.runOnUIThread(longPressRunnable = () -> { - view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} if (buttonBounce != null) { buttonBounce.setPressed(false); } @@ -1411,6 +1413,10 @@ public void setChat(TLRPC.Chat chat, boolean animated) { public void setColorId(int colorId, boolean animated) { MessagesController.PeerColors peerColors = MessagesController.getInstance(currentAccount).profilePeerColors; MessagesController.PeerColor peerColor = peerColors == null ? null : peerColors.getColor(colorId); + setColor(peerColor, animated); + } + + public void setColor(MessagesController.PeerColor peerColor, boolean animated) { if (peerColor != null) { setColors( peerColor.getStoryColor1(Theme.isCurrentThemeDark()), @@ -1421,6 +1427,7 @@ public void setColorId(int colorId, boolean animated) { resetColors(animated); } } + private void resetColors(boolean animated) { if (isDialogCell) { setColors(Theme.getColor(Theme.key_stories_circle_dialog1), Theme.getColor(Theme.key_stories_circle_dialog2), animated); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoryContainsEmojiButton.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoryContainsEmojiButton.java index cadc94779a..52477ca29b 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoryContainsEmojiButton.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoryContainsEmojiButton.java @@ -31,6 +31,7 @@ import org.telegram.tgnet.RequestDelegate; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Components.AnimatedEmojiDrawable; import org.telegram.ui.Components.AnimatedEmojiSpan; @@ -56,7 +57,7 @@ public class StoryContainsEmojiButton extends View { private ArrayList sets; private ArrayList inputSets; - private TLRPC.Vector vector; + private Vector vector; private boolean emoji, stickers; private Object parentObject; private float loadT; @@ -160,7 +161,7 @@ protected void dispatchDraw(Canvas canvas) { } private static Object lastRequestParentObject; - private static TLRPC.Vector lastResponse; + private static Vector lastResponse; public void load(int currentAccount, boolean requestStickers, TLObject obj, ArrayList additionalEmojiSets, Object parentObject) { final boolean animate[] = new boolean[] { true }; @@ -206,14 +207,14 @@ public void load(int currentAccount, boolean requestStickers, TLObject obj, Arra req.media = inputStickeredMediaDocument; } final RequestDelegate requestDelegate = (response, error) -> AndroidUtilities.runOnUIThread(() -> { - if (response == null) { + if (!(response instanceof Vector)) { return; } - TLRPC.Vector vector = this.vector = (TLRPC.Vector) response; + Vector vector = this.vector = (Vector) response; lastRequestParentObject = parentObject; lastResponse = vector; for (int i = 0; i < vector.objects.size(); ++i) { - TLRPC.StickerSetCovered setCovered = (TLRPC.StickerSetCovered) vector.objects.get(i); + TLRPC.StickerSetCovered setCovered = vector.objects.get(i); sets.add(setCovered); if (setCovered.set != null) { inputSets.add(MediaDataController.getInputStickerSet(setCovered.set)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoryCustomParamsHelper.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoryCustomParamsHelper.java index ace3abb7ea..f9594f176c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoryCustomParamsHelper.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoryCustomParamsHelper.java @@ -1,7 +1,9 @@ package org.telegram.ui.Stories; import org.telegram.tgnet.AbstractSerializedData; +import org.telegram.tgnet.InputSerializedData; import org.telegram.tgnet.NativeByteBuffer; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; import org.telegram.tgnet.tl.TL_stories; @@ -65,7 +67,7 @@ private Params_v1(TL_stories.StoryItem storyItem) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(VERSION); stream.writeInt32(flags); if ((flags & 2) != 0) { @@ -80,7 +82,7 @@ public void serializeToStream(AbstractSerializedData stream) { } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(true); storyItem.translated = (flags & 1) != 0; if ((flags & 2) != 0) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoryMediaAreasView.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoryMediaAreasView.java index c000ac556e..067dc369ca 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoryMediaAreasView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoryMediaAreasView.java @@ -36,6 +36,7 @@ import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.LocaleController; import org.telegram.messenger.MessageObject; +import org.telegram.messenger.MessagesController; import org.telegram.messenger.R; import org.telegram.messenger.UserConfig; import org.telegram.messenger.browser.Browser; @@ -261,6 +262,12 @@ public void onClick(View v) { selectedArea = null; invalidate(); return; + } else if (selectedArea.mediaArea instanceof TL_stories.TL_mediaAreaStarGift) { + final String slug = ((TL_stories.TL_mediaAreaStarGift) selectedArea.mediaArea).slug; + Browser.openUrl(getContext(), "https://" + MessagesController.getInstance(UserConfig.selectedAccount).linkPrefix + "/nft/" + slug); + selectedArea = null; + invalidate(); + return; } LocationActivity fragment = new LocationActivity(3) { @@ -323,6 +330,8 @@ protected boolean disablePermissionCheck() { SpannableStringBuilder text = new SpannableStringBuilder(); if (selectedArea.mediaArea instanceof TL_stories.TL_mediaAreaChannelPost) { text.append(LocaleController.getString(R.string.StoryViewMessage)); + } else if (selectedArea.mediaArea instanceof TL_stories.TL_mediaAreaStarGift) { + text.append(LocaleController.getString(R.string.StoryViewGift)); } else if (selectedArea.mediaArea instanceof TL_stories.TL_mediaAreaUrl) { thisHint.setMultilineText(multiline = true); text.append(LocaleController.getString(R.string.StoryOpenLink)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoryViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoryViewer.java index cc4ba13d56..66597be0a7 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoryViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/StoryViewer.java @@ -453,7 +453,9 @@ public boolean onScroll(@NonNull MotionEvent e1, @NonNull MotionEvent e2, float if (swipeToReplyOffset > maxOffset && !swipeToReplyWaitingKeyboard) { swipeToReplyWaitingKeyboard = true; showKeyboard(); - windowView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + windowView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} } swipeToReplyProgress = Utilities.clamp(swipeToReplyOffset / maxOffset, 1f, 0); if (storiesViewPager.getCurrentPeerView() != null) { @@ -506,7 +508,9 @@ public boolean onFling(@NonNull MotionEvent e1, @NonNull MotionEvent e2, float v if (swipeToReplyOffset != 0 && storiesIntro == null) { if (velocityY < -1000 && !swipeToReplyWaitingKeyboard) { swipeToReplyWaitingKeyboard = true; - windowView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + windowView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} showKeyboard(); } } @@ -960,8 +964,7 @@ public boolean onInterceptTouchEvent(MotionEvent ev) { if ((int) (nowSeek * 10) != (int) (wasSeek * 10)) { try { peerView.performHapticFeedback(9, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); - } catch (Exception ignore) { - } + } catch (Exception ignore) {} } peerView.storyContainer.invalidate(); lastTouchX = x; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/UserListPoller.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/UserListPoller.java index baba039fea..417156f00a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/UserListPoller.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/UserListPoller.java @@ -11,6 +11,7 @@ import org.telegram.messenger.support.LongSparseLongArray; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import org.telegram.tgnet.tl.TL_stories; import org.telegram.ui.Cells.DialogCell; import org.telegram.ui.Cells.UserCell; @@ -52,8 +53,8 @@ public void run() { request.id.add(MessagesController.getInstance(currentAccount).getInputPeer(dialogsFinal.get(i))); } ConnectionsManager.getInstance(currentAccount).sendRequest(request, (response, error) -> AndroidUtilities.runOnUIThread(() -> { - if (response != null) { - TLRPC.Vector vector = (TLRPC.Vector) response; + if (response instanceof Vector) { + Vector vector = (Vector) response; ArrayList usersToUpdate = new ArrayList<>(); ArrayList chatsToUpdate = new ArrayList<>(); for (int i = 0; i < vector.objects.size(); i++) { @@ -62,7 +63,7 @@ public void run() { if (user == null) { continue; } - user.stories_max_id = (int) vector.objects.get(i); + user.stories_max_id = ((Vector.Int) vector.objects.get(i)).value; if (user.stories_max_id != 0) { user.flags2 |= 32; } else { @@ -74,7 +75,7 @@ public void run() { if (chat == null) { continue; } - chat.stories_max_id = (int) vector.objects.get(i); + chat.stories_max_id = ((Vector.Int) vector.objects.get(i)).value; if (chat.stories_max_id != 0) { chat.flags2 |= 16; } else { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/ButtonWithCounterView.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/ButtonWithCounterView.java index 1343cb93b4..ccb2fc9ede 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/ButtonWithCounterView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/ButtonWithCounterView.java @@ -112,6 +112,11 @@ public void setColor(int color) { } } + public void updateColors(Theme.ResourcesProvider resourcesProvider) { + this.resourcesProvider = resourcesProvider; + updateColors(); + } + public void updateColors() { text.setTextColor(Theme.getColor(filled ? Theme.key_featuredStickers_buttonText : Theme.key_featuredStickers_addButton, resourcesProvider)); if (filled) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/CaptionContainerView.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/CaptionContainerView.java index 7bf4a818f2..cdaa7815c9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/CaptionContainerView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/CaptionContainerView.java @@ -501,7 +501,7 @@ private void replaceWithText(int start, int len, CharSequence text, boolean pars SpannableStringBuilder builder = new SpannableStringBuilder(editText.getText()); builder.replace(start, start + len, text); if (parseEmoji) { - Emoji.replaceEmoji(builder, editText.getEditText().getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false); + Emoji.replaceEmoji(builder, editText.getEditText().getPaint().getFontMetricsInt(), false); } editText.setText(builder); editText.setSelection(start + text.length()); @@ -774,7 +774,7 @@ public boolean onBackPressed() { return true; } - if (editText.isKeyboardVisible() && !keyboardNotifier.ignoring) { + if ((editText.isKeyboardVisible() || keyboardNotifier.keyboardVisible()) && !keyboardNotifier.ignoring) { closeKeyboard(); return true; } @@ -813,7 +813,7 @@ public void setReply(CharSequence title, CharSequence text) { private Path replyLinePath; private float[] replyLinePathRadii; private void drawReply(Canvas canvas) { - if (!hasReply || replyBackgroundBlur == null || replyTextBlur == null || customBlur()) { + if (!hasReply || replyBackgroundBlur == null || replyTextBlur == null) { return; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/CollageLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/CollageLayout.java index b89382ff24..808b47707c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/CollageLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/CollageLayout.java @@ -36,6 +36,21 @@ public static ArrayList getLayouts() { return layouts; } + public static CollageLayout of(int count) { + for (CollageLayout layout : getLayouts()) { + if (layout.parts.size() >= count) + return layout; + } + return null; + } + + public static int getMaxCount() { + int max = 0; + for (CollageLayout layout : getLayouts()) + max = Math.max(max, layout.parts.size()); + return max; + } + private final String src; public final int w, h; public final int[] columns; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/CollageLayoutView2.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/CollageLayoutView2.java index a96928f9bb..c3d3da3f81 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/CollageLayoutView2.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/CollageLayoutView2.java @@ -16,10 +16,12 @@ import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.RectF; +import android.graphics.RenderEffect; import android.graphics.RenderNode; import android.graphics.Shader; +import android.graphics.drawable.Drawable; import android.net.Uri; -import android.util.Log; +import android.os.Build; import android.util.TypedValue; import android.view.Gravity; import android.view.HapticFeedbackConstants; @@ -59,6 +61,8 @@ public class CollageLayoutView2 extends FrameLayout implements ItemOptions.Scrim private final FrameLayout containerView; private final Theme.ResourcesProvider resourcesProvider; + public final QRScanner.QrRegionDrawer qrDrawer = new QRScanner.QrRegionDrawer(this::invalidate); + public CameraView cameraView; private Object cameraViewBlurRenderNode; @@ -323,12 +327,45 @@ public void getBounds(RectF bounds) { } } + private Object renderNode; + private Object blurRenderNode; + + public Object getBlurRenderNode() { + if (renderNode == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + renderNode = new RenderNode("CameraViewRenderNode"); + blurRenderNode = new RenderNode("CameraViewRenderNodeBlur"); + ((RenderNode) blurRenderNode).setRenderEffect(RenderEffect.createBlurEffect(dp(32), dp(32), Shader.TileMode.DECAL)); + } + return blurRenderNode; + } + + private void finishNode(Canvas canvas) { + if (renderNode != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && canvas.isHardwareAccelerated()) { + RenderNode node = (RenderNode) renderNode; + node.endRecording(); + canvas.drawRenderNode(node); + if (blurRenderNode != null) { + RenderNode blurNode = (RenderNode) blurRenderNode; + blurNode.setPosition(0, 0, getWidth(), getHeight()); + blurNode.beginRecording().drawRenderNode(node); + blurNode.endRecording();; + } + } + } + private final RectF rect = new RectF(); @Override - protected void dispatchDraw(@NonNull Canvas canvas) { + protected void dispatchDraw(@NonNull Canvas c) { + Canvas canvas = c; + if (renderNode != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && canvas.isHardwareAccelerated()) { + RenderNode node = (RenderNode) renderNode; + node.setPosition(0, 0, getWidth(), getHeight()); + canvas = node.beginRecording(); + } super.dispatchDraw(canvas); - if (!hasLayout() && !reordering && !this.reorderingTouch && animatedRows.get() == currentLayout.h && animatedColumns[0].get() == currentLayout.columns[0]) { + if (!hasLayout() && !reordering && !this.reorderingTouch && animatedRows.get() == currentLayout.h && animatedColumns[0].get() == currentLayout.columns[0] && qrDrawer.hasNoDraw()) { setCameraNeedsBlur(false); + finishNode(c); return; } else if (preview) { setCameraNeedsBlur(false); @@ -466,16 +503,24 @@ protected void dispatchDraw(@NonNull Canvas canvas) { if (blurNeedsInvalidate && blurManager != null) { blurManager.invalidate(); } + finishNode(c); } - public float getFilledProgress() { - int done = 0, total = 0; + public int getTotalCount() { + return parts.size(); + } + + public int getFilledCount() { + int done = 0; for (int i = 0; i < parts.size(); ++i) { if (parts.get(i).hasContent()) done++; - total++; } - return (float) done / total; + return done; + } + + public float getFilledProgress() { + return (float) getFilledCount() / getTotalCount(); } private final Path clipPath = new Path(); @@ -500,21 +545,28 @@ private void drawPart(Canvas canvas, RectF rect, Part part) { } else { part.imageReceiver.setImageCoords(rect.left, rect.top, rect.width(), rect.height()); if (!part.imageReceiver.draw(canvas)) { - drawView(canvas, cameraView, rect, 0); + if (cameraView == null && cameraThumbVisible) { + drawDrawable(canvas, cameraThumbDrawable, rect, 0); + } else { + drawView(canvas, cameraView, rect, 0); + } } } } else if (part != null && part.current || AndroidUtilities.makingGlobalBlurBitmap) { - drawView(canvas, cameraView, rect, !(part != null && part.current) ? 0.4f : 0); + if (cameraView == null && cameraThumbVisible) { + drawDrawable(canvas, cameraThumbDrawable, rect, !(part != null && part.current) ? 0.4f : 0); + } else { + drawView(canvas, cameraView, rect, !(part != null && part.current) ? 0.4f : 0); + } } else { setCameraNeedsBlur(!preview); if (cameraViewBlurRenderNode != null && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q && canvas.isHardwareAccelerated()) { final RenderNode node = (RenderNode) cameraViewBlurRenderNode; final float scale = Math.max(rect.width() / node.getWidth(), rect.height() / node.getHeight()); canvas.save(); - canvas.translate(rect.centerX(), rect.centerY()); - canvas.clipRect(-rect.width() / 2.0f, -rect.height() / 2.0f, rect.width() / 2.0f, rect.height() / 2.0f); + canvas.translate(rect.left, rect.top); + canvas.clipRect(0, 0, rect.width(), rect.height()); canvas.scale(scale, scale); - canvas.translate(-node.getWidth() / 2.0f, -node.getHeight() / 2.0f); canvas.drawRenderNode(node); canvas.drawColor(0x64000000); canvas.restore(); @@ -561,6 +613,28 @@ private void drawView(Canvas canvas, View view, RectF rect, float overlayAlpha) canvas.drawColor(Theme.multAlpha(0xFF000000, view.getAlpha() * overlayAlpha)); } canvas.restore(); + + if (view == cameraView && qrDrawer != null) { + qrDrawer.draw(canvas, rect); + } + } + + private void drawDrawable(Canvas canvas, Drawable drawable, RectF rect, float overlayAlpha) { + if (drawable == null) return; + int w = drawable.getIntrinsicWidth(); + int h = drawable.getIntrinsicHeight(); + final float scale = Math.max(rect.width() / w, rect.height() / h); + canvas.save(); + canvas.translate(rect.centerX(), rect.centerY()); + canvas.clipRect(-rect.width() / 2.0f, -rect.height() / 2.0f, rect.width() / 2.0f, rect.height() / 2.0f); + canvas.scale(scale, scale); + canvas.translate(-w / 2.0f, -h / 2.0f); + drawable.setBounds(0, 0, w, h); + drawable.draw(canvas); + if (overlayAlpha > 0) { + canvas.drawColor(Theme.multAlpha(0xFF000000, drawable.getAlpha() * overlayAlpha)); + } + canvas.restore(); } public void updatePartsState() { @@ -670,6 +744,24 @@ public void setCameraView(CameraView cameraView) { invalidate(); } + private Drawable cameraThumbDrawable; + private boolean cameraThumbVisible = true; + private Runnable onCameraThumbClick; + + public void setCameraThumb(Drawable cameraThumbDrawable) { + this.cameraThumbDrawable = cameraThumbDrawable; + invalidate(); + } + + public void setCameraThumbVisible(boolean cameraThumbVisible) { + this.cameraThumbVisible = cameraThumbVisible; + invalidate(); + } + + public void setOnCameraThumbClick(Runnable listener) { + this.onCameraThumbClick = listener; + } + private boolean needsBlur; public void setCameraNeedsBlur(boolean needsBlur) { if (this.needsBlur == needsBlur) return; @@ -788,7 +880,9 @@ private void onLongPress() { } }) .show(); - performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); + try { + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); + } catch (Exception ignored) {} } public void retake(Part part) { @@ -833,7 +927,12 @@ public void delete(Part part) { @Override public boolean dispatchTouchEvent(MotionEvent event) { if (!hasLayout() || preview) { - return super.dispatchTouchEvent(event); + cancelTouch(); + return false; + } + if (event.getPointerCount() > 1) { + cancelTouch(); + return false; } final Part hitPart = getPartAt(event.getX(), event.getY()); if (event.getAction() == MotionEvent.ACTION_DOWN) { @@ -1022,7 +1121,9 @@ public void setContent(StoryEntry entry) { if (content == null) { imageReceiver.clearImage(); } else if (content.isVideo) { - if (content.thumbBitmap != null) { + if (content.blurredVideoThumb != null) { + imageReceiver.setImageBitmap(content.blurredVideoThumb); + } else if (content.thumbBitmap != null) { imageReceiver.setImageBitmap(content.thumbBitmap); } else if (content.thumbPath != null) { imageReceiver.setImage(content.thumbPath, filter, null, null, 0); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/CropEditor.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/CropEditor.java new file mode 100644 index 0000000000..1c9b1a3747 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/CropEditor.java @@ -0,0 +1,591 @@ +package org.telegram.ui.Stories.recorder; + +import static org.telegram.messenger.AndroidUtilities.dp; +import static org.telegram.messenger.AndroidUtilities.lerp; + +import android.animation.ValueAnimator; +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Matrix; +import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.RectF; +import android.os.Build; +import android.util.Log; +import android.util.TypedValue; +import android.view.Gravity; +import android.view.View; +import android.widget.FrameLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.google.zxing.common.detector.MathUtils; + +import org.checkerframework.checker.units.qual.C; +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MediaController; +import org.telegram.messenger.R; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.BubbleActivity; +import org.telegram.ui.Components.AnimatedFloat; +import org.telegram.ui.Components.Crop.CropAreaView; +import org.telegram.ui.Components.Crop.CropRotationWheel; +import org.telegram.ui.Components.Crop.CropTransform; +import org.telegram.ui.Components.Crop.CropView; +import org.telegram.ui.Components.CubicBezierInterpolator; +import org.telegram.ui.Components.LayoutHelper; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; + +public class CropEditor extends FrameLayout { + + private final Theme.ResourcesProvider resourcesProvider; + private final PreviewView previewView; + + private final AnimatedFloat animatedMirror; + private int lastOrientation = 0; + private final AnimatedFloat animatedOrientation; + + public final ContentView contentView; + public final FrameLayout controlsLayout; + + public final CropView cropView; + public final CropRotationWheel wheel; + + public final FrameLayout buttonsLayout; + public final TextView cancelButton; + public final TextView resetButton; + public final TextView cropButton; + + private int getCurrentWidth() { + if (entry == null) return 1; + return entry.orientation == 90 || entry.orientation == 270 ? previewView.getContentHeight() : previewView.getContentWidth(); + } + + private int getCurrentHeight() { + if (entry == null) return 1; + return entry.orientation == 90 || entry.orientation == 270 ? previewView.getContentWidth() : previewView.getContentHeight(); + } + + public CropEditor(Context context, PreviewView previewView, Theme.ResourcesProvider resourcesProvider) { + super(context); + this.previewView = previewView; + this.resourcesProvider = resourcesProvider; + + contentView = new ContentView(context); + animatedMirror = new AnimatedFloat(contentView, 0, 320, CubicBezierInterpolator.EASE_OUT_QUINT); + animatedOrientation = new AnimatedFloat(this, 0, 360, CubicBezierInterpolator.EASE_OUT_QUINT); + + cropView = new CropView(context) { + @Override + public int getCurrentWidth() { + return CropEditor.this.getCurrentWidth(); + } + @Override + public int getCurrentHeight() { + return CropEditor.this.getCurrentHeight(); + } + }; + cropView.setListener(new CropView.CropViewListener() { + @Override + public void onChange(boolean reset) { + + } + + @Override + public void onUpdate() { + contentView.invalidate(); + } + + @Override + public void onAspectLock(boolean enabled) { + + } + + @Override + public void onTapUp() { + + } + }); + addView(cropView); + + controlsLayout = new FrameLayout(context); + addView(controlsLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL)); + + wheel = new CropRotationWheel(context); + wheel.setListener(new CropRotationWheel.RotationWheelListener() { + @Override + public void onStart() { + cropView.onRotationBegan(); + } + + @Override + public void onChange(float angle) { + cropView.setRotation(angle); + } + + @Override + public void onEnd(float angle) { + cropView.onRotationEnded(); + } + + @Override + public void aspectRatioPressed() { + cropView.showAspectRatioDialog(); + } + + @Override + public boolean rotate90Pressed() { + boolean r = cropView.rotate(-90); + cropView.maximize(true); + contentView.invalidate(); + return r; + } + + @Override + public boolean mirror() { + contentView.invalidate(); + return cropView.mirror(); + } + }); + controlsLayout.addView(wheel, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER | Gravity.BOTTOM, 0, 0, 0, 52)); + + buttonsLayout = new FrameLayout(context); + controlsLayout.addView(buttonsLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 52, Gravity.BOTTOM, 0, 0, 0, 0)); + + cancelButton = new TextView(context); + cancelButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + cancelButton.setTypeface(AndroidUtilities.bold()); + cancelButton.setBackground(Theme.createSelectorDrawable(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR, 0)); + cancelButton.setTextColor(0xFFFFFFFF); + cancelButton.setText(LocaleController.getString(R.string.Cancel)); + cancelButton.setPadding(dp(12), 0, dp(12), 0); + buttonsLayout.addView(cancelButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.FILL_VERTICAL | Gravity.LEFT)); + cancelButton.setOnClickListener(v -> { + close(); + }); + + resetButton = new TextView(context); + resetButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + resetButton.setTypeface(AndroidUtilities.bold()); + resetButton.setBackground(Theme.createSelectorDrawable(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR, 0)); + resetButton.setTextColor(0xFFFFFFFF); + resetButton.setText(LocaleController.getString(R.string.CropReset)); + resetButton.setPadding(dp(12), 0, dp(12), 0); + buttonsLayout.addView(resetButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.FILL_VERTICAL | Gravity.CENTER_HORIZONTAL)); + resetButton.setOnClickListener(v -> { + cropView.reset(true); + wheel.setRotated(false); + wheel.setMirrored(false); + wheel.setRotation(0, true); + contentView.invalidate(); + }); + + cropButton = new TextView(context); + cropButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + cropButton.setTypeface(AndroidUtilities.bold()); + cropButton.setBackground(Theme.createSelectorDrawable(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR, 0)); + cropButton.setTextColor(0xff199cff); + cropButton.setText(LocaleController.getString(R.string.StoryCrop)); + cropButton.setPadding(dp(12), 0, dp(12), 0); + buttonsLayout.addView(cropButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.FILL_VERTICAL | Gravity.RIGHT)); + cropButton.setOnClickListener(v -> { + apply(); + close(); + }); + } + + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + cropView.setBottomPadding(controlsLayout.getPaddingBottom() + dp(116)); + super.onLayout(changed, left, top, right, bottom); + } + + private float appearProgress = 0.0f; + private final int[] thisLocation = new int[2]; + private final int[] previewLocation = new int[2]; + + private final CropTransform cropTransform = new CropTransform(); + + private StoryEntry entry; + + public void setEntry(StoryEntry entry) { + if (entry == null) return; + this.entry = entry; + + applied = false; + closing = false; + cropView.onShow(); + + getLocationOnScreen(thisLocation); + previewView.getLocationOnScreen(previewLocation); + final MediaController.CropState restoreState = entry.crop != null ? entry.crop : null; + cropView.start(entry.orientation, true, false, cropTransform, restoreState); + wheel.setRotation(cropView.getRotation()); + if (restoreState != null) { + wheel.setRotation(restoreState.cropRotate, false); + wheel.setRotated(restoreState.transformRotation != 0); + wheel.setMirrored(restoreState.mirrored); + animatedMirror.set(restoreState.mirrored, false); + } else { + wheel.setRotation(0, false); + wheel.setRotated(false); + wheel.setMirrored(false); + animatedMirror.set(false, false); + } + cropView.updateMatrix(); + animatedOrientation.set((lastOrientation / 360) * 360 + cropTransform.getOrientation(), true); + + this.contentView.setVisibility(View.VISIBLE); + this.contentView.invalidate(); + previewView.setCropEditorDrawing(this); +// previewView.setVisibility(View.GONE); + } + + public boolean closing; + public void disappearStarts() { + previewView.setCropEditorDrawing(this); + closing = true; + } + + public void stop() { + this.entry = null; + cropView.stop(); + cropView.onHide(); + contentView.setVisibility(View.GONE); + previewView.setCropEditorDrawing(null); +// previewView.setVisibility(View.VISIBLE); + } + + public boolean applied; + public void apply() { + if (entry == null) return; + + applied = true; + + entry.crop = new MediaController.CropState(); + cropView.applyToCropState(entry.crop); + entry.crop.orientation = entry.orientation; + } + + public float getAppearProgress() { + return appearProgress; + } + + public void setAppearProgress(float appearProgress) { + if (Math.abs(this.appearProgress - appearProgress) < 0.001f) return; + this.appearProgress = appearProgress; + contentView.setAlpha(appearProgress); + contentView.invalidate(); + cropView.areaView.setDimAlpha(0.5f * appearProgress); + cropView.areaView.setFrameAlpha(appearProgress); + cropView.areaView.invalidate(); + previewView.invalidate(); + } + + @Override + protected void dispatchDraw(@NonNull Canvas canvas) { + super.dispatchDraw(canvas); + } + + public class ContentView extends View { + public ContentView(Context context) { + super(context); + } + + private final Paint dimPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + + private final Path previewClipPath = new Path(); + private final RectF previewClipRect = new RectF(); + + private final Matrix identityMatrix = new Matrix(); + private final Matrix matrix = new Matrix(); + + private final Matrix previewMatrix = new Matrix(); + private final Matrix cropMatrix = new Matrix(); + private final Matrix clipMatrix = new Matrix(); + private final Matrix invertedClipMatrix = new Matrix(); + + public void drawImage(Canvas canvas, boolean fromPreview) { + if (fromPreview) { + if (appearProgress >= 1) { + return; + } + canvas.saveLayerAlpha(0, 0, previewView.getWidth(), previewView.getHeight(), (int) (0xFF * Math.min(1, (1.0f - appearProgress) * 2)), Canvas.ALL_SAVE_FLAG); + canvas.translate(thisLocation[0] - previewLocation[0], thisLocation[1] - previewLocation[1]); + } + + canvas.save(); + dimPaint.setColor(0xFF000000); + dimPaint.setAlpha((int) (0xFF * appearProgress)); + canvas.drawRect(0, 0, getWidth(), getHeight(), dimPaint); + + if (appearProgress < 1.0f && !fromPreview) { + + previewClipPath.rewind(); + previewClipRect.set(0, 0, previewView.getWidth(), previewView.getHeight()); + previewClipRect.offset(previewLocation[0], previewLocation[1]); + AndroidUtilities.rectTmp.set(0, 0, getWidth(), getHeight()); + lerp(previewClipRect, AndroidUtilities.rectTmp, appearProgress, previewClipRect); + final float r = lerp(dp(12), 0, appearProgress); + previewClipPath.addRoundRect(previewClipRect, r, r, Path.Direction.CW); + + canvas.clipPath(previewClipPath); + } + + final float pa = 1.0f - appearProgress; // preview alpha + final float ca = appearProgress; // crop alpha + + previewMatrix.reset(); + cropMatrix.reset(); + + previewMatrix.preTranslate(-thisLocation[0], -thisLocation[1]); + previewMatrix.preTranslate(previewLocation[0], previewLocation[1]); +// canvas.translate(-thisLocation[0] * pa, -thisLocation[1] * pa); +// canvas.translate(previewLocation[0] * pa, previewLocation[1] * pa); + +// if (pa > 0) { +// float sx = lerp(1.0f, (float) previewView.getWidth() / entry.resultWidth, pa); +// float sy = lerp(1.0f, (float) previewView.getHeight() / entry.resultHeight, pa); +// canvas.scale(sx, sy); +// AndroidUtilities.lerp(identityMatrix, entry.matrix, pa, matrix); +// canvas.concat(matrix); +// canvas.translate(previewView.getContentWidth() / 2.0f * pa, previewView.getContentHeight() / 2.0f * pa); +// } + previewMatrix.preScale((float) previewView.getWidth() / entry.resultWidth, (float) previewView.getHeight() / entry.resultHeight); + previewMatrix.preConcat(entry.matrix); + previewMatrix.preTranslate(previewView.getContentWidth() / 2.0f, previewView.getContentHeight() / 2.0f); + + final boolean inBubbleMode = getContext() instanceof BubbleActivity; + final float paddingTop = (Build.VERSION.SDK_INT >= 21 && !inBubbleMode ? AndroidUtilities.statusBarHeight : 0); + + cropMatrix.preTranslate((dp(16) + getContainerWidth() / 2.0f), (paddingTop + (getContainerHeight() + dp(32)) / 2.0f)); +// canvas.translate((dp(16) + getContainerWidth() / 2.0f) * ca, (paddingTop + (getContainerHeight() + dp(32)) / 2.0f) * ca); + + if (fromPreview) { + AndroidUtilities.lerp(previewMatrix, identityMatrix, appearProgress, clipMatrix); + clipMatrix.preRotate(-entry.orientation); + if (clipMatrix.invert(invertedClipMatrix)) { + final int orientation = entry.orientation + (entry.crop != null ? entry.crop.transformRotation : 0); + final boolean rotated = (orientation / 90) % 2 == 1; + final float w = previewView.getContentWidth(); + final float h = previewView.getContentHeight(); + final float pw = entry.crop != null ? entry.crop.cropPw : 1.0f; + final float ph = entry.crop != null ? entry.crop.cropPh : 1.0f; + final float hw = (rotated ? h : w) * pw / 2.0f; + final float hh = (rotated ? w : h) * ph / 2.0f; + final float s = lerp(1.0f, 4.0f, ca); + canvas.concat(clipMatrix); + canvas.clipRect(-hw * s, -hh * s, hw * s, hh * s); + canvas.concat(invertedClipMatrix); + } + } + + applyCrop(previewMatrix, true); + applyCrop(cropMatrix, false); +// applyCrop(canvas, ca, 1.0f); + float mirror = animatedMirror.set(closing ? (entry.crop != null && entry.crop.mirrored) : cropView.isMirrored()); + cropMatrix.preScale(1 - mirror * 2, 1f); + previewMatrix.preScale(1 - mirror * 2, 1f); +// canvas.scale(1 - mirror * 2, 1f); + cropMatrix.preSkew(0, 4 * mirror * (1f - mirror) * .25f); + previewMatrix.preSkew(0, 4 * mirror * (1f - mirror) * .25f); +// canvas.skew(0, 4 * mirror * (1f - mirror) * .25f); + cropMatrix.preTranslate(-previewView.getContentWidth() / 2.0f, -previewView.getContentHeight() / 2.0f); + previewMatrix.preTranslate(-previewView.getContentWidth() / 2.0f, -previewView.getContentHeight() / 2.0f); +// canvas.translate( +// -previewView.getContentWidth() / 2.0f, +// -previewView.getContentHeight() / 2.0f +// ); + + AndroidUtilities.lerp(previewMatrix, cropMatrix, appearProgress, matrix); + canvas.concat(matrix); + + previewView.drawContent(canvas); + + canvas.restore(); + +// final float originalWidth = 100, originalHeight = 100f / previewView.getContentWidth() * previewView.getContentHeight(); +// cropView.applyToCropState(cropState); +// if (cropState.useMatrix != null) { +// float pw = cropState.cropPw, ph = cropState.cropPh; +// if ((cropState.orientation / 90) % 2 == 1) { +// pw = cropState.cropPh; +// ph = cropState.cropPw; +// } +// float _pw = (1.0f - pw) / 2.0f, _ph = (1.0f - ph) / 2.0f; +// DEBUG_vertices[0] = originalWidth * _pw; +// DEBUG_vertices[1] = originalHeight * _ph; +// DEBUG_vertices[2] = originalWidth * (_pw + pw); +// DEBUG_vertices[3] = originalHeight * _ph; +// DEBUG_vertices[4] = originalWidth * _pw; +// DEBUG_vertices[5] = originalHeight * (_ph + ph); +// DEBUG_vertices[6] = originalWidth * (_pw + pw); +// DEBUG_vertices[7] = originalHeight * (_ph + ph); +// cropState.useMatrix.mapPoints(DEBUG_vertices); +// for (int a = 0; a < 4; a++) { +// DEBUG_vertices[a * 2] = DEBUG_vertices[a * 2] / originalWidth * 2f - 1f; +// DEBUG_vertices[a * 2 + 1] = 1f - DEBUG_vertices[a * 2 + 1] / originalHeight * 2f; +// } +// +// float uvOw = originalWidth, uvOh = originalHeight; +// DEBUG_uv[0] = uvOw*pw*-0.5f; +// DEBUG_uv[1] = uvOh*ph*-0.5f; +// DEBUG_uv[2] = uvOw*pw*+0.5f; +// DEBUG_uv[3] = uvOh*ph*-0.5f; +// DEBUG_uv[4] = uvOw*pw*-0.5f; +// DEBUG_uv[5] = uvOh*ph*+0.5f; +// DEBUG_uv[6] = uvOw*pw*+0.5f; +// DEBUG_uv[7] = uvOh*ph*+0.5f; +// float angle = (float) (-cropState.cropRotate * (Math.PI / 180.0f)); +// for (int a = 0; a < 4; ++a) { +// float x = DEBUG_uv[a * 2 + 0], y = DEBUG_uv[a * 2 + 1]; +// x -= cropState.cropPx * uvOw; +// y -= cropState.cropPy * uvOh; +// float x2 = (float) (x * Math.cos(angle) - y * Math.sin(angle)) / uvOw; +// float y2 = (float) (x * Math.sin(angle) + y * Math.cos(angle)) / uvOh; +// x2 /= cropState.cropScale; +// y2 /= cropState.cropScale; +// x2 += 0.5f; +// y2 += 0.5f; +// DEBUG_uv[a * 2 + 0] = x2; +// DEBUG_uv[a * 2 + 1] = y2; +// } +// +// final float cx = getWidth() / 2.0f, cy = getHeight() / 2.0f; +// canvas.save(); +// canvas.translate(cx-originalWidth/2.0f, cy-originalHeight/2.0f); +// DEBUG_path.rewind(); +// DEBUG_path.moveTo(DEBUG_uv[0] * originalWidth, DEBUG_uv[1] * originalHeight); +// DEBUG_path.lineTo(DEBUG_uv[2] * originalWidth, DEBUG_uv[3] * originalHeight); +// DEBUG_path.lineTo(DEBUG_uv[4] * originalWidth, DEBUG_uv[5] * originalHeight); +// DEBUG_path.lineTo(DEBUG_uv[6] * originalWidth, DEBUG_uv[7] * originalHeight); +// DEBUG_path.close(); +// canvas.drawRect(0,0,originalWidth,originalHeight,Theme.DEBUG_BLUE); +// canvas.drawPath(DEBUG_path, Theme.DEBUG_RED); +// canvas.restore(); +// } + + if (fromPreview) { + canvas.restore(); + } + } + + @Override + protected void dispatchDraw(@NonNull Canvas canvas) { + if (entry == null) return; + drawImage(canvas, false); + } + +// private final MediaController.CropState cropState = new MediaController.CropState(); +// private float[] DEBUG_vertices = new float[8]; +// private float[] DEBUG_uv = new float[8]; +// private final Path DEBUG_path = new Path(); + + private float getContainerWidth() { + return getWidth() - dp(32); + } + + private float getContainerHeight() { + final boolean inBubbleMode = getContext() instanceof BubbleActivity; + final float paddingTop = (Build.VERSION.SDK_INT >= 21 && !inBubbleMode ? AndroidUtilities.statusBarHeight : 0); + final float paddingBottom = cropView.bottomPadding; + return getHeight() - paddingTop - paddingBottom - dp(32); + } + + private void applyCrop(Matrix matrix, boolean preview) { + int originalWidth = getCurrentWidth(); + int originalHeight = getCurrentHeight(); + + int rotatedWidth = originalWidth; + int rotatedHeight = originalHeight; + int orientation = cropTransform.getOrientation(); + if (orientation == 90 || orientation == 270) { + int temp = rotatedWidth; + rotatedWidth = rotatedHeight; + rotatedHeight = temp; + } + + float trueScale = 1.0f + (cropTransform.getTrueCropScale() - 1.0f) * (preview ? 1.0f : 0.0f); + float scaleToFit = (getContainerWidth()) / (float) rotatedWidth; + if (scaleToFit * rotatedHeight > (getContainerHeight())) { + scaleToFit = (getContainerHeight()) / (float) rotatedHeight; + } + + boolean orientedRotate = (entry.orientation / 90) % 2 == 1; + matrix.preTranslate(cropTransform.getCropAreaX(), cropTransform.getCropAreaY()); + float s = (cropTransform.getScale() / trueScale) * scaleToFit; + if (entry != null && entry.crop != null) { + if (preview) s = entry.crop.cropScale; + } else { + if (preview) s = 1.0f; + } + matrix.preScale(s, s); + float px = cropTransform.getCropPx(), py = cropTransform.getCropPy(); + if (closing) { + if (preview) { + px = entry.crop == null ? 0 : !orientedRotate ? entry.crop.cropPx : entry.crop.cropPy; + py = entry.crop == null ? 0 : !orientedRotate ? entry.crop.cropPy : entry.crop.cropPx; + } + } + matrix.preTranslate(px * rotatedWidth, py * rotatedHeight); + float rotate = entry.orientation + cropTransform.getRotation() + orientation;//animatedOrientation.set((lastOrientation / 360) * 360 + orientation); + if (entry.crop == null) { + if (preview) rotate = 0; + } else { + if (preview) rotate = entry.crop.cropRotate + entry.crop.transformRotation; + } + matrix.preRotate(rotate); + } + + private void applyCrop(Canvas canvas, float scaleAlpha, float alpha) { + int originalWidth = getCurrentWidth(); + int originalHeight = getCurrentHeight(); + + int rotatedWidth = originalWidth; + int rotatedHeight = originalHeight; + int orientation = cropTransform.getOrientation(); + if (orientation == 90 || orientation == 270) { + int temp = rotatedWidth; + rotatedWidth = rotatedHeight; + rotatedHeight = temp; + } + + float trueScale = 1.0f + (cropTransform.getTrueCropScale() - 1.0f) * (1.0f - scaleAlpha); + float scaleToFit = (getContainerWidth()) / (float) rotatedWidth; + if (scaleToFit * rotatedHeight > (getContainerHeight())) { + scaleToFit = (getContainerHeight()) / (float) rotatedHeight; + } + + boolean orientedRotate = (entry.orientation / 90) % 2 == 1; + canvas.translate(cropTransform.getCropAreaX() * alpha, cropTransform.getCropAreaY() * alpha); + float s = (cropTransform.getScale() / trueScale) * scaleToFit; + if (entry != null && entry.crop != null) { + s = lerp(entry.crop.cropScale, s, scaleAlpha); + } else { + s = lerp(1.0f, s, scaleAlpha); + } + canvas.scale(s, s); + float px = cropTransform.getCropPx(), py = cropTransform.getCropPy(); + if (closing) { + px = lerp(entry.crop == null ? 0 : !orientedRotate ? entry.crop.cropPx : entry.crop.cropPy, px, appearProgress); + py = lerp(entry.crop == null ? 0 : !orientedRotate ? entry.crop.cropPy : entry.crop.cropPx, py, appearProgress); + } + canvas.translate(px * rotatedWidth, py * rotatedHeight); + float rotate = entry.orientation + cropTransform.getRotation() + animatedOrientation.set((lastOrientation / 360) * 360 + orientation); + if (entry.crop == null) { + rotate = lerp(0, rotate, appearProgress); + } else { + rotate = lerp(entry.crop.cropRotate + entry.crop.transformRotation, rotate, appearProgress); + } + canvas.rotate(rotate); + } + } + + protected void close() { + + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/CropInlineEditor.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/CropInlineEditor.java new file mode 100644 index 0000000000..3fd379f281 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/CropInlineEditor.java @@ -0,0 +1,456 @@ +package org.telegram.ui.Stories.recorder; + +import static org.telegram.messenger.AndroidUtilities.dp; +import static org.telegram.messenger.AndroidUtilities.lerp; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Matrix; +import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.RectF; +import android.os.Build; +import android.util.Log; +import android.util.TypedValue; +import android.view.Gravity; +import android.view.View; +import android.widget.FrameLayout; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MediaController; +import org.telegram.messenger.R; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.BubbleActivity; +import org.telegram.ui.Components.AnimatedFloat; +import org.telegram.ui.Components.Crop.CropRotationWheel; +import org.telegram.ui.Components.Crop.CropTransform; +import org.telegram.ui.Components.Crop.CropView; +import org.telegram.ui.Components.CubicBezierInterpolator; +import org.telegram.ui.Components.LayoutHelper; +import org.telegram.ui.Components.Paint.Views.PhotoView; + +public class CropInlineEditor extends FrameLayout { + + private final Theme.ResourcesProvider resourcesProvider; + private final PreviewView previewContainer; + private PhotoView photoView; + + private final AnimatedFloat animatedMirror; + private int lastOrientation = 0; + private final AnimatedFloat animatedOrientation; + public final ContentView contentView; + public final FrameLayout controlsLayout; + + public final CropView cropView; + public final CropRotationWheel wheel; + + public final FrameLayout buttonsLayout; + public final TextView cancelButton; + public final TextView resetButton; + public final TextView cropButton; + + public final LinearLayout shapesLayout; + + private int getCurrentWidth() { + if (photoView == null) return 1; + return photoView.getOrientation() == 90 || photoView.getOrientation() == 270 ? photoView.getContentHeight() : photoView.getContentWidth(); + } + + private int getCurrentHeight() { + if (photoView == null) return 1; + return photoView.getOrientation() == 90 || photoView.getOrientation() == 270 ? photoView.getContentWidth() : photoView.getContentHeight(); + } + + public CropInlineEditor(Context context, PreviewView previewView, Theme.ResourcesProvider resourcesProvider) { + super(context); + this.previewContainer = previewView; + this.resourcesProvider = resourcesProvider; + + contentView = new ContentView(context); + animatedMirror = new AnimatedFloat(contentView, 0, 320, CubicBezierInterpolator.EASE_OUT_QUINT); + animatedOrientation = new AnimatedFloat(contentView, 0, 320, CubicBezierInterpolator.EASE_OUT_QUINT); + + cropView = new CropView(context) { + @Override + public int getCurrentWidth() { + return CropInlineEditor.this.getCurrentWidth(); + } + @Override + public int getCurrentHeight() { + return CropInlineEditor.this.getCurrentHeight(); + } + }; + cropView.setListener(new CropView.CropViewListener() { + @Override + public void onChange(boolean reset) { + + } + + @Override + public void onUpdate() { + contentView.invalidate(); + } + + @Override + public void onAspectLock(boolean enabled) { + + } + + @Override + public void onTapUp() { + + } + }); + addView(cropView); + + controlsLayout = new FrameLayout(context); + addView(controlsLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL)); + + wheel = new CropRotationWheel(context); + wheel.setListener(new CropRotationWheel.RotationWheelListener() { + @Override + public void onStart() { + cropView.onRotationBegan(); + } + + @Override + public void onChange(float angle) { + cropView.setRotation(angle); + } + + @Override + public void onEnd(float angle) { + cropView.onRotationEnded(); + } + + @Override + public void aspectRatioPressed() { + cropView.showAspectRatioDialog(); + } + + @Override + public boolean rotate90Pressed() { + boolean r = cropView.rotate(-90); + cropView.maximize(true); + contentView.invalidate(); + return r; + } + + @Override + public boolean mirror() { + contentView.invalidate(); + return cropView.mirror(); + } + }); + controlsLayout.addView(wheel, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER | Gravity.BOTTOM, 0, 0, 0, 52)); + + buttonsLayout = new FrameLayout(context); + controlsLayout.addView(buttonsLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 52, Gravity.BOTTOM, 0, 0, 0, 0)); + + cancelButton = new TextView(context); + cancelButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + cancelButton.setTypeface(AndroidUtilities.bold()); + cancelButton.setBackground(Theme.createSelectorDrawable(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR, 0)); + cancelButton.setTextColor(0xFFFFFFFF); + cancelButton.setText(LocaleController.getString(R.string.Cancel)); + cancelButton.setPadding(dp(12), 0, dp(12), 0); + buttonsLayout.addView(cancelButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.FILL_VERTICAL | Gravity.LEFT)); + cancelButton.setOnClickListener(v -> { + close(); + }); + + resetButton = new TextView(context); + resetButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + resetButton.setTypeface(AndroidUtilities.bold()); + resetButton.setBackground(Theme.createSelectorDrawable(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR, 0)); + resetButton.setTextColor(0xFFFFFFFF); + resetButton.setText(LocaleController.getString(R.string.CropReset)); + resetButton.setPadding(dp(12), 0, dp(12), 0); + buttonsLayout.addView(resetButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.FILL_VERTICAL | Gravity.CENTER_HORIZONTAL)); + resetButton.setOnClickListener(v -> { + cropView.reset(true); + wheel.setRotated(false); + wheel.setMirrored(false); + wheel.setRotation(0, true); + }); + + cropButton = new TextView(context); + cropButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + cropButton.setTypeface(AndroidUtilities.bold()); + cropButton.setBackground(Theme.createSelectorDrawable(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR, 0)); + cropButton.setTextColor(0xff199cff); + cropButton.setText(LocaleController.getString(R.string.StoryCrop)); + cropButton.setPadding(dp(12), 0, dp(12), 0); + buttonsLayout.addView(cropButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.FILL_VERTICAL | Gravity.RIGHT)); + cropButton.setOnClickListener(v -> { + apply(); + close(); + }); + + shapesLayout = new LinearLayout(context); + + } + + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + cropView.setTopPadding(dp(52)); + cropView.setBottomPadding(controlsLayout.getPaddingBottom() + dp(116)); + super.onLayout(changed, left, top, right, bottom); + } + + private float appearProgress = 0.0f; + private final int[] thisLocation = new int[2]; + private final int[] previewLocation = new int[2]; + private final int[] photoViewLocation = new int[2]; + + private final CropTransform cropTransform = new CropTransform(); + + public void set(PhotoView photoView) { + if (photoView == null) return; + this.photoView = photoView; + setVisibility(View.VISIBLE); + + applied = false; + closing = false; + cropView.onShow(); + + getLocationOnScreen(thisLocation); + previewContainer.getLocationOnScreen(previewLocation); + photoView.getLocationOnScreen(photoViewLocation); + + final MediaController.CropState restoreState = photoView.crop != null ? photoView.crop : null; + cropView.start(photoView.getOrientation(), true, false, cropTransform, restoreState); + wheel.setRotation(cropView.getRotation()); + if (restoreState != null) { + wheel.setRotation(restoreState.cropRotate, false); + wheel.setRotated(restoreState.transformRotation != 0); + wheel.setMirrored(restoreState.mirrored); + animatedMirror.set(restoreState.mirrored, false); + } else { + wheel.setRotation(0, false); + wheel.setRotated(false); + wheel.setMirrored(false); + animatedMirror.set(false, false); + } + cropView.updateMatrix(); + + this.contentView.setVisibility(View.VISIBLE); + this.contentView.invalidate(); + } + + public boolean closing; + public void disappearStarts() { + closing = true; + } + + public void stop() { + this.photoView = null; + cropView.stop(); + cropView.onHide(); + contentView.setVisibility(View.GONE); + setVisibility(View.GONE); +// previewView.setVisibility(View.VISIBLE); + } + + public boolean applied; + public void apply() { + if (photoView == null) return; + + applied = true; + + photoView.crop = new MediaController.CropState(); + cropView.applyToCropState(photoView.crop); + photoView.crop.orientation = photoView.getOrientation(); + photoView.updatePosition(); + photoView.requestLayout(); + photoView.containerView.requestLayout(); + photoView.containerView.invalidate(); + photoView.containerView.post(() -> { + if (photoView.selectionView != null) { + photoView.selectionView.updatePosition(); + } + photoView.updatePosition(); + }); + } + + public float getAppearProgress() { + return appearProgress; + } + + public void setAppearProgress(float appearProgress) { + if (Math.abs(this.appearProgress - appearProgress) < 0.001f) return; + this.appearProgress = appearProgress; + this.contentView.invalidate(); + + cropView.areaView.setDimAlpha(0.5f * appearProgress); + cropView.areaView.setFrameAlpha(appearProgress); + cropView.areaView.invalidate(); + } + + @Override + protected void dispatchDraw(@NonNull Canvas canvas) { + super.dispatchDraw(canvas); + } + + public class ContentView extends View { + public ContentView(Context context) { + super(context); + } + + private final Paint dimPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + + private final Path previewClipPath = new Path(); + private final RectF previewClipRect = new RectF(); + + private final Matrix previewMatrix = new Matrix(); + private final Matrix identityMatrix = new Matrix(); + private final Matrix matrix = new Matrix(); + + @Override + protected void dispatchDraw(@NonNull Canvas canvas) { + if (photoView == null) return; + +// canvas.save(); +// canvas.translate(-thisLocation[0], -thisLocation[1]); +// canvas.translate(previewLocation[0], previewLocation[1]); +// +// previewClipPath.rewind(); +// previewClipRect.set(0, 0, previewView.getWidth(), previewView.getHeight()); +// previewClipPath.addRoundRect(previewClipRect, dp(12), dp(12), Path.Direction.CW); +// canvas.clipPath(previewClipPath); +// previewView.drawBackground(canvas); +// +// canvas.restore(); + + canvas.save(); + dimPaint.setColor(0xFF000000); + dimPaint.setAlpha((int) (0xFF * appearProgress)); + canvas.drawRect(0, 0, getWidth(), getHeight(), dimPaint); + + if (appearProgress < 1.0f) { + previewClipPath.rewind(); + previewClipRect.set(0, 0, previewContainer.getWidth(), previewContainer.getHeight()); + previewClipRect.offset(previewLocation[0], previewLocation[1]); + AndroidUtilities.rectTmp.set(0, 0, getWidth(), getHeight()); + lerp(previewClipRect, AndroidUtilities.rectTmp, appearProgress, previewClipRect); + final float r = lerp(dp(12), 0, appearProgress); + previewClipPath.addRoundRect(previewClipRect, r, r, Path.Direction.CW); + + canvas.clipPath(previewClipPath); + } + + final float pa = 1.0f - appearProgress; // preview alpha + final float ca = appearProgress; // crop alpha + + canvas.translate(-thisLocation[0] * pa, -thisLocation[1] * pa); + + if (pa > 0) { + if (closing) { + photoView.getLocationOnScreen(photoViewLocation); + } + canvas.translate((photoViewLocation[0]) * pa, (photoViewLocation[1]) * pa); + float pw = 1.0f, ph = 1.0f; + if (photoView.crop != null) { + pw = photoView.crop.cropPw; + ph = photoView.crop.cropPh; + } + final float s = lerp(1.0f, (float) photoView.getWidth() / pw * photoView.getScaleX() / previewContainer.getWidth(), pa); + canvas.scale(s, s); + canvas.rotate(photoView.getRotation() * pa); + canvas.translate(photoView.getContentWidth() * pw / 2.0f * pa, photoView.getContentHeight() * ph / 2.0f * pa); + } + + final boolean inBubbleMode = getContext() instanceof BubbleActivity; + final float paddingTop = cropView.topPadding + (Build.VERSION.SDK_INT >= 21 && !inBubbleMode ? AndroidUtilities.statusBarHeight : 0); + + canvas.translate((dp(16) + getContainerWidth() / 2.0f) * ca, (paddingTop + (getContainerHeight() + dp(32)) / 2.0f) * ca); + + if (pa > 0) { + final float w = photoView.getContentWidth(); + final float h = photoView.getContentHeight(); + final float pw = photoView.crop != null ? photoView.crop.cropPw : 1.0f; + final float ph = photoView.crop != null ? photoView.crop.cropPh : 1.0f; + final float hw = w * lerp(1.0f, pw, pa) / 2.0f; + final float hh = h * lerp(1.0f, ph, pa) / 2.0f; + final float s = lerp(1.0f, 4.0f, ca); + canvas.clipRect(-hw * s, -hh * s, hw * s, hh * s); + } + + applyCrop(canvas, ca, pa, 1.0f); + canvas.rotate(photoView.getOrientation()); + float mirror = animatedMirror.set(closing ? (photoView.crop != null && photoView.crop.mirrored) : cropView.isMirrored()); + canvas.scale(lerp(1.0f, -1.0f, mirror), 1.0f); + canvas.translate(-photoView.getContentWidth() / 2.0f, -photoView.getContentHeight() / 2.0f); + + photoView.drawContent(canvas); + + canvas.restore(); + } + + private float getContainerWidth() { + return getWidth() - dp(32); + } + + private float getContainerHeight() { + final boolean inBubbleMode = getContext() instanceof BubbleActivity; + final float paddingTop = cropView.topPadding + (Build.VERSION.SDK_INT >= 21 && !inBubbleMode ? AndroidUtilities.statusBarHeight : 0); + final float paddingBottom = cropView.bottomPadding; + return getHeight() - paddingTop - paddingBottom - dp(32); + } + + private void applyCrop(Canvas canvas, float scaleAlpha, float clipAlpha, float alpha) { + final float scale = 1.0f; + + int originalWidth = getCurrentWidth(); + int originalHeight = getCurrentHeight(); + + int rotatedWidth = originalWidth; + int rotatedHeight = originalHeight; + int orientation = cropTransform.getOrientation(); + if (orientation == 90 || orientation == 270) { + int temp = rotatedWidth; + rotatedWidth = rotatedHeight; + rotatedHeight = temp; + } + + float trueScale = 1.0f + (cropTransform.getTrueCropScale() - 1.0f) * (1.0f - scaleAlpha); + float scaleToFit = (getContainerWidth()) / (float) rotatedWidth; + if (scaleToFit * rotatedHeight > (getContainerHeight())) { + scaleToFit = (getContainerHeight()) / (float) rotatedHeight; + } + + canvas.translate(cropTransform.getCropAreaX() * alpha, cropTransform.getCropAreaY() * alpha); + float s = (cropTransform.getScale() / trueScale) * scaleToFit; + if (photoView != null && photoView.crop != null) { + s = lerp(photoView.crop.cropScale, s, scaleAlpha); + } else { + s = lerp(1.0f, s, scaleAlpha); + } + canvas.scale(s, s); + canvas.translate(cropTransform.getCropPx() * rotatedWidth * alpha, cropTransform.getCropPy() * rotatedHeight * alpha); + float rotate = photoView.getOrientation() + cropTransform.getRotation() + animatedOrientation.set((lastOrientation / 360) * 360 + orientation); +// if (lastOrientation != orientation) { +// if ((lastOrientation / 360) * 360 + orientation < lastOrientation) { +// lastOrientation = ((lastOrientation / 360 + 1) * 360) + orientation; +// } else { +// lastOrientation = (lastOrientation / 360) * 360 + orientation; +// } +// } + if (photoView.crop == null) { + rotate = lerp(0, rotate, appearProgress); + } else { + rotate = lerp(photoView.crop.cropRotate + photoView.crop.transformRotation, rotate, appearProgress); + } + canvas.rotate(rotate); + } + } + + protected void close() { + + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/DraftsController.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/DraftsController.java index 07950b815e..aae6836e95 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/DraftsController.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/DraftsController.java @@ -470,6 +470,7 @@ public static class StoryDraft { public int orientation, invert; public int width, height; + public MediaController.CropState crop; public int resultWidth, resultHeight; public long duration; @@ -542,6 +543,7 @@ public StoryDraft(@NonNull StoryEntry entry) { this.invert = entry.invert; this.width = entry.width; this.height = entry.height; + this.crop = entry.crop; this.resultWidth = entry.resultWidth; this.resultHeight = entry.resultHeight; this.duration = entry.duration; @@ -620,6 +622,7 @@ public StoryEntry toEntry() { entry.invert = invert; entry.width = width; entry.height = height; + entry.crop = crop; entry.resultWidth = resultWidth; entry.resultHeight = resultHeight; entry.matrix.setValues(matrixValues); @@ -833,6 +836,12 @@ public void toStream(AbstractSerializedData stream) { part.serializeToStream(stream); } } + + if (crop == null) { + stream.writeInt32(TLRPC.TL_null.constructor); + } else { + crop.serializeToStream(stream); + } } public int getObjectSize() { @@ -1039,6 +1048,13 @@ public StoryDraft(@NonNull AbstractSerializedData stream, boolean exception) { } } } + if (stream.remaining() > 0) { + magic = stream.readInt32(exception); + if (magic == MediaController.CropState.constructor) { + crop = new MediaController.CropState(); + crop.readParams(stream, exception); + } + } } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/DualCameraView.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/DualCameraView.java index 5945fff33f..c4ce67f972 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/DualCameraView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/DualCameraView.java @@ -215,11 +215,13 @@ private boolean checkTap(MotionEvent ev) { AndroidUtilities.runOnUIThread(longpressRunnable = () -> { if (tapTime > 0) { this.dualToggleShape(); - performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); + try { + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); + } catch (Exception ignored) {} } }, ViewConfiguration.getLongPressTimeout()); + return true; } - return true; } else if (ev.getAction() == MotionEvent.ACTION_UP) { if (System.currentTimeMillis() - tapTime <= ViewConfiguration.getTapTimeout() && MathUtils.distance(tapX, tapY, ev.getX(), ev.getY()) < AndroidUtilities.dp(10)) { if (isAtDual(tapX, tapY)) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/EmojiBottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/EmojiBottomSheet.java index b7bf5c3d4b..196b24873a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/EmojiBottomSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/EmojiBottomSheet.java @@ -56,7 +56,6 @@ import androidx.recyclerview.widget.LinearSmoothScrollerCustom; import androidx.recyclerview.widget.RecyclerView; -import org.checkerframework.checker.units.qual.A; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.Emoji; import org.telegram.messenger.FileLoader; @@ -740,7 +739,7 @@ public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newStat }); addView(searchField, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP)); - tabsStrip = new EmojiTabsStrip(context, resourcesProvider, false, false, true, 0, null) { + tabsStrip = new EmojiTabsStrip(context, resourcesProvider, false, false, false, true, 0, null) { @Override protected boolean onTabClick(int index) { if (scrollingAnimation) { @@ -1419,7 +1418,9 @@ public int getItemCount() { } public void showPremiumBulletin(String text) { - container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} BulletinFactory.of(container, resourcesProvider).createSimpleBulletin( R.raw.star_premium_2, LocaleController.getString(R.string.IncreaseLimit), diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/FlashViews.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/FlashViews.java index 277633925a..4396c2ca02 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/FlashViews.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/FlashViews.java @@ -66,7 +66,7 @@ public static int getColor(float warmth) { @Nullable private final WindowManager.LayoutParams windowViewParams; - public FlashViews(Context context, @Nullable WindowManager windowManager, View windowView, @Nullable WindowManager.LayoutParams windowViewParams) { + public FlashViews(Context context, @Nullable WindowManager windowManager, @Nullable View windowView, @Nullable WindowManager.LayoutParams windowViewParams) { this.context = context; this.windowManager = windowManager; this.windowView = windowView; @@ -113,7 +113,7 @@ public void flash(Utilities.Callback> takePicture) } private void setScreenBrightness(float value) { - if (windowViewParams != null) { + if (windowView != null && windowViewParams != null) { windowViewParams.screenBrightness = value; if (windowManager != null) { windowManager.updateViewLayout(windowView, windowViewParams); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/GalleryListView.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/GalleryListView.java index d22ae684d2..12e9d8f6cf 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/GalleryListView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/GalleryListView.java @@ -2,6 +2,7 @@ import static org.telegram.messenger.AndroidUtilities.dp; import static org.telegram.messenger.AndroidUtilities.dpf2; +import static org.telegram.messenger.LocaleController.getString; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -33,6 +34,7 @@ import android.util.Pair; import android.util.TypedValue; import android.view.Gravity; +import android.view.HapticFeedbackConstants; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; @@ -47,7 +49,10 @@ import androidx.recyclerview.widget.LinearSmoothScrollerCustom; import androidx.recyclerview.widget.RecyclerView; +import com.google.android.exoplayer2.scheduler.RequirementsWatcher; + import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.BotWebViewVibrationEffect; import org.telegram.messenger.DispatchQueue; import org.telegram.messenger.FileLoader; import org.telegram.messenger.ImageLocation; @@ -68,11 +73,13 @@ import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Components.AnimatedFloat; import org.telegram.ui.Components.BackupImageView; +import org.telegram.ui.Components.CheckBox2; import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.EditTextBoldCursor; import org.telegram.ui.Components.FlickerLoadingView; import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.Components.RecyclerListView; +import org.telegram.ui.Components.ScaleStateListAnimator; import org.telegram.ui.Components.StickerEmptyView; import java.io.File; @@ -105,11 +112,21 @@ public class GalleryListView extends FrameLayout implements NotificationCenter.N private final ActionBarMenuItem dropDownContainer; private final ActionBarMenuItem searchItem; + private final ImageView selectButton; + public boolean ignoreScroll; public final boolean onlyPhotos; + private int shiftDp = -2; + + private final float ASPECT_RATIO; public GalleryListView(int currentAccount, Context context, Theme.ResourcesProvider resourcesProvider, MediaController.AlbumEntry startAlbum, boolean onlyPhotos) { + this(currentAccount, context, resourcesProvider, startAlbum, onlyPhotos, 1.39f); + } + public GalleryListView(int currentAccount, Context context, Theme.ResourcesProvider resourcesProvider, MediaController.AlbumEntry startAlbum, boolean onlyPhotos, float aspectRatio) { super(context); + + this.ASPECT_RATIO = aspectRatio; this.currentAccount = currentAccount; this.resourcesProvider = resourcesProvider; this.onlyPhotos = onlyPhotos; @@ -185,11 +202,63 @@ public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull R index -= drafts.size(); } - if (index >= 0 && index < selectedPhotos.size()) { - MediaController.PhotoEntry entry = selectedPhotos.get(index); - onSelectListener.run(entry, entry.isVideo ? prepareBlurredThumb(cell) : null); + if (index >= 0 && index < photos.size()) { + MediaController.PhotoEntry entry = photos.get(index); + if (isMultiple()) { + if (selectedPhotos.contains(entry)) { + selectedPhotos.remove(entry); + } else { + if (selectedPhotos.size() + 1 > maxCount) { + AndroidUtilities.shakeViewSpring(cell, shiftDp = -shiftDp); + BotWebViewVibrationEffect.APP_ERROR.vibrate(); + return; + } + selectedPhotos.add(entry); + } + AndroidUtilities.updateVisibleRows(listView); + updateSelectButtonVisible(); + } else { + onSelectListener.run(entry, entry.isVideo ? prepareBlurredThumb(cell) : null); + } } }); + listView.setOnItemLongClickListener((view, position) -> { + if (position < 2 || onSelectListener == null || !(view instanceof Cell)) { + return false; + } + int index = position - 2; + if (containsDraftFolder) { + if (index == 0) { + return false; + } + index--; + } else if (containsDrafts) { + if (index >= 0 && index < drafts.size()) { + return false; + } + index -= drafts.size(); + } + + if (index >= 0 && index < photos.size()) { + MediaController.PhotoEntry entry = photos.get(index); + if (selectedPhotos.isEmpty() && !multipleOnClick) { + if (selectedPhotos.contains(entry)) { + selectedPhotos.remove(entry); + } else { + if (selectedPhotos.size() + 1 > maxCount) { + AndroidUtilities.shakeViewSpring(view, shiftDp = -shiftDp); + BotWebViewVibrationEffect.APP_ERROR.vibrate(); + return true; + } + selectedPhotos.add(entry); + } + AndroidUtilities.updateVisibleRows(listView); + updateSelectButtonVisible(); + return true; + } + } + return false; + }); listView.setOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { @@ -269,7 +338,7 @@ public void notifyDataSetChanged() { super.notifyDataSetChanged(); if (TextUtils.isEmpty(query)) { searchEmptyView.setStickerType(StickerEmptyView.STICKER_TYPE_ALBUM); - searchEmptyView.title.setText(LocaleController.getString(R.string.SearchImagesType)); + searchEmptyView.title.setText(getString(R.string.SearchImagesType)); } else { searchEmptyView.setStickerType(StickerEmptyView.STICKER_TYPE_SEARCH); searchEmptyView.title.setText(LocaleController.formatString(R.string.NoResultFoundFor, query)); @@ -313,7 +382,7 @@ public int getColumnsCount() { searchEmptyView.title.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); searchEmptyView.title.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText, resourcesProvider)); searchEmptyView.title.setTypeface(null); - searchEmptyView.title.setText(LocaleController.getString(R.string.SearchImagesType)); + searchEmptyView.title.setText(getString(R.string.SearchImagesType)); keyboardNotifier = new KeyboardNotifier(this, h -> searchEmptyView.animate().translationY(-h / 2f + dp(80)).setDuration(AdjustPanLayoutHelper.keyboardDuration).setInterpolator(AdjustPanLayoutHelper.keyboardInterpolator).start()); searchContainer.addView(searchEmptyView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL)); searchListView.setEmptyView(searchEmptyView); @@ -417,7 +486,7 @@ public void onTextChanged(EditText editText) { } }); searchItem.setVisibility(View.GONE); - searchItem.setSearchFieldHint(LocaleController.getString(R.string.SearchImagesTitle)); + searchItem.setSearchFieldHint(getString(R.string.SearchImagesTitle)); searchListView.setOnItemClickListener((view, position) -> { if (searchItem != null) { @@ -441,6 +510,28 @@ public void onTextChanged(EditText editText) { } } + selectButton = new ImageView(context); + selectButton.setScaleType(ImageView.ScaleType.CENTER); + selectButton.setImageResource(R.drawable.floating_check); + selectButton.setBackground(Theme.createCircleDrawable(dp(56), Theme.getColor(Theme.key_featuredStickers_addButton, resourcesProvider))); + ScaleStateListAnimator.apply(selectButton, 0.1f, 1.5f); + addView(selectButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | Gravity.RIGHT, 0, 0, 14, 14)); + selectButton.setOnClickListener(v -> { + if (onSelectMultipleListener != null && !selectedPhotos.isEmpty()) { + ArrayList blurredBitmaps = new ArrayList<>(); + for (MediaController.PhotoEntry entry : selectedPhotos) { + blurredBitmaps.add(entry.isVideo ? prepareBlurredThumb(findCell(entry)) : null); + } + onSelectMultipleListener.run(new ArrayList<>(selectedPhotos), blurredBitmaps); + selectedPhotos.clear(); + AndroidUtilities.updateVisibleRows(listView); + updateSelectButtonVisible(); + } + }); + selectButton.setAlpha(0.0f); + selectButton.setScaleX(0.7f); + selectButton.setScaleY(0.7f); + updateAlbumsDropDown(); if (startAlbum != null && (startAlbum != draftsAlbum || drafts.size() > 0)) { selectedAlbum = startAlbum; @@ -451,17 +542,32 @@ public void onTextChanged(EditText editText) { selectedAlbum = dropDownAlbums.get(0); } } - selectedPhotos = getPhotoEntries(selectedAlbum); + photos = getPhotoEntries(selectedAlbum); updateContainsDrafts(); if (selectedAlbum == MediaController.allMediaAlbumEntry) { - dropDown.setText(LocaleController.getString(R.string.ChatGallery)); + dropDown.setText(getString(R.string.ChatGallery)); } else if (selectedAlbum == draftsAlbum) { - dropDown.setText(LocaleController.getString("StoryDraftsAlbum")); + dropDown.setText(getString(R.string.StoryDraftsAlbum)); } else { dropDown.setText(selectedAlbum.bucketName); } } + private boolean multipleOnClick; + private int maxCount; + public void setMultipleOnClick(boolean multiple) { + if (this.multipleOnClick != multiple) { + this.multipleOnClick = multiple; + AndroidUtilities.updateVisibleRows(listView); + } + } + public void setMaxCount(int maxCount) { + this.maxCount = maxCount; + } + public boolean isMultiple() { + return !selectedPhotos.isEmpty() || multipleOnClick; + } + public void allowSearch(boolean allow) { searchItem.setVisibility(allow ? View.VISIBLE : View.GONE); } @@ -538,6 +644,7 @@ public MediaController.AlbumEntry getSelectedAlbum() { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { listView.setPinnedSectionOffsetY(AndroidUtilities.statusBarHeight + ActionBar.getCurrentActionBarHeight()); listView.setPadding(dp(6), AndroidUtilities.statusBarHeight + ActionBar.getCurrentActionBarHeight(), dp(1), AndroidUtilities.navigationBarHeight); + selectButton.setTranslationY(-AndroidUtilities.navigationBarHeight); FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) searchContainer.getLayoutParams(); lp.leftMargin = 0; lp.topMargin = AndroidUtilities.statusBarHeight + ActionBar.getCurrentActionBarHeight(); @@ -548,7 +655,31 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } + public void updateSelectButtonVisible() { + final boolean visible = !selectedPhotos.isEmpty(); + selectButton.animate() + .alpha(visible ? 1.0f : 0.0f) + .scaleX(visible ? 1.0f : 0.7f) + .scaleY(visible ? 1.0f : 0.7f) + .translationY(visible ? -AndroidUtilities.navigationBarHeight : +dp(8)) + .setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT) + .setDuration(320) + .start(); + } + + private Cell findCell(MediaController.PhotoEntry entry) { + for (int i = 0; i < listView.getChildCount(); ++i) { + View child = listView.getChildAt(i); + if (child instanceof Cell && ((Cell) child).currentObject == entry) + return (Cell) child; + } + return null; + } + private Bitmap prepareBlurredThumb(Cell cell) { + if (cell == null) { + return null; + } Bitmap bitmap = cell.bitmap; if (bitmap != null && !bitmap.isRecycled()) { return Utilities.stackBlurBitmapWithScaleFactor(bitmap, 6f); @@ -567,8 +698,13 @@ public void setOnBackClickListener(Runnable onBackClickListener) { } private Utilities.Callback2 onSelectListener; - public void setOnSelectListener(Utilities.Callback2 onSelectListener) { - this.onSelectListener = onSelectListener; + public void setOnSelectListener(Utilities.Callback2 listener) { + this.onSelectListener = listener; + } + + private Utilities.Callback2, ArrayList> onSelectMultipleListener; + public void setOnSelectMultipleListener(Utilities.Callback2, ArrayList> listener) { + this.onSelectMultipleListener = listener; } private static final MediaController.AlbumEntry draftsAlbum = new MediaController.AlbumEntry(-1, null, null); @@ -576,9 +712,11 @@ public void setOnSelectListener(Utilities.Callback2 onSelectList private boolean containsDraftFolder, containsDrafts; public MediaController.AlbumEntry selectedAlbum; - public ArrayList selectedPhotos; + public ArrayList photos; private ArrayList dropDownAlbums; + public final ArrayList selectedPhotos = new ArrayList<>(); + private void updateAlbumsDropDown() { dropDownContainer.removeAllSubItems(); ArrayList albums = MediaController.allMediaAlbums; @@ -610,7 +748,7 @@ private void updateAlbumsDropDown() { MediaController.AlbumEntry album = dropDownAlbums.get(a); AlbumButton button; if (album == draftsAlbum) { - button = new AlbumButton(getContext(), album.coverPhoto, LocaleController.getString("StoryDraftsAlbum"), drafts.size(), resourcesProvider); + button = new AlbumButton(getContext(), album.coverPhoto, getString("StoryDraftsAlbum"), drafts.size(), resourcesProvider); } else { ArrayList photoEntries = getPhotoEntries(album); if (photoEntries.isEmpty()) { @@ -629,12 +767,13 @@ private void updateAlbumsDropDown() { private void selectAlbum(MediaController.AlbumEntry album, boolean scrollAnimated) { selectedAlbum = album; - selectedPhotos = getPhotoEntries(selectedAlbum); + photos = getPhotoEntries(selectedAlbum); + selectedPhotos.clear(); updateContainsDrafts(); if (selectedAlbum == MediaController.allMediaAlbumEntry) { - dropDown.setText(LocaleController.getString(R.string.ChatGallery)); + dropDown.setText(getString(R.string.ChatGallery)); } else if (selectedAlbum == draftsAlbum) { - dropDown.setText(LocaleController.getString("StoryDraftsAlbum")); + dropDown.setText(getString(R.string.StoryDraftsAlbum)); } else { dropDown.setText(selectedAlbum.bucketName); } @@ -653,9 +792,7 @@ private void selectAlbum(MediaController.AlbumEntry album, boolean scrollAnimate private static final int VIEW_TYPE_HEADER = 1; private static final int VIEW_TYPE_ENTRY = 2; - private static final float ASPECT_RATIO = 1.39f; - - private static class Cell extends View { + private static class Cell extends FrameLayout { private Bitmap bitmap; private final Paint bitmapPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG); @@ -677,8 +814,12 @@ private static class Cell extends View { private StaticLayout draftLayout; private float draftLayoutWidth, draftLayoutLeft; - public Cell(Context context) { + private CheckBox2 checkBox; + private float aspectRatio; + + public Cell(Context context, Theme.ResourcesProvider resourcesProvider, float ratio) { super(context); + aspectRatio = ratio; bgPaint.setColor(0x10ffffff); @@ -689,6 +830,21 @@ public Cell(Context context) { draftTextPaint.setTextSize(AndroidUtilities.dp(11.33f)); draftTextPaint.setColor(0xffffffff); durationPlayDrawable = context.getResources().getDrawable(R.drawable.play_mini_video).mutate(); + + checkBox = new CheckBox2(context, 24, resourcesProvider) { + @Override + public void invalidate() { + super.invalidate(); + Cell.this.invalidate(); + } + }; + checkBox.setDrawBackgroundAsArc(6); + checkBox.setColor(Theme.key_chat_attachCheckBoxBackground, Theme.key_chat_attachPhotoBackground, Theme.key_chat_attachCheckBoxCheck); + checkBox.getCheckBoxBase().setStrokeBackgroundColor(Theme.key_windowBackgroundWhiteBlackText); + addView(checkBox, LayoutHelper.createFrame(26, 26, Gravity.RIGHT | Gravity.TOP, 0, 5, 5, 0)); + checkBox.setVisibility(VISIBLE); + + setWillNotDraw(false); } @Override @@ -729,6 +885,32 @@ public void set(MediaController.PhotoEntry photoEntry) { invalidate(); } + public void setCheckbox(boolean visible, int checked, boolean animated) { + if (!animated) { + checkBox.setVisibility(visible ? VISIBLE : GONE); + } else { + checkBox.setVisibility(VISIBLE); + checkBox.animate() + .alpha(visible ? 1.0f : 0.0f) + .scaleX(visible ? 1.0f : 0.7f) + .scaleY(visible ? 1.0f : 0.7f) + .withEndAction(() -> { + if (!visible) { + checkBox.setVisibility(GONE); + } + }) + .setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT) + .setDuration(320) + .start(); + } + if (checked >= 0) { + checkBox.setChecked(true, animated); + checkBox.setNum(checked); + } else { + checkBox.setChecked(false, animated); + } + } + private DispatchQueue myQueue; private static ArrayList allQueues = new ArrayList<>(); private static int allQueuesIndex; @@ -823,7 +1005,7 @@ private Pair getThumbnail(Object entry) { } int rw = (int) Math.min(AndroidUtilities.displaySize.x / 3f, dp(330)); - int rh = (int) (rw * ASPECT_RATIO); + int rh = (int) (rw * aspectRatio); int[] colors = null; Bitmap bitmap = null; @@ -840,7 +1022,7 @@ private Pair getThumbnail(Object entry) { opts.inJustDecodeBounds = false; bitmap = readBitmap(photoEntry, opts); - final boolean needGradient = bitmap != null && ((float) bitmap.getHeight() / bitmap.getWidth()) < ASPECT_RATIO; + final boolean needGradient = bitmap != null && ((float) bitmap.getHeight() / bitmap.getWidth()) < aspectRatio; if (needGradient) { if (photoEntry.gradientTopColor == 0 && photoEntry.gradientBottomColor == 0 && bitmap != null && !bitmap.isRecycled()) { colors = DominantColors.getColorsSync(true, bitmap, true); @@ -943,7 +1125,7 @@ private void afterLoad(String key, Bitmap bitmap, int[] colors) { private void updateMatrix() { if (getMeasuredWidth() > 0 && getMeasuredHeight() > 0 && bitmap != null) { float s; - if ((float) bitmap.getHeight() / bitmap.getWidth() > ASPECT_RATIO - .1f) { + if ((float) bitmap.getHeight() / bitmap.getWidth() > aspectRatio - .1f) { s = Math.max(getMeasuredWidth() / (float) bitmap.getWidth(), getMeasuredHeight() / (float) bitmap.getHeight()); } else { s = getMeasuredWidth() / (float) bitmap.getWidth(); @@ -1018,6 +1200,8 @@ public void setRounding(boolean topLeft, boolean topRight) { private final Path clipPath = new Path(); private final float[] radii = new float[8]; + private final Paint paintUnderCheck = new Paint(Paint.ANTI_ALIAS_FLAG); + @Override public void draw(Canvas canvas) { @@ -1033,7 +1217,17 @@ public void draw(Canvas canvas) { restore = true; } - super.draw(canvas); + final float pad = checkBox.getProgress() * dp(12.66f); + if (pad > 0) { + if (!restore) canvas.save(); + restore = true; + + final float s = (getWidth() - 2 * pad) / getWidth(); + paintUnderCheck.setColor(0x0CFFFFFF); + canvas.drawRect(0, 0, getWidth(), getHeight(), paintUnderCheck); + canvas.scale(s, s, getWidth() / 2.0f, getHeight() / 2.0f); + canvas.clipRect(0, 0, getWidth(), getHeight()); + } canvas.drawRect(0, 0, getWidth(), getHeight(), bgPaint); if (gradient != null) { @@ -1077,6 +1271,8 @@ public void draw(Canvas canvas) { if (restore) { canvas.restore(); } + + super.draw(canvas); } private void setDuration(String duration) { @@ -1092,7 +1288,7 @@ private void setDuration(String duration) { private void setDraft(boolean draft) { if (draft) { - draftLayout = new StaticLayout(LocaleController.getString("StoryDraft"), draftTextPaint, getMeasuredWidth() > 0 ? getMeasuredWidth() : AndroidUtilities.displaySize.x, Layout.Alignment.ALIGN_NORMAL, 1, 0, false); + draftLayout = new StaticLayout(getString("StoryDraft"), draftTextPaint, getMeasuredWidth() > 0 ? getMeasuredWidth() : AndroidUtilities.displaySize.x, Layout.Alignment.ALIGN_NORMAL, 1, 0, false); draftLayoutWidth = draftLayout.getLineCount() > 0 ? draftLayout.getLineWidth(0) : 0; draftLayoutLeft = draftLayout.getLineCount() > 0 ? draftLayout.getLineLeft(0) : 0; } else { @@ -1103,7 +1299,10 @@ private void setDraft(boolean draft) { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { final int w = MeasureSpec.getSize(widthMeasureSpec); - setMeasuredDimension(w, (int) (w * ASPECT_RATIO)); + super.onMeasure( + MeasureSpec.makeMeasureSpec(w, MeasureSpec.EXACTLY), + MeasureSpec.makeMeasureSpec((int) (w * aspectRatio), MeasureSpec.EXACTLY) + ); updateMatrix(); } } @@ -1127,8 +1326,8 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { final int photosCount; if (selectedAlbum == draftsAlbum) { photosCount = drafts.size(); - } else if (selectedPhotos != null) { - photosCount = selectedPhotos.size() + (containsDraftFolder ? 1 : 0) + (containsDrafts ? drafts.size() : 0); + } else if (photos != null) { + photosCount = photos.size() + (containsDraftFolder ? 1 : 0) + (containsDrafts ? drafts.size() : 0); } else { photosCount = 0; } @@ -1166,11 +1365,15 @@ public HeaderView(Context context, boolean onlyPhotos) { textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); textView.setTextColor(0xFFFFFFFF); textView.setTypeface(AndroidUtilities.bold()); - textView.setText(LocaleController.getString(onlyPhotos ? R.string.AddImage : R.string.ChoosePhotoOrVideo)); + textView.setText(getTitle()); addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL, 0, 0, onlyPhotos ? 32 : 0, 0)); } } + public String getTitle() { + return getString(onlyPhotos ? R.string.AddImage : R.string.ChoosePhotoOrVideo); + } + private HeaderView headerView; private class Adapter extends RecyclerListView.FastScrollAdapter { @@ -1189,7 +1392,7 @@ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int } else if (viewType == VIEW_TYPE_HEADER) { view = headerView = new HeaderView(getContext(), onlyPhotos); } else { - view = new Cell(getContext()); + view = new Cell(getContext(), resourcesProvider, ASPECT_RATIO); } return new RecyclerListView.Holder(view); } @@ -1206,22 +1409,40 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi int index = position - 2; if (containsDraftFolder) { if (index == 0) { + cell.setCheckbox(false, -1, false); cell.set(drafts.get(0), drafts.size()); return; } index--; } else if (containsDrafts) { if (index >= 0 && index < drafts.size()) { + cell.setCheckbox(false, -1, false); cell.set(drafts.get(index), 0); return; } index -= drafts.size(); } - if (selectedPhotos == null || index < 0 || index >= selectedPhotos.size()) { + if (photos == null || index < 0 || index >= photos.size()) { return; } - cell.set(selectedPhotos.get(index)); + final MediaController.PhotoEntry photo = photos.get(index); + cell.setCheckbox(isMultiple(), selectedPhotos.indexOf(photo), cell.currentObject == photo); + cell.set(photo); + } + } + + @Override + public void onViewAttachedToWindow(@NonNull RecyclerView.ViewHolder holder) { + super.onViewAttachedToWindow(holder); + if (holder.getItemViewType() == VIEW_TYPE_ENTRY) { + Cell cell = (Cell) holder.itemView; + if (cell.currentObject instanceof MediaController.PhotoEntry) { + final MediaController.PhotoEntry photo = (MediaController.PhotoEntry) cell.currentObject; + cell.setCheckbox(isMultiple(), selectedPhotos.indexOf(photo), false); + } else { + cell.setCheckbox(false, -1, false); + } } } @@ -1256,8 +1477,8 @@ public String getLetter(int position) { } position -= drafts.size(); } - if (selectedPhotos != null && position >= 0 && position < selectedPhotos.size()) { - MediaController.PhotoEntry entry = selectedPhotos.get(position); + if (photos != null && position >= 0 && position < photos.size()) { + MediaController.PhotoEntry entry = photos.get(position); if (entry != null) { long date = entry.dateTaken; if (Build.VERSION.SDK_INT <= 28) { @@ -1271,7 +1492,7 @@ public String getLetter(int position) { @Override public int getTotalItemsCount() { - int count = selectedPhotos == null ? 0 : selectedPhotos.size(); + int count = photos == null ? 0 : photos.size(); if (containsDraftFolder) { count++; } else if (containsDrafts) { @@ -1372,7 +1593,8 @@ public void didReceivedNotification(int id, int account, Object... args) { } } } - selectedPhotos = getPhotoEntries(selectedAlbum); + photos = getPhotoEntries(selectedAlbum); + selectedPhotos.clear(); updateContainsDrafts(); if (adapter != null) { adapter.notifyDataSetChanged(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/GallerySheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/GallerySheet.java new file mode 100644 index 0000000000..b2cd770a38 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/GallerySheet.java @@ -0,0 +1,122 @@ +package org.telegram.ui.Stories.recorder; + +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ValueAnimator; +import android.content.Context; + +import androidx.dynamicanimation.animation.DynamicAnimation; +import androidx.dynamicanimation.animation.SpringAnimation; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.MediaController; +import org.telegram.messenger.MessagesController; +import org.telegram.messenger.R; +import org.telegram.messenger.UserConfig; +import org.telegram.messenger.Utilities; +import org.telegram.tgnet.TLObject; +import org.telegram.ui.ActionBar.BottomSheet; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.Components.CubicBezierInterpolator; +import org.telegram.ui.Components.SizeNotifierFrameLayout; +import org.telegram.ui.Stories.DarkThemeResourceProvider; + +public class GallerySheet extends BottomSheet { + + private final GalleryListView listView; + + public GallerySheet(Context context, Theme.ResourcesProvider resourcesProvider, float aspectRatio) { + super(context, false, resourcesProvider); + + fixNavigationBar(0xff1f1f1f); + listView = new GalleryListView(UserConfig.selectedAccount, context, new DarkThemeResourceProvider(), null, true, aspectRatio) { + @Override + public String getTitle() { + return "Choose cover"; + } + }; + listView.allowSearch(false); + listView.setMultipleOnClick(false); + listView.setOnBackClickListener(() -> { + dismiss(); + }); + listView.setOnSelectListener((entry, blurredBitmap) -> { + if (entry == null || galleryListViewOpening != null) { + return; + } + if (entry instanceof MediaController.PhotoEntry && onGalleryListener != null) { + onGalleryListener.run((MediaController.PhotoEntry) entry); + } + }); + + this.containerView = new SizeNotifierFrameLayout(context); + this.containerView.setPadding(backgroundPaddingLeft, 0, backgroundPaddingLeft, 0); + this.containerView.addView(listView); + } + + private ValueAnimator galleryOpenCloseAnimator; + private SpringAnimation galleryOpenCloseSpringAnimator; + private Boolean galleryListViewOpening; + private Runnable galleryLayouted; + + @Override + public void show() { + super.show(); + animate(true, null); + } + + @Override + public void dismiss() { + animate(false, super::dismiss); + super.dismiss(); + } + + private void animate(boolean open, Runnable done) { + float from = listView.getTranslationY(); + float to = open ? 0 : containerView.getHeight() - listView.top() + AndroidUtilities.navigationBarHeight * 2.5f; + + galleryListViewOpening = open; + if (open) { + galleryOpenCloseSpringAnimator = new SpringAnimation(listView, DynamicAnimation.TRANSLATION_Y, to); + galleryOpenCloseSpringAnimator.getSpring().setDampingRatio(0.75f); + galleryOpenCloseSpringAnimator.getSpring().setStiffness(350.0f); + galleryOpenCloseSpringAnimator.addEndListener((a, canceled, c, d) -> { + if (canceled) { + return; + } + listView.setTranslationY(to); + listView.ignoreScroll = false; + galleryOpenCloseSpringAnimator = null; + galleryListViewOpening = null; + if (done != null) { + done.run(); + } + }); + galleryOpenCloseSpringAnimator.start(); + } else { + galleryOpenCloseAnimator = ValueAnimator.ofFloat(from, to); + galleryOpenCloseAnimator.addUpdateListener(anm -> { + listView.setTranslationY((float) anm.getAnimatedValue()); + }); + galleryOpenCloseAnimator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + galleryOpenCloseAnimator = null; + galleryListViewOpening = null; + if (done != null) { + done.run(); + } + } + }); + galleryOpenCloseAnimator.setDuration(450L); + galleryOpenCloseAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT); + galleryOpenCloseAnimator.start(); + } + } + + private Utilities.Callback onGalleryListener; + public void setOnGalleryImage(Utilities.Callback listener) { + onGalleryListener = listener; + } + +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/HintView2.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/HintView2.java index 6f59f13369..8ba887eab1 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/HintView2.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/HintView2.java @@ -1,6 +1,7 @@ package org.telegram.ui.Stories.recorder; import static org.telegram.messenger.AndroidUtilities.dp; +import static org.telegram.messenger.AndroidUtilities.dpf2; import static org.telegram.messenger.AndroidUtilities.lerp; import android.animation.Animator; @@ -8,13 +9,13 @@ import android.animation.ValueAnimator; import android.content.Context; import android.content.res.ColorStateList; -import android.graphics.Bitmap; import android.graphics.BitmapShader; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.ColorMatrix; import android.graphics.ColorMatrixColorFilter; import android.graphics.CornerPathEffect; +import android.graphics.LinearGradient; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Path; @@ -27,7 +28,6 @@ import android.graphics.Shader; import android.graphics.Typeface; import android.graphics.drawable.Drawable; -import android.graphics.drawable.RippleDrawable; import android.os.Build; import android.text.Layout; import android.text.Spannable; @@ -44,7 +44,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import org.checkerframework.checker.units.qual.C; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.Emoji; import org.telegram.messenger.LiteMode; @@ -89,12 +88,19 @@ public class HintView2 extends View { private Drawable closeButtonDrawable; private boolean closeButton; + private boolean roundWithCornerEffect = true; protected float rounding = dp(8); private final RectF innerPadding = new RectF(dp(11), dp(6), dp(11), dp(7)); private float closeButtonMargin = dp(2); private float arrowHalfWidth = dp(7); private float arrowHeight = dp(6); + public HintView2 setArrowSize(float halfWidthDp, float heightDp) { + this.arrowHalfWidth = dpf2(halfWidthDp); + this.arrowHeight = dpf2(heightDp); + return this; + } + protected final Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); private Paint blurBackgroundPaint, blurCutPaint; @@ -158,16 +164,47 @@ public HintView2 setDirection(int direction) { public HintView2 setRounding(float roundingDp) { this.rounding = dp(roundingDp); - backgroundPaint.setPathEffect(new CornerPathEffect(rounding)); + backgroundPaint.setPathEffect(roundWithCornerEffect ? new CornerPathEffect(rounding) : null); if (cutSelectorPaint != null) { - cutSelectorPaint.setPathEffect(new CornerPathEffect(rounding)); + cutSelectorPaint.setPathEffect(roundWithCornerEffect ? new CornerPathEffect(rounding) : null); } if (blurCutPaint != null) { - blurCutPaint.setPathEffect(new CornerPathEffect(rounding)); + blurCutPaint.setPathEffect(roundWithCornerEffect ? new CornerPathEffect(rounding) : null); } return this; } + public HintView2 setRoundingWithCornerEffect(boolean enable) { + roundWithCornerEffect = enable; + backgroundPaint.setPathEffect(roundWithCornerEffect ? new CornerPathEffect(rounding) : null); + return this; + } + + public HintView2 setFlicker(float lineWidthDp, int color) { + this.flicker = true; + flickerStart = System.currentTimeMillis(); + + flickerStrokePath = new Path(); + flickerStrokePathExtrude = dpf2(lineWidthDp) / 2.0f; + + flickerFillPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + flickerStrokePaint = new Paint(Paint.ANTI_ALIAS_FLAG); + + flickerStrokeGradient = new LinearGradient(0, 0, dp(64), 0, new int[] { Theme.multAlpha(color, 0.0f), Theme.multAlpha(color, 1.0f), Theme.multAlpha(color, 0.0f) }, new float[] { 0, .5f, 1f }, Shader.TileMode.CLAMP); + flickerStrokePaint.setShader(flickerStrokeGradient); + + flickerGradient = new LinearGradient(0, 0, dp(64), 0, new int[] { Theme.multAlpha(color, 0.0f), Theme.multAlpha(color, 0.5f), Theme.multAlpha(color, 0.0f) }, new float[] { 0, .5f, 1f }, Shader.TileMode.CLAMP); + flickerGradientMatrix = new Matrix(); + flickerFillPaint.setShader(flickerGradient); + + flickerStrokePaint.setStyle(Paint.Style.STROKE); + flickerStrokePaint.setStrokeJoin(Paint.Join.ROUND); + flickerStrokePaint.setStrokeCap(Paint.Cap.ROUND); + flickerStrokePaint.setStrokeWidth(dpf2(lineWidthDp)); + + return this; + } + // mutliline disables text animations public HintView2 setMultilineText(boolean enable) { this.multiline = enable; @@ -221,9 +258,9 @@ public HintView2 allowBlur(boolean allow) { return this; } - public HintView2 setTextSize(int sizeDp) { - textDrawable.setTextSize(dp(sizeDp)); - textPaint.setTextSize(dp(sizeDp)); + public HintView2 setTextSize(float sizeDp) { + textDrawable.setTextSize(dpf2(sizeDp)); + textPaint.setTextSize(dpf2(sizeDp)); return this; } @@ -289,13 +326,22 @@ public static float measureCorrectly(CharSequence text, TextPaint paint) { ColoredImageSpan[] imageSpans = spanned.getSpans(0, text.length(), ColoredImageSpan.class); int add = 0; for (int i = 0; i < emojiSpans.length; ++i) { - add += emojiSpans[i].size; + Emoji.EmojiSpan span = emojiSpans[i]; + final int start = spanned.getSpanStart(span); + final int end = spanned.getSpanEnd(span); + add += Math.max(0, span.size - paint.measureText(spanned, start, end)); } for (int i = 0; i < imageSpans.length; ++i) { - add += imageSpans[i].getSize(paint, text, spanned.getSpanStart(imageSpans[i]), spanned.getSpanEnd(imageSpans[i]), paint.getFontMetricsInt()); + ColoredImageSpan span = imageSpans[i]; + final int start = spanned.getSpanStart(span); + final int end = spanned.getSpanEnd(span); + add += Math.max(0, span.getSize(paint, text, start, end, paint.getFontMetricsInt()) - paint.measureText(spanned, start, end)); } for (int i = 0; i < animatedSpans.length; ++i) { - add += animatedSpans[i].size; + AnimatedEmojiSpan span = animatedSpans[i]; + final int start = spanned.getSpanStart(span); + final int end = spanned.getSpanEnd(span); + add += Math.max(0, span.getSize(paint, text, start, end, paint.getFontMetricsInt()) - paint.measureText(spanned, start, end)); } if (spans == null || spans.length == 0) { return paint.measureText(text.toString()) + add; @@ -303,8 +349,8 @@ public static float measureCorrectly(CharSequence text, TextPaint paint) { float len = 0; int s = 0, e; for (int i = 0; i < spans.length; ++i) { - int spanstart = spanned.getSpanStart(spans[i]); - int spanend = spanned.getSpanEnd(spans[i]); + final int spanstart = spanned.getSpanStart(spans[i]); + final int spanend = spanned.getSpanEnd(spans[i]); e = Math.max(s, spanstart); if (e - s > 0) { @@ -399,8 +445,8 @@ public HintView2 setAnimatedTextHacks(boolean splitByWords, boolean preserveInde // distances from text to inner hint bounds // use setPadding() or custom layout to move possible bounds of the hint location // call last, as paddings are dependent on multiline and closeButton - public HintView2 setInnerPadding(int leftDp, int topDp, int rightDp, int bottomDp) { - innerPadding.set(dp(leftDp), dp(topDp), dp(rightDp), dp(bottomDp)); + public HintView2 setInnerPadding(float leftDp, float topDp, float rightDp, float bottomDp) { + innerPadding.set(dpf2(leftDp), dpf2(topDp), dpf2(rightDp), dpf2(bottomDp)); return this; } @@ -474,7 +520,10 @@ public HintView2 setTextAlign(Layout.Alignment alignment) { } public HintView2 setBgColor(int color) { - backgroundPaint.setColor(color); + if (backgroundPaint.getColor() != color) { + backgroundPaint.setColor(color); + invalidate(); + } return this; } @@ -661,12 +710,23 @@ protected void onDetachedFromWindow() { private final Rect boundsWithArrow = new Rect(); private final RectF bounds = new RectF(); + private final RectF flickerBounds = new RectF(); protected final Path path = new Path(); private float arrowX, arrowY; private float pathLastWidth, pathLastHeight; private boolean pathSet; private boolean firstDraw = true; + private boolean flicker; + private Path flickerStrokePath; + private float flickerStrokePathExtrude; + private Paint flickerFillPaint; + private Paint flickerStrokePaint; + private LinearGradient flickerGradient; + private Matrix flickerGradientMatrix; + private LinearGradient flickerStrokeGradient; + private long flickerStart; + protected void drawBgPath(Canvas canvas) { if (blurBackgroundPaint != null) { canvas.saveLayerAlpha(0, 0, getWidth(), getHeight(), 0xFF, Canvas.ALL_SAVE_FLAG); @@ -675,6 +735,20 @@ protected void drawBgPath(Canvas canvas) { canvas.restore(); } canvas.drawPath(path, backgroundPaint); + if (flicker) { + final int delay = 4, duration = 1000; + final int gradientWidth = dp(64); + final float left = -gradientWidth + (System.currentTimeMillis() - flickerStart) % (duration * delay) / (float) (duration * delay) * (pathLastWidth * delay + gradientWidth * 2); + + flickerGradientMatrix.reset(); + flickerGradientMatrix.postTranslate(bounds.left + left, 0); + flickerGradient.setLocalMatrix(flickerGradientMatrix); + flickerStrokeGradient.setLocalMatrix(flickerGradientMatrix); + + canvas.drawPath(path, flickerFillPaint); + canvas.drawPath(flickerStrokePath, flickerStrokePaint); + invalidate(); + } } @Override @@ -713,7 +787,10 @@ protected void dispatchDraw(Canvas canvas) { final float width = innerPadding.left + contentWidth + innerPadding.right; final float height = innerPadding.top + contentHeight + innerPadding.bottom; if (!pathSet || Math.abs(width - pathLastWidth) > 0.1f || Math.abs(height - pathLastHeight) > 0.1f) { - rewindPath(pathLastWidth = width, pathLastHeight = height); + fillPath(path, pathLastWidth = width, pathLastHeight = height, 0.0f, bounds, boundsWithArrow); + if (flicker) { + fillPath(flickerStrokePath, width, height, flickerStrokePathExtrude, flickerBounds, null); + } } float alpha = useAlpha ? showT : 1; @@ -814,37 +891,55 @@ protected void dispatchDraw(Canvas canvas) { canvas.restore(); } - private void rewindPath(float width, float height) { + private final RectF oval = new RectF(); + private void fillPath(Path path, float width, float height, float extrude, RectF bounds, Rect boundsWithArrow) { float arrowXY; + final float r = Math.min(rounding, Math.min(width / 2, height / 2)); if (direction == DIRECTION_TOP || direction == DIRECTION_BOTTOM) { - arrowXY = lerp(getPaddingLeft(), getMeasuredWidth() - getPaddingRight(), joint); + if (roundWithCornerEffect) { + arrowXY = lerp(getPaddingLeft(), getMeasuredWidth() - getPaddingRight(), joint); + } else { + arrowXY = lerp(getPaddingLeft() + r + arrowHalfWidth, getMeasuredWidth() - getPaddingRight() - r - arrowHalfWidth, joint); + } arrowXY = Utilities.clamp(arrowXY + jointTranslate, getMeasuredWidth() - getPaddingRight(), getPaddingLeft()); float left = Math.max(getPaddingLeft(), arrowXY - width / 2f); float right = Math.min(left + width, getMeasuredWidth() - getPaddingRight()); left = right - width; - arrowXY = Utilities.clamp(arrowXY, right - rounding - arrowHalfWidth, left + rounding + arrowHalfWidth); + arrowXY = Utilities.clamp(arrowXY, right - r - arrowHalfWidth, left + r + arrowHalfWidth); if (direction == DIRECTION_TOP) { bounds.set(left, getPaddingTop() + arrowHeight, right, getPaddingTop() + arrowHeight + height); } else { bounds.set(left, getMeasuredHeight() - arrowHeight - getPaddingBottom() - height, right, getMeasuredHeight() - arrowHeight - getPaddingBottom()); } } else { - arrowXY = lerp(getPaddingTop(), getMeasuredHeight() - getPaddingBottom(), joint); + if (roundWithCornerEffect) { + arrowXY = lerp(getPaddingTop(), getMeasuredHeight() - getPaddingBottom(), joint); + } else { + arrowXY = lerp(getPaddingTop() + r + arrowHalfWidth, getMeasuredHeight() - getPaddingBottom() - r - arrowHalfWidth, joint); + } arrowXY = Utilities.clamp(arrowXY + jointTranslate, getMeasuredHeight() - getPaddingBottom(), getPaddingTop()); float top = Math.max(getPaddingTop(), arrowXY - height / 2f); float bottom = Math.min(top + height, getMeasuredHeight() - getPaddingBottom()); top = bottom - height; - arrowXY = Utilities.clamp(arrowXY, bottom - rounding - arrowHalfWidth, top + rounding + arrowHalfWidth); + arrowXY = Utilities.clamp(arrowXY, bottom - r - arrowHalfWidth, top + r + arrowHalfWidth); if (direction == DIRECTION_LEFT) { bounds.set(getPaddingLeft() + arrowHeight, top, getPaddingLeft() + arrowHeight + width, bottom); } else { bounds.set(getMeasuredWidth() - getPaddingRight() - arrowHeight - width, top, getMeasuredWidth() - getPaddingRight() - arrowHeight, bottom); } } - boundsWithArrow.set((int) bounds.left, (int) bounds.top, (int) bounds.right, (int) bounds.bottom); + bounds.inset(-extrude, -extrude); + if (boundsWithArrow != null) { + boundsWithArrow.set((int) bounds.left, (int) bounds.top, (int) bounds.right, (int) bounds.bottom); + } path.rewind(); - path.moveTo(bounds.left, bounds.bottom); + if (roundWithCornerEffect) { + path.moveTo(bounds.left, bounds.bottom); + } else { + oval.set(bounds.left, bounds.bottom - r * 2, bounds.left + r * 2, bounds.bottom); + path.arcTo(oval, 90, 90); + } if (direction == DIRECTION_LEFT) { path.lineTo(bounds.left, arrowXY + arrowHalfWidth + dp(2)); path.lineTo(bounds.left, arrowXY + arrowHalfWidth); @@ -854,9 +949,16 @@ private void rewindPath(float width, float height) { path.lineTo(bounds.left - arrowHeight, arrowXY - dp(1)); path.lineTo(bounds.left, arrowXY - arrowHalfWidth); path.lineTo(bounds.left, arrowXY - arrowHalfWidth - dp(2)); - boundsWithArrow.left -= arrowHeight; + if (boundsWithArrow != null) { + boundsWithArrow.left -= arrowHeight; + } + } + if (roundWithCornerEffect) { + path.lineTo(bounds.left, bounds.top); + } else { + oval.set(bounds.left, bounds.top, bounds.left + r * 2, bounds.top + r * 2); + path.arcTo(oval, 180, 90); } - path.lineTo(bounds.left, bounds.top); if (direction == DIRECTION_TOP) { path.lineTo(arrowXY - arrowHalfWidth - dp(2), bounds.top); path.lineTo(arrowXY - arrowHalfWidth, bounds.top); @@ -866,9 +968,16 @@ private void rewindPath(float width, float height) { path.lineTo(arrowXY + dp(1), bounds.top - arrowHeight); path.lineTo(arrowXY + arrowHalfWidth, bounds.top); path.lineTo(arrowXY + arrowHalfWidth + dp(2), bounds.top); - boundsWithArrow.top -= arrowHeight; + if (boundsWithArrow != null) { + boundsWithArrow.top -= arrowHeight; + } + } + if (roundWithCornerEffect) { + path.lineTo(bounds.right, bounds.top); + } else { + oval.set(bounds.right - r * 2, bounds.top, bounds.right, bounds.top + r * 2); + path.arcTo(oval, 270, 90); } - path.lineTo(bounds.right, bounds.top); if (direction == DIRECTION_RIGHT) { path.lineTo(bounds.right, arrowXY - arrowHalfWidth - dp(2)); path.lineTo(bounds.right, arrowXY - arrowHalfWidth); @@ -878,9 +987,16 @@ private void rewindPath(float width, float height) { path.lineTo(bounds.right + arrowHeight, arrowXY + dp(1)); path.lineTo(bounds.right, arrowXY + arrowHalfWidth); path.lineTo(bounds.right, arrowXY + arrowHalfWidth + dp(2)); - boundsWithArrow.right += arrowHeight; + if (boundsWithArrow != null) { + boundsWithArrow.right += arrowHeight; + } + } + if (roundWithCornerEffect) { + path.lineTo(bounds.right, bounds.bottom); + } else { + oval.set(bounds.right - r * 2, bounds.bottom - r * 2, bounds.right, bounds.bottom); + path.arcTo(oval, 0, 90); } - path.lineTo(bounds.right, bounds.bottom); if (direction == DIRECTION_BOTTOM) { path.lineTo(arrowXY + arrowHalfWidth + dp(2), bounds.bottom); path.lineTo(arrowXY + arrowHalfWidth, bounds.bottom); @@ -890,7 +1006,9 @@ private void rewindPath(float width, float height) { path.lineTo(arrowXY - dp(1), bounds.bottom + arrowHeight); path.lineTo(arrowXY - arrowHalfWidth, bounds.bottom); path.lineTo(arrowXY - arrowHalfWidth - dp(2), bounds.bottom); - boundsWithArrow.bottom += arrowHeight; + if (boundsWithArrow != null) { + boundsWithArrow.bottom += arrowHeight; + } } path.close(); pathSet = true; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/PaintView.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/PaintView.java index d73bae09c3..bda21a09bc 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/PaintView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/PaintView.java @@ -5,6 +5,7 @@ import static org.telegram.messenger.AndroidUtilities.lerp; import static org.telegram.messenger.LocaleController.formatPluralString; import static org.telegram.messenger.LocaleController.getString; +import static org.telegram.ui.Stars.StarsController.findAttribute; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -83,6 +84,7 @@ import org.telegram.messenger.VideoEditedInfo; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_stars; import org.telegram.tgnet.tl.TL_stories; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarPopupWindow; @@ -91,6 +93,7 @@ import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.BubbleActivity; +import org.telegram.ui.Cells.ChatActionCell; import org.telegram.ui.Cells.ChatMessageCell; import org.telegram.ui.ChatActivity; import org.telegram.ui.Components.AnimatedEmojiDrawable; @@ -201,7 +204,7 @@ public class PaintView extends SizeNotifierFrameLayoutPhoto implements IPhotoPai private boolean ignoreToolChangeAnimationOnce; private PaintWeightChooserView weightChooserView; - private PaintWeightChooserView.ValueOverride weightDefaultValueOverride = new PaintWeightChooserView.ValueOverride() { + private final PaintWeightChooserView.ValueOverride weightDefaultValueOverride = new PaintWeightChooserView.ValueOverride() { @Override public float get() { Brush brush = renderView.getCurrentBrush(); @@ -1948,7 +1951,9 @@ public boolean canClickWidget(Integer widgetId) { return false; } if (widgetsCount >= MessagesController.getInstance(currentAccount).storiesSuggestedReactionsLimitPremium) { - container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} BulletinFactory.of(container, resourcesProvider).createSimpleBulletin(R.raw.chats_infotip, getString("LimitReached", R.string.LimitReached), LocaleController.formatPluralString("StoryReactionsWidgetLimit2", MessagesController.getInstance(currentAccount).storiesSuggestedReactionsLimitPremium) @@ -2013,7 +2018,9 @@ protected boolean checkAudioPermission(Runnable granted) { return true; } else if (widgetId == EmojiBottomSheet.WIDGET_LINK) { if (!UserConfig.getInstance(currentAccount).isPremium()) { - alert.container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + try { + alert.container.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } catch (Exception ignored) {} BulletinFactory.of(alert.container, resourcesProvider).createSimpleBulletin(R.raw.star_premium_2, AndroidUtilities.premiumText(getString(R.string.StoryLinkPremium), () -> { BaseFragment fragment = new BaseFragment() { @@ -2398,7 +2405,7 @@ private void setupEntities() { text.setSpan(new AnimatedEmojiSpan(e.document_id, 1f, textPaintView.getFontMetricsInt()), e.offset, e.offset + e.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } CharSequence charSequence = text; - charSequence = Emoji.replaceEmoji(charSequence, textPaintView.getFontMetricsInt(), (int) (textPaintView.getFontSize() * .8f), false); + charSequence = Emoji.replaceEmoji(charSequence, textPaintView.getFontMetricsInt(), false); if (charSequence instanceof Spanned) { Emoji.EmojiSpan[] spans = ((Spanned) charSequence).getSpans(0, charSequence.length(), Emoji.EmojiSpan.class); if (spans != null) { @@ -2415,6 +2422,7 @@ private void setupEntities() { view = textPaintView; } else if (entity.type == VideoEditedInfo.MediaEntity.TYPE_PHOTO) { PhotoView photoView = createPhoto(entity.text, false); + photoView.crop = entity.crop; photoView.preloadSegmented(entity.segmentedPath); if ((entity.subType & 2) != 0) { photoView.mirror(); @@ -2658,6 +2666,7 @@ public Bitmap getBitmap(ArrayList entities, int res Point position = entity.getPosition(); boolean drawThisEntity = true; VideoEditedInfo.MediaEntity mediaEntity = new VideoEditedInfo.MediaEntity(); + ImageReceiver makeVisibleAfterwards = null; if (entities != null) { if (entity instanceof TextPaintView) { mediaEntity.type = VideoEditedInfo.MediaEntity.TYPE_TEXT; @@ -2754,6 +2763,7 @@ public Bitmap getBitmap(ArrayList entities, int res mediaEntity.width = size.width; mediaEntity.height = size.height; mediaEntity.text = photoView.getPath(currentAccount); + mediaEntity.crop = photoView.crop; if (photoView.isMirrored()) { mediaEntity.subType |= 2; } @@ -2873,12 +2883,88 @@ public Bitmap getBitmap(ArrayList entities, int res mediaEntity.type = VideoEditedInfo.MediaEntity.TYPE_MESSAGE; mediaEntity.width = mediaEntity.viewWidth = messageView.getWidth(); mediaEntity.height = mediaEntity.viewHeight = messageView.getHeight(); - mediaEntity.mediaArea = new TL_stories.TL_inputMediaAreaChannelPost(); - mediaEntity.mediaArea.coordinates = new TL_stories.TL_mediaAreaCoordinates(); - if (entry != null && entry.messageObjects != null) { - MessageObject messageObject = entry.messageObjects.get(0); - ((TL_stories.TL_inputMediaAreaChannelPost) mediaEntity.mediaArea).channel = MessagesController.getInstance(currentAccount).getInputChannel(-StoryEntry.getRepostDialogId(messageObject)); - ((TL_stories.TL_inputMediaAreaChannelPost) mediaEntity.mediaArea).msg_id = StoryEntry.getRepostMessageId(messageObject); + final MessageObject message = messageView.messageObjects.size() > 0 ? messageView.messageObjects.get(0) : null; + if (message != null && message.messageOwner != null && message.messageOwner.action instanceof TLRPC.TL_messageActionStarGiftUnique) { + final TLRPC.TL_messageActionStarGiftUnique action = (TLRPC.TL_messageActionStarGiftUnique) message.messageOwner.action; + final TL_stars.StarGift starGift = action.gift; + mediaEntity.mediaArea = new TL_stories.TL_mediaAreaStarGift(); + ((TL_stories.TL_mediaAreaStarGift) mediaEntity.mediaArea).slug = starGift.slug; + mediaEntity.mediaArea.coordinates = new TL_stories.TL_mediaAreaCoordinates(); + ChatActionCell cell = null; + for (int j = 0; j < messageView.listView.getChildCount(); ++j) { + View child = messageView.listView.getChildAt(j); + if (child instanceof ChatActionCell) { + cell = (ChatActionCell) child; + break; + } + } + if (cell != null && cell.starGiftLayout != null && cell.starGiftLayout.imageReceiver != null) { + final ImageReceiver imageReceiver = cell.starGiftLayout.imageReceiver; + imageReceiver.setVisible(false, false); + makeVisibleAfterwards = imageReceiver; + + final TL_stars.starGiftAttributeModel model = findAttribute(starGift.attributes, TL_stars.starGiftAttributeModel.class); + if (model != null) { + final float size = dp(110); + final float cx = messageView.listView.getX() + cell.getX() + cell.starGiftLayoutX + imageReceiver.getCenterX(); + final float cy = messageView.listView.getY() + cell.getY() + cell.starGiftLayoutY + imageReceiver.getCenterY(); + + final VideoEditedInfo.MediaEntity stickerEntity = new VideoEditedInfo.MediaEntity(); + stickerEntity.type = VideoEditedInfo.MediaEntity.TYPE_STICKER; + stickerEntity.width = size; + stickerEntity.height = size; + stickerEntity.document = model.document; + stickerEntity.parentObject = starGift; + final TLRPC.Document document = model.document; + stickerEntity.text = FileLoader.getInstance(UserConfig.selectedAccount).getPathToAttach(document, true).getAbsolutePath(); + if (MessageObject.isAnimatedStickerDocument(document, true) || isVideoStickerDocument(document)) { + final boolean isAnimatedSticker = MessageObject.isAnimatedStickerDocument(document, true); + stickerEntity.subType |= isAnimatedSticker ? 1 : 4; + final long duration; + RLottieDrawable lottieDrawable = imageReceiver.getLottieAnimation(); + if (lottieDrawable != null && (isAnimatedSticker || isVideoStickerDocument(document))) { + duration = lottieDrawable.getDuration(); + } else { + duration = 5000; + } + if (duration != 0) { + final BigInteger x = BigInteger.valueOf(duration); + lcm = lcm.multiply(x).divide(lcm.gcd(x)); + } + } + + float scaleX = v.getScaleX(); + float scaleY = v.getScaleY(); + float x = v.getX(); + float y = v.getY(); + stickerEntity.viewWidth = (int) size; + stickerEntity.viewHeight = (int) size; + stickerEntity.width = size * scaleX / (float) entitiesView.getMeasuredWidth(); + stickerEntity.height = size * scaleY / (float) entitiesView.getMeasuredHeight(); + stickerEntity.x = x + v.getWidth() / 2.0f;// + v.getWidth() * (1 - scaleX) / 2; + stickerEntity.y = y + v.getHeight() / 2.0f;//v.getHeight() * (1 - scaleY) / 2; + final float dx = cx * scaleX - v.getWidth() / 2.0f * scaleX; + final float dy = cy * scaleY - v.getHeight() / 2.0f * scaleY; + final float a = (float) (v.getRotation() / 180.0f * Math.PI); + stickerEntity.x += dx * Math.cos(a) - dy * Math.sin(a); + stickerEntity.y += dx * Math.sin(a) + dy * Math.cos(a); + stickerEntity.x += -size / 2.0f * scaleX; + stickerEntity.y += -size / 2.0f * scaleY; + stickerEntity.x /= entitiesView.getMeasuredWidth(); + stickerEntity.y /= entitiesView.getMeasuredHeight(); + stickerEntity.rotation = (float) (-v.getRotation() * (Math.PI / 180)); + stickerEntity.scale = scaleX; + entities.add(stickerEntity); + } + } + } else if (message != null) { + mediaEntity.mediaArea = new TL_stories.TL_inputMediaAreaChannelPost(); + mediaEntity.mediaArea.coordinates = new TL_stories.TL_mediaAreaCoordinates(); + ((TL_stories.TL_inputMediaAreaChannelPost) mediaEntity.mediaArea).channel = MessagesController.getInstance(currentAccount).getInputChannel(-StoryEntry.getRepostDialogId(message)); + ((TL_stories.TL_inputMediaAreaChannelPost) mediaEntity.mediaArea).msg_id = StoryEntry.getRepostMessageId(message); + } else { + mediaEntity.mediaArea = new TL_stories.TL_inputMediaAreaChannelPost(); + mediaEntity.mediaArea.coordinates = new TL_stories.TL_mediaAreaCoordinates(); } if (!drawMessage) { skipDrawToBitmap = true; @@ -3026,6 +3112,10 @@ public Bitmap getBitmap(ArrayList entities, int res } currentCanvas.restore(); } + if (makeVisibleAfterwards != null) { + makeVisibleAfterwards.setVisible(true, false); + makeVisibleAfterwards = null; + } } } } @@ -3972,7 +4062,7 @@ private void showMenuForEntity(final EntityView entityView) { editView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); if ((keyboardNotifier.keyboardVisible() && !keyboardNotifier.ignoring) || emojiPadding > 0) { editView.setTag(3); - editView.setText(getString("Paste", R.string.Paste)); + editView.setText(getString(R.string.Paste)); editView.setOnClickListener(v -> { try { EditText editText = ((TextPaintView) entityView).getEditText(); @@ -3986,7 +4076,7 @@ private void showMenuForEntity(final EntityView entityView) { }); } else { editView.setTag(1); - editView.setText(getString("PaintEdit", R.string.PaintEdit)); + editView.setText(getString(R.string.PaintEdit)); editView.setOnClickListener(v -> { selectEntity(entityView); editSelectedTextEntity(); @@ -3997,7 +4087,7 @@ private void showMenuForEntity(final EntityView entityView) { } parent.addView(editView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 44)); } else if (entityView instanceof LocationView) { - TextView editView = createActionLayoutButton(1, getString("PaintEdit", R.string.PaintEdit)); + TextView editView = createActionLayoutButton(1, getString(R.string.PaintEdit)); editView.setOnClickListener(v -> { selectEntity(null); showLocationAlert((LocationView) entityView, (location, area) -> { @@ -4010,7 +4100,7 @@ private void showMenuForEntity(final EntityView entityView) { }); parent.addView(editView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 44)); } else if (entityView instanceof LinkView) { - TextView editView = createActionLayoutButton(1, getString("PaintEdit", R.string.PaintEdit)); + TextView editView = createActionLayoutButton(1, getString(R.string.PaintEdit)); editView.setOnClickListener(v -> { selectEntity(null); showLinkAlert((LinkView) entityView); @@ -4021,8 +4111,19 @@ private void showMenuForEntity(final EntityView entityView) { parent.addView(editView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 44)); } +// if (entityView instanceof PhotoView) { +// TextView cropView = createActionLayoutButton(6, getString(R.string.StoryCrop)); +// cropView.setOnClickListener(v -> { +// onPhotoEntityCropClick((PhotoView) entityView); +// if (popupWindow != null && popupWindow.isShowing()) { +// popupWindow.dismiss(true); +// } +// }); +// parent.addView(cropView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 44)); +// } + if (entityView instanceof StickerView || entityView instanceof RoundView || entityView instanceof PhotoView || entityView instanceof ReactionWidgetEntityView) { - TextView flipView = createActionLayoutButton(4, getString("Flip", R.string.Flip)); + TextView flipView = createActionLayoutButton(4, getString(R.string.Flip)); flipView.setOnClickListener(v -> { if (entityView instanceof StickerView) { ((StickerView) entityView).mirror(true); @@ -4497,7 +4598,7 @@ public PhotoView createPhoto(String path, boolean select) { size.height = w; } PhotoView view = new PhotoView(getContext(), centerPositionForEntity(), 0, 1f, size, path, orientation.first, orientation.second); - view.centerImage.setLayerNum(4 + 8); +// view.centerImage.setLayerNum(4 + 8); // view.setHasStickyX(true); // view.setHasStickyY(true); view.setDelegate(this); @@ -4604,7 +4705,7 @@ public PhotoView createPhoto(TLObject obj, boolean select) { forceChanges = true; Size size = basePhotoSize(obj); PhotoView view = new PhotoView(getContext(), centerPositionForEntity(), 0, 1f, size, obj); - view.centerImage.setLayerNum(4 + 8); +// view.centerImage.setLayerNum(4 + 8); // view.setHasStickyX(true); // view.setHasStickyY(true); view.setDelegate(this); @@ -5222,7 +5323,7 @@ public void onEmojiSelected(String symbol) { } try { innerTextChange = 2; - CharSequence localCharSequence = Emoji.replaceEmoji(symbol, textPaintView.getFontMetricsInt(), (int) (textPaintView.getFontSize() * .8f), false); + CharSequence localCharSequence = Emoji.replaceEmoji(symbol, textPaintView.getFontMetricsInt(), false); if (localCharSequence instanceof Spanned) { Emoji.EmojiSpan[] spans = ((Spanned) localCharSequence).getSpans(0, localCharSequence.length(), Emoji.EmojiSpan.class); if (spans != null) { @@ -5330,4 +5431,8 @@ public static int argb2Rgba(int argb) { return (red << 24) | (green << 16) | (blue << 8) | alpha; } + + protected void onPhotoEntityCropClick(PhotoView photoView) { + + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/PreviewButtons.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/PreviewButtons.java index 81395d49fb..2fe7b80365 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/PreviewButtons.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/PreviewButtons.java @@ -44,8 +44,9 @@ public class PreviewButtons extends FrameLayout { public static final int BUTTON_PAINT = 0; public static final int BUTTON_TEXT = 1; public static final int BUTTON_STICKER = 2; - public static final int BUTTON_ADJUST = 3; - public static final int BUTTON_SHARE = 4; + public static final int BUTTON_CROP = 3; + public static final int BUTTON_ADJUST = 4; + public static final int BUTTON_SHARE = 5; private View shadowView; @@ -65,6 +66,7 @@ public PreviewButtons(Context context) { addButton(BUTTON_PAINT, R.drawable.media_draw, LocaleController.getString(R.string.AccDescrPaint)); addButton(BUTTON_STICKER, R.drawable.msg_photo_sticker, LocaleController.getString(R.string.AccDescrStickers)); addButton(BUTTON_TEXT, R.drawable.msg_photo_text2, LocaleController.getString(R.string.AccDescrPlaceText)); + addButton(BUTTON_CROP, R.drawable.media_crop, LocaleController.getString(R.string.Crop)); addButton(BUTTON_ADJUST, R.drawable.msg_photo_settings, LocaleController.getString(R.string.AccDescrPhotoAdjust)); shareButton = new ShareButtonView(context, shareText = LocaleController.getString(R.string.Send), shareArrow = true); @@ -74,19 +76,19 @@ public PreviewButtons(Context context) { updateAppearT(); } - public void setFiltersVisible(boolean visible) { + public void setButtonVisible(int btn, boolean visible) { for (int i = 0; i < buttons.size(); ++i) { ButtonView button = buttons.get(i); - if (button.id == BUTTON_ADJUST) { + if (button.id == btn) { button.setVisibility(visible ? View.VISIBLE : View.GONE); } } } - private boolean isFiltersVisible() { + private boolean isButtonVisible(int btn) { for (int i = 0; i < buttons.size(); ++i) { ButtonView button = buttons.get(i); - if (button.id == BUTTON_ADJUST) { + if (button.id == btn) { return button.getVisibility() == View.VISIBLE; } } @@ -128,10 +130,10 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto } } int maxPossibleMargin = visibleButtons < 2 ? 0 : (W - visibleButtons * dp(40)) / (visibleButtons - 1); - int margin = Math.min(dp(isFiltersVisible() ? 20 : 30), maxPossibleMargin); + int margin = Math.min(dp(isButtonVisible(BUTTON_ADJUST) ? 20 : 30), maxPossibleMargin); int t = (h - dp(40)) / 2, b = (h + dp(40)) / 2; - for (int i = 0, x = dp(12.33f) + (!isFiltersVisible() ? (W - visibleButtons * dp(40) - (visibleButtons - 1) * margin) / 2 : 0); i < buttons.size(); ++i) { + for (int i = 0, x = dp(12.33f) + (!isButtonVisible(BUTTON_ADJUST) ? (W - visibleButtons * dp(40) - (visibleButtons - 1) * margin) / 2 : 0); i < buttons.size(); ++i) { if (buttons.get(i).getVisibility() != View.VISIBLE) continue; buttons.get(i).layout(x, t, x + dp(40), b); x += dp(40) + margin; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/PreviewView.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/PreviewView.java index e23e001291..f63287930f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/PreviewView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/PreviewView.java @@ -46,8 +46,6 @@ import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.ChatThemeController; -import org.telegram.messenger.ImageLoader; -import org.telegram.messenger.ImageReceiver; import org.telegram.messenger.MessageObject; import org.telegram.messenger.MessagesController; import org.telegram.messenger.Utilities; @@ -66,7 +64,6 @@ import org.telegram.ui.Components.VideoPlayer; import java.io.File; -import java.util.ArrayList; import java.util.HashSet; public class PreviewView extends FrameLayout { @@ -450,7 +447,7 @@ public void onVideoVolumeChange(float volume) { } @Override - public void onVideoLeftChange(float left) { + public void onVideoLeftChange(boolean released, float left) { if (entry == null) { return; } @@ -462,7 +459,7 @@ public void onVideoLeftChange(float left) { } @Override - public void onVideoRightChange(float right) { + public void onVideoRightChange(boolean released, float right) { if (entry == null) { return; } @@ -969,6 +966,33 @@ protected boolean drawChild(Canvas canvas, View child, long drawingTime) { if (child == textureView && entry != null && entry.isRepostMessage) { return false; } + if ((child == textureView || child == filterTextureView) && entry != null && entry.crop != null) { + canvas.save(); + + canvas.scale((float) getWidth() / entry.resultWidth, (float) getHeight() / entry.resultHeight); + canvas.concat(entry.matrix); + if (entry.crop != null) { + canvas.translate(entry.width / 2.0f, entry.height / 2.0f); + canvas.rotate(-entry.orientation); + int w = entry.width, h = entry.height; + if (((entry.orientation + entry.crop.transformRotation) / 90) % 2 == 1) { + w = entry.height; + h = entry.width; + } + canvas.clipRect( + -w * entry.crop.cropPw / 2.0f, -h * entry.crop.cropPh / 2.0f, + +w * entry.crop.cropPw / 2.0f, +h * entry.crop.cropPh / 2.0f + ); + canvas.rotate(entry.orientation); + canvas.translate(-entry.width / 2.0f, -entry.height / 2.0f); + } + canvas.concat(invertMatrix); + canvas.scale(1.0f / ((float) getWidth() / entry.resultWidth), 1.0f / ((float) getHeight() / entry.resultHeight)); + + boolean r = super.drawChild(canvas, child, drawingTime); + canvas.restore(); + return r; + } return super.drawChild(canvas, child, drawingTime); } @@ -1312,8 +1336,7 @@ public void setDraw(boolean draw) { private final AnimatedFloat thumbAlpha = new AnimatedFloat(this, 0, 320, CubicBezierInterpolator.EASE_OUT); public boolean drawForThemeToggle = false; - @Override - protected void dispatchDraw(Canvas canvas) { + public void drawBackground(Canvas canvas) { if (wallpaperDrawable != null) { if (drawForThemeToggle) { Path path = new Path(); @@ -1339,26 +1362,114 @@ protected void dispatchDraw(Canvas canvas) { } else { canvas.drawRect(0, 0, getWidth(), getHeight(), gradientPaint); } - if (draw && entry != null && !isCollage()) { - float alpha = this.thumbAlpha.set(bitmap != null); - if (thumbBitmap != null && (1f - alpha) > 0) { - matrix.set(entry.matrix); - matrix.preScale((float) entry.width / thumbBitmap.getWidth(), (float) entry.height / thumbBitmap.getHeight()); - matrix.postScale((float) getWidth() / entry.resultWidth, (float) getHeight() / entry.resultHeight); + } + + @Override + protected void dispatchDraw(Canvas canvas) { + drawBackground(canvas); + if (cropEditorDrawing != null) { + cropEditorDrawing.contentView.drawImage(canvas, true); + } else if (draw && entry != null && !isCollage()) { + float alpha = this.thumbAlpha.set(bitmap == null); + if (thumbBitmap != null && alpha > 0.0f) { + canvas.save(); + canvas.scale((float) getWidth() / entry.resultWidth, (float) getHeight() / entry.resultHeight); + canvas.concat(entry.matrix); + if (entry.crop != null) { + canvas.translate(entry.width / 2.0f, entry.height / 2.0f); + canvas.rotate(-entry.orientation); + int w = entry.width, h = entry.height; + if (((entry.orientation + entry.crop.transformRotation) / 90) % 2 == 1) { + w = entry.height; + h = entry.width; + } + canvas.clipRect( + -w * entry.crop.cropPw / 2.0f, -h * entry.crop.cropPh / 2.0f, + +w * entry.crop.cropPw / 2.0f, +h * entry.crop.cropPh / 2.0f + ); + canvas.scale(entry.crop.cropScale, entry.crop.cropScale); + canvas.translate(entry.crop.cropPx * w, entry.crop.cropPy * h); + canvas.rotate(entry.crop.cropRotate + entry.crop.transformRotation); + if (entry.crop.mirrored) { + canvas.scale(-1, 1); + } + canvas.rotate(entry.orientation); + canvas.translate(-entry.width / 2.0f, -entry.height / 2.0f); + } + canvas.scale((float) entry.width / thumbBitmap.getWidth(), (float) entry.height / thumbBitmap.getHeight()); bitmapPaint.setAlpha(0xFF); - canvas.drawBitmap(thumbBitmap, matrix, bitmapPaint); + canvas.drawBitmap(thumbBitmap, 0, 0, bitmapPaint); + canvas.restore(); } if (bitmap != null) { - matrix.set(entry.matrix); - matrix.preScale((float) entry.width / bitmap.getWidth(), (float) entry.height / bitmap.getHeight()); - matrix.postScale((float) getWidth() / entry.resultWidth, (float) getHeight() / entry.resultHeight); - bitmapPaint.setAlpha((int) (0xFF * alpha)); - canvas.drawBitmap(bitmap, matrix, bitmapPaint); + canvas.save(); + canvas.scale((float) getWidth() / entry.resultWidth, (float) getHeight() / entry.resultHeight); + canvas.concat(entry.matrix); + if (entry.crop != null) { + canvas.translate(entry.width / 2.0f, entry.height / 2.0f); + canvas.rotate(-entry.orientation); + int w = entry.width, h = entry.height; + if (((entry.orientation + entry.crop.transformRotation) / 90) % 2 == 1) { + w = entry.height; + h = entry.width; + } + canvas.clipRect( + -w * entry.crop.cropPw / 2.0f, -h * entry.crop.cropPh / 2.0f, + +w * entry.crop.cropPw / 2.0f, +h * entry.crop.cropPh / 2.0f + ); + canvas.scale(entry.crop.cropScale, entry.crop.cropScale); + canvas.translate(entry.crop.cropPx * w, entry.crop.cropPy * h); + canvas.rotate(entry.crop.cropRotate + entry.crop.transformRotation); + if (entry.crop.mirrored) { + canvas.scale(-1, 1); + } + canvas.rotate(entry.orientation); + canvas.translate(-entry.width / 2.0f, -entry.height / 2.0f); + } + canvas.scale((float) entry.width / bitmap.getWidth(), (float) entry.height / bitmap.getHeight()); + bitmapPaint.setAlpha((int) (0xFF * (1.0f - alpha))); + canvas.drawBitmap(bitmap, 0, 0, bitmapPaint); + canvas.restore(); } } super.dispatchDraw(canvas); } + public int getContentWidth() { + if (entry == null) return 1; + return entry.width; + } + + public int getContentHeight() { + if (entry == null) return 1; + return entry.height; + } + + public void drawContent(Canvas canvas) { + if (textureView != null) { + canvas.save(); +// textureView.getTransform(matrix); + canvas.scale((float) getContentWidth() / getWidth(), (float) getContentHeight() / getHeight()); + canvas.concat(transformBackMatrix); + textureView.draw(canvas); + canvas.restore(); + } else if (bitmap != null && entry != null) { +// matrix.set(entry.matrix); + matrix.reset(); + matrix.preScale((float) entry.width / bitmap.getWidth(), (float) entry.height / bitmap.getHeight()); + bitmapPaint.setAlpha(0xFF); + canvas.drawBitmap(bitmap, matrix, bitmapPaint); + } + } + + public void getContentMatrix(Matrix matrix) { + if (entry == null) { + matrix.reset(); + return; + } +// matrix. + } + public VideoEditTextureView getTextureView() { return textureView; } @@ -1390,6 +1501,9 @@ public void setVisibility(int visibility) { } } + private final Matrix invertMatrix = new Matrix(); + private final Matrix transformMatrix = new Matrix(); + private final Matrix transformBackMatrix = new Matrix(); public void applyMatrix() { if (entry == null || entry.isRepostMessage) { return; @@ -1397,17 +1511,71 @@ public void applyMatrix() { if (textureView != null) { matrix.set(entry.matrix); matrix.preScale( - 1f / getWidth() * (entry.width < 0 ? videoWidth : entry.width), - 1f / getHeight() * (entry.height < 0 ? videoHeight : entry.height) + 1f / getWidth() * (entry.width < 0 ? videoWidth : entry.width), + 1f / getHeight() * (entry.height < 0 ? videoHeight : entry.height) ); matrix.postScale( - (float) getWidth() / entry.resultWidth, - (float) getHeight() / entry.resultHeight + (float) getWidth() / entry.resultWidth, + (float) getHeight() / entry.resultHeight ); + transformBackMatrix.reset(); + transformMatrix.invert(transformBackMatrix); textureView.setTransform(matrix); textureView.invalidate(); } invalidate(); +// +// invertMatrix.reset(); +// entry.matrix.invert(invertMatrix); +// if (entry == null || entry.isRepostMessage) { +// return; +// } +// if (textureView != null) { +// setTextureViewTransform(false, textureView); +// textureView.invalidate(); +// } +// invalidate(); + } + + public void setTextureViewTransform(boolean applyRotation, TextureView view) { + if (entry == null || view == null) { + return; + } + invalidate(); + transformMatrix.reset(); + transformMatrix.postScale( + 1f / getWidth() * (entry.width < 0 ? videoWidth : entry.width), + 1f / getHeight() * (entry.height < 0 ? videoHeight : entry.height) + ); + if (entry.crop != null) { + transformMatrix.preTranslate(entry.width / 2.0f, entry.height / 2.0f); + transformMatrix.preRotate(-entry.orientation); + int w = entry.width, h = entry.height; + if (((entry.orientation + entry.crop.transformRotation) / 90) % 2 == 1) { + w = entry.height; + h = entry.width; + } +// canvas.clipRect( +// -w * entry.crop.cropPw / 2.0f, -h * entry.crop.cropPh / 2.0f, +// +w * entry.crop.cropPw / 2.0f, +h * entry.crop.cropPh / 2.0f +// ); + transformMatrix.preScale(entry.crop.cropScale, entry.crop.cropScale); + transformMatrix.preTranslate(entry.crop.cropPx * w, entry.crop.cropPy * h); + transformMatrix.preRotate(entry.crop.cropRotate + entry.crop.transformRotation); + if (entry.crop.mirrored) { + transformMatrix.preScale(-1, 1); + } + transformMatrix.preRotate(entry.orientation); + transformMatrix.preTranslate(-entry.width / 2.0f, -entry.height / 2.0f); + } + transformMatrix.preConcat(entry.matrix); + transformMatrix.preScale( + (float) getWidth() / entry.resultWidth, + (float) getHeight() / entry.resultHeight + ); + transformBackMatrix.reset(); + transformMatrix.invert(transformBackMatrix); + view.setTransform(transformMatrix); } private boolean allowCropping = true; @@ -1827,4 +1995,12 @@ public static Drawable getBackgroundDrawableFromTheme(int currentAccount, EmojiT protected boolean verifyDrawable(@NonNull Drawable who) { return wallpaperDrawable == who || super.verifyDrawable(who); } + + private CropEditor cropEditorDrawing; + public void setCropEditorDrawing(CropEditor cropEditor) { + if (cropEditorDrawing != cropEditor) { + cropEditorDrawing = cropEditor; + invalidate(); + } + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/QRScanner.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/QRScanner.java new file mode 100644 index 0000000000..b7e31f46cc --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/QRScanner.java @@ -0,0 +1,353 @@ +package org.telegram.ui.Stories.recorder; + +import static org.telegram.messenger.AndroidUtilities.dp; +import static org.telegram.messenger.AndroidUtilities.lerp; + +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.PointF; +import android.graphics.RectF; +import android.text.TextUtils; +import android.util.SparseArray; +import android.view.TextureView; +import android.view.View; + +import androidx.annotation.NonNull; + +import com.google.android.gms.vision.Frame; +import com.google.android.gms.vision.barcode.Barcode; +import com.google.android.gms.vision.barcode.BarcodeDetector; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.MessagesController; +import org.telegram.messenger.SharedConfig; +import org.telegram.messenger.UserConfig; +import org.telegram.messenger.Utilities; +import org.telegram.messenger.camera.CameraView; +import org.telegram.ui.Components.AnimatedFloat; +import org.telegram.ui.Components.CubicBezierInterpolator; + +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; + +public class QRScanner { + + private final AtomicReference detector = new AtomicReference<>(); + private final AtomicBoolean paused = new AtomicBoolean(false); + + private final Utilities.Callback listener; + private Detected lastDetected; + private final String prefix; + + public QRScanner(Context context, Utilities.Callback whenScanned) { + this.listener = whenScanned; + this.prefix = MessagesController.getInstance(UserConfig.selectedAccount).linkPrefix; + Utilities.globalQueue.postRunnable(() -> { + detector.set(new BarcodeDetector.Builder(context).setBarcodeFormats(Barcode.QR_CODE).build()); + attach(cameraView); + }); + } + + public Detected getDetected() { + return lastDetected; + } + + private CameraView cameraView; + + public void destroy() { + this.cameraView = null; + Utilities.globalQueue.cancelRunnable(this.process); + } + + public void attach(CameraView cameraView) { + this.cameraView = cameraView; + if (detector.get() == null) return; + + if (!paused.get()) { + Utilities.globalQueue.cancelRunnable(this.process); + Utilities.globalQueue.postRunnable(this.process, getTimeout()); + } + } + + public void setPaused(boolean pause) { + if (this.paused.getAndSet(pause) == pause) return; + + if (pause) { + Utilities.globalQueue.cancelRunnable(this.process); + if (lastDetected != null) { + lastDetected = null; + AndroidUtilities.runOnUIThread(() -> QRScanner.this.listener.run(null)); + } + } else { + Utilities.globalQueue.cancelRunnable(this.process); + Utilities.globalQueue.postRunnable(this.process, getTimeout()); + } + } + + public boolean isPaused() { + return this.paused.get(); + } + + private Bitmap cacheBitmap; + private final Runnable process = () -> { + if (detector.get() == null || cameraView == null || paused.get()) { + return; + } + + TextureView textureView = cameraView.getTextureView(); + if (textureView != null) { + final int maxSide = 720; + int w = textureView.getWidth(); + int h = textureView.getHeight(); + if (w > maxSide || h > maxSide) { + final float scale = Math.min((float) maxSide / w, (float) maxSide / h); + w = (int) (w * scale); + h = (int) (h * scale); + } + w = Math.max(1, w); + h = Math.max(1, h); + if (cacheBitmap == null || w != cacheBitmap.getWidth() || h != cacheBitmap.getHeight()) { + cacheBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); + } + textureView.getBitmap(cacheBitmap); + final Detected detected = detect(cacheBitmap); + if ((lastDetected != null) != (detected != null) || detected != null && lastDetected != null && !detected.equals(lastDetected)) { + lastDetected = detected; + AndroidUtilities.runOnUIThread(() -> QRScanner.this.listener.run(detected)); + } + } + + if (!paused.get()) { + Utilities.globalQueue.cancelRunnable(this.process); + Utilities.globalQueue.postRunnable(this.process, getTimeout()); + } + }; + + private Detected detect(Bitmap bitmap) { + if (bitmap == null) { + return null; + } + + final BarcodeDetector detector = this.detector.get(); + if (detector == null || !detector.isOperational()) { + return null; + } + + final int w = bitmap.getWidth(); + final int h = bitmap.getHeight(); + final Frame frame = new Frame.Builder().setBitmap(bitmap).build(); + final SparseArray codes = detector.detect(frame); + + for (int i = 0; i < codes.size(); ++i) { + final Barcode code = codes.valueAt(i); + String link = code.rawValue; + if (link == null) continue; + link = link.trim(); + if (!link.startsWith(prefix) && !link.startsWith("https://" + prefix) && !link.startsWith("http://" + prefix)) continue; + + final PointF[] cornerPoints = new PointF[code.cornerPoints.length]; + for (int j = 0; j < code.cornerPoints.length; ++j) { + cornerPoints[j] = new PointF((float) code.cornerPoints[j].x / w, (float) code.cornerPoints[j].y / h); + } + + return new Detected(link, cornerPoints); + } + + return null; + } + + public int getMaxSide() { + switch (SharedConfig.getDevicePerformanceClass()) { + case SharedConfig.PERFORMANCE_CLASS_HIGH: return 720; + case SharedConfig.PERFORMANCE_CLASS_AVERAGE: return 540; + default: return 540; + } + } + + public long getTimeout() { + if (lastDetected == null) { + return 750; + } + switch (SharedConfig.getDevicePerformanceClass()) { + case SharedConfig.PERFORMANCE_CLASS_HIGH: return 80; + case SharedConfig.PERFORMANCE_CLASS_AVERAGE: return 400; + default: return 800; + } + } + + public void detach() { + BarcodeDetector detector = this.detector.getAndSet(null); + if (detector != null) { + detector.release(); + } + } + + public static final class Detected { + + public final String link; + public final PointF[] points; + + public final float cx, cy; + + private Detected(String link, PointF[] points) { + this.link = link; + this.points = points; + + float cx = 0, cy = 0; + if (points != null) { + for (int i = 0; i < points.length; ++i) { + cx += points[i].x; + cy += points[i].y; + } + cx /= points.length; + cy /= points.length; + } + this.cx = cx; + this.cy = cy; + } + + public boolean equals(Detected d) { + if (d == null) return false; + if (!TextUtils.equals(link, d.link)) return false; + if (points == d.points) return true; + if ((points != null) != (d.points != null)) return false; + if (points == null || d.points == null) return false; + if (points.length != d.points.length) return false; + for (int i = 0; i < points.length; ++i) { + if (Math.abs(points[i].x - d.points[i].x) > 0.001f || Math.abs(points[i].y - d.points[i].y) > 0.001f) { + return false; + } + } + return true; + } + } + + public static class QrRegionView extends View { + + public final QrRegionDrawer drawer = new QrRegionDrawer(this::invalidate); + private final RectF rect = new RectF(); + + public QrRegionView(Context context) { + super(context); + } + + @Override + protected void dispatchDraw(@NonNull Canvas canvas) { + if (drawer.hasNoDraw()) { + return; + } + rect.set(0, 0, getWidth(), getHeight()); + drawer.draw(canvas, rect); + } + } + + public static class QrRegionDrawer { + + private final Runnable invalidate; + + private boolean hasQrResult; + private QRScanner.Detected qrResult; + private final AnimatedFloat animatedQr, animatedQrCX, animatedQrCY; + private final AnimatedFloat[] animatedQPX; + private final AnimatedFloat[] animatedQPY; + + public QrRegionDrawer(Runnable invalidate) { + this.invalidate = invalidate; + + animatedQr = new AnimatedFloat(0, this.invalidate, 0, 320, CubicBezierInterpolator.EASE_OUT); + animatedQrCX = new AnimatedFloat(0, this.invalidate, 0, 160, CubicBezierInterpolator.EASE_OUT); + animatedQrCY = new AnimatedFloat(0, this.invalidate, 0, 160, CubicBezierInterpolator.EASE_OUT); + animatedQPX = new AnimatedFloat[] { + new AnimatedFloat(0, this.invalidate, 0, 160, CubicBezierInterpolator.EASE_OUT), + new AnimatedFloat(0, this.invalidate, 0, 160, CubicBezierInterpolator.EASE_OUT), + new AnimatedFloat(0, this.invalidate, 0, 160, CubicBezierInterpolator.EASE_OUT), + new AnimatedFloat(0, this.invalidate, 0, 160, CubicBezierInterpolator.EASE_OUT) + }; + animatedQPY = new AnimatedFloat[] { + new AnimatedFloat(0, this.invalidate, 0, 160, CubicBezierInterpolator.EASE_OUT), + new AnimatedFloat(0, this.invalidate, 0, 160, CubicBezierInterpolator.EASE_OUT), + new AnimatedFloat(0, this.invalidate, 0, 160, CubicBezierInterpolator.EASE_OUT), + new AnimatedFloat(0, this.invalidate, 0, 160, CubicBezierInterpolator.EASE_OUT) + }; + } + + public void draw(Canvas canvas, RectF rect) { + if (qrResult == null || qrResult.points.length <= 0) { + return; + } + + final float qrAlpha = animatedQr.set(hasQrResult); + final float cx = animatedQrCX.set(qrResult.cx), cxPx = rect.left + cx * rect.width(); + final float cy = animatedQrCY.set(qrResult.cy), cyPx = rect.top + cy * rect.height(); + final float qrScale = lerp(0.5f, 1.1f, qrAlpha); + + canvas.save(); + canvas.scale(qrScale, qrScale, cxPx, cyPx); + if (qrAlpha > 0) { + qrPath.rewind(); + final int len = Math.min(4, qrResult.points.length); + for (int i = 0; i < len; ++i) { + final int li = i - 1 < 0 ? len - 1 : i - 1; + final int ri = i + 1 >= len ? 0 : i + 1; + + final PointF l = qrResult.points[li]; + final PointF p = qrResult.points[i]; + final PointF r = qrResult.points[ri]; + + float lx = rect.left + (animatedQPX[li].set(l.x - qrResult.cx) + cx) * rect.width(), ly = rect.top + (animatedQPY[li].set(l.y - qrResult.cy) + cy) * rect.height(); + float px = rect.left + (animatedQPX[i].set(p.x - qrResult.cx) + cx) * rect.width(), py = rect.top + (animatedQPY[i].set(p.y - qrResult.cy) + cy) * rect.height(); + float rx = rect.left + (animatedQPX[ri].set(r.x - qrResult.cx) + cx) * rect.width(), ry = rect.top + (animatedQPY[ri].set(r.y - qrResult.cy) + cy) * rect.height(); + + final float lvx = lx - px, lvy = ly - py; + final float rvx = rx - px, rvy = ry - py; + + qrPath.moveTo( + px + lvx * .18f, + py + lvy * .18f + ); + qrPath.lineTo(px, py); + qrPath.lineTo( + px + rvx * .18f, + py + rvy * .18f + ); + } + qrPaint.setAlpha((int) (0xFF * qrAlpha)); + canvas.drawPath(qrPath, qrPaint); + } + canvas.restore(); + } + + private final Paint qrPaint = new Paint(Paint.ANTI_ALIAS_FLAG); { + qrPaint.setStyle(Paint.Style.STROKE); + qrPaint.setColor(0xFFFFDE07); + qrPaint.setStrokeWidth(dp(6)); + qrPaint.setStrokeJoin(Paint.Join.ROUND); + qrPaint.setStrokeCap(Paint.Cap.ROUND); + qrPaint.setShadowLayer(0x40666666, 0, dp(3), dp(6)); + } + private final Path qrPath = new Path(); + + public void setQrDetected(QRScanner.Detected qrResult) { + if (qrResult != null) { + this.qrResult = qrResult; + } + if (qrResult != null && !hasQrResult) { + animatedQrCX.set(qrResult.cx, true); + animatedQrCY.set(qrResult.cy, true); + for (int i = 0; i < Math.min(4, qrResult.points.length); ++i) { + animatedQPX[i].set(qrResult.points[i].x - qrResult.cx, true); + animatedQPY[i].set(qrResult.points[i].y - qrResult.cy, true); + } + } + hasQrResult = qrResult != null; + this.invalidate.run(); + } + + public boolean hasNoDraw() { + return !hasQrResult && animatedQr.get() <= 0; + } + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/RecordControl.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/RecordControl.java index 0bd6cdf2db..2232bc1403 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/RecordControl.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/RecordControl.java @@ -67,6 +67,13 @@ public interface Delegate { void onVideoRecordLocked(); boolean canRecordAudio(); void onCheckClick(); + + default long getMaxVideoDuration() { + return 60 * 1000L; + } + default boolean showStoriesDrafts() { + return true; + } } public void startAsVideo(boolean isVideo) { @@ -117,7 +124,6 @@ public void setDelegate(Delegate delegate) { private boolean dual; private final AnimatedFloat dualT = new AnimatedFloat(this, 0, 330, CubicBezierInterpolator.EASE_OUT_QUINT); - private static final long MAX_DURATION = 60 * 1000L; private long recordingStart; private long lastDuration; @@ -185,11 +191,13 @@ public RecordControl(Context context) { public void updateGalleryImage() { final String filter = "80_80"; - ArrayList drafts = MessagesController.getInstance(galleryImage.getCurrentAccount()).getStoriesController().getDraftsController().drafts; - galleryImage.setOrientation(0, 0, true); - if (drafts != null && !drafts.isEmpty() && drafts.get(0).draftThumbFile != null) { - galleryImage.setImage(ImageLocation.getForPath(drafts.get(0).draftThumbFile.getAbsolutePath()), filter, null, null, noGalleryDrawable, 0, null, null, 0); - return; + if (delegate != null && delegate.showStoriesDrafts()) { + ArrayList drafts = MessagesController.getInstance(galleryImage.getCurrentAccount()).getStoriesController().getDraftsController().drafts; + galleryImage.setOrientation(0, 0, true); + if (drafts != null && !drafts.isEmpty() && drafts.get(0).draftThumbFile != null) { + galleryImage.setImage(ImageLocation.getForPath(drafts.get(0).draftThumbFile.getAbsolutePath()), filter, null, null, noGalleryDrawable, 0, null, null, 0); + return; + } } MediaController.AlbumEntry albumEntry = MediaController.allMediaAlbumEntry; MediaController.PhotoEntry photoEntry = null; @@ -432,11 +440,12 @@ protected void onDraw(Canvas canvas) { canvas.drawArc(AndroidUtilities.rectTmp, -90, 360 * collageProgress, false, outlinePaint); } - long duration = System.currentTimeMillis() - recordingStart; - float recordEndT = recording ? 0 : 1f - recordingLongT; - float sweepAngle = duration / (float) MAX_DURATION * 360; + final long duration = System.currentTimeMillis() - recordingStart; + final float recordEndT = recording ? 0 : 1f - recordingLongT; + final long maxDuration = delegate != null ? delegate.getMaxVideoDuration() : 60_000; + final float sweepAngle = Math.min(duration / (float) (maxDuration < 0 ? 60_000 : maxDuration) * 360, 360); - float recordingLoading = this.recordingLoadingT.set(this.recordingLoading); + final float recordingLoading = this.recordingLoadingT.set(this.recordingLoading); outlineFilledPaint.setStrokeWidth(strokeWidth); outlineFilledPaint.setAlpha((int) (0xFF * Math.max(.7f * recordingLoading, 1f - recordEndT))); @@ -466,7 +475,7 @@ protected void onDraw(Canvas canvas) { if (duration / 1000L != lastDuration / 1000L) { delegate.onVideoDuration(duration / 1000L); } - if (duration >= MAX_DURATION) { + if (maxDuration > 0 && duration >= maxDuration) { post(() -> { recording = false; longpressRecording = false; @@ -804,6 +813,10 @@ public boolean onTouchEvent(MotionEvent event) { return r; } + public boolean isRecording() { + return recording; + } + public void stopRecording() { if (!recording) { return; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/ScannedLinkPreview.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/ScannedLinkPreview.java new file mode 100644 index 0000000000..e46ed2fc82 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/ScannedLinkPreview.java @@ -0,0 +1,414 @@ +package org.telegram.ui.Stories.recorder; + +import static org.telegram.messenger.AndroidUtilities.dp; +import static org.telegram.messenger.AndroidUtilities.lerp; +import static org.telegram.messenger.LocaleController.getString; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.Path; +import android.graphics.RectF; +import android.graphics.RenderNode; +import android.graphics.drawable.Drawable; +import android.net.Uri; +import android.os.Build; +import android.os.Bundle; +import android.text.SpannableStringBuilder; +import android.text.Spanned; +import android.text.TextUtils; +import android.view.MotionEvent; +import android.view.View; + +import androidx.annotation.NonNull; + +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.FileLog; +import org.telegram.messenger.ImageReceiver; +import org.telegram.messenger.MessagesController; +import org.telegram.messenger.R; +import org.telegram.messenger.UserConfig; +import org.telegram.messenger.UserNameResolver; +import org.telegram.messenger.UserObject; +import org.telegram.messenger.Utilities; +import org.telegram.tgnet.ConnectionsManager; +import org.telegram.tgnet.TLObject; +import org.telegram.tgnet.TLRPC; +import org.telegram.ui.ActionBar.BaseFragment; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.AvatarSpan; +import org.telegram.ui.ChatActivity; +import org.telegram.ui.Components.AnimatedFloat; +import org.telegram.ui.Components.AvatarDrawable; +import org.telegram.ui.Components.ButtonBounce; +import org.telegram.ui.Components.ColoredImageSpan; +import org.telegram.ui.Components.CubicBezierInterpolator; +import org.telegram.ui.Components.Point; +import org.telegram.ui.Components.Text; +import org.telegram.ui.ProfileActivity; + +import java.util.ArrayList; +import java.util.List; + +public class ScannedLinkPreview extends View { + + private final int currentAccount; + private final Runnable resolvedListener; + private Utilities.Callback> clickListener; + + private final AnimatedFloat animatedAlpha = new AnimatedFloat(this, 0, 320, CubicBezierInterpolator.EASE_OUT_QUINT); + + private final RectF bounds = new RectF(); + private final RectF clipBounds = new RectF(); + private final ImageReceiver imageReceiver = new ImageReceiver(this); + private boolean hasImage; + private Text title, subtitle; + private final Path clipPath = new Path(); + private final Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private final ButtonBounce bounce = new ButtonBounce(this); + + private boolean hasResolved; + private ResolvedLink resolved; + + public ScannedLinkPreview(Context context, int currentAccount, Runnable resolvedListener) { + super(context); + this.currentAccount = currentAccount; + this.resolvedListener = resolvedListener; + } + + public void whenClicked(Utilities.Callback> clickListener) { + this.clickListener = clickListener; + } + + private View blurView; + private Object blurRenderNode; + public void setBlurRenderNode(View renderNodeView, Object renderNode) { + this.blurView = renderNodeView; + this.blurRenderNode = renderNode; + invalidate(); + } + + public boolean isResolved() { + return hasResolved; + } + + private Runnable currentCancel; + private String currentLink; + public void setLink(String link) { + if (TextUtils.isEmpty(link)) { + if (currentCancel != null) { + currentCancel.run(); + currentCancel = null; + } + if (hasResolved) invalidate(); + hasResolved = false; + currentLink = null; + if (resolvedListener != null) { + resolvedListener.run(); + } + } else if (resolved == null && currentCancel == null || resolved != null && !TextUtils.equals(resolved.sourceLink, link) && !TextUtils.equals(currentLink, link)) { + if (currentCancel != null) { + currentCancel.run(); + currentCancel = null; + } + resolved = null; + currentLink = link; + currentCancel = ResolvedLink.resolve(currentAccount, link, result -> { + currentCancel = null; + resolved = result; + hasResolved = result != null; + setup(); + invalidate(); + if (resolvedListener != null) { + resolvedListener.run(); + } + }); + } else if (resolved != null && !hasResolved && TextUtils.equals(resolved.sourceLink, link)) { + hasResolved = true; + setup(); + invalidate(); + if (resolvedListener != null) { + resolvedListener.run(); + } + } + } + + public void cancel() { + if (currentCancel != null) { + currentCancel.run(); + currentCancel = null; + } + resolved = null; + hasResolved = false; + invalidate(); + if (resolvedListener != null) { + resolvedListener.run(); + } + } + + private void setup() { + if (resolved == null) return; + title = new Text(resolved.getTitle(), 16, AndroidUtilities.bold()); + final SpannableStringBuilder sb = new SpannableStringBuilder(resolved.getSubtitle()); + if (sb.toString().contains(">")) { + sb.clear(); + sb.append(AndroidUtilities.replaceArrows(resolved.getSubtitle(), false)); + } else { + sb.append(" "); + sb.append(">"); + final ColoredImageSpan span = new ColoredImageSpan(R.drawable.settings_arrow); + span.setScale(1.25f, 1.25f); + sb.setSpan(span, sb.length() - 1, sb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + } + subtitle = new Text(sb, 14); + hasImage = resolved.setImage(imageReceiver); + } + + private final int[] thisLocation = new int[2]; + private final int[] blurLocation = new int[2]; + + @Override + protected void dispatchDraw(@NonNull Canvas canvas) { + final float alpha = animatedAlpha.set(hasResolved); + if (title == null || subtitle == null) return; + if (alpha <= 0) return; + + title.ellipsize(getWidth() * .7f); + subtitle.ellipsize(getWidth() * .7f); + + final float px = dp(5), py = dp(10); + final float imgsize = dp(32); + final float pph = dp(2), pimg = dp(11); + + final float width = Math.max(Math.min(dp(200), getWidth() * .8f), px + (hasImage ? pimg + imgsize + pimg : 0) + Math.max(title.getCurrentWidth(), subtitle.getCurrentWidth()) + dp(15) + px); + final float height = py + Math.max(hasImage ? imgsize : 0, title.getHeight() + pph + subtitle.getHeight()) + py; + + final float scale = bounce.getScale(0.05f) * lerp(0.6f, 1.0f, alpha); + final float ty = dp(15) * (1.0f - alpha); + + bounds.set((getWidth() - width) / 2.0f, (getHeight() - height) / 2.0f, (getWidth() + width) / 2.0f, (getHeight() + height) / 2.0f); + clipBounds.set(bounds); + AndroidUtilities.scaleRect(clipBounds, scale); + clipBounds.offset(0, ty); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && blurRenderNode != null && blurView != null) { + final RenderNode node = (RenderNode) blurRenderNode; + clipPath.rewind(); + clipPath.addRoundRect(clipBounds, dp(12), dp(12), Path.Direction.CW); + getLocationOnScreen(thisLocation); + blurView.getLocationOnScreen(blurLocation); + canvas.saveLayerAlpha(clipBounds, (int) (0xFF * alpha), Canvas.ALL_SAVE_FLAG); + canvas.clipPath(clipPath); + canvas.translate(blurLocation[0] - thisLocation[0], blurLocation[1] - thisLocation[1]); + final float s = Math.max((float) blurView.getWidth() / node.getWidth(), (float) blurView.getHeight() / node.getHeight()); + canvas.scale(s, s); + canvas.drawRenderNode(node); + canvas.restore(); + backgroundPaint.setColor(Theme.multAlpha(0x70000000, alpha)); + canvas.drawRoundRect(clipBounds, dp(12), dp(12), backgroundPaint); + } else { + backgroundPaint.setColor(Theme.multAlpha(0xdd000000, alpha)); + canvas.drawRoundRect(clipBounds, dp(12), dp(12), backgroundPaint); + } + + canvas.save(); + canvas.translate(0, ty); + canvas.scale(scale, scale, bounds.centerX(), bounds.centerY()); + + if (hasImage) { + imageReceiver.setRoundRadius((int) (imgsize / 2.0f)); + imageReceiver.setImageCoords(bounds.left + px + pimg, bounds.centerY() - imgsize / 2.0f, imgsize, imgsize); + imageReceiver.setAlpha(alpha); + imageReceiver.draw(canvas); + } + final float textTop = bounds.centerY() - (title.getHeight() + pph + subtitle.getHeight()) / 2.0f; + title.draw(canvas, bounds.left + (hasImage ? pimg + imgsize + pimg : 0) + px, textTop + title.getHeight() / 2.0f, 0xFFFFFFFF, alpha); + subtitle.draw(canvas, bounds.left + (hasImage ? pimg + imgsize + pimg : 0) + px, textTop + title.getHeight() + pph + subtitle.getHeight() / 2.0f, Theme.blendOver(0xFF000000, 0x9FFFFFFF), alpha); + + canvas.restore(); + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + imageReceiver.onAttachedToWindow(); + } + + @Override + protected void onDetachedFromWindow() { + super.onDetachedFromWindow(); + imageReceiver.onDetachedFromWindow(); + } + + private boolean touch; + public boolean inTouch() { + return bounce.isPressed() || touch; + } + + @Override + public boolean dispatchTouchEvent(MotionEvent e) { + if (!hasResolved || resolved == null) { + bounce.setPressed(touch = false); + return false; + } + if (e.getAction() == MotionEvent.ACTION_DOWN) { + if (bounds.contains(e.getX(), e.getY())) { + bounce.setPressed(touch = true); + } + } else if (e.getAction() == MotionEvent.ACTION_MOVE) { + if (bounce.isPressed() && !bounds.contains(e.getX(), e.getY())) { + bounce.setPressed(false); + } + } else if (e.getAction() == MotionEvent.ACTION_UP) { + if (bounce.isPressed()) { + if (clickListener != null && resolved != null) { + clickListener.run(fragment -> { + if (resolved != null || fragment == null) { + resolved.open(fragment); + } + }); + } + } + bounce.setPressed(false); + touch = false; + } else if (e.getAction() == MotionEvent.ACTION_CANCEL) { + bounce.setPressed(false); + touch = false; + } + return touch || bounce.isPressed(); + } + + public static class ResolvedLink { + + public final String sourceLink; + public ResolvedLink(String sourceLink) { + this.sourceLink = sourceLink; + } + + public static Runnable resolve(int currentAccount, String link, Utilities.Callback whenResolved) { + if (whenResolved == null) return null; + try { + final MessagesController mc = MessagesController.getInstance(currentAccount); + final String prefix = mc.linkPrefix; + + final Uri uri = Uri.parse(link); + if (!TextUtils.equals(uri.getHost(), prefix)) { + return null; + } + + final List segments = uri.getPathSegments(); + + if (segments.isEmpty()) { + return null; + } + + final String first = segments.get(0); + final String referrer = uri.getQueryParameter("ref"); + + if (TextUtils.isEmpty(referrer)) { + TLObject obj = mc.getUserOrChat(first); + if (obj instanceof TLRPC.User) { + whenResolved.run(fromUser(link, (TLRPC.User) obj)); + return null; + } else if (obj instanceof TLRPC.Chat) { + whenResolved.run(fromChat(link, (TLRPC.Chat) obj)); + return null; + } + } + + return mc.getUserNameResolver().resolve(first, referrer, did -> { + if (did == null) { + whenResolved.run(null); + } else { + TLObject obj = mc.getUserOrChat(did); + if (obj instanceof TLRPC.User) { + whenResolved.run(fromUser(link, (TLRPC.User) obj)); + } else if (obj instanceof TLRPC.Chat) { + whenResolved.run(fromChat(link, (TLRPC.Chat) obj)); + } + } + }); + } catch (Exception e) { + FileLog.e(e); + } + whenResolved.run(null); + return null; + } + + public static ResolvedLink fromUser(String link, TLRPC.User user) { + if (user == null) return null; + return new ResolvedLink(link) { + @Override + public String getTitle() { + return UserObject.getUserName(user); + } + @Override + public String getSubtitle() { + return getString(R.string.ViewProfile); + } + @Override + public boolean setImage(ImageReceiver imageReceiver) { + AvatarDrawable avatarDrawable = new AvatarDrawable(); + avatarDrawable.setInfo(user); + imageReceiver.setForUserOrChat(user, avatarDrawable); + return true; + } + @Override + public void open(BaseFragment fragment) { + if (user.id == UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId()) { + Bundle args = new Bundle(); + args.putLong("user_id", user.id); + args.putBoolean("my_profile", true); + fragment.presentFragment(new ProfileActivity(args, null)); + } else { + fragment.presentFragment(ProfileActivity.of(user.id)); + } + } + }; + } + + public static ResolvedLink fromChat(String link, TLRPC.Chat chat) { + if (chat == null) return null; + return new ResolvedLink(link) { + @Override + public String getTitle() { + return chat.title; + } + @Override + public String getSubtitle() { + return getString(R.string.AccDescrOpenChat); + } + @Override + public boolean setImage(ImageReceiver imageReceiver) { + AvatarDrawable avatarDrawable = new AvatarDrawable(); + avatarDrawable.setInfo(chat); + imageReceiver.setForUserOrChat(chat, avatarDrawable); + return true; + } + @Override + public void open(BaseFragment fragment) { + fragment.presentFragment(ChatActivity.of(-chat.id)); + } + }; + } + + + public String getTitle() { + return null; + } + + public String getSubtitle() { + return null; + } + + public boolean setImage(ImageReceiver imageReceiver) { + return false; + } + + public void open(BaseFragment fragment) { + + } + + } + + +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/SliderView.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/SliderView.java index e1f2c2a837..74651e4a70 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/SliderView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/SliderView.java @@ -215,8 +215,7 @@ public boolean dispatchTouchEvent(MotionEvent event) { if (volume <= this.minVolume && pastVolume > volume || volume >= this.maxVolume && pastVolume < volume) { try { performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); - } catch (Exception ignore) { - } + } catch (Exception ignored) {} } else if (Math.floor(pastVolume * 5) != Math.floor(volume * 5)) { AndroidUtilities.vibrateCursor(this); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/StoryEntry.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/StoryEntry.java index 97ec0b5467..0f394741dc 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/StoryEntry.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/StoryEntry.java @@ -18,6 +18,7 @@ import android.provider.MediaStore; import android.text.SpannableString; import android.text.TextUtils; +import android.util.Pair; import androidx.annotation.NonNull; @@ -38,10 +39,12 @@ import org.telegram.messenger.Utilities; import org.telegram.messenger.VideoEditedInfo; import org.telegram.messenger.video.MediaCodecVideoConvertor; +import org.telegram.tgnet.AbstractSerializedData; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.RequestDelegate; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.Vector; import org.telegram.tgnet.tl.TL_stories; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Components.AnimatedFileDrawable; @@ -117,13 +120,13 @@ public class StoryEntry { public boolean coverSet; public Bitmap coverBitmap; -// public int width, height; public long duration; public int resultWidth = 720; public int resultHeight = 1280; public int width, height; + public MediaController.CropState crop; // matrix describes transformations from width x height to resultWidth x resultHeight public final Matrix matrix = new Matrix(); @@ -198,6 +201,12 @@ public boolean wouldBeVideo(ArrayList mediaEntities if (round != null) { return true; } + if (messageObjects != null && messageObjects.size() == 1) { + final MessageObject messageObject = messageObjects.get(0); + if (messageObject != null && messageObject.messageOwner != null && messageObject.messageOwner.action instanceof TLRPC.TL_messageActionStarGiftUnique) { + return true; + } + } if (mediaEntities != null && !mediaEntities.isEmpty()) { for (int i = 0; i < mediaEntities.size(); ++i) { VideoEditedInfo.MediaEntity entity = mediaEntities.get(i); @@ -292,29 +301,57 @@ public Bitmap buildBitmap(float scale, Bitmap mainFileBitmap) { tempMatrix.preScale(s, s); tempMatrix.postScale(scale, scale); canvas.drawBitmap(mainFileBitmap, tempMatrix, bitmapPaint); +// final float s = (float) width / mainFileBitmap.getWidth(); +// canvas.save(); +// canvas.scale(scale, scale); +// canvas.concat(matrix); +// if (crop != null) { +// canvas.translate(width / 2.0f, height / 2.0f); +// int _w = width, _h = height; +// if ((crop.transformRotation / 90) % 2 == 1) { +// _w = height; +// _h = width; +// } +// canvas.clipRect( +// -_w * crop.cropPw / 2.0f, -_h * crop.cropPh / 2.0f, +// +_w * crop.cropPw / 2.0f, +_h * crop.cropPh / 2.0f +// ); +// canvas.scale(crop.cropScale, crop.cropScale); +// canvas.translate(crop.cropPx * _w, crop.cropPy * _h); +// canvas.rotate(crop.cropRotate + crop.transformRotation); +// if (crop.mirrored) { +// canvas.scale(-1, 1); +// } +// canvas.translate(-width / 2.0f, -height / 2.0f); +// } +// canvas.scale(s, s); +// canvas.drawBitmap(mainFileBitmap, 0, 0, bitmapPaint); +// canvas.restore(); } else { if (isCollage()) { for (int i = 0; i < collageContent.size(); ++i) { - StoryEntry entry = collageContent.get(i); + final StoryEntry entry = collageContent.get(i); final File file = entry.filterFile != null ? entry.filterFile : entry.file; if (file != null) { try { final Bitmap fileBitmap = getScaledBitmap(opts -> BitmapFactory.decodeFile(file.getPath(), opts), w, h, true, true); canvas.save(); final RectF bounds = new RectF(); + int fw = fileBitmap.getWidth(), fh = fileBitmap.getHeight(); + final Pair orientation = AndroidUtilities.getImageOrientation(file); + if ((orientation.first / 90) % 2 == 1) { + fw = fileBitmap.getHeight(); + fh = fileBitmap.getWidth(); + } collage.parts.get(i).bounds(bounds, w, h); canvas.translate(bounds.centerX(), bounds.centerY()); canvas.clipRect(-bounds.width() / 2.0f, -bounds.height() / 2.0f, bounds.width() / 2.0f, bounds.height() / 2.0f); - final float s = Math.max(bounds.width() / fileBitmap.getWidth(), bounds.height() / fileBitmap.getHeight()); + final float s = Math.max(bounds.width() / fw, bounds.height() / fh); canvas.scale(s, s); + canvas.rotate(orientation.first); canvas.translate(-fileBitmap.getWidth() / 2.0f, -fileBitmap.getHeight() / 2.0f); canvas.drawBitmap(fileBitmap, 0, 0, null); canvas.restore(); -// final float s = (float) width / fileBitmap.getWidth(); -// tempMatrix.preScale(s, s); -// tempMatrix.postScale(scale, scale); -// canvas.drawBitmap(fileBitmap, tempMatrix, bitmapPaint); -// fileBitmap.recycle(); } catch (Exception e) { FileLog.e(e); } @@ -334,6 +371,40 @@ public Bitmap buildBitmap(float scale, Bitmap mainFileBitmap) { FileLog.e(e); } } +// if (file != null) { +// try { +// Bitmap fileBitmap = getScaledBitmap(opts -> BitmapFactory.decodeFile(file.getPath(), opts), w, h, true, true); +// final float s = (float) width / fileBitmap.getWidth(); +// canvas.save(); +// canvas.scale(scale, scale); +// canvas.concat(matrix); +// if (crop != null) { +// canvas.translate(width / 2.0f, height / 2.0f); +// int _w = width, _h = height; +// if ((crop.transformRotation / 90) % 2 == 1) { +// _w = height; +// _h = width; +// } +// canvas.clipRect( +// -_w * crop.cropPw / 2.0f, -_h * crop.cropPh / 2.0f, +// +_w * crop.cropPw / 2.0f, +_h * crop.cropPh / 2.0f +// ); +// canvas.scale(crop.cropScale, crop.cropScale); +// canvas.translate(crop.cropPx * _w, crop.cropPy * _h); +// canvas.rotate(crop.cropRotate + crop.transformRotation); +// if (crop.mirrored) { +// canvas.scale(-1, 1); +// } +// canvas.translate(-width / 2.0f, -height / 2.0f); +// } +// canvas.scale(s, s); +// canvas.drawBitmap(fileBitmap, 0, 0, bitmapPaint); +// canvas.restore(); +// fileBitmap.recycle(); +// } catch (Exception e) { +// FileLog.e(e); +// } +// } } if (paintFile != null) { @@ -1206,7 +1277,11 @@ public void getVideoEditedInfo(@NonNull Utilities.Callback when info.isDark = isDark; info.avatarStartTime = -1; - info.cropState = new MediaController.CropState(); + if (crop != null) { + info.cropState = crop.clone(); + } else { + info.cropState = new MediaController.CropState(); + } info.cropState.useMatrix = new Matrix(); info.cropState.useMatrix.set(matrix); @@ -1416,9 +1491,9 @@ public void checkStickers(TL_stories.StoryItem storyItem) { } final RequestDelegate requestDelegate = (response, error) -> AndroidUtilities.runOnUIThread(() -> { checkStickersReqId = 0; - if (response instanceof TLRPC.Vector) { + if (response instanceof Vector) { editStickers = new ArrayList<>(); - TLRPC.Vector vector = (TLRPC.Vector) response; + Vector vector = (Vector) response; for (int i = 0; i < vector.objects.size(); ++i) { TLRPC.StickerSetCovered setCovered = (TLRPC.StickerSetCovered) vector.objects.get(i); TLRPC.Document document = setCovered.cover; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/StoryLinkSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/StoryLinkSheet.java index e94e336181..c72514ea24 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/StoryLinkSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/StoryLinkSheet.java @@ -27,11 +27,13 @@ import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.FileLog; +import org.telegram.messenger.MessagesController; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; import org.telegram.messenger.Utilities; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Cells.EditTextCell; import org.telegram.ui.Cells.TextCheckCell; @@ -344,11 +346,19 @@ private void checkEditURL(String str) { } private final Runnable requestPreview = () -> { - TLRPC.TL_messages_getWebPagePreview req = new TLRPC.TL_messages_getWebPagePreview(); + TL_account.getWebPagePreview req = new TL_account.getWebPagePreview(); req.message = urlEditText.editText.getText().toString(); reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { - if (res instanceof TLRPC.TL_messageMediaWebPage) { - webpage = ((TLRPC.TL_messageMediaWebPage) res).webpage; + TLRPC.TL_messageMediaWebPage media = null; + if (res instanceof TL_account.webPagePreview) { + final TL_account.webPagePreview preview = (TL_account.webPagePreview) res; + MessagesController.getInstance(currentAccount).putUsers(preview.users, false); + if (preview.media instanceof TLRPC.TL_messageMediaWebPage) { + media = (TLRPC.TL_messageMediaWebPage) preview.media; + } + } + if (media != null) { + webpage = media.webpage; if (isPreviewEmpty(webpage)) { webpageId = webpage == null ? 0 : webpage.id; webpage = null; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/StoryRecorder.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/StoryRecorder.java index cee06221c2..11a30e1985 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/StoryRecorder.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/StoryRecorder.java @@ -3,6 +3,7 @@ import static org.telegram.messenger.AndroidUtilities.dp; import static org.telegram.messenger.AndroidUtilities.dpf2; import static org.telegram.messenger.AndroidUtilities.touchSlop; +import static org.telegram.messenger.LocaleController.formatPluralString; import static org.telegram.messenger.LocaleController.getString; import android.Manifest; @@ -24,7 +25,6 @@ import android.graphics.BitmapShader; import android.graphics.Canvas; import android.graphics.Color; -import android.graphics.Insets; import android.graphics.LinearGradient; import android.graphics.Matrix; import android.graphics.Outline; @@ -57,7 +57,6 @@ import android.text.style.ForegroundColorSpan; import android.text.style.ImageSpan; import android.text.style.URLSpan; -import android.util.Log; import android.util.Pair; import android.view.Gravity; import android.view.HapticFeedbackConstants; @@ -87,6 +86,7 @@ import org.telegram.messenger.AnimationNotificationsLocker; import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.BotWebViewVibrationEffect; +import org.telegram.messenger.BuildVars; import org.telegram.messenger.DialogObject; import org.telegram.messenger.FileLoader; import org.telegram.messenger.FileLog; @@ -175,7 +175,7 @@ public class StoryRecorder implements NotificationCenter.NotificationCenterDeleg private boolean isShown; private boolean prepareClosing; - WindowManager windowManager; + private final WindowManager windowManager; private final WindowManager.LayoutParams windowLayoutParams; private WindowView windowView; private ContainerView containerView; @@ -552,7 +552,7 @@ public void open(SourceView sourceView, boolean animated) { windowManager.addView(windowView, windowLayoutParams); } - cameraViewThumb.setImageDrawable(getCameraThumb()); + collageLayoutView.setCameraThumb(getCameraThumb()); if (botId == 0) { StoriesController.StoryLimit storyLimit = MessagesController.getInstance(currentAccount).getStoriesController().checkStoryLimit(); @@ -783,6 +783,7 @@ public void openRepost(SourceView sourceView, StoryEntry entry) { botEdit = null; } + private boolean fastClose; public void close(boolean animated) { if (!isShown) { return; @@ -887,6 +888,10 @@ public void onAnimationEnd(Animator animation) { if (value > 0 || containerView.getTranslationY1() < AndroidUtilities.dp(20)) { openCloseAnimator.setDuration(300L); openCloseAnimator.setInterpolator(new FastOutSlowInInterpolator()); + } else if (value < 0 && fastClose) { + openCloseAnimator.setDuration(200L); + openCloseAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT); + fastClose = false; } else { openCloseAnimator.setDuration(400L); openCloseAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT); @@ -1276,7 +1281,7 @@ public boolean onSingleTapUp(@NonNull MotionEvent e) { @Override public boolean onScroll(@NonNull MotionEvent e1, @NonNull MotionEvent e2, float distanceX, float distanceY) { - if (openCloseAnimator != null && openCloseAnimator.isRunning() || galleryOpenCloseSpringAnimator != null || galleryOpenCloseAnimator != null || recordControl.isTouch() || cameraView != null && cameraView.isDualTouch() || scaling || zoomControlView != null && zoomControlView.isTouch() || inCheck()) { + if (openCloseAnimator != null && openCloseAnimator.isRunning() || galleryOpenCloseSpringAnimator != null || galleryOpenCloseAnimator != null || qrLinkView != null && qrLinkView.inTouch() || recordControl.isTouch() || cameraView != null && cameraView.isDualTouch() || scaling || zoomControlView != null && zoomControlView.isTouch() || inCheck()) { return false; } if (takingVideo || takingPhoto || currentPage != PAGE_CAMERA) { @@ -1341,7 +1346,7 @@ public void onLongPress(@NonNull MotionEvent e) { @Override public boolean onFling(@NonNull MotionEvent e1, @NonNull MotionEvent e2, float velocityX, float velocityY) { - if (openCloseAnimator != null && openCloseAnimator.isRunning() || recordControl.isTouch() || cameraView != null && cameraView.isDualTouch() || scaling || zoomControlView != null && zoomControlView.isTouch() || inCheck()) { + if (openCloseAnimator != null && openCloseAnimator.isRunning() || qrLinkView != null && qrLinkView.inTouch() || recordControl.isTouch() || cameraView != null && cameraView.isDualTouch() || scaling || zoomControlView != null && zoomControlView.isTouch() || inCheck()) { return false; } flingDetected = true; @@ -1412,7 +1417,7 @@ public boolean onDoubleTapEvent(MotionEvent e) { @Override public boolean hasDoubleTap(MotionEvent e) { - return currentPage == PAGE_CAMERA && cameraView != null && !awaitingPlayer && cameraView.isInited() && !takingPhoto && !recordControl.isTouch() && !isGalleryOpen() && galleryListViewOpening == null; + return currentPage == PAGE_CAMERA && cameraView != null && !awaitingPlayer && cameraView.isInited() && !takingPhoto && !recordControl.isTouch() && (qrLinkView == null || !qrLinkView.inTouch()) && !isGalleryOpen() && galleryListViewOpening == null; } }; @@ -1526,9 +1531,23 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { } } + if (cropEditor != null) { + measureChildExactly(cropEditor, W, H); + measureChildExactly(cropEditor.contentView, W, H); + } + + if (cropInlineEditor != null) { + measureChildExactly(cropInlineEditor, W, H); + measureChildExactly(cropInlineEditor.contentView, W, H); + } + setMeasuredDimension(W, H); } + private void measureChildExactly(View child, int width, int height) { + child.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)); + } + @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { if (ignoreLayout) { @@ -1592,6 +1611,18 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto } } + if (cropEditor != null) { + cropEditor.controlsLayout.setPadding(0, insetTop, 0, insetBottom); + cropEditor.layout(0, 0, W, H); + cropEditor.contentView.layout(0, 0, W, H); + } + + if (cropInlineEditor != null) { + cropInlineEditor.controlsLayout.setPadding(0, insetTop, 0, insetBottom); + cropInlineEditor.layout(0, 0, W, H); + cropInlineEditor.contentView.layout(0, 0, W, H); + } + for (int i = 0; i < getChildCount(); ++i) { View child = getChildAt(i); if (child instanceof DownloadButton.PreparingVideoToast) { @@ -1635,7 +1666,7 @@ public void drawBlurBitmap(Bitmap bitmap, float amount) { } else if (child == previewContainer) { for (int j = 0; j < previewContainer.getChildCount(); ++j) { child = previewContainer.getChildAt(j); - if (child == previewView || child == cameraView || child == cameraViewThumb || child.getVisibility() != View.VISIBLE) { + if (child == previewView || child == cameraView || child.getVisibility() != View.VISIBLE) { continue; } canvas.save(); @@ -1812,6 +1843,8 @@ protected boolean drawChild(Canvas canvas, View child, long drawingTime) { public static final int EDIT_MODE_PAINT = 0; public static final int EDIT_MODE_FILTER = 1; public static final int EDIT_MODE_TIMELINE = 2; + public static final int EDIT_MODE_CROP = 3; + public static final int EDIT_MODE_CROP_INLINE = 4; private int currentEditMode = EDIT_MODE_NONE; private FrameLayout previewContainer; @@ -1837,8 +1870,9 @@ protected boolean drawChild(Canvas canvas, View child, long drawingTime) { /* PAGE_CAMERA */ private CollageLayoutView2 collageLayoutView; - private ImageView cameraViewThumb; private DualCameraView cameraView; + private QRScanner qrScanner; + private ScannedLinkPreview qrLinkView; private int flashButtonResId; private ToggleButton2 flashButton; @@ -1882,6 +1916,8 @@ protected boolean drawChild(Canvas canvas, View child, long drawingTime) { private PreviewHighlightView previewHighlight; private TrashView trash; private RoundVideoRecorder currentRoundRecorder; + private CropEditor cropEditor; + private CropInlineEditor cropInlineEditor; /* PAGE_COVER */ private TimelineView coverTimelineView; @@ -2080,6 +2116,11 @@ protected void onLayoutUpdate(CollageLayout layout) { collageButton.setSelected(false, true); } updateActionBarButtons(true); + + if (galleryListView != null) { + galleryListView.setMultipleOnClick(collageLayoutView.hasLayout()); + galleryListView.setMaxCount(CollageLayout.getMaxCount() - collageLayoutView.getFilledCount()); + } } }; collageLayoutView.setCancelGestures(windowView::cancelGestures); @@ -2087,15 +2128,20 @@ protected void onLayoutUpdate(CollageLayout layout) { updateActionBarButtons(true); }); previewContainer.addView(collageLayoutView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL)); - - cameraViewThumb = new ImageView(context); - cameraViewThumb.setScaleType(ImageView.ScaleType.CENTER_CROP); - cameraViewThumb.setOnClickListener(v -> { + collageLayoutView.setOnClickListener(v -> { if (noCameraPermission) { requestCameraPermission(true); } }); - cameraViewThumb.setClickable(true); + +// cameraViewThumb = new ImageView(context); +// cameraViewThumb.setScaleType(ImageView.ScaleType.CENTER_CROP); +// cameraViewThumb.setOnClickListener(v -> { +// if (noCameraPermission) { +// requestCameraPermission(true); +// } +// }); +// cameraViewThumb.setClickable(true); // previewContainer.addView(cameraViewThumb, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL)); previewContainer.setBackgroundColor(openType == 1 || openType == 0 ? 0 : 0xff1f1f1f); @@ -2296,7 +2342,7 @@ protected boolean captionLimitToast() { } final int symbols = MessagesController.getInstance(currentAccount).storyCaptionLengthLimitPremium; final int times = Math.round((float) symbols / MessagesController.getInstance(currentAccount).storyCaptionLengthLimitDefault); - SpannableStringBuilder text = AndroidUtilities.replaceTags(LocaleController.formatPluralString("CaptionPremiumSubtitle", times, "" + symbols)); + SpannableStringBuilder text = AndroidUtilities.replaceTags(formatPluralString("CaptionPremiumSubtitle", times, "" + symbols)); int startIndex = text.toString().indexOf("__"); if (startIndex >= 0) { text.replace(startIndex, startIndex + 2, ""); @@ -2709,6 +2755,11 @@ protected void dispatchDraw(Canvas canvas) { if (cameraView != null) { cameraView.recordHevc = !collageLayoutView.hasLayout(); } + + if (galleryListView != null) { + galleryListView.setMultipleOnClick(collageLayoutView.hasLayout()); + galleryListView.setMaxCount(CollageLayout.getMaxCount() - collageLayoutView.getFilledCount()); + } } collageListView.setVisible(!collageListView.isVisible(), true); updateActionBarButtons(true); @@ -2734,6 +2785,11 @@ protected void dispatchDraw(Canvas canvas) { } collageListView.setVisible(false, true); updateActionBarButtons(true); + + if (galleryListView != null) { + galleryListView.setMultipleOnClick(collageLayoutView.hasLayout()); + galleryListView.setMaxCount(CollageLayout.getMaxCount() - collageLayoutView.getFilledCount()); + } }); flashViews.add(collageRemoveButton); actionBarContainer.addView(collageRemoveButton, LayoutHelper.createFrame(56, 56, Gravity.TOP | Gravity.RIGHT)); @@ -2750,6 +2806,11 @@ protected void dispatchDraw(Canvas canvas) { collageButton.setDrawable(new CollageLayoutButton.CollageLayoutDrawable(layout)); setActionBarButtonVisible(collageRemoveButton, collageListView.isVisible(), true); recordControl.setCollageProgress(collageLayoutView.hasLayout() ? collageLayoutView.getFilledProgress() : 0.0f, true); + + if (galleryListView != null) { + galleryListView.setMultipleOnClick(collageLayoutView.hasLayout()); + galleryListView.setMaxCount(CollageLayout.getMaxCount() - collageLayoutView.getFilledCount()); + } }); actionBarContainer.addView(collageListView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 56, Gravity.TOP | Gravity.RIGHT)); @@ -2811,6 +2872,20 @@ protected void dispatchDraw(Canvas canvas) { }); zoomControlView.setZoom(cameraZoom = 0, false); + qrLinkView = new ScannedLinkPreview(context, currentAccount, () -> { + if (collageLayoutView != null) { + collageLayoutView.qrDrawer.setQrDetected(qrLinkView.isResolved() ? qrScanner.getDetected() : null); + } + }); + qrLinkView.whenClicked(open -> { + fastClose = true; + close(true); + AndroidUtilities.runOnUIThread(() -> { + open.run(LaunchActivity.getSafeLastFragment()); + }, 210); + }); + controlContainer.addView(qrLinkView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 80, Gravity.BOTTOM | Gravity.FILL_HORIZONTAL, 0, 0, 0, 90)); + modeSwitcherView = new PhotoVideoSwitcherView(context) { @Override protected boolean allowTouch() { @@ -2900,6 +2975,8 @@ protected boolean allowTouch() { } } else if (btn == PreviewButtons.BUTTON_ADJUST) { switchToEditMode(EDIT_MODE_FILTER, true); + } else if (btn == PreviewButtons.BUTTON_CROP) { + switchToEditMode(EDIT_MODE_CROP, true); } }); navbarContainer.addView(previewButtons, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 52, Gravity.CENTER_VERTICAL | Gravity.FILL_HORIZONTAL)); @@ -3328,6 +3405,9 @@ public void onPhotoShoot() { } catch (Exception ignore) {} outputFile = null; } + if (qrScanner != null) { + qrScanner.setPaused(true); + } outputFile = StoryEntry.makeCacheFile(currentAccount, false); takingPhoto = true; checkFrontfaceFlashModes(); @@ -3377,6 +3457,9 @@ private void takePicture(Utilities.Callback done) { bitmap.recycle(); } if (!savedFromTextureView) { + if (qrScanner != null) { + qrScanner.setPaused(true); + } takingPhoto = CameraController.getInstance().takePicture(outputFile, true, cameraView.getCameraSessionObject(), (orientation) -> { if (useDisplayFlashlight()) { try { @@ -3384,6 +3467,9 @@ private void takePicture(Utilities.Callback done) { } catch (Exception ignore) {} } takingPhoto = false; + if (qrScanner != null) { + qrScanner.setPaused(false); + } if (outputFile == null) { return; } @@ -3442,6 +3528,9 @@ private void takePicture(Utilities.Callback done) { }); } else { takingPhoto = false; + if (qrScanner != null) { + qrScanner.setPaused(false); + } final StoryEntry entry = StoryEntry.fromPhotoShoot(outputFile, 0); entry.botId = botId; entry.botLang = botLang; @@ -3490,6 +3579,9 @@ public void onVideoRecordStart(boolean byLongPress, Runnable whenStarted) { } cameraHint.hide(); takingVideo = true; + if (qrScanner != null) { + qrScanner.setPaused(true); + } if (outputFile != null) { try { outputFile.delete(); @@ -3526,8 +3618,12 @@ private void startRecording(boolean byLongPress, Runnable whenStarted) { takingVideo = false; stoppingTakingVideo = false; + if (qrScanner != null) { + qrScanner.setPaused(false); + } if (duration <= 800) { + animateRecording(false, true); setAwakeLock(false); videoTimerView.setRecording(false, true); @@ -3633,6 +3729,9 @@ public void onVideoRecordEnd(boolean byDuration) { } stoppingTakingVideo = true; AndroidUtilities.runOnUIThread(() -> { + if (qrScanner != null) { + qrScanner.setPaused(false); + } if (takingVideo && stoppingTakingVideo && cameraView != null) { showZoomControls(false, true); // animateRecording(false, true); @@ -3990,9 +4089,9 @@ public void navigateTo(int page, boolean animated) { videoTimeView.show(false, animated); } setActionBarButtonVisible(backButton, !collageListView.isVisible(), animated); - setActionBarButtonVisible(flashButton, page == PAGE_CAMERA && !collageListView.isVisible() && flashButtonMode != null && !inCheck(), animated); - setActionBarButtonVisible(dualButton, page == PAGE_CAMERA && cameraView != null && cameraView.dualAvailable() && !collageListView.isVisible() && !collageLayoutView.hasLayout(), true); - setActionBarButtonVisible(collageButton, page == PAGE_CAMERA && !collageListView.isVisible(), animated); + setActionBarButtonVisible(flashButton, !animatedRecording && page == PAGE_CAMERA && !collageListView.isVisible() && flashButtonMode != null && !inCheck(), animated); + setActionBarButtonVisible(dualButton, !animatedRecording && page == PAGE_CAMERA && cameraView != null && cameraView.dualAvailable() && !collageListView.isVisible() && !collageLayoutView.hasLayout(), true); + setActionBarButtonVisible(collageButton, !animatedRecording && page == PAGE_CAMERA && !collageListView.isVisible(), animated); updateActionBarButtons(animated); if (animated) { pageAnimator = new AnimatorSet(); @@ -4002,8 +4101,8 @@ public void navigateTo(int page, boolean animated) { if (cameraView != null) { animators.add(ObjectAnimator.ofFloat(cameraView, View.ALPHA, page == PAGE_CAMERA ? 1 : 0)); } - cameraViewThumb.setVisibility(View.VISIBLE); - animators.add(ObjectAnimator.ofFloat(cameraViewThumb, View.ALPHA, page == PAGE_CAMERA ? 1 : 0)); +// cameraViewThumb.setVisibility(View.VISIBLE); +// animators.add(ObjectAnimator.ofFloat(cameraViewThumb, View.ALPHA, page == PAGE_CAMERA ? 1 : 0)); animators.add(ObjectAnimator.ofFloat(previewView, View.ALPHA, page == PAGE_PREVIEW && !collageLayoutView.hasLayout() || page == PAGE_COVER ? 1 : 0)); animators.add(ObjectAnimator.ofFloat(collageLayoutView, View.ALPHA, page == PAGE_CAMERA || page == PAGE_PREVIEW && collageLayoutView.hasLayout() ? 1 : 0)); @@ -4011,6 +4110,7 @@ public void navigateTo(int page, boolean animated) { // animators.add(ObjectAnimator.ofFloat(flashButton, View.ALPHA, page == PAGE_CAMERA ? 1 : 0)); // animators.add(ObjectAnimator.ofFloat(dualButton, View.ALPHA, page == PAGE_CAMERA && cameraView != null && cameraView.dualAvailable() ? 1 : 0)); animators.add(ObjectAnimator.ofFloat(recordControl, View.TRANSLATION_Y, page == PAGE_CAMERA ? 0 : dp(24))); + animators.add(ObjectAnimator.ofFloat(qrLinkView, View.ALPHA, page == PAGE_CAMERA ? 1 : 0)); animators.add(ObjectAnimator.ofFloat(modeSwitcherView, View.ALPHA, page == PAGE_CAMERA && !inCheck() ? 1 : 0)); animators.add(ObjectAnimator.ofFloat(modeSwitcherView, View.TRANSLATION_Y, page == PAGE_CAMERA && !inCheck() ? 0 : dp(24))); // backButton.setVisibility(View.VISIBLE); @@ -4050,12 +4150,11 @@ public void onAnimationEnd(Animator animation) { if (cameraView != null) { cameraView.setAlpha(page == PAGE_CAMERA ? 1 : 0); } - cameraViewThumb.setAlpha(page == PAGE_CAMERA ? 1f : 0); - cameraViewThumb.setVisibility(page == PAGE_CAMERA ? View.VISIBLE : View.GONE); previewView.setAlpha(page == PAGE_PREVIEW && !collageLayoutView.hasLayout() || page == PAGE_COVER ? 1f : 0); collageLayoutView.setAlpha(page == PAGE_CAMERA || page == PAGE_PREVIEW && collageLayoutView.hasLayout() ? 1 : 0); recordControl.setAlpha(page == PAGE_CAMERA ? 1f : 0); recordControl.setTranslationY(page == PAGE_CAMERA ? 0 : dp(16)); + qrLinkView.setAlpha(page == PAGE_CAMERA ? 1.0f : 0.0f); modeSwitcherView.setAlpha(page == PAGE_CAMERA && !inCheck() ? 1f : 0); modeSwitcherView.setTranslationY(page == PAGE_CAMERA && !inCheck() ? 0 : dp(16)); hintTextView.setAlpha(page == PAGE_CAMERA && animatedRecording && !inCheck() ? 1f : 0); @@ -4179,7 +4278,7 @@ protected void onFullScreen(boolean isFullscreen) { if (currentPage == PAGE_CAMERA && isFullscreen) { AndroidUtilities.runOnUIThread(() -> { destroyCameraView(true); - cameraViewThumb.setImageDrawable(getCameraThumb()); + collageLayoutView.setCameraThumb(getCameraThumb()); }); } } @@ -4195,6 +4294,8 @@ public boolean dispatchTouchEvent(MotionEvent ev) { } }; galleryListView.allowSearch(false); + galleryListView.setMultipleOnClick(collageLayoutView.hasLayout()); + galleryListView.setMaxCount(CollageLayout.getMaxCount() - collageLayoutView.getFilledCount()); galleryListView.setOnBackClickListener(() -> { animateGalleryListView(false); lastGallerySelectedAlbum = null; @@ -4259,7 +4360,7 @@ public boolean dispatchTouchEvent(MotionEvent ev) { } storyEntry.botId = botId; storyEntry.botLang = botLang; - storyEntry.setupMatrix(); +// storyEntry.setupMatrix(); isVideo = storyEntry.isVideo; storyEntry.blurredVideoThumb = blurredBitmap; fromGallery = false; @@ -4280,6 +4381,59 @@ public boolean dispatchTouchEvent(MotionEvent ev) { lastGallerySelectedAlbum = galleryListView.getSelectedAlbum(); } }); + galleryListView.setOnSelectMultipleListener((entries, bitmaps) -> { + if (currentPage != PAGE_CAMERA) return; + if (entries == null || entries.isEmpty() || galleryListViewOpening != null || scrollingY || !isGalleryOpen()) return; + + if (collageLayoutView.getFilledCount() + entries.size() > collageLayoutView.getTotalCount()) { + CollageLayout newLayout = CollageLayout.of(collageLayoutView.getFilledCount() + entries.size()); + if (newLayout == null) { + collageLayoutView.setLayout(null, true); + collageLayoutView.clear(true); + collageListView.setSelected(null); + if (cameraView != null) { + cameraView.recordHevc = !collageLayoutView.hasLayout(); + } + collageListView.setVisible(false, true); + updateActionBarButtons(true); + return; + } + + collageLayoutView.setLayout(lastCollageLayout = newLayout, true); + collageListView.setSelected(newLayout); + int listPosition = CollageLayout.getLayouts().indexOf(newLayout); + if (listPosition >= 0) + collageListView.listView.scrollToPosition(listPosition); + if (cameraView != null) { + cameraView.recordHevc = !collageLayoutView.hasLayout(); + } + collageButton.setDrawable(new CollageLayoutButton.CollageLayoutDrawable(newLayout)); + setActionBarButtonVisible(collageRemoveButton, collageListView.isVisible(), true); + recordControl.setCollageProgress(collageLayoutView.hasLayout() ? collageLayoutView.getFilledProgress() : 0.0f, true); + } + + fromGallery = true; + for (int i = 0; i < entries.size(); ++i) { + MediaController.PhotoEntry photoEntry = entries.get(i); + StoryEntry storyEntry = StoryEntry.fromPhotoEntry(photoEntry); + storyEntry.blurredVideoThumb = bitmaps.get(i); + storyEntry.botId = botId; + storyEntry.botLang = botLang; + storyEntry.setupMatrix(); + if (collageLayoutView.push(storyEntry)) { + outputEntry = StoryEntry.asCollage(collageLayoutView.getLayout(), collageLayoutView.getContent()); + break; + } + } + collageListView.setVisible(false, true); + updateActionBarButtons(true); + + animateGalleryListView(false); + if (galleryListView != null) { + lastGalleryScrollPosition = galleryListView.layoutManager.onSaveInstanceState(); + lastGallerySelectedAlbum = galleryListView.getSelectedAlbum(); + } + }); if (lastGalleryScrollPosition != null) { galleryListView.layoutManager.onRestoreInstanceState(lastGalleryScrollPosition); } @@ -4415,7 +4569,7 @@ private void onNavigateStart(int fromPage, int toPage) { } if (fromPage == PAGE_CAMERA) { setCameraFlashModeIcon(null, true); - saveLastCameraBitmap(() -> cameraViewThumb.setImageDrawable(getCameraThumb())); + saveLastCameraBitmap(() -> collageLayoutView.setCameraThumb(getCameraThumb())); if (draftSavedHint != null) { draftSavedHint.setVisibility(View.GONE); } @@ -4520,7 +4674,8 @@ private void onNavigateStart(int fromPage, int toPage) { } else { captionEdit.clear(); } - previewButtons.setFiltersVisible(outputEntry == null || (!outputEntry.isRepostMessage || outputEntry.isVideo) && !outputEntry.isCollage()); + previewButtons.setButtonVisible(PreviewButtons.BUTTON_ADJUST, outputEntry == null || (!outputEntry.isRepostMessage || outputEntry.isVideo) && !outputEntry.isCollage()); + previewButtons.setButtonVisible(PreviewButtons.BUTTON_CROP, BuildVars.DEBUG_PRIVATE_VERSION && outputEntry != null && !outputEntry.isRepostMessage && !outputEntry.isCollage()); previewButtons.setShareEnabled(!videoError && !captionEdit.isCaptionOverLimit() && (!MessagesController.getInstance(currentAccount).getStoriesController().hasStoryLimit() || (outputEntry != null && (outputEntry.isEdit || outputEntry.botId != 0)))); muteButton.setImageResource(outputEntry != null && outputEntry.muted ? R.drawable.media_unmute : R.drawable.media_mute); previewView.setVisibility(View.VISIBLE); @@ -4588,7 +4743,7 @@ private void onNavigateStart(int fromPage, int toPage) { }; coverTimelineView.setDelegate(new TimelineView.TimelineDelegate() { @Override - public void onVideoLeftChange(float left) { + public void onVideoLeftChange(boolean released, float left) { videoLeftSet.run(false, left); } }); @@ -4601,7 +4756,6 @@ public void onVideoLeftChange(float left) { if (photoFilterEnhanceView != null) { photoFilterEnhanceView.setAllowTouch(false); } - cameraViewThumb.setClickable(false); if (savedDualHint != null) { savedDualHint.hide(); } @@ -4633,7 +4787,6 @@ private void onNavigateEnd(int fromPage, int toPage) { animateRecording(false, false); setAwakeLock(false); } - cameraViewThumb.setClickable(toPage == PAGE_CAMERA); if (fromPage == PAGE_COVER) { coverTimelineView.setVisibility(View.GONE); captionContainer.setVisibility(toPage == PAGE_PREVIEW ? View.VISIBLE : View.GONE); @@ -4668,7 +4821,7 @@ private void onNavigateEnd(int fromPage, int toPage) { hidePhotoPaintView(); } if (outputEntry == null || !outputEntry.isRepost && !outputEntry.isRepostMessage) { - createFilterPhotoView(); +// createFilterPhotoView(); } if (photoFilterEnhanceView != null) { photoFilterEnhanceView.setAllowTouch(false); @@ -4730,6 +4883,9 @@ public void switchToEditMode(int editMode, boolean force, boolean animated) { editModeAnimator = null; } + if (oldEditMode != editMode) { + onSwitchEditModeStart(oldEditMode, editMode); + } previewButtons.appear((editMode == EDIT_MODE_NONE || editMode == EDIT_MODE_TIMELINE) && openProgress > 0, animated); ArrayList animators = new ArrayList<>(); @@ -4758,18 +4914,58 @@ public void switchToEditMode(int editMode, boolean force, boolean animated) { previewTouchable = paintView; animators.add(ObjectAnimator.ofFloat(backButton, View.ALPHA, 0)); animators.add(ObjectAnimator.ofFloat(paintView.getTopLayout(), View.ALPHA, 0, 1)); - animators.add(ObjectAnimator.ofFloat(paintView.getTopLayout(), View.TRANSLATION_Y, -AndroidUtilities.dp(16), 0)); + animators.add(ObjectAnimator.ofFloat(paintView.getTopLayout(), View.TRANSLATION_Y, -dp(16), 0)); animators.add(ObjectAnimator.ofFloat(paintView.getBottomLayout(), View.ALPHA, 0, 1)); - animators.add(ObjectAnimator.ofFloat(paintView.getBottomLayout(), View.TRANSLATION_Y, AndroidUtilities.dp(48), 0)); - animators.add(ObjectAnimator.ofFloat(paintView.getWeightChooserView(), View.TRANSLATION_X, -AndroidUtilities.dp(32), 0)); + animators.add(ObjectAnimator.ofFloat(paintView.getBottomLayout(), View.TRANSLATION_Y, dp(48), 0)); + animators.add(ObjectAnimator.ofFloat(paintView.getWeightChooserView(), View.TRANSLATION_X, -dp(32), 0)); } else if (oldEditMode == EDIT_MODE_PAINT && paintView != null) { previewTouchable = null; animators.add(ObjectAnimator.ofFloat(backButton, View.ALPHA, 1)); animators.add(ObjectAnimator.ofFloat(paintView.getTopLayout(), View.ALPHA, 0)); - animators.add(ObjectAnimator.ofFloat(paintView.getTopLayout(), View.TRANSLATION_Y, -AndroidUtilities.dp(16))); + animators.add(ObjectAnimator.ofFloat(paintView.getTopLayout(), View.TRANSLATION_Y, -dp(16))); animators.add(ObjectAnimator.ofFloat(paintView.getBottomLayout(), View.ALPHA, 0)); - animators.add(ObjectAnimator.ofFloat(paintView.getBottomLayout(), View.TRANSLATION_Y, AndroidUtilities.dp(48))); - animators.add(ObjectAnimator.ofFloat(paintView.getWeightChooserView(), View.TRANSLATION_X, -AndroidUtilities.dp(32))); + animators.add(ObjectAnimator.ofFloat(paintView.getBottomLayout(), View.TRANSLATION_Y, dp(48))); + animators.add(ObjectAnimator.ofFloat(paintView.getWeightChooserView(), View.TRANSLATION_X, -dp(32))); + } + + if (cropEditor != null) { + if (editMode == EDIT_MODE_CROP) { + animators.add(ObjectAnimator.ofFloat(cropEditor.wheel, View.ALPHA, 0, 1)); + animators.add(ObjectAnimator.ofFloat(cropEditor.wheel, View.TRANSLATION_Y, dp(52), 0)); + animators.add(ObjectAnimator.ofFloat(cropEditor.buttonsLayout, View.ALPHA, 0, 1)); + animators.add(ObjectAnimator.ofFloat(cropEditor.buttonsLayout, View.TRANSLATION_Y, dp(52), 0)); + final ValueAnimator valueAnimator = ValueAnimator.ofFloat(cropEditor.getAppearProgress(), 1.0f); + valueAnimator.addUpdateListener(a -> cropEditor.setAppearProgress((float) a.getAnimatedValue())); + animators.add(valueAnimator); + } else if (oldEditMode == EDIT_MODE_CROP) { + animators.add(ObjectAnimator.ofFloat(cropEditor.wheel, View.ALPHA, 1, 0)); + animators.add(ObjectAnimator.ofFloat(cropEditor.wheel, View.TRANSLATION_Y, 0, dp(52))); + animators.add(ObjectAnimator.ofFloat(cropEditor.buttonsLayout, View.ALPHA, 1, 0)); + animators.add(ObjectAnimator.ofFloat(cropEditor.buttonsLayout, View.TRANSLATION_Y, 0, dp(52))); + final ValueAnimator valueAnimator = ValueAnimator.ofFloat(cropEditor.getAppearProgress(), 0.0f); + valueAnimator.addUpdateListener(a -> cropEditor.setAppearProgress((float) a.getAnimatedValue())); + animators.add(valueAnimator); + } + } + + if (cropInlineEditor != null) { + if (editMode == EDIT_MODE_CROP_INLINE) { + animators.add(ObjectAnimator.ofFloat(cropInlineEditor.wheel, View.ALPHA, 0, 1)); + animators.add(ObjectAnimator.ofFloat(cropInlineEditor.wheel, View.TRANSLATION_Y, dp(52), 0)); + animators.add(ObjectAnimator.ofFloat(cropInlineEditor.buttonsLayout, View.ALPHA, 0, 1)); + animators.add(ObjectAnimator.ofFloat(cropInlineEditor.buttonsLayout, View.TRANSLATION_Y, dp(52), 0)); + final ValueAnimator valueAnimator = ValueAnimator.ofFloat(cropInlineEditor.getAppearProgress(), 1.0f); + valueAnimator.addUpdateListener(a -> cropInlineEditor.setAppearProgress((float) a.getAnimatedValue())); + animators.add(valueAnimator); + } else if (oldEditMode == EDIT_MODE_CROP_INLINE) { + animators.add(ObjectAnimator.ofFloat(cropInlineEditor.wheel, View.ALPHA, 1, 0)); + animators.add(ObjectAnimator.ofFloat(cropInlineEditor.wheel, View.TRANSLATION_Y, 0, dp(52))); + animators.add(ObjectAnimator.ofFloat(cropInlineEditor.buttonsLayout, View.ALPHA, 1, 0)); + animators.add(ObjectAnimator.ofFloat(cropInlineEditor.buttonsLayout, View.TRANSLATION_Y, 0, dp(52))); + final ValueAnimator valueAnimator = ValueAnimator.ofFloat(cropInlineEditor.getAppearProgress(), 0.0f); + valueAnimator.addUpdateListener(a -> cropInlineEditor.setAppearProgress((float) a.getAnimatedValue())); + animators.add(valueAnimator); + } } animators.add(ObjectAnimator.ofFloat(muteButton, View.ALPHA, (editMode == EDIT_MODE_NONE || editMode == EDIT_MODE_TIMELINE) && isVideo ? 1 : 0)); @@ -4818,6 +5014,8 @@ public void switchToEditMode(int editMode, boolean force, boolean animated) { } animators.add(ObjectAnimator.ofFloat(captionEdit, View.ALPHA, editMode == EDIT_MODE_NONE ? 1f : 0)); + animators.add(ObjectAnimator.ofFloat(captionContainer, View.ALPHA, editMode == EDIT_MODE_NONE || editMode == EDIT_MODE_TIMELINE ? 1f : 0)); + animators.add(ObjectAnimator.ofFloat(captionContainer, View.TRANSLATION_Y, editMode == EDIT_MODE_NONE || editMode == EDIT_MODE_TIMELINE ? 0 : dp(120))); animators.add(ObjectAnimator.ofFloat(videoTimelineContainerView, View.ALPHA, editMode == EDIT_MODE_NONE || editMode == EDIT_MODE_TIMELINE ? 1f : 0)); animators.add(ObjectAnimator.ofFloat(videoTimelineContainerView, View.TRANSLATION_Y, editMode == EDIT_MODE_TIMELINE ? dp(68) : -(captionEdit.getEditTextHeight() + AndroidUtilities.dp(12)) + AndroidUtilities.dp(64))); actionBarButtons.setPivotX(actionBarButtons.getMeasuredWidth() - dp(46 / 2.0f)); @@ -4839,9 +5037,6 @@ public void onAnimationUpdate(@NonNull ValueAnimator animation) { animators.add(valueAnimator); } - if (oldEditMode != editMode) { - onSwitchEditModeStart(oldEditMode, editMode); - } if (timelineView != null) { timelineView.setOpen(outputEntry == null || !outputEntry.isCollage() || !outputEntry.hasVideo() || editMode == EDIT_MODE_TIMELINE, animated); } @@ -5191,6 +5386,13 @@ public void onDeselectRound(RoundView roundView) { timelineView.selectRound(false); } } + + @Override + protected void onPhotoEntityCropClick(PhotoView photoView) { + createCropInlineEditor(); + cropInlineEditor.set(photoView); + switchToEditMode(EDIT_MODE_CROP_INLINE, true); + } }; paintView.setHasAudio(outputEntry != null && outputEntry.audioPath != null); paintView.setBlurManager(blurManager); @@ -5342,6 +5544,29 @@ private void onSwitchEditModeStart(int fromMode, int toMode) { photoFilterEnhanceView.setAllowTouch(false); } muteHint.hide(); + + if (toMode == EDIT_MODE_CROP) { + createCropEditor(); + cropEditor.setVisibility(View.VISIBLE); + if (outputEntry != null) { + cropEditor.setEntry(outputEntry); + } + } else if (fromMode == EDIT_MODE_CROP) { + previewView.applyMatrix(); + if (cropEditor != null) { + cropEditor.disappearStarts(); + } + } + + if (toMode == EDIT_MODE_CROP_INLINE) { + createCropInlineEditor(); + cropInlineEditor.setVisibility(View.VISIBLE); + } else if (fromMode == EDIT_MODE_CROP_INLINE) { + previewView.applyMatrix(); + if (cropInlineEditor != null) { + cropInlineEditor.disappearStarts(); + } + } } private void onSwitchEditModeEnd(int fromMode, int toMode) { @@ -5370,6 +5595,28 @@ private void onSwitchEditModeEnd(int fromMode, int toMode) { if (photoFilterEnhanceView != null) { photoFilterEnhanceView.setAllowTouch(toMode == EDIT_MODE_FILTER || toMode == EDIT_MODE_NONE); } + if (toMode == EDIT_MODE_CROP) { + if (cropEditor != null) { + cropEditor.setAppearProgress(1.0f); + } + } else if (fromMode == EDIT_MODE_CROP) { + if (cropEditor != null) { + cropEditor.setVisibility(View.GONE); + cropEditor.setAppearProgress(0.0f); + cropEditor.stop(); + } + } + if (toMode == EDIT_MODE_CROP_INLINE) { + if (cropInlineEditor != null) { + cropInlineEditor.setAppearProgress(1.0f); + } + } else if (fromMode == EDIT_MODE_CROP_INLINE) { + if (cropInlineEditor != null) { + cropInlineEditor.setVisibility(View.GONE); + cropInlineEditor.setAppearProgress(0.0f); + cropInlineEditor.stop(); + } + } } private void applyPaintInBackground(Runnable whenDone) { final PaintView paintView = this.paintView; @@ -5857,6 +6104,10 @@ private void applyFilterMatrix() { photoFilterViewTextureView.setTransform(photoFilterStartMatrix); photoFilterViewTextureView.invalidate(); } +// if (outputEntry != null && previewView != null && photoFilterViewTextureView != null) { +// previewView.setTextureViewTransform(photoFilterViewTextureView); +// photoFilterViewTextureView.invalidate(); +// } } private void destroyPhotoFilterView() { @@ -5968,6 +6219,19 @@ protected void receivedAmplitude(double amplitude) { } else if (!cameraView.isSavedDual() && cameraView.dualAvailable() && MessagesController.getGlobalMainSettings().getInt("storydualhint", 0) < 2) { dualHint.show(); } + if (qrScanner == null) { + qrScanner = new QRScanner(getContext(), d -> { + if (qrScanner == null) return; + qrLinkView.setLink(d == null ? null : d.link); + if (collageLayoutView != null) { + collageLayoutView.qrDrawer.setQrDetected(qrLinkView.isResolved() ? qrScanner.getDetected() : null); + } + }); + } + qrScanner.attach(cameraView); + if (qrLinkView != null) { + qrLinkView.setBlurRenderNode(collageLayoutView, collageLayoutView.getBlurRenderNode()); + } } private int frontfaceFlashMode = -1; @@ -6130,10 +6394,20 @@ private void showDismissEntry() { } private void destroyCameraView(boolean waitForThumb) { + if (qrScanner != null) { + qrScanner.destroy(); + qrScanner = null; + if (collageLayoutView != null) { + collageLayoutView.qrDrawer.setQrDetected(null); + } + } + if (qrLinkView != null) { + qrLinkView.setBlurRenderNode(null, null); + } if (cameraView != null) { if (waitForThumb) { saveLastCameraBitmap(() -> { - cameraViewThumb.setImageDrawable(getCameraThumb()); + collageLayoutView.setCameraThumb(getCameraThumb()); if (cameraView != null) { cameraView.destroy(true, null); AndroidUtilities.removeFromParent(cameraView); @@ -6145,7 +6419,7 @@ private void destroyCameraView(boolean waitForThumb) { }); } else { saveLastCameraBitmap(() -> { - cameraViewThumb.setImageDrawable(getCameraThumb()); + collageLayoutView.setCameraThumb(getCameraThumb()); }); cameraView.destroy(true, null); AndroidUtilities.removeFromParent(cameraView); @@ -6177,7 +6451,7 @@ private void requestCameraPermission(boolean force) { iconDrawable.setColorFilter(new PorterDuffColorFilter(0x3dffffff, PorterDuff.Mode.MULTIPLY)); CombinedDrawable drawable = new CombinedDrawable(new ColorDrawable(0xff222222), iconDrawable); drawable.setIconSize(dp(64), dp(64)); - cameraViewThumb.setImageDrawable(drawable); + collageLayoutView.setCameraThumb(drawable); if (activity.shouldShowRequestPermissionRationale(Manifest.permission.CAMERA)) { new AlertDialog.Builder(getContext(), resourcesProvider) .setTopAnimation(R.raw.permission_request_camera, AlertsCreator.PERMISSIONS_REQUEST_TOP_ICON_SIZE, false, Theme.getColor(Theme.key_dialogTopBackground)) @@ -6305,7 +6579,7 @@ private void onRequestPermissionsResultInternal(int requestCode, String[] permis if (requestCode == 111) { noCameraPermission = !granted; if (granted && currentPage == PAGE_CAMERA) { - cameraViewThumb.setImageDrawable(null); + collageLayoutView.setCameraThumb(null); if (CameraController.getInstance().isCameraInitied()) { createCameraView(); } else { @@ -6561,7 +6835,7 @@ public boolean clipWithGradient(int tag) { } window.setTouchable(true); BulletinFactory.of(window, resourcesProvider) - .createSimpleBulletin(R.raw.fire_on, premiumText(LocaleController.formatPluralString("StoryPeriodPremium", hours)), 3) + .createSimpleBulletin(R.raw.fire_on, premiumText(formatPluralString("StoryPeriodPremium", hours)), 3) .show(true); } @@ -6860,7 +7134,7 @@ private void updateActionBarButtons(boolean animated) { setActionBarButtonVisible(backButton, collageListView == null || !collageListView.isVisible(), animated); setActionBarButtonVisible(flashButton, !animatedRecording && currentPage == PAGE_CAMERA && flashButtonMode != null && !collageListView.isVisible() && !inCheck(), animated); setActionBarButtonVisible(dualButton, !animatedRecording && currentPage == PAGE_CAMERA && cameraView != null && cameraView.dualAvailable() && !collageListView.isVisible() && !collageLayoutView.hasLayout(), animated); - setActionBarButtonVisible(collageButton, currentPage == PAGE_CAMERA && !collageListView.isVisible(), animated); + setActionBarButtonVisible(collageButton, !animatedRecording && currentPage == PAGE_CAMERA && !collageListView.isVisible(), animated); setActionBarButtonVisible(collageRemoveButton, collageListView.isVisible(), animated); final float collageProgress = collageLayoutView.hasLayout() ? collageLayoutView.getFilledProgress() : 0.0f; recordControl.setCollageProgress(collageProgress, animated); @@ -6880,4 +7154,28 @@ private void updateActionBarButtonsOffsets() { collageListView.setBounds(left + dp(8), right + dp(8)); } + + public void createCropEditor() { + if (cropEditor != null) return; + cropEditor = new CropEditor(getContext(), previewView, resourcesProvider) { + @Override + protected void close() { + switchToEditMode(EDIT_MODE_NONE, true); + } + }; + windowView.addView(cropEditor.contentView);//, windowView.indexOfChild(containerView)); + windowView.addView(cropEditor); + } + + public void createCropInlineEditor() { + if (cropInlineEditor != null) return; + cropInlineEditor = new CropInlineEditor(getContext(), previewView, resourcesProvider) { + @Override + protected void close() { + switchToEditMode(EDIT_MODE_NONE, true); + } + }; + windowView.addView(cropInlineEditor.contentView);//, windowView.indexOfChild(containerView)); + windowView.addView(cropInlineEditor); + } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/TimelineView.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/TimelineView.java index d7a1836949..fbc39902ad 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/TimelineView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/TimelineView.java @@ -48,7 +48,6 @@ import org.telegram.ui.Components.ItemOptions; import org.telegram.ui.Components.Scroller; import org.telegram.ui.Components.Text; -import org.telegram.ui.Stories.StoriesViewPager; import java.nio.ByteBuffer; import java.util.ArrayList; @@ -69,12 +68,12 @@ public long getMaxScrollDuration() { // maximum allowed duration to select public static final long MAX_SELECT_DURATION = (long) (59 * 1000L); - interface TimelineDelegate { + public interface TimelineDelegate { default void onProgressDragChange(boolean dragging) {}; default void onProgressChange(long progress, boolean fast) {}; - default void onVideoLeftChange(float left) {}; - default void onVideoRightChange(float right) {}; + default void onVideoLeftChange(boolean released, float left) {}; + default void onVideoRightChange(boolean released, float right) {}; default void onVideoVolumeChange(float volume) {}; default void onVideoLeftChange(int i, float left) {}; @@ -264,7 +263,6 @@ public void setOpen(boolean open, boolean animated) { private final Scroller scroller = new Scroller(getContext()); - private final ViewGroup container; private final View previewContainer; private final Theme.ResourcesProvider resourcesProvider; @@ -278,7 +276,6 @@ public void setCover() { public TimelineView(Context context, ViewGroup container, View previewContainer, Theme.ResourcesProvider resourcesProvider, BlurringShader.BlurManager blurManager) { super(context); - this.container = container; this.previewContainer = previewContainer; this.resourcesProvider = resourcesProvider; @@ -992,23 +989,23 @@ public boolean onTouchEvent(MotionEvent event) { if (pressHandle == HANDLE_VIDEO_LEFT) { videoTrack.left = Utilities.clamp(videoTrack.left + d, videoTrack.right - MIN_SELECT_DURATION / (float) videoTrack.duration, 0); if (delegate != null) { - delegate.onVideoLeftChange(videoTrack.left); + delegate.onVideoLeftChange(false, videoTrack.left); } if (videoTrack.right - videoTrack.left > MAX_SELECT_DURATION / (float) videoTrack.duration) { videoTrack.right = Math.min(1, videoTrack.left + MAX_SELECT_DURATION / (float) videoTrack.duration); if (delegate != null) { - delegate.onVideoRightChange(videoTrack.right); + delegate.onVideoRightChange(false, videoTrack.right); } } } else if (pressHandle == HANDLE_VIDEO_RIGHT) { videoTrack.right = Utilities.clamp(videoTrack.right + d, 1, videoTrack.left + MIN_SELECT_DURATION / (float) videoTrack.duration); if (delegate != null) { - delegate.onVideoRightChange(videoTrack.right); + delegate.onVideoRightChange(false, videoTrack.right); } if (videoTrack.right - videoTrack.left > MAX_SELECT_DURATION / (float) videoTrack.duration) { videoTrack.left = Math.max(0, videoTrack.right - MAX_SELECT_DURATION / (float) videoTrack.duration); if (delegate != null) { - delegate.onVideoLeftChange(videoTrack.left); + delegate.onVideoLeftChange(false, videoTrack.left); } } } else if (pressHandle == HANDLE_VIDEO_REGION) { @@ -1020,8 +1017,8 @@ public boolean onTouchEvent(MotionEvent event) { videoTrack.left += d; videoTrack.right += d; if (delegate != null) { - delegate.onVideoLeftChange(videoTrack.left); - delegate.onVideoRightChange(videoTrack.right); + delegate.onVideoLeftChange(false, videoTrack.left); + delegate.onVideoRightChange(false, videoTrack.right); } } if (progress / (float) videoTrack.duration < videoTrack.left || progress / (float) videoTrack.duration > videoTrack.right) { @@ -1330,8 +1327,8 @@ public boolean onTouchEvent(MotionEvent event) { videoTrack.left = (event.getX() - px - ph) / sw * (1 - d); videoTrack.right = videoTrack.left + d; if (delegate != null) { - delegate.onVideoLeftChange(videoTrack.left); - delegate.onVideoRightChange(videoTrack.right); + delegate.onVideoLeftChange(true, videoTrack.left); + delegate.onVideoRightChange(true, videoTrack.right); } invalidate(); } else if (pressType == 3 && (audioSelected || roundSelected ? -1 : collageSelected) != pressCollageIndex) { @@ -2537,8 +2534,8 @@ protected void dispatchDraw(Canvas canvas) { videoTrack.left = Utilities.clamp(videoTrack.left + d, 1, 0); videoTrack.right = Utilities.clamp(videoTrack.right + d, 1, 0); if (delegate != null) { - delegate.onVideoLeftChange(videoTrack.left); - delegate.onVideoRightChange(videoTrack.right); + delegate.onVideoLeftChange(false, videoTrack.left); + delegate.onVideoRightChange(false, videoTrack.right); } invalidate(); } else if (pressHandle == HANDLE_AUDIO_REGION) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/Weather.java b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/Weather.java index 1b92cbea34..59f0836a2b 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/Weather.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/Weather.java @@ -26,6 +26,7 @@ import org.telegram.messenger.Utilities; import org.telegram.tgnet.AbstractSerializedData; import org.telegram.tgnet.ConnectionsManager; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.AlertDialog; @@ -291,7 +292,7 @@ public static Weather.State TLdeserialize(AbstractSerializedData stream) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeDouble(lat); stream.writeDouble(lng); // stream.writeInt32(type); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/TextMessageEnterTransition.java b/TMessagesProj/src/main/java/org/telegram/ui/TextMessageEnterTransition.java index 33bbcf6837..507bc9660c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/TextMessageEnterTransition.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/TextMessageEnterTransition.java @@ -197,7 +197,7 @@ public TextMessageEnterTransition(ChatMessageCell messageView, ChatActivity chat layoutH = chatActivityEnterView.getEditField().getLayout().getLineBottom(chatActivityEnterView.getEditField().getLayout().getLineForOffset(newStart[0] + trimmedStr.length())) - linesOffset; } text = AnimatedEmojiSpan.cloneSpans(text); - text = Emoji.replaceEmoji(editText, textPaint.getFontMetricsInt(), emojiSize, false); + text = Emoji.replaceEmoji(editText, textPaint.getFontMetricsInt(), false); } scaleFrom = chatActivityEnterView.getEditField().getTextSize() / textPaint.getTextSize(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ThemePreviewActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ThemePreviewActivity.java index 3b9f9e6985..a4dc0ed062 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ThemePreviewActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ThemePreviewActivity.java @@ -108,6 +108,7 @@ import org.telegram.messenger.VideoEditedInfo; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.tgnet.tl.TL_stories; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenu; @@ -3619,11 +3620,11 @@ public void didReceivedNotification(int id, int account, Object... args) { acc = MediaDataController.calcHash(acc, wallPaper.id); } } - TLRPC.TL_account_getWallPapers req = new TLRPC.TL_account_getWallPapers(); + TL_account.getWallPapers req = new TL_account.getWallPapers(); req.hash = acc; int reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { - if (response instanceof TLRPC.TL_account_wallPapers) { - TLRPC.TL_account_wallPapers res = (TLRPC.TL_account_wallPapers) response; + if (response instanceof TL_account.TL_wallPapers) { + TL_account.TL_wallPapers res = (TL_account.TL_wallPapers) response; patterns.clear(); patternsDict.clear(); boolean added2 = false; @@ -3656,7 +3657,7 @@ public void didReceivedNotification(int id, int account, Object... args) { MessagesStorage.getInstance(currentAccount).putWallpapers(res.wallpapers, 1); } if (selectedPattern == null && accent != null && !TextUtils.isEmpty(accent.patternSlug)) { - TLRPC.TL_account_getWallPaper req2 = new TLRPC.TL_account_getWallPaper(); + TL_account.getWallPaper req2 = new TL_account.getWallPaper(); TLRPC.TL_inputWallPaperSlug inputWallPaperSlug = new TLRPC.TL_inputWallPaperSlug(); inputWallPaperSlug.slug = accent.patternSlug; req2.wallpaper = inputWallPaperSlug; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ThemeSetUrlActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ThemeSetUrlActivity.java index 6b1bfce6d0..cbc1810f59 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ThemeSetUrlActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ThemeSetUrlActivity.java @@ -42,6 +42,7 @@ import org.telegram.messenger.R; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenu; import org.telegram.ui.ActionBar.AlertDialog; @@ -508,7 +509,7 @@ private boolean checkUrl(final String url, boolean alert) { setCheckText(LocaleController.getString(R.string.SetUrlChecking), Theme.key_windowBackgroundWhiteGrayText8); lastCheckName = url; checkRunnable = () -> { - TLRPC.TL_account_createTheme req = new TLRPC.TL_account_createTheme(); + TL_account.createTheme req = new TL_account.createTheme(); req.slug = url; req.title = ""; req.document = new TLRPC.TL_inputDocumentEmpty(); @@ -586,7 +587,7 @@ private void saveTheme() { progressDialog = new AlertDialog(getParentActivity(), AlertDialog.ALERT_TYPE_SPINNER); - final TLRPC.TL_account_updateTheme req = new TLRPC.TL_account_updateTheme(); + final TL_account.updateTheme req = new TL_account.updateTheme(); TLRPC.TL_inputTheme inputTheme = new TLRPC.TL_inputTheme(); inputTheme.id = info.id; inputTheme.access_hash = info.access_hash; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/TopicCreateFragment.java b/TMessagesProj/src/main/java/org/telegram/ui/TopicCreateFragment.java index 0d181f79b8..f3df1c1e53 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/TopicCreateFragment.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/TopicCreateFragment.java @@ -34,6 +34,7 @@ import org.telegram.messenger.Utilities; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_stars; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarPopupWindow; import org.telegram.ui.ActionBar.AlertDialog; @@ -426,7 +427,7 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto } } - protected void onEmojiSelected(View view, Long documentId, TLRPC.Document document, Integer until) { + protected void onEmojiSelected(View view, Long documentId, TLRPC.Document document, TL_stars.TL_starGiftUnique gift, Integer until) { boolean setIsFree = false; if (!TextUtils.isEmpty(UserConfig.getInstance(currentAccount).defaultTopicIcons)) { TLRPC.TL_messages_stickerSet stickerSet = getMediaDataController().getStickerSetByEmojiOrName(UserConfig.getInstance(currentAccount).defaultTopicIcons); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/TopicsFragment.java b/TMessagesProj/src/main/java/org/telegram/ui/TopicsFragment.java index 9db4fb59f2..55b4b9fa96 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/TopicsFragment.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/TopicsFragment.java @@ -72,6 +72,7 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.tgnet.tl.TL_stories; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenu; @@ -975,7 +976,9 @@ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { } } toggleSelection(view); - view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} return true; }); recyclerListView.setOnScrollListener(new RecyclerView.OnScrollListener() { @@ -1103,7 +1106,9 @@ public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerVi if (canShowHiddenArchive != canShowInternal) { canShowHiddenArchive = canShowInternal; if (pullViewState == ARCHIVE_ITEM_STATE_HIDDEN) { - recyclerListView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + recyclerListView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} if (pullForegroundDrawable != null) { pullForegroundDrawable.colorize(canShowInternal); } @@ -1774,7 +1779,9 @@ public boolean onTouchEvent(MotionEvent e) { } if (!canShowHiddenArchive) { canShowHiddenArchive = true; - performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + try { + performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } catch (Exception ignored) {} if (pullForegroundDrawable != null) { pullForegroundDrawable.colorize(true); } @@ -1847,28 +1854,22 @@ private void deleteTopics(HashSet selectedTopics, Runnable runnable) { } else { builder.setMessage(LocaleController.getString(R.string.DeleteSelectedTopics)); } - builder.setPositiveButton(LocaleController.getString(R.string.Delete), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - excludeTopics = new HashSet<>(); - excludeTopics.addAll(selectedTopics); + builder.setPositiveButton(LocaleController.getString(R.string.Delete), (dialog, which) -> { + excludeTopics = new HashSet<>(); + excludeTopics.addAll(selectedTopics); + updateTopicsList(true, false); + BulletinFactory.of(TopicsFragment.this).createUndoBulletin(LocaleController.getPluralString("TopicsDeleted", selectedTopics.size()), () -> { + excludeTopics = null; updateTopicsList(true, false); - BulletinFactory.of(TopicsFragment.this).createUndoBulletin(LocaleController.getPluralString("TopicsDeleted", selectedTopics.size()), () -> { - excludeTopics = null; - updateTopicsList(true, false); - }, () -> { - topicsController.deleteTopics(chatId, topicsToRemove); - runnable.run(); - }).show(); - clearSelectedTopics(); - dialog.dismiss(); - } + }, () -> { + topicsController.deleteTopics(chatId, topicsToRemove); + runnable.run(); + }).show(); + clearSelectedTopics(); + dialog.dismiss(); }); - builder.setNegativeButton(LocaleController.getString(R.string.Cancel), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.dismiss(); - } + builder.setNegativeButton(LocaleController.getString(R.string.Cancel), (dialog, which) -> { + dialog.dismiss(); }); AlertDialog alertDialog = builder.create(); alertDialog.show(); @@ -1879,7 +1880,9 @@ public void onClick(DialogInterface dialog, int which) { } private boolean showChatPreview(DialogCell cell) { - cell.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + try { + cell.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } catch (Exception ignored) {} final ActionBarPopupWindow.ActionBarPopupWindowLayout[] previewMenu = new ActionBarPopupWindow.ActionBarPopupWindowLayout[1]; int flags = ActionBarPopupWindow.ActionBarPopupWindowLayout.FLAG_USE_SWIPEBACK; previewMenu[0] = new ActionBarPopupWindow.ActionBarPopupWindowLayout(getParentActivity(), R.drawable.popup_fixed_alert, getResourceProvider(), flags); @@ -2631,16 +2634,11 @@ public boolean onFragmentCreate() { //TODO remove when server start send in get diff if (!settingsPreloaded.contains(chatId)) { settingsPreloaded.add(chatId); - TLRPC.TL_account_getNotifyExceptions exceptionsReq = new TLRPC.TL_account_getNotifyExceptions(); + TL_account.getNotifyExceptions exceptionsReq = new TL_account.getNotifyExceptions(); exceptionsReq.peer = new TLRPC.TL_inputNotifyPeer(); exceptionsReq.flags |= 1; ((TLRPC.TL_inputNotifyPeer) exceptionsReq.peer).peer = getMessagesController().getInputPeer(-chatId); - getConnectionsManager().sendRequest(exceptionsReq, (response, error) -> AndroidUtilities.runOnUIThread(() -> { - if (response instanceof TLRPC.TL_updates) { - TLRPC.TL_updates updates = (TLRPC.TL_updates) response; - getMessagesController().processUpdates(updates, false); - } - })); + getConnectionsManager().sendRequest(exceptionsReq, null); } return true; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/TopicsNotifySettingsFragments.java b/TMessagesProj/src/main/java/org/telegram/ui/TopicsNotifySettingsFragments.java index 166aadddc1..bbd2314598 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/TopicsNotifySettingsFragments.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/TopicsNotifySettingsFragments.java @@ -17,6 +17,7 @@ import org.telegram.messenger.LocaleController; import org.telegram.messenger.R; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BackDrawable; @@ -154,7 +155,7 @@ public void didRemoveException(long dialog_id) { private void removeException(int topicId) { getNotificationsController().getNotificationsSettingsFacade().clearPreference(dialogId, topicId); - TLRPC.TL_account_updateNotifySettings req = new TLRPC.TL_account_updateNotifySettings(); + TL_account.updateNotifySettings req = new TL_account.updateNotifySettings(); req.settings = new TLRPC.TL_inputPeerNotifySettings(); TLRPC.TL_inputNotifyForumTopic topicPeer = new TLRPC.TL_inputNotifyForumTopic(); topicPeer.peer = getMessagesController().getInputPeer(dialogId); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationActivity.java index 73489f1cb8..06e8618216 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationActivity.java @@ -8,6 +8,9 @@ package org.telegram.ui; +import static org.telegram.messenger.LocaleController.formatString; +import static org.telegram.messenger.LocaleController.getString; + import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.StateListAnimator; @@ -54,6 +57,7 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.RequestDelegate; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; @@ -75,6 +79,7 @@ import org.telegram.ui.Components.RecyclerListView; import org.telegram.ui.Components.TransformableLoginButtonView; import org.telegram.ui.Components.VerticalPositionAutoAnimator; +import org.telegram.ui.Stories.recorder.HintView2; import java.util.ArrayList; import java.util.Locale; @@ -105,7 +110,7 @@ public class TwoStepVerificationActivity extends BaseFragment implements Notific private boolean loading; private boolean destroyed; private boolean paused; - private TLRPC.account_Password currentPassword; + private TL_account.Password currentPassword; private boolean passwordEntered = true; private byte[] currentPasswordHash = new byte[0]; private long currentSecretId; @@ -134,6 +139,7 @@ public class TwoStepVerificationActivity extends BaseFragment implements Notific private RadialProgressView radialProgressView; private int delegateType; + private String delegateTypeString; private TwoStepVerificationActivityDelegate delegate; public interface TwoStepVerificationActivityDelegate { @@ -150,12 +156,12 @@ public TwoStepVerificationActivity(int account) { currentAccount = account; } - public void setPassword(TLRPC.account_Password password) { + public void setPassword(TL_account.Password password) { currentPassword = password; passwordEntered = false; } - public void setCurrentPasswordParams(TLRPC.account_Password password, byte[] passwordHash, long secretId, byte[] secret) { + public void setCurrentPasswordParams(TL_account.Password password, byte[] passwordHash, long secretId, byte[] secret) { currentPassword = password; currentPasswordHash = passwordHash; currentSecret = secret; @@ -239,10 +245,10 @@ public void onItemClick(int id) { scrollView.addView(linearLayout, LayoutHelper.createScroll(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP)); lockImageView = new RLottieImageView(context); - lockImageView.setAnimation(R.raw.tsv_setup_intro, 120, 120); + lockImageView.setAnimation(R.raw.tsv_setup_intro, 100, 100); lockImageView.playAnimation(); - lockImageView.setVisibility(AndroidUtilities.isSmallScreen() || AndroidUtilities.displaySize.x > AndroidUtilities.displaySize.y ? View.GONE : View.VISIBLE); - linearLayout.addView(lockImageView, LayoutHelper.createLinear(120, 120, Gravity.CENTER_HORIZONTAL)); + lockImageView.setVisibility(AndroidUtilities.isSmallScreen() || (AndroidUtilities.displaySize.x > AndroidUtilities.displaySize.y && !AndroidUtilities.isTablet()) ? View.GONE : View.VISIBLE); + linearLayout.addView(lockImageView, LayoutHelper.createLinear(100, 100, Gravity.CENTER_HORIZONTAL)); titleTextView = new TextView(context); titleTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); @@ -256,10 +262,10 @@ public void onItemClick(int id) { subtitleTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); subtitleTextView.setGravity(Gravity.CENTER_HORIZONTAL); subtitleTextView.setVisibility(View.GONE); - linearLayout.addView(subtitleTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 24, 8, 24, 0)); + linearLayout.addView(subtitleTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 42, 8, 42, 0)); passwordOutlineView = new OutlineTextContainerView(context); - passwordOutlineView.setText(LocaleController.getString(R.string.EnterPassword)); + passwordOutlineView.setText(getString(R.string.EnterPassword)); passwordOutlineView.animateSelection(1f, false); linearLayout.addView(passwordOutlineView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 24, 24, 24, 0)); @@ -274,7 +280,7 @@ public void onItemClick(int id) { passwordEditText.setTypeface(Typeface.DEFAULT); passwordEditText.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteInputFieldActivated)); passwordEditText.setCursorWidth(1.5f); - passwordEditText.setContentDescription(LocaleController.getString(R.string.EnterPassword)); + passwordEditText.setContentDescription(getString(R.string.EnterPassword)); int padding = AndroidUtilities.dp(16); passwordEditText.setPadding(padding, padding, padding, padding); passwordOutlineView.addView(passwordEditText, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); @@ -307,7 +313,7 @@ public void afterTextChanged(Editable s) { bottomTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6)); bottomTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); bottomTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP); - bottomTextView.setText(LocaleController.getString(R.string.YourEmailInfo)); + bottomTextView.setText(getString(R.string.YourEmailInfo)); linearLayout.addView(bottomTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 40, 30, 40, 0)); resetWaitView = new TextView(context); @@ -334,7 +340,7 @@ public void afterTextChanged(Editable s) { cancelResetButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); cancelResetButton.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL); cancelResetButton.setPadding(AndroidUtilities.dp(32), 0, AndroidUtilities.dp(32), 0); - cancelResetButton.setText(LocaleController.getString(R.string.CancelReset)); + cancelResetButton.setText(getString(R.string.CancelReset)); cancelResetButton.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4)); cancelResetButton.setVisibility(View.GONE); frameLayout.addView(cancelResetButton, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? 56 : 60, Gravity.BOTTOM, 0, 0, 0, 16)); @@ -363,7 +369,7 @@ public void getOutline(View view, Outline outline) { floatingButtonIcon.setProgress(0f); floatingButtonIcon.setColor(Theme.getColor(Theme.key_chats_actionIcon)); floatingButtonIcon.setDrawBackground(false); - floatingButtonContainer.setContentDescription(LocaleController.getString(R.string.Next)); + floatingButtonContainer.setContentDescription(getString(R.string.Next)); floatingButtonContainer.addView(floatingButtonIcon, LayoutHelper.createFrame(Build.VERSION.SDK_INT >= 21 ? 56 : 60, Build.VERSION.SDK_INT >= 21 ? 56 : 60)); Drawable drawable = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56), Theme.getColor(Theme.key_chats_actionBackground), Theme.getColor(Theme.key_chats_actionPressedBackground)); @@ -401,17 +407,17 @@ public void getOutline(View view, Outline outline) { } else if (position == turnPasswordOffRow) { AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); - String text = LocaleController.getString(R.string.TurnPasswordOffQuestion); + String text = getString(R.string.TurnPasswordOffQuestion); if (currentPassword.has_secure_values) { - text += "\n\n" + LocaleController.getString(R.string.TurnPasswordOffPassport); + text += "\n\n" + getString(R.string.TurnPasswordOffPassport); } - String title = LocaleController.getString(R.string.TurnPasswordOffQuestionTitle); - String buttonText = LocaleController.getString(R.string.Disable); + String title = getString(R.string.TurnPasswordOffQuestionTitle); + String buttonText = getString(R.string.Disable); builder.setMessage(text); builder.setTitle(title); builder.setPositiveButton(buttonText, (dialogInterface, i) -> clearPassword()); - builder.setNegativeButton(LocaleController.getString(R.string.Cancel), null); + builder.setNegativeButton(getString(R.string.Cancel), null); AlertDialog alertDialog = builder.create(); showDialog(alertDialog); TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE); @@ -439,18 +445,24 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { updateRows(); if (passwordEntered && delegate == null) { - actionBar.setTitle(LocaleController.getString(R.string.TwoStepVerificationTitle)); + actionBar.setTitle(getString(R.string.TwoStepVerificationTitle)); } else { actionBar.setTitle(null); } if (delegate != null) { - titleTextView.setText(LocaleController.getString(R.string.YourPassword)); - subtitleTextView.setText(LocaleController.getString(delegateType == 1 ? R.string.PleaseEnterCurrentPasswordWithdraw : R.string.PleaseEnterCurrentPasswordTransfer)); + titleTextView.setText(getString(R.string.YourPassword)); + if (delegateType == 1) { + subtitleTextView.setText(getString(R.string.PleaseEnterCurrentPasswordWithdraw)); + } else if (delegateType == 2) { + subtitleTextView.setText(AndroidUtilities.replaceTags(formatString(R.string.PleaseEnterCurrentPasswordGiftTransfer, delegateTypeString))); + } else { + subtitleTextView.setText(getString(R.string.PleaseEnterCurrentPasswordTransfer)); + } subtitleTextView.setVisibility(View.VISIBLE); } else { - titleTextView.setText(LocaleController.getString(R.string.YourPassword)); + titleTextView.setText(getString(R.string.YourPassword)); subtitleTextView.setVisibility(View.VISIBLE); - subtitleTextView.setText(LocaleController.getString(R.string.LoginPasswordTextShort)); + subtitleTextView.setText(getString(R.string.LoginPasswordTextShort)); } if (passwordEntered) { @@ -467,7 +479,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); - lockImageView.setVisibility(AndroidUtilities.isSmallScreen() || AndroidUtilities.displaySize.x > AndroidUtilities.displaySize.y ? View.GONE : View.VISIBLE); + lockImageView.setVisibility(AndroidUtilities.isSmallScreen() || (AndroidUtilities.displaySize.x > AndroidUtilities.displaySize.y && !AndroidUtilities.isTablet()) ? View.GONE : View.VISIBLE); } private Runnable updateTimeRunnable = this::updateBottomButton; @@ -477,8 +489,8 @@ private void cancelPasswordReset() { return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); - builder.setPositiveButton(LocaleController.getString(R.string.CancelPasswordResetYes), (dialog, which) -> { - TLRPC.TL_account_declinePasswordReset req = new TLRPC.TL_account_declinePasswordReset(); + builder.setPositiveButton(getString(R.string.CancelPasswordResetYes), (dialog, which) -> { + TL_account.declinePasswordReset req = new TL_account.declinePasswordReset(); getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (response instanceof TLRPC.TL_boolTrue) { currentPassword.pending_reset_date = 0; @@ -486,9 +498,9 @@ private void cancelPasswordReset() { } })); }); - builder.setNegativeButton(LocaleController.getString(R.string.CancelPasswordResetNo), null); - builder.setTitle(LocaleController.getString(R.string.CancelReset)); - builder.setMessage(LocaleController.getString(R.string.CancelPasswordReset)); + builder.setNegativeButton(getString(R.string.CancelPasswordResetNo), null); + builder.setTitle(getString(R.string.CancelReset)); + builder.setMessage(getString(R.string.CancelPasswordReset)); showDialog(builder.create()); } @@ -498,24 +510,24 @@ public void setForgotPasswordOnShow() { private void resetPassword() { needShowProgress(true); - TLRPC.TL_account_resetPassword req = new TLRPC.TL_account_resetPassword(); + TL_account.resetPassword req = new TL_account.resetPassword(); getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { needHideProgress(); - if (response instanceof TLRPC.TL_account_resetPasswordOk) { + if (response instanceof TL_account.resetPasswordOk) { AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); - builder.setNegativeButton(LocaleController.getString(R.string.OK), null); - builder.setTitle(LocaleController.getString(R.string.ResetPassword)); - builder.setMessage(LocaleController.getString(R.string.RestorePasswordResetPasswordOk)); + builder.setNegativeButton(getString(R.string.OK), null); + builder.setTitle(getString(R.string.ResetPassword)); + builder.setMessage(getString(R.string.RestorePasswordResetPasswordOk)); showDialog(builder.create(), dialog -> { getNotificationCenter().postNotificationName(NotificationCenter.didSetOrRemoveTwoStepPassword); finishFragment(); }); - } else if (response instanceof TLRPC.TL_account_resetPasswordRequestedWait) { - TLRPC.TL_account_resetPasswordRequestedWait res = (TLRPC.TL_account_resetPasswordRequestedWait) response; + } else if (response instanceof TL_account.resetPasswordRequestedWait) { + TL_account.resetPasswordRequestedWait res = (TL_account.resetPasswordRequestedWait) response; currentPassword.pending_reset_date = res.until_date; updateBottomButton(); - } else if (response instanceof TLRPC.TL_account_resetPasswordFailedWait) { - TLRPC.TL_account_resetPasswordFailedWait res = (TLRPC.TL_account_resetPasswordFailedWait) response; + } else if (response instanceof TL_account.resetPasswordFailedWait) { + TL_account.resetPasswordFailedWait res = (TL_account.resetPasswordFailedWait) response; int time = res.retry_date - getConnectionsManager().getCurrentTime(); String timeString; if (time > 24 * 60 * 60) { @@ -527,7 +539,7 @@ private void resetPassword() { } else { timeString = LocaleController.formatPluralString("Seconds", Math.max(1, time)); } - showAlertWithText(LocaleController.getString(R.string.ResetPassword), LocaleController.formatString("ResetPasswordWait", R.string.ResetPasswordWait, timeString)); + showAlertWithText(getString(R.string.ResetPassword), LocaleController.formatString("ResetPasswordWait", R.string.ResetPasswordWait, timeString)); } })); } @@ -539,11 +551,11 @@ private void updateBottomButton() { resetWaitView.setVisibility(View.GONE); } if (currentPassword.pending_reset_date == 0) { - bottomButton.setText(LocaleController.getString(R.string.ForgotPassword)); + bottomButton.setText(getString(R.string.ForgotPassword)); cancelResetButton.setVisibility(View.GONE); bottomButton.setVisibility(View.VISIBLE); } else { - bottomButton.setText(LocaleController.getString(R.string.ResetPassword)); + bottomButton.setText(getString(R.string.ResetPassword)); cancelResetButton.setVisibility(View.VISIBLE); bottomButton.setVisibility(View.VISIBLE); } @@ -607,9 +619,9 @@ protected void onReset() { } else { timeString = LocaleController.formatPluralString("Minutes", time / 60); } - showAlertWithText(LocaleController.getString(R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, timeString)); + showAlertWithText(getString(R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, timeString)); } else { - showAlertWithText(LocaleController.getString(R.string.AppName), error.text); + showAlertWithText(getString(R.string.AppName), error.text); } } }), ConnectionsManager.RequestFlagFailOnServerErrors | ConnectionsManager.RequestFlagWithoutLogin); @@ -620,10 +632,10 @@ protected void onReset() { if (currentPassword.pending_reset_date != 0) { if (getConnectionsManager().getCurrentTime() > currentPassword.pending_reset_date) { AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); - builder.setPositiveButton(LocaleController.getString(R.string.Reset), (dialog, which) -> resetPassword()); - builder.setNegativeButton(LocaleController.getString(R.string.Cancel), null); - builder.setTitle(LocaleController.getString(R.string.ResetPassword)); - builder.setMessage(LocaleController.getString(R.string.RestorePasswordResetPasswordText)); + builder.setPositiveButton(getString(R.string.Reset), (dialog, which) -> resetPassword()); + builder.setNegativeButton(getString(R.string.Cancel), null); + builder.setTitle(getString(R.string.ResetPassword)); + builder.setMessage(getString(R.string.RestorePasswordResetPasswordText)); AlertDialog dialog = builder.create(); showDialog(dialog); TextView button = (TextView) dialog.getButton(DialogInterface.BUTTON_POSITIVE); @@ -635,10 +647,10 @@ protected void onReset() { } } else { AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); - builder.setPositiveButton(LocaleController.getString(R.string.Reset), (dialog, which) -> resetPassword()); - builder.setNegativeButton(LocaleController.getString(R.string.Cancel), null); - builder.setTitle(LocaleController.getString(R.string.ResetPassword)); - builder.setMessage(LocaleController.getString(R.string.RestorePasswordNoEmailText2)); + builder.setPositiveButton(getString(R.string.Reset), (dialog, which) -> resetPassword()); + builder.setNegativeButton(getString(R.string.Cancel), null); + builder.setTitle(getString(R.string.ResetPassword)); + builder.setMessage(getString(R.string.RestorePasswordNoEmailText2)); showDialog(builder.create()); } } @@ -668,7 +680,7 @@ public void onResume() { AndroidUtilities.requestAdjustResize(getParentActivity(), classGuid); } - public void setCurrentPasswordInfo(byte[] hash, TLRPC.account_Password password) { + public void setCurrentPasswordInfo(byte[] hash, TL_account.Password password) { if (hash != null) { currentPasswordHash = hash; } @@ -680,7 +692,11 @@ public void setDelegate(int a, TwoStepVerificationActivityDelegate twoStepVerifi delegate = twoStepVerificationActivityDelegate; } - public static boolean canHandleCurrentPassword(TLRPC.account_Password password, boolean login) { + public void setDelegateString(String string) { + delegateTypeString = string; + } + + public static boolean canHandleCurrentPassword(TL_account.Password password, boolean login) { if (login) { if (password.current_algo instanceof TLRPC.TL_passwordKdfAlgoUnknown) { return false; @@ -695,7 +711,7 @@ public static boolean canHandleCurrentPassword(TLRPC.account_Password password, return true; } - public static void initPasswordNewAlgo(TLRPC.account_Password password) { + public static void initPasswordNewAlgo(TL_account.Password password) { if (password.new_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) { TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo = (TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) password.new_algo; byte[] salt = new byte[algo.salt1.length + 32]; @@ -719,13 +735,13 @@ private void loadPasswordInfo(boolean first, final boolean silent, Runnable when listAdapter.notifyDataSetChanged(); } } - TLRPC.TL_account_getPassword req = new TLRPC.TL_account_getPassword(); + TL_account.getPassword req = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (error == null) { loading = false; - currentPassword = (TLRPC.account_Password) response; + currentPassword = (TL_account.Password) response; if (!canHandleCurrentPassword(currentPassword, false)) { - AlertsCreator.showUpdateAppAlert(getParentActivity(), LocaleController.getString(R.string.UpdateAppAlert), true); + AlertsCreator.showUpdateAppAlert(getParentActivity(), getString(R.string.UpdateAppAlert), true); return; } if (!silent || first) { @@ -906,7 +922,7 @@ private void showAlertWithText(String title, String text) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); - builder.setPositiveButton(LocaleController.getString(R.string.OK), null); + builder.setPositiveButton(getString(R.string.OK), null); builder.setTitle(title); builder.setMessage(text); showDialog(builder.create()); @@ -914,11 +930,11 @@ private void showAlertWithText(String title, String text) { private void clearPassword() { final String password = firstPassword; - final TLRPC.TL_account_updatePasswordSettings req = new TLRPC.TL_account_updatePasswordSettings(); + final TL_account.updatePasswordSettings req = new TL_account.updatePasswordSettings(); if (currentPasswordHash == null || currentPasswordHash.length == 0) { req.password = new TLRPC.TL_inputCheckPasswordEmpty(); } - req.new_settings = new TLRPC.TL_account_passwordInputSettings(); + req.new_settings = new TL_account.passwordInputSettings(); UserConfig.getInstance(currentAccount).resetSavedPassword(); currentSecret = null; @@ -932,10 +948,10 @@ private void clearPassword() { Utilities.globalQueue.postRunnable(() -> { if (req.password == null) { if (currentPassword.current_algo == null) { - TLRPC.TL_account_getPassword getPasswordReq = new TLRPC.TL_account_getPassword(); + TL_account.getPassword getPasswordReq = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(getPasswordReq, (response2, error2) -> AndroidUtilities.runOnUIThread(() -> { if (error2 == null) { - currentPassword = (TLRPC.account_Password) response2; + currentPassword = (TL_account.Password) response2; initPasswordNewAlgo(currentPassword); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.didSetOrRemoveTwoStepPassword, currentPassword); clearPassword(); @@ -951,10 +967,10 @@ private void clearPassword() { RequestDelegate requestDelegate = (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (error != null && "SRP_ID_INVALID".equals(error.text)) { - TLRPC.TL_account_getPassword getPasswordReq = new TLRPC.TL_account_getPassword(); + TL_account.getPassword getPasswordReq = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(getPasswordReq, (response2, error2) -> AndroidUtilities.runOnUIThread(() -> { if (error2 == null) { - currentPassword = (TLRPC.account_Password) response2; + currentPassword = (TL_account.Password) response2; initPasswordNewAlgo(currentPassword); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.didSetOrRemoveTwoStepPassword, currentPassword); clearPassword(); @@ -978,9 +994,9 @@ private void clearPassword() { } else { timeString = LocaleController.formatPluralString("Minutes", time / 60); } - showAlertWithText(LocaleController.getString(R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, timeString)); + showAlertWithText(getString(R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, timeString)); } else { - showAlertWithText(LocaleController.getString(R.string.AppName), error.text); + showAlertWithText(getString(R.string.AppName), error.text); } } }); @@ -996,7 +1012,7 @@ public TLRPC.TL_inputCheckPasswordSRP getNewSrpPassword() { return null; } - private boolean checkSecretValues(byte[] passwordBytes, TLRPC.TL_account_passwordSettings passwordSettings) { + private boolean checkSecretValues(byte[] passwordBytes, TL_account.passwordSettings passwordSettings) { if (passwordSettings.secure_settings != null) { currentSecret = passwordSettings.secure_settings.secure_secret; byte[] passwordHash; @@ -1016,9 +1032,9 @@ private boolean checkSecretValues(byte[] passwordBytes, TLRPC.TL_account_passwor System.arraycopy(passwordHash, 32, iv, 0, 16); Utilities.aesCbcEncryptionByteArraySafe(currentSecret, key, iv, 0, currentSecret.length, 0, 0); if (!PassportActivity.checkSecret(passwordSettings.secure_settings.secure_secret, passwordSettings.secure_settings.secure_secret_id)) { - TLRPC.TL_account_updatePasswordSettings req = new TLRPC.TL_account_updatePasswordSettings(); + TL_account.updatePasswordSettings req = new TL_account.updatePasswordSettings(); req.password = getNewSrpPassword(); - req.new_settings = new TLRPC.TL_account_passwordInputSettings(); + req.new_settings = new TL_account.passwordInputSettings(); req.new_settings.new_secure_settings = new TLRPC.TL_secureSecretSettings(); req.new_settings.new_secure_settings.secure_secret = new byte[0]; req.new_settings.new_secure_settings.secure_algo = new TLRPC.TL_securePasswordKdfAlgoUnknown(); @@ -1048,7 +1064,7 @@ private void processDone() { needShowProgress(); Utilities.globalQueue.postRunnable(() -> { - final TLRPC.TL_account_getPasswordSettings req = new TLRPC.TL_account_getPasswordSettings(); + final TL_account.getPasswordSettings req = new TL_account.getPasswordSettings(); final byte[] x_bytes; if (currentPassword.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) { TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo = (TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) currentPassword.current_algo; @@ -1060,7 +1076,7 @@ private void processDone() { RequestDelegate requestDelegate = (response, error) -> { if (error == null) { Utilities.globalQueue.postRunnable(() -> { - boolean secretOk = checkSecretValues(oldPasswordBytes, (TLRPC.TL_account_passwordSettings) response); + boolean secretOk = checkSecretValues(oldPasswordBytes, (TL_account.passwordSettings) response); AndroidUtilities.runOnUIThread(() -> { if (delegate == null || !secretOk) { needHideProgress(); @@ -1088,17 +1104,17 @@ private void processDone() { } } } else { - AlertsCreator.showUpdateAppAlert(getParentActivity(), LocaleController.getString(R.string.UpdateAppAlert), true); + AlertsCreator.showUpdateAppAlert(getParentActivity(), getString(R.string.UpdateAppAlert), true); } }); }); } else { AndroidUtilities.runOnUIThread(() -> { if ("SRP_ID_INVALID".equals(error.text)) { - TLRPC.TL_account_getPassword getPasswordReq = new TLRPC.TL_account_getPassword(); + TL_account.getPassword getPasswordReq = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(getPasswordReq, (response2, error2) -> AndroidUtilities.runOnUIThread(() -> { if (error2 == null) { - currentPassword = (TLRPC.account_Password) response2; + currentPassword = (TL_account.Password) response2; initPasswordNewAlgo(currentPassword); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.didSetOrRemoveTwoStepPassword, currentPassword); processDone(); @@ -1117,9 +1133,9 @@ private void processDone() { } else { timeString = LocaleController.formatPluralString("Minutes", time / 60); } - showAlertWithText(LocaleController.getString(R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, timeString)); + showAlertWithText(getString(R.string.AppName), LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, timeString)); } else { - showAlertWithText(LocaleController.getString(R.string.AppName), error.text); + showAlertWithText(getString(R.string.AppName), error.text); } }); } @@ -1205,24 +1221,24 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { textCell.setTag(Theme.key_windowBackgroundWhiteBlackText); textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); if (position == changePasswordRow) { - textCell.setText(LocaleController.getString(R.string.ChangePassword), true); + textCell.setText(getString(R.string.ChangePassword), true); } else if (position == setPasswordRow) { - textCell.setText(LocaleController.getString(R.string.SetAdditionalPassword), true); + textCell.setText(getString(R.string.SetAdditionalPassword), true); } else if (position == turnPasswordOffRow) { - textCell.setText(LocaleController.getString(R.string.TurnPasswordOff), true); + textCell.setText(getString(R.string.TurnPasswordOff), true); } else if (position == changeRecoveryEmailRow) { - textCell.setText(LocaleController.getString(R.string.ChangeRecoveryEmail), false); + textCell.setText(getString(R.string.ChangeRecoveryEmail), false); } else if (position == setRecoveryEmailRow) { - textCell.setText(LocaleController.getString(R.string.SetRecoveryEmail), false); + textCell.setText(getString(R.string.SetRecoveryEmail), false); } break; case 1: TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; if (position == setPasswordDetailRow) { - privacyCell.setText(LocaleController.getString(R.string.SetAdditionalPasswordInfo)); + privacyCell.setText(getString(R.string.SetAdditionalPasswordInfo)); privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (position == passwordEnabledDetailRow) { - privacyCell.setText(LocaleController.getString(R.string.EnabledPasswordText)); + privacyCell.setText(getString(R.string.EnabledPasswordText)); privacyCell.setBackgroundDrawable(Theme.getThemedDrawableByKey(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } break; @@ -1289,11 +1305,11 @@ public boolean onBackPressed() { private void showSetForcePasswordAlert() { AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); - builder.setTitle(LocaleController.getString(R.string.Warning)); + builder.setTitle(getString(R.string.Warning)); builder.setMessage(LocaleController.formatPluralString("ForceSetPasswordAlertMessageShort", otherwiseReloginDays)); - builder.setPositiveButton(LocaleController.getString(R.string.TwoStepVerificationSetPassword), null); + builder.setPositiveButton(getString(R.string.TwoStepVerificationSetPassword), null); - builder.setNegativeButton(LocaleController.getString(R.string.ForceSetPasswordCancel), (a1, a2) -> finishFragment()); + builder.setNegativeButton(getString(R.string.ForceSetPasswordCancel), (a1, a2) -> finishFragment()); AlertDialog alertDialog = builder.show(); ((TextView)alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE)).setTextColor(Theme.getColor(Theme.key_text_RedBold)); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationSetupActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationSetupActivity.java index c77cca6042..d8ae008d32 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationSetupActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/TwoStepVerificationSetupActivity.java @@ -66,6 +66,7 @@ import org.telegram.tgnet.RequestDelegate; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenu; import org.telegram.ui.ActionBar.ActionBarMenuItem; @@ -129,7 +130,7 @@ public class TwoStepVerificationSetupActivity extends BaseFragment { private String email; private boolean paused; private boolean waitingForEmail; - private TLRPC.account_Password currentPassword; + private TL_account.Password currentPassword; private byte[] currentPasswordHash = new byte[0]; private long currentSecretId; private byte[] currentSecret; @@ -184,7 +185,7 @@ public class TwoStepVerificationSetupActivity extends BaseFragment { private Runnable monkeyAfterSwitchCallback; private Runnable monkeyEndCallback; - public TwoStepVerificationSetupActivity(int type, TLRPC.account_Password password) { + public TwoStepVerificationSetupActivity(int type, TL_account.Password password) { super(); currentType = type; currentPassword = password; @@ -195,7 +196,7 @@ public TwoStepVerificationSetupActivity(int type, TLRPC.account_Password passwor } } - public TwoStepVerificationSetupActivity(int account, int type, TLRPC.account_Password password) { + public TwoStepVerificationSetupActivity(int account, int type, TL_account.Password password) { super(); currentAccount = account; currentType = type; @@ -1121,7 +1122,7 @@ protected void onDraw(Canvas canvas) { ((ViewGroup.MarginLayoutParams) bottomSkipButton.getLayoutParams()).bottomMargin = 0; bottomSkipButton.setText(LocaleController.getString(R.string.ResendCode)); bottomSkipButton.setOnClickListener(v -> { - TLRPC.TL_account_resendPasswordEmail req = new TLRPC.TL_account_resendPasswordEmail(); + TL_account.resendPasswordEmail req = new TL_account.resendPasswordEmail(); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {}); showDialog(new AlertDialog.Builder(getParentActivity()) .setMessage(LocaleController.getString(R.string.ResendCodeInfo)) @@ -1370,7 +1371,7 @@ private void processNext() { needShowProgress(); Utilities.globalQueue.postRunnable(() -> { - final TLRPC.TL_account_getPasswordSettings req = new TLRPC.TL_account_getPasswordSettings(); + final TL_account.getPasswordSettings req = new TL_account.getPasswordSettings(); final byte[] x_bytes; if (currentPassword.current_algo instanceof TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) { TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo = (TLRPC.TL_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) currentPassword.current_algo; @@ -1393,10 +1394,10 @@ private void processNext() { } else { AndroidUtilities.runOnUIThread(() -> { if ("SRP_ID_INVALID".equals(error.text)) { - TLRPC.TL_account_getPassword getPasswordReq = new TLRPC.TL_account_getPassword(); + TL_account.getPassword getPasswordReq = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(getPasswordReq, (response2, error2) -> AndroidUtilities.runOnUIThread(() -> { if (error2 == null) { - currentPassword = (TLRPC.account_Password) response2; + currentPassword = (TL_account.Password) response2; TwoStepVerificationActivity.initPasswordNewAlgo(currentPassword); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.didSetOrRemoveTwoStepPassword, currentPassword); processNext(); @@ -1537,7 +1538,7 @@ private void processNext() { break; } case TYPE_EMAIL_CONFIRM: { - TLRPC.TL_account_confirmPasswordEmail req = new TLRPC.TL_account_confirmPasswordEmail(); + TL_account.confirmPasswordEmail req = new TL_account.confirmPasswordEmail(); req.code = codeFieldContainer.getCode(); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { needHideProgress(); @@ -1758,10 +1759,10 @@ public void onTransitionAnimationEnd(boolean isOpen, boolean backward) { } private void loadPasswordInfo() { - TLRPC.TL_account_getPassword req = new TLRPC.TL_account_getPassword(); + TL_account.getPassword req = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (error == null) { - currentPassword = (TLRPC.account_Password) response; + currentPassword = (TL_account.Password) response; if (!TwoStepVerificationActivity.canHandleCurrentPassword(currentPassword, false)) { AlertsCreator.showUpdateAppAlert(getParentActivity(), LocaleController.getString(R.string.UpdateAppAlert), true); return; @@ -1859,7 +1860,7 @@ private void showAlertWithText(String title, String text) { private void setNewPassword(final boolean clear) { if (clear && waitingForEmail && currentPassword.has_password) { needShowProgress(); - TLRPC.TL_account_cancelPasswordEmail req = new TLRPC.TL_account_cancelPasswordEmail(); + TL_account.cancelPasswordEmail req = new TL_account.cancelPasswordEmail(); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { needHideProgress(); if (error == null) { @@ -1876,7 +1877,7 @@ private void setNewPassword(final boolean clear) { } final String password = firstPassword; - TLRPC.TL_account_passwordInputSettings new_settings = new TLRPC.TL_account_passwordInputSettings(); + TL_account.passwordInputSettings new_settings = new TL_account.passwordInputSettings(); if (clear) { UserConfig.getInstance(currentAccount).resetSavedPassword(); currentSecret = null; @@ -1916,7 +1917,7 @@ private void setNewPassword(final boolean clear) { req.flags |= 1; request = req; } else { - TLRPC.TL_account_updatePasswordSettings req = new TLRPC.TL_account_updatePasswordSettings(); + TL_account.updatePasswordSettings req = new TL_account.updatePasswordSettings(); if (currentPasswordHash == null || currentPasswordHash.length == 0 || clear && waitingForEmail) { req.password = new TLRPC.TL_inputCheckPasswordEmpty(); } @@ -1926,8 +1927,8 @@ private void setNewPassword(final boolean clear) { needShowProgress(); Utilities.globalQueue.postRunnable(() -> { - if (request instanceof TLRPC.TL_account_updatePasswordSettings) { - TLRPC.TL_account_updatePasswordSettings req = (TLRPC.TL_account_updatePasswordSettings) request; + if (request instanceof TL_account.updatePasswordSettings) { + TL_account.updatePasswordSettings req = (TL_account.updatePasswordSettings) request; if (req.password == null) { req.password = getNewSrpPassword(); } @@ -1950,10 +1951,10 @@ private void setNewPassword(final boolean clear) { RequestDelegate requestDelegate = (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (error != null && "SRP_ID_INVALID".equals(error.text)) { - TLRPC.TL_account_getPassword getPasswordReq = new TLRPC.TL_account_getPassword(); + TL_account.getPassword getPasswordReq = new TL_account.getPassword(); ConnectionsManager.getInstance(currentAccount).sendRequest(getPasswordReq, (response2, error2) -> AndroidUtilities.runOnUIThread(() -> { if (error2 == null) { - currentPassword = (TLRPC.account_Password) response2; + currentPassword = (TL_account.Password) response2; TwoStepVerificationActivity.initPasswordNewAlgo(currentPassword); setNewPassword(clear); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.didSetOrRemoveTwoStepPassword, currentPassword); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/UserInfoActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/UserInfoActivity.java index b4b43b1437..0d3cb51222 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/UserInfoActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/UserInfoActivity.java @@ -26,6 +26,7 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenuItem; import org.telegram.ui.ActionBar.AlertDialog; @@ -195,7 +196,7 @@ protected void fillItems(ArrayList items, UniversalAdapter adapter) { } } - public static String birthdayString(TLRPC.TL_birthday birthday) { + public static String birthdayString(TL_account.TL_birthday birthday) { if (birthday == null) { return "—"; } @@ -302,10 +303,10 @@ public void onResume() { private String currentFirstName; private String currentLastName; private String currentBio; - private TLRPC.TL_birthday currentBirthday; + private TL_account.TL_birthday currentBirthday; private long currentChannel; - private TLRPC.TL_birthday birthday; + private TL_account.TL_birthday birthday; private TLRPC.Chat channel; private boolean hadHours, hadLocation; @@ -363,7 +364,7 @@ public boolean hasChanges() { ); } - public static boolean birthdaysEqual(TLRPC.TL_birthday a, TLRPC.TL_birthday b) { + public static boolean birthdaysEqual(TL_account.TL_birthday a, TL_account.TL_birthday b) { return !((a == null) == (b != null) || a != null && (a.day != b.day || a.month != b.month || a.year != b.year)); } @@ -406,7 +407,7 @@ private void processDone(boolean error) { !TextUtils.equals(currentBio, bioEdit.getText().toString()) ) ) { - TLRPC.TL_account_updateProfile req1 = new TLRPC.TL_account_updateProfile(); + TL_account.updateProfile req1 = new TL_account.updateProfile(); req1.flags |= 1; req1.first_name = user.first_name = firstNameEdit.getText().toString(); @@ -421,9 +422,9 @@ private void processDone(boolean error) { requests.add(req1); } - TLRPC.TL_birthday oldBirthday = userFull != null ? userFull.birthday : null; + TL_account.TL_birthday oldBirthday = userFull != null ? userFull.birthday : null; if (!birthdaysEqual(currentBirthday, birthday)) { - TLRPC.TL_account_updateBirthday req = new TLRPC.TL_account_updateBirthday(); + TL_account.updateBirthday req = new TL_account.updateBirthday(); if (birthday != null) { userFull.flags2 |= 32; userFull.birthday = birthday; @@ -440,7 +441,7 @@ private void processDone(boolean error) { } if (currentChannel != (channel != null ? channel.id : 0)) { - TLRPC.TL_account_updatePersonalChannel req = new TLRPC.TL_account_updatePersonalChannel(); + TL_account.updatePersonalChannel req = new TL_account.updatePersonalChannel(); req.channel = MessagesController.getInputChannel(channel); if (channel != null) { userFull.flags |= 64; @@ -467,7 +468,7 @@ private void processDone(boolean error) { getConnectionsManager().sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { if (err != null) { doneButtonDrawable.animateToProgress(0f); - if (req instanceof TLRPC.TL_account_updateBirthday && err.text != null && err.text.startsWith("FLOOD_WAIT_")) { + if (req instanceof TL_account.updateBirthday && err.text != null && err.text.startsWith("FLOOD_WAIT_")) { if (getContext() != null) { showDialog( new AlertDialog.Builder(getContext(), resourceProvider) @@ -480,7 +481,7 @@ private void processDone(boolean error) { } else { BulletinFactory.showError(err); } - if (req instanceof TLRPC.TL_account_updateBirthday) { + if (req instanceof TL_account.updateBirthday) { if (oldBirthday != null) { userFull.flags |= 32; } else { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/UsersSelectActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/UsersSelectActivity.java index bdc796d804..6b28e8413a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/UsersSelectActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/UsersSelectActivity.java @@ -8,6 +8,9 @@ package org.telegram.ui; +import static org.telegram.messenger.LocaleController.formatString; +import static org.telegram.messenger.LocaleController.getString; + import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; @@ -17,6 +20,7 @@ import android.content.Context; import android.graphics.Canvas; import android.graphics.Outline; +import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.Rect; @@ -52,7 +56,9 @@ import org.telegram.messenger.ChatObject; import org.telegram.messenger.ContactsController; import org.telegram.messenger.DialogObject; +import org.telegram.messenger.Emoji; import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MessageObject; import org.telegram.messenger.MessagesController; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; @@ -459,9 +465,9 @@ public View createView(Context context) { actionBar.setAllowOverlayTitle(true); if (type == TYPE_FILTER || type == TYPE_PRIVATE) { if (isInclude) { - actionBar.setTitle(LocaleController.getString(R.string.FilterAlwaysShow)); + actionBar.setTitle(getString(R.string.FilterAlwaysShow)); } else { - actionBar.setTitle(LocaleController.getString(R.string.FilterNeverShow)); + actionBar.setTitle(getString(R.string.FilterNeverShow)); } } else if (type == TYPE_AUTO_DELETE_EXISTING_CHATS){ updateHint(); @@ -580,7 +586,7 @@ public boolean onTouchEvent(MotionEvent event) { editText.setImeOptions(EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI); editText.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL); spansContainer.addView(editText); - editText.setHintText(LocaleController.getString(R.string.SearchForPeopleAndGroups)); + editText.setHintText(getString(R.string.SearchForPeopleAndGroups)); editText.setCustomSelectionActionModeCallback(new ActionMode.Callback() { public boolean onPrepareActionMode(ActionMode mode, Menu menu) { @@ -669,7 +675,7 @@ public void afterTextChanged(Editable editable) { adapter.setSearching(true); listView.setFastScrollVisible(false); listView.setVerticalScrollBarEnabled(true); - emptyView.title.setText(LocaleController.getString(R.string.NoResult)); + emptyView.title.setText(getString(R.string.NoResult)); } emptyView.showProgress(true); adapter.searchDialogs(editText.getText().toString()); @@ -696,7 +702,7 @@ public void setVisibility(int visibility) { } }; emptyView.showProgress(ContactsController.getInstance(currentAccount).isLoadingContacts()); - emptyView.title.setText(LocaleController.getString(R.string.NoContacts)); + emptyView.title.setText(getString(R.string.NoContacts)); frameLayout.addView(emptyView); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false); @@ -771,7 +777,7 @@ public void setVisibility(int visibility) { } else if (object instanceof TLRPC.Chat) { id = -((TLRPC.Chat) object).id; if (type == TYPE_AUTO_DELETE_EXISTING_CHATS && !ChatObject.canUserDoAdminAction((TLRPC.Chat) object, ChatObject.ACTION_DELETE_MESSAGES)) { - BulletinFactory.of(this).createErrorBulletin(LocaleController.getString(R.string.NeedAdminRightForSetAutoDeleteTimer)).show(); + BulletinFactory.of(this).createErrorBulletin(getString(R.string.NeedAdminRightForSetAutoDeleteTimer)).show(); return; } } else { @@ -853,7 +859,7 @@ public void getOutline(View view, Outline outline) { floatingButton.setScaleX(0.0f); floatingButton.setScaleY(0.0f); floatingButton.setAlpha(0.0f);*/ - floatingButton.setContentDescription(LocaleController.getString(R.string.Next)); + floatingButton.setContentDescription(getString(R.string.Next)); for (int position = 1, N = (isInclude ? 5 : 3); position <= N; position++) { int id; @@ -1063,14 +1069,14 @@ private void closeSearch() { adapter.searchDialogs(null); listView.setFastScrollVisible(true); listView.setVerticalScrollBarEnabled(false); - emptyView.title.setText(LocaleController.getString(R.string.NoContacts)); + emptyView.title.setText(getString(R.string.NoContacts)); } private void updateHint() { if (type == TYPE_FILTER) { int limit = getUserConfig().isPremium() ? getMessagesController().dialogFiltersChatsLimitPremium : getMessagesController().dialogFiltersChatsLimitDefault; if (selectedCount == 0) { - actionBar.setSubtitle(LocaleController.formatString("MembersCountZero", R.string.MembersCountZero, LocaleController.formatPluralString("Chats", limit))); + actionBar.setSubtitle(formatString("MembersCountZero", R.string.MembersCountZero, LocaleController.formatPluralString("Chats", limit))); } else { actionBar.setSubtitle(String.format(LocaleController.getPluralString("MembersCountSelected", selectedCount), selectedCount, limit)); } @@ -1079,18 +1085,18 @@ private void updateHint() { actionBar.setSubtitle(""); if (selectedCount == 0) { - animatedAvatarContainer.getTitle().setText(LocaleController.getString(R.string.SelectChats), true); + animatedAvatarContainer.getTitle().setText(getString(R.string.SelectChats), true); if (ttlPeriod > 0) { - animatedAvatarContainer.getSubtitleTextView().setText(LocaleController.getString(R.string.SelectChatsForAutoDelete), true); + animatedAvatarContainer.getSubtitleTextView().setText(getString(R.string.SelectChatsForAutoDelete), true); } else { - animatedAvatarContainer.getSubtitleTextView().setText(LocaleController.getString(R.string.SelectChatsForDisableAutoDelete), true); + animatedAvatarContainer.getSubtitleTextView().setText(getString(R.string.SelectChatsForDisableAutoDelete), true); } } else { animatedAvatarContainer.getTitle().setText(LocaleController.formatPluralString("Chats", selectedCount, selectedCount)); if (ttlPeriod > 0) { - animatedAvatarContainer.getSubtitleTextView().setText(LocaleController.getString(R.string.SelectChatsForAutoDelete2)); + animatedAvatarContainer.getSubtitleTextView().setText(getString(R.string.SelectChatsForAutoDelete2)); } else { - animatedAvatarContainer.getSubtitleTextView().setText(LocaleController.getString(R.string.SelectChatsForDisableAutoDelete2)); + animatedAvatarContainer.getSubtitleTextView().setText(getString(R.string.SelectChatsForDisableAutoDelete2)); } } } @@ -1298,55 +1304,55 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { int flag; if (type == TYPE_PRIVATE) { if (position == 1) { - name = LocaleController.getString(R.string.FilterExistingChats); + name = getString(R.string.FilterExistingChats); object = "existing_chats"; flag = BusinessRecipientsHelper.PRIVATE_FLAG_EXISTING_CHATS; } else if (position == 2 && !doNotNewChats) { - name = LocaleController.getString(R.string.FilterNewChats); + name = getString(R.string.FilterNewChats); object = "new_chats"; flag = BusinessRecipientsHelper.PRIVATE_FLAG_NEW_CHATS; } else if (position == 2 + (doNotNewChats ? 0 : 1)) { - name = LocaleController.getString(R.string.FilterContacts); + name = getString(R.string.FilterContacts); object = "contacts"; flag = BusinessRecipientsHelper.PRIVATE_FLAG_CONTACTS; } else { - name = LocaleController.getString(R.string.FilterNonContacts); + name = getString(R.string.FilterNonContacts); object = "non_contacts"; flag = BusinessRecipientsHelper.PRIVATE_FLAG_NON_CONTACTS; } } else if (isInclude) { if (position == 1) { - name = LocaleController.getString(R.string.FilterContacts); + name = getString(R.string.FilterContacts); object = "contacts"; flag = MessagesController.DIALOG_FILTER_FLAG_CONTACTS; } else if (position == 2) { - name = LocaleController.getString(R.string.FilterNonContacts); + name = getString(R.string.FilterNonContacts); object = "non_contacts"; flag = MessagesController.DIALOG_FILTER_FLAG_NON_CONTACTS; } else if (position == 3) { - name = LocaleController.getString(R.string.FilterGroups); + name = getString(R.string.FilterGroups); object = "groups"; flag = MessagesController.DIALOG_FILTER_FLAG_GROUPS; } else if (position == 4) { - name = LocaleController.getString(R.string.FilterChannels); + name = getString(R.string.FilterChannels); object = "channels"; flag = MessagesController.DIALOG_FILTER_FLAG_CHANNELS; } else { - name = LocaleController.getString(R.string.FilterBots); + name = getString(R.string.FilterBots); object = "bots"; flag = MessagesController.DIALOG_FILTER_FLAG_BOTS; } } else { if (position == 1) { - name = LocaleController.getString(R.string.FilterMuted); + name = getString(R.string.FilterMuted); object = "muted"; flag = MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED; } else if (position == 2) { - name = LocaleController.getString(R.string.FilterRead); + name = getString(R.string.FilterRead); object = "read"; flag = MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_READ; } else { - name = LocaleController.getString(R.string.FilterArchived); + name = getString(R.string.FilterArchived); object = "archived"; flag = MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED; } @@ -1372,7 +1378,8 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { } else if (type == TYPE_FILTER) { if (!searching) { - StringBuilder builder = new StringBuilder(); + final Paint.FontMetricsInt fontMetricsInt = cell.getStatusTextView().getPaint().getFontMetricsInt(); + SpannableStringBuilder builder = new SpannableStringBuilder(); ArrayList filters = getMessagesController().dialogFilters; for (int a = 0, N = filters.size(); a < N; a++) { MessagesController.DialogFilter filter = filters.get(a); @@ -1380,7 +1387,10 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (builder.length() > 0) { builder.append(", "); } - builder.append(filter.name); + CharSequence filterName = new SpannableStringBuilder(filter.name); + filterName = Emoji.replaceEmoji(filterName, fontMetricsInt, false); + filterName = MessageObject.replaceAnimatedEmoji(filterName, filter.entities, fontMetricsInt); + builder.append(filterName); } } username = builder; @@ -1395,13 +1405,13 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(); spannableStringBuilder.append("d"); spannableStringBuilder.setSpan(new ColoredImageSpan(R.drawable.msg_mini_fireon), 0, 1, 0); - spannableStringBuilder.append(LocaleController.formatString("AutoDeleteAfter", R.string.AutoDeleteAfter, LocaleController.formatTTLString(ttlPeriod)).toLowerCase()); + spannableStringBuilder.append(formatString(R.string.AutoDeleteAfter, LocaleController.formatTTLString(ttlPeriod)).toLowerCase()); username = spannableStringBuilder; } else { SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(); spannableStringBuilder.append("d"); spannableStringBuilder.setSpan(new ColoredImageSpan(R.drawable.msg_mini_fireoff), 0, 1, 0); - spannableStringBuilder.append(LocaleController.formatString("AutoDeleteDisabled", R.string.AutoDeleteDisabled)); + spannableStringBuilder.append(getString(R.string.AutoDeleteDisabled)); username = spannableStringBuilder; } if (object instanceof TLRPC.Chat) { @@ -1425,9 +1435,9 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { case 2: { GraySectionCell cell = (GraySectionCell) holder.itemView; if (position == 0 && !noChatTypes) { - cell.setText(LocaleController.getString(R.string.FilterChatTypes)); + cell.setText(getString(R.string.FilterChatTypes)); } else { - cell.setText(LocaleController.getString(R.string.FilterChats)); + cell.setText(getString(R.string.FilterChats)); } break; } @@ -1527,10 +1537,10 @@ public void searchDialogs(final String query) { names[0] = ContactsController.formatName(user.first_name, user.last_name).toLowerCase(); username = UserObject.getPublicUsername(user); if (UserObject.isReplyUser(user)) { - names[2] = LocaleController.getString(R.string.RepliesTitle).toLowerCase(); + names[2] = getString(R.string.RepliesTitle).toLowerCase(); } else if (UserObject.isUserSelf(user)) { if (!allowSelf) continue; - names[2] = LocaleController.getString(R.string.SavedMessages).toLowerCase(); + names[2] = getString(R.string.SavedMessages).toLowerCase(); } else if (user.bot && !allowBots) { continue; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/VoIPFragment.java b/TMessagesProj/src/main/java/org/telegram/ui/VoIPFragment.java index eceec10c6d..38133efe1a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/VoIPFragment.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/VoIPFragment.java @@ -15,7 +15,6 @@ import android.annotation.TargetApi; import android.app.Activity; import android.app.KeyguardManager; -import android.app.Service; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; @@ -77,7 +76,6 @@ import org.telegram.messenger.voip.EncryptionKeyEmojifier; import org.telegram.messenger.voip.Instance; import org.telegram.messenger.voip.VideoCapturerDevice; -import org.telegram.messenger.voip.VoIPPreNotificationService; import org.telegram.messenger.voip.VoIPService; import org.telegram.messenger.voip.VoIPServiceState; import org.telegram.messenger.voip.VoipAudioManager; @@ -95,7 +93,6 @@ import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.HideViewAfterAnimation; import org.telegram.ui.Components.LayoutHelper; -import org.telegram.ui.Components.PermissionRequest; import org.telegram.ui.Components.voip.AcceptDeclineView; import org.telegram.ui.Components.voip.EmojiRationalLayout; import org.telegram.ui.Components.voip.HideEmojiTextView; @@ -125,7 +122,6 @@ import org.webrtc.TextureViewRenderer; import java.io.ByteArrayOutputStream; -import java.security.Permission; import java.util.ArrayList; import java.util.List; @@ -983,7 +979,7 @@ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { callingUserTitle = new TextView(context); callingUserTitle.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 28); CharSequence name = ContactsController.formatName(callingUser.first_name, callingUser.last_name); - name = Emoji.replaceEmoji(name, callingUserTitle.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false); + name = Emoji.replaceEmoji(name, callingUserTitle.getPaint().getFontMetricsInt(), false); callingUserTitle.setText(name); callingUserTitle.setMaxLines(2); callingUserTitle.setEllipsize(TextUtils.TruncateAt.END); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/WallpapersListActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/WallpapersListActivity.java index 479ff2968f..e209e4d419 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/WallpapersListActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/WallpapersListActivity.java @@ -60,6 +60,7 @@ import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.ui.ActionBar.ActionBar; import org.telegram.ui.ActionBar.ActionBarMenu; import org.telegram.ui.ActionBar.ActionBarMenuItem; @@ -547,7 +548,7 @@ public void onItemClick(int id) { } deleteCount[0]++; TLRPC.WallPaper wallPaper = (TLRPC.WallPaper) object; - TLRPC.TL_account_saveWallPaper req = new TLRPC.TL_account_saveWallPaper(); + TL_account.saveWallPaper req = new TL_account.saveWallPaper(); req.settings = new TLRPC.TL_wallPaperSettings(); req.unsave = true; @@ -785,7 +786,7 @@ public boolean supportsPredictiveItemAnimations() { progressDialog = new AlertDialog(getParentActivity(), AlertDialog.ALERT_TYPE_SPINNER); progressDialog.setCanCancel(false); progressDialog.show(); - TLRPC.TL_account_resetWallPapers req = new TLRPC.TL_account_resetWallPapers(); + TL_account.resetWallPapers req = new TL_account.resetWallPapers(); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> loadWallpapers(false))); }); builder.setNegativeButton(LocaleController.getString(R.string.Cancel), null); @@ -1133,11 +1134,11 @@ private void loadWallpapers(boolean force) { acc = MediaDataController.calcHash(acc, wallPaper.id); } } - TLRPC.TL_account_getWallPapers req = new TLRPC.TL_account_getWallPapers(); + TL_account.getWallPapers req = new TL_account.getWallPapers(); req.hash = acc; int reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { - if (response instanceof TLRPC.TL_account_wallPapers) { - TLRPC.TL_account_wallPapers res = (TLRPC.TL_account_wallPapers) response; + if (response instanceof TL_account.TL_wallPapers) { + TL_account.TL_wallPapers res = (TL_account.TL_wallPapers) response; patterns.clear(); patternsDict.clear(); if (currentType != TYPE_COLOR && currentType != TYPE_CHANNEL_PATTERNS) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/bots/AffiliateProgramFragment.java b/TMessagesProj/src/main/java/org/telegram/ui/bots/AffiliateProgramFragment.java index df2453ad6c..747890b738 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/bots/AffiliateProgramFragment.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/bots/AffiliateProgramFragment.java @@ -576,17 +576,17 @@ public FeatureCell(Context context, Theme.ResourcesProvider resourcesProvider) { imageView = new ImageView(context); imageView.setScaleType(ImageView.ScaleType.CENTER); imageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText, resourcesProvider), PorterDuff.Mode.SRC_IN)); - addView(imageView, LayoutHelper.createFrame(24, 24, Gravity.TOP | Gravity.LEFT, 20, 12.66f, 0, 0)); + addView(imageView, LayoutHelper.createFrame(24, 24, Gravity.TOP | Gravity.LEFT, 20, 4.66f, 0, 0)); textLayout = new LinearLayout(context); textLayout.setOrientation(LinearLayout.VERTICAL); - addView(textLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL | Gravity.FILL_HORIZONTAL, 64, 3, 24, 5 + 8.33f)); + addView(textLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL | Gravity.FILL_HORIZONTAL, 64, 3, 24, 5 + 7.66f)); titleView = new TextView(context); titleView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText, resourcesProvider)); titleView.setTypeface(AndroidUtilities.bold()); titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); - textLayout.addView(titleView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.FILL_HORIZONTAL | Gravity.TOP, 0, 0, 0, 4)); + textLayout.addView(titleView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.FILL_HORIZONTAL | Gravity.TOP, 0, 0, 0, 1)); textView = new TextView(context); textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2, resourcesProvider)); @@ -600,6 +600,10 @@ public void set(int iconResId, CharSequence title, CharSequence text) { textView.setText(text); } + public void setText(CharSequence text) { + textView.setText(text); + } + public static class Factory extends UItem.UItemFactory { static { setup(new Factory()); } @@ -670,7 +674,7 @@ public ColorfulTextCell(Context context, Theme.ResourcesProvider resourcesProvid textLayout.addView(textView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.FILL_HORIZONTAL | Gravity.TOP, 0, 3, 0, 0)); arrowView = new ImageView(context); - arrowView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2, resourcesProvider), PorterDuff.Mode.SRC_IN)); + arrowView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_switchTrack, resourcesProvider), PorterDuff.Mode.SRC_IN)); arrowView.setImageResource(R.drawable.msg_arrowright); arrowView.setScaleType(ImageView.ScaleType.CENTER); addView(arrowView, LayoutHelper.createFrame(24, 24, Gravity.RIGHT | Gravity.CENTER_VERTICAL, 0, 0, 10, 0)); @@ -680,10 +684,10 @@ public ColorfulTextCell(Context context, Theme.ResourcesProvider resourcesProvid percentView.setBackground(Theme.createRoundRectDrawable(dp(4), Theme.getColor(Theme.key_color_green, resourcesProvider))); percentView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13); percentView.setTypeface(AndroidUtilities.bold()); - percentView.setPadding(dp(5), 0, dp(4), dp(2)); + percentView.setPadding(dp(5), 0, dp(4), 0); percentView.setGravity(Gravity.CENTER); percentView.setVisibility(View.GONE); - addView(percentView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 17, Gravity.RIGHT | Gravity.CENTER_VERTICAL, 0, 0, 35.33f, 0)); + addView(percentView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 18, Gravity.RIGHT | Gravity.CENTER_VERTICAL, 0, 0, 35.33f, 0)); } public void set(int color, int iconResId, CharSequence title, CharSequence text) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/bots/BotCommandsMenuView.java b/TMessagesProj/src/main/java/org/telegram/ui/bots/BotCommandsMenuView.java index b5039c4bfe..e51747733f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/bots/BotCommandsMenuView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/bots/BotCommandsMenuView.java @@ -27,7 +27,6 @@ import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.Emoji; -import org.telegram.messenger.LocaleController; import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.R; import org.telegram.tgnet.TLRPC; @@ -336,7 +335,7 @@ public BotCommandView(@NonNull Context context) { description = new TextView(context) { @Override public void setText(CharSequence text, BufferType type) { - text = Emoji.replaceEmoji(text, getPaint().getFontMetricsInt(), AndroidUtilities.dp(14), false); + text = Emoji.replaceEmoji(text, getPaint().getFontMetricsInt(), false); super.setText(text, type); } }; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/bots/BotVerifySheet.java b/TMessagesProj/src/main/java/org/telegram/ui/bots/BotVerifySheet.java new file mode 100644 index 0000000000..4bbfefc4a1 --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/bots/BotVerifySheet.java @@ -0,0 +1,432 @@ +package org.telegram.ui.bots; + +import static org.telegram.messenger.AndroidUtilities.dp; +import static org.telegram.messenger.LocaleController.formatPluralString; +import static org.telegram.messenger.LocaleController.formatString; +import static org.telegram.messenger.LocaleController.getString; +import static org.telegram.ui.bots.AffiliateProgramFragment.percents; + +import android.content.Context; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; +import android.graphics.Typeface; +import android.graphics.drawable.ShapeDrawable; +import android.os.Bundle; +import android.text.Editable; +import android.text.InputType; +import android.text.TextUtils; +import android.text.TextWatcher; +import android.util.TypedValue; +import android.view.Gravity; +import android.view.View; +import android.widget.FrameLayout; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; + +import org.telegram.messenger.AccountInstance; +import org.telegram.messenger.AndroidUtilities; +import org.telegram.messenger.ChatObject; +import org.telegram.messenger.DialogObject; +import org.telegram.messenger.Emoji; +import org.telegram.messenger.LocaleController; +import org.telegram.messenger.MessageObject; +import org.telegram.messenger.MessagesController; +import org.telegram.messenger.MessagesStorage; +import org.telegram.messenger.NotificationCenter; +import org.telegram.messenger.R; +import org.telegram.messenger.SendMessagesHelper; +import org.telegram.messenger.UserObject; +import org.telegram.messenger.Utilities; +import org.telegram.tgnet.ConnectionsManager; +import org.telegram.tgnet.TLObject; +import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_bots; +import org.telegram.ui.ActionBar.AlertDialog; +import org.telegram.ui.ActionBar.BaseFragment; +import org.telegram.ui.ActionBar.BottomSheet; +import org.telegram.ui.ActionBar.SimpleTextView; +import org.telegram.ui.ActionBar.Theme; +import org.telegram.ui.Components.AnimatedEmojiDrawable; +import org.telegram.ui.Components.AvatarDrawable; +import org.telegram.ui.Components.BackupImageView; +import org.telegram.ui.Components.BulletinFactory; +import org.telegram.ui.Components.EditTextBoldCursor; +import org.telegram.ui.Components.EditTextSuggestionsFix; +import org.telegram.ui.Components.LayoutHelper; +import org.telegram.ui.Components.OutlineTextContainerView; +import org.telegram.ui.Components.Premium.PremiumGradient; +import org.telegram.ui.DialogsActivity; +import org.telegram.ui.LaunchActivity; +import org.telegram.ui.Stories.recorder.ButtonWithCounterView; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; + +public class BotVerifySheet { + + public static void openVerify(int currentAccount, long botId, TL_bots.botVerifierSettings settings) { + BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); + if (lastFragment == null) return; + + final Bundle args = new Bundle(); + args.putBoolean("onlySelect", true); + args.putInt("dialogsType", DialogsActivity.DIALOGS_TYPE_BOT_SELECT_VERIFY); + args.putBoolean("resetDelegate", false); + + final DialogsActivity fragment = new DialogsActivity(args); + fragment.setCurrentAccount(currentAccount); + fragment.setDelegate((fragment1, dids, _message, param, notify, scheduleDate, topicsFragment) -> { + if (dids.isEmpty()) { + return false; + } + final long dialogId = dids.get(0).dialogId; + openSheet(fragment.getContext(), currentAccount, botId, dialogId, settings, (removed) -> { + if (topicsFragment != null) { + topicsFragment.finishFragment(); + fragment.removeSelfFromStack(); + } else { + fragment.finishFragment(); + } + BaseFragment lastFragment2 = LaunchActivity.getSafeLastFragment(); + if (lastFragment2 == null) return; + + String dialogTitle; + TLObject dialog; + if (dialogId >= 0) { + TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(dialogId); + dialogTitle = UserObject.getForcedFirstName(user); + dialog = user; + } else { + TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-dialogId); + dialogTitle = chat == null ? "" : chat.title; + dialog = chat; + } + BulletinFactory.of(lastFragment2) + .createUsersBulletin(dialog, AndroidUtilities.replaceTags(formatString(removed ? R.string.BotSentRevokeVerifyRequest : R.string.BotSentVerifyRequest, dialogTitle))) + .show(false); + }); + return true; + }); + lastFragment.presentFragment(fragment); + } + + public static void openSheet(Context context, int currentAccount, long botId, long dialogId, TL_bots.botVerifierSettings settings, Utilities.Callback whenSent) { + if (context == null) { + return; + } + + TLRPC.User botUser = MessagesController.getInstance(currentAccount).getUser(botId); + String dialogTitle; + TLObject dialog; + TLRPC.User user = null; + TLRPC.Chat chat = null; + if (dialogId >= 0) { + user = MessagesController.getInstance(currentAccount).getUser(dialogId); + dialogTitle = UserObject.getForcedFirstName(user); + dialog = user; + if (user.bot_verification_icon == settings.icon) { + openRemoveVerify(context, currentAccount, botId, dialogId, settings, whenSent); + return; + } + } else { + chat = MessagesController.getInstance(currentAccount).getChat(-dialogId); + dialogTitle = chat == null ? "" : chat.title; + dialog = chat; + if (chat.bot_verification_icon == settings.icon) { + openRemoveVerify(context, currentAccount, botId, dialogId, settings, whenSent); + return; + } + } + + BottomSheet.Builder b = new BottomSheet.Builder(context, true); + + LinearLayout linearLayout = new LinearLayout(context); + linearLayout.setOrientation(LinearLayout.VERTICAL); + linearLayout.setPadding(dp(16), dp(20), dp(16), dp(8)); + linearLayout.setClipChildren(false); + linearLayout.setClipToPadding(false); + +// FrameLayout topView = new FrameLayout(context); +// +// BackupImageView imageView1 = new BackupImageView(context); +// imageView1.setRoundRadius(dp(30)); +// AvatarDrawable avatarDrawable = new AvatarDrawable(); +// avatarDrawable.setInfo(botUser); +// imageView1.setForUserOrChat(botUser, avatarDrawable); +// topView.addView(imageView1, LayoutHelper.createFrame(60, 60, Gravity.CENTER_VERTICAL | Gravity.LEFT, 0, 0, 0, 0)); +// +// ImageView arrowView = new ImageView(context); +// arrowView.setImageResource(R.drawable.msg_arrow_avatar); +// arrowView.setScaleType(ImageView.ScaleType.CENTER); +// arrowView.setTranslationX(-dp(8.33f / 4)); +// arrowView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2), PorterDuff.Mode.SRC_IN)); +// topView.addView(arrowView, LayoutHelper.createFrame(36, 60, Gravity.CENTER, 60, 0, 60, 0)); +// +// BackupImageView imageView2 = new BackupImageView(context); +// imageView2.setRoundRadius(dp(30)); +// avatarDrawable = new AvatarDrawable(); +// avatarDrawable.setInfo(dialog); +// imageView2.setForUserOrChat(dialog, avatarDrawable); +// topView.addView(imageView2, LayoutHelper.createFrame(60, 60, Gravity.CENTER_VERTICAL | Gravity.RIGHT, 0, 0, 5.66f, 0)); +// +// BackupImageView iconBgView = new BackupImageView(context); +//// iconBgView.setAnimatedEmojiDrawable(AnimatedEmojiDrawable.make(currentAccount, AnimatedEmojiDrawable.CACHE_TYPE_ALERT_PREVIEW, settings.icon)); +//// iconBgView.setEmojiColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_dialogBackground), PorterDuff.Mode.SRC_IN)); +// iconBgView.setScaleX(1.25f); +// iconBgView.setScaleY(1.25f); +// iconBgView.setBackground(Theme.createCircleDrawable(dp(24), Theme.getColor(Theme.key_dialogBackground))); +// topView.addView(iconBgView, LayoutHelper.createFrame(24, 24, Gravity.CENTER_VERTICAL | Gravity.RIGHT, 0, 18, 1.66f, 0)); +// +// BackupImageView iconFgView = new BackupImageView(context); +// iconFgView.setAnimatedEmojiDrawable(AnimatedEmojiDrawable.make(currentAccount, AnimatedEmojiDrawable.CACHE_TYPE_ALERT_PREVIEW, settings.icon)); +// iconFgView.setEmojiColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_verifiedBackground), PorterDuff.Mode.SRC_IN)); +// topView.addView(iconFgView, LayoutHelper.createFrame(24, 24, Gravity.CENTER_VERTICAL | Gravity.RIGHT, 0, 18, 1.66f, 0)); +// +// linearLayout.addView(topView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 0, 0, 0, 0)); + + FrameLayout chipLayout = new FrameLayout(context); + chipLayout.setBackground(Theme.createRoundRectDrawable(dp(28), dp(28), Theme.getColor(Theme.key_groupcreate_spanBackground))); + + BackupImageView chipAvatar = new BackupImageView(context); + chipAvatar.setRoundRadius(dp(28)); + AvatarDrawable avatarDrawable = new AvatarDrawable(); + avatarDrawable.setInfo(dialog); + chipAvatar.setForUserOrChat(dialog, avatarDrawable); + chipLayout.addView(chipAvatar, LayoutHelper.createFrame(28, 28, Gravity.LEFT | Gravity.TOP)); + + BackupImageView badgeView = new BackupImageView(context); + badgeView.setEmojiColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_verifiedBackground), PorterDuff.Mode.SRC_IN)); + badgeView.setAnimatedEmojiDrawable(AnimatedEmojiDrawable.make(currentAccount, AnimatedEmojiDrawable.CACHE_TYPE_ALERT_PREVIEW, settings.icon)); + chipLayout.addView(badgeView, LayoutHelper.createFrame(20, 20, Gravity.LEFT | Gravity.CENTER_VERTICAL, 34, 0, 0, 0)); + + SimpleTextView chipText = new SimpleTextView(context); + chipText.setTextColor(Theme.getColor(Theme.key_dialogTextBlack)); + chipText.setTextSize(13); + chipText.setEllipsizeByGradient(true); + chipText.setText(dialogTitle); + chipText.setWidthWrapContent(true); + chipLayout.addView(chipText, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL | Gravity.LEFT, 37 + 20, 0, 10, 0)); + + linearLayout.addView(chipLayout, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 16, 0, 16, 0)); + + TextView titleView = new TextView(context); + titleView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); + titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); + titleView.setGravity(Gravity.CENTER); + if (UserObject.isBot(user)) { + titleView.setText(getString(R.string.BotVerifyBotTitle)); + } else if (user != null) { + titleView.setText(getString(R.string.BotVerifyUserTitle)); + } else if (ChatObject.isChannelAndNotMegaGroup(chat)) { + titleView.setText(getString(R.string.BotVerifyChannelTitle)); + } else { + titleView.setText(getString(R.string.BotVerifyGroupTitle)); + } + titleView.setTypeface(AndroidUtilities.bold()); + linearLayout.addView(titleView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 24, 21, 24, 8.33f)); + + TextView textView = new TextView(context); + textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); + textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + textView.setGravity(Gravity.CENTER); + NotificationCenter.listenEmojiLoading(textView); + textView.setText(Emoji.replaceEmoji(AndroidUtilities.replaceTags(formatString(R.string.BotVerifyText, dialogTitle)), textView.getPaint().getFontMetricsInt(), false)); + linearLayout.addView(textView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 24, 0, 24, 22)); + + final int maxLength = MessagesController.getInstance(currentAccount).botVerificationDescriptionLengthLimit; + final EditTextBoldCursor editText = new EditTextBoldCursor(context); + final OutlineTextContainerView editTextContainer = new OutlineTextContainerView(context); + editTextContainer.setForceForceUseCenter(true); + editTextContainer.setText(getString(R.string.BotVerifyDescription)); + editTextContainer.setLeftPadding(dp(2)); + editText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); + editText.setCursorSize(AndroidUtilities.dp(20)); + editText.setCursorWidth(1.5f); + editText.setBackground(null); + editText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); + editText.setMaxLines(15); + editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES); + editText.setTypeface(Typeface.DEFAULT); + editText.setSelectAllOnFocus(true); + editText.setHighlightColor(Theme.getColor(Theme.key_chat_inTextSelectionHighlight)); + editText.setHandlesColor(Theme.getColor(Theme.key_chat_TextSelectionCursor)); + editText.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); + editText.setOnFocusChangeListener((v, hasFocus) -> editTextContainer.animateSelection(hasFocus, !TextUtils.isEmpty(editText.getText()))); + editTextContainer.attachEditText(editText); + editTextContainer.addView(editText, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP, 12, 4, 12, 4)); + linearLayout.addView(editTextContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + editText.addTextChangedListener(new EditTextSuggestionsFix()); + editText.addTextChangedListener(new TextWatcher() { + boolean ignoreEditText; + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void afterTextChanged(Editable s) { + CharSequence text = editText.getText(); + if (!ignoreEditText) { + if (text.length() > maxLength) { + ignoreEditText = true; + editText.setText(text = text.subSequence(0, maxLength)); + editText.setSelection(editText.length()); + ignoreEditText = false; + } + } + editTextContainer.animateSelection(editText.isFocused(), !TextUtils.isEmpty(text)); + } + }); + if (!TextUtils.isEmpty(settings.custom_description)) { + editText.setText(settings.custom_description); + if (!settings.can_modify_custom_description) { + editText.setEnabled(false); + editText.setFocusable(false); + editText.setFocusableInTouchMode(false); + } + } else if (!settings.can_modify_custom_description) { + editTextContainer.setVisibility(View.GONE); + } + + if (settings.can_modify_custom_description) { + TextView editTextInfoView = new TextView(context); + editTextInfoView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText4)); + editTextInfoView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12); + editTextInfoView.setText(getString(dialogId >= 0 ? R.string.BotVerifyDescriptionInfo : R.string.BotVerifyDescriptionInfoChat)); + editTextInfoView.setPadding(dp(14), dp(7), dp(14), dp(27)); + linearLayout.addView(editTextInfoView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); + } else { + linearLayout.addView(new View(context), LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 12)); + } + + ButtonWithCounterView button = new ButtonWithCounterView(context, null); + button.setText(titleView.getText(), false); + linearLayout.addView(button, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48)); + + b.setCustomView(linearLayout); + BottomSheet sheet = b.create(); + + button.setOnClickListener(v -> { + if (button.isLoading()) return; + + if (settings.can_modify_custom_description && editText.getText().length() > maxLength) { + editTextContainer.animateError(1.0f); + AndroidUtilities.shakeViewSpring(editTextContainer, -6); + return; + } + + button.setLoading(true); + + TL_bots.setCustomVerification req = new TL_bots.setCustomVerification(); + req.enabled = true; + req.flags |= 1; + req.bot = MessagesController.getInstance(currentAccount).getInputUser(botId); + req.peer = MessagesController.getInstance(currentAccount).getInputPeer(dialogId); + if (settings.can_modify_custom_description) { + req.custom_description = editText.getText().toString(); + } else { + req.custom_description = settings.custom_description; + } + if (!TextUtils.isEmpty(req.custom_description)) { + req.flags |= 4; + } + + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { + button.setLoading(false); + if (res instanceof TLRPC.TL_boolTrue) { + sheet.dismiss(); + whenSent.run(false); + } else { + + } + })); + }); + + sheet.smoothKeyboardAnimationEnabled = true; + sheet.smoothKeyboardByBottom = true; + sheet.show(); + } + + public static void openRemoveVerify(Context context, int currentAccount, long botId, long dialogId, TL_bots.botVerifierSettings settings, Utilities.Callback whenSent) { + if (context == null) { + return; + } + + String dialogTitle; + TLObject dialog; + TLRPC.User user = null; + TLRPC.Chat chat = null; + if (dialogId >= 0) { + user = MessagesController.getInstance(currentAccount).getUser(dialogId); + dialogTitle = UserObject.getForcedFirstName(user); + dialog = user; + } else { + chat = MessagesController.getInstance(currentAccount).getChat(-dialogId); + dialogTitle = chat == null ? "" : chat.title; + dialog = chat; + } + + FrameLayout layoutView = new FrameLayout(context); + + FrameLayout chipLayout = new FrameLayout(context); + chipLayout.setBackground(Theme.createRoundRectDrawable(dp(28), dp(28), Theme.getColor(Theme.key_groupcreate_spanBackground))); + + BackupImageView chipAvatar = new BackupImageView(context); + chipAvatar.setRoundRadius(dp(28)); + AvatarDrawable avatarDrawable = new AvatarDrawable(); + avatarDrawable.setInfo(dialog); + chipAvatar.setForUserOrChat(dialog, avatarDrawable); + chipLayout.addView(chipAvatar, LayoutHelper.createFrame(28, 28, Gravity.LEFT | Gravity.TOP)); + + BackupImageView badgeView = new BackupImageView(context); + badgeView.setEmojiColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_verifiedBackground), PorterDuff.Mode.SRC_IN)); + badgeView.setAnimatedEmojiDrawable(AnimatedEmojiDrawable.make(currentAccount, AnimatedEmojiDrawable.CACHE_TYPE_ALERT_PREVIEW, settings.icon)); + chipLayout.addView(badgeView, LayoutHelper.createFrame(20, 20, Gravity.LEFT | Gravity.CENTER_VERTICAL, 34, 0, 0, 0)); + + SimpleTextView chipText = new SimpleTextView(context); + chipText.setTextColor(Theme.getColor(Theme.key_dialogTextBlack)); + chipText.setTextSize(13); + chipText.setEllipsizeByGradient(true); + chipText.setText(dialogTitle); + chipText.setWidthWrapContent(true); + chipLayout.addView(chipText, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL | Gravity.LEFT, 37 + 20, 0, 10, 0)); + + layoutView.addView(chipLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 16, 0, 16, 0)); + + final boolean[] loading = new boolean[1]; + new AlertDialog.Builder(context) + .setTitle(getString(R.string.BotRemoveVerificationTitle)) + .setMessage(getString(dialogId >= 0 ? R.string.BotRemoveVerificationText : R.string.BotRemoveVerificationChatText)) + .setView(layoutView) + .setNegativeButton(getString(R.string.Cancel), null) + .setPositiveButton(getString(R.string.Remove), (di, w) -> { + if (loading[0]) return; + loading[0] = true; + + TL_bots.setCustomVerification req = new TL_bots.setCustomVerification(); + req.enabled = false; + req.flags |= 1; + req.bot = MessagesController.getInstance(currentAccount).getInputUser(botId); + req.peer = MessagesController.getInstance(currentAccount).getInputPeer(dialogId); + + ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { + loading[0] = false; + if (res instanceof TLRPC.TL_boolTrue) { + whenSent.run(true); + } else { + + } + })); + }) + .makeRed(AlertDialog.BUTTON_POSITIVE) + .show(); + } + +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/bots/BotWebViewSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/bots/BotWebViewSheet.java index 8ec046f665..2e2b5b8b08 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/bots/BotWebViewSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/bots/BotWebViewSheet.java @@ -498,6 +498,7 @@ public void onWebViewCreated(MyWebView webView) { sensors.attachWebView(webView); } fullscreenButtons.setWebView(webView); + updateWebViewBackgroundColor(); } @Override @@ -2083,6 +2084,7 @@ public void setBackgroundColor(int color, boolean isOverride, boolean animated) errorContainer.setDark(AndroidUtilities.computePerceivedBrightness(backgroundPaint.getColor()) <= .721f, false); errorContainer.setBackgroundColor(backgroundPaint.getColor()); } + updateWebViewBackgroundColor(); }); backgroundColorAnimator.addListener(new AnimatorListenerAdapter() { @Override @@ -2094,6 +2096,7 @@ public void onAnimationEnd(Animator animation) { errorContainer.setDark(AndroidUtilities.computePerceivedBrightness(backgroundPaint.getColor()) <= .721f, false); errorContainer.setBackgroundColor(backgroundPaint.getColor()); } + updateWebViewBackgroundColor(); } }); backgroundColorAnimator.start(); @@ -2105,9 +2108,21 @@ public void onAnimationEnd(Animator animation) { errorContainer.setDark(AndroidUtilities.computePerceivedBrightness(backgroundPaint.getColor()) <= .721f, false); errorContainer.setBackgroundColor(backgroundPaint.getColor()); } + updateWebViewBackgroundColor(); } } + private void updateWebViewBackgroundColor() { + if (webViewContainer == null) { + return; + } + BotWebViewContainer.MyWebView webView = webViewContainer.getWebView(); + if (webView == null) { + return; + } + webView.setBackgroundColor(backgroundPaint.getColor()); + } + private boolean resetOffsetY = true; private ValueAnimator fullscreenAnimator; public void setFullscreen(boolean fullscreen, boolean animated) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/bots/ChannelAffiliateProgramsFragment.java b/TMessagesProj/src/main/java/org/telegram/ui/bots/ChannelAffiliateProgramsFragment.java index 4b892cb844..eca1c688d5 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/bots/ChannelAffiliateProgramsFragment.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/bots/ChannelAffiliateProgramsFragment.java @@ -10,6 +10,7 @@ import static org.telegram.ui.bots.AffiliateProgramFragment.percents; import android.content.Context; +import android.graphics.Canvas; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.drawable.ShapeDrawable; @@ -69,12 +70,14 @@ import org.telegram.ui.Components.Premium.PremiumGradient; import org.telegram.ui.Components.Premium.StarParticlesView; import org.telegram.ui.Components.RecyclerListView; +import org.telegram.ui.Components.ScaleStateListAnimator; import org.telegram.ui.Components.TableView; import org.telegram.ui.Components.UItem; import org.telegram.ui.Components.UniversalAdapter; import org.telegram.ui.FilterCreateActivity; import org.telegram.ui.GradientHeaderActivity; import org.telegram.ui.LaunchActivity; +import org.telegram.ui.ProfileActivity; import org.telegram.ui.Stars.BotStarsController; import org.telegram.ui.Stars.StarsIntroActivity; import org.telegram.ui.Stories.recorder.ButtonWithCounterView; @@ -131,7 +134,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { iconTextureView.mRenderer.colorKey2 = Theme.key_starsGradient2; iconTextureView.mRenderer.updateColors(); iconTextureView.setStarParticlesView(particlesView); - aboveTitleView.addView(iconTextureView, LayoutHelper.createFrame(190, 190, Gravity.CENTER, 0, 32, 0, 24)); + aboveTitleView.addView(iconTextureView, LayoutHelper.createFrame(190, 190, Gravity.CENTER, 0, 32, 0, 12)); configureHeader(getString(R.string.ChannelAffiliateProgramTitle), AndroidUtilities.replaceTags(getString(R.string.ChannelAffiliateProgramText)), aboveTitleView, null); listView.setOnItemClickListener((view, position) -> { @@ -272,7 +275,7 @@ public void fillItems(ArrayList items, UniversalAdapter adapter) { TL_payments.connectedBotStarRef bot = connectedBots.bots.get(i); items.add(BotCell.Factory.as(bot)); } - if (connectedBots.isLoading()) { + if (!connectedBots.endReached || connectedBots.isLoading()) { items.add(UItem.asFlicker(FlickerLoadingView.PROFILE_SEARCH_CELL)); items.add(UItem.asFlicker(FlickerLoadingView.PROFILE_SEARCH_CELL)); items.add(UItem.asFlicker(FlickerLoadingView.PROFILE_SEARCH_CELL)); @@ -286,7 +289,7 @@ public void fillItems(ArrayList items, UniversalAdapter adapter) { for (int i = 0; i < suggestedBots.bots.size(); ++i) { items.add(BotCell.Factory.as(suggestedBots.bots.get(i))); } - if (suggestedBots.isLoading()) { + if (!suggestedBots.endReached || suggestedBots.isLoading()) { items.add(UItem.asFlicker(FlickerLoadingView.PROFILE_SEARCH_CELL)); items.add(UItem.asFlicker(FlickerLoadingView.PROFILE_SEARCH_CELL)); items.add(UItem.asFlicker(FlickerLoadingView.PROFILE_SEARCH_CELL)); @@ -473,13 +476,15 @@ public BotCell(Context context, int currentAccount, Theme.ResourcesProvider reso textLayout.addView(textView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.FILL_HORIZONTAL | Gravity.TOP, 6, 1, 24, 0)); arrowView = new ImageView(context); - arrowView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2, resourcesProvider), PorterDuff.Mode.SRC_IN)); - arrowView.setImageResource(R.drawable.photos_arrow); + arrowView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_switchTrack, resourcesProvider), PorterDuff.Mode.SRC_IN)); + arrowView.setImageResource(R.drawable.msg_arrowright); arrowView.setScaleType(ImageView.ScaleType.CENTER); addView(arrowView, LayoutHelper.createFrame(24, 24, Gravity.RIGHT | Gravity.CENTER_VERTICAL, 0, 0, 10, 0)); } - public void set(TL_payments.connectedBotStarRef bot, boolean showArrow) { + private boolean needDivider; + + public void set(TL_payments.connectedBotStarRef bot, boolean showArrow, boolean needDivider) { final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(bot.bot_id); AvatarDrawable avatarDrawable = new AvatarDrawable(); @@ -512,9 +517,11 @@ public void set(TL_payments.connectedBotStarRef bot, boolean showArrow) { linkFgView.setImageResource(bot.revoked ? R.drawable.msg_link_2 : R.drawable.msg_limit_links); linkFgView.setScaleX(bot.revoked ? 0.8f : 0.6f); linkFgView.setScaleY(bot.revoked ? 0.8f : 0.6f); + + setWillNotDraw(!(this.needDivider = needDivider)); } - public void set(TL_payments.starRefProgram bot, boolean showArrow) { + public void set(TL_payments.starRefProgram bot, boolean showArrow, boolean needDivider) { final TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(bot.bot_id); AvatarDrawable avatarDrawable = new AvatarDrawable(); @@ -543,6 +550,8 @@ public void set(TL_payments.starRefProgram bot, boolean showArrow) { linkBgView.setVisibility(View.GONE); linkFgView.setVisibility(View.GONE); linkFg2View.setVisibility(View.GONE); + + setWillNotDraw(!(this.needDivider = needDivider)); } @Override @@ -553,6 +562,14 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { ); } + @Override + protected void dispatchDraw(@NonNull Canvas canvas) { + super.dispatchDraw(canvas); + if (needDivider) { + canvas.drawRect(dp(72), getHeight() - 1, getWidth(), getHeight(), Theme.dividerPaint); + } + } + public static class Factory extends UItem.UItemFactory { static { setup(new Factory()); } @@ -564,9 +581,9 @@ public BotCell createView(Context context, int currentAccount, int classGuid, Th @Override public void bindView(View view, UItem item, boolean divider) { if (item.object instanceof TL_payments.connectedBotStarRef) { - ((BotCell) view).set((TL_payments.connectedBotStarRef) item.object, item.red); + ((BotCell) view).set((TL_payments.connectedBotStarRef) item.object, item.red, divider); } else if (item.object instanceof TL_payments.starRefProgram) { - ((BotCell) view).set((TL_payments.starRefProgram) item.object, item.red); + ((BotCell) view).set((TL_payments.starRefProgram) item.object, item.red, divider); } } @@ -593,7 +610,7 @@ public HeaderSortCell(Context context, Theme.ResourcesProvider resourcesProvider subtextView = new LinkSpanDrawable.LinksTextView(context, resourcesProvider); subtextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); subtextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2, resourcesProvider)); - subtextView.setLinkTextColor(Theme.getColor(Theme.key_chat_messageLinkIn, resourcesProvider)); + subtextView.setLinkTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueHeader, resourcesProvider)); subtextView.setPadding(dp(4), 0, dp(4), 0); addView(subtextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, 14 - 4, 20, 14 - 4, 0)); } @@ -652,6 +669,7 @@ public static void showConnectAffiliateAlert(Context context, int currentAccount AvatarDrawable avatarDrawable2 = new AvatarDrawable(); avatarDrawable2.setInfo(botUser); imageView1.setForUserOrChat(botUser, avatarDrawable2); + ScaleStateListAnimator.apply(imageView1); topView.addView(imageView1, LayoutHelper.createFrame(60, 60, Gravity.CENTER_VERTICAL | Gravity.LEFT, 0, 0, 0, 0)); ImageView arrowView = new ImageView(context); @@ -759,7 +777,13 @@ public static void showConnectAffiliateAlert(Context context, int currentAccount b.setCustomView(linearLayout); BottomSheet sheet = b.create(); - + imageView1.setOnClickListener(v -> { + final BaseFragment lastFragment = LaunchActivity.getSafeLastFragment(); + if (lastFragment != null) { + sheet.dismiss(); + lastFragment.presentFragment(ProfileActivity.of(bot.bot_id)); + } + }); button.setOnClickListener(v -> { if (button.isLoading()) return; button.setLoading(true); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/bots/ChatAttachAlertBotWebViewLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/bots/ChatAttachAlertBotWebViewLayout.java index 969b364bbb..4091606ddd 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/bots/ChatAttachAlertBotWebViewLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/bots/ChatAttachAlertBotWebViewLayout.java @@ -819,7 +819,9 @@ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float ve if (isSwipeDisallowed || !allowSwipes || fullsize && !allowFullSizeSwipe || (shouldWaitWebViewScroll && !allowingScroll(false))) { return false; } - if (velocityY >= dp(650) && (AndroidUtilities.distance(e1.getX(), e1.getY(), e2.getX(), e2.getY()) > dp(200) || (e2.getEventTime() - e1.getEventTime()) > 250) && (webView == null || webView.getScrollY() == 0)) { + final float distance = AndroidUtilities.distance(e1.getX(), e1.getY(), e2.getX(), e2.getY()); + final float time = e2.getEventTime() - e1.getEventTime(); + if (velocityY >= dp(650) && (distance > dp(200) || (time > 250)) && (webView == null || webView.getScrollY() == 0)) { flingInProgress = true; if (swipeOffsetY >= swipeStickyRange || fullsize) { @@ -1118,7 +1120,7 @@ public boolean dispatchTouchEvent(MotionEvent ev) { } else if (flingInProgress) { flingInProgress = false; - } else if (allowSwipes && (!shouldWaitWebViewScroll || swipeOffsetY != -offsetY + topActionBarOffsetY || allowingScroll(false))) { + } else if (allowSwipes && (!shouldWaitWebViewScroll || swipeOffsetY != -offsetY + topActionBarOffsetY && allowingScroll(false))) { if (swipeOffsetY <= -swipeStickyRange) { if (stickToEdges) { stickTo(-offsetY + topActionBarOffsetY); @@ -1128,7 +1130,9 @@ public boolean dispatchTouchEvent(MotionEvent ev) { stickTo(0); } } else { - if (delegate != null && ((ev.getEventTime() - pressDownTime) > 250 || AndroidUtilities.distance(ev.getX(), ev.getY(), pressDownX, pressDownY) > dp(200))) { + final float distance = AndroidUtilities.distance(ev.getX(), ev.getY(), pressDownX, pressDownY); + final long time = ev.getEventTime() - pressDownTime; + if (delegate != null && (time > 250 || distance > dp(200))) { delegate.onDismiss(!wasScrolling); } else if (stickToEdges) { stickTo(-offsetY + topActionBarOffsetY); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/bots/SetupEmojiStatusSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/bots/SetupEmojiStatusSheet.java index 83d42083d8..f4411fb1eb 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/bots/SetupEmojiStatusSheet.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/bots/SetupEmojiStatusSheet.java @@ -2,42 +2,28 @@ import static android.graphics.PorterDuff.Mode.SRC_IN; import static org.telegram.messenger.AndroidUtilities.dp; -import static org.telegram.messenger.AndroidUtilities.getDataColumn; -import static org.telegram.messenger.LocaleController.getCurrencyExpDivider; import static org.telegram.messenger.LocaleController.getString; import android.app.Activity; -import android.app.Dialog; import android.content.Context; -import android.content.ContextWrapper; -import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.Paint; import android.graphics.PixelFormat; import android.graphics.PorterDuffColorFilter; -import android.graphics.PorterDuffXfermode; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.Drawable; -import android.net.Uri; -import android.text.TextUtils; -import android.util.TypedValue; -import android.view.Gravity; import android.view.View; -import android.widget.LinearLayout; -import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import org.checkerframework.checker.units.qual.A; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.DocumentObject; import org.telegram.messenger.FileLoader; -import org.telegram.messenger.FileLog; import org.telegram.messenger.ImageLocation; import org.telegram.messenger.ImageReceiver; import org.telegram.messenger.LocaleController; @@ -51,31 +37,20 @@ import org.telegram.messenger.Utilities; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; +import org.telegram.tgnet.tl.TL_account; import org.telegram.tgnet.tl.TL_bots; import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.BaseFragment; -import org.telegram.ui.ActionBar.BottomSheet; import org.telegram.ui.ActionBar.Theme; -import org.telegram.ui.Components.AlertsCreator; import org.telegram.ui.Components.AnimatedEmojiDrawable; -import org.telegram.ui.Components.AnimatedFileDrawable; import org.telegram.ui.Components.AnimatedFloat; import org.telegram.ui.Components.AttachableDrawable; import org.telegram.ui.Components.AvatarDrawable; -import org.telegram.ui.Components.BackupImageView; -import org.telegram.ui.Components.ChatAttachAlert; import org.telegram.ui.Components.CubicBezierInterpolator; -import org.telegram.ui.Components.LayoutHelper; -import org.telegram.ui.Components.PhotoViewerCaptionEnterView; import org.telegram.ui.Components.Premium.PremiumFeatureBottomSheet; -import org.telegram.ui.Components.Premium.PremiumPreviewBottomSheet; import org.telegram.ui.Components.Text; import org.telegram.ui.LaunchActivity; -import org.telegram.ui.PhotoViewer; import org.telegram.ui.PremiumPreviewFragment; -import org.telegram.ui.Stories.recorder.ButtonWithCounterView; - -import java.util.ArrayList; public class SetupEmojiStatusSheet { @@ -163,17 +138,14 @@ public Activity getParentActivity() { } setting[0] = true; - TLRPC.TL_account_updateEmojiStatus req = new TLRPC.TL_account_updateEmojiStatus(); + TL_account.updateEmojiStatus req = new TL_account.updateEmojiStatus(); + TLRPC.TL_emojiStatus status = new TLRPC.TL_emojiStatus(); + status.document_id = document.id; if (duration > 0) { - TLRPC.TL_emojiStatusUntil status = new TLRPC.TL_emojiStatusUntil(); + status.flags |= 1; status.until = ConnectionsManager.getInstance(currentAccount).getCurrentTime() + duration; - status.document_id = document.id; - req.emoji_status = status; - } else { - TLRPC.TL_emojiStatus status = new TLRPC.TL_emojiStatus(); - status.document_id = document.id; - req.emoji_status = status; } + req.emoji_status = status; ConnectionsManager.getInstance(currentAccount).sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> { if (!(res instanceof TLRPC.TL_boolTrue)) { if (!sentDone[0]) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/web/BotWebViewContainer.java b/TMessagesProj/src/main/java/org/telegram/ui/web/BotWebViewContainer.java index 9d42d6e225..b9cd5844dd 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/web/BotWebViewContainer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/web/BotWebViewContainer.java @@ -379,6 +379,13 @@ private void setupWebView(MyWebView replaceWith, Object proxy) { if (replaceWith != null) { AndroidUtilities.removeFromParent(replaceWith); } + try { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && SharedConfig.debugWebView) { + WebView.setWebContentsDebuggingEnabled(true); + } + } catch (Exception e) { + FileLog.e(e); + } webView = replaceWith == null ? new MyWebView(getContext(), bot) : replaceWith; if (!bot) { CookieManager cookieManager = CookieManager.getInstance(); @@ -3476,20 +3483,25 @@ public boolean onRenderProcessGone(WebView view, RenderProcessGoneDetail detail) } else { d("onRenderProcessGone"); } - if (!AndroidUtilities.isSafeToShow(getContext())) { + try { + if (!AndroidUtilities.isSafeToShow(getContext())) { + return true; + } + new AlertDialog.Builder(getContext(), botWebViewContainer == null ? null : botWebViewContainer.resourcesProvider) + .setTitle(getString(R.string.ChromeCrashTitle)) + .setMessage(AndroidUtilities.replaceSingleTag(getString(R.string.ChromeCrashMessage), () -> Browser.openUrl(getContext(), "https://play.google.com/store/apps/details?id=com.google.android.webview"))) + .setPositiveButton(getString(R.string.OK), null) + .setOnDismissListener(d -> { + if (botWebViewContainer != null && botWebViewContainer.delegate != null) { + botWebViewContainer.delegate.onCloseRequested(null); + } + }) + .show(); return true; + } catch (Exception e) { + FileLog.e(e); + return false; } - new AlertDialog.Builder(getContext(), botWebViewContainer == null ? null : botWebViewContainer.resourcesProvider) - .setTitle(getString(R.string.ChromeCrashTitle)) - .setMessage(AndroidUtilities.replaceSingleTag(getString(R.string.ChromeCrashMessage), () -> Browser.openUrl(getContext(), "https://play.google.com/store/apps/details?id=com.google.android.webview"))) - .setPositiveButton(getString(R.string.OK), null) - .setOnDismissListener(d -> { - if (botWebViewContainer != null && botWebViewContainer.delegate != null) { - botWebViewContainer.delegate.onCloseRequested(null); - } - }) - .show(); - return true; } @Override @@ -3782,20 +3794,25 @@ public boolean onRenderProcessGone(WebView view, RenderProcessGoneDetail detail) } else { d("newWebView.onRenderProcessGone"); } - if (!AndroidUtilities.isSafeToShow(getContext())) { + try { + if (!AndroidUtilities.isSafeToShow(getContext())) { + return true; + } + new AlertDialog.Builder(getContext(), botWebViewContainer == null ? null : botWebViewContainer.resourcesProvider) + .setTitle(getString(R.string.ChromeCrashTitle)) + .setMessage(AndroidUtilities.replaceSingleTag(getString(R.string.ChromeCrashMessage), () -> Browser.openUrl(getContext(), "https://play.google.com/store/apps/details?id=com.google.android.webview"))) + .setPositiveButton(getString(R.string.OK), null) + .setOnDismissListener(d -> { + if (botWebViewContainer.delegate != null) { + botWebViewContainer.delegate.onCloseRequested(null); + } + }) + .show(); return true; + } catch (Exception e) { + FileLog.e(e); + return false; } - new AlertDialog.Builder(getContext(), botWebViewContainer == null ? null : botWebViewContainer.resourcesProvider) - .setTitle(getString(R.string.ChromeCrashTitle)) - .setMessage(AndroidUtilities.replaceSingleTag(getString(R.string.ChromeCrashMessage), () -> Browser.openUrl(getContext(), "https://play.google.com/store/apps/details?id=com.google.android.webview"))) - .setPositiveButton(getString(R.string.OK), null) - .setOnDismissListener(d -> { - if (botWebViewContainer.delegate != null) { - botWebViewContainer.delegate.onCloseRequested(null); - } - }) - .show(); - return true; } @Override @@ -4087,7 +4104,7 @@ public void onDownloadStart(String url, String userAgent, String contentDisposit // we can't get blob binary from webview :( return; } else { - final String filename = getFilename(url, contentDisposition, mimeType); + final String filename = AndroidUtilities.escape(getFilename(url, contentDisposition, mimeType)); final Runnable download = () -> { try { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/web/BrowserHistory.java b/TMessagesProj/src/main/java/org/telegram/ui/web/BrowserHistory.java index 8b2a3ba414..f363a127d7 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/web/BrowserHistory.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/web/BrowserHistory.java @@ -7,6 +7,8 @@ import org.telegram.messenger.FileLog; import org.telegram.messenger.Utilities; import org.telegram.tgnet.AbstractSerializedData; +import org.telegram.tgnet.InputSerializedData; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLObject; @@ -23,7 +25,7 @@ public static class Entry extends TLObject { public WebMetadataCache.WebMetadata meta; @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt64(id); stream.writeInt64(time); stream.writeString(url == null ? "" : url); @@ -31,7 +33,7 @@ public void serializeToStream(AbstractSerializedData stream) { } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt64(exception); time = stream.readInt64(exception); url = stream.readString(exception); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/web/WebActionBar.java b/TMessagesProj/src/main/java/org/telegram/ui/web/WebActionBar.java index 8a39df6bab..0b3899c7d7 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/web/WebActionBar.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/web/WebActionBar.java @@ -1003,7 +1003,9 @@ protected boolean verifyDrawable(@NonNull Drawable who) { if (getParent() != null) { getParent().requestDisallowInterceptTouchEvent(true); } - performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); + try { + performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); + } catch (Exception ignored) {} }; public boolean longClicked = false; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/web/WebMetadataCache.java b/TMessagesProj/src/main/java/org/telegram/ui/web/WebMetadataCache.java index 5950bee2c7..03dfa6146e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/web/WebMetadataCache.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/web/WebMetadataCache.java @@ -30,6 +30,8 @@ import org.telegram.messenger.R; import org.telegram.messenger.Utilities; import org.telegram.tgnet.AbstractSerializedData; +import org.telegram.tgnet.InputSerializedData; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; @@ -93,7 +95,7 @@ public static WebMetadata from(BotWebViewContainer.MyWebView webView) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt64(time); stream.writeString(domain == null ? "" : domain); stream.writeString(title == null ? "" : title); @@ -124,7 +126,7 @@ public void serializeToStream(AbstractSerializedData stream) { } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { time = stream.readInt64(exception); domain = stream.readString(exception); title = stream.readString(exception); @@ -145,7 +147,7 @@ private final static class MetadataFile extends TLObject { public final ArrayList array = new ArrayList<>(); @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(array.size()); for (int i = 0; i < array.size(); ++i) { array.get(i).serializeToStream(stream); @@ -153,7 +155,7 @@ public void serializeToStream(AbstractSerializedData stream) { } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { final int count = stream.readInt32(exception); for (int i = 0; i < count; ++i) { WebMetadata metadata = new WebMetadata(); diff --git a/TMessagesProj/src/main/res/drawable/filled_crown_off.xml b/TMessagesProj/src/main/res/drawable/filled_crown_off.xml new file mode 100644 index 0000000000..444ecc8678 --- /dev/null +++ b/TMessagesProj/src/main/res/drawable/filled_crown_off.xml @@ -0,0 +1,14 @@ + + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/drawable/filled_crown_on.xml b/TMessagesProj/src/main/res/drawable/filled_crown_on.xml new file mode 100644 index 0000000000..22c92cc07d --- /dev/null +++ b/TMessagesProj/src/main/res/drawable/filled_crown_on.xml @@ -0,0 +1,12 @@ + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/drawable/filled_gift_simple.xml b/TMessagesProj/src/main/res/drawable/filled_gift_simple.xml new file mode 100644 index 0000000000..ac0bebb15b --- /dev/null +++ b/TMessagesProj/src/main/res/drawable/filled_gift_simple.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/drawable/filled_gift_transfer.xml b/TMessagesProj/src/main/res/drawable/filled_gift_transfer.xml new file mode 100644 index 0000000000..a61e5eb608 --- /dev/null +++ b/TMessagesProj/src/main/res/drawable/filled_gift_transfer.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/drawable/filled_share.xml b/TMessagesProj/src/main/res/drawable/filled_share.xml new file mode 100644 index 0000000000..2d06f1c472 --- /dev/null +++ b/TMessagesProj/src/main/res/drawable/filled_share.xml @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/drawable/filled_sound_on.xml b/TMessagesProj/src/main/res/drawable/filled_sound_on.xml new file mode 100644 index 0000000000..f72cf165a4 --- /dev/null +++ b/TMessagesProj/src/main/res/drawable/filled_sound_on.xml @@ -0,0 +1,11 @@ + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/drawable/gift_unpack.xml b/TMessagesProj/src/main/res/drawable/gift_unpack.xml new file mode 100644 index 0000000000..e35722a1d4 --- /dev/null +++ b/TMessagesProj/src/main/res/drawable/gift_unpack.xml @@ -0,0 +1,29 @@ + + + + + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/drawable/gift_upgrade.xml b/TMessagesProj/src/main/res/drawable/gift_upgrade.xml new file mode 100644 index 0000000000..a13380b3c4 --- /dev/null +++ b/TMessagesProj/src/main/res/drawable/gift_upgrade.xml @@ -0,0 +1,13 @@ + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/drawable/input_gift_s.xml b/TMessagesProj/src/main/res/drawable/input_gift_s.xml new file mode 100644 index 0000000000..7aa9cdd05d --- /dev/null +++ b/TMessagesProj/src/main/res/drawable/input_gift_s.xml @@ -0,0 +1,27 @@ + + + + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/drawable/menu_feature_tradable.xml b/TMessagesProj/src/main/res/drawable/menu_feature_tradable.xml new file mode 100644 index 0000000000..24cae2db2a --- /dev/null +++ b/TMessagesProj/src/main/res/drawable/menu_feature_tradable.xml @@ -0,0 +1,32 @@ + + + + + + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/drawable/menu_feature_transfer.xml b/TMessagesProj/src/main/res/drawable/menu_feature_transfer.xml new file mode 100644 index 0000000000..507eafd6aa --- /dev/null +++ b/TMessagesProj/src/main/res/drawable/menu_feature_transfer.xml @@ -0,0 +1,32 @@ + + + + + + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/drawable/menu_feature_unique.xml b/TMessagesProj/src/main/res/drawable/menu_feature_unique.xml new file mode 100644 index 0000000000..920efb17d3 --- /dev/null +++ b/TMessagesProj/src/main/res/drawable/menu_feature_unique.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/drawable/menu_sort_date.xml b/TMessagesProj/src/main/res/drawable/menu_sort_date.xml new file mode 100644 index 0000000000..faf467f57c --- /dev/null +++ b/TMessagesProj/src/main/res/drawable/menu_sort_date.xml @@ -0,0 +1,32 @@ + + + + + + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/drawable/menu_sort_value.xml b/TMessagesProj/src/main/res/drawable/menu_sort_value.xml new file mode 100644 index 0000000000..3edb80882a --- /dev/null +++ b/TMessagesProj/src/main/res/drawable/menu_sort_value.xml @@ -0,0 +1,24 @@ + + + + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/drawable/menu_verification.xml b/TMessagesProj/src/main/res/drawable/menu_verification.xml new file mode 100644 index 0000000000..c1a87a3932 --- /dev/null +++ b/TMessagesProj/src/main/res/drawable/menu_verification.xml @@ -0,0 +1,16 @@ + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/drawable/msg_emoji_gem.xml b/TMessagesProj/src/main/res/drawable/msg_emoji_gem.xml new file mode 100644 index 0000000000..fc18c35c31 --- /dev/null +++ b/TMessagesProj/src/main/res/drawable/msg_emoji_gem.xml @@ -0,0 +1,24 @@ + + + + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/drawable/video_settings.xml b/TMessagesProj/src/main/res/drawable/video_settings.xml new file mode 100644 index 0000000000..bb871d3dfd --- /dev/null +++ b/TMessagesProj/src/main/res/drawable/video_settings.xml @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/drawable/video_starts_at.xml b/TMessagesProj/src/main/res/drawable/video_starts_at.xml new file mode 100644 index 0000000000..f85428e1ea --- /dev/null +++ b/TMessagesProj/src/main/res/drawable/video_starts_at.xml @@ -0,0 +1,13 @@ + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/raw/gift_upgrade.json b/TMessagesProj/src/main/res/raw/gift_upgrade.json new file mode 100644 index 0000000000..ec8605e64e --- /dev/null +++ b/TMessagesProj/src/main/res/raw/gift_upgrade.json @@ -0,0 +1 @@ +{"tgs":1,"v":"5.5.2","fr":60,"ip":0,"op":42,"w":512,"h":512,"nm":"Gift Upgraded 1","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Main Shape 2","sr":1,"ks":{"p":{"a":0,"k":[256,256,0]},"s":{"a":1,"k":[{"i":{"x":[0.7,0.7,0.7],"y":[1,1,1]},"o":{"x":[0.3,0.3,0.3],"y":[0,0,0]},"t":0,"s":[115,115,100]},{"i":{"x":[0.7,0.7,0.7],"y":[1,1,1]},"o":{"x":[0.6,0.6,0.6],"y":[0,0,0]},"t":11,"s":[80,80,100]},{"i":{"x":[0.7,0.7,0.7],"y":[1,1,1]},"o":{"x":[0.3,0.3,0.3],"y":[0,0,0]},"t":23,"s":[104,104,100]},{"i":{"x":[0.7,0.7,0.7],"y":[1,1,1]},"o":{"x":[0.3,0.3,0.3],"y":[0,0,0]},"t":33,"s":[99,99,100]},{"t":40,"s":[100,100,100]}]}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ks":{"a":1,"k":[{"i":{"x":0.71,"y":1},"o":{"x":0.29,"y":0},"t":0,"s":[{"i":[[-112.666,0],[0,-112.666],[112.666,0],[0,112.666]],"o":[[112.666,0],[0,112.666],[-112.666,0],[0,-112.666]],"v":[[0,-204],[204,0],[0,204],[-204,0]],"c":true}]},{"t":10,"s":[{"i":[[-112.666,0],[0,-112.666],[112.666,0],[0,112.666]],"o":[[112.666,0],[0,112.666],[-112.666,0],[0,-112.666]],"v":[[0,-204],[204,0],[0,204],[-204,0]],"c":true}]}]},"nm":"Path 4","hd":false},{"ind":1,"ty":"sh","ks":{"a":1,"k":[{"i":{"x":0.71,"y":1},"o":{"x":0.6,"y":0},"t":0,"s":[{"i":[[112.666,0],[0,-112.666],[-112.666,0],[0,112.666]],"o":[[-112.666,0],[0,112.666],[112.666,0],[0,-112.666]],"v":[[0,-204],[-204,0],[0,204],[204,0]],"c":true}]},{"t":10,"s":[{"i":[[-0.061,0],[0,0.061],[0.061,0],[0,-0.061]],"o":[[0.061,0],[0,-0.061],[-0.061,0],[0,0.061]],"v":[[0,0.111],[0.111,0],[0,-0.111],[-0.111,0]],"c":true}]}]},"nm":"Path 5","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1]},"o":{"a":0,"k":100},"r":1,"bm":0,"nm":"Fill 1","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0]},"a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"r":{"a":0,"k":0},"o":{"a":0,"k":100},"sk":{"a":0,"k":0},"sa":{"a":0,"k":0},"nm":"Transform"}],"nm":"Combined-Shape","bm":0,"hd":false}],"ip":1,"op":9,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Main Shape 3","parent":3,"sr":1,"ks":{"s":{"a":1,"k":[{"i":{"x":[0.7,0.7,0.7],"y":[1,1,1]},"o":{"x":[0.3,0.3,0.3],"y":[0,0,0]},"t":0,"s":[143.75,143.75,100]},{"i":{"x":[0.7,0.7,0.7],"y":[1,1,1]},"o":{"x":[0.6,0.6,0.6],"y":[0,0,0]},"t":11,"s":[100,100,100]},{"i":{"x":[0.7,0.7,0.7],"y":[1,1,1]},"o":{"x":[0.3,0.3,0.3],"y":[0,0,0]},"t":23,"s":[130,130,100]},{"i":{"x":[0.7,0.7,0.7],"y":[1,1,1]},"o":{"x":[0.3,0.3,0.3],"y":[0,0,0]},"t":33,"s":[123.75,123.75,100]},{"t":40,"s":[125,125,100]}]}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ks":{"a":1,"k":[{"i":{"x":0.833,"y":1},"o":{"x":0.167,"y":0},"t":9,"s":[{"i":[[0,0],[3.4,-2.84],[0,0],[-2.759,-3.255],[0,0],[-3.137,2.62],[0,0],[0,0],[0,0],[0,0],[-2.759,3.255],[3.279,2.739]],"o":[[-3.4,-2.84],[0,0],[-3.279,2.739],[0,0],[2.81,2.877],[0,0],[0,0],[0,0],[0,0],[3.279,2.739],[2.759,-3.255],[0,0]],"v":[[5.684,121.125],[-6.082,121.125],[-39.339,148.901],[-40.281,159.754],[-39.91,160.162],[-29.348,160.689],[-0.656,136.726],[-0.199,136.345],[0.295,136.757],[28.949,160.689],[39.883,159.754],[38.941,148.901]],"c":true}]},{"i":{"x":0.4,"y":1},"o":{"x":0.3,"y":0},"t":10,"s":[{"i":[[0,0],[3.629,-3.031],[0,0],[-2.945,-3.475],[0,0],[-3.348,2.796],[0,0],[0,0],[0,0],[0,0],[-2.945,3.475],[3.5,2.923]],"o":[[-3.629,-3.031],[0,0],[-3.5,2.923],[0,0],[2.999,3.071],[0,0],[0,0],[0,0],[0,0],[3.5,2.923],[2.945,-3.475],[0,0]],"v":[[6.036,118.895],[-6.522,118.895],[-42.019,148.541],[-43.024,160.126],[-42.628,160.562],[-29.675,162.192],[-0.577,138.294],[-0.09,137.887],[0.438,138.328],[29.037,161.124],[42.539,160.126],[41.534,148.541]],"c":true}]},{"i":{"x":0.7,"y":1},"o":{"x":0.5,"y":0},"t":23,"s":[{"i":[[0,0],[6.816,-5.693],[0,0],[-5.531,-6.525],[0,0],[-6.288,5.252],[0,0],[0,0],[0,0],[0,0],[-5.531,6.525],[6.574,5.49]],"o":[[-6.816,-5.693],[0,0],[-6.574,5.49],[0,0],[5.633,5.768],[0,0],[0,0],[0,0],[0,0],[6.574,5.49],[5.531,-6.525],[0,0]],"v":[[12.316,1.063],[-11.269,1.063],[-77.935,56.741],[-79.823,78.497],[-79.078,79.316],[-57.906,80.371],[-0.391,32.335],[0.524,31.571],[1.515,32.399],[58.953,80.371],[80.871,78.497],[78.983,56.741]],"c":true}]},{"i":{"x":0.7,"y":1},"o":{"x":0.3,"y":0},"t":33,"s":[{"i":[[0,0],[6.816,-5.693],[0,0],[-5.531,-6.525],[0,0],[-6.288,5.252],[0,0],[0,0],[0,0],[0,0],[-5.531,6.525],[6.574,5.49]],"o":[[-6.816,-5.693],[0,0],[-6.574,5.49],[0,0],[5.633,5.768],[0,0],[0,0],[0,0],[0,0],[6.574,5.49],[5.531,-6.525],[0,0]],"v":[[11.682,42.712],[-11.904,42.712],[-78.57,98.39],[-80.458,120.146],[-79.713,120.965],[-58.541,122.02],[-1.026,73.984],[-0.111,73.22],[0.88,74.048],[58.318,122.02],[80.236,120.146],[78.348,98.39]],"c":true}]},{"t":41,"s":[{"i":[[0,0],[6.816,-5.693],[0,0],[-5.531,-6.525],[0,0],[-6.288,5.252],[0,0],[0,0],[0,0],[0,0],[-5.531,6.525],[6.574,5.49]],"o":[[-6.816,-5.693],[0,0],[-6.574,5.49],[0,0],[5.633,5.768],[0,0],[0,0],[0,0],[0,0],[6.574,5.49],[5.531,-6.525],[0,0]],"v":[[11.793,34.665],[-11.793,34.665],[-78.459,90.343],[-80.347,112.1],[-79.602,112.919],[-58.429,113.974],[-0.915,65.938],[0,65.174],[0.991,66.001],[58.429,113.974],[80.347,112.1],[78.459,90.343]],"c":true}]}]},"nm":"Path 3","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1]},"o":{"a":0,"k":100},"r":1,"bm":0,"nm":"Fill 1","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0]},"a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"r":{"a":0,"k":0},"o":{"a":0,"k":100},"sk":{"a":0,"k":0},"sa":{"a":0,"k":0},"nm":"Transform"}],"nm":"Combined-Shape","bm":0,"hd":false}],"ip":9,"op":14,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Main Shape","sr":1,"ks":{"p":{"a":0,"k":[256,256,0]},"s":{"a":1,"k":[{"i":{"x":[0.7,0.7,0.7],"y":[1,1,1]},"o":{"x":[0.3,0.3,0.3],"y":[0,0,0]},"t":0,"s":[115,115,100]},{"i":{"x":[0.7,0.7,0.7],"y":[1,1,1]},"o":{"x":[0.6,0.6,0.6],"y":[0,0,0]},"t":11,"s":[80,80,100]},{"i":{"x":[0.7,0.7,0.7],"y":[1,1,1]},"o":{"x":[0.3,0.3,0.3],"y":[0,0,0]},"t":23,"s":[104,104,100]},{"i":{"x":[0.7,0.7,0.7],"y":[1,1,1]},"o":{"x":[0.3,0.3,0.3],"y":[0,0,0]},"t":33,"s":[99,99,100]},{"t":40,"s":[100,100,100]}]}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ks":{"a":1,"k":[{"i":{"x":0.4,"y":1},"o":{"x":0.3,"y":0},"t":8,"s":[{"i":[[0,0],[3.4,-2.84],[0,0],[-2.759,-3.255],[0,0],[-3.137,2.62],[0,0],[0,0],[0,0],[0,0],[-2.759,3.255],[3.279,2.739]],"o":[[-3.4,-2.84],[0,0],[-3.279,2.739],[0,0],[2.81,2.877],[0,0],[0,0],[0,0],[0,0],[3.279,2.739],[2.759,-3.255],[0,0]],"v":[[5.639,110.887],[-6.126,110.887],[-39.384,138.662],[-40.325,149.516],[-39.954,149.924],[-29.392,150.451],[-0.7,126.488],[-0.244,126.106],[0.251,126.519],[28.905,150.451],[39.838,149.516],[38.897,138.662]],"c":true}]},{"i":{"x":0.7,"y":1},"o":{"x":0.5,"y":0},"t":17,"s":[{"i":[[0,0],[6.816,-5.693],[0,0],[-5.531,-6.525],[0,0],[-6.288,5.252],[0,0],[0,0],[0,0],[0,0],[-5.531,6.525],[6.574,5.49]],"o":[[-6.816,-5.693],[0,0],[-6.574,5.49],[0,0],[5.633,5.768],[0,0],[0,0],[0,0],[0,0],[6.574,5.49],[5.531,-6.525],[0,0]],"v":[[12.565,-160.583],[-11.02,-160.583],[-77.686,-104.905],[-79.574,-83.148],[-78.829,-82.33],[-57.657,-81.274],[-5.063,-125.2],[0.773,-130.074],[6.165,-125.571],[59.202,-81.274],[81.12,-83.148],[79.231,-104.905]],"c":true}]},{"i":{"x":0.7,"y":1},"o":{"x":0.3,"y":0},"t":28,"s":[{"i":[[0,0],[6.816,-5.693],[0,0],[-5.531,-6.525],[0,0],[-6.288,5.252],[0,0],[0,0],[0,0],[0,0],[-5.531,6.525],[6.574,5.49]],"o":[[-6.816,-5.693],[0,0],[-6.574,5.49],[0,0],[5.633,5.768],[0,0],[0,0],[0,0],[0,0],[6.574,5.49],[5.531,-6.525],[0,0]],"v":[[11.793,-113.604],[-11.793,-113.604],[-78.459,-57.926],[-80.347,-36.17],[-79.602,-35.351],[-58.429,-34.296],[-5.836,-78.222],[0,-83.096],[5.392,-78.592],[58.429,-34.296],[80.347,-36.17],[78.459,-57.926]],"c":true}]},{"t":37,"s":[{"i":[[0,0],[6.816,-5.693],[0,0],[-5.531,-6.525],[0,0],[-6.288,5.252],[0,0],[0,0],[0,0],[0,0],[-5.531,6.525],[6.574,5.49]],"o":[[-6.816,-5.693],[0,0],[-6.574,5.49],[0,0],[5.633,5.768],[0,0],[0,0],[0,0],[0,0],[6.574,5.49],[5.531,-6.525],[0,0]],"v":[[11.793,-124.131],[-11.793,-124.131],[-78.459,-68.453],[-80.347,-46.696],[-79.602,-45.877],[-58.429,-44.822],[-5.836,-88.748],[0,-93.622],[5.392,-89.119],[58.429,-44.822],[80.347,-46.696],[78.459,-68.453]],"c":true}]}]},"nm":"Path 1","hd":false},{"ind":1,"ty":"sh","ks":{"a":1,"k":[{"i":{"x":0.833,"y":1},"o":{"x":0.3,"y":0},"t":8,"s":[{"i":[[0,0],[3.4,-2.84],[0,0],[-2.759,-3.255],[0,0],[-3.137,2.62],[0,0],[0,0],[0,0],[0,0],[-2.759,3.255],[3.279,2.739]],"o":[[-3.4,-2.84],[0,0],[-3.279,2.739],[0,0],[2.81,2.877],[0,0],[0,0],[0,0],[0,0],[3.279,2.739],[2.759,-3.255],[0,0]],"v":[[5.729,120.972],[-6.036,120.972],[-39.294,148.748],[-40.235,159.601],[-39.864,160.009],[-29.302,160.536],[-0.61,136.573],[-0.153,136.191],[0.341,136.604],[28.995,160.536],[39.928,159.601],[38.987,148.748]],"c":true}]},{"i":{"x":0.833,"y":1},"o":{"x":0.167,"y":0},"t":9,"s":[{"i":[[0,0],[3.4,-2.84],[0,0],[-2.759,-3.255],[0,0],[-3.137,2.62],[0,0],[0,0],[0,0],[0,0],[-2.759,3.255],[3.279,2.739]],"o":[[-3.4,-2.84],[0,0],[-3.279,2.739],[0,0],[2.81,2.877],[0,0],[0,0],[0,0],[0,0],[3.279,2.739],[2.759,-3.255],[0,0]],"v":[[5.684,121.125],[-6.082,121.125],[-39.339,148.901],[-40.281,159.754],[-39.91,160.162],[-29.348,160.689],[-0.656,136.726],[-0.199,136.345],[0.295,136.757],[28.949,160.689],[39.883,159.754],[38.941,148.901]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.3,"y":0},"t":10,"s":[{"i":[[0,0],[3.4,-2.84],[0,0],[-2.759,-3.255],[0,0],[-3.137,2.62],[0,0],[0,0],[0,0],[0,0],[-2.759,3.255],[3.279,2.739]],"o":[[-3.4,-2.84],[0,0],[-3.279,2.739],[0,0],[2.81,2.877],[0,0],[0,0],[0,0],[0,0],[3.279,2.739],[2.759,-3.255],[0,0]],"v":[[5.793,121.14],[-5.973,121.14],[-39.23,148.915],[-40.172,159.769],[-39.8,160.177],[-29.238,160.704],[-0.547,136.74],[-0.09,136.359],[0.404,136.772],[29.058,160.704],[39.992,159.769],[39.05,148.915]],"c":true}]},{"i":{"x":0.4,"y":1},"o":{"x":0.167,"y":0.167},"t":12,"s":[{"i":[[0,0],[4.367,-3.292],[0,0],[-3.544,-3.774],[0,0],[-4.029,3.037],[0,0],[0,0],[0,0],[0,0],[-3.544,3.774],[4.212,3.175]],"o":[[-4.367,-3.292],[0,0],[-4.212,3.175],[0,0],[3.609,3.336],[0,0],[0,0],[0,0],[0,0],[4.212,3.175],[3.544,-3.774],[0,0]],"v":[[7.419,64.138],[-7.693,64.138],[-50.409,96.34],[-51.619,108.923],[-51.142,109.397],[-37.575,110.007],[-2.465,83.538],[-0.137,81.783],[2.087,83.46],[37.301,110.007],[51.345,108.923],[50.135,96.34]],"c":true}]},{"i":{"x":0.7,"y":1},"o":{"x":0.5,"y":0},"t":20,"s":[{"i":[[0,0],[6.816,-5.693],[0,0],[-5.531,-6.525],[0,0],[-6.288,5.252],[0,0],[0,0],[0,0],[0,0],[-5.531,6.525],[6.574,5.49]],"o":[[-6.816,-5.693],[0,0],[-6.574,5.49],[0,0],[5.633,5.768],[0,0],[0,0],[0,0],[0,0],[6.574,5.49],[5.531,-6.525],[0,0]],"v":[[12.326,-76.949],[-11.26,-76.949],[-77.926,-21.271],[-79.814,0.486],[-79.069,1.305],[-57.897,2.36],[-10.289,-37.402],[0.533,-46.44],[10.566,-38.06],[58.962,2.36],[80.88,0.486],[78.992,-21.271]],"c":true}]},{"i":{"x":0.7,"y":1},"o":{"x":0.3,"y":0},"t":31,"s":[{"i":[[0,0],[6.816,-5.693],[0,0],[-5.531,-6.525],[0,0],[-6.288,5.252],[0,0],[0,0],[0,0],[0,0],[-5.531,6.525],[6.574,5.49]],"o":[[-6.816,-5.693],[0,0],[-6.574,5.49],[0,0],[5.633,5.768],[0,0],[0,0],[0,0],[0,0],[6.574,5.49],[5.531,-6.525],[0,0]],"v":[[11.793,-34.206],[-11.793,-34.206],[-78.459,21.472],[-80.347,43.228],[-79.602,44.047],[-58.429,45.102],[-10.821,5.34],[0,-3.698],[10.033,4.682],[58.429,45.102],[80.347,43.228],[78.459,21.472]],"c":true}]},{"t":40,"s":[{"i":[[0,0],[6.816,-5.693],[0,0],[-5.531,-6.525],[0,0],[-6.288,5.252],[0,0],[0,0],[0,0],[0,0],[-5.531,6.525],[6.574,5.49]],"o":[[-6.816,-5.693],[0,0],[-6.574,5.49],[0,0],[5.633,5.768],[0,0],[0,0],[0,0],[0,0],[6.574,5.49],[5.531,-6.525],[0,0]],"v":[[11.793,-44.733],[-11.793,-44.733],[-78.459,10.945],[-80.347,32.702],[-79.602,33.521],[-58.429,34.576],[-10.821,-5.186],[0,-14.224],[10.033,-5.844],[58.429,34.576],[80.347,32.702],[78.459,10.945]],"c":true}]}]},"nm":"Path 2","hd":false},{"ind":2,"ty":"sh","ks":{"a":1,"k":[{"i":{"x":0.833,"y":1},"o":{"x":0.167,"y":0},"t":9,"s":[{"i":[[0,0],[3.4,-2.84],[0,0],[-2.759,-3.255],[0,0],[-3.137,2.62],[0,0],[0,0],[0,0],[0,0],[-2.759,3.255],[3.279,2.739]],"o":[[-3.4,-2.84],[0,0],[-3.279,2.739],[0,0],[2.81,2.877],[0,0],[0,0],[0,0],[0,0],[3.279,2.739],[2.759,-3.255],[0,0]],"v":[[5.684,121.125],[-6.082,121.125],[-39.339,148.901],[-40.281,159.754],[-39.91,160.162],[-29.348,160.689],[-0.656,136.726],[-0.199,136.345],[0.295,136.757],[28.949,160.689],[39.883,159.754],[38.941,148.901]],"c":true}]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.3,"y":0},"t":10,"s":[{"i":[[0,0],[2.322,-1.939],[0,0],[-1.884,-2.223],[0,0],[-2.142,1.789],[0,0],[0,0],[0,0],[0,0],[-1.884,2.223],[2.239,1.87]],"o":[[-2.322,-1.939],[0,0],[-2.239,1.87],[0,0],[1.919,1.965],[0,0],[0,0],[0,0],[0,0],[2.239,1.87],[1.884,-2.223],[0,0]],"v":[[3.927,127.398],[-4.107,127.398],[-26.815,146.364],[-27.459,153.775],[-27.205,154.053],[-19.993,154.413],[-0.402,138.051],[-0.09,137.79],[0.247,138.072],[19.813,154.413],[27.278,153.775],[26.635,146.364]],"c":true}]},{"i":{"x":0.4,"y":1},"o":{"x":0.167,"y":0.167},"t":14,"s":[{"i":[[0,0],[3.537,-2.954],[0,0],[-2.87,-3.386],[0,0],[-3.263,2.725],[0,0],[0,0],[0,0],[0,0],[-2.87,3.386],[3.411,2.849]],"o":[[-3.537,-2.954],[0,0],[-3.411,2.849],[0,0],[2.923,2.993],[0,0],[0,0],[0,0],[0,0],[3.411,2.849],[2.87,-3.386],[0,0]],"v":[[6.244,85.269],[-5.995,85.269],[-40.28,114.16],[-41.566,125.449],[-41.18,125.874],[-28.049,127.34],[-0.324,104.253],[0.151,103.857],[0.665,104.286],[27.992,127.647],[41.816,125.449],[41.755,113.853]],"c":true}]},{"i":{"x":0.7,"y":1},"o":{"x":0.5,"y":0},"t":23,"s":[{"i":[[0,0],[6.816,-5.693],[0,0],[-5.531,-6.525],[0,0],[-6.288,5.252],[0,0],[0,0],[0,0],[0,0],[-5.531,6.525],[6.574,5.49]],"o":[[-6.816,-5.693],[0,0],[-6.574,5.49],[0,0],[5.633,5.768],[0,0],[0,0],[0,0],[0,0],[6.574,5.49],[5.531,-6.525],[0,0]],"v":[[12.316,1.063],[-11.269,1.063],[-77.935,56.741],[-79.823,78.497],[-79.078,79.316],[-57.906,80.371],[-0.391,32.335],[0.524,31.571],[1.515,32.399],[58.953,80.371],[80.871,78.497],[78.983,56.741]],"c":true}]},{"i":{"x":0.7,"y":1},"o":{"x":0.3,"y":0},"t":33,"s":[{"i":[[0,0],[6.816,-5.693],[0,0],[-5.531,-6.525],[0,0],[-6.288,5.252],[0,0],[0,0],[0,0],[0,0],[-5.531,6.525],[6.574,5.49]],"o":[[-6.816,-5.693],[0,0],[-6.574,5.49],[0,0],[5.633,5.768],[0,0],[0,0],[0,0],[0,0],[6.574,5.49],[5.531,-6.525],[0,0]],"v":[[11.682,42.712],[-11.904,42.712],[-78.57,98.39],[-80.458,120.146],[-79.713,120.965],[-58.541,122.02],[-1.026,73.984],[-0.111,73.22],[0.88,74.048],[58.318,122.02],[80.236,120.146],[78.348,98.39]],"c":true}]},{"t":41,"s":[{"i":[[0,0],[6.816,-5.693],[0,0],[-5.531,-6.525],[0,0],[-6.288,5.252],[0,0],[0,0],[0,0],[0,0],[-5.531,6.525],[6.574,5.49]],"o":[[-6.816,-5.693],[0,0],[-6.574,5.49],[0,0],[5.633,5.768],[0,0],[0,0],[0,0],[0,0],[6.574,5.49],[5.531,-6.525],[0,0]],"v":[[11.793,34.665],[-11.793,34.665],[-78.459,90.343],[-80.347,112.1],[-79.602,112.919],[-58.429,113.974],[-0.915,65.938],[0,65.174],[0.991,66.001],[58.429,113.974],[80.347,112.1],[78.459,90.343]],"c":true}]}]},"nm":"Path 3","hd":false},{"ind":3,"ty":"sh","ks":{"a":1,"k":[{"i":{"x":0.71,"y":1},"o":{"x":0.29,"y":0},"t":0,"s":[{"i":[[-112.666,0],[0,-112.666],[112.666,0],[0,112.666]],"o":[[112.666,0],[0,112.666],[-112.666,0],[0,-112.666]],"v":[[0,-204],[204,0],[0,204],[-204,0]],"c":true}]},{"t":10,"s":[{"i":[[-112.666,0],[0,-112.666],[112.666,0],[0,112.666]],"o":[[112.666,0],[0,112.666],[-112.666,0],[0,-112.666]],"v":[[0,-204],[204,0],[0,204],[-204,0]],"c":true}]}]},"nm":"Path 4","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1]},"o":{"a":0,"k":100},"r":1,"bm":0,"nm":"Fill 1","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0]},"a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"r":{"a":0,"k":0},"o":{"a":0,"k":100},"sk":{"a":0,"k":0},"sa":{"a":0,"k":0},"nm":"Transform"}],"nm":"Combined-Shape","bm":0,"hd":false}],"ip":9,"op":180,"st":0,"bm":0}]} \ No newline at end of file diff --git a/TMessagesProj/src/main/res/values/strings.xml b/TMessagesProj/src/main/res/values/strings.xml index 962001c7b8..59ee072579 100644 --- a/TMessagesProj/src/main/res/values/strings.xml +++ b/TMessagesProj/src/main/res/values/strings.xml @@ -253,6 +253,7 @@ Deleted Account Select Chat Choose Bot + Choose Bots Choose User Choose Users Choose Group @@ -543,6 +544,17 @@ Channel created un1 sent you a gift for **un2** You have sent a gift for **un2** + You bought a gift for **un2** + Someone sent you a gift! + **un1** sent a gift to **un2** for %d Star + **un1** sent a gift to **un2** for %d Stars + **un1** turned the gift from you into a unique collectible + **un1** turned the gift into a unique collectible + You turned the gift from **un1** into a unique collectible + You turned the gift into a unique collectible + **un1** transferred you a gift! + **un1** transferred a gift to **un2**! + You transferred a gift to **un1** %s sent you a gift Gift %d Month Premium @@ -652,6 +664,12 @@ Logged in on this device more than **24 hours** ago. Please come back later. Set Password + Security Check + You can withdraw only if you have: + Enabled **2-Step Verification** more than **7 days** ago. + Logged in on this device more than **24 hours** ago. + Please come back later. + Set Password This will transfer the **full owner** rights for **%1$s** to **%2$s**. Change Owner **%1$s** is now the owner of the group. @@ -987,8 +1005,8 @@ un1 changed forum to group un1 created topic un2 un1 changed topic name from un2 to un3 - un1 closed topic un2 - un1 reopened topic un2 + %s closed topic un2 + %s reopened topic un2 un1 delete topic un2 un1 pin topic un2 un1 unpin topic un2 @@ -1412,6 +1430,7 @@ FAKE via Message doesn\'t exist + Gift was not found Slow Mode is enabled. You can send\nyour next message in %1$s Tap for photo, hold for video Send without sound @@ -1534,6 +1553,8 @@ %1$s: %2$s %2$s sent you a Gift worth of %1$d Star %2$s sent you a Gift worth of %1$d Stars + %1$s transferred you a Gift! + %1$s upgraded your Gift %1$s sent you %2$s %1$s sent you an album %1$s forwarded you %2$s @@ -2863,6 +2884,9 @@ No Chats Contact Non-Contact + Folder name + Enable Animations + Disable Animations Folder name Are you sure you want to delete this folder? Are you sure you want to delete this folder? This will also deactivate all the invite links used to share this folder. @@ -2950,6 +2974,7 @@ GIFs Shared Content Similar Channels + Similar Bots Share photos and videos in this chat and access them on any of your devices. Share music in this chat and access it on any of your devices. Share files and documents in this chat and access them on any of your devices. @@ -3217,6 +3242,7 @@ Back to Settings Please enter your password to complete the transfer. Please enter your password to withdraw. + Please enter your password to send **%s** to Fragment. Enter a new password Re-enter your password New Password @@ -3542,6 +3568,7 @@ Continue Create Link CROP + Crop Update app UPDATE Accept @@ -4397,6 +4424,8 @@ %1$d chats %1$d channel %1$d channels + %1$d bot + %1$d bots %1$d group %1$d groups %1$d member @@ -5257,6 +5286,7 @@ Premium Gifting Send a Gift Send a Gift + Send a Gift Activate For Free You already have Telegram Premium You can activate this gift code after %1$s or **send the link** to a friend. @@ -5998,7 +6028,7 @@ You can join **%d new chats** Tap here to view it Tap here to view them - Share Folder %s + Share Folder %1$s Share access to some of this folder’s groups and channels with others. You can create more links to set up different access levels for different people. Create Invite Link @@ -6228,6 +6258,10 @@ Story forwarded to **Saved Messages** Story forwarded to **a chat**. Story forwarded to **%1$d chats**. + Link forwarded to **Saved Messages** + Link forwarded to **%s**. + Link forwarded to **a chat**. + Link forwarded to **%1$d chats**. This story is no longer available %d story was posted %d stories were posted @@ -6395,6 +6429,7 @@ Please wait until the **Stealth Mode** is ready to use again. View Location > View Message > + Show Gift > Like Long tap for more reactions Add Reactions... @@ -6875,6 +6910,7 @@ Your channel needs to reach **Level %d** to change channel link style icon.\n\nAsk your **Premium** subscribers to boost your channel with this link: Your channel needs to reach **Level %d** to change channel profile icon.\n\nAsk your **Premium** subscribers to boost your channel with this link: Your channel needs to reach **Level %d** to set channel emoji status.\n\nAsk your **Premium** subscribers to boost your channel with this link: + Your channel needs to reach **Level %d** to wear collectibles. **Premium** users can boost your channel with this link: Your channel needs to reach **Level %d** to change channel wallpaper.\n\nAsk your **Premium** subscribers to boost your channel with this link: Your channel needs to reach **Level %d** to change channel wallpaper to custom photo.\n\nAsk your **Premium** subscribers to boost your channel with this link: Your channel needs %s to enable posting stories.\n\nAsk your **Premium** subscribers to boost your channel with this link: @@ -6888,6 +6924,7 @@ Your group needs to reach **Level %d** to change group link style icon.\n\nAsk your **Premium** members to boost your group with this link: Your group needs to reach **Level %d** to change group profile icon.\n\nAsk your **Premium** members to boost your group with this link: Your group needs to reach **Level %d** to set group emoji status.\n\nAsk your **Premium** members to boost your group with this link: + Your group needs to reach **Level %d** to wear collectibles. **Premium** users can boost your group with this link: Your group needs to reach **Level %d** to set group emoji pack.\n\nAsk your **Premium** members to boost your group with this link: Your group needs to reach **Level %d** to change group wallpaper.\n\nAsk your **Premium** members to boost your group with this link: Your group needs to reach **Level %d** to change group wallpaper to custom photo.\n\nAsk your **Premium** members to boost your group with this link: @@ -6910,6 +6947,7 @@ Unlock Colors Unlock Profile Colors Unlock Emoji Status + Wear Item Unlock Group Emoji Pack Unlock Wallpaper Unlock Link Icons @@ -6959,6 +6997,7 @@ Link Preview Your selected color will also tint the link preview. Apply Color and Icon + Wear Collectible Add Icons to Replies Add Icons to Profile Choose a color and an icon for your profile @@ -7012,6 +7051,7 @@ Your channel profile emoji has been put! Copy Code Similar Channels + Similar Bots Apply for Me Apply for Me and %s Apply for %s @@ -7038,6 +7078,8 @@ Unlock more channels Show More Channels Subscribe to **Telegram Premium**\nto unlock up to %s similar channels. + Show More Apps + Subscribe to **Telegram Premium**\nto unlock up to %s similar apps. commented Level %d Level %d+ @@ -7091,6 +7133,8 @@ Read More Message reposted to your profile. Message reposted to **%s**. + Gift is reposted to your profile. + Gift is reposted to **%s**. Select Wallpaper Saved Chats @@ -7618,6 +7662,7 @@ Channels VIEW STICKERS VIEW EMOJI + VIEW COLLECTIBLE Story pinned %d stories pinned Story unpinned. @@ -7763,6 +7808,9 @@ Buy **Stars** to keep your subscription for **%s**. Buy **Stars** to send paid reactions to **%s** and other channels. Buy **Stars** to send gifts to **%s** and other contacts. + Buy **Stars** to send gifts to **%s** and other channels. + Buy **Stars** to upgrade your gifts. + Buy **Stars** to transfer your gifts. Buy **Stars** to keep your channel subscriptions. Buy **Stars** to keep your channel subscriptions. Buy **Stars** to keep your subscriptions active for the next 12 months. @@ -7791,7 +7839,8 @@ Fragment From Transaction ID - Transaction ID copied to clipboard + Transaction ID is copied to clipboard + Wallet address is copied to clipboard Date Messages %d @@ -8122,6 +8171,7 @@ You reacted with **%d** stars. Undo Star Reaction + Star Reaction Choose how many stars you want to send to **%s** to support this post. You sent **%1$d** Star to support this post. You sent **%1$d** Stars to support this post. @@ -8151,6 +8201,13 @@ Referred User Reason Affiliate Program + Reason + Gift Upgraded + view + Gift Transferred + Gift From + Gift Transfer + Refunded Gift Transfer Monthly subscription fee My subscriptions Show More @@ -8180,28 +8237,59 @@ See Features > Gift Stars Give **%s** gifts that can be kept on the profile or converted to Stars. + Buy a gift + Buy yourself a gift to display on your page or reserve for later. + Limited-edition gifts upgraded to collectibles can be gifted to others later. + Send a Gift + Select a gift to show appreciation for **%s**. + Upgrade this gift for free to turn it into a unique collectible. + %s can turn this gift into a unique collectible. What are Stars > Send a Gift + Buy a Gift + Gift to Myself Enter Message Enter Message (Optional) Only %s will see your message. Hide My Name You can hide your name and message from visitors to %1$s`s profile. %1$s will still see your name and message. + You can hide your name and message from all visitors of this channel except its admins. + Hide My Name + Hide my name and message from visitors to my profile + Make Unique for ⭐️%d + Enable this to let %s turn your gift into a unique collectible. **Learn More >** + Enable this to let the admins of %s to turn your gift into a unique collectible. **Learn More >** + Make Unique for ⭐️%d + Enable this to turn your gift into a unique collectible. **Learn More >** Send a Gift for ⭐️%d Send a Gift for ⭐️%d Send a Gift for %s + Buy a Gift for ⭐️%d + Buy a Gift for ⭐️%d Gift from + Saved Gift %s received a gift! You received a gift! + This gift cannot be converted to Stars because the payment related to it was refunded. + This gift was downgraded because a request to refund the payment related to this gift was made, and the money was returned. Display this gift on your page or convert it to %d Star. Display this gift on your page or convert it to %d Stars. + Display this gift in channel\'s Gifts or convert it to **%d** Star. + Display this gift in channel\'s Gifts or convert it to **%d** Stars. + Display this gift in channel\'s Gifts. You can display this gift on your page. You kept this gift on your page. This gift is now visible on your page. You converted this gift to %d Star. You converted this gift to %d Stars. + Display this gift on your page or convert it to %1$d Star. + Display this gift on your page or convert it to %1$d Stars. + Display this gift on your page. + You can display this gift on your page or turn it into a unique collectible and send to others. **%2$s** can display this gift on their page or convert it to %1$d Star. **%2$s** can display this gift on their page or convert it to %1$d Stars. + **%s** can display this gift on their page. + **%s** can display this gift on their page or convert it to unique collectible. %d Star %d Stars Gifts @@ -8209,7 +8297,9 @@ %d gift %d gifts Send Gifts to Friends + Send Gifts to Channel All Gifts + In Stock Limited limited Limited @@ -8217,27 +8307,48 @@ Gift sent! You spent **%1$d** Star from your balance. You spent **%1$d** Stars from your balance. + You sent a gift to **%2$s** for **%1$d** Star. + You sent a gift to **%2$s** for **%1$d** Stars. + Send Gift + Tap here to send gift Sent Gift Gift Received Gift + Saved Gift + Gift Premium - You can keep this gift in your Profile or convert it to **%1$d** Star within **%2$s**. - You can keep this gift in your Profile or convert it to **%1$d** Stars within **%2$s**. + %2$s can keep this gift in their Profile or convert it to **%1$d** Star. + %2$s can keep this gift in their Profile or convert it to **%1$d** Stars. + %1$s can keep this gift in their Profile or upgrade to unique collectible. + %1$s can keep this gift in their Profile. + You can keep this gift in your Profile or convert it to **%1$d** Star. + You can keep this gift in your Profile or convert it to **%1$d** Stars. + Your channel can keep this gift in channel\'s Gifts or convert it to **%1$d** Star. + Your channel can keep this gift in channel\'s Gifts or convert it to **%1$d** Stars. You can keep this %d Star gift in your Profile. You can keep this %d Stars gift in your Profile. + Your channel can keep this %d Star gift in channel\'s Gifts. + Your channel can keep this %d Stars gift in channel\'s Gifts. You can remove this gift from your Profile. You can keep this gift in your Profile. + Your channel can hide this gift from channel\'s Gifts. + Your channel can keep this gift in channel\'s Gifts. + You can remove this gift from your Profile or upgrade to unique collectible. + You can keep this gift in your Profile or upgrade to unique collectible. %2$s can keep this gift in profile or convert it to **%1$d** Star. %2$s can keep this gift in profile or convert it to **%1$d** Stars. You converted this gift to **%d** Star. You converted this gift to **%d** Stars. + Your channel converted this gift to **%d** Star. + Your channel converted this gift to **%d** Stars. %2$s converted this gift to **%d** Star. %2$s converted this gift to **%d** Stars. %1$s kept this gift in your Profile. Only you can see the senderʼs name and message. - This gift is visible to visitors of your page. - This gift is visible to visitors of your page. **View >** - This gift is hidden. Only you can see it. + This gift is visible on your page. **Hide >** + This gift is hidden from your page. **Show >** + This gift is visible in your channel\'s Gifts. **Hide >** + This gift is hidden from visitors of your channel. **Show >** **More about Stars >** From To @@ -8247,6 +8358,11 @@ Not visible on your page show Availability + Quantity + %d/ + %d issued + None of %d left + None of %d left %1$d of %2$s left %1$d of %2$s left None of %1$d left @@ -8277,9 +8393,15 @@ Gift is now visible in **your profile**. Gift Hidden Gift is now hidden in **your profile**. + Gift Shown + Gift is now visible in in your channel\'s Gifts. + Gift Hidden + Gift is now hidden from visitors of your channel. Converted Gift %d Star was sent to your balance - %d Star were sent to your balance + %d Stars were sent to your balance + %d Star was sent to channel\'s balance + %d Stars were sent to channel\'s balance Sold Out! All %d gifts were already sold. All %d gifts were already sold. @@ -8295,11 +8417,15 @@ Send Report Telegram moderators will review your report. Thank you! Refunded Sent Gift + Refunded Gift Upgrade Refunded Converted Gift Converted Gift Gift + Collectible Upgrade sent a Gift worth of %d Star sent a Gift worth of %d Stars + sent a Unique Gift! + upgraded your Gift your balance Buy Stars Buy More Stars @@ -8511,4 +8637,151 @@ Move caption down Caption moved down Caption will be shown below the media + Add your photo! 📸 + Help your friends spot you easily. + Send Another Gift + Send Gift to %s + All Chats + Private Chats + Group Chats + Channels + From all chats + From private chats + From groups + From channels + No results + There were no results for \"%s\".\nTry a new search. + Search in All Messages + Verify Accounts + Choose Chat To Verify + Verify User + Verify Bot + Verify Channel + Verify Group + Do you want to verify **%s** with your verification mark and description? + Description + You can customize your description for each account. + You can customize your description for each chat. + Remove verification + This account is already verified by you.\nDo you want to revoke verification? + This chat is already verified by you.\nDo you want to revoke verification? + **%s** has been notified and will receive your verification mark and description upon accepting. + **%s**\'s verification has been revoked. + This page is verified by the %1$s + This community is verified as official by the representatives of %s. + Status + Non-Unique + upgrade + Upgrade Gift + Turn your gift into a unique collectible that you can transfer or auction. + Unique + Get a unique number, model, backdrop and a symbol for your gift. + The recipient will get a unique number, model, backdrop, and symbol for the gift. + Transferable + Send your upgraded gift to any of your friends on Telegram. + The recipient will be able to send the gift to anyone on Telegram. + Tradable + SOON + Sell or auction your gift on third-party NFT marketplaces. + The recipient will be able to auction the gift on third-party NFT marketplaces. + Wear %s + and get these benefits + Radiant Badge + The glittering icon of this item will be displayed next to your name. + Unique Profile Design + Your profile page will get the color and the symbol of this item. + Proof of Ownership + Tapping the icon of this item next to your name will show its info and owner. + Start Wearing + Transfer + Wear + Take Off + You put on **%s** + You took off **%s** + Share + Subscribe to **Telegram Premium** to wear collectibles. + Make Unique + Let %s turn your gift into a unique collectible. + Upgrade for ⭐️%d + Upgrade for Free + Add sender\'s name to the gift + Add sender\'s name and comment + Add my name to the gift + Add channel\'s name to the gift + Notify About New Gifts + You will receive a message from Telegram when your channel receives a gift. + You will not receive a message from Telegram when your channel receives a gift. + Not Available + This channel can\'t receive any star gifts. + Collectible #%d + Collectible #%d + Owner + transfer + Model + Backdrop + Symbol + Unique + Gifted by %1$s to %2$s on %3$s. + Gifted by %1$s to %2$s on %3$s with the comment: “%4$s” + Gifted saved by %1$s on %2$s. + Gifted by %1$s on %2$s with the comment: “%3$s” + Gifted to %1$s on %2$s. + Gifted to %1$s on %2$s with the comment: “%3$s” + Transfer %s + Do you want to transfer ownership of **%1$s** to **%2$s**? + Do you want to transfer ownership of **%2$s** to **%3$s** for **%1$d Star**? + Do you want to transfer ownership of **%2$s** to **%3$s** for **%1$d Stars**? + Transfer + Transfer for ⭐️%d + Gift Upgraded + Your gift **%s** now has unique attributes and can be transferred to others. + Gift from %s + Gift + View + Unpack + gift + Send via Blockchain + unlocks in %d day + unlocks in %d days + Unlocking in progress + In %d day, youll be able to send this collectible to any TON blockchain address outside Telegram for sale or auction. + In %d days, youll be able to send this collectible to any TON blockchain address outside Telegram for sale or auction. + Update required + Please update your Telegram application to the latest version. + Manage with Fragment + You can use Fragment, a third-party service, to transfer **%s** to your TON account. After that, you can manage it as an NFT with any TON wallet outside Telegram.\n\nYou can also move such NFTs back to your Telegram account via Fragment. + Open Fragment + Only %s of such collectibles have this attribute + This gift was downgraded because a request to refund the payment related to this gift was made, and the money was returned. + This is You + buy yourself a gift + Gift Transferred + You have successfully transferred **%1$s** to **%2$s**. + You can display this gift on your page or turn it into a unique collectible and send to others. + Display this gift on your page or convert it to **%d Star**. + Display this gift on your page or convert it to **%d Stars**. + You converted this gift to **%d Star**. + You converted this gift to **%d Stars**. + You can display this gift on your page. + Tap “Unpack” to turn this gift into a unique collectible. + %s can turn this gift into a unique collectible. + Transfer + View in Profile + Sound is now muted, so the video will play and loop like a GIF. + Your profile photo is uploading... + Your profile video is uploading... + Your profile photo is now set. + Your profile video is now set. + Sort By Date + Sort By Value + Unlimited + Limited + Unique + Displayed + Hidden + Use a gift + Apply your collectible\'s unique look to your profile. + Start at %s + Starts at %s + This gift is in TON Blockchain. **View >** \ No newline at end of file diff --git a/TMessagesProj_AppStandalone/src/main/java/org/telegram/messenger/SMSJobController.java b/TMessagesProj_AppStandalone/src/main/java/org/telegram/messenger/SMSJobController.java index fa9302567c..7fbc00f4cf 100644 --- a/TMessagesProj_AppStandalone/src/main/java/org/telegram/messenger/SMSJobController.java +++ b/TMessagesProj_AppStandalone/src/main/java/org/telegram/messenger/SMSJobController.java @@ -31,6 +31,8 @@ import org.telegram.messenger.web.R; import org.telegram.tgnet.AbstractSerializedData; import org.telegram.tgnet.ConnectionsManager; +import org.telegram.tgnet.InputSerializedData; +import org.telegram.tgnet.OutputSerializedData; import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TL_smsjobs; @@ -441,7 +443,7 @@ public void whenDelivered(boolean success, String reason) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(0x8384213); stream.writeInt32(id); stream.writeInt32(currentAccount); @@ -459,7 +461,7 @@ public void serializeToStream(AbstractSerializedData stream) { } @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { id = stream.readInt32(exception); currentAccount = stream.readInt32(exception); jobId = stream.readString(exception); diff --git a/TMessagesProj_AppStandalone/src/main/java/org/telegram/tgnet/TL_smsjobs.java b/TMessagesProj_AppStandalone/src/main/java/org/telegram/tgnet/TL_smsjobs.java index fe87a80a23..a845e6fe9a 100644 --- a/TMessagesProj_AppStandalone/src/main/java/org/telegram/tgnet/TL_smsjobs.java +++ b/TMessagesProj_AppStandalone/src/main/java/org/telegram/tgnet/TL_smsjobs.java @@ -9,13 +9,13 @@ public static class TL_smsjobs_eligibleToJoin extends TLObject { public int monthly_sent_sms; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { terms_of_use = stream.readString(exception); monthly_sent_sms = stream.readInt32(exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(terms_of_use); stream.writeInt32(monthly_sent_sms); @@ -36,7 +36,7 @@ public static class TL_smsjobs_status extends TLObject { public String terms_url; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { flags = stream.readInt32(exception); allow_international = (flags & 1) != 0; recent_sent = stream.readInt32(exception); @@ -51,7 +51,7 @@ public void readParams(AbstractSerializedData stream, boolean exception) { } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = allow_international ? flags | 1 : flags &~ 1; stream.writeInt32(flags); @@ -72,12 +72,12 @@ public static class TL_updateSmsJob extends TLRPC.Update { public String job_id; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { job_id = stream.readString(exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(job_id); } @@ -91,14 +91,14 @@ public static class TL_smsJob extends TLObject { public String text; @Override - public void readParams(AbstractSerializedData stream, boolean exception) { + public void readParams(InputSerializedData stream, boolean exception) { job_id = stream.readString(exception); phone_number = stream.readString(exception); text = stream.readString(exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(job_id); stream.writeString(phone_number); @@ -110,7 +110,7 @@ public static class TL_smsjobs_isEligibleToJoin extends TLObject { public static final int constructor = 0xedc39d0; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { if (constructor == TL_smsjobs_eligibleToJoin.constructor) { TL_smsjobs_eligibleToJoin result = new TL_smsjobs_eligibleToJoin(); result.readParams(stream, exception); @@ -120,7 +120,7 @@ public TLObject deserializeResponse(AbstractSerializedData stream, int construct } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -129,12 +129,12 @@ public static class TL_smsjobs_join extends TLObject { public static final int constructor = 0xa74ece2d; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -143,12 +143,12 @@ public static class TL_smsjobs_leave extends TLObject { public static final int constructor = 0x9898ad73; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -157,7 +157,7 @@ public static class TL_smsjobs_getStatus extends TLObject { public static final int constructor = 0x10a698e8; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { if (constructor == TL_smsjobs_status.constructor) { TL_smsjobs_status result = new TL_smsjobs_status(); result.readParams(stream, exception); @@ -167,7 +167,7 @@ public TLObject deserializeResponse(AbstractSerializedData stream, int construct } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); } } @@ -178,7 +178,7 @@ public static class TL_smsjobs_getSmsJob extends TLObject { public String job_id; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { if (constructor == TL_smsJob.constructor) { TL_smsJob result = new TL_smsJob(); result.readParams(stream, exception); @@ -188,7 +188,7 @@ public TLObject deserializeResponse(AbstractSerializedData stream, int construct } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeString(job_id); } @@ -202,12 +202,12 @@ public static class TL_smsjobs_finishJob extends TLObject { public String error; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); stream.writeInt32(flags); stream.writeString(job_id); @@ -224,12 +224,12 @@ public static class TL_smsjobs_updateSettings extends TLObject { public boolean allow_international; @Override - public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) { + public TLObject deserializeResponse(InputSerializedData stream, int constructor, boolean exception) { return TLRPC.Bool.TLdeserialize(stream, constructor, exception); } @Override - public void serializeToStream(AbstractSerializedData stream) { + public void serializeToStream(OutputSerializedData stream) { stream.writeInt32(constructor); flags = allow_international ? flags | 1 : flags &~ 1; stream.writeInt32(flags); diff --git a/gradle.properties b/gradle.properties index 205cd42176..0ddaf85c30 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,8 +13,8 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true #Sat Mar 12 05:53:50 MSK 2016 -APP_VERSION_CODE=5511 -APP_VERSION_NAME=11.5.3 +APP_VERSION_CODE=5663 +APP_VERSION_NAME=11.7.0 APP_PACKAGE=org.telegram.messenger IS_PRIVATE=false RELEASE_KEY_PASSWORD=android From 60249655e1bded1b9e7ffb45c04fad37b7e6bd65 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Mon, 27 Jan 2025 11:14:07 +0800 Subject: [PATCH 4/5] release: bump version --- TMessagesProj/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 0b3020b023..21e36e5b2d 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -15,7 +15,7 @@ repositories { } def verName = APP_VERSION_NAME -def verCode = 1202 +def verCode = 1203 def officialVer = APP_VERSION_NAME From dad6d902e144edfb7b7a54922ea54d6e8d4bb23a Mon Sep 17 00:00:00 2001 From: xtaodada Date: Mon, 27 Jan 2025 21:42:25 +0800 Subject: [PATCH 5/5] fix: folder create activity --- TMessagesProj/build.gradle | 4 ++-- .../telegram/ui/Cells/EditEmojiTextCell.java | 23 +++++++++++++++++++ .../telegram/ui/Cells/PollEditTextCell.java | 22 ------------------ .../org/telegram/ui/FilterCreateActivity.java | 13 ++++++----- 4 files changed, 32 insertions(+), 30 deletions(-) diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 21e36e5b2d..eaed61362b 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -15,7 +15,7 @@ repositories { } def verName = APP_VERSION_NAME -def verCode = 1203 +def verCode = 1204 def officialVer = APP_VERSION_NAME @@ -371,7 +371,7 @@ android { task.enabled = false } else if (task.name.endsWith("GoogleServices") && task.name.contains("NoGcm")) { task.enabled = false - } else if (task.name.contains("buildCMakeDebug") && nagram_build_args.contains("skip_buildCMakeDebug")) { + } else if (task.name.contains("buildCMakeDebug") && nagram_build_args != null && nagram_build_args.contains("skip_buildCMakeDebug")) { task.enabled = false } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/EditEmojiTextCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/EditEmojiTextCell.java index 5210d54d68..e5c8397101 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/EditEmojiTextCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/EditEmojiTextCell.java @@ -6,6 +6,8 @@ import android.content.Context; import android.graphics.Canvas; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; import android.graphics.drawable.Drawable; import android.os.Build; import android.text.Editable; @@ -57,6 +59,8 @@ public class EditEmojiTextCell extends FrameLayout { private boolean allowEntities = true; + private ImageView iconImageView; + final AnimatedColor limitColor; private int limitCount; final AnimatedTextView.AnimatedTextDrawable limit = new AnimatedTextView.AnimatedTextDrawable(false, true, true); { @@ -269,6 +273,22 @@ public void onFocusChange(View v, boolean hasFocus) { updateLimitText(); } + public void setOnChangeIcon(Context context, OnClickListener onChangeIcon) { + editTextEmoji.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, LocaleController.isRTL ? 19 : 40, 0, !LocaleController.isRTL ? 19 : 40, 0)); + iconImageView = new ImageView(context); + iconImageView.setFocusable(true); + iconImageView.setBackground(Theme.createSelectorDrawable(Theme.getColor(Theme.key_stickers_menuSelector))); + iconImageView.setScaleType(ImageView.ScaleType.CENTER); + iconImageView.setOnClickListener(onChangeIcon); + iconImageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteGrayIcon), PorterDuff.Mode.MULTIPLY)); + iconImageView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); + addView(iconImageView, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 8, 2, 8, 0)); + } + + public void setIcon(int icon, String name) { + iconImageView.setImageResource(icon); + } + public void setText(CharSequence text) { ignoreEditText = true; editTextEmoji.setText(text); @@ -313,6 +333,9 @@ protected void onDraw(Canvas canvas) { @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + if (iconImageView != null) { + iconImageView.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(48), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(48), MeasureSpec.EXACTLY)); + } super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), heightMeasureSpec); } } \ No newline at end of file diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/PollEditTextCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/PollEditTextCell.java index 22ad4c531e..b55ebe4dfe 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/PollEditTextCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/PollEditTextCell.java @@ -59,7 +59,6 @@ public class PollEditTextCell extends FrameLayout implements SuggestEmojiView.An private EditTextBoldCursor textView; private ImageView deleteImageView; private ImageView moveImageView; - private ImageView iconImageView; private SimpleTextView textView2; private CheckBox2 checkBox; private boolean showNextButton; @@ -74,10 +73,6 @@ public PollEditTextCell(Context context, OnClickListener onDelete) { } public PollEditTextCell(Context context, boolean caption, int type, OnClickListener onDelete) { - this(context, caption, type, onDelete, null); - } - - public PollEditTextCell(Context context, boolean caption, int type, OnClickListener onDelete, OnClickListener onChangeIcon) { super(context); textView = new EditTextCaption(context, null) { @@ -183,16 +178,6 @@ public ActionMode startActionMode(ActionMode.Callback callback) { } onCheckBoxClick(PollEditTextCell.this, !checkBox.isChecked()); }); - } else if (onChangeIcon != null) { - addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, LocaleController.isRTL ? 19 : 66, 0, !LocaleController.isRTL ? 19 : 66, 0)); - iconImageView = new ImageView(context); - iconImageView.setFocusable(true); - iconImageView.setBackground(Theme.createSelectorDrawable(Theme.getColor(Theme.key_stickers_menuSelector))); - iconImageView.setScaleType(ImageView.ScaleType.CENTER); - iconImageView.setOnClickListener(onChangeIcon); - iconImageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteGrayIcon), PorterDuff.Mode.MULTIPLY)); - iconImageView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); - addView(iconImageView, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 8, 2, 8, 0)); } else { int endMargin = type == TYPE_EMOJI ? 80: 19; addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, LocaleController.isRTL ? endMargin : 19, 0, LocaleController.isRTL ? 19 : endMargin, 0)); @@ -218,10 +203,6 @@ public ActionMode startActionMode(ActionMode.Callback callback) { } } - public void setIcon(int icon, String name) { - iconImageView.setImageResource(icon); - } - protected void onEditTextFocusChanged(boolean focused) { } @@ -246,9 +227,6 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (moveImageView != null) { moveImageView.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(48), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(48), MeasureSpec.EXACTLY)); } - if (iconImageView != null) { - iconImageView.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(48), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(48), MeasureSpec.EXACTLY)); - } if (textView2 != null) { textView2.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(48), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(24), MeasureSpec.EXACTLY)); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/FilterCreateActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/FilterCreateActivity.java index caad81424b..43a2797f77 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/FilterCreateActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/FilterCreateActivity.java @@ -1474,6 +1474,12 @@ public int emojiCacheType() { return AnimatedEmojiDrawable.CACHE_TYPE_TOGGLEABLE_EDIT; } }; + cell.setOnChangeIcon(mContext, view1 -> IconSelectorAlert.show(FilterCreateActivity.this, (emoticon) -> { + newFilterEmoticon = emoticon; + ((EditEmojiTextCell) view1.getParent()).setIcon(FolderIconHelper.getTabIcon(newFilterEmoticon), newFilterEmoticon); + checkDoneButton(true); + })); + cell.setIcon(FolderIconHelper.getTabIcon(newFilterEmoticon), newFilterEmoticon); cell.setAllowEntities(false); cell.editTextEmoji.getEditText().setEmojiColor(getThemedColor(Theme.key_featuredStickers_addButton)); cell.editTextEmoji.setEmojiViewCacheType(AnimatedEmojiDrawable.CACHE_TYPE_TOGGLEABLE_EDIT); @@ -1670,11 +1676,6 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { createLinkCell.setDivider(divider); break; } - case VIEW_TYPE_EDIT: { - PollEditTextCell cell = (PollEditTextCell) holder.itemView; - cell.setIcon(FolderIconHelper.getTabIcon(newFilterEmoticon), newFilterEmoticon); - break; - } case VIEW_TYPE_HEADER_COLOR_PREVIEW: { folderTagsHeader = (HeaderCellColorPreview) holder.itemView; folderTagsHeader.setPreviewText(AnimatedEmojiSpan.cloneSpans(newFilterName, -1, folderTagsHeader.getPreviewTextPaint().getFontMetricsInt(), .5f), false); @@ -2845,7 +2846,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { rightTextView.setGravity(LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT); rightTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueHeader, resourcesProvider)); rightTextView.setTextSize(dpf2(15)); - addView(rightTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 18, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, 22, 17, 22, 0)); + addView(rightTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 18, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, 22, -20, 22, 0)); ScaleStateListAnimator.apply(rightTextView, 0.04f, 1.2f); } }