diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle
index d9d7d786a..f4d41d8cd 100644
--- a/TMessagesProj/build.gradle
+++ b/TMessagesProj/build.gradle
@@ -42,10 +42,9 @@ dependencies {
implementation 'com.googlecode.mp4parser:isoparser:1.0.6'
implementation 'com.stripe:stripe-android:2.0.2'
implementation 'com.google.mlkit:language-id:16.1.1'
- implementation 'com.android.billingclient:billing:5.1.0'
+ implementation 'com.android.billingclient:billing:6.0.1'
implementation 'com.google.code.gson:gson:2.10'
implementation 'com.google.guava:guava:31.1-android'
- implementation 'com.airbnb.android:lottie:6.4.0'
implementation 'com.google.android.play:integrity:1.3.0'
implementation 'com.google.android.gms:play-services-safetynet:18.0.1'
@@ -217,7 +216,9 @@ apply plugin: 'com.google.gms.google-services'
task checkVisibility {
doFirst {
- def isPrivateBuild = project.gradle.startParameter.taskNames.find { it.contains("HA_private") }
+ def isPrivateBuild = project.gradle.startParameter.taskNames.find {
+ it.contains("HA_private") || it.contains("Debug") || it.contains("Release")
+ }
def isPublicAllowed = !project.hasProperty("IS_PRIVATE") || !project.property("IS_PRIVATE").toBoolean()
if (!isPrivateBuild && !isPublicAllowed) {
throw new GradleException("Building public version of private code!")
diff --git a/TMessagesProj/jni/CMakeLists.txt b/TMessagesProj/jni/CMakeLists.txt
index 5f15aa626..3eb875975 100644
--- a/TMessagesProj/jni/CMakeLists.txt
+++ b/TMessagesProj/jni/CMakeLists.txt
@@ -268,6 +268,7 @@ elseif(${ANDROID_ABI} STREQUAL "arm64-v8a")
rlottie/src/vector/pixman/pixman-arma64-neon-asm.S)
endif()
+
#flac
add_library(flac STATIC
exoplayer/libFLAC/bitmath.c
@@ -447,7 +448,8 @@ add_library(${NATIVE_LIB} SHARED
exoplayer/ffmpeg_jni.cc
fast-edge.cpp
genann.c
- secureid_ocr.cpp)
+ secureid_ocr.cpp
+)
target_compile_options(${NATIVE_LIB} PUBLIC
-ffast-math -Os -funroll-loops -ffast-math -fno-strict-aliasing -fno-math-errno)
diff --git a/TMessagesProj/jni/ffmpeg/arm64-v8a/libavcodec.a b/TMessagesProj/jni/ffmpeg/arm64-v8a/libavcodec.a
index ef59f86ab..3e86a329d 100644
Binary files a/TMessagesProj/jni/ffmpeg/arm64-v8a/libavcodec.a and b/TMessagesProj/jni/ffmpeg/arm64-v8a/libavcodec.a differ
diff --git a/TMessagesProj/jni/ffmpeg/arm64-v8a/libavformat.a b/TMessagesProj/jni/ffmpeg/arm64-v8a/libavformat.a
index bb75ab74e..4bd6439a4 100644
Binary files a/TMessagesProj/jni/ffmpeg/arm64-v8a/libavformat.a and b/TMessagesProj/jni/ffmpeg/arm64-v8a/libavformat.a differ
diff --git a/TMessagesProj/jni/ffmpeg/arm64-v8a/libavresample.a b/TMessagesProj/jni/ffmpeg/arm64-v8a/libavresample.a
index a5d4c2b77..591f2207b 100644
Binary files a/TMessagesProj/jni/ffmpeg/arm64-v8a/libavresample.a and b/TMessagesProj/jni/ffmpeg/arm64-v8a/libavresample.a differ
diff --git a/TMessagesProj/jni/ffmpeg/arm64-v8a/libavutil.a b/TMessagesProj/jni/ffmpeg/arm64-v8a/libavutil.a
index cf6697a67..6b3846183 100644
Binary files a/TMessagesProj/jni/ffmpeg/arm64-v8a/libavutil.a and b/TMessagesProj/jni/ffmpeg/arm64-v8a/libavutil.a differ
diff --git a/TMessagesProj/jni/ffmpeg/arm64-v8a/libswresample.a b/TMessagesProj/jni/ffmpeg/arm64-v8a/libswresample.a
index 7675775e3..69efdf612 100644
Binary files a/TMessagesProj/jni/ffmpeg/arm64-v8a/libswresample.a and b/TMessagesProj/jni/ffmpeg/arm64-v8a/libswresample.a differ
diff --git a/TMessagesProj/jni/ffmpeg/arm64-v8a/libswscale.a b/TMessagesProj/jni/ffmpeg/arm64-v8a/libswscale.a
index 2732e67fc..9f0c6d211 100644
Binary files a/TMessagesProj/jni/ffmpeg/arm64-v8a/libswscale.a and b/TMessagesProj/jni/ffmpeg/arm64-v8a/libswscale.a differ
diff --git a/TMessagesProj/jni/ffmpeg/arm64-v8a/libvpx.a b/TMessagesProj/jni/ffmpeg/arm64-v8a/libvpx.a
index 32f07ddd9..0d8886b8b 100644
Binary files a/TMessagesProj/jni/ffmpeg/arm64-v8a/libvpx.a and b/TMessagesProj/jni/ffmpeg/arm64-v8a/libvpx.a differ
diff --git a/TMessagesProj/jni/ffmpeg/armeabi-v7a/libavcodec.a b/TMessagesProj/jni/ffmpeg/armeabi-v7a/libavcodec.a
index 5f8dd2c62..4d4a94856 100644
Binary files a/TMessagesProj/jni/ffmpeg/armeabi-v7a/libavcodec.a and b/TMessagesProj/jni/ffmpeg/armeabi-v7a/libavcodec.a differ
diff --git a/TMessagesProj/jni/ffmpeg/armeabi-v7a/libavformat.a b/TMessagesProj/jni/ffmpeg/armeabi-v7a/libavformat.a
index bbd38c511..c43fffeaa 100644
Binary files a/TMessagesProj/jni/ffmpeg/armeabi-v7a/libavformat.a and b/TMessagesProj/jni/ffmpeg/armeabi-v7a/libavformat.a differ
diff --git a/TMessagesProj/jni/ffmpeg/armeabi-v7a/libavresample.a b/TMessagesProj/jni/ffmpeg/armeabi-v7a/libavresample.a
index 677df6492..a4816891d 100644
Binary files a/TMessagesProj/jni/ffmpeg/armeabi-v7a/libavresample.a and b/TMessagesProj/jni/ffmpeg/armeabi-v7a/libavresample.a differ
diff --git a/TMessagesProj/jni/ffmpeg/armeabi-v7a/libavutil.a b/TMessagesProj/jni/ffmpeg/armeabi-v7a/libavutil.a
index f7a03fba4..5dde31d83 100644
Binary files a/TMessagesProj/jni/ffmpeg/armeabi-v7a/libavutil.a and b/TMessagesProj/jni/ffmpeg/armeabi-v7a/libavutil.a differ
diff --git a/TMessagesProj/jni/ffmpeg/armeabi-v7a/libswresample.a b/TMessagesProj/jni/ffmpeg/armeabi-v7a/libswresample.a
index 90e94947f..fb86241f9 100644
Binary files a/TMessagesProj/jni/ffmpeg/armeabi-v7a/libswresample.a and b/TMessagesProj/jni/ffmpeg/armeabi-v7a/libswresample.a differ
diff --git a/TMessagesProj/jni/ffmpeg/armeabi-v7a/libswscale.a b/TMessagesProj/jni/ffmpeg/armeabi-v7a/libswscale.a
index e740c3634..f35501bca 100644
Binary files a/TMessagesProj/jni/ffmpeg/armeabi-v7a/libswscale.a and b/TMessagesProj/jni/ffmpeg/armeabi-v7a/libswscale.a differ
diff --git a/TMessagesProj/jni/ffmpeg/armeabi-v7a/libvpx.a b/TMessagesProj/jni/ffmpeg/armeabi-v7a/libvpx.a
index ca37d5906..a6d9ffcaa 100644
Binary files a/TMessagesProj/jni/ffmpeg/armeabi-v7a/libvpx.a and b/TMessagesProj/jni/ffmpeg/armeabi-v7a/libvpx.a differ
diff --git a/TMessagesProj/jni/ffmpeg/x86/libavcodec.a b/TMessagesProj/jni/ffmpeg/x86/libavcodec.a
index 4eddf5040..002a567a9 100644
Binary files a/TMessagesProj/jni/ffmpeg/x86/libavcodec.a and b/TMessagesProj/jni/ffmpeg/x86/libavcodec.a differ
diff --git a/TMessagesProj/jni/ffmpeg/x86/libavformat.a b/TMessagesProj/jni/ffmpeg/x86/libavformat.a
index a6743018d..00c5ac2ef 100644
Binary files a/TMessagesProj/jni/ffmpeg/x86/libavformat.a and b/TMessagesProj/jni/ffmpeg/x86/libavformat.a differ
diff --git a/TMessagesProj/jni/ffmpeg/x86/libavresample.a b/TMessagesProj/jni/ffmpeg/x86/libavresample.a
index 5c8bc6263..81563020c 100644
Binary files a/TMessagesProj/jni/ffmpeg/x86/libavresample.a and b/TMessagesProj/jni/ffmpeg/x86/libavresample.a differ
diff --git a/TMessagesProj/jni/ffmpeg/x86/libavutil.a b/TMessagesProj/jni/ffmpeg/x86/libavutil.a
index 0b72b4145..f03fd350b 100644
Binary files a/TMessagesProj/jni/ffmpeg/x86/libavutil.a and b/TMessagesProj/jni/ffmpeg/x86/libavutil.a differ
diff --git a/TMessagesProj/jni/ffmpeg/x86/libswresample.a b/TMessagesProj/jni/ffmpeg/x86/libswresample.a
index 45ee7954d..00a5203be 100644
Binary files a/TMessagesProj/jni/ffmpeg/x86/libswresample.a and b/TMessagesProj/jni/ffmpeg/x86/libswresample.a differ
diff --git a/TMessagesProj/jni/ffmpeg/x86/libswscale.a b/TMessagesProj/jni/ffmpeg/x86/libswscale.a
index efdf8fce0..fb56c176c 100644
Binary files a/TMessagesProj/jni/ffmpeg/x86/libswscale.a and b/TMessagesProj/jni/ffmpeg/x86/libswscale.a differ
diff --git a/TMessagesProj/jni/ffmpeg/x86/libvpx.a b/TMessagesProj/jni/ffmpeg/x86/libvpx.a
index 865f97cbc..de3c1db95 100644
Binary files a/TMessagesProj/jni/ffmpeg/x86/libvpx.a and b/TMessagesProj/jni/ffmpeg/x86/libvpx.a differ
diff --git a/TMessagesProj/jni/ffmpeg/x86_64/libavcodec.a b/TMessagesProj/jni/ffmpeg/x86_64/libavcodec.a
index 13d6c3ee0..e54555cb9 100644
Binary files a/TMessagesProj/jni/ffmpeg/x86_64/libavcodec.a and b/TMessagesProj/jni/ffmpeg/x86_64/libavcodec.a differ
diff --git a/TMessagesProj/jni/ffmpeg/x86_64/libavformat.a b/TMessagesProj/jni/ffmpeg/x86_64/libavformat.a
index 730d167d4..f8e543074 100644
Binary files a/TMessagesProj/jni/ffmpeg/x86_64/libavformat.a and b/TMessagesProj/jni/ffmpeg/x86_64/libavformat.a differ
diff --git a/TMessagesProj/jni/ffmpeg/x86_64/libavresample.a b/TMessagesProj/jni/ffmpeg/x86_64/libavresample.a
index 11b9ada0b..a2e5997b6 100644
Binary files a/TMessagesProj/jni/ffmpeg/x86_64/libavresample.a and b/TMessagesProj/jni/ffmpeg/x86_64/libavresample.a differ
diff --git a/TMessagesProj/jni/ffmpeg/x86_64/libavutil.a b/TMessagesProj/jni/ffmpeg/x86_64/libavutil.a
index 130af1e6a..d982f1067 100644
Binary files a/TMessagesProj/jni/ffmpeg/x86_64/libavutil.a and b/TMessagesProj/jni/ffmpeg/x86_64/libavutil.a differ
diff --git a/TMessagesProj/jni/ffmpeg/x86_64/libswresample.a b/TMessagesProj/jni/ffmpeg/x86_64/libswresample.a
index ce7275144..230a28697 100644
Binary files a/TMessagesProj/jni/ffmpeg/x86_64/libswresample.a and b/TMessagesProj/jni/ffmpeg/x86_64/libswresample.a differ
diff --git a/TMessagesProj/jni/ffmpeg/x86_64/libswscale.a b/TMessagesProj/jni/ffmpeg/x86_64/libswscale.a
index afb1f7ffa..3187be8df 100644
Binary files a/TMessagesProj/jni/ffmpeg/x86_64/libswscale.a and b/TMessagesProj/jni/ffmpeg/x86_64/libswscale.a differ
diff --git a/TMessagesProj/jni/ffmpeg/x86_64/libvpx.a b/TMessagesProj/jni/ffmpeg/x86_64/libvpx.a
index 21e46183d..bd0383e80 100644
Binary files a/TMessagesProj/jni/ffmpeg/x86_64/libvpx.a and b/TMessagesProj/jni/ffmpeg/x86_64/libvpx.a differ
diff --git a/TMessagesProj/jni/tgnet/ApiScheme.cpp b/TMessagesProj/jni/tgnet/ApiScheme.cpp
index 2e0f88ad8..fa2d2dd16 100644
--- a/TMessagesProj/jni/tgnet/ApiScheme.cpp
+++ b/TMessagesProj/jni/tgnet/ApiScheme.cpp
@@ -528,6 +528,9 @@ void TL_user::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &er
profile_color_color = stream->readInt32(&error);
profile_color_background_emoji_id = stream->readInt64(&error);
}
+ if ((flags2 & 4096) != 0) {
+ bot_active_users = stream->readInt32(&error);
+ }
}
void TL_user::serializeToStream(NativeByteBuffer *stream) {
@@ -605,6 +608,9 @@ void TL_user::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(profile_color_color);
stream->writeInt32(profile_color_background_emoji_id);
}
+ if ((flags2 & 4096) != 0) {
+ stream->writeInt32(bot_active_users);
+ }
}
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 4a7659ac4..a883738db 100644
--- a/TMessagesProj/jni/tgnet/ApiScheme.h
+++ b/TMessagesProj/jni/tgnet/ApiScheme.h
@@ -388,6 +388,7 @@ public:
int64_t color_background_emoji_id;
int32_t profile_color_color;
int64_t profile_color_background_emoji_id;
+ int32_t bot_active_users;
static User *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error);
};
@@ -404,7 +405,7 @@ public:
class TL_user : public User {
public:
- static const uint32_t constructor = 0x215c4438;
+ static const uint32_t constructor = 0x83314fca;
void readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error);
void serializeToStream(NativeByteBuffer *stream);
diff --git a/TMessagesProj/src/main/AndroidManifest.xml b/TMessagesProj/src/main/AndroidManifest.xml
index be5cda368..32526988c 100644
--- a/TMessagesProj/src/main/AndroidManifest.xml
+++ b/TMessagesProj/src/main/AndroidManifest.xml
@@ -102,7 +102,10 @@
android:requestLegacyExternalStorage="true"
android:preserveLegacyExternalStorage="true"
android:allowAudioPlaybackCapture="true"
- tools:replace="android:supportsRtl">
+ tools:replace="android:supportsRtl"
+ android:usesCleartextTraffic="true"
+ >
+
+
+
+
+
+
+
diff --git a/TMessagesProj/src/main/assets/currencies.json b/TMessagesProj/src/main/assets/currencies.json
index 25205f658..b80d598b7 100644
--- a/TMessagesProj/src/main/assets/currencies.json
+++ b/TMessagesProj/src/main/assets/currencies.json
@@ -1 +1 @@
-{"AED":{"code":"AED","title":"United Arab Emirates Dirham","symbol":"AED","native":"د.إ.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"exp":2,"min_amount":"367","max_amount":"3673095"},"AFN":{"code":"AFN","title":"Afghan Afghani","symbol":"AFN","native":"؋","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"8729","max_amount":"87299487"},"ALL":{"code":"ALL","title":"Albanian Lek","symbol":"ALL","native":"Lek","thousands_sep":".","decimal_sep":",","symbol_left":false,"space_between":false,"exp":2,"min_amount":"11842","max_amount":"118421187"},"AMD":{"code":"AMD","title":"Armenian Dram","symbol":"AMD","native":"դր.","thousands_sep":",","decimal_sep":".","symbol_left":false,"space_between":true,"exp":2,"min_amount":"40943","max_amount":"409436718"},"ARS":{"code":"ARS","title":"Argentine Peso","symbol":"ARS","native":"$","thousands_sep":".","decimal_sep":",","symbol_left":true,"space_between":true,"exp":2,"min_amount":"14706","max_amount":"147065012"},"AUD":{"code":"AUD","title":"Australian Dollar","symbol":"AU$","native":"$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"154","max_amount":"1541535"},"AZN":{"code":"AZN","title":"Azerbaijani Manat","symbol":"AZN","native":"ман.","thousands_sep":" ","decimal_sep":",","symbol_left":false,"space_between":true,"exp":2,"min_amount":"170","max_amount":"1702860"},"BAM":{"code":"BAM","title":"Bosnia & Herzegovina Convertible Mark","symbol":"BAM","native":"KM","thousands_sep":".","decimal_sep":",","symbol_left":false,"space_between":true,"exp":2,"min_amount":"199","max_amount":"1990677"},"BDT":{"code":"BDT","title":"Bangladeshi Taka","symbol":"BDT","native":"৳","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"exp":2,"min_amount":"10009","max_amount":"100094046"},"BGN":{"code":"BGN","title":"Bulgarian Lev","symbol":"BGN","native":"лв.","thousands_sep":" ","decimal_sep":",","symbol_left":false,"space_between":true,"exp":2,"min_amount":"199","max_amount":"1993852"},"BND":{"code":"BND","title":"Brunei Dollar","symbol":"BND","native":"$","thousands_sep":".","decimal_sep":",","symbol_left":true,"space_between":false,"exp":2,"min_amount":"142","max_amount":"1421883"},"BOB":{"code":"BOB","title":"Bolivian Boliviano","symbol":"BOB","native":"Bs","thousands_sep":".","decimal_sep":",","symbol_left":true,"space_between":true,"exp":2,"min_amount":"683","max_amount":"6832607"},"BRL":{"code":"BRL","title":"Brazilian Real","symbol":"R$","native":"R$","thousands_sep":".","decimal_sep":",","symbol_left":true,"space_between":true,"exp":2,"min_amount":"539","max_amount":"5397297"},"BYN":{"code":"BYN","title":"Belarusian ruble","symbol":"BYN","native":"BYN","thousands_sep":" ","decimal_sep":",","symbol_left":false,"space_between":true,"exp":2,"min_amount":"249","max_amount":"2495801"},"CAD":{"code":"CAD","title":"Canadian Dollar","symbol":"CA$","native":"$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"137","max_amount":"1371480"},"CHF":{"code":"CHF","title":"Swiss Franc","symbol":"CHF","native":"CHF","thousands_sep":"'","decimal_sep":".","symbol_left":false,"space_between":true,"exp":2,"min_amount":"97","max_amount":"976430"},"CLP":{"code":"CLP","title":"Chilean Peso","symbol":"CLP","native":"$","thousands_sep":".","decimal_sep":",","symbol_left":true,"space_between":true,"exp":0,"min_amount":"963","max_amount":"9637500"},"CNY":{"code":"CNY","title":"Chinese Renminbi Yuan","symbol":"CN¥","native":"CN¥","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"711","max_amount":"7113300"},"COP":{"code":"COP","title":"Colombian Peso","symbol":"COP","native":"$","thousands_sep":".","decimal_sep":",","symbol_left":true,"space_between":true,"exp":2,"min_amount":"452870","max_amount":"4528700000"},"CRC":{"code":"CRC","title":"Costa Rican Colón","symbol":"CRC","native":"₡","thousands_sep":".","decimal_sep":",","symbol_left":true,"space_between":false,"exp":2,"min_amount":"62506","max_amount":"625061070"},"CZK":{"code":"CZK","title":"Czech Koruna","symbol":"CZK","native":"Kč","thousands_sep":" ","decimal_sep":",","symbol_left":false,"space_between":true,"exp":2,"min_amount":"2503","max_amount":"25036400"},"DKK":{"code":"DKK","title":"Danish Krone","symbol":"DKK","native":"kr","thousands_sep":"","decimal_sep":",","symbol_left":false,"space_between":true,"exp":2,"min_amount":"758","max_amount":"7587520"},"DOP":{"code":"DOP","title":"Dominican Peso","symbol":"DOP","native":"$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"5275","max_amount":"52757308"},"DZD":{"code":"DZD","title":"Algerian Dinar","symbol":"DZD","native":"د.ج.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"exp":2,"min_amount":"14035","max_amount":"140351015"},"EGP":{"code":"EGP","title":"Egyptian Pound","symbol":"EGP","native":"ج.م.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"exp":2,"min_amount":"1954","max_amount":"19544296"},"ETB":{"code":"ETB","title":"Ethiopian Birr","symbol":"ETB","native":"ብር","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"5224","max_amount":"52247069"},"EUR":{"code":"EUR","title":"Euro","symbol":"€","native":"€","thousands_sep":" ","decimal_sep":",","symbol_left":false,"space_between":true,"exp":2,"min_amount":"102","max_amount":"1020295"},"GBP":{"code":"GBP","title":"British Pound","symbol":"£","native":"£","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"90","max_amount":"901955"},"GEL":{"code":"GEL","title":"Georgian Lari","symbol":"GEL","native":"GEL","thousands_sep":" ","decimal_sep":",","symbol_left":false,"space_between":true,"exp":2,"min_amount":"283","max_amount":"2830146"},"GTQ":{"code":"GTQ","title":"Guatemalan Quetzal","symbol":"GTQ","native":"Q","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"778","max_amount":"7781323"},"HKD":{"code":"HKD","title":"Hong Kong Dollar","symbol":"HK$","native":"$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"784","max_amount":"7849850"},"HNL":{"code":"HNL","title":"Honduran Lempira","symbol":"HNL","native":"L","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"exp":2,"min_amount":"2441","max_amount":"24413729"},"HRK":{"code":"HRK","title":"Croatian Kuna","symbol":"HRK","native":"kn","thousands_sep":".","decimal_sep":",","symbol_left":false,"space_between":true,"exp":2,"min_amount":"768","max_amount":"7681499"},"HUF":{"code":"HUF","title":"Hungarian Forint","symbol":"HUF","native":"Ft","thousands_sep":" ","decimal_sep":",","symbol_left":false,"space_between":true,"exp":2,"min_amount":"42967","max_amount":"429670063"},"IDR":{"code":"IDR","title":"Indonesian Rupiah","symbol":"IDR","native":"Rp","thousands_sep":".","decimal_sep":",","symbol_left":true,"space_between":false,"exp":2,"min_amount":"1523720","max_amount":"15237200000"},"ILS":{"code":"ILS","title":"Israeli New Sheqel","symbol":"₪","native":"₪","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"exp":2,"min_amount":"356","max_amount":"3564105"},"INR":{"code":"INR","title":"Indian Rupee","symbol":"₹","native":"₹","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"8155","max_amount":"81553202"},"ISK":{"code":"ISK","title":"Icelandic Króna","symbol":"ISK","native":"kr","thousands_sep":".","decimal_sep":",","symbol_left":false,"space_between":true,"exp":0,"min_amount":"143","max_amount":"1431502"},"JMD":{"code":"JMD","title":"Jamaican Dollar","symbol":"JMD","native":"$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"15013","max_amount":"150131044"},"JPY":{"code":"JPY","title":"Japanese Yen","symbol":"¥","native":"¥","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":0,"min_amount":"144","max_amount":"1447309"},"KES":{"code":"KES","title":"Kenyan Shilling","symbol":"KES","native":"Ksh","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"12080","max_amount":"120800507"},"KGS":{"code":"KGS","title":"Kyrgyzstani Som","symbol":"KGS","native":"KGS","thousands_sep":" ","decimal_sep":"-","symbol_left":false,"space_between":true,"exp":2,"min_amount":"8018","max_amount":"80182900"},"KRW":{"code":"KRW","title":"South Korean Won","symbol":"₩","native":"₩","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":0,"min_amount":"1430","max_amount":"14308699"},"KZT":{"code":"KZT","title":"Kazakhstani Tenge","symbol":"KZT","native":"₸","thousands_sep":" ","decimal_sep":"-","symbol_left":true,"space_between":false,"exp":2,"min_amount":"47186","max_amount":"471867112"},"LBP":{"code":"LBP","title":"Lebanese Pound","symbol":"LBP","native":"ل.ل.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"exp":2,"min_amount":"150999","max_amount":"1509998778"},"LKR":{"code":"LKR","title":"Sri Lankan Rupee","symbol":"LKR","native":"රු.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"exp":2,"min_amount":"35546","max_amount":"355469651"},"MAD":{"code":"MAD","title":"Moroccan Dirham","symbol":"MAD","native":"د.م.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"exp":2,"min_amount":"1093","max_amount":"10938136"},"MDL":{"code":"MDL","title":"Moldovan Leu","symbol":"MDL","native":"MDL","thousands_sep":",","decimal_sep":".","symbol_left":false,"space_between":true,"exp":2,"min_amount":"1926","max_amount":"19264439"},"MNT":{"code":"MNT","title":"Mongolian Tögrög","symbol":"MNT","native":"MNT","thousands_sep":" ","decimal_sep":",","symbol_left":true,"space_between":false,"exp":2,"min_amount":"322444","max_amount":"3224442056"},"MUR":{"code":"MUR","title":"Mauritian Rupee","symbol":"MUR","native":"MUR","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"4514","max_amount":"45142537"},"MVR":{"code":"MVR","title":"Maldivian Rufiyaa","symbol":"MVR","native":"MVR","thousands_sep":",","decimal_sep":".","symbol_left":false,"space_between":true,"exp":2,"min_amount":"1545","max_amount":"15459951"},"MXN":{"code":"MXN","title":"Mexican Peso","symbol":"MX$","native":"$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"2018","max_amount":"20186299"},"MYR":{"code":"MYR","title":"Malaysian Ringgit","symbol":"MYR","native":"RM","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"464","max_amount":"4641025"},"MZN":{"code":"MZN","title":"Mozambican Metical","symbol":"MZN","native":"MTn","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"6382","max_amount":"63829680"},"NGN":{"code":"NGN","title":"Nigerian Naira","symbol":"NGN","native":"₦","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"43203","max_amount":"432039540"},"NIO":{"code":"NIO","title":"Nicaraguan Córdoba","symbol":"NIO","native":"C$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"exp":2,"min_amount":"3556","max_amount":"35566412"},"NOK":{"code":"NOK","title":"Norwegian Krone","symbol":"NOK","native":"kr","thousands_sep":" ","decimal_sep":",","symbol_left":true,"space_between":true,"exp":2,"min_amount":"1072","max_amount":"10724875"},"NPR":{"code":"NPR","title":"Nepalese Rupee","symbol":"NPR","native":"नेरू","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"12954","max_amount":"129546657"},"NZD":{"code":"NZD","title":"New Zealand Dollar","symbol":"NZ$","native":"$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"174","max_amount":"1748790"},"PAB":{"code":"PAB","title":"Panamanian Balboa","symbol":"PAB","native":"B\/.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"exp":2,"min_amount":"98","max_amount":"988722"},"PEN":{"code":"PEN","title":"Peruvian Nuevo Sol","symbol":"PEN","native":"S\/.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"exp":2,"min_amount":"390","max_amount":"3902208"},"PHP":{"code":"PHP","title":"Philippine Peso","symbol":"PHP","native":"₱","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"5865","max_amount":"58658497"},"PKR":{"code":"PKR","title":"Pakistani Rupee","symbol":"PKR","native":"₨","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"22642","max_amount":"226426805"},"PLN":{"code":"PLN","title":"Polish Złoty","symbol":"PLN","native":"zł","thousands_sep":" ","decimal_sep":",","symbol_left":false,"space_between":true,"exp":2,"min_amount":"495","max_amount":"4950459"},"PYG":{"code":"PYG","title":"Paraguayan Guaraní","symbol":"PYG","native":"₲","thousands_sep":".","decimal_sep":",","symbol_left":true,"space_between":true,"exp":0,"min_amount":"6977","max_amount":"69772317"},"QAR":{"code":"QAR","title":"Qatari Riyal","symbol":"QAR","native":"ر.ق.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"exp":2,"min_amount":"364","max_amount":"3641013"},"RON":{"code":"RON","title":"Romanian Leu","symbol":"RON","native":"RON","thousands_sep":".","decimal_sep":",","symbol_left":false,"space_between":true,"exp":2,"min_amount":"504","max_amount":"5049800"},"RSD":{"code":"RSD","title":"Serbian Dinar","symbol":"RSD","native":"дин.","thousands_sep":".","decimal_sep":",","symbol_left":false,"space_between":true,"exp":2,"min_amount":"11968","max_amount":"119684977"},"RUB":{"code":"RUB","title":"Russian Ruble","symbol":"RUB","native":"₽","thousands_sep":" ","decimal_sep":",","symbol_left":false,"space_between":true,"exp":2,"min_amount":"7146","max_amount":"71468755"},"SAR":{"code":"SAR","title":"Saudi Riyal","symbol":"SAR","native":"ر.س.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"exp":2,"min_amount":"375","max_amount":"3758389"},"SEK":{"code":"SEK","title":"Swedish Krona","symbol":"SEK","native":"kr","thousands_sep":".","decimal_sep":",","symbol_left":false,"space_between":true,"exp":2,"min_amount":"1118","max_amount":"11187065"},"SGD":{"code":"SGD","title":"Singapore Dollar","symbol":"SGD","native":"$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"143","max_amount":"1433860"},"THB":{"code":"THB","title":"Thai Baht","symbol":"฿","native":"฿","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"3798","max_amount":"37980185"},"TJS":{"code":"TJS","title":"Tajikistani Somoni","symbol":"TJS","native":"TJS","thousands_sep":" ","decimal_sep":";","symbol_left":false,"space_between":true,"exp":2,"min_amount":"975","max_amount":"9753854"},"TRY":{"code":"TRY","title":"Turkish Lira","symbol":"TRY","native":"TL","thousands_sep":".","decimal_sep":",","symbol_left":false,"space_between":true,"exp":2,"min_amount":"1853","max_amount":"18536199"},"TTD":{"code":"TTD","title":"Trinidad and Tobago Dollar","symbol":"TTD","native":"$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"672","max_amount":"6722681"},"TWD":{"code":"TWD","title":"New Taiwan Dollar","symbol":"NT$","native":"NT$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"3174","max_amount":"31744503"},"TZS":{"code":"TZS","title":"Tanzanian Shilling","symbol":"TZS","native":"TSh","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"233200","max_amount":"2332000058"},"UAH":{"code":"UAH","title":"Ukrainian Hryvnia","symbol":"UAH","native":"₴","thousands_sep":" ","decimal_sep":",","symbol_left":false,"space_between":false,"exp":2,"min_amount":"3633","max_amount":"36338830"},"UGX":{"code":"UGX","title":"Ugandan Shilling","symbol":"UGX","native":"USh","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":0,"min_amount":"3816","max_amount":"38166726"},"USD":{"code":"USD","title":"United States Dollar","symbol":"$","native":"$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"exp":2,"min_amount":"100","max_amount":1000000},"UYU":{"code":"UYU","title":"Uruguayan Peso","symbol":"UYU","native":"$","thousands_sep":".","decimal_sep":",","symbol_left":true,"space_between":true,"exp":2,"min_amount":"4080","max_amount":"40801205"},"UZS":{"code":"UZS","title":"Uzbekistani Som","symbol":"UZS","native":"UZS","thousands_sep":" ","decimal_sep":",","symbol_left":false,"space_between":true,"exp":2,"min_amount":"1089058","max_amount":"10890583014"},"VND":{"code":"VND","title":"Vietnamese Đồng","symbol":"₫","native":"₫","thousands_sep":".","decimal_sep":",","symbol_left":false,"space_between":true,"exp":0,"min_amount":"23870","max_amount":"238700000"},"YER":{"code":"YER","title":"Yemeni Rial","symbol":"YER","native":"ر.ي.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"exp":2,"min_amount":"25031","max_amount":"250319621"},"ZAR":{"code":"ZAR","title":"South African Rand","symbol":"ZAR","native":"R","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"exp":2,"min_amount":"1801","max_amount":"18018198"}}
\ No newline at end of file
+{"AED":{"code":"AED","title":"United Arab Emirates Dirham","symbol":"AED","native":"د.إ.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"367","max_amount":"3673042"},"AFN":{"code":"AFN","title":"Afghan Afghani","symbol":"AFN","native":"؋","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"7032","max_amount":"70320011"},"ALL":{"code":"ALL","title":"Albanian Lek","symbol":"ALL","native":"Lek","thousands_sep":".","decimal_sep":",","symbol_left":false,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"9170","max_amount":"91699858"},"AMD":{"code":"AMD","title":"Armenian Dram","symbol":"AMD","native":"դր.","thousands_sep":",","decimal_sep":".","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"38438","max_amount":"384379435"},"ARS":{"code":"ARS","title":"Argentine Peso","symbol":"ARS","native":"$","thousands_sep":".","decimal_sep":",","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"93241","max_amount":"932408369"},"AUD":{"code":"AUD","title":"Australian Dollar","symbol":"AU$","native":"$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"154","max_amount":"1535627"},"AZN":{"code":"AZN","title":"Azerbaijani Manat","symbol":"AZN","native":"ман.","thousands_sep":" ","decimal_sep":",","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"170","max_amount":"1703970"},"BAM":{"code":"BAM","title":"Bosnia & Herzegovina Convertible Mark","symbol":"BAM","native":"KM","thousands_sep":".","decimal_sep":",","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"179","max_amount":"1790780"},"BDT":{"code":"BDT","title":"Bangladeshi Taka","symbol":"BDT","native":"৳","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"11644","max_amount":"116440049"},"BGN":{"code":"BGN","title":"Bulgarian Lev","symbol":"BGN","native":"лв.","thousands_sep":" ","decimal_sep":",","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"179","max_amount":"1790871"},"BHD":{"code":"BHD","title":"Bahraini dinar","symbol":"BHD","native":"د.ب.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":3,"min_amount":"377","max_amount":"3765970"},"BND":{"code":"BND","title":"Brunei Dollar","symbol":"BND","native":"$","thousands_sep":".","decimal_sep":",","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"132","max_amount":"1319416"},"BOB":{"code":"BOB","title":"Bolivian Boliviano","symbol":"BOB","native":"Bs","thousands_sep":".","decimal_sep":",","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"685","max_amount":"6847960"},"BRL":{"code":"BRL","title":"Brazilian Real","symbol":"R$","native":"R$","thousands_sep":".","decimal_sep":",","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"570","max_amount":"5700224"},"BYN":{"code":"BYN","title":"Belarusian ruble","symbol":"BYN","native":"BYN","thousands_sep":" ","decimal_sep":",","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"324","max_amount":"3242595"},"CAD":{"code":"CAD","title":"Canadian Dollar","symbol":"CA$","native":"$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"139","max_amount":"1387250"},"CHF":{"code":"CHF","title":"Swiss Franc","symbol":"CHF","native":"CHF","thousands_sep":"'","decimal_sep":".","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"86","max_amount":"858080"},"CLP":{"code":"CLP","title":"Chilean Peso","symbol":"CLP","native":"$","thousands_sep":".","decimal_sep":",","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":0,"min_amount":"944","max_amount":"9438172"},"CNY":{"code":"CNY","title":"Chinese Renminbi Yuan","symbol":"CN¥","native":"CN¥","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"716","max_amount":"7159204"},"COP":{"code":"COP","title":"Colombian Peso","symbol":"COP","native":"$","thousands_sep":".","decimal_sep":",","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"405201","max_amount":"4052007508"},"CRC":{"code":"CRC","title":"Costa Rican Colón","symbol":"CRC","native":"₡","thousands_sep":".","decimal_sep":",","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"51870","max_amount":"518701644"},"CZK":{"code":"CZK","title":"Czech Koruna","symbol":"CZK","native":"Kč","thousands_sep":" ","decimal_sep":",","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"2323","max_amount":"23232104"},"DKK":{"code":"DKK","title":"Danish Krone","symbol":"DKK","native":"kr","thousands_sep":"","decimal_sep":",","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"684","max_amount":"6838604"},"DOP":{"code":"DOP","title":"Dominican Peso","symbol":"DOP","native":"$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"5895","max_amount":"58947947"},"DZD":{"code":"DZD","title":"Algerian Dinar","symbol":"DZD","native":"د.ج.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"13411","max_amount":"134106121"},"EGP":{"code":"EGP","title":"Egyptian Pound","symbol":"EGP","native":"ج.م.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"4863","max_amount":"48626104"},"ETB":{"code":"ETB","title":"Ethiopian Birr","symbol":"ETB","native":"ብር","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"8025","max_amount":"80247402"},"EUR":{"code":"EUR","title":"Euro","symbol":"€","native":"€","thousands_sep":" ","decimal_sep":",","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"92","max_amount":"915704"},"GBP":{"code":"GBP","title":"British Pound","symbol":"£","native":"£","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"78","max_amount":"780853"},"GEL":{"code":"GEL","title":"Georgian Lari","symbol":"GEL","native":"GEL","thousands_sep":" ","decimal_sep":",","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"271","max_amount":"2705040"},"GHS":{"code":"GHS","title":"Ghanaian cedi","symbol":"GHS","native":"GHS","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"1541","max_amount":"15410887"},"GTQ":{"code":"GTQ","title":"Guatemalan Quetzal","symbol":"GTQ","native":"Q","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"768","max_amount":"7680264"},"HKD":{"code":"HKD","title":"Hong Kong Dollar","symbol":"HK$","native":"$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"781","max_amount":"7807950"},"HNL":{"code":"HNL","title":"Honduran Lempira","symbol":"HNL","native":"L","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"2453","max_amount":"24532344"},"HRK":{"code":"HRK","title":"Croatian Kuna","symbol":"HRK","native":"kn","thousands_sep":".","decimal_sep":",","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"691","max_amount":"6907950"},"HUF":{"code":"HUF","title":"Hungarian Forint","symbol":"HUF","native":"Ft","thousands_sep":" ","decimal_sep":",","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"36510","max_amount":"365103831"},"IDR":{"code":"IDR","title":"Indonesian Rupiah","symbol":"IDR","native":"Rp","thousands_sep":".","decimal_sep":",","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"1617595","max_amount":"16175950000"},"ILS":{"code":"ILS","title":"Israeli New Sheqel","symbol":"₪","native":"₪","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"380","max_amount":"3799935"},"INR":{"code":"INR","title":"Indian Rupee","symbol":"₹","native":"₹","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"8377","max_amount":"83767350"},"IQD":{"code":"IQD","title":"Iraqi dinar","symbol":"IQD","native":"د.ع.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":3,"min_amount":"1298173","max_amount":"12981733280"},"IRR":{"code":"IRR","title":"Iranian rial","symbol":"IRR","native":"ريال","thousands_sep":",","decimal_sep":"\/","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"4210500","max_amount":"42105000352"},"ISK":{"code":"ISK","title":"Icelandic Króna","symbol":"ISK","native":"kr","thousands_sep":".","decimal_sep":",","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":0,"min_amount":"138","max_amount":"1379504"},"JMD":{"code":"JMD","title":"Jamaican Dollar","symbol":"JMD","native":"$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"15504","max_amount":"155042805"},"JOD":{"code":"JOD","title":"Jordanian dinar","symbol":"JOD","native":"JOD","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":3,"min_amount":"709","max_amount":"7087040"},"JPY":{"code":"JPY","title":"Japanese Yen","symbol":"¥","native":"¥","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":0,"min_amount":"147","max_amount":"1465950"},"KES":{"code":"KES","title":"Kenyan Shilling","symbol":"KES","native":"Ksh","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"12883","max_amount":"128828458"},"KGS":{"code":"KGS","title":"Kyrgyzstani Som","symbol":"KGS","native":"KGS","thousands_sep":" ","decimal_sep":"-","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"8403","max_amount":"84030384"},"KRW":{"code":"KRW","title":"South Korean Won","symbol":"₩","native":"₩","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":0,"min_amount":"1358","max_amount":"13581650"},"KZT":{"code":"KZT","title":"Kazakhstani Tenge","symbol":"KZT","native":"₸","thousands_sep":" ","decimal_sep":"-","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"47034","max_amount":"470338323"},"LBP":{"code":"LBP","title":"Lebanese Pound","symbol":"LBP","native":"ل.ل.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"8874340","max_amount":"88743396054"},"LKR":{"code":"LKR","title":"Sri Lankan Rupee","symbol":"LKR","native":"රු.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"29919","max_amount":"299189672"},"MAD":{"code":"MAD","title":"Moroccan Dirham","symbol":"MAD","native":"د.م.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"979","max_amount":"9790963"},"MDL":{"code":"MDL","title":"Moldovan Leu","symbol":"MDL","native":"MDL","thousands_sep":",","decimal_sep":".","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"1762","max_amount":"17620290"},"MMK":{"code":"MMK","title":"Myanmar kyat","symbol":"MMK","native":"MMK","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"324796","max_amount":"3247960992"},"MNT":{"code":"MNT","title":"Mongolian Tögrög","symbol":"MNT","native":"MNT","thousands_sep":" ","decimal_sep":",","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"345000","max_amount":"3450000346"},"MOP":{"code":"MOP","title":"Macanese pataca","symbol":"MOP","native":"MOP","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"797","max_amount":"7972623"},"MUR":{"code":"MUR","title":"Mauritian Rupee","symbol":"MUR","native":"MUR","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"4675","max_amount":"46750378"},"MVR":{"code":"MVR","title":"Maldivian Rufiyaa","symbol":"MVR","native":"MVR","thousands_sep":",","decimal_sep":".","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"1536","max_amount":"15360378"},"MXN":{"code":"MXN","title":"Mexican Peso","symbol":"MX$","native":"$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"1918","max_amount":"19178504"},"MYR":{"code":"MYR","title":"Malaysian Ringgit","symbol":"MYR","native":"RM","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"450","max_amount":"4497504"},"MZN":{"code":"MZN","title":"Mozambican Metical","symbol":"MZN","native":"MTn","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"6390","max_amount":"63899991"},"NGN":{"code":"NGN","title":"Nigerian Naira","symbol":"NGN","native":"₦","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"163595","max_amount":"1635950377"},"NIO":{"code":"NIO","title":"Nicaraguan Córdoba","symbol":"NIO","native":"C$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"3648","max_amount":"36478506"},"NOK":{"code":"NOK","title":"Norwegian Krone","symbol":"NOK","native":"kr","thousands_sep":" ","decimal_sep":",","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"1095","max_amount":"10948150"},"NPR":{"code":"NPR","title":"Nepalese Rupee","symbol":"NPR","native":"नेरू","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"13277","max_amount":"132765646"},"NZD":{"code":"NZD","title":"New Zealand Dollar","symbol":"NZ$","native":"$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"168","max_amount":"1678557"},"PAB":{"code":"PAB","title":"Panamanian Balboa","symbol":"PAB","native":"B\/.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"99","max_amount":"990981"},"PEN":{"code":"PEN","title":"Peruvian Nuevo Sol","symbol":"PEN","native":"S\/.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"371","max_amount":"3708923"},"PHP":{"code":"PHP","title":"Philippine Peso","symbol":"PHP","native":"₱","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"5780","max_amount":"57795038"},"PKR":{"code":"PKR","title":"Pakistani Rupee","symbol":"PKR","native":"₨","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"27599","max_amount":"275991393"},"PLN":{"code":"PLN","title":"Polish Złoty","symbol":"PLN","native":"zł","thousands_sep":" ","decimal_sep":",","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"393","max_amount":"3929050"},"PYG":{"code":"PYG","title":"Paraguayan Guaraní","symbol":"PYG","native":"₲","thousands_sep":".","decimal_sep":",","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":0,"min_amount":"7505","max_amount":"75053793"},"QAR":{"code":"QAR","title":"Qatari Riyal","symbol":"QAR","native":"ر.ق.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"361","max_amount":"3613606"},"RON":{"code":"RON","title":"Romanian Leu","symbol":"RON","native":"RON","thousands_sep":".","decimal_sep":",","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"456","max_amount":"4560404"},"RSD":{"code":"RSD","title":"Serbian Dinar","symbol":"RSD","native":"дин.","thousands_sep":".","decimal_sep":",","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"10716","max_amount":"107157442"},"RUB":{"code":"RUB","title":"Russian Ruble","symbol":"RUB","native":"₽","thousands_sep":" ","decimal_sep":",","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"8922","max_amount":"89218514"},"SAR":{"code":"SAR","title":"Saudi Riyal","symbol":"SAR","native":"ر.س.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"375","max_amount":"3753930"},"SEK":{"code":"SEK","title":"Swedish Krona","symbol":"SEK","native":"kr","thousands_sep":".","decimal_sep":",","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"1055","max_amount":"10554325"},"SGD":{"code":"SGD","title":"Singapore Dollar","symbol":"SGD","native":"$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"133","max_amount":"1327104"},"SYP":{"code":"SYP","title":"Syrian pound","symbol":"SYP","native":"ل.س.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"251253","max_amount":"2512530370"},"THB":{"code":"THB","title":"Thai Baht","symbol":"฿","native":"฿","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"3531","max_amount":"35313038"},"TJS":{"code":"TJS","title":"Tajikistani Somoni","symbol":"TJS","native":"TJS","thousands_sep":" ","decimal_sep":";","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"1048","max_amount":"10479788"},"TRY":{"code":"TRY","title":"Turkish Lira","symbol":"TRY","native":"TL","thousands_sep":".","decimal_sep":",","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"3310","max_amount":"33102504"},"TTD":{"code":"TTD","title":"Trinidad and Tobago Dollar","symbol":"TTD","native":"$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"671","max_amount":"6710617"},"TWD":{"code":"TWD","title":"New Taiwan Dollar","symbol":"NT$","native":"NT$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"3260","max_amount":"32603904"},"TZS":{"code":"TZS","title":"Tanzanian Shilling","symbol":"TZS","native":"TSh","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"268068","max_amount":"2680675731"},"UAH":{"code":"UAH","title":"Ukrainian Hryvnia","symbol":"UAH","native":"₴","thousands_sep":" ","decimal_sep":",","symbol_left":false,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"4089","max_amount":"40888706"},"UGX":{"code":"UGX","title":"Ugandan Shilling","symbol":"UGX","native":"USh","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":0,"min_amount":"3692","max_amount":"36918006"},"USD":{"code":"USD","title":"United States Dollar","symbol":"$","native":"$","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":false,"drop_zeros":false,"exp":2,"min_amount":"100","max_amount":1000000},"UYU":{"code":"UYU","title":"Uruguayan Peso","symbol":"UYU","native":"$","thousands_sep":".","decimal_sep":",","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"3993","max_amount":"39930412"},"UZS":{"code":"UZS","title":"Uzbekistani Som","symbol":"UZS","native":"UZS","thousands_sep":" ","decimal_sep":",","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"1246166","max_amount":"12461658197"},"VEF":{"code":"VEF","title":"Venezuelan bolívar","symbol":"VEF","native":"Bs.F.","thousands_sep":".","decimal_sep":",","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"362255253","max_amount":"999999999999"},"VND":{"code":"VND","title":"Vietnamese Đồng","symbol":"₫","native":"₫","thousands_sep":".","decimal_sep":",","symbol_left":false,"space_between":true,"drop_zeros":false,"exp":0,"min_amount":"25218","max_amount":"252175000"},"YER":{"code":"YER","title":"Yemeni Rial","symbol":"YER","native":"ر.ي.","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"25035","max_amount":"250350363"},"ZAR":{"code":"ZAR","title":"South African Rand","symbol":"ZAR","native":"R","thousands_sep":",","decimal_sep":".","symbol_left":true,"space_between":true,"drop_zeros":false,"exp":2,"min_amount":"1828","max_amount":"18278037"}}
\ No newline at end of file
diff --git a/TMessagesProj/src/main/assets/darkblue.attheme b/TMessagesProj/src/main/assets/darkblue.attheme
index d3cac2cf7..5c400cef3 100644
--- a/TMessagesProj/src/main/assets/darkblue.attheme
+++ b/TMessagesProj/src/main/assets/darkblue.attheme
@@ -441,5 +441,8 @@ code_string=-7806088
code_operator=2147483647
code_number=-10887465
code_comment=2147483647
+iv_background=-16777216
+iv_backgroundGray=-14737633
+iv_navigationBackground=-16777216
table_background=177390847
table_border=436207615
diff --git a/TMessagesProj/src/main/assets/fonts/num.otf b/TMessagesProj/src/main/assets/fonts/num.otf
index 320ce49b2..856f2f71e 100644
Binary files a/TMessagesProj/src/main/assets/fonts/num.otf and b/TMessagesProj/src/main/assets/fonts/num.otf differ
diff --git a/TMessagesProj/src/main/assets/night.attheme b/TMessagesProj/src/main/assets/night.attheme
index c259bfe71..3ad321175 100644
--- a/TMessagesProj/src/main/assets/night.attheme
+++ b/TMessagesProj/src/main/assets/night.attheme
@@ -466,5 +466,8 @@ code_string=-7806088
code_operator=2147483647
code_number=-10887465
code_comment=2147483647
+iv_background=-16777216
+iv_backgroundGray=-14737633
+iv_navigationBackground=-16777216
table_background=177390847
table_border=436207615
diff --git a/TMessagesProj/src/main/assets/shaders/fragment4.glsl b/TMessagesProj/src/main/assets/shaders/fragment4.glsl
index 104c3a602..738446765 100644
--- a/TMessagesProj/src/main/assets/shaders/fragment4.glsl
+++ b/TMessagesProj/src/main/assets/shaders/fragment4.glsl
@@ -6,6 +6,7 @@ uniform sampler2D u_BackgroundTexture;
uniform float f_xOffset;
uniform float f_alpha;
uniform mat4 world;
+uniform float white;
varying vec3 vNormal;
varying vec2 vUV;
@@ -89,5 +90,5 @@ void main() {
clamp(flecksSpec * abs(vNormal.z) * (flecksNormal.z), 0.2, 0.3) - .2
);
- gl_FragColor = color * f_alpha;
+ gl_FragColor = mix(color * f_alpha, vec4(1.0), white);
}
\ No newline at end of file
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java
index 6afa570ed..2936edb2d 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java
@@ -221,6 +221,7 @@ public class AndroidUtilities {
public final static int REPLACING_TAG_TYPE_BOLD = 1;
public final static int REPLACING_TAG_TYPE_LINKBOLD = 2;
public final static int REPLACING_TAG_TYPE_LINK_NBSP = 3;
+ public final static int REPLACING_TAG_TYPE_UNDERLINE = 4;
public final static String TYPEFACE_ROBOTO_MEDIUM = "fonts/rmedium.ttf";
public final static String TYPEFACE_ROBOTO_MEDIUM_ITALIC = "fonts/rmediumitalic.ttf";
@@ -327,7 +328,7 @@ public class AndroidUtilities {
final String HOST_NAME = "(" + IRI + "\\.)+" + GTLD;
final Pattern DOMAIN_NAME = Pattern.compile("(" + HOST_NAME + "|" + IP_ADDRESS + ")");
WEB_URL = Pattern.compile(
- "((?:(http|https|Http|Https|ton|tg):\\/\\/(?:(?:[a-zA-Z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)"
+ "((?:(http|https|Http|Https|ton|tg|tonsite):\\/\\/(?:(?:[a-zA-Z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)"
+ "\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,64}(?:\\:(?:[a-zA-Z0-9\\$\\-\\_"
+ "\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,25})?\\@)?)?"
+ "(?:" + DOMAIN_NAME + ")"
@@ -530,13 +531,13 @@ public class AndroidUtilities {
if (type == REPLACING_TAG_TYPE_LINK_NBSP) {
spannableStringBuilder.replace(index, index + len, AndroidUtilities.replaceMultipleCharSequence(" ", spannableStringBuilder.subSequence(index, index + len), " "));
}
- if (type == REPLACING_TAG_TYPE_LINK || type == REPLACING_TAG_TYPE_LINK_NBSP || type == REPLACING_TAG_TYPE_LINKBOLD) {
+ if (type == REPLACING_TAG_TYPE_LINK || type == REPLACING_TAG_TYPE_LINK_NBSP || type == REPLACING_TAG_TYPE_LINKBOLD || type == REPLACING_TAG_TYPE_UNDERLINE) {
spannableStringBuilder.setSpan(new ClickableSpan() {
@Override
public void updateDrawState(@NonNull TextPaint ds) {
super.updateDrawState(ds);
- ds.setUnderlineText(false);
+ ds.setUnderlineText(type == REPLACING_TAG_TYPE_UNDERLINE);
if (colorKey >= 0) {
ds.setColor(Theme.getColor(colorKey, resourcesProvider));
}
@@ -1101,7 +1102,7 @@ public class AndroidUtilities {
Linkify.addLinks(text, Linkify.PHONE_NUMBERS);
}
if ((mask & Linkify.WEB_URLS) != 0) {
- gatherLinks(links, text, LinkifyPort.WEB_URL, new String[]{"http://", "https://", "tg://"}, sUrlMatchFilter, internalOnly);
+ gatherLinks(links, text, LinkifyPort.WEB_URL, new String[]{"http://", "https://", "tg://", "tonsite://"}, sUrlMatchFilter, internalOnly);
}
pruneOverlaps(links);
if (links.size() == 0) {
@@ -1124,6 +1125,7 @@ public class AndroidUtilities {
if (url != null) {
url = url.replaceAll("∕|⁄|%E2%81%84|%E2%88%95", "/");
}
+ if (Browser.isTonsitePunycode(url)) continue;
text.setSpan(new URLSpan(url), link.start, link.end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
return true;
@@ -2105,7 +2107,7 @@ public class AndroidUtilities {
user.first_name = vcardData.name;
user.last_name = "";
user.id = 0;
- TLRPC.TL_restrictionReason reason = new TLRPC.TL_restrictionReason();
+ TLRPC.RestrictionReason reason = new TLRPC.RestrictionReason();
reason.text = vcardData.vcard.toString();
reason.platform = "";
reason.reason = "";
@@ -4003,7 +4005,16 @@ public class AndroidUtilities {
stringBuilder.replace(a, a + 1, " ");
}
}
- return original;
+ return stringBuilder;
+ } else if (original instanceof SpannableString) {
+ if (TextUtils.indexOf(original, '\n') < 0) return original;
+ SpannableStringBuilder stringBuilder = new SpannableStringBuilder(original);
+ for (int a = 0, N = original.length(); a < N; a++) {
+ if (original.charAt(a) == '\n') {
+ stringBuilder.replace(a, a + 1, " ");
+ }
+ }
+ return stringBuilder;
}
return original.toString().replace('\n', ' ');
}
@@ -4734,6 +4745,21 @@ public class AndroidUtilities {
}
}
+ public static void scaleRect(RectF rect, float scale) {
+ scaleRect(rect, scale, rect.centerX(), rect.centerY());
+ }
+
+ public static void scaleRect(RectF rect, float scale, float px, float py) {
+ final float wl = px - rect.left, wr = rect.right - px;
+ final float ht = py - rect.top, hb = rect.bottom - py;
+ rect.set(
+ px - wl * scale,
+ py - ht * scale,
+ px + wr * scale,
+ py + hb * scale
+ );
+ }
+
public static float cascade(float fullAnimationT, float position, float count, float waveLength) {
if (count <= 0) return fullAnimationT;
final float waveDuration = 1f / count * Math.min(waveLength, count);
@@ -4781,6 +4807,23 @@ public class AndroidUtilities {
return "";
}
+ public static String getCertificateSHA1Fingerprint() {
+ PackageManager pm = ApplicationLoader.applicationContext.getPackageManager();
+ String packageName = ApplicationLoader.applicationContext.getPackageName();
+ try {
+ PackageInfo packageInfo = pm.getPackageInfo(packageName, PackageManager.GET_SIGNATURES);
+ Signature[] signatures = packageInfo.signatures;
+ byte[] cert = signatures[0].toByteArray();
+ InputStream input = new ByteArrayInputStream(cert);
+ CertificateFactory cf = CertificateFactory.getInstance("X509");
+ X509Certificate c = (X509Certificate) cf.generateCertificate(input);
+ return Utilities.bytesToHex(Utilities.computeSHA1(c.getEncoded()));
+ } catch (Throwable ignore) {
+
+ }
+ return "";
+ }
+
private static char[] characters = new char[]{' ', ' ', '!', '"', '#', '%', '&', '\'', '(', ')', '*', ',', '-', '.', '/', ':', ';', '?', '@', '[', '\\', ']', '_', '{', '}', '¡', '§', '«', '¶', '·', '»', '¿', ';', '·', '՚', '՛', '՜', '՝', '՞', '՟', '։', '֊', '־', '׀', '׃', '׆', '׳', '״', '؉', '؊', '،', '؍', '؛', '؞', '؟', '٪', '٫', '٬', '٭', '۔', '܀', '܁', '܂', '܃', '܄', '܅', '܆', '܇', '܈', '܉', '܊', '܋', '܌', '܍', '߷', '߸', '߹', '࠰', '࠱', '࠲', '࠳', '࠴', '࠵', '࠶', '࠷', '࠸', '࠹', '࠺', '࠻', '࠼', '࠽', '࠾', '࡞', '।', '॥', '॰', '৽', '੶', '૰', '౷', '಄', '෴', '๏', '๚', '๛', '༄', '༅', '༆', '༇', '༈', '༉', '༊', '་', '༌', '།', '༎', '༏', '༐', '༑', '༒', '༔', '༺', '༻', '༼', '༽', '྅', '࿐', '࿑', '࿒', '࿓', '࿔', '࿙', '࿚', '၊', '။', '၌', '၍', '၎', '၏', '჻', '፠', '፡', '።', '፣', '፤', '፥', '፦', '፧', '፨', '᐀', '᙮', '᚛', '᚜', '᛫', '᛬', '᛭', '᜵', '᜶', '។', '៕', '៖', '៘', '៙', '៚', '᠀', '᠁', '᠂', '᠃', '᠄', '᠅', '᠆', '᠇', '᠈', '᠉', '᠊', '᥄', '᥅', '᨞', '᨟', '᪠', '᪡', '᪢', '᪣', '᪤', '᪥', '᪦', '᪨', '᪩', '᪪', '᪫', '᪬', '᪭', '᭚', '᭛', '᭜', '᭝', '᭞', '᭟', '᭠', '᯼', '᯽', '᯾', '᯿', '᰻', '᰼', '᰽', '᰾', '᰿', '᱾', '᱿', '᳀', '᳁', '᳂', '᳃', '᳄', '᳅', '᳆', '᳇', '᳓', '‐', '‑', '‒', '–', '—', '―', '‖', '‗', '‘', '’', '‚', '‛', '“', '”', '„', '‟', '†', '‡', '•', '‣', '․', '‥', '…', '‧', '‰', '‱', '′', '″', '‴', '‵', '‶', '‷', '‸', '‹', '›', '※', '‼', '‽', '‾', '‿', '⁀', '⁁', '⁂', '⁃', '⁅', '⁆', '⁇', '⁈', '⁉', '⁊', '⁋', '⁌', '⁍', '⁎', '⁏', '⁐', '⁑', '⁓', '⁔', '⁕', '⁖', '⁗', '⁘', '⁙', '⁚', '⁛', '⁜', '⁝', '⁞', '⁽', '⁾', '₍', '₎', '⌈', '⌉', '⌊', '⌋', '〈', '〉', '❨', '❩', '❪', '❫', '❬', '❭', '❮', '❯', '❰', '❱', '❲', '❳', '❴', '❵', '⟅', '⟆', '⟦', '⟧', '⟨', '⟩', '⟪', '⟫', '⟬', '⟭', '⟮', '⟯', '⦃', '⦄', '⦅', '⦆', '⦇', '⦈', '⦉', '⦊', '⦋', '⦌', '⦍', '⦎', '⦏', '⦐', '⦑', '⦒', '⦓', '⦔', '⦕', '⦖', '⦗', '⦘', '⧘', '⧙', '⧚', '⧛', '⧼', '⧽', '⳹', '⳺', '⳻', '⳼', '⳾', '⳿', '⵰', '⸀', '⸁', '⸂', '⸃', '⸄', '⸅', '⸆', '⸇', '⸈', '⸉', '⸊', '⸋', '⸌', '⸍', '⸎', '⸏', '⸐', '⸑', '⸒', '⸓', '⸔', '⸕', '⸖', '⸗', '⸘', '⸙', '⸚', '⸛', '⸜', '⸝', '⸞', '⸟', '⸠', '⸡', '⸢', '⸣', '⸤', '⸥', '⸦', '⸧', '⸨', '⸩', '⸪', '⸫', '⸬', '⸭', '⸮', '⸰', '⸱', '⸲', '⸳', '⸴', '⸵', '⸶', '⸷', '⸸', '⸹', '⸺', '⸻', '⸼', '⸽', '⸾', '⸿', '⹀', '⹁', '⹂', '⹃', '⹄', '⹅', '⹆', '⹇', '⹈', '⹉', '⹊', '⹋', '⹌', '⹍', '⹎', '⹏', '、', '。', '〃', '〈', '〉', '《', '》', '「', '」', '『', '』', '【', '】', '〔', '〕', '〖', '〗', '〘', '〙', '〚', '〛', '〜', '〝', '〞', '〟', '〰', '〽', '゠', '・', '꓾', '꓿', '꘍', '꘎', '꘏', '꙳', '꙾', '꛲', '꛳', '꛴', '꛵', '꛶', '꛷', '꡴', '꡵', '꡶', '꡷', '꣎', '꣏', '꣸', '꣹', '꣺', '꣼', '꤮', '꤯', '꥟', '꧁', '꧂', '꧃', '꧄', '꧅', '꧆', '꧇', '꧈', '꧉', '꧊', '꧋', '꧌', '꧍', '꧞', '꧟', '꩜', '꩝', '꩞', '꩟', '꫞', '꫟', '꫰', '꫱', '꯫', '﴾', '﴿', '︐', '︑', '︒', '︓', '︔', '︕', '︖', '︗', '︘', '︙', '︰', '︱', '︲', '︳', '︴', '︵', '︶', '︷', '︸', '︹', '︺', '︻', '︼', '︽', '︾', '︿', '﹀', '﹁', '﹂', '﹃', '﹄', '﹅', '﹆', '﹇', '﹈', '﹉', '﹊', '﹋', '﹌', '﹍', '﹎', '﹏', '﹐', '﹑', '﹒', '﹔', '﹕', '﹖', '﹗', '﹘', '﹙', '﹚', '﹛', '﹜', '﹝', '﹞', '﹟', '﹠', '﹡', '﹣', '﹨', '﹪', '﹫', '!', '"', '#', '%', '&', ''', '(', ')', '*', ',', '-', '.', '/', ':', ';', '?', '@', '[', '\', ']', '_', '{', '}', '⦅', '⦆', '。', '「', '」', '、', '・'};
//private static String[] longCharacters = new String[] {"𐄀", "𐄁", "𐄂", "𐎟", "𐏐", "𐕯", "𐡗", "𐤟", "𐤿", "𐩐", "𐩑", "𐩒", "𐩓", "𐩔", "𐩕", "𐩖", "𐩗", "𐩘", "𐩿", "𐫰", "𐫱", "𐫲", "𐫳", "𐫴", "𐫵", "𐫶", "𐬹", "𐬺", "𐬻", "𐬼", "𐬽", "𐬾", "𐬿", "𐮙", "𐮚", "𐮛", "𐮜", "𐽕", "𐽖", "𐽗", "𐽘", "𐽙", "𑁇", "𑁈", "𑁉", "𑁊", "𑁋", "𑁌", "𑁍", "𑂻", "𑂼", "𑂾", "𑂿", "𑃀", "𑃁", "𑅀", "𑅁", "𑅂", "𑅃", "𑅴", "𑅵", "𑇅", "𑇆", "𑇇", "𑇈", "𑇍", "𑇛", "𑇝", "𑇞", "𑇟", "𑈸", "𑈹", "𑈺", "𑈻", "𑈼", "𑈽", "𑊩", "𑑋", "𑑌", "𑑍", "𑑎", "𑑏", "𑑛", "𑑝", "𑓆", "𑗁", "𑗂", "𑗃", "𑗄", "𑗅", "𑗆", "𑗇", "𑗈", "𑗉", "𑗊", "𑗋", "𑗌", "𑗍", "𑗎", "𑗏", "𑗐", "𑗑", "𑗒", "𑗓", "𑗔", "𑗕", "𑗖", "𑗗", "𑙁", "𑙂", "𑙃", "𑙠", "𑙡", "𑙢", "𑙣", "𑙤", "𑙥", "𑙦", "𑙧", "𑙨", "𑙩", "𑙪", "𑙫", "𑙬", "𑜼", "𑜽", "𑜾", "𑠻", "𑧢", "𑨿", "𑩀", "𑩁", "𑩂", "𑩃", "𑩄", "𑩅", "𑩆", "𑪚", "𑪛", "𑪜", "𑪞", "𑪟", "𑪠", "𑪡", "𑪢", "𑱁", "𑱂", "𑱃", "𑱄", "𑱅", "𑱰", "𑱱", "𑻷", "𑻸", "𑿿", "𒑰", "𒑱", "𒑲", "𒑳", "𒑴", "𖩮", "𖩯", "𖫵", "𖬷", "𖬸", "𖬹", "𖬺", "𖬻", "𖭄", "𖺗", "𖺘", "𖺙", "𖺚", "𖿢", "𛲟", "𝪇", "𝪈", "𝪉", "𝪊", "𝪋", "𞥞", "𞥟"};
private static HashSet charactersMap;
@@ -5407,11 +5450,25 @@ public class AndroidUtilities {
public static boolean hasDialogOnTop(BaseFragment fragment) {
if (fragment == null) return false;
- if (fragment.visibleDialog != null) return true;
+ if (fragment.visibleDialog != null && !(fragment.visibleDialog instanceof AlertDialog) && !(
+ fragment.visibleDialog instanceof BottomSheet && ((BottomSheet) fragment.visibleDialog).attachedFragment != null
+ )) return true;
if (fragment.getParentLayout() == null) return false;
List globalViews = allGlobalViews();
if (globalViews == null || globalViews.isEmpty()) return false;
- View lastGlobalView = globalViews.get(globalViews.size() - 1);
+ View lastGlobalView = null;
+ for (int i = globalViews.size() - 1; i >= 0; --i) {
+ lastGlobalView = globalViews.get(i);
+ if (fragment.visibleDialog instanceof AlertDialog) {
+ if (lastGlobalView == getRootView((((AlertDialog) fragment.visibleDialog).getContainerView()))) {
+ continue;
+ }
+ }
+ if (!(
+ lastGlobalView instanceof AlertDialog.AlertDialogView ||
+ lastGlobalView instanceof PipRoundVideoView.PipFrameLayout
+ )) break;
+ }
return lastGlobalView != getRootView(fragment.getParentLayout().getView());
}
@@ -5464,7 +5521,7 @@ public class AndroidUtilities {
canvas.drawColor(Theme.getColor(Theme.key_windowBackgroundWhite));
for (int i = 0; i < finalViews.size(); ++i) {
View view = finalViews.get(i);
- if (view instanceof PipRoundVideoView.PipFrameLayout || view instanceof PipRoundVideoView.PipFrameLayout || (exclude != null && exclude.contains(view))) {
+ if (view instanceof PipRoundVideoView.PipFrameLayout || (exclude != null && exclude.contains(view))) {
continue;
}
@@ -5482,7 +5539,7 @@ public class AndroidUtilities {
try {
view.draw(canvas);
} catch (Exception e) {
-
+ FileLog.e(e);
}
canvas.restore();
}
@@ -5559,7 +5616,7 @@ public class AndroidUtilities {
private static Pattern uriParse;
- private static Pattern getURIParsePattern() {
+ public static Pattern getURIParsePattern() {
if (uriParse == null) {
uriParse = Pattern.compile("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"); // RFC 3986 B
}
@@ -5567,6 +5624,10 @@ public class AndroidUtilities {
}
public static String getHostAuthority(String uri) {
+ return getHostAuthority(uri, false);
+ }
+
+ public static String getHostAuthority(String uri, boolean removeWWW) {
if (uri == null) {
return null;
}
@@ -5577,6 +5638,9 @@ public class AndroidUtilities {
if (authority != null) {
authority = authority.toLowerCase();
}
+ if (removeWWW && authority != null && authority.startsWith("www.")) {
+ authority = authority.substring(4);
+ }
return authority;
}
return null;
@@ -5589,6 +5653,13 @@ public class AndroidUtilities {
return getHostAuthority(uri.toString());
}
+ public static String getHostAuthority(Uri uri, boolean removeWWW) {
+ if (uri == null) {
+ return null;
+ }
+ return getHostAuthority(uri.toString(), removeWWW);
+ }
+
public static boolean intersect1d(int x1, int x2, int y1, int y2) {
return Math.max(x1, x2) > Math.min(y1, y2) && Math.max(y1, y2) > Math.min(x1, x2);
}
@@ -5891,27 +5962,56 @@ public class AndroidUtilities {
} catch (Exception ignore) {}
}
- public static void applySpring(Animator anim, float stiffness, float damping) {
- applySpring(anim, stiffness, damping, 1);
+ public static void applySpring(Animator anim, double stiffness, double damping) {
+ applySpring(anim, stiffness, damping, 1, 0);
}
- public static void applySpring(Animator anim, float stiffness, float damping, float mass) {
- final double delta = damping / (2.0 * Math.sqrt(stiffness * mass));
- final double undampedFrequency = Math.sqrt(stiffness / mass);
- final double omega_0 = Math.sqrt(stiffness / mass);
- final double zeta = damping / (2 * Math.sqrt(stiffness * mass));
+ public static void applySpring(Animator anim, double stiffness, double damping, double mass) {
+ applySpring(anim, stiffness, damping, mass, 0);
+ }
+
+ public static void applySpring(Animator anim, double stiffness, double damping, double mass, double initialVelocity) {
+ final double w0 = Math.sqrt(stiffness / mass);
+ final double zeta = damping / (2.0 * Math.sqrt(stiffness * mass));
+ final double wd, A, B;
+ if (zeta < 1) {
+ wd = w0 * Math.sqrt(1.0 - zeta * zeta);
+ A = 1.0;
+ B = (zeta * w0 + -initialVelocity) / wd;
+ } else {
+ wd = 0.0;
+ A = 1.0;
+ B = -initialVelocity + w0;
+ }
final double threshold = 0.0025;
- final double duration = Math.log(threshold) / (-zeta * omega_0);
+ final double duration = Math.log(threshold) / (-zeta * w0);
anim.setDuration((long) (duration * 1000L));
anim.setInterpolator(new Interpolator() {
@Override
public float getInterpolation(float t) {
- if (delta < 1) {
- final double dampedFrequency = undampedFrequency * Math.sqrt(1 - delta * delta);
- return (float) (1 - Math.exp(-delta * undampedFrequency * t) *
- (Math.cos(dampedFrequency * t) + (delta * undampedFrequency / dampedFrequency) * Math.sin(dampedFrequency * t)));
+ if (zeta < 1) {
+ return (float) (1.0 - Math.exp(-t * zeta * w0) * (A * Math.cos(wd * t) + B * Math.sin(wd * t)));
} else {
- final double a = -delta * undampedFrequency * t;
+ return (float) (1.0 - (A + B * t) * Math.exp(-t * w0));
+ }
+ }
+ });
+ }
+
+ public static void applySpring(Animator anim, float stiffness, float damping, float mass, long overrideDuration) {
+ final double zeta = damping / (2 * Math.sqrt(stiffness * mass));
+ final double omega = Math.sqrt(stiffness / mass);
+ final double threshold = 0.0025;
+ anim.setDuration(overrideDuration);
+ anim.setInterpolator(new Interpolator() {
+ @Override
+ public float getInterpolation(float t) {
+ if (zeta < 1) {
+ final double dampedFrequency = omega * Math.sqrt(1 - zeta * zeta);
+ return (float) (1 - Math.exp(-zeta * omega * t) *
+ (Math.cos(dampedFrequency * t) + (zeta * omega / dampedFrequency) * Math.sin(dampedFrequency * t)));
+ } else {
+ final double a = -zeta * omega * t;
return (float) (1 - (1 + a) * Math.exp(a));
}
}
@@ -5942,9 +6042,9 @@ public class AndroidUtilities {
if (segments.size() >= 3 && "s".equals(segments.get(1))) {
return false;
} else if (segments.size() > 1) {
- final String segment = segments.get(1);
- if (TextUtils.isEmpty(segment)) return false;
- switch (segment) {
+ final String segment0 = segments.get(0);
+ if (TextUtils.isEmpty(segment0)) return false;
+ switch (segment0) {
case "joinchat":
case "login":
case "addstickers":
@@ -5961,6 +6061,9 @@ public class AndroidUtilities {
case "addlist":
return false;
}
+ final String segment1 = segments.get(1);
+ if (TextUtils.isEmpty(segment1)) return false;
+ if (segment1.matches("^\\d+$")) return false;
return true;
} else if (segments.size() == 1) {
return !TextUtils.isEmpty(uri.getQueryParameter("startapp"));
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ApplicationLoader.java b/TMessagesProj/src/main/java/org/telegram/messenger/ApplicationLoader.java
index 5f0d8d1d1..1dadb79a7 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/ApplicationLoader.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/ApplicationLoader.java
@@ -638,5 +638,4 @@ public class ApplicationLoader extends Application {
public BaseFragment openSettings(int n) {
return null;
}
-
}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/BillingController.java b/TMessagesProj/src/main/java/org/telegram/messenger/BillingController.java
index d97777a8c..407b28a7c 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/BillingController.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/BillingController.java
@@ -192,7 +192,7 @@ public class BillingController implements PurchasesUpdatedListener, BillingClien
return;
}
- if ((paymentPurpose instanceof TLRPC.TL_inputStorePaymentGiftPremium || paymentPurpose instanceof TLRPC.TL_inputStorePaymentStars) && !checkedConsume) {
+ if ((paymentPurpose instanceof TLRPC.TL_inputStorePaymentGiftPremium || paymentPurpose instanceof TLRPC.TL_inputStorePaymentStarsTopup || paymentPurpose instanceof TLRPC.TL_inputStorePaymentStarsGift) && !checkedConsume) {
queryPurchases(BillingClient.ProductType.INAPP, (billingResult, list) -> {
if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK) {
Runnable callback = () -> launchBillingFlow(activity, accountInstance, paymentPurpose, productDetails, subscriptionUpdateParams, true);
@@ -244,7 +244,8 @@ public class BillingController implements PurchasesUpdatedListener, BillingClien
if (subscriptionUpdateParams != null) {
flowParams.setSubscriptionUpdateParams(subscriptionUpdateParams);
}
- int responseCode = billingClient.launchBillingFlow(activity, flowParams.build()).getResponseCode();
+ final BillingResult result = billingClient.launchBillingFlow(activity, flowParams.build());
+ int responseCode = result.getResponseCode();
if (responseCode != BillingClient.BillingResponseCode.OK) {
FileLog.d("Billing: Launch Error: " + responseCode + ", " + obfuscatedAccountId + ", " + obfuscatedData);
}
@@ -281,41 +282,40 @@ public class BillingController implements PurchasesUpdatedListener, BillingClien
if (!purchase.isAcknowledged()) {
requestingTokens.add(purchase.getPurchaseToken());
- retrievePurpose(purchase, opayload, payload -> {
- TLRPC.TL_payments_assignPlayMarketTransaction req = new TLRPC.TL_payments_assignPlayMarketTransaction();
- req.receipt = new TLRPC.TL_dataJSON();
- req.receipt.data = purchase.getOriginalJson();
- req.purpose = payload.second;
+ TLRPC.TL_payments_assignPlayMarketTransaction req = new TLRPC.TL_payments_assignPlayMarketTransaction();
+ req.receipt = new TLRPC.TL_dataJSON();
+ req.receipt.data = purchase.getOriginalJson();
+ req.purpose = opayload.second;
- final AlertDialog progressDialog = new AlertDialog(ApplicationLoader.applicationContext, AlertDialog.ALERT_TYPE_SPINNER);
- AndroidUtilities.runOnUIThread(() -> progressDialog.showDelayed(500));
+ final AlertDialog progressDialog = new AlertDialog(ApplicationLoader.applicationContext, AlertDialog.ALERT_TYPE_SPINNER);
+ AndroidUtilities.runOnUIThread(() -> progressDialog.showDelayed(500));
- AccountInstance acc = payload.first;
- acc.getConnectionsManager().sendRequest(req, (response, error) -> {
- AndroidUtilities.runOnUIThread(progressDialog::dismiss);
+ AccountInstance acc = opayload.first;
+ acc.getConnectionsManager().sendRequest(req, (response, error) -> {
+ AndroidUtilities.runOnUIThread(progressDialog::dismiss);
- requestingTokens.remove(purchase.getPurchaseToken());
+ requestingTokens.remove(purchase.getPurchaseToken());
- if (response instanceof TLRPC.Updates) {
- acc.getMessagesController().processUpdates((TLRPC.Updates) response, false);
+ if (response instanceof TLRPC.Updates) {
+ acc.getMessagesController().processUpdates((TLRPC.Updates) response, false);
- for (String productId : purchase.getProducts()) {
- Consumer listener = resultListeners.remove(productId);
- if (listener != null) {
- listener.accept(billing);
- }
+ for (String productId : purchase.getProducts()) {
+ Consumer listener = resultListeners.remove(productId);
+ if (listener != null) {
+ listener.accept(billing);
}
-
- consumeGiftPurchase(purchase, req.purpose);
- } else if (error != null) {
- if (onCanceled != null) {
- onCanceled.run();
- onCanceled = null;
- }
- NotificationCenter.getGlobalInstance().postNotificationNameOnUIThread(NotificationCenter.billingConfirmPurchaseError, req, error);
}
- }, ConnectionsManager.RequestFlagFailOnServerErrors | ConnectionsManager.RequestFlagFailOnServerErrorsExceptFloodWait | ConnectionsManager.RequestFlagInvokeAfter);
- });
+
+ consumeGiftPurchase(purchase, req.purpose);
+ BillingUtilities.cleanupPurchase(purchase);
+ } else if (error != null) {
+ if (onCanceled != null) {
+ onCanceled.run();
+ onCanceled = null;
+ }
+ NotificationCenter.getGlobalInstance().postNotificationNameOnUIThread(NotificationCenter.billingConfirmPurchaseError, req, error);
+ }
+ }, ConnectionsManager.RequestFlagFailOnServerErrors | ConnectionsManager.RequestFlagFailOnServerErrorsExceptFloodWait | ConnectionsManager.RequestFlagInvokeAfter);
} else {
consumeGiftPurchase(purchase, opayload.second);
}
@@ -323,93 +323,6 @@ public class BillingController implements PurchasesUpdatedListener, BillingClien
}
}
- private boolean retrievePurpose(Purchase purchase, Pair payload, Utilities.Callback> whenPayload) {
- if (payload == null || payload.first == null) {
- FileLog.d("retrievePurpose: payload or account is null");
- return false;
- }
- if (payload.second != null) {
- FileLog.d("retrievePurpose: already has purpose");
- whenPayload.run(payload);
- return true;
- }
- if (purchase == null || purchase.getProducts().isEmpty()) {
- FileLog.d("retrievePurpose: no products found for purpose!");
- whenPayload.run(payload);
- return false;
- } else {
- final int currentAccount = payload.first.getCurrentAccount();
- final String productId = purchase.getProducts().get(0);
-
- if (productId == null) {
- FileLog.d("retrievePurpose: first product is null!");
- whenPayload.run(payload);
- return false;
- }
-
- ArrayList options = StarsController.getInstance(currentAccount).getOptionsCached();
- if (options == null) {
- ConnectionsManager.getInstance(currentAccount).sendRequest(new TLRPC.TL_payments_getStarsTopupOptions(), (res, err) -> AndroidUtilities.runOnUIThread(() -> {
- ArrayList loadedOptions = new ArrayList<>();
- if (res instanceof TLRPC.Vector) {
- TLRPC.Vector vector = (TLRPC.Vector) res;
- for (Object object : vector.objects) {
- if (object instanceof TLRPC.TL_starsTopupOption) {
- TLRPC.TL_starsTopupOption option = (TLRPC.TL_starsTopupOption) object;
- loadedOptions.add(option);
- }
- }
- } else if (err != null) {
- FileLog.d("retrievePopup: getStarsTopupOptions gives error! " + err.code + ": " + err.text);
- }
-
- TLRPC.TL_starsTopupOption foundOption = null;
- for (int i = 0; i < loadedOptions.size(); ++i) {
- if (productId.equals(loadedOptions.get(i).store_product)) {
- foundOption = loadedOptions.get(i);
- break;
- }
- }
-
- if (foundOption != null) {
- TLRPC.TL_inputStorePaymentStars purpose = new TLRPC.TL_inputStorePaymentStars();
- purpose.amount = foundOption.amount;
- purpose.currency = foundOption.currency;
- purpose.stars = foundOption.stars;
- FileLog.d("retrievePurpose: found stars option of " + productId + " from stars loaded options!");
- whenPayload.run(new Pair(payload.first, purpose));
- } else {
- FileLog.d("retrievePurpose: failed to find option of " + productId + " from stars loaded options");
- whenPayload.run(payload);
- }
- }));
- return true;
- } else {
- TLRPC.TL_starsTopupOption foundOption = null;
- for (int i = 0; i < options.size(); ++i) {
- if (productId.equals(options.get(i).store_product)) {
- foundOption = options.get(i);
- break;
- }
- }
-
- if (foundOption != null) {
- TLRPC.TL_inputStorePaymentStars purpose = new TLRPC.TL_inputStorePaymentStars();
- purpose.amount = foundOption.amount;
- purpose.currency = foundOption.currency;
- purpose.stars = foundOption.stars;
- FileLog.d("retrievePurpose: found stars option of " + productId + " from stars options!");
- whenPayload.run(new Pair(payload.first, purpose));
- return true;
- } else {
- FileLog.d("retrievePurpose: failed to find option of " + productId + " from stars options");
- whenPayload.run(payload);
- return false;
- }
- }
- }
- }
-
/**
* All consumable purchases must be consumed. For us it is a gift.
* Without confirmation the user will not be able to buy the product again.
@@ -417,7 +330,8 @@ public class BillingController implements PurchasesUpdatedListener, BillingClien
private void consumeGiftPurchase(Purchase purchase, TLRPC.InputStorePaymentPurpose purpose) {
if (purpose instanceof TLRPC.TL_inputStorePaymentGiftPremium
|| purpose instanceof TLRPC.TL_inputStorePaymentPremiumGiftCode
- || purpose instanceof TLRPC.TL_inputStorePaymentStars
+ || purpose instanceof TLRPC.TL_inputStorePaymentStarsTopup
+ || purpose instanceof TLRPC.TL_inputStorePaymentStarsGift
|| purpose instanceof TLRPC.TL_inputStorePaymentPremiumGiveaway) {
billingClient.consumeAsync(
ConsumeParams.newBuilder()
@@ -510,18 +424,19 @@ public class BillingController implements PurchasesUpdatedListener, BillingClien
public static String getResponseCodeString(int code) {
switch (code) {
- case -3: return "SERVICE_TIMEOUT";
- case -2: return "FEATURE_NOT_SUPPORTED";
- case -1: return "SERVICE_DISCONNECTED";
- case 0: return "OK";
- case 1: return "USER_CANCELED";
- case 2: return "SERVICE_UNAVAILABLE";
- case 3: return "BILLING_UNAVAILABLE";
- case 4: return "ITEM_UNAVAILABLE";
- case 5: return "DEVELOPER_ERROR";
- case 6: return "ERROR";
- case 7: return "ITEM_ALREADY_OWNED";
- case 8: return "ITEM_NOT_OWNED";
+ case BillingClient.BillingResponseCode.SERVICE_TIMEOUT: return "SERVICE_TIMEOUT";
+ case BillingClient.BillingResponseCode.FEATURE_NOT_SUPPORTED: return "FEATURE_NOT_SUPPORTED";
+ case BillingClient.BillingResponseCode.SERVICE_DISCONNECTED: return "SERVICE_DISCONNECTED";
+ case BillingClient.BillingResponseCode.OK: return "OK";
+ case BillingClient.BillingResponseCode.USER_CANCELED: return "USER_CANCELED";
+ case BillingClient.BillingResponseCode.SERVICE_UNAVAILABLE: return "SERVICE_UNAVAILABLE";
+ case BillingClient.BillingResponseCode.BILLING_UNAVAILABLE: return "BILLING_UNAVAILABLE";
+ case BillingClient.BillingResponseCode.ITEM_UNAVAILABLE: return "ITEM_UNAVAILABLE";
+ case BillingClient.BillingResponseCode.DEVELOPER_ERROR: return "DEVELOPER_ERROR";
+ case BillingClient.BillingResponseCode.ERROR: return "ERROR";
+ case BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED: return "ITEM_ALREADY_OWNED";
+ case BillingClient.BillingResponseCode.ITEM_NOT_OWNED: return "ITEM_NOT_OWNED";
+ case BillingClient.BillingResponseCode.NETWORK_ERROR: return "NETWORK_ERROR";
}
return null;
}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ChatObject.java b/TMessagesProj/src/main/java/org/telegram/messenger/ChatObject.java
index 51212a0de..420f4106a 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/ChatObject.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/ChatObject.java
@@ -1782,7 +1782,7 @@ public class ChatObject {
}
public static boolean canSendAsPeers(TLRPC.Chat chat) {
- return ChatObject.isChannel(chat) && chat.megagroup && (ChatObject.isPublic(chat) || chat.has_geo || chat.has_link);
+ return ChatObject.isChannel(chat) && (!chat.megagroup && chat.signatures && ChatObject.hasAdminRights(chat) && ChatObject.canWriteToChat(chat) || chat.megagroup && (ChatObject.isPublic(chat) || chat.has_geo || chat.has_link));
}
public static boolean isChannel(TLRPC.Chat chat) {
@@ -1943,6 +1943,9 @@ public class ChatObject {
if (chat != null && chat.admin_rights != null && chat.admin_rights.anonymous) {
return invertChannel ? -chat.id : chat.id;
}
+ if (chat != null && ChatObject.isChannelAndNotMegaGroup(chat) && !chat.signatures) {
+ return invertChannel ? -chat.id : chat.id;
+ }
return UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId();
}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/CodeHighlighting.java b/TMessagesProj/src/main/java/org/telegram/messenger/CodeHighlighting.java
index 201dfe5c6..00644f532 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/CodeHighlighting.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/CodeHighlighting.java
@@ -309,7 +309,7 @@ public class CodeHighlighting {
for (int i = 0; i < patterns.length; ++i) {
if (patterns[i].pattern != null && "REST".equals(patterns[i].pattern.patternSource)) {
if (result == null) {
- result = new ArrayList<>();
+ result = new ArrayList();
Collections.addAll(result, patterns);
}
result.remove(patterns[i]);
@@ -447,7 +447,7 @@ public class CodeHighlighting {
}
private static Match matchPattern(TokenPattern pattern, int pos, String text) {
- Matcher matcher = pattern.pattern.getPattern(). matcher(text);
+ Matcher matcher = pattern.pattern.getPattern().matcher(text);
matcher.region(pos, text.length());
if (!matcher.find()) {
return null;
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/DownloadController.java b/TMessagesProj/src/main/java/org/telegram/messenger/DownloadController.java
index 64197de0a..adfd4c505 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/DownloadController.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/DownloadController.java
@@ -610,6 +610,11 @@ public class DownloadController extends BaseController implements NotificationCe
}
return true;
}
+ if (messageObject.sponsoredMedia != null) {
+ return true;
+ }
+ if (messageObject.isHiddenSensitive())
+ return false;
return canDownloadMedia(messageObject.messageOwner) == 1;
}
@@ -793,7 +798,7 @@ public class DownloadController extends BaseController implements NotificationCe
} else {
maxSize = preset.sizes[typeToIndex(type)];
}
- long size = MessageObject.getMessageSize(message);
+ long size = MessageObject.getMediaSize(media);
if (isVideo && preset.preloadVideo && size > maxSize && maxSize > 2 * 1024 * 1024) {
return (mask & type) != 0 ? 2 : 0;
} else {
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Emoji.java b/TMessagesProj/src/main/java/org/telegram/messenger/Emoji.java
index 3f581487b..ff87d77ea 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/Emoji.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/Emoji.java
@@ -270,7 +270,7 @@ public class Emoji {
}
public static abstract class EmojiDrawable extends Drawable {
- boolean fullSize = false;
+ public boolean fullSize = false;
int placeholderColor = 0x10000000;
public boolean isLoaded() {
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java
index 9b0d0c80f..608bbaf45 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java
@@ -706,7 +706,7 @@ public class FileLoader extends BaseController {
for (FileLoadOperation operation : loadOperationPaths.values()) {
if (operation == null || operation.requestInfos == null) continue;
for (FileLoadOperation.RequestInfo requestInfo : operation.requestInfos) {
- if (requestInfo.requestToken == requestToken) {
+ if (requestInfo != null && requestInfo.requestToken == requestToken) {
return operation;
}
}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FileRefController.java b/TMessagesProj/src/main/java/org/telegram/messenger/FileRefController.java
index 1ed983c25..01a98db85 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/FileRefController.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/FileRefController.java
@@ -1,13 +1,14 @@
package org.telegram.messenger;
import android.os.SystemClock;
-import android.util.Log;
import org.telegram.tgnet.RequestDelegate;
import org.telegram.tgnet.TLObject;
import org.telegram.tgnet.TLRPC;
+import org.telegram.tgnet.tl.TL_bots;
import org.telegram.tgnet.tl.TL_stories;
import org.telegram.ui.ActionBar.Theme;
+import org.telegram.ui.Stories.StoriesController;
import java.util.ArrayList;
import java.util.Arrays;
@@ -70,7 +71,20 @@ public class FileRefController extends BaseController {
}
public static String getKeyForParentObject(Object parentObject) {
- if (parentObject instanceof TL_stories.StoryItem) {
+ if (parentObject instanceof StoriesController.BotPreview) {
+ StoriesController.BotPreview storyItem = (StoriesController.BotPreview) parentObject;
+ if (storyItem.list == null) {
+ FileLog.d("failed request reference can't find list in botpreview");
+ return null;
+ }
+ if (storyItem.media.document != null) {
+ return "botstory_doc_" + storyItem.media.document.id;
+ } else if (storyItem.media.photo != null) {
+ return "botstory_photo_" + storyItem.media.photo.id;
+ } else {
+ return "botstory_" + storyItem.id;
+ }
+ } else if (parentObject instanceof TL_stories.StoryItem) {
TL_stories.StoryItem storyItem = (TL_stories.StoryItem) parentObject;
if (storyItem.dialogId == 0) {
FileLog.d("failed request reference can't find dialogId");
@@ -81,8 +95,8 @@ public class FileRefController extends BaseController {
return "premium_promo";
} else if (parentObject instanceof TLRPC.TL_availableReaction) {
return "available_reaction_" + ((TLRPC.TL_availableReaction) parentObject).reaction;
- } else if (parentObject instanceof TLRPC.BotInfo) {
- TLRPC.BotInfo botInfo = (TLRPC.BotInfo) parentObject;
+ } else if (parentObject instanceof TL_bots.BotInfo) {
+ TL_bots.BotInfo botInfo = (TL_bots.BotInfo) parentObject;
return "bot_info_" + botInfo.user_id;
} else if (parentObject instanceof TLRPC.TL_attachMenuBot) {
TLRPC.TL_attachMenuBot bot = (TLRPC.TL_attachMenuBot) parentObject;
@@ -137,7 +151,21 @@ public class FileRefController extends BaseController {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("start loading request reference parent " + getObjectString(parentObject) + " args = " + args[0]);
}
- if (args[0] instanceof TL_stories.TL_storyItem) {
+ if (args[0] instanceof StoriesController.BotPreview) {
+ StoriesController.BotPreview storyItem = (StoriesController.BotPreview) args[0];
+ if (storyItem.media.document != null) {
+ location = new TLRPC.TL_inputDocumentFileLocation();
+ location.id = storyItem.media.document.id;
+ locationKey = "botstory_doc_" + storyItem.media.document.id;
+ } else if (storyItem.media.photo != null) {
+ location = new TLRPC.TL_inputPhotoFileLocation();
+ location.id = storyItem.media.photo.id;
+ locationKey = "botstory_photo_" + storyItem.media.photo.id;
+ } else {
+ locationKey = "botstory_" + storyItem.id;
+ location = new TLRPC.TL_inputDocumentFileLocation();
+ }
+ } else if (args[0] instanceof TL_stories.TL_storyItem) {
TL_stories.TL_storyItem storyItem = (TL_stories.TL_storyItem) args[0];
locationKey = "story_" + storyItem.id;
location = new TLRPC.TL_inputDocumentFileLocation();
@@ -401,7 +429,18 @@ public class FileRefController extends BaseController {
}
private void requestReferenceFromServer(Object parentObject, String locationKey, String parentKey, Object[] args) {
- if (parentObject instanceof TL_stories.StoryItem) {
+ if (parentObject instanceof StoriesController.BotPreview) {
+ StoriesController.BotPreview storyItem = (StoriesController.BotPreview) parentObject;
+ if (storyItem.list == null) {
+ sendErrorToObject(args, 0);
+ return;
+ }
+ storyItem.list.requestReference(storyItem, newStoryItem -> {
+ Utilities.stageQueue.postRunnable(() -> {
+ onRequestComplete(locationKey, parentKey, newStoryItem, null, true, false);
+ });
+ });
+ } else if (parentObject instanceof TL_stories.StoryItem) {
TL_stories.StoryItem storyItem = (TL_stories.StoryItem) parentObject;
TL_stories.TL_stories_getStoriesByID req = new TL_stories.TL_stories_getStoriesByID();
req.peer = getMessagesController().getInputPeer(storyItem.dialogId);
@@ -424,8 +463,8 @@ public class FileRefController extends BaseController {
TLRPC.TL_messages_getAvailableReactions req = new TLRPC.TL_messages_getAvailableReactions();
req.hash = 0;
getConnectionsManager().sendRequest(req, (response, error) -> onRequestComplete(locationKey, parentKey, response, error, true, false));
- } else if (parentObject instanceof TLRPC.BotInfo) {
- TLRPC.BotInfo botInfo = (TLRPC.BotInfo) parentObject;
+ } else if (parentObject instanceof TL_bots.BotInfo) {
+ TL_bots.BotInfo botInfo = (TL_bots.BotInfo) parentObject;
TLRPC.TL_users_getFullUser req = new TLRPC.TL_users_getFullUser();
req.id = getMessagesController().getInputUser(botInfo.user_id);
getConnectionsManager().sendRequest(req, (response, error) -> onRequestComplete(locationKey, parentKey, response, error, true, false));
@@ -909,7 +948,14 @@ public class FileRefController extends BaseController {
needReplacement = new boolean[1];
}
requester.completed = true;
- if (response instanceof TLRPC.messages_Messages) {
+ if (response instanceof StoriesController.BotPreview) {
+ StoriesController.BotPreview newStoryItem = (StoriesController.BotPreview) response;
+ if (newStoryItem.media.document != null) {
+ result = getFileReference(newStoryItem.media.document, requester.location, needReplacement, locationReplacement);
+ } else if (newStoryItem.media.photo != null) {
+ result = getFileReference(newStoryItem.media.photo, requester.location, needReplacement, locationReplacement);
+ }
+ } else if (response instanceof TLRPC.messages_Messages) {
TLRPC.messages_Messages res = (TLRPC.messages_Messages) response;
if (!res.messages.isEmpty()) {
for (int i = 0, size3 = res.messages.size(); i < size3; i++) {
@@ -1020,7 +1066,7 @@ public class FileRefController extends BaseController {
getMessagesController().putUsers(usersFull.users, false);
getMessagesController().putChats(usersFull.chats, false);
TLRPC.UserFull userFull = usersFull.full_user;
- TLRPC.BotInfo botInfo = userFull.bot_info;
+ TL_bots.BotInfo botInfo = userFull.bot_info;
if (botInfo != null) {
getMessagesStorage().updateUserInfo(userFull, true);
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java b/TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java
index f041026ef..0765b1486 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/ImageLoader.java
@@ -32,7 +32,6 @@ import android.os.Environment;
import android.os.SystemClock;
import android.provider.MediaStore;
import android.text.TextUtils;
-import android.util.Log;
import android.util.Pair;
import android.util.SparseArray;
@@ -101,7 +100,6 @@ import java.util.zip.GZIPInputStream;
* firstframe - return firstframe for Lottie or Video animation
* ignoreOrientation - do not extract EXIF orientation and do not apply it to an imagereceiver
* exif — check exif contents of invert/orientation
- * bnb — airbnb canvas lottie impl
*/
public class ImageLoader {
@@ -1022,11 +1020,10 @@ public class ImageLoader {
cacheOptions.firstFrame = true;
}
}
- final boolean airbnb = cacheImage.filter != null && cacheImage.filter.contains("bnb");
if (compressed) {
- lottieDrawable = new RLottieDrawable(cacheImage.finalFilePath, decompressGzip(cacheImage.finalFilePath), w, h, cacheOptions, limitFps, null, fitzModifier, airbnb);
+ lottieDrawable = new RLottieDrawable(cacheImage.finalFilePath, decompressGzip(cacheImage.finalFilePath), w, h, cacheOptions, limitFps, null, fitzModifier);
} else {
- lottieDrawable = new RLottieDrawable(cacheImage.finalFilePath, w, h, cacheOptions, limitFps, null, fitzModifier, airbnb);
+ lottieDrawable = new RLottieDrawable(cacheImage.finalFilePath, w, h, cacheOptions, limitFps, null, fitzModifier);
}
}
if (lastFrameBitmap || firstFrameBitmap) {
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ImageReceiver.java b/TMessagesProj/src/main/java/org/telegram/messenger/ImageReceiver.java
index 0bf248556..855e04fd6 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/ImageReceiver.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/ImageReceiver.java
@@ -2659,8 +2659,8 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
public void setEmojiPaused(boolean paused) {
if (emojiPaused == paused) return;
emojiPaused = paused;
- RLottieDrawable rLottieDrawable = getLottieAnimation();
allowStartLottieAnimation = !paused;
+ RLottieDrawable rLottieDrawable = getLottieAnimation();
if (rLottieDrawable != null) {
if (paused) {
rLottieDrawable.stop();
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/LinkifyPort.java b/TMessagesProj/src/main/java/org/telegram/messenger/LinkifyPort.java
index 1e361830c..6be30c044 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/LinkifyPort.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/LinkifyPort.java
@@ -6,7 +6,7 @@ public class LinkifyPort {
private static String IANA_TOP_LEVEL_DOMAINS =
"(?:"
- + "(?:aaa|aarp|abb|abbott|abogado|academy|accenture|accountant|accountants|aco|active"
+ + "(?:aaa|adnl|aarp|abb|abbott|abogado|academy|accenture|accountant|accountants|aco|active"
+ "|actor|ads|adult|aeg|aero|afl|agency|aig|airforce|airtel|allfinanz|alsace|amica|amsterdam"
+ "|android|apartments|app|apple|aquarelle|aramco|archi|army|arpa|arte|asia|associates"
+ "|attorney|auction|audio|auto|autos|axa|azure|a[cdefgilmoqrstuwxz])"
@@ -67,7 +67,7 @@ public class LinkifyPort {
+ "|sky|skype|sncf|soccer|social|software|sohu|solar|solutions|sony|soy|space|spiegel|spreadbetting"
+ "|srl|stada|starhub|statoil|stc|stcgroup|stockholm|studio|study|style|sucks|supplies"
+ "|supply|support|surf|surgery|suzuki|swatch|swiss|sydney|systems|s[abcdeghijklmnortuvxyz])"
- + "|(?:tab|taipei|tatamotors|tatar|tattoo|tax|taxi|team|tech|technology|tel|telefonica"
+ + "|(?:ton|tab|taipei|tatamotors|tatar|tattoo|tax|taxi|team|tech|technology|tel|telefonica"
+ "|temasek|tennis|thd|theater|theatre|tickets|tienda|tips|tires|tirol|today|tokyo|tools"
+ "|top|toray|toshiba|tours|town|toyota|toys|trade|trading|training|travel|trust|tui|t[cdfghjklmnortvwz])"
+ "|(?:ubs|university|uno|uol|u[agksyz])"
@@ -168,13 +168,13 @@ public class LinkifyPort {
private static final String LABEL_CHAR = "a-zA-Z0-9" + UCS_CHAR_FIXED;
private static final String IRI_LABEL = "[" + LABEL_CHAR + "](?:[" + LABEL_CHAR + "_\\-]{0,61}[" + LABEL_CHAR + "]){0,1}";
private static String STRICT_TLD = "(?:" + IANA_TOP_LEVEL_DOMAINS + "|" + PUNYCODE_TLD + ")";
- private static final String STRICT_HOST_NAME = "(?:(?:" + IRI_LABEL + "\\.)+" + STRICT_TLD + ")";
+ public static final String STRICT_HOST_NAME = "(?:(?:" + IRI_LABEL + "\\.)+" + STRICT_TLD + ")";
private static final String STRICT_DOMAIN_NAME = "(?:" + STRICT_HOST_NAME + "|" + IP_ADDRESS_STRING + ")";
private static final String TLD = "(" + PUNYCODE_TLD + "|" + "[" + TLD_CHAR + "]{2,63}" + ")";
private static final String HOST_NAME = "(" + IRI_LABEL + "\\.)+" + TLD;
private static final String DOMAIN_NAME_STR = "(" + HOST_NAME + "|" + IP_ADDRESS_STRING + ")";
private static final Pattern DOMAIN_NAME = Pattern.compile(DOMAIN_NAME_STR);
- private static final String PROTOCOL = "(?i:http|https|ton|tg)://";
+ private static final String PROTOCOL = "(?i:http|https|ton|tg|tonsite)://";
private static final String WORD_BOUNDARY = "(?:\\b|$|^)";
private static final String USER_INFO = "(?:[a-zA-Z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)"
+ "\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,64}(?:\\:(?:[a-zA-Z0-9\\$\\-\\_"
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java b/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java
index d8d925279..75e8bc352 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java
@@ -1394,13 +1394,22 @@ public class LocaleController {
if (TextUtils.isEmpty(key)) {
return "LOC_ERR:" + key;
}
- int resourceId = ApplicationLoader.applicationContext.getResources().getIdentifier(key, "string", ApplicationLoader.applicationContext.getPackageName());
+ int resourceId = getStringResId(key);
if (resourceId != 0) {
return getString(key, resourceId);
}
return getServerString(key);
}
+ public static int getStringResId(String key) {
+ return ApplicationLoader.applicationContext.getResources().getIdentifier(key, "string", ApplicationLoader.applicationContext.getPackageName());
+ }
+
+ public static String nullable(String val) {
+ if (val == null || val.startsWith("LOC_ERR")) return null;
+ return val;
+ }
+
public static String getPluralString(String key, int plural) {
if (key == null || key.length() == 0 || getInstance().currentPluralRules == null) {
return "LOC_ERR:" + key;
@@ -1515,7 +1524,7 @@ public class LocaleController {
if (BuildVars.USE_CLOUD_STRINGS && fallback != null) {
value = getInstance().localeValues.get(fallback);
}
- if (value == null) {
+ if (value == null && res != 0) {
try {
value = ApplicationLoader.applicationContext.getString(res);
} catch (Exception e) {
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java
index 3b7e20502..4a8d75f9d 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java
@@ -5006,6 +5006,36 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
return "";
}
+ public static File createFileInCache(String name, String ext) {
+ File f = null;
+ try {
+ f = AndroidUtilities.getSharingDirectory();
+ f.mkdirs();
+ if (AndroidUtilities.isInternalUri(Uri.fromFile(f))) {
+ return null;
+ }
+ int count = 0;
+ do {
+ f = AndroidUtilities.getSharingDirectory();
+ if (count == 0) {
+ f = new File(f, name);
+ } else {
+ int lastDotIndex = name.lastIndexOf(".");
+ if (lastDotIndex > 0) {
+ f = new File(f, name.substring(0, lastDotIndex) + " (" + count + ")" + name.substring(lastDotIndex));
+ } else {
+ f = new File(f, name + " (" + count + ")");
+ }
+ }
+ count++;
+ } while (f.exists());
+ return f;
+ } catch (Exception e) {
+ FileLog.e(e);
+ }
+ return null;
+ }
+
public static String copyFileToCache(Uri uri, String ext) {
return copyFileToCache(uri, ext, -1);
}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java
index 781b0fc0b..1380c6222 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java
@@ -58,6 +58,7 @@ import org.telegram.tgnet.RequestDelegate;
import org.telegram.tgnet.SerializedData;
import org.telegram.tgnet.TLObject;
import org.telegram.tgnet.TLRPC;
+import org.telegram.tgnet.tl.TL_bots;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.EmojiThemes;
import org.telegram.ui.ActionBar.Theme;
@@ -387,9 +388,11 @@ public class MediaDataController extends BaseController {
loaded = false;
hints.clear();
inlineBots.clear();
+ webapps.clear();
AndroidUtilities.runOnUIThread(() -> {
getNotificationCenter().postNotificationName(NotificationCenter.reloadHints);
getNotificationCenter().postNotificationName(NotificationCenter.reloadInlineHints);
+ getNotificationCenter().postNotificationName(NotificationCenter.reloadWebappsHints);
});
drafts.clear();
@@ -3960,7 +3963,7 @@ public class MediaDataController extends BaseController {
}
};
if (isSaved) {
- loadReplyMessagesForMessages(messageObjects, dialogId, 0, lastReplyMessageId, done, guid);
+ loadReplyMessagesForMessages(messageObjects, dialogId, 0, lastReplyMessageId, done, guid, null);
} else {
done.run();
}
@@ -4322,7 +4325,7 @@ public class MediaDataController extends BaseController {
if (res != null && res.messages != null) {
messagesCount = res.messages.size();
}
- FileLog.d("process load media messagesCount " + messagesCount + " did " + dialogId + " topicId " + topicId + " count = " + count + " max_id=" + max_id + " min_id=" + min_id + " type = " + type + " cache = " + fromCache + " classGuid = " + classGuid);
+ FileLog.d("process load media messagesCount " + messagesCount + " did " + dialogId + " topicId " + topicId + " count = " + count + " max_id=" + max_id + " min_id=" + min_id + " type = " + type + " cache = " + fromCache + " classGuid = " + classGuid + " topReached=" + topReached);
}
if (fromCache != 0 && res != null && res.messages != null && ((res.messages.isEmpty() && min_id == 0) || (res.messages.size() <= 1 && min_id != 0)) && !DialogObject.isEncryptedDialog(dialogId)) {
if (fromCache == 2) {
@@ -4821,6 +4824,7 @@ public class MediaDataController extends BaseController {
public ArrayList hints = new ArrayList<>();
public ArrayList inlineBots = new ArrayList<>();
+ public ArrayList webapps = new ArrayList<>();
boolean loaded;
boolean loading;
@@ -5030,6 +5034,7 @@ public class MediaDataController extends BaseController {
getMessagesStorage().getStorageQueue().postRunnable(() -> {
ArrayList hintsNew = new ArrayList<>();
ArrayList inlineBotsNew = new ArrayList<>();
+ ArrayList webappsNew = new ArrayList<>();
ArrayList users = new ArrayList<>();
ArrayList chats = new ArrayList<>();
long selfUserId = getUserConfig().getClientUserId();
@@ -5058,6 +5063,8 @@ public class MediaDataController extends BaseController {
hintsNew.add(peer);
} else if (type == 1) {
inlineBotsNew.add(peer);
+ } else if (type == 2) {
+ webappsNew.add(peer);
}
}
cursor.dispose();
@@ -5075,10 +5082,12 @@ public class MediaDataController extends BaseController {
loaded = true;
hints = hintsNew;
inlineBots = inlineBotsNew;
+ webapps = webappsNew;
buildShortcuts();
getNotificationCenter().postNotificationName(NotificationCenter.reloadHints);
getNotificationCenter().postNotificationName(NotificationCenter.reloadInlineHints);
- if (Math.abs(getUserConfig().lastHintsSyncTime - (int) (System.currentTimeMillis() / 1000)) >= 24 * 60 * 60) {
+ getNotificationCenter().postNotificationName(NotificationCenter.reloadWebappsHints);
+ if (Math.abs(getUserConfig().lastHintsSyncTime - (int) (System.currentTimeMillis() / 1000)) >= 24 * 60 * 60 || BuildVars.DEBUG_PRIVATE_VERSION) {
loadHints(false);
}
});
@@ -5096,6 +5105,7 @@ public class MediaDataController extends BaseController {
req.groups = false;
req.channels = false;
req.bots_inline = true;
+ req.bots_app = true;
req.offset = 0;
req.limit = 20;
getConnectionsManager().sendRequest(req, (response, error) -> {
@@ -5109,6 +5119,9 @@ public class MediaDataController extends BaseController {
if (category.category instanceof TLRPC.TL_topPeerCategoryBotsInline) {
inlineBots = category.peers;
getUserConfig().botRatingLoadTime = (int) (System.currentTimeMillis() / 1000);
+ } else if (category.category instanceof TLRPC.TL_topPeerCategoryBotsApp) {
+ webapps = category.peers;
+ getUserConfig().webappRatingLoadTime = (int) (System.currentTimeMillis() / 1000);
} else {
hints = category.peers;
long selfUserId = getUserConfig().getClientUserId();
@@ -5126,6 +5139,7 @@ public class MediaDataController extends BaseController {
buildShortcuts();
getNotificationCenter().postNotificationName(NotificationCenter.reloadHints);
getNotificationCenter().postNotificationName(NotificationCenter.reloadInlineHints);
+ getNotificationCenter().postNotificationName(NotificationCenter.reloadWebappsHints);
getMessagesStorage().getStorageQueue().postRunnable(() -> {
try {
getMessagesStorage().getDatabase().executeFast("DELETE FROM chat_hints WHERE 1").stepThis().dispose();
@@ -5138,6 +5152,8 @@ public class MediaDataController extends BaseController {
TLRPC.TL_topPeerCategoryPeers category = topPeers.categories.get(a);
if (category.category instanceof TLRPC.TL_topPeerCategoryBotsInline) {
type = 1;
+ } else if (category.category instanceof TLRPC.TL_topPeerCategoryBotsApp) {
+ type = 2;
} else {
type = 0;
}
@@ -5180,8 +5196,10 @@ public class MediaDataController extends BaseController {
public void clearTopPeers() {
hints.clear();
inlineBots.clear();
+ webapps.clear();
getNotificationCenter().postNotificationName(NotificationCenter.reloadHints);
getNotificationCenter().postNotificationName(NotificationCenter.reloadInlineHints);
+ getNotificationCenter().postNotificationName(NotificationCenter.reloadWebappsHints);
getMessagesStorage().getStorageQueue().postRunnable(() -> {
try {
getMessagesStorage().getDatabase().executeFast("DELETE FROM chat_hints WHERE 1").stepThis().dispose();
@@ -5192,7 +5210,7 @@ public class MediaDataController extends BaseController {
buildShortcuts();
}
- public void increaseInlineRaiting(long uid) {
+ public void increaseInlineRating(long uid) {
if (!getUserConfig().suggestContacts) {
return;
}
@@ -5233,8 +5251,48 @@ public class MediaDataController extends BaseController {
getNotificationCenter().postNotificationName(NotificationCenter.reloadInlineHints);
}
+ public void increaseWebappRating(long uid) {
+ final TLRPC.User user = getMessagesController().getUser(uid);
+ if (user == null || !user.bot) return;
+
+ int dt;
+ if (getUserConfig().webappRatingLoadTime != 0) {
+ dt = Math.max(1, ((int) (System.currentTimeMillis() / 1000)) - getUserConfig().webappRatingLoadTime);
+ } else {
+ dt = 60;
+ }
+
+ TLRPC.TL_topPeer peer = null;
+ for (int a = 0; a < inlineBots.size(); a++) {
+ TLRPC.TL_topPeer p = inlineBots.get(a);
+ if (p.peer.user_id == uid) {
+ peer = p;
+ break;
+ }
+ }
+ if (peer == null) {
+ peer = new TLRPC.TL_topPeer();
+ peer.peer = new TLRPC.TL_peerUser();
+ peer.peer.user_id = uid;
+ webapps.add(peer);
+ }
+ peer.rating += Math.exp(dt / getMessagesController().ratingDecay);
+ Collections.sort(inlineBots, (lhs, rhs) -> {
+ if (lhs.rating > rhs.rating) {
+ return -1;
+ } else if (lhs.rating < rhs.rating) {
+ return 1;
+ }
+ return 0;
+ });
+ if (webapps.size() > 20) {
+ webapps.remove(webapps.size() - 1);
+ }
+ savePeer(uid, 2, peer.rating);
+ getNotificationCenter().postNotificationName(NotificationCenter.reloadWebappsHints);
+ }
+
public void removeInline(long dialogId) {
- TLRPC.TL_topPeerCategoryPeers category = null;
for (int a = 0; a < inlineBots.size(); a++) {
if (inlineBots.get(a).peer.user_id == dialogId) {
inlineBots.remove(a);
@@ -5251,6 +5309,23 @@ public class MediaDataController extends BaseController {
}
}
+ public void removeWebapp(long dialogId) {
+ for (int a = 0; a < webapps.size(); a++) {
+ if (webapps.get(a).peer.user_id == dialogId) {
+ webapps.remove(a);
+ TLRPC.TL_contacts_resetTopPeerRating req = new TLRPC.TL_contacts_resetTopPeerRating();
+ req.category = new TLRPC.TL_topPeerCategoryBotsApp();
+ req.peer = getMessagesController().getInputPeer(dialogId);
+ getConnectionsManager().sendRequest(req, (response, error) -> {
+
+ });
+ deletePeer(dialogId, 2);
+ getNotificationCenter().postNotificationName(NotificationCenter.reloadWebappsHints);
+ return;
+ }
+ }
+ }
+
public void removePeer(long uid) {
for (int a = 0; a < hints.size(); a++) {
if (hints.get(a).peer.user_id == uid) {
@@ -5942,9 +6017,10 @@ public class MediaDataController extends BaseController {
}
}
- public void loadReplyMessagesForMessages(ArrayList messages, long dialogId, int mode, long threadMessageId, Runnable callback, int classGuid) {
+ public void loadReplyMessagesForMessages(ArrayList messages, long dialogId, int mode, long threadMessageId, Runnable callback, int classGuid, Timer logLogger) {
final boolean scheduled = mode == ChatActivity.MODE_SCHEDULED;
if (DialogObject.isEncryptedDialog(dialogId)) {
+ Timer.Task t1 = Timer.start(logLogger, "loadReplyMessagesForMessages: (encrypted) finding messages to load");
ArrayList replyMessages = new ArrayList<>();
LongSparseArray> replyMessageRandomOwners = new LongSparseArray<>();
for (int a = 0; a < messages.size(); a++) {
@@ -5971,8 +6047,11 @@ public class MediaDataController extends BaseController {
}
return;
}
-
+ Timer.done(t1);
+ Timer.Task t2 = Timer.start(logLogger, "loadReplyMessagesForMessages (encrypted) storageQueue.postRunnable");
getMessagesStorage().getStorageQueue().postRunnable(() -> {
+ Timer.done(t2);
+ Timer.Task t3 = Timer.start(logLogger, "loadReplyMessagesForMessages: (encrypted) loading those messages from storage");
try {
ArrayList loadedMessages = new ArrayList<>();
SQLiteCursor cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT m.data, m.mid, m.date, r.random_id FROM randoms_v2 as r INNER JOIN messages_v2 as m ON r.mid = m.mid AND r.uid = m.uid WHERE r.random_id IN(%s)", TextUtils.join(",", replyMessages)));
@@ -6015,7 +6094,12 @@ public class MediaDataController extends BaseController {
}
}
}
- AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.replyMessagesDidLoad, dialogId, loadedMessages, null));
+ Timer.done(t3);
+ Timer.Task t4 = Timer.start(logLogger, "loadReplyMessagesForMessages (encrypted) runOnUIThread: posting notification");
+ AndroidUtilities.runOnUIThread(() -> {
+ Timer.done(t4);
+ getNotificationCenter().postNotificationName(NotificationCenter.replyMessagesDidLoad, dialogId, loadedMessages, null);
+ });
if (callback != null) {
callback.run();
}
@@ -6027,6 +6111,7 @@ public class MediaDataController extends BaseController {
LongSparseArray>> replyMessageOwners = new LongSparseArray<>();
LongSparseArray> dialogReplyMessagesIds = new LongSparseArray<>();
LongSparseArray> messagesWithUnknownStories = null;
+ Timer.Task t2 = Timer.start(logLogger, "loadReplyMessagesForMessages: filling replies from the same array");
for (int a = 0; a < messages.size(); a++) {
MessageObject messageObject = messages.get(a);
if (messageObject == null) {
@@ -6054,6 +6139,8 @@ public class MediaDataController extends BaseController {
}
}
}
+ Timer.done(t2);
+ Timer.Task t3 = Timer.start(logLogger, "loadReplyMessagesForMessages: gathering ids of missing reply data");
for (int a = 0; a < messages.size(); a++) {
MessageObject messageObject = messages.get(a);
if (messageObject == null) {
@@ -6070,6 +6157,7 @@ public class MediaDataController extends BaseController {
array = new ArrayList<>();
messagesWithUnknownStories.put(storyDialogId, array);
}
+ Timer.log(logLogger, "+story did=" + storyDialogId + " at "+(messageObject.type == MessageObject.TYPE_STORY ? "forwarded" : "mentioned")+" #" + messageObject.getId());
array.add(messageObject);
} else {
long storyDialogId = DialogObject.getPeerDialogId(messageObject.messageOwner.media.peer);
@@ -6086,6 +6174,7 @@ public class MediaDataController extends BaseController {
array = new ArrayList<>();
messagesWithUnknownStories.put(storyDialogId, array);
}
+ Timer.log(logLogger, "+story did=" + storyDialogId + " at replied #" + messageObject.getId());
array.add(messageObject);
} else {
long storyDialogId = DialogObject.getPeerDialogId(messageObject.messageOwner.reply_to.peer);
@@ -6140,6 +6229,7 @@ public class MediaDataController extends BaseController {
}
}
arrayList.add(messageObject);
+ Timer.log(logLogger, "+message did=" + -channelId + " mid="+messageId+" at replied #" + messageObject.getId());
}
if (
messageObject.type == MessageObject.TYPE_TEXT &&
@@ -6162,6 +6252,7 @@ public class MediaDataController extends BaseController {
array = new ArrayList<>();
messagesWithUnknownStories.put(storyDialogId, array);
}
+ Timer.log(logLogger, "+story did=" + storyDialogId + " at webpage of #" + messageObject.getId());
array.add(messageObject);
} else {
long storyDialogId = DialogObject.getPeerDialogId(attrStory.peer);
@@ -6171,6 +6262,7 @@ public class MediaDataController extends BaseController {
}
}
}
+ Timer.done(t3);
if (replyMessageOwners.isEmpty() && messagesWithUnknownStories == null) {
if (callback != null) {
callback.run();
@@ -6180,8 +6272,10 @@ public class MediaDataController extends BaseController {
LongSparseArray> finalMessagesWithUnknownStories = messagesWithUnknownStories;
+ Timer.Task t4 = Timer.start(logLogger, "loadReplyMessagesForMessages: storageQueue.postRunnable");
AtomicInteger requestsCount = new AtomicInteger(2);
getMessagesStorage().getStorageQueue().postRunnable(() -> {
+ Timer.done(t4);
try {
getMessagesController().getStoriesController().fillMessagesWithStories(finalMessagesWithUnknownStories, () -> {
if (requestsCount.decrementAndGet() == 0) {
@@ -6189,8 +6283,9 @@ public class MediaDataController extends BaseController {
AndroidUtilities.runOnUIThread(callback);
}
}
- }, classGuid);
+ }, classGuid, logLogger);
if (replyMessageOwners.isEmpty()) {
+ Timer.log(logLogger, "loadReplyMessagesForMessages: empty replyMessageOwners");
if (requestsCount.decrementAndGet() == 0) {
if (callback != null) {
AndroidUtilities.runOnUIThread(callback);
@@ -6198,6 +6293,9 @@ public class MediaDataController extends BaseController {
}
return;
}
+
+ Timer.Task t5 = Timer.start(logLogger, "loadReplyMessagesForMessages: getting reply messages");
+
ArrayList result = new ArrayList<>();
ArrayList users = new ArrayList<>();
ArrayList chats = new ArrayList<>();
@@ -6257,13 +6355,16 @@ public class MediaDataController extends BaseController {
broadcastReplyMessages(result, replyMessageOwners, users, chats, dialogId, true);
if (!dialogReplyMessagesIds.isEmpty()) {
+ Timer.done(t5);
for (int a = 0, N = dialogReplyMessagesIds.size(); a < N; a++) {
long channelId = dialogReplyMessagesIds.keyAt(a);
if (scheduled) {
+ Timer.Task t6 = Timer.start(logLogger, "loadReplyMessagesForMessages: load scheduled");
TLRPC.TL_messages_getScheduledMessages req = new TLRPC.TL_messages_getScheduledMessages();
req.peer = getMessagesController().getInputPeer(dialogId);
req.id = dialogReplyMessagesIds.valueAt(a);
int reqId = getConnectionsManager().sendRequest(req, (response, error) -> {
+ Timer.done(t6);
if (error == null) {
TLRPC.messages_Messages messagesRes = (TLRPC.messages_Messages) response;
for (int i = 0; i < messagesRes.messages.size(); i++) {
@@ -6317,6 +6418,8 @@ public class MediaDataController extends BaseController {
getMessagesStorage().putUsersAndChats(messagesRes.users, messagesRes.chats, true, true);
saveReplyMessages(replyMessageOwners, messagesRes.messages, scheduled);
}
+ } else {
+ Timer.log(logLogger, "getScheduledMessages error: " + error.code + " " + error.text);
}
if (requestsCount.decrementAndGet() == 0) {
if (callback != null) {
@@ -6328,10 +6431,12 @@ public class MediaDataController extends BaseController {
getConnectionsManager().bindRequestToGuid(reqId, classGuid);
}
} else if (channelId != 0) {
+ Timer.Task t6 = Timer.start(logLogger, "loadReplyMessagesForMessages: load channel messages");
TLRPC.TL_channels_getMessages req = new TLRPC.TL_channels_getMessages();
req.channel = getMessagesController().getInputChannel(channelId);
req.id = dialogReplyMessagesIds.valueAt(a);
int reqId = getConnectionsManager().sendRequest(req, (response, error) -> {
+ Timer.done(t6);
if (error == null) {
TLRPC.messages_Messages messagesRes = (TLRPC.messages_Messages) response;
for (int i = 0; i < messagesRes.messages.size(); i++) {
@@ -6345,6 +6450,8 @@ public class MediaDataController extends BaseController {
broadcastReplyMessages(messagesRes.messages, replyMessageOwners, messagesRes.users, messagesRes.chats, dialogId, false);
getMessagesStorage().putUsersAndChats(messagesRes.users, messagesRes.chats, true, true);
saveReplyMessages(replyMessageOwners, messagesRes.messages, scheduled);
+ } else {
+ Timer.log(logLogger, "channels.getMessages error: " + error.code + " " + error.text);
}
if (requestsCount.decrementAndGet() == 0) {
if (callback != null) {
@@ -6356,9 +6463,11 @@ public class MediaDataController extends BaseController {
getConnectionsManager().bindRequestToGuid(reqId, classGuid);
}
} else {
+ Timer.Task t6 = Timer.start(logLogger, "loadReplyMessagesForMessages: load messages");
TLRPC.TL_messages_getMessages req = new TLRPC.TL_messages_getMessages();
req.id = dialogReplyMessagesIds.valueAt(a);
int reqId = getConnectionsManager().sendRequest(req, (response, error) -> {
+ Timer.done(t6);
if (error == null) {
TLRPC.messages_Messages messagesRes = (TLRPC.messages_Messages) response;
for (int i = 0; i < messagesRes.messages.size(); i++) {
@@ -6371,6 +6480,8 @@ public class MediaDataController extends BaseController {
broadcastReplyMessages(messagesRes.messages, replyMessageOwners, messagesRes.users, messagesRes.chats, dialogId, false);
getMessagesStorage().putUsersAndChats(messagesRes.users, messagesRes.chats, true, true);
saveReplyMessages(replyMessageOwners, messagesRes.messages, scheduled);
+ } else {
+ Timer.log(logLogger, "messages.getMessages error: " + error.code + " " + error.text);
}
if (requestsCount.decrementAndGet() == 0) {
if (callback != null) {
@@ -6384,6 +6495,7 @@ public class MediaDataController extends BaseController {
}
}
} else {
+ Timer.done(t5);
if (requestsCount.decrementAndGet() == 0) {
if (callback != null) {
AndroidUtilities.runOnUIThread(callback);
@@ -7721,7 +7833,7 @@ public class MediaDataController extends BaseController {
//---------------- DRAFT END ----------------
- private HashMap botInfos = new HashMap<>();
+ private HashMap botInfos = new HashMap<>();
private LongSparseArray> botDialogKeyboards = new LongSparseArray<>();
private HashMap botKeyboards = new HashMap<>();
private LongSparseArray botKeyboardsByMids = new LongSparseArray();
@@ -7813,8 +7925,8 @@ public class MediaDataController extends BaseController {
});
}
- private TLRPC.BotInfo loadBotInfoInternal(long uid, long dialogId) throws SQLiteException {
- TLRPC.BotInfo botInfo = null;
+ private TL_bots.BotInfo loadBotInfoInternal(long uid, long dialogId) throws SQLiteException {
+ TL_bots.BotInfo botInfo = null;
SQLiteCursor cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT info FROM bot_info_v2 WHERE uid = %d AND dialogId = %d", uid, dialogId));
if (cursor.next()) {
NativeByteBuffer data;
@@ -7822,7 +7934,7 @@ public class MediaDataController extends BaseController {
if (!cursor.isNull(0)) {
data = cursor.byteBufferValue(0);
if (data != null) {
- botInfo = TLRPC.BotInfo.TLdeserialize(data, data.readInt32(false), false);
+ botInfo = TL_bots.BotInfo.TLdeserialize(data, data.readInt32(false), false);
data.reuse();
}
}
@@ -7831,9 +7943,16 @@ public class MediaDataController extends BaseController {
return botInfo;
}
+ public TL_bots.BotInfo getBotInfoCached(long uid, long dialogId) {
+ return botInfos.get(uid + "_" + dialogId);
+ }
+
public void loadBotInfo(long uid, long dialogId, boolean cache, int classGuid) {
+ loadBotInfo(uid, dialogId, cache, classGuid, null);
+ }
+ public void loadBotInfo(long uid, long dialogId, boolean cache, int classGuid, Utilities.Callback whenReceived) {
if (cache) {
- TLRPC.BotInfo botInfo = botInfos.get(uid + "_" + dialogId);
+ TL_bots.BotInfo botInfo = botInfos.get(uid + "_" + dialogId);
if (botInfo != null) {
getNotificationCenter().postNotificationName(NotificationCenter.botInfoDidLoad, botInfo, classGuid);
return;
@@ -7841,9 +7960,20 @@ public class MediaDataController extends BaseController {
}
getMessagesStorage().getStorageQueue().postRunnable(() -> {
try {
- TLRPC.BotInfo botInfo = loadBotInfoInternal(uid, dialogId);
+ TL_bots.BotInfo botInfo = loadBotInfoInternal(uid, dialogId);
if (botInfo != null) {
- AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.botInfoDidLoad, botInfo, classGuid));
+ AndroidUtilities.runOnUIThread(() -> {
+ if (whenReceived != null) {
+ whenReceived.run(botInfo);
+ }
+ getNotificationCenter().postNotificationName(NotificationCenter.botInfoDidLoad, botInfo, classGuid);
+ });
+ } else if (whenReceived != null) {
+ AndroidUtilities.runOnUIThread(() -> {
+ if (whenReceived != null) {
+ whenReceived.run(null);
+ }
+ });
}
} catch (Exception e) {
FileLog.e(e);
@@ -7918,7 +8048,7 @@ public class MediaDataController extends BaseController {
}
}
- public void putBotInfo(long dialogId, TLRPC.BotInfo botInfo) {
+ public void putBotInfo(long dialogId, TL_bots.BotInfo botInfo) {
if (botInfo == null) {
return;
}
@@ -7942,14 +8072,14 @@ public class MediaDataController extends BaseController {
}
public void updateBotInfo(long dialogId, TLRPC.TL_updateBotCommands update) {
- TLRPC.BotInfo botInfo = botInfos.get(update.bot_id + "_" + dialogId);
+ TL_bots.BotInfo botInfo = botInfos.get(update.bot_id + "_" + dialogId);
if (botInfo != null) {
botInfo.commands = update.commands;
getNotificationCenter().postNotificationName(NotificationCenter.botInfoDidLoad, botInfo, 0);
}
getMessagesStorage().getStorageQueue().postRunnable(() -> {
try {
- TLRPC.BotInfo info = loadBotInfoInternal(update.bot_id, dialogId);
+ TL_bots.BotInfo info = loadBotInfoInternal(update.bot_id, dialogId);
if (info != null) {
info.commands = update.commands;
}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessageLoaderLogger.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessageLoaderLogger.java
deleted file mode 100644
index 6e7421ae5..000000000
--- a/TMessagesProj/src/main/java/org/telegram/messenger/MessageLoaderLogger.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.telegram.messenger;
-
-public class MessageLoaderLogger {
-
- final long dialogId;
- final int count;
- final int loadIndex;
- final long startTime;
-
- long moveToStorageQueueTime;
- long getFromDatabaseTime;
- long moveToStageQueueTime;
- long stageQueueProccessing;
-
- boolean reload;
-
- public MessageLoaderLogger(long dialogId, int loadIndex, int count) {
- this.dialogId = dialogId;
- this.count = count;
- this.loadIndex = loadIndex;
- startTime = System.currentTimeMillis();
- }
-
- public void logStorageQueuePost() {
- moveToStorageQueueTime = System.currentTimeMillis() - startTime;
- }
-
- public void logStorageProccessing() {
- getFromDatabaseTime = System.currentTimeMillis() - startTime;
- }
-
- public void logStageQueuePost() {
- moveToStageQueueTime = System.currentTimeMillis() - startTime;
- }
-
- public void reload() {
- reload = true;
- }
-
- public void logStageQueueProcessing() {
- stageQueueProccessing = System.currentTimeMillis() - startTime;
- }
-
- public void finish() {
- long totalTime = System.currentTimeMillis() - startTime;
- FileLog.d("MessageLoaderLogger dialogId=" + dialogId + " index=" + loadIndex + " count=" + count + " " +
- " moveToStorageQueueTime=" + moveToStorageQueueTime +
- " getFromDatabaseTime=" + getFromDatabaseTime +
- " moveToStageQueueTime=" + moveToStageQueueTime +
- " stageQueueProccessing=" + stageQueueProccessing +
- " wasReload=" + reload + " totalTime=" + totalTime
- );
- }
-}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java
index 744ff92bf..d75f5e8d2 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java
@@ -33,6 +33,7 @@ import android.text.style.ClickableSpan;
import android.text.style.URLSpan;
import android.text.util.Linkify;
import android.util.Base64;
+import android.util.Log;
import androidx.annotation.NonNull;
import androidx.collection.LongSparseArray;
@@ -75,6 +76,8 @@ import org.telegram.ui.Components.spoilers.SpoilerEffect;
import org.telegram.ui.PeerColorActivity;
import org.telegram.ui.Stars.StarsController;
import org.telegram.ui.Stars.StarsIntroActivity;
+import org.telegram.ui.Stories.StoriesController;
+import org.telegram.ui.web.BotWebViewContainer;
import java.io.BufferedReader;
import java.io.File;
@@ -131,6 +134,7 @@ public class MessageObject {
public static final int TYPE_JOINED_CHANNEL = 27; // recommendations list
public static final int TYPE_GIVEAWAY_RESULTS = 28;
public static final int TYPE_PAID_MEDIA = 29; // messageMediaPaidMedia with stars
+ public static final int TYPE_GIFT_STARS = 30;
public int localType;
public String localName;
@@ -141,8 +145,10 @@ public class MessageObject {
public boolean localSupergroup;
public Boolean cachedIsSupergroup;
public boolean localEdit;
+ public StoriesController.StoriesList parentStoriesList;
public TLRPC.Message messageOwner;
public TL_stories.StoryItem storyItem;
+ public StoriesController.UploadingStory uploadingStory;
public TLRPC.Document emojiAnimatedSticker;
public Long emojiAnimatedStickerId;
public boolean isTopicMainMessage;
@@ -222,6 +228,7 @@ public class MessageObject {
public String sponsoredInfo, sponsoredAdditionalInfo;
public String sponsoredButtonText;
public TLRPC.TL_peerColor sponsoredColor;
+ public TLRPC.MessageMedia sponsoredMedia;
public boolean sponsoredCanReport;
public boolean replyTextEllipsized;
@@ -287,7 +294,7 @@ public class MessageObject {
private boolean hasUnwrappedEmoji;
public int emojiOnlyCount, animatedEmojiCount;
- private int totalAnimatedEmojiCount;
+ public int totalAnimatedEmojiCount;
private boolean layoutCreated;
private int generatedWithMinSize;
private float generatedWithDensity;
@@ -488,7 +495,54 @@ public class MessageObject {
}
public boolean hasMediaSpoilers() {
- return !isRepostPreview && (messageOwner.media != null && messageOwner.media.spoiler || needDrawBluredPreview());
+ return !isRepostPreview && (messageOwner.media != null && messageOwner.media.spoiler || needDrawBluredPreview()) || isHiddenSensitive();
+ }
+
+ public Boolean isSensitiveCached;
+ public boolean isSensitive() {
+ if (isSensitiveCached != null) return isSensitiveCached;
+ if (messageOwner == null) return false;
+ if (!canBeSensitive()) return false;
+ if (!messageOwner.restriction_reason.isEmpty()) {
+ for (int i = 0; i < messageOwner.restriction_reason.size(); ++i) {
+ TLRPC.RestrictionReason reason = messageOwner.restriction_reason.get(i);
+ if (
+ "sensitive".equals(reason.reason) &&
+ ("all".equals(reason.platform) || !ApplicationLoader.isStandaloneBuild() && !BuildVars.isBetaApp() && "android".equals(reason.platform))
+ ) {
+ return isSensitiveCached = true;
+ }
+ }
+ }
+ if (getDialogId() < 0) {
+ final TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-getDialogId());
+ if (chat != null && chat.restriction_reason != null) {
+ for (int i = 0; i < chat.restriction_reason.size(); ++i) {
+ TLRPC.RestrictionReason reason = chat.restriction_reason.get(i);
+ if (
+ "sensitive".equals(reason.reason) &&
+ ("all".equals(reason.platform) || !ApplicationLoader.isStandaloneBuild() && !BuildVars.isBetaApp() && "android".equals(reason.platform))
+ ) {
+ return isSensitiveCached = true;
+ }
+ }
+ }
+ }
+ return isSensitiveCached = false;
+ }
+
+ public boolean isHiddenSensitive() {
+ return isSensitive() && !MessagesController.getInstance(currentAccount).showSensitiveContent();
+ }
+
+ public boolean canBeSensitive() {
+ return messageOwner != null && (
+ type == TYPE_PHOTO ||
+ type == TYPE_VIDEO ||
+ type == TYPE_FILE ||
+ type == TYPE_GIF ||
+ type == TYPE_ROUND_VIDEO
+ ) && !sendPreview && !isRepostPreview && !isOutOwner() && messageOwner.send_state == MessageObject.MESSAGE_SEND_STATE_SENT;
}
public boolean shouldDrawReactions() {
@@ -760,6 +814,7 @@ public class MessageObject {
public int padTop, padBottom;
public int charactersOffset;
public int charactersEnd;
+ public int originalWidth;
public int height;
public int heightByOffset;
public byte directionFlags;
@@ -2414,6 +2469,12 @@ public class MessageObject {
} else {
messageText = replaceWithLink(LocaleController.getString("EventLogToggledSignaturesOff", R.string.EventLogToggledSignaturesOff), "un1", fromUser);
}
+ } else if (event.action instanceof TLRPC.TL_channelAdminLogEventActionToggleSignatureProfiles) {
+ if (((TLRPC.TL_channelAdminLogEventActionToggleSignatureProfiles) event.action).value) {
+ messageText = replaceWithLink(LocaleController.getString(R.string.EventLogToggledSignaturesProfilesOn), "un1", fromUser);
+ } else {
+ messageText = replaceWithLink(LocaleController.getString(R.string.EventLogToggledSignaturesProfilesOff), "un1", fromUser);
+ }
} else if (event.action instanceof TLRPC.TL_channelAdminLogEventActionToggleInvites) {
if (((TLRPC.TL_channelAdminLogEventActionToggleInvites) event.action).new_value) {
messageText = replaceWithLink(LocaleController.getString("EventLogToggledInvitesOn", R.string.EventLogToggledInvitesOn), "un1", fromUser);
@@ -2695,9 +2756,12 @@ public class MessageObject {
} else if (event.action instanceof TLRPC.TL_channelAdminLogEventActionParticipantJoinByInvite) {
TLRPC.TL_channelAdminLogEventActionParticipantJoinByInvite action = (TLRPC.TL_channelAdminLogEventActionParticipantJoinByInvite) event.action;
if (action.via_chatlist) {
- messageText = replaceWithLink(LocaleController.getString("ActionInviteUserFolder", R.string.ActionInviteUserFolder), "un1", fromUser);
+ messageText = replaceWithLink(LocaleController.getString(ChatObject.isChannelAndNotMegaGroup(chat) ? R.string.ActionInviteChannelUserFolder : R.string.ActionInviteUserFolder), "un1", fromUser);
} else {
- messageText = replaceWithLink(LocaleController.getString("ActionInviteUser", R.string.ActionInviteUser), "un1", fromUser);
+ messageText = replaceWithLink(LocaleController.getString(ChatObject.isChannelAndNotMegaGroup(chat) ? R.string.ActionInviteChannelUser : R.string.ActionInviteUser), "un1", fromUser);
+ }
+ if (action.invite != null && !TextUtils.isEmpty(action.invite.link)) {
+ messageText = TextUtils.concat(messageText, " ", action.invite.link);
}
} else if (event.action instanceof TLRPC.TL_channelAdminLogEventActionToggleNoForwards) {
TLRPC.TL_channelAdminLogEventActionToggleNoForwards action = (TLRPC.TL_channelAdminLogEventActionToggleNoForwards) event.action;
@@ -3538,6 +3602,7 @@ public class MessageObject {
}
message.reactions = reactions;
message.flags |= 1048576;
+ FileLog.d("msg#"+message.id+" updateReactions out=" + message.out);
}
public boolean hasReactions() {
@@ -4144,6 +4209,16 @@ public class MessageObject {
messageText = replaceWithLink(messageText, "un1", fromObject);
}
}
+ } else if (messageOwner.action instanceof TLRPC.TL_messageActionPaymentRefunded) {
+ TLRPC.TL_messageActionPaymentRefunded action = (TLRPC.TL_messageActionPaymentRefunded) messageOwner.action;
+ long did = DialogObject.getPeerDialogId(action.peer);
+ TLObject who;
+ if (did >= 0) {
+ who = getUser(users, sUsers, did);
+ } else {
+ who = getChat(chats, sChats, -did);
+ }
+ messageText = StarsIntroActivity.replaceStars(replaceWithLink(LocaleController.formatString(R.string.ActionRefunded, action.currency + " " + LocaleController.formatNumber(action.total_amount, ',')), "un1", who));
} else if (messageOwner.action instanceof TLRPC.TL_messageActionChatAddUser) {
long singleUserId = messageOwner.action.user_id;
if (singleUserId == 0 && messageOwner.action.users.size() == 1) {
@@ -4200,9 +4275,9 @@ public class MessageObject {
}
} else if (messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByLink) {
if (isOut()) {
- messageText = LocaleController.getString("ActionInviteYou", R.string.ActionInviteYou);
+ messageText = LocaleController.getString(R.string.ActionInviteYou);
} else {
- messageText = replaceWithLink(LocaleController.getString("ActionInviteUser", R.string.ActionInviteUser), "un1", fromObject);
+ messageText = replaceWithLink(LocaleController.getString(R.string.ActionInviteUser), "un1", fromObject);
}
} else if (messageOwner.action instanceof TLRPC.TL_messageActionGiveawayLaunch) {
TLRPC.Chat chat = messageOwner.peer_id != null && messageOwner.peer_id.channel_id != 0 ? getChat(chats, sChats, messageOwner.peer_id.channel_id) : null;
@@ -4245,6 +4320,24 @@ public class MessageObject {
stringBuilder.append(LocaleController.formatPluralString(isChannel ? "BoostingGiveawayServiceUndistributed" : "BoostingGiveawayServiceUndistributedGroup", giveawayResults.unclaimed_count));
}
messageText = stringBuilder;
+ } else if (messageOwner.action instanceof TLRPC.TL_messageActionGiftStars) {
+ if (fromObject instanceof TLRPC.User && ((TLRPC.User) fromObject).self) {
+ TLRPC.User user = getUser(users, sUsers, messageOwner.peer_id.user_id);
+ messageText = replaceWithLink(AndroidUtilities.replaceTags(LocaleController.getString(R.string.ActionGiftOutbound)), "un1", user);
+ } else if (fromObject instanceof TLRPC.User && UserObject.isService(((TLRPC.User) fromObject).id)) {
+ messageText = TextUtils.replace(AndroidUtilities.replaceTags(LocaleController.getString(R.string.ActionGiftInbound)), new String[] {"un1"}, new CharSequence[]{ LocaleController.getString(R.string.StarsTransactionUnknown) });
+ } else {
+ messageText = replaceWithLink(AndroidUtilities.replaceTags(LocaleController.getString(R.string.ActionGiftInbound)), "un1", fromObject);
+ }
+ int i = messageText.toString().indexOf("un2");
+ if (i != -1) {
+ SpannableStringBuilder sb = SpannableStringBuilder.valueOf(messageText);
+ CharSequence price = BillingController.getInstance().formatCurrency(messageOwner.action.amount, messageOwner.action.currency);
+ if ((messageOwner.action.flags & 1) != 0) {
+ price = String.format("%.2f", (messageOwner.action.cryptoAmount * Math.pow(10, -9))) + " " + messageOwner.action.cryptoCurrency + " (~ " + price + ")";
+ }
+ messageText = sb.replace(i, i + 3, price);
+ }
} else if (messageOwner.action instanceof TLRPC.TL_messageActionGiftCode && ((TLRPC.TL_messageActionGiftCode) messageOwner.action).boost_peer != null) {
messageText = LocaleController.getString("BoostingReceivedGiftNoName", R.string.BoostingReceivedGiftNoName);
} else if (messageOwner.action instanceof TLRPC.TL_messageActionGiftPremium || messageOwner.action instanceof TLRPC.TL_messageActionGiftCode) {
@@ -4748,11 +4841,11 @@ public class MessageObject {
}
} else {
isRestrictedMessage = false;
- String restrictionReason = MessagesController.getRestrictionReason(messageOwner.restriction_reason);
+ String restrictionReason = MessagesController.getInstance(currentAccount).getRestrictionReason(messageOwner.restriction_reason);
if (!TextUtils.isEmpty(restrictionReason)) {
messageText = restrictionReason;
isRestrictedMessage = true;
- } else if (!isMediaEmpty()) {
+ } else if (!isMediaEmpty() && !isSponsored()) {
// messageText = getMediaTitle(getMedia(messageOwner)); // I'm afraid doing this
if (getMedia(messageOwner) instanceof TLRPC.TL_messageMediaGiveaway) {
boolean isChannel;
@@ -5004,6 +5097,9 @@ public class MessageObject {
if (messageObject == null || messageObject.messageOwner == null) {
return null;
}
+ if (messageObject.sponsoredMedia != null) {
+ return messageObject.sponsoredMedia;
+ }
return getMedia(messageObject.messageOwner);
}
@@ -5063,7 +5159,9 @@ public class MessageObject {
int oldType = type;
type = 1000;
isRoundVideoCached = 0;
- if (channelJoined) {
+ if (isSponsored()) {
+ type = TYPE_TEXT;
+ } else if (channelJoined) {
type = TYPE_JOINED_CHANNEL;
channelJoinedExpanded = MessagesController.getInstance(currentAccount).getMainSettings().getBoolean("c" + getDialogId() + "_rec", true);
} else if (messageOwner instanceof TLRPC.TL_message || messageOwner instanceof TLRPC.TL_messageForwarded_old2) {
@@ -5190,6 +5288,9 @@ public class MessageObject {
} 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) {
+ contentType = 1;
+ type = TYPE_GIFT_STARS;
} else if (messageOwner.action instanceof TLRPC.TL_messageActionChatEditPhoto || messageOwner.action instanceof TLRPC.TL_messageActionUserUpdatedPhoto) {
contentType = 1;
type = TYPE_ACTION_PHOTO;
@@ -5545,6 +5646,27 @@ public class MessageObject {
}
}
}
+ } else if (sponsoredMedia != null) {
+ TLRPC.Photo photo = sponsoredMedia.photo;
+ TLRPC.Document document = sponsoredMedia.document;
+ if (photo != null) {
+ if (!update || photoThumbs == null) {
+ photoThumbs = new ArrayList<>(photo.sizes);
+ } else if (!photoThumbs.isEmpty()) {
+ updatePhotoSizeLocations(photoThumbs, photo.sizes);
+ }
+ photoThumbsObject = photo;
+ } else if (document != null) {
+ if (isDocumentHasThumb(document)) {
+ if (!update) {
+ photoThumbs = new ArrayList<>();
+ photoThumbs.addAll(document.thumbs);
+ } else if (photoThumbs != null && !photoThumbs.isEmpty()) {
+ updatePhotoSizeLocations(photoThumbs, document.thumbs);
+ }
+ photoThumbsObject = document;
+ }
+ }
} else if (sponsoredPhoto != null) {
if (!update || photoThumbs == null) {
photoThumbs = new ArrayList<>(sponsoredPhoto.sizes);
@@ -6515,10 +6637,11 @@ public class MessageObject {
} else if (run.urlEntity instanceof TLRPC.TL_messageEntityUrl) {
hasUrls = true;
String lowerCase = url.toLowerCase();
- url = !lowerCase.contains("://") ? "http://" + url : url;
+ url = !lowerCase.contains("://") ? (BotWebViewContainer.isTonsite(url) ? "tonsite://" : "http://") + url : url;
if (url != null) {
url = url.replaceAll("∕|⁄|%E2%81%84|%E2%88%95", "/");
}
+ if (Browser.isTonsitePunycode(url)) continue;
spannable.setSpan(new URLSpanBrowser(url, run), run.start, run.end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
} else if (run.urlEntity instanceof TLRPC.TL_messageEntityBankCard) {
hasUrls = true;
@@ -6535,6 +6658,7 @@ public class MessageObject {
if (url != null) {
url = url.replaceAll("∕|⁄|%E2%81%84|%E2%88%95", "/");
}
+ if (Browser.isTonsitePunycode(url)) continue;
spannable.setSpan(new URLSpanReplacement(url, run), run.start, run.end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
} else if (run.urlEntity instanceof TLRPC.TL_messageEntityMentionName) {
spannable.setSpan(new URLSpanUserMention("" + ((TLRPC.TL_messageEntityMentionName) run.urlEntity).user_id, t, run), run.start, run.end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
@@ -6841,6 +6965,7 @@ public class MessageObject {
maxWidth -= AndroidUtilities.dp(15);
}
+ int textLayoutOriginalWidth;
StaticLayout textLayout;
TextPaint paint;
@@ -6852,6 +6977,7 @@ public class MessageObject {
CharSequence text = messageText;
try {
+ textLayoutOriginalWidth = maxWidth;
textLayout = makeStaticLayout(text, paint, maxWidth, 1f, totalAnimatedEmojiCount >= 4 ? -1 : 0, emojiOnlyCount > 0);
} catch (Exception e) {
FileLog.e(e);
@@ -6897,6 +7023,7 @@ public class MessageObject {
}, text.length() - readMore.length(), text.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
try {
+ textLayoutOriginalWidth = maxWidth;
textLayout = makeStaticLayout(text, paint, maxWidth, 1f, totalAnimatedEmojiCount >= 4 ? -1 : 0, emojiOnlyCount > 0);
} catch (Exception e) {
FileLog.e(e);
@@ -7024,7 +7151,10 @@ public class MessageObject {
} else {
sb = new SpannableString(blockText.toString());
}
+ block.originalWidth = textLayoutOriginalWidth = blockMaxWidth;
textLayout = makeStaticLayout(sb, layoutPaint, blockMaxWidth, 1f, totalAnimatedEmojiCount >= 4 ? -1 : 0, emojiOnlyCount > 0);
+ } else {
+ block.originalWidth = textLayoutOriginalWidth;
}
block.textLayout = textLayout;
@@ -7061,6 +7191,7 @@ public class MessageObject {
} else {
sb = SpannableString.valueOf(blockText);
}
+ block.originalWidth = blockMaxWidth;
block.textLayout = makeStaticLayout(sb, layoutPaint, blockMaxWidth, 1f, totalAnimatedEmojiCount >= 4 ? -1 : 0, false);
block.height = block.textLayout.getHeight();//Math.max(block.height, block.textLayout.getLineBottom(block.textLayout.getLineCount() - 1));
@@ -7305,11 +7436,9 @@ public class MessageObject {
width -= AndroidUtilities.dp(15);
}
- final float lineSpacing = 1f;
- final float lineAdd = 0;
- Layout.Alignment align = Layout.Alignment.ALIGN_NORMAL; //type == TYPE_EMOJIS && isOut() ? Layout.Alignment.ALIGN_OPPOSITE : Layout.Alignment.ALIGN_NORMAL;
+ int textLayoutOriginalWidth;
try {
- textLayout = makeStaticLayout(text, textPaint, width, 1f, 0f, false);
+ textLayout = makeStaticLayout(text, textPaint, textLayoutOriginalWidth = width, 1f, 0f, false);
} catch (Exception e) {
FileLog.e(e);
return;
@@ -7353,6 +7482,7 @@ public class MessageObject {
}, text.length() - readMore.length(), text.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
try {
+ textLayoutOriginalWidth = width;
textLayout = makeStaticLayout(text, textPaint, width, 1f, 0f, false);
} catch (Exception e) {
FileLog.e(e);
@@ -7471,7 +7601,10 @@ public class MessageObject {
} else {
sb = new SpannableString(text.subSequence(range.start, range.end));
}
+ block.originalWidth = textLayoutOriginalWidth = blockMaxWidth;
textLayout = makeStaticLayout(sb, layoutPaint, blockMaxWidth, 1f, 0f, false);
+ } else {
+ block.originalWidth = textLayoutOriginalWidth;
}
block.textLayout = textLayout;
@@ -7495,6 +7628,7 @@ public class MessageObject {
} else {
sb = SpannableString.valueOf(text.subSequence(startCharacter, endCharacter));
}
+ block.originalWidth = blockMaxWidth;
block.textLayout = makeStaticLayout(sb, layoutPaint, blockMaxWidth, 1f, 0f, false);
block.height = block.textLayout.getHeight();
@@ -7672,7 +7806,7 @@ public class MessageObject {
}
}
TLRPC.Chat chat = messageOwner.peer_id != null && messageOwner.peer_id.channel_id != 0 ? getChat(null, null, messageOwner.peer_id.channel_id) : null;
- if (!messageOwner.out || !(messageOwner.from_id instanceof TLRPC.TL_peerUser) && (!(messageOwner.from_id instanceof TLRPC.TL_peerChannel) || ChatObject.isChannel(chat) && !chat.megagroup) || messageOwner.post) {
+ if (!messageOwner.out || !(messageOwner.from_id instanceof TLRPC.TL_peerUser) && (!(messageOwner.from_id instanceof TLRPC.TL_peerChannel) || ChatObject.isChannelAndNotMegaGroup(chat)) || messageOwner.post) {
return isOutOwnerCached = false;
}
if (messageOwner.fwd_from == null) {
@@ -7686,6 +7820,9 @@ public class MessageObject {
}
public boolean needDrawAvatar() {
+ if (type == TYPE_JOINED_CHANNEL) {
+ return false;
+ }
if (isRepostPreview) {
return true;
}
@@ -7698,7 +7835,12 @@ public class MessageObject {
if (searchType != 0) {
return true;
}
- return !isSponsored() && (isFromUser() || isFromGroup() || eventId != 0 || messageOwner.fwd_from != null && messageOwner.fwd_from.saved_from_peer != null);
+ boolean channelSignatureProfiles = false;
+ if (getDialogId() < 0) {
+ TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-getDialogId());
+ channelSignatureProfiles = (chat != null && chat.signature_profiles);
+ }
+ return !isSponsored() && (isFromUser() || isFromGroup() || channelSignatureProfiles || eventId != 0 || messageOwner.fwd_from != null && messageOwner.fwd_from.saved_from_peer != null);
}
private boolean needDrawAvatarInternal() {
@@ -8814,7 +8956,7 @@ public class MessageObject {
return dp(82);
} else if (type == 10) {
return dp(30);
- } else if (type == TYPE_ACTION_PHOTO || type == TYPE_GIFT_PREMIUM || type == TYPE_GIFT_PREMIUM_CHANNEL || type == TYPE_SUGGEST_PHOTO) {
+ } else if (type == TYPE_ACTION_PHOTO || type == TYPE_GIFT_PREMIUM || type == TYPE_GIFT_STARS || type == TYPE_GIFT_PREMIUM_CHANNEL || type == TYPE_SUGGEST_PHOTO) {
return dp(50);
} else if (type == TYPE_ROUND_VIDEO) {
return AndroidUtilities.roundMessageSize;
@@ -9948,6 +10090,141 @@ public class MessageObject {
return !isEditing() && !isSponsored() && isSent() && messageOwner.action == null && !isExpiredStory();
}
+ public boolean isPaidReactionChosen() {
+ if (messageOwner.reactions == null) return false;
+ for (int i = 0; i < messageOwner.reactions.results.size(); i++) {
+ if (messageOwner.reactions.results.get(i).reaction instanceof TLRPC.TL_reactionPaid) {
+ return messageOwner.reactions.results.get(i).chosen;
+ }
+ }
+ return false;
+ }
+
+ public void addPaidReactions(int amount, boolean chosen, boolean anonymous) {
+ if (messageOwner.reactions == null) {
+ messageOwner.reactions = new TLRPC.TL_messageReactions();
+ messageOwner.reactions.reactions_as_tags = MessageObject.getDialogId(messageOwner) == UserConfig.getInstance(currentAccount).getClientUserId();
+ messageOwner.reactions.can_see_list = isFromGroup() || isFromUser();
+ }
+ addPaidReactions(currentAccount, messageOwner.reactions, amount, anonymous, chosen);
+ }
+
+ public Boolean isMyPaidReactionAnonymous() {
+ if (messageOwner == null || messageOwner.reactions == null) return null;
+ if (messageOwner.reactions.top_reactors == null) return null;
+ for (TLRPC.MessageReactor reactor : messageOwner.reactions.top_reactors) {
+ if (reactor != null && reactor.my) {
+ return reactor.anonymous;
+ }
+ }
+ return null;
+ }
+
+ public static Boolean isMyPaidReactionAnonymous(TLRPC.MessageReactions reactions) {
+ if (reactions == null) return null;
+ if (reactions.top_reactors == null) return null;
+ for (TLRPC.MessageReactor reactor : reactions.top_reactors) {
+ if (reactor != null && reactor.my) {
+ return reactor.anonymous;
+ }
+ }
+ return null;
+ }
+
+ public void setMyPaidReactionAnonymous(boolean value) {
+ if (messageOwner == null || messageOwner.reactions == null) return;
+ if (messageOwner.reactions.top_reactors == null) return;
+ for (TLRPC.MessageReactor reactor : messageOwner.reactions.top_reactors) {
+ if (reactor != null && reactor.my) {
+ reactor.anonymous = value;
+ }
+ }
+ }
+
+ public boolean doesPaidReactionExist() {
+ if (messageOwner.reactions == null) {
+ messageOwner.reactions = new TLRPC.TL_messageReactions();
+ messageOwner.reactions.reactions_as_tags = MessageObject.getDialogId(messageOwner) == UserConfig.getInstance(currentAccount).getClientUserId();
+ messageOwner.reactions.can_see_list = isFromGroup() || isFromUser();
+ }
+ for (int i = 0; i < messageOwner.reactions.results.size(); i++) {
+ if (messageOwner.reactions.results.get(i).reaction instanceof TLRPC.TL_reactionPaid) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean ensurePaidReactionsExist(boolean chosen) {
+ if (messageOwner.reactions == null) {
+ messageOwner.reactions = new TLRPC.TL_messageReactions();
+ messageOwner.reactions.reactions_as_tags = MessageObject.getDialogId(messageOwner) == UserConfig.getInstance(currentAccount).getClientUserId();
+ messageOwner.reactions.can_see_list = isFromGroup() || isFromUser();
+ }
+ TLRPC.ReactionCount reactionCount = null;
+ for (int i = 0; i < messageOwner.reactions.results.size(); i++) {
+ if (messageOwner.reactions.results.get(i).reaction instanceof TLRPC.TL_reactionPaid) {
+ reactionCount = messageOwner.reactions.results.get(i);
+ }
+ }
+ if (reactionCount == null) {
+ reactionCount = new TLRPC.TL_reactionCount();
+ reactionCount.reaction = new TLRPC.TL_reactionPaid();
+ reactionCount.count = 1;
+ reactionCount.chosen = chosen;
+ messageOwner.reactions.results.add(0, reactionCount);
+ return true;
+ }
+ return false;
+ }
+
+ public static void addPaidReactions(
+ int currentAccount,
+ TLRPC.MessageReactions reactions,
+ int amount,
+ boolean anonymous,
+ boolean chosen
+ ) {
+ TLRPC.ReactionCount reactionCount = null;
+ for (int i = 0; i < reactions.results.size(); i++) {
+ if (reactions.results.get(i).reaction instanceof TLRPC.TL_reactionPaid) {
+ reactionCount = reactions.results.get(i);
+ }
+ }
+ TLRPC.MessageReactor reactor = null;
+ for (int i = 0; i < reactions.top_reactors.size(); i++) {
+ if (reactions.top_reactors.get(i).my) {
+ reactor = reactions.top_reactors.get(i);
+ break;
+ }
+ }
+ if (reactionCount == null && amount > 0) {
+ reactionCount = new TLRPC.TL_reactionCount();
+ reactionCount.reaction = new TLRPC.TL_reactionPaid();
+ reactions.results.add(0, reactionCount);
+ }
+ if (reactionCount != null) {
+ reactionCount.chosen = chosen;
+ reactionCount.count = Math.max(0, reactionCount.count + amount);
+ if (reactionCount.count <= 0) {
+ reactions.results.remove(reactionCount);
+ }
+ }
+ if (reactor == null && amount > 0) {
+ reactor = new TLRPC.TL_messageReactor();
+ reactor.my = true;
+ reactor.peer_id = MessagesController.getInstance(currentAccount).getPeer(UserConfig.getInstance(currentAccount).getClientUserId());
+ reactions.top_reactors.add(reactor);
+ }
+ if (reactor != null) {
+ reactor.count = Math.max(0, reactor.count + amount);
+ reactor.anonymous = anonymous;
+ if (reactor.count <= 0) {
+ reactions.top_reactors.remove(reactor);
+ }
+ }
+ }
+
public boolean selectReaction(ReactionsLayoutInBubble.VisibleReaction visibleReaction, boolean big, boolean fromDoubleTap) {
if (messageOwner.reactions == null) {
messageOwner.reactions = new TLRPC.TL_messageReactions();
@@ -9959,8 +10236,8 @@ public class MessageObject {
TLRPC.ReactionCount newReaction = null;
int maxChoosenOrder = 0;
for (int i = 0; i < messageOwner.reactions.results.size(); i++) {
- if (messageOwner.reactions.results.get(i).chosen) {
- TLRPC.ReactionCount reactionCount = messageOwner.reactions.results.get(i);
+ final TLRPC.ReactionCount reactionCount = messageOwner.reactions.results.get(i);
+ if (reactionCount.chosen && !(reactionCount.reaction instanceof TLRPC.TL_reactionPaid)) {
choosenReactions.add(reactionCount);
if (reactionCount.chosen_order > maxChoosenOrder) {
maxChoosenOrder = reactionCount.chosen_order;
@@ -10013,7 +10290,10 @@ public class MessageObject {
while (!choosenReactions.isEmpty() && choosenReactions.size() >= maxReactionsCount) {
int minIndex = 0;
for (int i = 1; i < choosenReactions.size(); i++) {
- if (choosenReactions.get(i).chosen_order < choosenReactions.get(minIndex).chosen_order) {
+ if (
+ !(choosenReactions.get(i).reaction instanceof TLRPC.TL_reactionPaid) &&
+ choosenReactions.get(i).chosen_order < choosenReactions.get(minIndex).chosen_order
+ ) {
minIndex = i;
}
}
@@ -10037,7 +10317,15 @@ public class MessageObject {
if (newReaction == null) {
int maxChatReactions = MessagesController.getInstance(currentAccount).getChatMaxUniqReactions(getDialogId());
- if (messageOwner.reactions.results.size() + 1 > maxChatReactions) {
+ int chosenCount = 0;
+ if (messageOwner != null && messageOwner.reactions != null) {
+ for (TLRPC.ReactionCount reactionCount : messageOwner.reactions.results) {
+ if (!(reactionCount.reaction instanceof TLRPC.TL_reactionPaid)) {
+ chosenCount++;
+ }
+ }
+ }
+ if (chosenCount + 1 > maxChatReactions) {
return false;
}
newReaction = new TLRPC.TL_reactionCount();
@@ -10115,6 +10403,10 @@ public class MessageObject {
return storyItem != null;
}
+ public boolean isBotPreview() {
+ return storyItem instanceof StoriesController.BotPreview;
+ }
+
private TLRPC.WebPage storyMentionWebpage;
public TLRPC.WebPage getStoryMentionWebpage() {
if (!isStoryMention()) {
@@ -10153,7 +10445,7 @@ public class MessageObject {
}
public boolean isAnyGift() {
- return type == MessageObject.TYPE_GIFT_PREMIUM || type == MessageObject.TYPE_GIFT_PREMIUM_CHANNEL;
+ return type == MessageObject.TYPE_GIFT_STARS || type == MessageObject.TYPE_GIFT_PREMIUM || type == MessageObject.TYPE_GIFT_PREMIUM_CHANNEL;
}
private static CharSequence[] userSpan;
@@ -10641,4 +10933,8 @@ public class MessageObject {
return getMedia(this) instanceof TLRPC.TL_messageMediaPaidMedia;
}
+ public float getProgress() {
+ return 0f;
+ }
+
}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagePreviewParams.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagePreviewParams.java
index 14695dd10..78a749457 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagePreviewParams.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagePreviewParams.java
@@ -213,7 +213,7 @@ public class MessagePreviewParams {
replyMessageObject = null;
replyQuote = null;
}
- hasSecretMessages = replyMessageObject != null && (replyMessageObject.isVoiceOnce() || replyMessageObject.isRoundOnce());
+ hasSecretMessages = replyMessageObject != null && (replyMessageObject.isVoiceOnce() || replyMessageObject.isRoundOnce() || replyMessageObject.type == MessageObject.TYPE_GIFT_STARS);
if (replyMessageObject != null || replyQuote != null) {
if (group != null) {
replyMessage = new Messages(null, 1, group.messages, dialogId, null);
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java
index fcaabc71d..9ec4bdfd9 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java
@@ -8,6 +8,8 @@
package org.telegram.messenger;
+import static org.telegram.messenger.AndroidUtilities.dp;
+import static org.telegram.messenger.LocaleController.getString;
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;
@@ -32,6 +34,9 @@ import android.util.Pair;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
import android.util.SparseIntArray;
+import android.view.Gravity;
+import android.view.View;
+import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -55,12 +60,17 @@ import org.telegram.tgnet.RequestDelegate;
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_stories;
import org.telegram.tgnet.tl.TL_chatlists;
+import org.telegram.ui.ActionBar.ActionBarLayout;
import org.telegram.ui.ActionBar.AlertDialog;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Business.QuickRepliesController;
+import org.telegram.ui.Cells.ChatMessageCell;
+import org.telegram.ui.Cells.CheckBoxCell;
import org.telegram.ui.ChannelMonetizationLayout;
import org.telegram.ui.ChatActivity;
import org.telegram.ui.ChatReactionsEditActivity;
@@ -70,6 +80,7 @@ import org.telegram.ui.Components.AnimatedEmojiDrawable;
import org.telegram.ui.Components.BulletinFactory;
import org.telegram.ui.Components.ImageUpdater;
import org.telegram.ui.Components.JoinCallAlert;
+import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.MotionBackgroundDrawable;
import org.telegram.ui.Components.Premium.LimitReachedBottomSheet;
import org.telegram.ui.Components.Reactions.ReactionsLayoutInBubble;
@@ -84,7 +95,11 @@ import org.telegram.ui.SecretMediaViewer;
import org.telegram.ui.Stars.BotStarsController;
import org.telegram.ui.Stars.StarsController;
import org.telegram.ui.Stories.StoriesController;
+import org.telegram.ui.ThemeActivity;
import org.telegram.ui.TopicsFragment;
+import org.telegram.ui.bots.BotWebViewAttachedSheet;
+import org.telegram.ui.bots.BotWebViewSheet;
+import org.telegram.ui.bots.WebViewRequestProps;
import java.io.File;
import java.util.ArrayList;
@@ -104,17 +119,17 @@ import java.util.concurrent.CountDownLatch;
public class MessagesController extends BaseController implements NotificationCenter.NotificationCenterDelegate {
public int lastKnownSessionsCount;
- private ConcurrentHashMap chats = new ConcurrentHashMap<>(100, 1.0f, 2);
- private ConcurrentHashMap encryptedChats = new ConcurrentHashMap<>(10, 1.0f, 2);
- private ConcurrentHashMap users = new ConcurrentHashMap<>(100, 1.0f, 3);
- private ConcurrentHashMap objectsByUsernames = new ConcurrentHashMap<>(100, 1.0f, 2);
+ private final ConcurrentHashMap chats = new ConcurrentHashMap<>(100, 1.0f, 2);
+ private final ConcurrentHashMap encryptedChats = new ConcurrentHashMap<>(10, 1.0f, 2);
+ private final ConcurrentHashMap users = new ConcurrentHashMap<>(100, 1.0f, 3);
+ private final ConcurrentHashMap objectsByUsernames = new ConcurrentHashMap<>(100, 1.0f, 2);
public static int stableIdPointer = 100;
- private HashMap activeVoiceChatsMap = new HashMap<>();
+ private final HashMap activeVoiceChatsMap = new HashMap<>();
- private ArrayList joiningToChannels = new ArrayList<>();
+ private final ArrayList joiningToChannels = new ArrayList<>();
- private LongSparseArray exportedChats = new LongSparseArray<>();
+ private final LongSparseArray exportedChats = new LongSparseArray<>();
public ArrayList hintDialogs = new ArrayList<>();
public SparseArray> dialogsByFolder = new SparseArray<>();
@@ -543,6 +558,7 @@ public class MessagesController extends BaseController implements NotificationCe
public int boostsChannelLevelMax;
public int channelRestrictSponsoredLevelMin;
public Set webAppAllowedProtocols;
+ public Set ignoreRestrictionReasons;
public int channelsLimitDefault;
public int channelsLimitPremium;
@@ -613,6 +629,15 @@ public class MessagesController extends BaseController implements NotificationCe
public int factcheckLengthLimit;
public long starsRevenueWithdrawalMin;
public long starsPaidPostAmountMax;
+ public int botPreviewMediasMax;
+ public String tonProxyAddress;
+ public String weatherSearchUsername;
+ public boolean storyWeatherPreload;
+ public boolean starsGiftsEnabled;
+ public long starsPaidReactionAmountMax;
+ public long starsSubscriptionAmountMax;
+ public float starsUsdSellRate1000;
+ public float starsUsdWithdrawRate1000;
public int savedDialogsPinnedLimitDefault;
public int savedDialogsPinnedLimitPremium;
@@ -626,9 +651,9 @@ public class MessagesController extends BaseController implements NotificationCe
public String premiumBotUsername;
public String premiumInvoiceSlug;
- private SharedPreferences notificationsPreferences;
- private SharedPreferences mainPreferences;
- private SharedPreferences emojiPreferences;
+ private final SharedPreferences notificationsPreferences;
+ private final SharedPreferences mainPreferences;
+ private final SharedPreferences emojiPreferences;
public volatile boolean ignoreSetOnline;
public boolean premiumLocked;
@@ -1555,7 +1580,17 @@ public class MessagesController extends BaseController implements NotificationCe
factcheckLengthLimit = mainPreferences.getInt("factcheckLengthLimit", 1024);
starsRevenueWithdrawalMin = mainPreferences.getLong("starsRevenueWithdrawalMin", 1000);
starsPaidPostAmountMax = mainPreferences.getLong("starsPaidPostAmountMax", 10_000);
+ botPreviewMediasMax = mainPreferences.getInt("botPreviewMediasMax", 10);
webAppAllowedProtocols = mainPreferences.getStringSet("webAppAllowedProtocols", new HashSet<>(Arrays.asList("http", "https")));
+ ignoreRestrictionReasons = mainPreferences.getStringSet("ignoreRestrictionReasons", new HashSet<>(Arrays.asList()));
+ tonProxyAddress = mainPreferences.getString("tonProxyAddress", "magic.org");
+ weatherSearchUsername = mainPreferences.getString("weatherSearchUsername", "izweatherbot");
+ storyWeatherPreload = mainPreferences.getBoolean("storyWeatherPreload", true);
+ starsGiftsEnabled = mainPreferences.getBoolean("starsGiftsEnabled", true);
+ starsPaidReactionAmountMax = mainPreferences.getLong("starsPaidReactionAmountMax", 10_000L);
+ starsSubscriptionAmountMax = mainPreferences.getLong("starsSubscriptionAmountMax", 2500L);
+ starsUsdSellRate1000 = mainPreferences.getFloat("starsUsdSellRate1000", 2000);
+ starsUsdWithdrawRate1000 = mainPreferences.getFloat("starsUsdWithdrawRate1000", 1200);
scheduleTranscriptionUpdate();
BuildVars.GOOGLE_AUTH_CLIENT_ID = mainPreferences.getString("googleAuthClientId", BuildVars.GOOGLE_AUTH_CLIENT_ID);
if (mainPreferences.contains("dcDomainName2")) {
@@ -1597,6 +1632,7 @@ public class MessagesController extends BaseController implements NotificationCe
exportUri.add("content://(\\d+@)?com\\.whatsapp\\.w4b\\.provider\\.media/export_chat/");
exportUri.add("content://jp\\.naver\\.line\\.android\\.line\\.common\\.FileProvider/export-chat/");
exportUri.add(".*WhatsApp.*\\.txt$");
+ exportUri.add(".*WhatsApp.*\\.zip$");
}
exportGroupUri = mainPreferences.getStringSet("exportGroupUri", null);
@@ -4151,6 +4187,28 @@ public class MessagesController extends BaseController implements NotificationCe
}
break;
}
+ case "bot_preview_medias_max": {
+ if (value.value instanceof TLRPC.TL_jsonNumber) {
+ TLRPC.TL_jsonNumber num = (TLRPC.TL_jsonNumber) value.value;
+ if ((int) num.value != botPreviewMediasMax) {
+ botPreviewMediasMax = (int) num.value;
+ editor.putInt("botPreviewMediasMax", botPreviewMediasMax);
+ changed = true;
+ }
+ }
+ break;
+ }
+ case "ton_proxy_address": {
+ if (value.value instanceof TLRPC.TL_jsonString) {
+ TLRPC.TL_jsonString str = (TLRPC.TL_jsonString) value.value;
+ if (!TextUtils.equals(str.value, tonProxyAddress)) {
+ tonProxyAddress = str.value;
+ editor.putString("tonProxyAddress", tonProxyAddress);
+ changed = true;
+ }
+ }
+ break;
+ }
case "web_app_allowed_protocols": {
HashSet newProtocols = new HashSet<>();
if (value.value instanceof TLRPC.TL_jsonArray) {
@@ -4170,6 +4228,102 @@ public class MessagesController extends BaseController implements NotificationCe
}
break;
}
+ case "weather_search_username": {
+ if (value.value instanceof TLRPC.TL_jsonString) {
+ TLRPC.TL_jsonString str = (TLRPC.TL_jsonString) value.value;
+ if (!TextUtils.equals(str.value, weatherSearchUsername)) {
+ weatherSearchUsername = str.value;
+ editor.putString("weatherSearchUsername", weatherSearchUsername);
+ changed = true;
+ }
+ }
+ break;
+ }
+ case "story_weather_preload": {
+ if (value.value instanceof TLRPC.TL_jsonBool) {
+ TLRPC.TL_jsonBool bool = (TLRPC.TL_jsonBool) value.value;
+ if (bool.value != storyWeatherPreload) {
+ storyWeatherPreload = bool.value;
+ editor.putBoolean("storyWeatherPreload", storyWeatherPreload);
+ changed = true;
+ }
+ }
+ break;
+ }
+ case "stars_gifts_enabled": {
+ if (value.value instanceof TLRPC.TL_jsonBool) {
+ TLRPC.TL_jsonBool bool = (TLRPC.TL_jsonBool) value.value;
+ if (bool.value != starsGiftsEnabled) {
+ starsGiftsEnabled = bool.value;
+ editor.putBoolean("starsGiftsEnabled", starsGiftsEnabled);
+ changed = true;
+ }
+ }
+ break;
+ }
+ case "stars_paid_reaction_amount_max": {
+ if (value.value instanceof TLRPC.TL_jsonNumber) {
+ TLRPC.TL_jsonNumber num = (TLRPC.TL_jsonNumber) value.value;
+ if ((long) num.value != starsPaidReactionAmountMax) {
+ starsPaidReactionAmountMax = (long) num.value;
+ editor.putLong("starsPaidReactionAmountMax", starsPaidReactionAmountMax);
+ changed = true;
+ }
+ }
+ break;
+ }
+ case "stars_subscription_amount_max": {
+ if (value.value instanceof TLRPC.TL_jsonNumber) {
+ TLRPC.TL_jsonNumber num = (TLRPC.TL_jsonNumber) value.value;
+ if ((long) num.value != starsSubscriptionAmountMax) {
+ starsSubscriptionAmountMax = (long) num.value;
+ editor.putLong("starsSubscriptionAmountMax", starsSubscriptionAmountMax);
+ changed = true;
+ }
+ }
+ break;
+ }
+ case "stars_usd_sell_rate_x1000": {
+ if (value.value instanceof TLRPC.TL_jsonNumber) {
+ TLRPC.TL_jsonNumber num = (TLRPC.TL_jsonNumber) value.value;
+ if (Math.abs(num.value - starsUsdSellRate1000) > 0.001f) {
+ starsUsdSellRate1000 = (float) num.value;
+ editor.putFloat("starsUsdSellRate1000", starsUsdSellRate1000);
+ changed = true;
+ }
+ }
+ break;
+ }
+ case "stars_usd_withdraw_rate_x1000": {
+ if (value.value instanceof TLRPC.TL_jsonNumber) {
+ TLRPC.TL_jsonNumber num = (TLRPC.TL_jsonNumber) value.value;
+ if (Math.abs(num.value - starsUsdWithdrawRate1000) > 0.001f) {
+ starsUsdWithdrawRate1000 = (float) num.value;
+ editor.putFloat("starsUsdWithdrawRate1000", starsUsdWithdrawRate1000);
+ changed = true;
+ }
+ }
+ break;
+ }
+ case "ignore_restriction_reasons": {
+ HashSet newReasons = new HashSet<>();
+ if (value.value instanceof TLRPC.TL_jsonArray) {
+ TLRPC.TL_jsonArray array = (TLRPC.TL_jsonArray) value.value;
+ for (int b = 0, N2 = array.value.size(); b < N2; b++) {
+ TLRPC.JSONValue val = array.value.get(b);
+ if (val instanceof TLRPC.TL_jsonString) {
+ TLRPC.TL_jsonString string = (TLRPC.TL_jsonString) val;
+ newReasons.add(string.value.toLowerCase());
+ }
+ }
+ }
+ if (!ignoreRestrictionReasons.equals(newReasons)) {
+ ignoreRestrictionReasons = newReasons;
+ editor.putStringSet("ignoreRestrictionReasons", ignoreRestrictionReasons);
+ changed = true;
+ }
+ break;
+ }
}
}
@@ -5755,6 +5909,13 @@ public class MessagesController extends BaseController implements NotificationCe
return objectsByUsernames.get(username.toLowerCase());
}
+ public TLRPC.User getUser(String username) {
+ TLObject obj = getUserOrChat(username);
+ if (obj instanceof TLRPC.User)
+ return (TLRPC.User) obj;
+ return null;
+ }
+
public ConcurrentHashMap getUsers() {
return users;
}
@@ -6523,7 +6684,7 @@ public class MessagesController extends BaseController implements NotificationCe
applyDialogNotificationsSettings(-chatId, 0, res.full_chat.notify_settings);
for (int a = 0; a < res.full_chat.bot_info.size(); a++) {
- TLRPC.BotInfo botInfo = res.full_chat.bot_info.get(a);
+ TL_bots.BotInfo botInfo = res.full_chat.bot_info.get(a);
getMediaDataController().putBotInfo(-chatId, botInfo);
}
int index = blockePeers.indexOfKey(-chatId);
@@ -6584,7 +6745,10 @@ public class MessagesController extends BaseController implements NotificationCe
}
public void loadFullUser(final TLRPC.User user, int classGuid, boolean force) {
- if (user == null || loadingFullUsers.contains(user.id) || !force && loadedFullUsers.get(user.id) > 0) {
+ loadFullUser(user, classGuid, force, null);
+ }
+ public void loadFullUser(final TLRPC.User user, int classGuid, boolean force, Utilities.Callback whenReceivedFullUser) {
+ if (user == null || whenReceivedFullUser == null && (loadingFullUsers.contains(user.id) || !force && loadedFullUsers.get(user.id) > 0)) {
return;
}
loadingFullUsers.add(user.id);
@@ -6605,11 +6769,15 @@ public class MessagesController extends BaseController implements NotificationCe
getStoriesController().updateStoriesFromFullPeer(dialogId, userFull.stories);
ChatThemeController.getInstance(currentAccount).saveChatWallpaper(res.full_user.id, res.full_user.wallpaper);
+ if (whenReceivedFullUser != null) {
+ whenReceivedFullUser.run(userFull);
+ }
+
AndroidUtilities.runOnUIThread(() -> {
savePeerSettings(userFull.user.id, userFull.settings, false);
applyDialogNotificationsSettings(user.id, 0, userFull.notify_settings);
- if (userFull.bot_info instanceof TLRPC.TL_botInfo) {
+ if (userFull.bot_info instanceof TL_bots.TL_botInfo) {
userFull.bot_info.user_id = user.id;
getMediaDataController().putBotInfo(user.id, userFull.bot_info);
}
@@ -6640,7 +6808,7 @@ public class MessagesController extends BaseController implements NotificationCe
if (userFull.user.photo != null && userFull.user.photo.has_video) {
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, UPDATE_MASK_AVATAR);
}
- if (userFull.bot_info instanceof TLRPC.TL_botInfo) {
+ if (userFull.bot_info instanceof TL_bots.TL_botInfo) {
userFull.bot_info.user_id = userFull.id;
getNotificationCenter().postNotificationName(NotificationCenter.botInfoDidLoad, userFull.bot_info, classGuid);
}
@@ -9965,12 +10133,12 @@ public class MessagesController extends BaseController implements NotificationCe
loadMessagesInternal(dialogId, mergeDialogId, loadInfo, count, max_id, offset_date, fromCache, midDate, classGuid, load_type, last_message_id, mode, threadMessageId, loadIndex, first_unread, unread_count, last_date, queryFromServer, mentionsCount, true, true, isTopic, null, 0L);
}
- private void loadMessagesInternal(long dialogId, long mergeDialogId, boolean loadInfo, int count, int max_id, int offset_date, boolean fromCache, int minDate, int classGuid, int load_type, int last_message_id, int mode, long threadMessageId, int loadIndex, int first_unread, int unread_count, int last_date, boolean queryFromServer, int mentionsCount, boolean loadDialog, boolean processMessages, boolean isTopic, MessageLoaderLogger loaderLogger, long hash) {
+ private void loadMessagesInternal(long dialogId, long mergeDialogId, boolean loadInfo, int count, int max_id, int offset_date, boolean fromCache, int minDate, int classGuid, int load_type, int last_message_id, int mode, long threadMessageId, int loadIndex, int first_unread, int unread_count, int last_date, boolean queryFromServer, int mentionsCount, boolean loadDialog, boolean processMessages, boolean isTopic, Timer loaderLogger, long hash) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("load messages in chat " + dialogId + " topic_id " + threadMessageId + " count " + count + " max_id " + max_id + " cache " + fromCache + " mindate = " + minDate + " guid " + classGuid + " load_type " + load_type + " last_message_id " + last_message_id + " mode " + mode + " index " + loadIndex + " firstUnread " + first_unread + " unread_count " + unread_count + " last_date " + last_date + " queryFromServer " + queryFromServer + " isTopic " + isTopic);
}
if (BuildVars.LOGS_ENABLED && loaderLogger == null && mode == 0) {
- loaderLogger = new MessageLoaderLogger(dialogId, loadIndex, count);
+ loaderLogger = new Timer("MessageLoaderLogger dialogId=" + dialogId + " index=" + loadIndex + " count=" + count);
}
if ((threadMessageId == 0 || isTopic || mode == ChatActivity.MODE_SAVED || mode == ChatActivity.MODE_QUICK_REPLIES) && mode != ChatActivity.MODE_PINNED && (fromCache || DialogObject.isEncryptedDialog(dialogId))) {
getMessagesStorage().getMessages(dialogId, mergeDialogId, loadInfo, count, max_id, offset_date, minDate, classGuid, load_type, mode, threadMessageId, loadIndex, processMessages, isTopic, loaderLogger);
@@ -10281,10 +10449,11 @@ public class MessagesController extends BaseController implements NotificationCe
}
public void processLoadedMessages(TLRPC.messages_Messages messagesRes, int resCount, long dialogId, long mergeDialogId, int count, int max_id, int offset_date, boolean isCache, int classGuid,
- int first_unread, int last_message_id, int unread_count, int last_date, int load_type, boolean isEnd, int mode, long threadMessageId, int loadIndex, boolean queryFromServer, int mentionsCount, boolean needProcess, boolean isTopic, MessageLoaderLogger loaderLogger) {
+ int first_unread, int last_message_id, int unread_count, int last_date, int load_type, boolean isEnd, int mode, long threadMessageId, int loadIndex, boolean queryFromServer, int mentionsCount, boolean needProcess, boolean isTopic, Timer loaderLogger) {
if (BuildVars.LOGS_ENABLED) {
- FileLog.d("processLoadedMessages size " + messagesRes.messages.size() + " in chat " + dialogId + " topic_id " + threadMessageId + " count " + count + " max_id " + max_id + " cache " + isCache + " guid " + classGuid + " load_type " + load_type + " last_message_id " + last_message_id + " index " + loadIndex + " firstUnread " + first_unread + " unread_count " + unread_count + " last_date " + last_date + " queryFromServer " + queryFromServer + " isTopic " + isTopic);
+ FileLog.d("processLoadedMessages size " + messagesRes.messages.size() + " in chat " + dialogId + " topic_id " + threadMessageId + " count " + count + " max_id " + max_id + " cache " + isCache + " guid " + classGuid + " load_type " + load_type + " last_message_id " + last_message_id + " index " + loadIndex + " firstUnread " + first_unread + " unread_count " + unread_count + " last_date " + last_date + " queryFromServer " + queryFromServer + " isTopic " + isTopic + " mode " + mode);
}
+ Timer.Task t1 = Timer.start(loaderLogger, "processLoadedMessages");
long startProcessTime = SystemClock.elapsedRealtime();
boolean createDialog = false;
@@ -10385,9 +10554,6 @@ public class MessagesController extends BaseController implements NotificationCe
}
}
}
- if (loaderLogger != null) {
- loaderLogger.reload();
- }
final long finalHash = hash;
AndroidUtilities.runOnUIThread(() -> loadMessagesInternal(dialogId, mergeDialogId, false, count, load_type == LOAD_FROM_UNREAD && queryFromServer ? first_unread : max_id, offset_date, false, 0, classGuid, load_type, last_message_id, mode, threadMessageId, loadIndex, first_unread, unread_count, last_date, queryFromServer, mentionsCount, true, needProcess, isTopic, loaderLogger, finalHash));
if (messagesRes.messages.isEmpty()) {
@@ -10485,9 +10651,6 @@ public class MessagesController extends BaseController implements NotificationCe
if (BuildVars.LOGS_ENABLED) {
FileLog.d("process time=" + (SystemClock.elapsedRealtime() - startProcessTime) + " count=" + objects.size() + " for dialog " + dialogId);
}
- if (loaderLogger != null) {
- loaderLogger.logStageQueueProcessing();
- }
if (mode == ChatActivity.MODE_SCHEDULED) {
Collections.sort(objects, (o1, o2) -> {
if (o1.messageOwner.date == o2.messageOwner.date && o1.getId() >= 0 && o2.getId() >= 0) {
@@ -10519,13 +10682,15 @@ public class MessagesController extends BaseController implements NotificationCe
}
}
}
+
+ Timer.done(t1);
+ Timer.Task t2 = Timer.start(loaderLogger, "processLoadedMessages: runOnUIThread");
AndroidUtilities.runOnUIThread(() -> {
+ Timer.done(t2);
+ Timer.Task t3 = Timer.start(loaderLogger, "processLoadedMessages: post runOnUIThread");
putUsers(messagesRes.users, isCache);
putChats(messagesRes.chats, isCache);
- if (loaderLogger != null) {
- loaderLogger.finish();
- }
if (messagesRes.animatedEmoji != null && needProcess) {
AnimatedEmojiDrawable.getDocumentFetcher(currentAccount).processDocuments(messagesRes.animatedEmoji);
}
@@ -10552,13 +10717,15 @@ public class MessagesController extends BaseController implements NotificationCe
if (!DialogObject.isEncryptedDialog(dialogId) && mode != ChatActivity.MODE_QUICK_REPLIES) {
int finalFirst_unread_final = first_unread_final;
+ Timer.Task t5 = Timer.start(loaderLogger, "loadReplyMessagesForMessages");
getMediaDataController().loadReplyMessagesForMessages(objects, dialogId, mode, threadMessageId, () -> {
+ Timer.done(t5);
if (!needProcess) {
getNotificationCenter().postNotificationName(NotificationCenter.messagesDidLoadWithoutProcess, classGuid, resCount, isCache, isEnd, last_message_id);
} else {
getNotificationCenter().postNotificationName(NotificationCenter.messagesDidLoad, dialogId, count, objects, isCache, finalFirst_unread_final, last_message_id, unread_count, last_date, load_type, isEnd, classGuid, loadIndex, max_id, mentionsCount, mode);
}
- }, classGuid);
+ }, classGuid, loaderLogger);
} else {
getNotificationCenter().postNotificationName(NotificationCenter.messagesDidLoad, dialogId, count, objects, isCache, first_unread_final, last_message_id, unread_count, last_date, load_type, isEnd, classGuid, loadIndex, max_id, mentionsCount, mode);
}
@@ -10569,6 +10736,11 @@ public class MessagesController extends BaseController implements NotificationCe
if (!webpagesToReload.isEmpty()) {
reloadWebPages(dialogId, webpagesToReload, mode);
}
+
+ Timer.done(t3);
+ if (loaderLogger != null) {
+ loaderLogger.finish();
+ }
});
}
@@ -13453,16 +13625,26 @@ public class MessagesController extends BaseController implements NotificationCe
}, ConnectionsManager.RequestFlagInvokeAfter);
}
- public void toggleChannelSignatures(long chatId, boolean enabled) {
+ public void toggleChannelSignatures(long chatId, boolean signaturesEnabled, boolean profilesEnabled) {
+ TLRPC.Chat chat = getChat(chatId);
+ if (chat != null) {
+ chat.signatures = signaturesEnabled;
+ chat.signature_profiles = profilesEnabled;
+ putChat(chat, true);
+ }
+
TLRPC.TL_channels_toggleSignatures req = new TLRPC.TL_channels_toggleSignatures();
req.channel = getInputChannel(chatId);
- req.enabled = enabled;
+ req.signatures_enabled = signaturesEnabled;
+ req.profiles_enabled = profilesEnabled;
getConnectionsManager().sendRequest(req, (response, error) -> {
if (response != null) {
processUpdates((TLRPC.Updates) response, false);
AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, UPDATE_MASK_CHAT));
}
}, ConnectionsManager.RequestFlagInvokeAfter);
+
+ getNotificationCenter().postNotificationName(NotificationCenter.updateAllMessages, -chatId);
}
public void toggleChannelForum(long chatId, boolean enabled) {
@@ -15046,7 +15228,7 @@ public class MessagesController extends BaseController implements NotificationCe
updateInterfaceWithMessages(dialogId, arr, 0);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload);
});
- }, 0);
+ }, 0, null);
}
});
@@ -17297,8 +17479,21 @@ public class MessagesController extends BaseController implements NotificationCe
message.out = true;
}
}
- if (!message.out && message.from_id instanceof TLRPC.TL_peerUser && message.from_id.user_id == clientUserId) {
- message.out = true;
+ if (!message.out) {
+ long from_id = DialogObject.getPeerDialogId(message.from_id);
+ if (from_id == clientUserId) {
+ message.out = true;
+ } else {
+ TLRPC.TL_channels_sendAsPeers peers = getSendAsPeers(MessageObject.getDialogId(message));
+ if (peers != null) {
+ for (TLRPC.TL_sendAsPeer peer : peers.peers) {
+ if (peer != null && from_id == DialogObject.getPeerDialogId(peer.peer)) {
+ message.out = true;
+ break;
+ }
+ }
+ }
+ }
}
if (!fromGetDifference) {
for (int a = 0, count = message.entities.size(); a < count; a++) {
@@ -18275,6 +18470,11 @@ public class MessagesController extends BaseController implements NotificationCe
} else if (baseUpdate instanceof TLRPC.TL_updateMessageReactions) {
TLRPC.TL_updateMessageReactions update = (TLRPC.TL_updateMessageReactions) baseUpdate;
long dialogId = MessageObject.getPeerId(update.peer);
+ long pendingPaid = StarsController.getInstance(currentAccount).getPendingPaidReactions(dialogId, update.msg_id);
+ if (pendingPaid != 0) {
+ final StarsController starsController = StarsController.getInstance(currentAccount);
+ MessageObject.addPaidReactions(currentAccount, update.reactions, (int) pendingPaid, starsController.arePaidReactionsAnonymous(StarsController.MessageId.from(dialogId, update.msg_id), update.reactions), true);
+ }
getNotificationCenter().postNotificationName(NotificationCenter.didUpdateReactions, dialogId, update.msg_id, update.reactions);
} else if (baseUpdate instanceof TLRPC.TL_updateMessageExtendedMedia) {
TLRPC.TL_updateMessageExtendedMedia extendedMedia = (TLRPC.TL_updateMessageExtendedMedia) baseUpdate;
@@ -18296,8 +18496,8 @@ public class MessagesController extends BaseController implements NotificationCe
getNotificationCenter().postNotificationName(NotificationCenter.webViewResultSent, resultSent.query_id);
} else if (baseUpdate instanceof TLRPC.TL_updateAttachMenuBots) {
getMediaDataController().loadAttachMenuBots(false, true);
- } else if (baseUpdate instanceof TLRPC.TL_updateBotMenuButton) {
- TLRPC.TL_updateBotMenuButton updateBotMenuButton = (TLRPC.TL_updateBotMenuButton) baseUpdate;
+ } else if (baseUpdate instanceof TL_bots.TL_updateBotMenuButton) {
+ TL_bots.TL_updateBotMenuButton updateBotMenuButton = (TL_bots.TL_updateBotMenuButton) baseUpdate;
getNotificationCenter().postNotificationName(NotificationCenter.updateBotMenuButton, updateBotMenuButton.bot_id, updateBotMenuButton.button);
} else if (baseUpdate instanceof TLRPC.TL_updateReadChannelDiscussionInbox) {
TLRPC.TL_updateReadChannelDiscussionInbox update = (TLRPC.TL_updateReadChannelDiscussionInbox) baseUpdate;
@@ -18563,7 +18763,7 @@ public class MessagesController extends BaseController implements NotificationCe
}
}
}
- getMediaDataController().loadReplyMessagesForMessages(arrayList, dialogId, 0, 0,null, 0);
+ getMediaDataController().loadReplyMessagesForMessages(arrayList, dialogId, 0, 0,null, 0, null);
getNotificationCenter().postNotificationName(NotificationCenter.replaceMessagesObjects, dialogId, arrayList, false);
}
}
@@ -19082,7 +19282,6 @@ public class MessagesController extends BaseController implements NotificationCe
for (int a = 0, N = res.messages.size(); a < N; a++) {
TLRPC.TL_sponsoredMessage sponsoredMessage = res.messages.get(a);
TLRPC.TL_message message = new TLRPC.TL_message();
- message.message = sponsoredMessage.message;
if (!sponsoredMessage.entities.isEmpty()) {
message.entities = sponsoredMessage.entities;
message.flags |= 128;
@@ -19091,6 +19290,11 @@ public class MessagesController extends BaseController implements NotificationCe
message.flags |= 256;
message.date = getConnectionsManager().getCurrentTime();
message.id = messageId--;
+ message.message = sponsoredMessage.message;
+ if (sponsoredMessage.media != null) {
+ message.flags |= 512;
+ }
+ message.media = sponsoredMessage.media;
MessageObject messageObject = new MessageObject(currentAccount, message, usersDict, chatsDict, true, true);
messageObject.sponsoredId = sponsoredMessage.random_id;
messageObject.sponsoredTitle = sponsoredMessage.title;
@@ -19102,6 +19306,10 @@ public class MessagesController extends BaseController implements NotificationCe
messageObject.sponsoredButtonText = sponsoredMessage.button_text;
messageObject.sponsoredCanReport = sponsoredMessage.can_report;
messageObject.sponsoredColor = sponsoredMessage.color;
+ messageObject.sponsoredMedia = sponsoredMessage.media;
+ messageObject.setType();
+ messageObject.textLayoutBlocks = new ArrayList<>();
+ messageObject.generateThumbs(true);
result.add(messageObject);
}
}
@@ -19154,17 +19362,6 @@ public class MessagesController extends BaseController implements NotificationCe
putUsers(res.users, false);
putChats(res.chats, false);
});
- final LongSparseArray usersDict = new LongSparseArray<>();
- final LongSparseArray chatsDict = new LongSparseArray<>();
-
- for (int a = 0; a < res.users.size(); a++) {
- TLRPC.User u = res.users.get(a);
- usersDict.put(u.id, u);
- }
- for (int a = 0; a < res.chats.size(); a++) {
- TLRPC.Chat c = res.chats.get(a);
- chatsDict.put(c.id, c);
- }
}
} else {
result = null;
@@ -19317,7 +19514,7 @@ public class MessagesController extends BaseController implements NotificationCe
}
}
}
- getMediaDataController().loadReplyMessagesForMessages(messages, dialogId, mode, 0, null, 0);
+ getMediaDataController().loadReplyMessagesForMessages(messages, dialogId, mode, 0, null, 0, null);
if (mode == ChatActivity.MODE_QUICK_REPLIES) {
QuickRepliesController.getInstance(currentAccount).checkLocalMessages(messages);
}
@@ -19790,12 +19987,14 @@ public class MessagesController extends BaseController implements NotificationCe
}
}
- public static String getRestrictionReason(ArrayList reasons) {
+ public String getRestrictionReason(ArrayList reasons) {
if (reasons.isEmpty()) {
return null;
}
for (int a = 0, N = reasons.size(); a < N; a++) {
- TLRPC.TL_restrictionReason reason = reasons.get(a);
+ TLRPC.RestrictionReason reason = reasons.get(a);
+ if (ignoreRestrictionReasons != null && ignoreRestrictionReasons.contains(reason.reason)) continue;
+ if ("sensitive".equals(reason.reason)) continue;
if ("all".equals(reason.platform) || !ApplicationLoader.isStandaloneBuild() && !BuildVars.isBetaApp() && "android".equals(reason.platform)) {
return reason.text;
}
@@ -19803,6 +20002,83 @@ public class MessagesController extends BaseController implements NotificationCe
return null;
}
+ public boolean isSensitive(ArrayList reasons) {
+ if (reasons == null || reasons.isEmpty()) {
+ return false;
+ }
+ for (int a = 0, N = reasons.size(); a < N; a++) {
+ TLRPC.RestrictionReason reason = reasons.get(a);
+ if (ignoreRestrictionReasons != null && ignoreRestrictionReasons.contains(reason.reason)) continue;
+ if ("all".equals(reason.platform) || !ApplicationLoader.isStandaloneBuild() && !BuildVars.isBetaApp() && "android".equals(reason.platform)) {
+ if ("sensitive".equals(reason.reason)) return true;
+ }
+ }
+ return false;
+ }
+
+ public void checkSensitive(BaseFragment fragment, long did, Runnable done, Runnable canceled) {
+ ArrayList reasons = null;
+ if (did < 0) {
+ TLRPC.Chat chat = getChat(-did);
+ reasons = chat != null ? chat.restriction_reason : null;
+ } else if (did >= 0) {
+ TLRPC.User user = getUser(did);
+ reasons = user != null ? user.restriction_reason : null;
+ }
+ if (!isSensitive(reasons) || sensitiveAgreed.contains(did)) {
+ if (done != null) {
+ done.run();
+ }
+ return;
+ }
+ final AlertDialog progressDialog = new AlertDialog(fragment.getContext(), AlertDialog.ALERT_TYPE_SPINNER);
+ progressDialog.showDelayed(200);
+ getContentSettings(settings -> {
+ progressDialog.dismissUnless(200);
+ boolean[] always = new boolean[1];
+ FrameLayout frameLayout = new FrameLayout(fragment.getContext());
+ if (settings != null && settings.sensitive_can_change) {
+ CheckBoxCell checkbox = new CheckBoxCell(fragment.getContext(), 1, fragment.getResourceProvider());
+ checkbox.setBackground(Theme.getSelectorDrawable(false));
+ checkbox.setText(getString(R.string.MessageShowSensitiveContentAlways), "", always[0], false);
+ checkbox.setPadding(LocaleController.isRTL ? dp(16) : dp(8), 0, LocaleController.isRTL ? dp(8) : dp(16), 0);
+ frameLayout.addView(checkbox, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.TOP | Gravity.LEFT, 0, 0, 0, 0));
+ checkbox.setOnClickListener(v -> {
+ CheckBoxCell cell1 = (CheckBoxCell) v;
+ always[0] = !always[0];
+ cell1.setChecked(always[0], true);
+ });
+ }
+ final boolean[] doneSet = new boolean[1];
+ new AlertDialog.Builder(fragment.getContext(), fragment.getResourceProvider())
+ .setTitle(getString(R.string.MessageShowSensitiveContentChannelTitle))
+ .setMessage(getString(R.string.MessageShowSensitiveContentChannelText))
+ .setView(frameLayout).setCustomViewOffset(9)
+ .setNegativeButton(getString(R.string.Cancel), null)
+ .setPositiveButton(getString(R.string.MessageShowSensitiveContentButton), (di, w) -> {
+ doneSet[0] = true;
+ sensitiveAgreed.add(did);
+ if (always[0] && settings != null && settings.sensitive_can_change) {
+ getMessagesController().setContentSettings(true);
+ BulletinFactory.of(fragment)
+ .createSimpleBulletinDetail(R.raw.chats_infotip, AndroidUtilities.replaceArrows(AndroidUtilities.premiumText(getString(R.string.SensitiveContentSettingsToast), () -> {
+ fragment.presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC).highlightSensitiveRow());
+ }), true))
+ .show(true);
+ }
+ if (done != null) {
+ done.run();
+ }
+ })
+ .setOnDismissListener(di -> {
+ if (!doneSet[0] && canceled != null) {
+ canceled.run();
+ }
+ })
+ .show();
+ });
+ }
+
public static void showCantOpenAlert(BaseFragment fragment, String reason) {
if (fragment == null || fragment.getParentActivity() == null) {
return;
@@ -19827,6 +20103,8 @@ public class MessagesController extends BaseController implements NotificationCe
return checkCanOpenChat(bundle, fragment, originalMessage, null);
}
+ private final HashSet sensitiveAgreed = new HashSet<>();
+
public boolean checkCanOpenChat(Bundle bundle, BaseFragment fragment, MessageObject originalMessage, Browser.Progress progress) {
if (bundle == null || fragment == null) {
return true;
@@ -19836,9 +20114,12 @@ public class MessagesController extends BaseController implements NotificationCe
long userId = bundle.getLong("user_id", 0);
long chatId = bundle.getLong("chat_id", 0);
int messageId = bundle.getInt("message_id", 0);
+ long dialogId = 0;
if (userId != 0) {
+ dialogId = userId;
user = getUser(userId);
} else if (chatId != 0) {
+ dialogId = -chatId;
chat = getChat(chatId);
}
if (user == null && chat == null) {
@@ -19936,7 +20217,7 @@ public class MessagesController extends BaseController implements NotificationCe
return true;
}
- public static void openChatOrProfileWith(TLRPC.User user, TLRPC.Chat chat, BaseFragment fragment, int type, boolean closeLast) {
+ public void openChatOrProfileWith(TLRPC.User user, TLRPC.Chat chat, BaseFragment fragment, int type, boolean closeLast) {
if (user == null && chat == null || fragment == null) {
return;
}
@@ -20201,7 +20482,7 @@ public class MessagesController extends BaseController implements NotificationCe
});
}
- public void setCustomChatReactions(long chatId, int type, List reactions, int reactionsCount, Utilities.Callback onError, Runnable onSuccess) {
+ public void setCustomChatReactions(long chatId, int type, List reactions, int reactionsCount, Boolean allow_paid, Utilities.Callback onError, Runnable onSuccess) {
TLRPC.TL_messages_setChatAvailableReactions req = new TLRPC.TL_messages_setChatAvailableReactions();
req.peer = getInputPeer(-chatId);
if (type == ChatReactionsEditActivity.SELECT_TYPE_NONE || reactions.isEmpty()) {
@@ -20213,6 +20494,10 @@ public class MessagesController extends BaseController implements NotificationCe
req.available_reactions = someReactions;
someReactions.reactions.addAll(reactions);
}
+ if (allow_paid != null) {
+ req.flags |= 2;
+ req.paid_enabled = allow_paid;
+ }
req.flags |= 1;
req.reactions_limit = reactionsCount;
getConnectionsManager().sendRequest(req, (response, error) -> {
@@ -20252,6 +20537,9 @@ public class MessagesController extends BaseController implements NotificationCe
chatFull.flags |= 1048576;
}
chatFull.reactions_limit = reactionsCount;
+ if (allow_paid != null) {
+ chatFull.paid_reactions_available = allow_paid;
+ }
getMessagesStorage().updateChatInfo(chatFull, false);
}
}
@@ -21485,4 +21773,219 @@ public class MessagesController extends BaseController implements NotificationCe
return true;
}
};
+
+ public static boolean equals(TLRPC.MessageMedia a, TLRPC.MessageMedia b) {
+ if (a instanceof TLRPC.TL_messageMediaDocument) {
+ if (!(b instanceof TLRPC.TL_messageMediaDocument)) return false;
+ return a.document.id == b.document.id;
+ } else if (b instanceof TLRPC.TL_messageMediaPhoto) {
+ if (!(b instanceof TLRPC.TL_messageMediaPhoto)) return false;
+ return a.photo.id == b.photo.id;
+ }
+ return false;
+ }
+
+ public static TLRPC.InputDocument toInputDocument(TLRPC.Document document) {
+ TLRPC.TL_inputDocument id = new TLRPC.TL_inputDocument();
+ id.id = document.id;
+ id.access_hash = document.access_hash;
+ id.file_reference = document.file_reference;
+ return id;
+ }
+
+ public static TLRPC.InputMedia toInputMedia(TLRPC.MessageMedia media) {
+ if (media instanceof TLRPC.TL_messageMediaDocument) {
+ TLRPC.TL_inputMediaDocument input = new TLRPC.TL_inputMediaDocument();
+ input.id = new TLRPC.TL_inputDocument();
+ input.id.id = media.document.id;
+ input.id.access_hash = media.document.access_hash;
+ input.id.file_reference = media.document.file_reference;
+ return input;
+ } else if (media instanceof TLRPC.TL_messageMediaPhoto) {
+ TLRPC.TL_inputMediaPhoto input = new TLRPC.TL_inputMediaPhoto();
+ input.id = new TLRPC.TL_inputPhoto();
+ input.id.id = media.photo.id;
+ input.id.access_hash = media.photo.access_hash;
+ input.id.file_reference = media.photo.file_reference;
+ return input;
+ }
+ return null;
+ }
+
+ public void openApp(TLRPC.User bot, int classGuid) {
+ openApp(null, bot, classGuid, null);
+ }
+ public void openApp(BaseFragment _fragment, TLRPC.User bot, int classGuid, Browser.Progress progress) {
+ if (bot == null) return;
+
+ boolean[] cancelled = new boolean[] { false };
+ if (progress != null) {
+ progress.onCancel(() -> cancelled[0] = true);
+ progress.init();
+ }
+
+ final TL_bots.BotInfo[] botInfo = new TL_bots.BotInfo[1];
+ Runnable open = () -> {
+ BaseFragment fragment = _fragment != null ? _fragment : LaunchActivity.getSafeLastFragment();
+ if (fragment == null) return;
+ if (progress != null) {
+ progress.end();
+ }
+ if (cancelled[0]) return;
+ if (bot.bot_has_main_app) {
+ if (fragment.getParentLayout() instanceof ActionBarLayout) {
+ fragment = ((ActionBarLayout) fragment.getParentLayout()).getSheetFragment();
+ }
+ AndroidUtilities.hideKeyboard(fragment.getFragmentView());
+ WebViewRequestProps props = WebViewRequestProps.of(currentAccount, bot.id, bot.id, null, null, BotWebViewAttachedSheet.TYPE_WEB_VIEW_BOT_MAIN, 0, false, null, false, null, bot, 0, false);
+ if (LaunchActivity.instance != null && LaunchActivity.instance.getBottomSheetTabs() != null && LaunchActivity.instance.getBottomSheetTabs().tryReopenTab(props) != null) {
+ return;
+ }
+ if (AndroidUtilities.isTablet()) {
+ BotWebViewSheet webViewSheet = new BotWebViewSheet(fragment.getContext(), fragment.getResourceProvider());
+ webViewSheet.setDefaultFullsize(true);
+ webViewSheet.setNeedsContext(true);
+ webViewSheet.setParentActivity(fragment.getParentActivity());
+ webViewSheet.requestWebView(null, props);
+ webViewSheet.show();
+ } else {
+ BotWebViewAttachedSheet sheet = fragment.createBotViewer();
+ sheet.setDefaultFullsize(true);
+ sheet.setNeedsContext(false);
+ sheet.setParentActivity(fragment.getParentActivity());
+ sheet.requestWebView(null, props);
+ sheet.show();
+ }
+ } else if (botInfo[0] != null && botInfo[0].menu_button instanceof TL_bots.TL_botMenuButton) {
+ if (fragment.getParentLayout() instanceof ActionBarLayout) {
+ fragment = ((ActionBarLayout) fragment.getParentLayout()).getSheetFragment();
+ }
+ TL_bots.TL_botMenuButton btn = (TL_bots.TL_botMenuButton) botInfo[0].menu_button;
+ AndroidUtilities.hideKeyboard(fragment.getFragmentView());
+ WebViewRequestProps props = WebViewRequestProps.of(currentAccount, bot.id, bot.id, btn.text, btn.url, BotWebViewAttachedSheet.TYPE_BOT_MENU_BUTTON, 0, false, null, false, null, bot, 0, false);
+ if (LaunchActivity.instance != null && LaunchActivity.instance.getBottomSheetTabs() != null && LaunchActivity.instance.getBottomSheetTabs().tryReopenTab(props) != null) {
+ return;
+ }
+ if (AndroidUtilities.isTablet()) {
+ BotWebViewSheet webViewSheet = new BotWebViewSheet(fragment.getContext(), fragment.getResourceProvider());
+ webViewSheet.setDefaultFullsize(false);
+ webViewSheet.setNeedsContext(true);
+ webViewSheet.setParentActivity(fragment.getParentActivity());
+ webViewSheet.requestWebView(null, props);
+ webViewSheet.show();
+ } else {
+ BotWebViewAttachedSheet sheet = fragment.createBotViewer();
+ sheet.setDefaultFullsize(false);
+ sheet.setNeedsContext(false);
+ sheet.setParentActivity(fragment.getParentActivity());
+ sheet.requestWebView(null, props);
+ sheet.show();
+ }
+ } else {
+ fragment.presentFragment(ChatActivity.of(bot.id));
+ }
+ };
+
+ botInfo[0] = getMediaDataController().getBotInfoCached(bot.id, bot.id);
+ if (bot.bot_has_main_app) {
+ open.run();
+ } else if (botInfo[0] == null) {
+ getMediaDataController().loadBotInfo(bot.id, bot.id, false, classGuid, _botInfo -> {
+ if (cancelled[0]) return;
+ botInfo[0] = _botInfo;
+ if (botInfo[0] == null) {
+ TLRPC.UserFull userFull = getUserFull(bot.id);
+ if (userFull == null) {
+ if (cancelled[0]) return;
+ loadFullUser(bot, classGuid, true, userFull1 -> {
+ if (cancelled[0]) return;
+ if (userFull1 != null) {
+ botInfo[0] = userFull1.bot_info;
+ }
+ AndroidUtilities.runOnUIThread(open);
+ });
+ } else {
+ botInfo[0] = userFull.bot_info;
+ open.run();
+ }
+ } else {
+ open.run();
+ }
+ });
+ } else {
+ open.run();
+ }
+ }
+
+
+ private boolean contentSettingsLoading;
+ private ArrayList> contentSettingsCallbacks;
+ private long contentSettingsLoadedTime;
+ private TL_account.contentSettings contentSettings;
+
+ public TL_account.contentSettings getContentSettings() {
+ return contentSettings;
+ }
+
+ public void getContentSettings(Utilities.Callback whenReceived) {
+ if (contentSettings != null && System.currentTimeMillis() - contentSettingsLoadedTime < 1000 * 60 * 60) {
+ if (whenReceived != null) whenReceived.run(contentSettings);
+ return;
+ }
+
+ if (contentSettingsCallbacks == null) contentSettingsCallbacks = new ArrayList<>();
+ if (whenReceived != null) contentSettingsCallbacks.add(whenReceived);
+ if (contentSettingsLoading) return;
+ contentSettingsLoading = true;
+
+ TL_account.getContentSettings req = new TL_account.getContentSettings();
+ getConnectionsManager().sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> {
+ if (res instanceof TL_account.contentSettings) {
+ contentSettings = (TL_account.contentSettings) res;
+ contentSettingsLoadedTime = System.currentTimeMillis();
+ }
+ contentSettingsLoading = false;
+ if (contentSettingsCallbacks != null) {
+ for (Utilities.Callback callback : contentSettingsCallbacks) {
+ callback.run(contentSettings);
+ }
+ contentSettingsCallbacks.clear();
+ contentSettingsCallbacks = null;
+ }
+ }));
+ }
+
+ public void invalidateContentSettings() {
+ contentSettings = null;
+ contentSettingsLoadedTime = 0;
+ }
+
+ public void setContentSettings(boolean showSensitiveContent) {
+ if (contentSettings != null) {
+ if (!contentSettings.sensitive_can_change) {
+ return;
+ }
+ contentSettings.sensitive_enabled = showSensitiveContent;
+ }
+
+ if (ignoreRestrictionReasons == null) ignoreRestrictionReasons = new HashSet<>();
+ if (showSensitiveContent) ignoreRestrictionReasons.add("sensitive");
+ else ignoreRestrictionReasons.remove("sensitive");
+
+ TL_account.setContentSettings req = new TL_account.setContentSettings();
+ req.sensitive_enabled = showSensitiveContent;
+ getConnectionsManager().sendRequest(req, (res, err) -> AndroidUtilities.runOnUIThread(() -> {
+ if (err != null) {
+ BulletinFactory.showError(err);
+ }
+ }));
+ }
+
+ public boolean showSensitiveContent() {
+ if (contentSettings != null && System.currentTimeMillis() - contentSettingsLoadedTime < 1000 * 60 * 60) {
+ return contentSettings.sensitive_enabled;
+ }
+ return ignoreRestrictionReasons == null || ignoreRestrictionReasons.contains("sensitive");
+ }
+
}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java
index 73590c2fb..5fd111729 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java
@@ -38,6 +38,7 @@ import org.telegram.tgnet.NativeByteBuffer;
import org.telegram.tgnet.RequestDelegate;
import org.telegram.tgnet.TLObject;
import org.telegram.tgnet.TLRPC;
+import org.telegram.tgnet.tl.TL_bots;
import org.telegram.tgnet.tl.TL_stories;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Adapters.DialogsSearchAdapter;
@@ -1404,6 +1405,7 @@ public class MessagesStorage extends BaseController {
database.executeFast("DELETE FROM business_replies").stepThis().dispose();
database.executeFast("DELETE FROM quick_replies_messages").stepThis().dispose();
database.executeFast("DELETE FROM effects").stepThis().dispose();
+ database.executeFast("DELETE FROM app_config").stepThis().dispose();
cursor = database.queryFinalized("SELECT did FROM dialogs WHERE 1");
@@ -2183,6 +2185,9 @@ public class MessagesStorage extends BaseController {
for (int a = 0; a < dialogs.size(); a++) {
long did = dialogs.keyAt(a);
ReadDialog dialog = dialogs.valueAt(a);
+ if (getMessagesController().isForum(did)) {
+ getMessagesController().markAllTopicsAsRead(did);
+ }
getMessagesController().markDialogAsRead(did, dialog.lastMid, dialog.lastMid, dialog.date, false, 0, dialog.unreadCount, true, 0);
}
});
@@ -7453,7 +7458,7 @@ public class MessagesStorage extends BaseController {
cursor.dispose();
cursor = null;
for (int a = 0; a < info.bot_info.size(); a++) {
- TLRPC.BotInfo botInfo = info.bot_info.get(a);
+ TL_bots.BotInfo botInfo = info.bot_info.get(a);
usersToLoad.add(botInfo.user_id);
}
}
@@ -8282,7 +8287,7 @@ public class MessagesStorage extends BaseController {
});
}
- public Runnable getMessagesInternal(long dialogId, long mergeDialogId, int count, int max_id, int offset_date, int minDate, int classGuid, int load_type, int mode, long threadMessageId, int loadIndex, boolean processMessages, boolean isTopic, MessageLoaderLogger loaderLogger) {
+ public Runnable getMessagesInternal(long dialogId, long mergeDialogId, int count, int max_id, int offset_date, int minDate, int classGuid, int load_type, int mode, long threadMessageId, int loadIndex, boolean processMessages, boolean isTopic, Timer loaderLogger) {
TLRPC.TL_messages_messages res = new TLRPC.TL_messages_messages();
long currentUserId = getUserConfig().clientUserId;
int count_unread = 0;
@@ -9267,19 +9272,16 @@ public class MessagesStorage extends BaseController {
}
}
- public void getMessages(long dialogId, long mergeDialogId, boolean loadInfo, int count, int max_id, int offset_date, int minDate, int classGuid, int load_type, int mode, long replyMessageId, int loadIndex, boolean processMessages, boolean isTopic, MessageLoaderLogger loaderLogger) {
+ public void getMessages(long dialogId, long mergeDialogId, boolean loadInfo, int count, int max_id, int offset_date, int minDate, int classGuid, int load_type, int mode, long replyMessageId, int loadIndex, boolean processMessages, boolean isTopic, Timer loaderLogger) {
+ Timer.Task t1 = Timer.start(loaderLogger, "MessagesStorage.getMessages: storageQueue.postRunnable");
storageQueue.postRunnable(() -> {
- if (loaderLogger != null) {
- loaderLogger.logStorageQueuePost();
- }
+ Timer.done(t1);
+ Timer.Task t2 = Timer.start(loaderLogger, "MessagesStorage.getMessages");
Runnable processMessagesRunnable = getMessagesInternal(dialogId, mergeDialogId, count, max_id, offset_date, minDate, classGuid, load_type, mode, replyMessageId, loadIndex, processMessages, isTopic, loaderLogger);
- if (loaderLogger != null) {
- loaderLogger.logStorageProccessing();
- }
+ Timer.done(t2);
+ Timer.Task t3 = Timer.start(loaderLogger, "MessagesStorage.getMessages: stageQueue.postRunnable");
Utilities.stageQueue.postRunnable(() -> {
- if (loaderLogger != null) {
- loaderLogger.logStageQueuePost();
- }
+ Timer.done(t3);
processMessagesRunnable.run();
});
});
@@ -14819,6 +14821,9 @@ public class MessagesStorage extends BaseController {
} else if (oldMessage.media instanceof TLRPC.TL_messageMediaDocument && message.media instanceof TLRPC.TL_messageMediaDocument && oldMessage.media.document != null && message.media.document != null) {
sameMedia = oldMessage.media.document.id == message.media.document.id;
}
+ if (oldMessage.out && !message.out) {
+ message.out = oldMessage.out;
+ }
if (!sameMedia) {
addFilesToDelete(oldMessage, filesToDelete, idsToDelete, namesToDelete, false);
}
@@ -15362,6 +15367,14 @@ public class MessagesStorage extends BaseController {
}
}
}
+ if (message.reactions != null && message.reactions.top_reactors != null) {
+ for (int i = 0; i < message.reactions.top_reactors.size(); ++i) {
+ final TLRPC.MessageReactor reactor = message.reactions.top_reactors.get(i);
+ if (reactor != null && reactor.peer_id != null) {
+ addLoadPeerInfo(reactor.peer_id, usersToLoad, chatsToLoad);
+ }
+ }
+ }
}
public static void addLoadPeerInfo(TLRPC.Peer peer, ArrayList usersToLoad, ArrayList chatsToLoad) {
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java
index cc9a31426..ea5cfb9b6 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java
@@ -105,6 +105,7 @@ public class NotificationCenter {
public static final int wasUnableToFindCurrentLocation = totalEvents++;
public static final int reloadHints = totalEvents++;
public static final int reloadInlineHints = totalEvents++;
+ public static final int reloadWebappsHints = totalEvents++;
public static final int newDraftReceived = totalEvents++;
public static final int recentDocumentsDidLoad = totalEvents++;
public static final int needAddArchivedStickers = totalEvents++;
@@ -143,6 +144,8 @@ public class NotificationCenter {
public static final int businessMessagesUpdated = totalEvents++;
public static final int quickRepliesUpdated = totalEvents++;
public static final int quickRepliesDeleted = totalEvents++;
+ public static final int bookmarkAdded = totalEvents++;
+ public static final int starReactionAnonymousUpdate = totalEvents++;
public static final int businessLinksUpdated = totalEvents++;
public static final int businessLinkCreated = totalEvents++;
@@ -250,12 +253,16 @@ public class NotificationCenter {
public static final int premiumFloodWaitReceived = totalEvents++;
public static final int availableEffectsUpdate = totalEvents++;
public static final int starOptionsLoaded = totalEvents++;
+ public static final int starGiftOptionsLoaded = totalEvents++;
public static final int starBalanceUpdated = totalEvents++;
public static final int starTransactionsLoaded = totalEvents++;
+ public static final int starSubscriptionsLoaded = totalEvents++;
public static final int factCheckLoaded = totalEvents++;
public static final int botStarsUpdated = totalEvents++;
public static final int botStarsTransactionsLoaded = totalEvents++;
public static final int channelStarsUpdated = totalEvents++;
+ public static final int webViewResolved = totalEvents++;
+ public static final int updateAllMessages = totalEvents++;
//global
public static final int pushMessagesUpdated = totalEvents++;
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java
index 58c0536b9..770c07adb 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java
@@ -34,7 +34,6 @@ import android.provider.OpenableColumns;
import android.text.Spannable;
import android.text.TextUtils;
import android.util.Base64;
-import android.util.Log;
import android.util.SparseArray;
import android.util.TypedValue;
import android.view.Gravity;
@@ -85,12 +84,12 @@ import org.telegram.ui.TwoStepVerificationSetupActivity;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+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.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -100,6 +99,8 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
public class SendMessagesHelper extends BaseController implements NotificationCenter.NotificationCenterDelegate {
@@ -3098,7 +3099,15 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
return voteSendTime.get(pollId, 0L);
}
- public void sendReaction(MessageObject messageObject, ArrayList visibleReactions, ReactionsLayoutInBubble.VisibleReaction addedReaction, boolean big, boolean addToRecent, BaseFragment parentFragment, Runnable callback) {
+ public void sendReaction(
+ MessageObject messageObject,
+ ArrayList visibleReactions,
+ ReactionsLayoutInBubble.VisibleReaction addedReaction,
+ boolean big,
+ boolean addToRecent,
+ BaseFragment parentFragment,
+ Runnable callback
+ ) {
if (messageObject == null || parentFragment == null) {
return;
}
@@ -3148,7 +3157,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
TLRPC.TL_messages_requestUrlAuth req = new TLRPC.TL_messages_requestUrlAuth();
req.url = url;
req.flags |= 4;
- getConnectionsManager().sendRequest(req, (response, error) -> {
+ getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
if (response != null) {
if (response instanceof TLRPC.TL_urlAuthResultRequest) {
TLRPC.TL_urlAuthResultRequest res = (TLRPC.TL_urlAuthResultRequest) response;
@@ -3162,7 +3171,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
} else {
AlertsCreator.showOpenUrlAlert(parentFragment, url, false, ask);
}
- }, ConnectionsManager.RequestFlagFailOnServerErrors);
+ }), ConnectionsManager.RequestFlagFailOnServerErrors);
}
public void sendCallback(final boolean cache, final MessageObject messageObject, final TLRPC.KeyboardButton button, final ChatActivity parentFragment) {
@@ -3654,7 +3663,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
user.phone = newMsg.media.phone_number;
user.first_name = newMsg.media.first_name;
user.last_name = newMsg.media.last_name;
- TLRPC.TL_restrictionReason reason = new TLRPC.TL_restrictionReason();
+ TLRPC.RestrictionReason reason = new TLRPC.RestrictionReason();
reason.platform = "";
reason.reason = "";
reason.text = newMsg.media.vcard;
@@ -3936,7 +3945,8 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
}
newMsg.local_id = newMsg.id = getUserConfig().getNewMessageId();
newMsg.out = true;
- if (isChannel && sendToPeer != null) {
+ TLRPC.Chat chat = sendToPeer != null ? getMessagesController().getChat(sendToPeer.channel_id) : null;
+ if (isChannel && sendToPeer != null && (chat == null || !chat.signatures)) {
newMsg.from_id = new TLRPC.TL_peerChannel();
newMsg.from_id.channel_id = sendToPeer.channel_id;
} else if (fromPeer != null) {
@@ -4006,10 +4016,10 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
newMsg.unread = true;
} else {
newMsg.post = true;
- if (chat.signatures) {
- newMsg.from_id = new TLRPC.TL_peerUser();
- newMsg.from_id.user_id = myId;
- }
+// if (chat.signatures && !chat.signature_profiles) {
+// newMsg.from_id = new TLRPC.TL_peerUser();
+// newMsg.from_id.user_id = myId;
+// }
}
}
} else {
@@ -7029,7 +7039,46 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
continue;
}
- String path = MediaController.copyFileToCache(mediaUri, "txt");
+ String ext = "txt";
+ String filename = FileLoader.fixFileName(MediaController.getFileName(uri));
+ if (filename != null && filename.endsWith(".zip")) {
+ ext = "zip";
+ }
+
+ String path = MediaController.copyFileToCache(mediaUri, ext);
+ if ("zip".equals(ext)) {
+ File zipfile = new File(path);
+ try {
+ try (ZipInputStream zis = new ZipInputStream(new FileInputStream(zipfile))) {
+ ZipEntry zipEntry = zis.getNextEntry();
+ while (zipEntry != null) {
+ if (zipEntry.getName().endsWith(".txt")) {
+ File newFile = MediaController.createFileInCache(zipEntry.getName(), "txt");
+ path = newFile.getAbsolutePath();
+ FileOutputStream fos = new FileOutputStream(newFile);
+ byte[] buffer = new byte[1024];
+ int len;
+ while ((len = zis.read(buffer)) > 0) {
+ fos.write(buffer, 0, len);
+ }
+ fos.close();
+ break;
+ }
+ zipEntry = zis.getNextEntry();
+ }
+ zis.closeEntry();
+ } catch (IOException e) {
+ FileLog.e(e);
+ }
+ } catch (Exception e2) {
+ FileLog.e(e2);
+ }
+ try {
+ zipfile.delete();
+ } catch (Exception e) {
+ FileLog.e(e);
+ }
+ }
if (path == null) {
continue;
}
@@ -8064,7 +8113,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
user.phone = result.send_message.phone_number;
user.first_name = result.send_message.first_name;
user.last_name = result.send_message.last_name;
- TLRPC.TL_restrictionReason reason = new TLRPC.TL_restrictionReason();
+ TLRPC.RestrictionReason reason = new TLRPC.RestrictionReason();
reason.text = result.send_message.vcard;
reason.platform = "";
reason.reason = "";
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/SharedConfig.java b/TMessagesProj/src/main/java/org/telegram/messenger/SharedConfig.java
index 778dfb3ee..bf5844d4b 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/SharedConfig.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/SharedConfig.java
@@ -275,12 +275,16 @@ public class SharedConfig {
// public static int saveToGalleryFlags;
public static int mapPreviewType = 2;
+ public static int searchEngineType = 0;
+ public static String searchEngineCustomURLQuery, searchEngineCustomURLAutocomplete;
public static boolean chatBubbles = Build.VERSION.SDK_INT >= 30;
public static boolean raiseToSpeak = false;
public static boolean raiseToListen = true;
public static boolean nextMediaTap = true;
public static boolean recordViaSco = false;
public static boolean customTabs = true;
+ public static boolean inappBrowser = true;
+ public static boolean adaptableColorInBrowser = true;
public static boolean directShare = true;
public static boolean inappCamera = true;
public static boolean roundCamera16to9 = true;
@@ -578,11 +582,14 @@ public class SharedConfig {
preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
SaveToGallerySettingsHelper.load(preferences);
mapPreviewType = preferences.getInt("mapPreviewType", 2);
+ searchEngineType = preferences.getInt("searchEngineType", 0);
raiseToListen = preferences.getBoolean("raise_to_listen", true);
raiseToSpeak = preferences.getBoolean("raise_to_speak", false);
nextMediaTap = preferences.getBoolean("next_media_on_tap", true);
recordViaSco = preferences.getBoolean("record_via_sco", false);
customTabs = preferences.getBoolean("custom_tabs", true);
+ inappBrowser = preferences.getBoolean("inapp_browser", true);
+ adaptableColorInBrowser = preferences.getBoolean("adaptableBrowser", false);
directShare = preferences.getBoolean("direct_share", true);
shuffleMusic = preferences.getBoolean("shuffleMusic", false);
playOrderReversed = !shuffleMusic && preferences.getBoolean("playOrderReversed", false);
@@ -1185,6 +1192,14 @@ public class SharedConfig {
editor.apply();
}
+ public static void setSearchEngineType(int value) {
+ searchEngineType = value;
+ SharedPreferences preferences = MessagesController.getGlobalMainSettings();
+ SharedPreferences.Editor editor = preferences.edit();
+ editor.putInt("searchEngineType", searchEngineType);
+ editor.apply();
+ }
+
public static void setNoSoundHintShowed(boolean value) {
if (noSoundHintShowed == value) {
return;
@@ -1224,14 +1239,30 @@ public class SharedConfig {
return raiseToListen && (!speak || raiseToSpeak);
}
- public static void toggleCustomTabs() {
- customTabs = !customTabs;
+ public static void toggleCustomTabs(boolean newValue) {
+ customTabs = newValue;
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("custom_tabs", customTabs);
editor.apply();
}
+ public static void toggleInappBrowser() {
+ inappBrowser = !inappBrowser;
+ SharedPreferences preferences = MessagesController.getGlobalMainSettings();
+ SharedPreferences.Editor editor = preferences.edit();
+ editor.putBoolean("inapp_browser", inappBrowser);
+ editor.apply();
+ }
+
+ public static void toggleBrowserAdaptableColors() {
+ adaptableColorInBrowser = !adaptableColorInBrowser;
+ SharedPreferences preferences = MessagesController.getGlobalMainSettings();
+ SharedPreferences.Editor editor = preferences.edit();
+ editor.putBoolean("adaptableBrowser", adaptableColorInBrowser);
+ editor.apply();
+ }
+
public static void toggleDirectShare() {
directShare = !directShare;
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Timer.java b/TMessagesProj/src/main/java/org/telegram/messenger/Timer.java
new file mode 100644
index 000000000..fb92829b0
--- /dev/null
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/Timer.java
@@ -0,0 +1,104 @@
+package org.telegram.messenger;
+
+import java.util.ArrayList;
+
+public class Timer {
+
+ public static Timer create(String name) {
+ if (!BuildVars.LOGS_ENABLED)
+ return null;
+ return new Timer(name);
+ }
+
+ public static Task start(Timer logger, String task) {
+ if (logger != null) {
+ return logger.start(task);
+ }
+ return null;
+ }
+
+ public static void log(Timer logger, String log) {
+ if (logger != null) {
+ logger.log(log);
+ }
+ }
+
+ public static void done(Task task) {
+ if (task != null) {
+ task.done();
+ }
+ }
+
+
+ int pad = 0;
+
+ final String name;
+ final long startTime;
+
+ public Timer(String name) {
+ this.name = name;
+ this.startTime = System.currentTimeMillis();
+ }
+
+ public ArrayList tasks = new ArrayList<>();
+
+ public Task start(String task) {
+ Task timer = new Task(task);
+ tasks.add(timer);
+ return timer;
+ }
+
+ public void log(String log) {
+ tasks.add(new Log(log));
+ }
+
+ public void finish() {
+ final long totalTime = System.currentTimeMillis() - startTime;
+ StringBuilder s = new StringBuilder();
+ s.append(name).append(" total=").append(totalTime).append("ms\n");
+ for (int i = 0; i < tasks.size(); i++) {
+ if (tasks.get(i) == null) continue;
+ s.append("#").append(i);
+ final int pad = tasks.get(i).pad;
+ for (int j = 0; j < pad; ++j) s.append(" ");
+ s.append(" ").append(tasks.get(i)).append("\n");
+ }
+ FileLog.d(s.toString());
+ }
+
+ public class Task {
+ final long startTime;
+ long endTime = -1;
+
+ final String task;
+ int pad;
+
+ public Task(String task) {
+ startTime = System.currentTimeMillis();
+ this.task = task;
+ Timer.this.pad++;
+ }
+
+ public void done() {
+ if (this.endTime < 0)
+ this.pad = Timer.this.pad--;
+ this.endTime = System.currentTimeMillis();
+ }
+
+ @Override
+ public String toString() {
+ return task + ": " + (endTime < 0 ? "not done" : (endTime - startTime) + "ms");
+ }
+ }
+
+ public class Log extends Task {
+ public Log(String task) {
+ super(task);
+ }
+ @Override
+ public String toString() {
+ return task;
+ }
+ }
+
+}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/UserConfig.java b/TMessagesProj/src/main/java/org/telegram/messenger/UserConfig.java
index b6f521b29..151002867 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/UserConfig.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/UserConfig.java
@@ -46,6 +46,7 @@ public class UserConfig extends BaseController {
public TLRPC.TL_account_tmpPassword tmpPassword;
public int ratingLoadTime;
public int botRatingLoadTime;
+ public int webappRatingLoadTime;
public boolean contactsReimported;
public boolean hasValidDialogLoadIds;
public int migrateOffsetId = -1;
@@ -154,6 +155,7 @@ public class UserConfig extends BaseController {
editor.putBoolean("unreadDialogsLoaded", unreadDialogsLoaded);
editor.putInt("ratingLoadTime", ratingLoadTime);
editor.putInt("botRatingLoadTime", botRatingLoadTime);
+ editor.putInt("webappRatingLoadTime", webappRatingLoadTime);
editor.putBoolean("contactsReimported", contactsReimported);
editor.putInt("loginTime", loginTime);
editor.putBoolean("syncContacts", syncContacts);
@@ -298,6 +300,7 @@ public class UserConfig extends BaseController {
contactsReimported = preferences.getBoolean("contactsReimported", false);
ratingLoadTime = preferences.getInt("ratingLoadTime", 0);
botRatingLoadTime = preferences.getInt("botRatingLoadTime", 0);
+ webappRatingLoadTime = preferences.getInt("webappRatingLoadTime", 0);
loginTime = preferences.getInt("loginTime", currentAccount);
syncContacts = preferences.getBoolean("syncContacts", true);
suggestContacts = preferences.getBoolean("suggestContacts", true);
@@ -466,6 +469,7 @@ public class UserConfig extends BaseController {
migrateOffsetAccess = -1;
ratingLoadTime = 0;
botRatingLoadTime = 0;
+ webappRatingLoadTime = 0;
draftsLoaded = false;
contactsReimported = true;
syncContacts = true;
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/UserObject.java b/TMessagesProj/src/main/java/org/telegram/messenger/UserObject.java
index 8a042abab..19658ad66 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/UserObject.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/UserObject.java
@@ -121,7 +121,7 @@ public class UserObject {
if (name == null) {
return LocaleController.getString(R.string.HiddenName);
}
- int index = name.indexOf(" ");
+ int index = name.indexOf(" ", 2);
if (index >= 0) {
name = name.substring(0, index);
}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java b/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java
index c24bb729f..edfe41d9e 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java
@@ -14,6 +14,7 @@ import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
+import android.net.Uri;
import com.carrotsearch.randomizedtesting.Xoroshiro128PlusRandom;
@@ -612,4 +613,12 @@ public class Utilities {
return list == null || list.isEmpty();
}
+ public static Uri uriParseSafe(String link) {
+ try {
+ return Uri.parse(link);
+ } catch (Exception ignore) {
+ return null;
+ }
+ }
+
}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/VideoEditedInfo.java b/TMessagesProj/src/main/java/org/telegram/messenger/VideoEditedInfo.java
index 30aeb0383..257537b87 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/VideoEditedInfo.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/VideoEditedInfo.java
@@ -26,6 +26,7 @@ import org.telegram.ui.Components.PhotoFilterView;
import org.telegram.ui.Components.Point;
import org.telegram.ui.Components.Reactions.ReactionsLayoutInBubble;
import org.telegram.ui.Stories.recorder.StoryEntry;
+import org.telegram.ui.Stories.recorder.Weather;
import java.util.ArrayList;
import java.util.Locale;
@@ -127,6 +128,7 @@ public class VideoEditedInfo {
public static final byte TYPE_ROUND = 5;
public static final byte TYPE_MESSAGE = 6;
public static final byte TYPE_LINK = 7;
+ public static final byte TYPE_WEATHER = 8;
public byte type;
public byte subType;
@@ -175,6 +177,7 @@ public class VideoEditedInfo {
public TL_stories.MediaArea mediaArea;
public TLRPC.MessageMedia media;
+ public Weather.State weather;
public float density;
public long roundOffset;
@@ -255,6 +258,11 @@ public class VideoEditedInfo {
roundDuration = data.readInt64(exception);
} else if (type == TYPE_PHOTO) {
segmentedPath = data.readString(exception);
+ } else if (type == TYPE_WEATHER) {
+ int magic = data.readInt32(exception);
+ if (magic == 0x7EA7539) {
+ weather = Weather.State.TLdeserialize(data);
+ }
}
}
@@ -321,6 +329,13 @@ public class VideoEditedInfo {
data.writeInt64(roundDuration);
} else if (type == TYPE_PHOTO) {
data.writeString(segmentedPath);
+ } else if (type == TYPE_WEATHER) {
+ if (weather == null) {
+ data.writeInt32(0xdeadbeef);
+ } else {
+ data.writeInt32(0x7EA7539);
+ weather.serializeToStream(data);
+ }
}
}
@@ -374,6 +389,7 @@ public class VideoEditedInfo {
entity.roundLeft = roundLeft;
entity.roundRight = roundRight;
entity.linkSettings = linkSettings;
+ entity.weather = weather;
return entity;
}
}
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 4bf72a64a..f558a3b1a 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/browser/Browser.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/browser/Browser.java
@@ -13,10 +13,10 @@ import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
-import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.BitmapFactory;
import android.net.Uri;
+import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
@@ -43,15 +43,20 @@ import org.telegram.messenger.support.customtabsclient.shared.ServiceConnection;
import org.telegram.messenger.support.customtabsclient.shared.ServiceConnectionCallback;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.TLRPC;
+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.LaunchActivity;
+import org.telegram.ui.web.RestrictedDomainsList;
import java.lang.ref.WeakReference;
+import java.net.IDN;
import java.net.URLEncoder;
-import java.util.Collections;
import java.util.List;
import java.util.regex.Matcher;
+import java.util.regex.Pattern;
public class Browser {
@@ -221,9 +226,12 @@ public class Browser {
public void end() {
end(false);
}
- public void end(boolean replaced) {}
+ public void end(boolean replaced) {
+ if (onEndListener != null) {
+ onEndListener.run();
+ }
+ }
- private Runnable onCancelListener;
public void cancel() {
cancel(false);
}
@@ -233,20 +241,27 @@ public class Browser {
}
end(replaced);
}
+
+ private Runnable onCancelListener;
public void onCancel(Runnable onCancelListener) {
this.onCancelListener = onCancelListener;
}
+
+ private Runnable onEndListener;
+ public void onEnd(Runnable onEndListener) {
+ this.onEndListener = onEndListener;
+ }
}
public static void openUrl(final Context context, Uri uri, final boolean allowCustom, boolean tryTelegraph) {
- openUrl(context, uri, allowCustom, tryTelegraph, false, null, null);
+ openUrl(context, uri, allowCustom, tryTelegraph, false, null, null, false);
}
public static void openUrl(final Context context, Uri uri, final boolean allowCustom, boolean tryTelegraph, Progress inCaseLoading) {
- openUrl(context, uri, allowCustom, tryTelegraph, false, inCaseLoading, null);
+ openUrl(context, uri, allowCustom, tryTelegraph, false, inCaseLoading, null, false);
}
- public static void openUrl(final Context context, Uri uri, boolean _allowCustom, boolean tryTelegraph, boolean forceNotInternalForApps, Progress inCaseLoading, String browser) {
+ public static void openUrl(final Context context, Uri uri, boolean _allowCustom, boolean tryTelegraph, boolean forceNotInternalForApps, Progress inCaseLoading, String browser, boolean allowIntent) {
if (context == null || uri == null) {
return;
}
@@ -338,56 +353,8 @@ public class Browser {
}
uri = Uri.parse("https://" + finalPath);
}
- if (allowCustom && SharedConfig.customTabs && !internalUri && !scheme.equals("tel")) {
- String[] browserPackageNames = null;
- try {
- Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
- List list = context.getPackageManager().queryIntentActivities(browserIntent, 0);
- if (list != null && !list.isEmpty()) {
- browserPackageNames = new String[list.size()];
- for (int a = 0; a < list.size(); a++) {
- browserPackageNames[a] = list.get(a).activityInfo.packageName;
- if (BuildVars.LOGS_ENABLED) {
- FileLog.d("default browser name = " + browserPackageNames[a]);
- }
- }
- }
- } catch (Exception ignore) {
-
- }
-
- List allActivities = null;
- try {
- Intent viewIntent = new Intent(Intent.ACTION_VIEW, uri);
- allActivities = context.getPackageManager().queryIntentActivities(viewIntent, 0);
- if (browserPackageNames != null) {
- for (int a = 0; a < allActivities.size(); a++) {
- for (int b = 0; b < browserPackageNames.length; b++) {
- if (browserPackageNames[b].equals(allActivities.get(a).activityInfo.packageName)) {
- allActivities.remove(a);
- a--;
- break;
- }
- }
- }
- } else {
- for (int a = 0; a < allActivities.size(); a++) {
- if (allActivities.get(a).activityInfo.packageName.toLowerCase().contains("browser") || allActivities.get(a).activityInfo.packageName.toLowerCase().contains("chrome")) {
- allActivities.remove(a);
- a--;
- }
- }
- }
- if (BuildVars.LOGS_ENABLED) {
- for (int a = 0; a < allActivities.size(); a++) {
- FileLog.d("device has " + allActivities.get(a).activityInfo.packageName + " to open " + uri.toString());
- }
- }
- } catch (Exception ignore) {
-
- }
-
- if (forceBrowser[0] || allActivities == null || allActivities.isEmpty()) {
+ if (allowCustom && !SharedConfig.inappBrowser && SharedConfig.customTabs && !internalUri && !scheme.equals("tel") && !isTonsite(uri.toString())) {
+ if (forceBrowser[0] || !openInExternalApp(context, uri.toString(), false) || !hasAppToOpen(context, uri.toString())) {
if (MessagesController.getInstance(currentAccount).authDomains.contains(host)) {
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -401,11 +368,13 @@ public class Browser {
PendingIntent copy = PendingIntent.getBroadcast(ApplicationLoader.applicationContext, 0, new Intent(ApplicationLoader.applicationContext, CustomTabsCopyReceiver.class), PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(getSession());
- builder.addMenuItem(LocaleController.getString("CopyLink", R.string.CopyLink), copy);
+
+ builder.addMenuItem(LocaleController.getString(R.string.CopyLink), copy);
builder.setToolbarColor(Theme.getColor(Theme.key_actionBarBrowser));
builder.setShowTitle(true);
builder.setActionButton(BitmapFactory.decodeResource(context.getResources(), R.drawable.msg_filled_shareout), LocaleController.getString("ShareFile", R.string.ShareFile), PendingIntent.getBroadcast(ApplicationLoader.applicationContext, 0, share, PendingIntent.FLAG_MUTABLE ), true);
+
CustomTabsIntent intent = builder.build();
intent.setUseNewTask();
intent.launchUrl(context, uri);
@@ -416,29 +385,24 @@ public class Browser {
FileLog.e(e);
}
try {
- Intent intent = new Intent(Intent.ACTION_VIEW, uri);
- if (internalUri) {
- ComponentName componentName = new ComponentName(context.getPackageName(), LaunchActivity.class.getName());
- intent.setComponent(componentName);
- }
- if (!TextUtils.isEmpty(browserPackage)) {
- intent.setPackage(browserPackage);
- }
- intent.putExtra(android.provider.Browser.EXTRA_CREATE_NEW_TAB, true);
- intent.putExtra(android.provider.Browser.EXTRA_APPLICATION_ID, context.getPackageName());
- if (internalUri && context instanceof LaunchActivity) {
- intent.putExtra(LaunchActivity.EXTRA_FORCE_NOT_INTERNAL_APPS, forceNotInternalForApps);
- ((LaunchActivity) context).onNewIntent(intent, inCaseLoading);
+ final boolean inappBrowser = (
+ SharedConfig.inappBrowser &&
+ TextUtils.isEmpty(browserPackage) &&
+ !RestrictedDomainsList.getInstance().isRestricted(AndroidUtilities.getHostAuthority(uri, true)) &&
+ (uri.getScheme() == null || "https".equals(uri.getScheme()) || "http".equals(uri.getScheme()) || "tonsite".equals(uri.getScheme()))
+ ||
+ isTonsite(uri.toString())
+ );
+ if (internalUri && LaunchActivity.instance != null) {
+ LaunchActivity.dismissAllWeb();
+ openAsInternalIntent(LaunchActivity.instance, uri.toString(), forceNotInternalForApps, inCaseLoading);
} else {
- try {
- context.startActivity(intent);
- } catch (Exception e2) {
- if (browserPackage != null) {
- intent.setPackage(browserPackage = null);
- context.startActivity(intent);
- } else {
- FileLog.e(e2);
+ if (inappBrowser) {
+ if (!openInExternalApp(context, uri.toString(), allowIntent)) {
+ openInTelegramBrowser(context, uri.toString(), inCaseLoading);
}
+ } else {
+ openInExternalBrowser(context, uri.toString(), allowIntent, browserPackage);
}
}
} catch (Exception e) {
@@ -446,6 +410,189 @@ public class Browser {
}
}
+ public static boolean openAsInternalIntent(Context context, String url) {
+ return openAsInternalIntent(context, url, false, null);
+ }
+ public static boolean openAsInternalIntent(Context context, String url, Browser.Progress progress) {
+ return openAsInternalIntent(context, url, false, progress);
+ }
+ public static boolean openAsInternalIntent(Context context, String url, boolean forceNotInternalForApps) {
+ return openAsInternalIntent(context, url, forceNotInternalForApps, null);
+ }
+ public static boolean openAsInternalIntent(Context context, String url, boolean forceNotInternalForApps, Browser.Progress progress) {
+ if (url == null) return false;
+ LaunchActivity activity = null;
+ if (AndroidUtilities.findActivity(context) instanceof LaunchActivity) {
+ activity = (LaunchActivity) AndroidUtilities.findActivity(context);
+ } else if (LaunchActivity.instance != null) {
+ activity = LaunchActivity.instance;
+ } else {
+ return false;
+ }
+ if (activity == null) return false;
+ final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
+ ComponentName componentName = new ComponentName(context.getPackageName(), LaunchActivity.class.getName());
+ intent.setComponent(componentName);
+ intent.putExtra(android.provider.Browser.EXTRA_CREATE_NEW_TAB, true);
+ intent.putExtra(android.provider.Browser.EXTRA_APPLICATION_ID, context.getPackageName());
+ intent.putExtra(LaunchActivity.EXTRA_FORCE_NOT_INTERNAL_APPS, forceNotInternalForApps);
+ activity.onNewIntent(intent, progress);
+ return true;
+ }
+
+ public static boolean openInTelegramBrowser(Context context, String url, Browser.Progress progress) {
+ if (LaunchActivity.instance != null) {
+ BottomSheetTabs tabs = LaunchActivity.instance.getBottomSheetTabs();
+ if (tabs != null && tabs.tryReopenTab(url) != null) {
+ return true;
+ }
+ }
+ BaseFragment fragment = LaunchActivity.getSafeLastFragment();
+ if (fragment != null && fragment.getParentLayout() instanceof ActionBarLayout) {
+ fragment = ((ActionBarLayout) fragment.getParentLayout()).getSheetFragment();
+ }
+ if (fragment == null) {
+ return false;
+ }
+ fragment.createArticleViewer(false).open(url, progress);
+ return true;
+ }
+
+ public static boolean openInExternalBrowser(Context context, String url, boolean allowIntent) {
+ return openInExternalBrowser(context, url, allowIntent, null);
+ }
+ public static boolean openInExternalBrowser(Context context, String url, boolean allowIntent, String browser) {
+ if (url == null) return false;
+ try {
+ Uri uri = Uri.parse(url);
+ final boolean isIntentScheme = uri.getScheme() != null && uri.getScheme().equalsIgnoreCase("intent");
+ if (isIntentScheme && !allowIntent) return false;
+ final Intent intent = isIntentScheme ?
+ Intent.parseUri(uri.toString(), Intent.URI_INTENT_SCHEME) :
+ new Intent(Intent.ACTION_VIEW, uri);
+ if (!TextUtils.isEmpty(browser)) {
+ intent.setPackage(browser);
+ }
+ intent.putExtra(android.provider.Browser.EXTRA_CREATE_NEW_TAB, true);
+ intent.putExtra(android.provider.Browser.EXTRA_APPLICATION_ID, context.getPackageName());
+ context.startActivity(intent);
+ return true;
+ } catch (Exception e) {
+ FileLog.e(e);
+ }
+ return false;
+ }
+
+ public static boolean isTonsite(String url) {
+ String domain = AndroidUtilities.getHostAuthority(url, true);
+ if (domain != null && (domain.endsWith(".ton") || domain.endsWith(".adnl"))) {
+ return true;
+ }
+ Uri uri = Uri.parse(url);
+ if (uri.getScheme() != null && uri.getScheme().equalsIgnoreCase("tonsite")) {
+ return true;
+ }
+ return false;
+ }
+
+ private static Pattern domainPattern;
+ public static boolean isTonsitePunycode(String url) {
+ if (domainPattern == null) domainPattern = Pattern.compile("^[a-zA-Z0-9\\-\\_\\.]+\\.[a-zA-Z0-9\\-\\_]+$");
+ String domain = AndroidUtilities.getHostAuthority(url, true);
+ if (domain != null && (domain.endsWith(".ton") || domain.endsWith(".adnl"))) {
+ return !domainPattern.matcher(domain).matches();
+ }
+ Uri uri = Uri.parse(url);
+ if (uri.getScheme() != null && uri.getScheme().equalsIgnoreCase("tonsite")) {
+ return !domainPattern.matcher(uri.getScheme()).matches();
+ }
+ return false;
+ }
+
+ public static boolean openInExternalApp(Context context, String url, boolean allowIntent) {
+ if (url == null) return false;
+ try {
+ if (isTonsite(url) || isInternalUrl(url, null)) return false;
+ Uri uri = Uri.parse(url);
+ url = Browser.replace(
+ uri,
+ uri.getScheme() == null ? "https" : uri.getScheme(),
+ uri.getHost() != null ? uri.getHost().toLowerCase() : uri.getHost(),
+ TextUtils.isEmpty(uri.getPath()) ? "/" : uri.getPath()
+ );
+ uri = Uri.parse(url);
+ final boolean isIntentScheme = uri.getScheme() != null && uri.getScheme().equalsIgnoreCase("intent");
+ if (isIntentScheme && !allowIntent) return false;
+ final Intent intent = isIntentScheme ?
+ Intent.parseUri(uri.toString(), Intent.URI_INTENT_SCHEME) :
+ new Intent(Intent.ACTION_VIEW, uri);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
+ intent.addCategory(Intent.CATEGORY_BROWSABLE);
+ intent.addCategory(Intent.CATEGORY_DEFAULT);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ intent.addFlags(Intent.FLAG_ACTIVITY_REQUIRE_NON_BROWSER);
+ } else if (!hasAppToOpen(context, url)) {
+ return false;
+ }
+ context.startActivity(intent);
+ return true;
+ } catch (Exception e) {
+ FileLog.e(e);
+ }
+ return false;
+ }
+
+ public static boolean hasAppToOpen(Context context, String url) {
+ if (url == null) return false;
+
+ String[] browserPackageNames = null;
+ try {
+ Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
+ List list = context.getPackageManager().queryIntentActivities(browserIntent, 0);
+ if (list != null && !list.isEmpty()) {
+ browserPackageNames = new String[list.size()];
+ for (int a = 0; a < list.size(); a++) {
+ browserPackageNames[a] = list.get(a).activityInfo.packageName;
+ if (BuildVars.LOGS_ENABLED) {
+ FileLog.d("default browser name = " + browserPackageNames[a]);
+ }
+ }
+ }
+ } catch (Exception ignore) {}
+
+ List allActivities = null;
+ try {
+ Intent viewIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
+ allActivities = context.getPackageManager().queryIntentActivities(viewIntent, 0);
+ if (browserPackageNames != null) {
+ for (int a = 0; a < allActivities.size(); a++) {
+ for (int b = 0; b < browserPackageNames.length; b++) {
+ if (browserPackageNames[b].equals(allActivities.get(a).activityInfo.packageName)) {
+ allActivities.remove(a);
+ a--;
+ break;
+ }
+ }
+ }
+ } else {
+ for (int a = 0; a < allActivities.size(); a++) {
+ final String packageName = allActivities.get(a).activityInfo.packageName.toLowerCase();
+ if (isBrowserPackageName(packageName)) {
+ allActivities.remove(a);
+ a--;
+ }
+ }
+ }
+ if (BuildVars.LOGS_ENABLED) {
+ for (int a = 0; a < allActivities.size(); a++) {
+ FileLog.d("device has " + allActivities.get(a).activityInfo.packageName + " to open " + url);
+ }
+ }
+ } catch (Exception ignore) {}
+
+ return allActivities != null && !allActivities.isEmpty();
+ }
+
public static boolean isInternalUrl(String url, boolean[] forceBrowser) {
return isInternalUri(Uri.parse(url), false, forceBrowser);
}
@@ -596,30 +743,76 @@ public class Browser {
return null;
}
- public static String replaceHostname(Uri originalUri, String newHostname) {
- String scheme = originalUri.getScheme();
- String userInfo = originalUri.getUserInfo();
- int port = originalUri.getPort();
- String path = originalUri.getPath();
- String query = originalUri.getQuery();
- String fragment = originalUri.getFragment();
+ public static boolean isBrowserPackageName(String name) {
+ return name != null && (
+ name.contains("browser") ||
+ name.contains("chrome") ||
+ name.contains("firefox") ||
+ "com.microsoft.emmx".equals(name) ||
+ "com.opera.mini.native".equals(name) ||
+ "com.duckduckgo.mobile.android".equals(name) ||
+ "com.UCMobile.intl".equals(name)
+ );
+ }
- StringBuilder modifiedUriBuilder = new StringBuilder();
- modifiedUriBuilder.append(scheme).append("://");
- if (userInfo != null) {
- modifiedUriBuilder.append(userInfo).append("@");
+ public static boolean isPunycodeAllowed(String host) {
+ if (host == null) return true;
+ String[] levels = host.split("\\.");
+ if (levels.length <= 0) return true;
+ String topLevel = levels[levels.length - 1];
+ return topLevel.startsWith("xn--");
+ }
+
+ public static String IDN_toUnicode(String host) {
+ try {
+ host = IDN.toASCII(host, IDN.ALLOW_UNASSIGNED);
+ } catch (Exception e) {
+ FileLog.e(e);
}
- modifiedUriBuilder.append(newHostname);
- if (port != -1) {
- modifiedUriBuilder.append(":").append(port);
+ if (!isPunycodeAllowed(host)) return host;
+ try {
+ host = IDN.toUnicode(host, IDN.ALLOW_UNASSIGNED);
+ } catch (Exception e) {
+ FileLog.e(e);
}
- modifiedUriBuilder.append(path);
- if (query != null) {
- modifiedUriBuilder.append("?").append(query);
+ return host;
+ }
+
+ public static String replaceHostname(Uri originalUri, String newHostname, String newScheme) {
+ return replace(originalUri, newScheme, newHostname, null);
+ }
+
+ public static String replace(Uri originalUri, String newScheme, String newHostname, String newPath) {
+ final StringBuilder modifiedUriBuilder = new StringBuilder();
+ final String scheme = newScheme == null ? originalUri.getScheme() : newScheme;
+ if (scheme != null) {
+ modifiedUriBuilder.append(scheme).append("://");
}
- if (fragment != null) {
- modifiedUriBuilder.append("#").append(fragment);
+ if (originalUri.getUserInfo() != null) {
+ modifiedUriBuilder.append(originalUri.getUserInfo()).append("@");
+ }
+ if (newHostname == null) {
+ if (originalUri.getHost() != null) {
+ modifiedUriBuilder.append(originalUri.getHost());
+ }
+ } else {
+ modifiedUriBuilder.append(newHostname);
+ }
+ if (originalUri.getPort() != -1) {
+ modifiedUriBuilder.append(":").append(originalUri.getPort());
+ }
+ if (newPath != null) {
+ modifiedUriBuilder.append(newPath);
+ } else {
+ modifiedUriBuilder.append(originalUri.getPath());
+ }
+ if (originalUri.getQuery() != null) {
+ modifiedUriBuilder.append("?").append(originalUri.getQuery());
+ }
+ if (originalUri.getFragment() != null) {
+ modifiedUriBuilder.append("#").append(originalUri.getFragment());
}
return modifiedUriBuilder.toString();
}
+
}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/camera/Camera2Session.java b/TMessagesProj/src/main/java/org/telegram/messenger/camera/Camera2Session.java
index bc37ca6d8..207b15f9f 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/camera/Camera2Session.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/camera/Camera2Session.java
@@ -355,6 +355,17 @@ public class Camera2Session {
}
}
+ private boolean flashing;
+ public void setFlash(boolean flash) {
+ if (flashing != flash) {
+ flashing = flash;
+ updateCaptureRequest();
+ }
+ }
+ public boolean getFlash() {
+ return flashing;
+ }
+
public float getZoom() {
return currentZoom;
}
@@ -476,6 +487,8 @@ public class Camera2Session {
captureRequestBuilder.set(CaptureRequest.CONTROL_SCENE_MODE, isFront ? CameraMetadata.CONTROL_SCENE_MODE_NIGHT_PORTRAIT : CameraMetadata.CONTROL_SCENE_MODE_NIGHT);
}
+ captureRequestBuilder.set(CaptureRequest.FLASH_MODE, flashing ? (recordingVideo ? CaptureRequest.FLASH_MODE_TORCH : CaptureRequest.FLASH_MODE_SINGLE) : CaptureRequest.FLASH_MODE_OFF);
+
if (recordingVideo) {
captureRequestBuilder.set(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE, new Range(30, 60));
captureRequestBuilder.set(CaptureRequest.CONTROL_CAPTURE_INTENT, CaptureRequest.CONTROL_CAPTURE_INTENT_VIDEO_RECORD);
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/camera/CameraController.java b/TMessagesProj/src/main/java/org/telegram/messenger/camera/CameraController.java
index 1f493014d..7349338bf 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/camera/CameraController.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/camera/CameraController.java
@@ -554,6 +554,22 @@ public class CameraController implements MediaRecorder.OnInfoListener {
}
Camera.Parameters params = camera.getParameters();
+ List rawFlashModes = params.getSupportedFlashModes();
+ session.availableFlashModes.clear();
+ if (rawFlashModes != null) {
+ for (int a = 0; a < rawFlashModes.size(); a++) {
+ String rawFlashMode = rawFlashModes.get(a);
+ if (rawFlashMode.equals(Camera.Parameters.FLASH_MODE_OFF) || rawFlashMode.equals(Camera.Parameters.FLASH_MODE_ON) || rawFlashMode.equals(Camera.Parameters.FLASH_MODE_AUTO)) {
+ session.availableFlashModes.add(rawFlashMode);
+ }
+ }
+ if (!TextUtils.equals(session.getCurrentFlashMode(), params.getFlashMode()) || !session.availableFlashModes.contains(session.getCurrentFlashMode())) {
+ session.checkFlashMode(session.availableFlashModes.get(0));
+ } else {
+ session.checkFlashMode(session.getCurrentFlashMode());
+ }
+ }
+
session.configureRoundCamera(true);
if (configureCallback != null) {
configureCallback.run();
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 ae79192cb..ce82a9b91 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/camera/CameraSession.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/camera/CameraSession.java
@@ -138,22 +138,34 @@ public class CameraSession {
return;
}
currentFlashMode = mode;
- configurePhotoCamera();
- SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("camera", Activity.MODE_PRIVATE);
- sharedPreferences.edit().putString(cameraInfo.frontCamera != 0 ? "flashMode_front" : "flashMode", mode).commit();
+ if (isRound) {
+ configureRoundCamera(false);
+ } else {
+ configurePhotoCamera();
+ SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("camera", Activity.MODE_PRIVATE);
+ sharedPreferences.edit().putString(cameraInfo.frontCamera != 0 ? "flashMode_front" : "flashMode", mode).commit();
+ }
}
public void setCurrentFlashMode(String mode) {
currentFlashMode = mode;
- configurePhotoCamera();
- SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("camera", Activity.MODE_PRIVATE);
- sharedPreferences.edit().putString(cameraInfo.frontCamera != 0 ? "flashMode_front" : "flashMode", mode).commit();
+ if (isRound) {
+ configureRoundCamera(false);
+ } else {
+ configurePhotoCamera();
+ SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("camera", Activity.MODE_PRIVATE);
+ sharedPreferences.edit().putString(cameraInfo.frontCamera != 0 ? "flashMode_front" : "flashMode", mode).commit();
+ }
}
public void setTorchEnabled(boolean enabled) {
try {
currentFlashMode = enabled ? Camera.Parameters.FLASH_MODE_TORCH : Camera.Parameters.FLASH_MODE_OFF;
- configurePhotoCamera();
+ if (isRound) {
+ configureRoundCamera(false);
+ } else {
+ configurePhotoCamera();
+ }
} catch (Exception e) {
FileLog.e(e);
}
@@ -262,7 +274,7 @@ public class CameraSession {
} catch (Exception e) {
//
}
- params.setFlashMode(Camera.Parameters.FLASH_MODE_OFF);
+ params.setFlashMode(currentFlashMode);
params.setZoom((int) (currentZoom * maxZoom));
try {
camera.setParameters(params);
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 f0566c216..69b1fb34c 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/ringtone/RingtoneUploader.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/ringtone/RingtoneUploader.java
@@ -89,7 +89,7 @@ public class RingtoneUploader implements NotificationCenter.NotificationCenterDe
} else if (error.text.equals("RINGTONE_SIZE_TOO_BIG")) {
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.showBulletin, Bulletin.TYPE_ERROR_SUBTITLE, LocaleController.formatString("TooLargeError", R.string.TooLargeError), LocaleController.formatString("ErrorRingtoneSizeTooBig", R.string.ErrorRingtoneSizeTooBig, (MessagesController.getInstance(currentAccount).ringtoneSizeMax / 1024)));
} else {
- NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.showBulletin, Bulletin.TYPE_ERROR_SUBTITLE, LocaleController.formatString("InvalidFormatError", R.string.InvalidFormatError), LocaleController.formatString("ErrorRingtoneInvalidFormat", R.string.ErrorRingtoneInvalidFormat));
+ NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.showBulletin, Bulletin.TYPE_ERROR_SUBTITLE, LocaleController.formatString("InvalidFormatError", R.string.InvalidFormatError), LocaleController.getString(R.string.ErrorRingtoneInvalidFormat));
}
});
}
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 1c819bf6c..41bdd821d 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/utils/BillingUtilities.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/utils/BillingUtilities.java
@@ -1,6 +1,8 @@
package org.telegram.messenger.utils;
+import android.app.Activity;
import android.content.Context;
+import android.content.SharedPreferences;
import android.util.Base64;
import androidx.core.util.Pair;
@@ -15,7 +17,10 @@ import org.telegram.messenger.AccountInstance;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.UserConfig;
+import org.telegram.messenger.Utilities;
+import org.telegram.tgnet.AbstractSerializedData;
import org.telegram.tgnet.SerializedData;
+import org.telegram.tgnet.TLObject;
import org.telegram.tgnet.TLRPC;
import java.io.InputStream;
@@ -28,8 +33,6 @@ public class BillingUtilities {
private static final String CURRENCY_FILE = "currencies.json";
private static final String CURRENCY_EXP = "exp";
- private static TLRPC.InputStorePaymentPurpose remPaymentPurpose;
-
@SuppressWarnings("ConstantConditions")
public static void extractCurrencyExp(Map currencyExpMap) {
if (!currencyExpMap.isEmpty()) {
@@ -55,21 +58,146 @@ public class BillingUtilities {
long currentAccountId = accountInstance.getUserConfig().getClientUserId();
byte[] currentAccountIdBytes = String.valueOf(currentAccountId).getBytes(Charsets.UTF_8);
String obfuscatedAccountId = Base64.encodeToString(currentAccountIdBytes, Base64.DEFAULT);
+ return Pair.create(obfuscatedAccountId, savePurpose(paymentPurpose));
+ }
- SerializedData serializedData = new SerializedData(paymentPurpose.getObjectSize());
- paymentPurpose.serializeToStream(serializedData);
- String obfuscatedData = Base64.encodeToString(serializedData.toByteArray(), Base64.DEFAULT);
- serializedData.cleanup();
- if (
- paymentPurpose instanceof TLRPC.TL_inputStorePaymentPremiumGiftCode ||
- paymentPurpose instanceof TLRPC.TL_inputStorePaymentPremiumGiveaway
- ) {
- remPaymentPurpose = paymentPurpose;
- return Pair.create(obfuscatedAccountId, obfuscatedAccountId);
- } else {
- remPaymentPurpose = null;
+ public static String savePurpose(TLRPC.InputStorePaymentPurpose paymentPurpose) {
+ final long id = Utilities.random.nextLong();
+ FileLog.d("BillingUtilities.savePurpose id=" + id + " paymentPurpose=" + paymentPurpose);
+
+ SerializedData id_data = new SerializedData(8);
+ id_data.writeInt64(id);
+ String id_hex = Utilities.bytesToHex(id_data.toByteArray());
+ id_data.cleanup();
+
+ FileLog.d("BillingUtilities.savePurpose id_hex=" + id_hex + " paymentPurpose=" + paymentPurpose);
+
+ TL_savedPurpose savedPurpose = new TL_savedPurpose();
+ savedPurpose.id = id;
+ savedPurpose.flags = 1;
+ savedPurpose.purpose = paymentPurpose;
+
+ SerializedData data = new SerializedData(savedPurpose.getObjectSize());
+ savedPurpose.serializeToStream(data);
+ String full_data_hex = Utilities.bytesToHex(data.toByteArray());
+ data.cleanup();
+
+ if (savedPurpose.getObjectSize() > 28) {
+ FileLog.d("BillingUtilities.savePurpose: sending short version, original size is " + savedPurpose.getObjectSize() + " bytes");
+
+ savedPurpose.flags = 0;
+ savedPurpose.purpose = null;
+ }
+
+ data = new SerializedData(savedPurpose.getObjectSize());
+ savedPurpose.serializeToStream(data);
+ String data_hex = Utilities.bytesToHex(data.toByteArray());
+ data.cleanup();
+
+ SharedPreferences prefs = ApplicationLoader.applicationContext.getSharedPreferences("purchases", Activity.MODE_PRIVATE);
+ prefs.edit().putString(id_hex, full_data_hex).apply();
+ FileLog.d("BillingUtilities.savePurpose: saved {" + full_data_hex + "} under " + id_hex);
+ FileLog.d("BillingUtilities.savePurpose: but sending {" + data_hex + "}");
+
+ return data_hex;
+ }
+
+ public static TLRPC.InputStorePaymentPurpose getPurpose(String data_hex) throws RuntimeException {
+ FileLog.d("BillingUtilities.getPurpose " + data_hex);
+
+ SerializedData data = new SerializedData(Utilities.hexToBytes(data_hex));
+ TL_savedPurpose savedPurpose = TL_savedPurpose.TLdeserialize(data, data.readInt32(true), true);
+ data.cleanup();
+
+ if (savedPurpose.purpose != null) {
+ FileLog.d("BillingUtilities.getPurpose: got purpose from received obfuscated profile id");
+ return savedPurpose.purpose;
+ }
+
+ SerializedData id_data = new SerializedData(8);
+ id_data.writeInt64(savedPurpose.id);
+ String id_hex = Utilities.bytesToHex(id_data.toByteArray());
+ id_data.cleanup();
+
+ FileLog.d("BillingUtilities.getPurpose: searching purpose under " + id_hex);
+
+ SharedPreferences prefs = ApplicationLoader.applicationContext.getSharedPreferences("purchases", Activity.MODE_PRIVATE);
+ String full_data_hex = prefs.getString(id_hex, null);
+ if (full_data_hex == null) {
+ FileLog.d("BillingUtilities.getPurpose: purpose under " + id_hex + " not found");
+ throw new RuntimeException("no purpose under " + id_hex + " found :(");
+ }
+
+ FileLog.d("BillingUtilities.getPurpose: got {" + full_data_hex + "} under " + id_hex);
+
+ SerializedData full_data = new SerializedData(Utilities.hexToBytes(full_data_hex));
+ savedPurpose = TL_savedPurpose.TLdeserialize(full_data, full_data.readInt32(true), true);
+ full_data.cleanup();
+
+ return savedPurpose.purpose;
+ }
+
+ public static void clearPurpose(String data_hex) {
+ try {
+ FileLog.d("BillingUtilities.clearPurpose: got {" + data_hex + "}");
+
+ SerializedData data = new SerializedData(Utilities.hexToBytes(data_hex));
+ TL_savedPurpose savedPurpose = TL_savedPurpose.TLdeserialize(data, data.readInt32(true), true);
+
+ SerializedData id_data = new SerializedData(8);
+ id_data.writeInt64(savedPurpose.id);
+ String id_hex = Utilities.bytesToHex(id_data.toByteArray());
+ id_data.cleanup();
+ FileLog.d("BillingUtilities.clearPurpose: id_hex = " + id_hex);
+
+ SharedPreferences prefs = ApplicationLoader.applicationContext.getSharedPreferences("purchases", Activity.MODE_PRIVATE);
+ prefs.edit().remove(id_hex).apply();
+ } catch (Exception e) {
+ FileLog.e(e);
+ }
+ }
+
+ public static class TL_savedPurpose extends TLObject {
+ public static final int constructor = 0x1d8ad892;
+
+ public int flags;
+ public long id;
+ public TLRPC.InputStorePaymentPurpose purpose;
+
+ public static TL_savedPurpose TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
+ TL_savedPurpose result = null;
+ switch (constructor) {
+ case TL_savedPurpose.constructor:
+ result = new TL_savedPurpose();
+ break;
+ }
+ if (result == null && exception) {
+ throw new RuntimeException(String.format("can't parse magic %x in TL_savedPurpose", constructor));
+ }
+ if (result != null) {
+ result.readParams(stream, exception);
+ }
+ return result;
+ }
+
+ @Override
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ id = stream.readInt64(exception);
+ if ((flags & 1) != 0) {
+ purpose = TLRPC.InputStorePaymentPurpose.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ }
+
+ @Override
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeInt32(flags);
+ stream.writeInt64(id);
+ if ((flags & 1) != 0) {
+ purpose.serializeToStream(stream);
+ }
}
- return Pair.create(obfuscatedAccountId, obfuscatedData);
}
private static AccountInstance findAccountById(long accountId) {
@@ -99,19 +227,11 @@ public class BillingUtilities {
try {
TLRPC.InputStorePaymentPurpose purpose;
- if (remPaymentPurpose == null) {
- try {
- byte[] obfuscatedDataBytes = Base64.decode(obfuscatedData, Base64.DEFAULT);
- SerializedData data = new SerializedData(obfuscatedDataBytes);
- purpose = TLRPC.InputStorePaymentPurpose.TLdeserialize(data, data.readInt32(true), true);
- data.cleanup();
- } catch (Exception e) {
- FileLog.e("Billing: Extract payload, no remPaymentPurpose; failed to get purpose", e);
- purpose = null;
- }
- } else {
- purpose = remPaymentPurpose;
- remPaymentPurpose = null;
+ try {
+ purpose = getPurpose(obfuscatedData);
+ } catch (Exception e) {
+ FileLog.e("Billing: Extract payload, failed to get purpose", e);
+ purpose = null;
}
byte[] obfuscatedAccountIdBytes = Base64.decode(obfuscatedAccountId, Base64.DEFAULT);
@@ -128,4 +248,9 @@ public class BillingUtilities {
return null;
}
}
+
+ public static void cleanupPurchase(Purchase purchase) {
+ AccountIdentifiers identifiers = purchase.getAccountIdentifiers();
+ clearPurpose(identifiers.getObfuscatedProfileId());
+ }
}
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 95ad24841..c0176b151 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/video/TextureRenderer.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/video/TextureRenderer.java
@@ -41,11 +41,7 @@ import android.view.View;
import android.view.inputmethod.EditorInfo;
import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
-import androidx.exifinterface.media.ExifInterface;
-
-import com.google.zxing.common.detector.MathUtils;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
@@ -1342,9 +1338,14 @@ public class TextureRenderer {
}
private void initLocationEntity(VideoEditedInfo.MediaEntity entity) {
- LocationMarker marker = new LocationMarker(ApplicationLoader.applicationContext, entity.density, 0);
+ final int variant = entity.type == VideoEditedInfo.MediaEntity.TYPE_LOCATION ? LocationMarker.VARIANT_LOCATION : LocationMarker.VARIANT_WEATHER;
+ LocationMarker marker = new LocationMarker(ApplicationLoader.applicationContext, variant, entity.density, 0);
+ marker.setIsVideo(true);
marker.setText(entity.text);
marker.setType(entity.subType, entity.color);
+ if (entity.weather != null && entity.entities.isEmpty()) {
+ marker.setCodeEmoji(UserConfig.selectedAccount, entity.weather.getEmoji());
+ }
marker.setMaxWidth(entity.viewWidth);
if (entity.entities.size() == 1) {
marker.forceEmoji();
diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java b/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java
index 795ca50a9..b09615521 100644
--- a/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java
+++ b/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java
@@ -372,8 +372,9 @@ public class ConnectionsManager extends BaseController {
if (response != 0) {
NativeByteBuffer buff = NativeByteBuffer.wrap(response);
buff.reused = true;
+ int magic = buff.readInt32(true);
try {
- resp = object.deserializeResponse(buff, buff.readInt32(true), true);
+ resp = object.deserializeResponse(buff, magic, true);
} catch (Exception e2) {
if (BuildVars.DEBUG_PRIVATE_VERSION) {
throw e2;
diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java b/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java
index 7fac04eac..f7ee2e99a 100644
--- a/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java
+++ b/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java
@@ -26,6 +26,7 @@ import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.SvgHelper;
import org.telegram.messenger.Utilities;
+import org.telegram.tgnet.tl.TL_bots;
import org.telegram.tgnet.tl.TL_stats;
import org.telegram.tgnet.tl.TL_stories;
import org.telegram.ui.Stories.MessageMediaStoryFull;
@@ -78,7 +79,7 @@ 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 = 183;
+ public static final int LAYER = 186;
public static abstract class EmailVerifyPurpose extends TLObject {
@@ -1745,6 +1746,7 @@ public class TLRPC {
public boolean voice;
public byte[] waveform;
public int preload_prefix_size;
+ public double video_start_ts;
public boolean nosound;
public static DocumentAttribute TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
@@ -1768,9 +1770,12 @@ public class TLRPC {
case 0x15590068:
result = new TL_documentAttributeFilename();
break;
- case 0xd38ff1c2:
+ case TL_documentAttributeVideo.constructor:
result = new TL_documentAttributeVideo();
break;
+ case TL_documentAttributeVideo_layer184.constructor:
+ result = new TL_documentAttributeVideo_layer184();
+ break;
case 0x5910cccb:
result = new TL_documentAttributeVideo_layer65();
break;
@@ -1886,6 +1891,43 @@ public class TLRPC {
}
public static class TL_documentAttributeVideo extends DocumentAttribute {
+ public static final int constructor = 0x17399fad;
+
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ round_message = (flags & 1) != 0;
+ supports_streaming = (flags & 2) != 0;
+ nosound = (flags & 8) != 0;
+ duration = stream.readDouble(exception);
+ w = stream.readInt32(exception);
+ h = stream.readInt32(exception);
+ if ((flags & 4) != 0) {
+ preload_prefix_size = stream.readInt32(exception);
+ }
+ if ((flags & 16) != 0) {
+ video_start_ts = stream.readDouble(exception);
+ }
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = round_message ? (flags | 1) : (flags &~ 1);
+ flags = supports_streaming ? (flags | 2) : (flags &~ 2);
+ flags = nosound ? (flags | 8) : (flags &~ 8);
+ stream.writeInt32(flags);
+ stream.writeDouble(duration);
+ stream.writeInt32(w);
+ stream.writeInt32(h);
+ if ((flags & 4) != 0) {
+ stream.writeInt32(preload_prefix_size);
+ }
+ if ((flags & 16) != 0) {
+ stream.writeDouble(video_start_ts);
+ }
+ }
+ }
+
+ public static class TL_documentAttributeVideo_layer184 extends TL_documentAttributeVideo {
public static final int constructor = 0xd38ff1c2;
public void readParams(AbstractSerializedData stream, boolean exception) {
@@ -6069,7 +6111,10 @@ public class TLRPC {
public boolean verified;
public boolean scam;
public boolean fake;
+ public boolean can_refulfill_subscription;
public int color;
+ public TL_starsSubscriptionPricing subscription_pricing;
+ public long subscription_form_id;
public static ChatInvite TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
ChatInvite result = null;
@@ -6077,6 +6122,9 @@ public class TLRPC {
case TL_chatInvite.constructor:
result = new TL_chatInvite();
break;
+ case TL_chatInvite_layer185.constructor:
+ result = new TL_chatInvite_layer185();
+ break;
case TL_chatInvite_layer165.constructor:
result = new TL_chatInvite_layer165();
break;
@@ -6098,6 +6146,90 @@ public class TLRPC {
}
public static class TL_chatInvite extends ChatInvite {
+ public static final int constructor = 0xfe65389d;
+
+ public void readParams(AbstractSerializedData 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) {
+ int magic = stream.readInt32(exception);
+ if (magic != 0x1cb5c415) {
+ if (exception) {
+ 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);
+ }
+ }
+ color = stream.readInt32(exception);
+ if ((flags & 1024) != 0) {
+ subscription_pricing = TL_starsSubscriptionPricing.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ if ((flags & 4096) != 0) {
+ subscription_form_id = stream.readInt64(exception);
+ }
+ }
+
+ public void serializeToStream(AbstractSerializedData 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) {
+ stream.writeInt32(0x1cb5c415);
+ int count = participants.size();
+ stream.writeInt32(count);
+ for (int a = 0; a < count; a++) {
+ participants.get(a).serializeToStream(stream);
+ }
+ }
+ stream.writeInt32(color);
+ if ((flags & 1024) != 0) {
+ subscription_pricing.serializeToStream(stream);
+ }
+ if ((flags & 4096) != 0) {
+ stream.writeInt64(subscription_form_id);
+ }
+ }
+ }
+
+ public static class TL_chatInvite_layer185 extends TL_chatInvite {
public static final int constructor = 0xcde0ec40;
public void readParams(AbstractSerializedData stream, boolean exception) {
@@ -11230,375 +11362,6 @@ public class TLRPC {
}
}
- public static class TL_bots_setBotInfo extends TLObject {
- public static final int constructor = 0x10cf3123;
-
- public int flags;
- public InputUser bot;
- public String lang_code;
- public String name;
- public String about;
- public String description;
-
- 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(flags);
- if ((flags & 4) != 0) {
- bot.serializeToStream(stream);
- }
- stream.writeString(lang_code);
- if ((flags & 8) != 0) {
- stream.writeString(name);
- }
- if ((flags & 1) != 0) {
- stream.writeString(about);
- }
- if ((flags & 2) != 0) {
- stream.writeString(description);
- }
- }
- }
-
- public static class TL_bots_getBotInfo extends TLObject {
- public static final int constructor = 0xdcd914fd;
-
- public int flags;
- public InputUser bot;
- public String lang_code;
-
- public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
- return BotInfo.TLdeserialize(stream, constructor, exception);
- }
-
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- stream.writeInt32(flags);
- if ((flags & 1) != 0) {
- bot.serializeToStream(stream);
- }
- stream.writeString(lang_code);
- }
- }
-
- public static class TL_bots_reorderUsernames extends TLObject {
- public static final int constructor = 0x9709b1c2;
-
- public InputUser bot;
- public ArrayList order = 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);
- 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));
- }
- }
- }
-
- public static class TL_bots_toggleUsername extends TLObject {
- public static final int constructor = 0x53ca973;
-
- public InputUser bot;
- public String username;
- public boolean active;
-
- public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
- return Bool.TLdeserialize(stream, constructor, exception);
- }
-
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- bot.serializeToStream(stream);
- stream.writeString(username);
- stream.writeBool(active);
- }
- }
-
- public static abstract class BotInfo extends TLObject {
- public long user_id;
- public String description;
- public ArrayList commands = new ArrayList<>();
- public int version;
- public BotMenuButton menu_button;
- public int flags;
- public Photo description_photo;
- public Document description_document;
-
- public static BotInfo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
- BotInfo result = null;
- switch (constructor) {
- case 0xe4169b5d:
- result = new TL_botInfo_layer140();
- break;
- case 0xbb2e37ce:
- result = new TL_botInfoEmpty_layer48();
- break;
- case 0x98e81d3a:
- result = new TL_botInfo_layer131();
- break;
- case 0x9cf585d:
- result = new TL_botInfo_layer48();
- break;
- case 0x1b74b335:
- result = new TL_botInfo_layer139();
- break;
- case 0x8f300b57:
- result = new TL_botInfo();
- break;
- }
- if (result == null && exception) {
- throw new RuntimeException(String.format("can't parse magic %x in BotInfo", constructor));
- }
- if (result != null) {
- result.readParams(stream, exception);
- }
- return result;
- }
- }
-
- public static class TL_botInfoEmpty_layer48 extends TL_botInfo {
- public static final int constructor = 0xbb2e37ce;
-
-
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- }
- }
-
- public static class TL_botInfo_layer131 extends TL_botInfo {
- public static final int constructor = 0x98e81d3a;
-
-
- public void readParams(AbstractSerializedData 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++) {
- TL_botCommand object = TL_botCommand.TLdeserialize(stream, stream.readInt32(exception), exception);
- if (object == null) {
- return;
- }
- commands.add(object);
- }
- }
-
- public void serializeToStream(AbstractSerializedData 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);
- }
- }
- }
-
- public static class TL_botInfo_layer48 extends TL_botInfo {
- public static final int constructor = 0x9cf585d;
-
-
- public void readParams(AbstractSerializedData 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++) {
- TL_botCommand object = TL_botCommand.TLdeserialize(stream, stream.readInt32(exception), exception);
- if (object == null) {
- return;
- }
- commands.add(object);
- }
- }
-
- public void serializeToStream(AbstractSerializedData 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);
- }
- }
- }
-
- public static class TL_botInfo_layer139 extends BotInfo {
- public static final int constructor = 0x1b74b335;
-
-
- public void readParams(AbstractSerializedData 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++) {
- TL_botCommand object = TL_botCommand.TLdeserialize(stream, stream.readInt32(exception), exception);
- if (object == null) {
- return;
- }
- commands.add(object);
- }
- }
-
- public void serializeToStream(AbstractSerializedData 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);
- }
- }
- }
-
- public static class TL_botInfo extends BotInfo {
- public static final int constructor = 0x8f300b57;
-
-
- public void readParams(AbstractSerializedData stream, boolean exception) {
- flags = stream.readInt32(exception);
- if ((flags & 1) != 0) {
- user_id = stream.readInt64(exception);
- }
- if ((flags & 2) != 0) {
- description = stream.readString(exception);
- }
- if ((flags & 16) != 0) {
- description_photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception);
- }
- if ((flags & 32) != 0) {
- description_document = 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++) {
- TL_botCommand object = TL_botCommand.TLdeserialize(stream, stream.readInt32(exception), exception);
- if (object == null) {
- return;
- }
- commands.add(object);
- }
- }
- if ((flags & 8) != 0) {
- menu_button = BotMenuButton.TLdeserialize(stream, stream.readInt32(exception), exception);
- }
- }
-
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- 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) {
- stream.writeInt32(0x1cb5c415);
- int count = commands.size();
- stream.writeInt32(count);
- for (int a = 0; a < count; a++) {
- commands.get(a).serializeToStream(stream);
- }
- }
- if ((flags & 8) != 0) {
- menu_button.serializeToStream(stream);
- }
- }
- }
-
- public static class TL_botInfo_layer140 extends TL_botInfo {
- public static final int constructor = 0xe4169b5d;
-
-
- public void readParams(AbstractSerializedData 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++) {
- TL_botCommand object = TL_botCommand.TLdeserialize(stream, stream.readInt32(exception), exception);
- if (object == null) {
- return;
- }
- commands.add(object);
- }
- menu_button = BotMenuButton.TLdeserialize(stream, stream.readInt32(exception), exception);
- }
-
- public void serializeToStream(AbstractSerializedData 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);
- }
- menu_button.serializeToStream(stream);
- }
- }
-
public static abstract class InputGame extends TLObject {
public InputUser bot_id;
public String short_name;
@@ -12995,7 +12758,7 @@ public class TLRPC {
public Photo chat_photo;
public PeerNotifySettings notify_settings;
public TL_chatInviteExported exported_invite;
- public ArrayList bot_info = new ArrayList<>();
+ public ArrayList bot_info = new ArrayList<>();
public int flags;
public boolean can_view_participants;
public boolean can_set_username;
@@ -13055,6 +12818,7 @@ public class TLRPC {
public boolean can_view_revenue;
public boolean can_view_stars_revenue;
public boolean paid_media_allowed;
+ public boolean paid_reactions_available;
public long inviterId; //custom
public int invitesCount; //custom
@@ -13265,7 +13029,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -13405,7 +13169,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -13512,7 +13276,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -13694,7 +13458,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -13795,7 +13559,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -13950,7 +13714,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -14043,7 +13807,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -14162,7 +13926,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -14356,7 +14120,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -14454,7 +14218,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -14599,7 +14363,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -14845,7 +14609,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -15086,7 +14850,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -15279,7 +15043,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -15416,7 +15180,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -15547,7 +15311,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -15690,6 +15454,7 @@ public class TLRPC {
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) {
@@ -15724,7 +15489,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -15852,6 +15617,7 @@ public class TLRPC {
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);
@@ -16034,7 +15800,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -16334,7 +16100,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -16630,7 +16396,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -16908,7 +16674,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -17178,7 +16944,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -17437,7 +17203,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -17706,7 +17472,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -17974,7 +17740,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -18183,7 +17949,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -18361,7 +18127,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -18527,7 +18293,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -18672,7 +18438,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -18810,7 +18576,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -18942,7 +18708,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -19042,7 +18808,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -19108,7 +18874,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -19230,7 +18996,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -19345,7 +19111,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -19441,7 +19207,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -19521,7 +19287,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -19594,7 +19360,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -19658,7 +19424,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -19734,7 +19500,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -19831,7 +19597,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -19925,7 +19691,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -20018,7 +19784,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- BotInfo object = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ TL_bots.BotInfo object = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -25321,6 +25087,7 @@ public class TLRPC {
public boolean bot_nochats;
public boolean bot_can_edit;
public boolean bot_business;
+ public boolean bot_has_main_app;
public boolean verified;
public boolean restricted;
public boolean min;
@@ -25339,7 +25106,7 @@ public class TLRPC {
public String lang_code;
public boolean inactive;
public boolean explicit_content;
- public ArrayList restriction_reason = new ArrayList<>();
+ public ArrayList restriction_reason = new ArrayList<>();
public boolean bot_attach_menu;
public boolean bot_menu_webview;
public boolean attach_menu_enabled;
@@ -25348,6 +25115,7 @@ public class TLRPC {
public int stories_max_id;
public TL_peerColor color;
public TL_peerColor profile_color;
+ public int bot_active_users;
public static User TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
User result = null;
@@ -25355,6 +25123,12 @@ public class TLRPC {
case TL_user.constructor:
result = new TL_user();
break;
+ case TL_user_layer185.constructor:
+ result = new TL_user_layer185();
+ break;
+ case TL_user_layer184.constructor:
+ result = new TL_user_layer184();
+ break;
case TL_user_layer166.constructor:
result = new TL_user_layer166();
break;
@@ -25501,6 +25275,444 @@ public class TLRPC {
}
public static class TL_user extends User {
+ public static final int constructor = 0x83314fca;
+
+ public void readParams(AbstractSerializedData 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;
+ 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);
+ }
+ 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) {
+ int magic = stream.readInt32(exception);
+ if (magic != 0x1cb5c415) {
+ if (exception) {
+ 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 & 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) {
+ int magic = stream.readInt32(exception);
+ if (magic != 0x1cb5c415) {
+ if (exception) {
+ 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);
+ }
+ }
+ 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);
+ }
+ if ((flags2 & 4096) != 0) {
+ bot_active_users = stream.readInt32(exception);
+ }
+ }
+
+ public void serializeToStream(AbstractSerializedData 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);
+ 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) {
+ 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) {
+ 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 & 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) {
+ stream.writeInt32(0x1cb5c415);
+ int count = usernames.size();
+ stream.writeInt32(count);
+ for (int a = 0; a < count; a++) {
+ usernames.get(a).serializeToStream(stream);
+ }
+ }
+ 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_layer185 extends TL_user {
+ public static final int constructor = 0x4fe9cce0;
+
+ public void readParams(AbstractSerializedData 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;
+ contact_require_premium = (flags2 & 1024) != 0;
+ bot_business = (flags2 & 2048) != 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) {
+ int magic = stream.readInt32(exception);
+ if (magic != 0x1cb5c415) {
+ if (exception) {
+ 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 & 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) {
+ int magic = stream.readInt32(exception);
+ if (magic != 0x1cb5c415) {
+ if (exception) {
+ 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);
+ }
+ }
+ 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);
+ }
+ if ((flags2 & 4096) != 0) {
+ bot_active_users = stream.readInt32(exception);
+ }
+ }
+
+ public void serializeToStream(AbstractSerializedData 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);
+ 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) {
+ 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) {
+ 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 & 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) {
+ stream.writeInt32(0x1cb5c415);
+ int count = usernames.size();
+ stream.writeInt32(count);
+ for (int a = 0; a < count; a++) {
+ usernames.get(a).serializeToStream(stream);
+ }
+ }
+ 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_layer184 extends TL_user {
public static final int constructor = 0x215c4438;
public void readParams(AbstractSerializedData stream, boolean exception) {
@@ -25565,7 +25777,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -25775,7 +25987,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -25981,7 +26193,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -26170,7 +26382,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -26344,7 +26556,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -26485,7 +26697,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -26618,7 +26830,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -27716,6 +27928,8 @@ public class TLRPC {
public String cryptoCurrency;
public long cryptoAmount;
public WallPaper wallpaper;
+ public Peer peer;
+ public byte[] payload;
public static MessageAction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
MessageAction result = null;
@@ -27915,6 +28129,12 @@ public class TLRPC {
case TL_messageActionRequestedPeer.constructor:
result = new TL_messageActionRequestedPeer();
break;
+ case TL_messageActionPaymentRefunded.constructor:
+ result = new TL_messageActionPaymentRefunded();
+ break;
+ case TL_messageActionGiftStars.constructor:
+ result = new TL_messageActionGiftStars();
+ break;
}
if (result == null && exception) {
throw new RuntimeException(String.format("can't parse magic %x in MessageAction", constructor));
@@ -27942,6 +28162,72 @@ public class TLRPC {
}
}
+ public static class TL_messageActionPaymentRefunded extends MessageAction {
+ public static final int constructor = 0x41b3e202;
+
+ public TL_paymentCharge charge;
+
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception);
+ currency = stream.readString(exception);
+ total_amount = stream.readInt64(exception);
+ if ((flags & 1) != 0) {
+ payload = stream.readByteArray(exception);
+ }
+ charge = TL_paymentCharge.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeInt32(flags);
+ peer.serializeToStream(stream);
+ stream.writeString(currency);
+ stream.writeInt64(total_amount);
+ if ((flags & 1) != 0) {
+ stream.writeByteArray(payload);
+ }
+ charge.serializeToStream(stream);
+ }
+ }
+
+ public static class TL_messageActionGiftStars extends MessageAction {
+ public static final int constructor = 0x45d5b021;
+
+ public long stars;
+ public TL_paymentCharge charge;
+ public String transaction_id;
+
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ currency = stream.readString(exception);
+ amount = stream.readInt64(exception);
+ stars = stream.readInt64(exception);
+ if ((flags & 1) != 0) {
+ cryptoCurrency = stream.readString(exception);
+ cryptoAmount = stream.readInt64(exception);
+ }
+ if ((flags & 2) != 0) {
+ transaction_id = stream.readString(exception);
+ }
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeInt32(flags);
+ stream.writeString(currency);
+ stream.writeInt64(amount);
+ stream.writeInt64(stars);
+ if ((flags & 1) != 0) {
+ stream.writeString(cryptoCurrency);
+ stream.writeInt64(cryptoAmount);
+ }
+ if ((flags & 2) != 0) {
+ stream.writeString(transaction_id);
+ }
+ }
+ }
+
public static class TL_messageEncryptedAction extends MessageAction {
public static final int constructor = 0x555555F7;
@@ -28984,6 +29270,7 @@ public class TLRPC {
public byte[] payload;
public TL_paymentRequestedInfo info;
public String shipping_option_id;
+ public TL_paymentCharge charge;
public void readParams(AbstractSerializedData stream, boolean exception) {
flags = stream.readInt32(exception);
@@ -28998,6 +29285,7 @@ public class TLRPC {
if ((flags & 2) != 0) {
shipping_option_id = stream.readString(exception);
}
+ charge = TL_paymentCharge.TLdeserialize(stream, stream.readInt32(exception), exception);
}
public void serializeToStream(AbstractSerializedData stream) {
@@ -29014,6 +29302,7 @@ public class TLRPC {
if ((flags & 2) != 0) {
stream.writeString(shipping_option_id);
}
+ charge.serializeToStream(stream);
}
}
@@ -29952,6 +30241,83 @@ public class TLRPC {
}
}
+ public static class MessageReactor extends TLObject {
+
+ public int flags;
+ public boolean top;
+ public boolean my;
+ public boolean anonymous;
+ public Peer peer_id;
+ public int count;
+
+ public static MessageReactor TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
+ MessageReactor result = null;
+ switch (constructor) {
+ case TL_messageReactor.constructor:
+ result = new TL_messageReactor();
+ break;
+ case TL_messageReactor_old.constructor:
+ result = new TL_messageReactor_old();
+ break;
+ }
+ if (result == null && exception) {
+ throw new RuntimeException(String.format("can't parse magic %x in MessageReactor", constructor));
+ }
+ if (result != null) {
+ result.readParams(stream, exception);
+ }
+ return result;
+ }
+ }
+
+ public static class TL_messageReactor extends MessageReactor {
+ public static final int constructor = 0x4ba3a95a;
+
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ top = (flags & 1) != 0;
+ my = (flags & 2) != 0;
+ anonymous = (flags & 4) != 0;
+ if ((flags & 8) != 0) {
+ peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ count = stream.readInt32(exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = top ? (flags | 1) : (flags &~ 1);
+ flags = my ? (flags | 2) : (flags &~ 2);
+ flags = anonymous ? (flags | 4) : (flags &~ 4);
+ stream.writeInt32(flags);
+ if ((flags & 8) != 0) {
+ peer_id.serializeToStream(stream);
+ }
+ stream.writeInt32(count);
+ }
+ }
+
+ public static class TL_messageReactor_old extends TL_messageReactor {
+ public static final int constructor = 0xef00d448;
+
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ top = (flags & 1) != 0;
+ my = (flags & 2) != 0;
+ peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception);
+ count = stream.readInt32(exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = top ? (flags | 1) : (flags &~ 1);
+ flags = my ? (flags | 2) : (flags &~ 2);
+ stream.writeInt32(flags);
+ peer_id.serializeToStream(stream);
+ stream.writeInt32(count);
+ }
+ }
+
public static abstract class MessageReactions extends TLObject {
public int flags;
@@ -29960,6 +30326,7 @@ public class TLRPC {
public boolean reactions_as_tags;
public ArrayList results = new ArrayList<>();
public ArrayList recent_reactions = new ArrayList<>();
+ public ArrayList top_reactors = new ArrayList<>();
public static TL_messageReactions TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
TL_messageReactions result = null;
@@ -29967,9 +30334,12 @@ public class TLRPC {
case 0x87b6e36:
result = new TL_messageReactionsOld();
break;
- case 0x4f2b9479:
+ case TL_messageReactions.constructor:
result = new TL_messageReactions();
break;
+ case TL_messageReactions_layer185.constructor:
+ result = new TL_messageReactions_layer185();
+ break;
case 0xb87a24d1:
result = new TL_messageReactions_layer137();
break;
@@ -29985,6 +30355,96 @@ public class TLRPC {
}
public static class TL_messageReactions extends MessageReactions {
+ public static final int constructor = 0xa339f0b;
+
+ public void readParams(AbstractSerializedData 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);
+ }
+ 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);
+ }
+ }
+ 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);
+ }
+ }
+ }
+
+ public void serializeToStream(AbstractSerializedData 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);
+ }
+ 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);
+ }
+ }
+ 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);
+ }
+ }
+ }
+ }
+
+ public static class TL_messageReactions_layer185 extends TL_messageReactions {
public static final int constructor = 0x4f2b9479;
public void readParams(AbstractSerializedData stream, boolean exception) {
@@ -30739,6 +31199,9 @@ public class TLRPC {
case 0x637b7ed:
result = new TL_topPeerCategoryCorrespondents();
break;
+ case TL_topPeerCategoryBotsApp.constructor:
+ result = new TL_topPeerCategoryBotsApp();
+ break;
}
if (result == null && exception) {
throw new RuntimeException(String.format("can't parse magic %x in TopPeerCategory", constructor));
@@ -30822,6 +31285,15 @@ public class TLRPC {
}
}
+ public static class TL_topPeerCategoryBotsApp extends TopPeerCategory {
+ public static final int constructor = 0xfd9e7bec;
+
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ }
+ }
+
public static abstract class MessageReplyHeader extends TLObject {
public int flags;
@@ -32385,6 +32857,8 @@ public class TLRPC {
public int groupId; //custom
public PhotoSize thumb; //custom
public TLObject thumbObject; //custom
+ public int cachedWidth; //custom
+ public int cachedHeight; //custom
public static PageBlock TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
PageBlock result = null;
@@ -35764,8 +36238,8 @@ public class TLRPC {
case TL_updateChatDefaultBannedRights.constructor:
result = new TL_updateChatDefaultBannedRights();
break;
- case TL_updateBotMenuButton.constructor:
- result = new TL_updateBotMenuButton();
+ case TL_bots.TL_updateBotMenuButton.constructor:
+ result = new TL_bots.TL_updateBotMenuButton();
break;
case TL_updateChannelPinnedTopics.constructor:
result = new TL_updateChannelPinnedTopics();
@@ -42734,7 +43208,7 @@ public class TLRPC {
}
public static class TL_sponsoredMessage extends TLObject {
- public static final int constructor = 0xbdedf566;
+ public static final int constructor = 0x4d93a990;
public int flags;
public boolean recommended;
@@ -42749,6 +43223,7 @@ public class TLRPC {
public String sponsor_info;
public String additional_info;
public TL_peerColor color;
+ public MessageMedia media;
public static TL_sponsoredMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
if (TL_sponsoredMessage.constructor != constructor) {
@@ -42791,6 +43266,9 @@ public class TLRPC {
if ((flags & 64) != 0) {
photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception);
}
+ if ((flags & 16384) != 0) {
+ media = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
if ((flags & 8192) != 0) {
color = TL_peerColor.TLdeserialize(stream, stream.readInt32(exception), exception);
}
@@ -42823,6 +43301,9 @@ public class TLRPC {
if ((flags & 64) != 0) {
photo.serializeToStream(stream);
}
+ if ((flags & 16384) != 0) {
+ media.serializeToStream(stream);
+ }
if ((flags & 8192) != 0) {
color.serializeToStream(stream);
}
@@ -43831,6 +44312,7 @@ public class TLRPC {
public String rank;
public boolean via_invite;
public long user_id;
+ public int subscription_until_date;
public static ChannelParticipant TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
ChannelParticipant result = null;
@@ -43859,9 +44341,12 @@ public class TLRPC {
case 0x34c3bb53:
result = new TL_channelParticipantAdmin();
break;
- case 0xc00c07c0:
+ case TL_channelParticipant.constructor:
result = new TL_channelParticipant();
break;
+ case TL_channelParticipant_layer185.constructor:
+ result = new TL_channelParticipant_layer185();
+ break;
case 0x2fe601d3:
result = new TL_channelParticipantCreator();
break;
@@ -43871,9 +44356,12 @@ public class TLRPC {
case 0xa82fa898:
result = new TL_channelParticipantAdmin_layer92();
break;
- case 0x35a8bfa7:
+ case TL_channelParticipantSelf.constructor:
result = new TL_channelParticipantSelf();
break;
+ case TL_channelParticipantSelf_layer185.constructor:
+ result = new TL_channelParticipantSelf_layer185();
+ break;
case 0x28a8bc67:
result = new TL_channelParticipantSelf_layer133();
break;
@@ -43913,6 +44401,31 @@ public class TLRPC {
}
public static class TL_channelParticipant extends ChannelParticipant {
+ public static final int constructor = 0xcb397619;
+
+
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ peer = new TLRPC.TL_peerUser();
+ peer.user_id = stream.readInt64(exception);
+ date = stream.readInt32(exception);
+ if ((flags & 1) != 0) {
+ subscription_until_date = stream.readInt32(exception);
+ }
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeInt32(flags);
+ stream.writeInt64(peer.user_id);
+ stream.writeInt32(date);
+ if ((flags & 1) != 0) {
+ stream.writeInt32(subscription_until_date);
+ }
+ }
+ }
+
+ public static class TL_channelParticipant_layer185 extends TL_channelParticipant {
public static final int constructor = 0xc00c07c0;
@@ -43930,6 +44443,33 @@ public class TLRPC {
}
public static class TL_channelParticipantSelf extends ChannelParticipant {
+ public static final int constructor = 0x4f607bef;
+
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ via_invite = (flags & 1) != 0;
+ user_id = stream.readInt64(exception);
+ inviter_id = stream.readInt64(exception);
+ date = stream.readInt32(exception);
+ if ((flags & 2) != 0) {
+ subscription_until_date = stream.readInt32(exception);
+ }
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = via_invite ? (flags | 1) : (flags &~ 1);
+ stream.writeInt32(flags);
+ stream.writeInt64(user_id);
+ stream.writeInt64(inviter_id);
+ stream.writeInt32(date);
+ if ((flags & 2) != 0) {
+ stream.writeInt32(subscription_until_date);
+ }
+ }
+ }
+
+ public static class TL_channelParticipantSelf_layer185 extends TL_channelParticipantSelf {
public static final int constructor = 0x35a8bfa7;
public void readParams(AbstractSerializedData stream, boolean exception) {
@@ -46531,6 +47071,9 @@ public class TLRPC {
case TL_channelAdminLogEventActionChangeEmojiStatus.constructor:
result = new TL_channelAdminLogEventActionChangeEmojiStatus();
break;
+ case TL_channelAdminLogEventActionToggleSignatureProfiles.constructor:
+ result = new TL_channelAdminLogEventActionToggleSignatureProfiles();
+ break;
}
if (result == null && exception) {
throw new RuntimeException(String.format("can't parse magic %x in ChannelAdminLogEventAction", constructor));
@@ -47178,6 +47721,21 @@ public class TLRPC {
}
}
+ public static class TL_channelAdminLogEventActionToggleSignatureProfiles extends ChannelAdminLogEventAction {
+ public static final int constructor = 0x60a79c79;
+
+ public boolean value;
+
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ value = stream.readBool(exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeBool(value);
+ }
+ }
+
public static class TL_channelAdminLogEventActionPinTopic extends ChannelAdminLogEventAction {
public static final int constructor = 0x5d8d353b;
@@ -47815,7 +48373,7 @@ public class TLRPC {
public boolean gigagroup;
public boolean noforwards;
public boolean forum;
- public ArrayList restriction_reason = new ArrayList<>();
+ public ArrayList restriction_reason = new ArrayList<>();
public TL_channelAdminRights_layer92 admin_rights_layer92;
public TL_channelBannedRights_layer92 banned_rights_layer92;
public TL_chatAdminRights admin_rights;
@@ -47827,11 +48385,13 @@ public class TLRPC {
public boolean stories_hidden;
public boolean stories_hidden_min;
public boolean stories_unavailable;
+ public boolean signature_profiles;
public int stories_max_id;
public TL_peerColor color;
public TL_peerColor profile_color;
public EmojiStatus emoji_status;
public int level;
+ public int subscription_until_date;
public ArrayList usernames = new ArrayList<>();
@@ -47857,6 +48417,9 @@ public class TLRPC {
case TL_channel.constructor:
result = new TL_channel();
break;
+ case TL_channel_layer185.constructor:
+ result = new TL_channel_layer185();
+ break;
case TL_channel_layer167_3.constructor:
result = new TL_channel_layer167_3();
break;
@@ -48358,7 +48921,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -48531,7 +49094,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -48662,6 +49225,199 @@ public class TLRPC {
}
public static class TL_channel extends Chat {
+ public static final int constructor = 0xfe4478bd;
+
+ public void readParams(AbstractSerializedData 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;
+ signature_profiles = (flags2 & 4096) != 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) {
+ int magic = stream.readInt32(exception);
+ if (magic != 0x1cb5c415) {
+ if (exception) {
+ 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 & 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) {
+ int magic = stream.readInt32(exception);
+ if (magic != 0x1cb5c415) {
+ if (exception) {
+ 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);
+ }
+ }
+ if ((flags2 & 16) != 0) {
+ stories_max_id = stream.readInt32(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) {
+ 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);
+ flags2 = signature_profiles ? (flags2 | 4096) : (flags2 &~ 4096);
+ 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) {
+ 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 & 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) {
+ stream.writeInt32(0x1cb5c415);
+ int count = usernames.size();
+ stream.writeInt32(count);
+ for (int a = 0; a < count; a++) {
+ usernames.get(a).serializeToStream(stream);
+ }
+ }
+ if ((flags2 & 16) != 0) {
+ stream.writeInt32(stories_max_id);
+ }
+ 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_layer185 extends TL_channel {
public static final int constructor = 0xaadfc8f;
public void readParams(AbstractSerializedData stream, boolean exception) {
@@ -48710,7 +49466,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -48895,7 +49651,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -49062,7 +49818,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -49239,7 +49995,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -49412,7 +50168,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -49563,7 +50319,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -49848,7 +50604,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -50303,25 +51059,32 @@ public class TLRPC {
}
}
- public static class TL_restrictionReason extends TLObject {
- public static final int constructor = 0xd072acb4;
+ public static class RestrictionReason extends TLObject {
public String platform;
public String reason;
public String text;
- public static TL_restrictionReason TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
- if (TL_restrictionReason.constructor != constructor) {
- if (exception) {
- throw new RuntimeException(String.format("can't parse magic %x in TL_restrictionReason", constructor));
- } else {
- return null;
- }
+ public static RestrictionReason TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
+ RestrictionReason result = null;
+ switch (constructor) {
+ case TL_reastrictionReason.constructor:
+ result = new TL_reastrictionReason();
+ break;
+ }
+ if (result == null && exception) {
+ throw new RuntimeException(String.format("can't parse magic %x in RestrictionReason", constructor));
+ }
+ if (result != null) {
+ result.readParams(stream, exception);
}
- TL_restrictionReason result = new TL_restrictionReason();
- result.readParams(stream, exception);
return result;
}
+ }
+
+ public static class TL_reastrictionReason extends RestrictionReason {
+ public static final int constructor = 0xd072acb4;
+
public void readParams(AbstractSerializedData stream, boolean exception) {
platform = stream.readString(exception);
@@ -52486,9 +53249,12 @@ public class TLRPC {
public static TL_chatInviteExported TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
TL_chatInviteExported result = null;
switch (constructor) {
- case 0xab4a819:
+ case TL_chatInviteExported.constructor:
result = new TL_chatInviteExported();
break;
+ case TL_chatInviteExported_layer185.constructor:
+ result = new TL_chatInviteExported_layer185();
+ break;
case 0xb18105e8:
result = new TL_chatInviteExported_layer133();
break;
@@ -52516,7 +53282,7 @@ public class TLRPC {
}
public static class TL_chatInviteExported extends ExportedChatInvite {
- public static final int constructor = 0xab4a819;
+ public static final int constructor = 0xa22cbd96;
public int flags;
public boolean revoked;
@@ -52530,10 +53296,85 @@ public class TLRPC {
public int usage_limit;
public int usage;
public int requested;
+ public int subscription_expired;
public String title;
+ public TL_starsSubscriptionPricing subscription_pricing;
public ArrayList importers; //custom
public boolean expired; //custom
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ revoked = (flags & 1) != 0;
+ permanent = (flags & 32) != 0;
+ request_needed = (flags & 64) != 0;
+ link = stream.readString(exception);
+ admin_id = stream.readInt64(exception);
+ date = stream.readInt32(exception);
+ if ((flags & 16) != 0) {
+ start_date = stream.readInt32(exception);
+ }
+ if ((flags & 2) != 0) {
+ expire_date = stream.readInt32(exception);
+ }
+ if ((flags & 4) != 0) {
+ usage_limit = stream.readInt32(exception);
+ }
+ if ((flags & 8) != 0) {
+ usage = stream.readInt32(exception);
+ }
+ if ((flags & 128) != 0) {
+ requested = stream.readInt32(exception);
+ }
+ if ((flags & 1024) != 0) {
+ subscription_expired = stream.readInt32(exception);
+ }
+ if ((flags & 256) != 0) {
+ title = stream.readString(exception);
+ }
+ if ((flags & 512) != 0) {
+ subscription_pricing = TL_starsSubscriptionPricing.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = revoked ? (flags | 1) : (flags &~ 1);
+ flags = permanent ? (flags | 32) : (flags &~ 32);
+ flags = request_needed ? (flags | 64) : (flags &~ 64);
+ stream.writeInt32(flags);
+ stream.writeString(link);
+ stream.writeInt64(admin_id);
+ stream.writeInt32(date);
+ if ((flags & 16) != 0) {
+ stream.writeInt32(start_date);
+ }
+ if ((flags & 2) != 0) {
+ stream.writeInt32(expire_date);
+ }
+ if ((flags & 4) != 0) {
+ stream.writeInt32(usage_limit);
+ }
+ if ((flags & 8) != 0) {
+ stream.writeInt32(usage);
+ }
+ if ((flags & 128) != 0) {
+ stream.writeInt32(requested);
+ }
+ if ((flags & 1024) != 0) {
+ stream.writeInt32(subscription_expired);
+ }
+ if ((flags & 256) != 0) {
+ stream.writeString(title);
+ }
+ if ((flags & 512) != 0) {
+ subscription_pricing.serializeToStream(stream);
+ }
+ }
+ }
+
+ public static class TL_chatInviteExported_layer185 extends TL_chatInviteExported {
+ public static final int constructor = 0xab4a819;
+
public void readParams(AbstractSerializedData stream, boolean exception) {
flags = stream.readInt32(exception);
revoked = (flags & 1) != 0;
@@ -52719,12 +53560,15 @@ public class TLRPC {
public static InputFile TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
InputFile result = null;
switch (constructor) {
- case 0xfa4f0bb5:
+ case TL_inputFileBig.constructor:
result = new TL_inputFileBig();
break;
- case 0xf52ff27f:
+ case TL_inputFile.constructor:
result = new TL_inputFile();
break;
+ case TL_inputFileStoryDocument.constructor:
+ result = new TL_inputFileStoryDocument();
+ break;
}
if (result == null && exception) {
throw new RuntimeException(String.format("can't parse magic %x in InputFile", constructor));
@@ -52754,6 +53598,21 @@ public class TLRPC {
}
}
+ public static class TL_inputFileStoryDocument extends InputFile {
+ public static final int constructor = 0x62dc8b48;
+
+ public TLRPC.InputDocument doc;
+
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ doc = TLRPC.InputDocument.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ doc.serializeToStream(stream);
+ }
+ }
+
public static class TL_inputFile extends InputFile {
public static final int constructor = 0xf52ff27f;
@@ -53074,7 +53933,7 @@ public class TLRPC {
public Photo personal_photo;
public Photo profile_photo;
public PeerNotifySettings notify_settings;
- public BotInfo bot_info;
+ public TL_bots.BotInfo bot_info;
public int pinned_msg_id;
public int common_chats_count;
public int folder_id;
@@ -53199,7 +54058,7 @@ public class TLRPC {
}
notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception);
if ((flags & 8) != 0) {
- bot_info = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ bot_info = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
}
if ((flags & 64) != 0) {
pinned_msg_id = stream.readInt32(exception);
@@ -53402,7 +54261,7 @@ public class TLRPC {
}
notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception);
if ((flags & 8) != 0) {
- bot_info = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ bot_info = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
}
if ((flags & 64) != 0) {
pinned_msg_id = stream.readInt32(exception);
@@ -53596,7 +54455,7 @@ public class TLRPC {
}
notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception);
if ((flags & 8) != 0) {
- bot_info = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ bot_info = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
}
if ((flags & 64) != 0) {
pinned_msg_id = stream.readInt32(exception);
@@ -53784,7 +54643,7 @@ public class TLRPC {
}
notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception);
if ((flags & 8) != 0) {
- bot_info = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ bot_info = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
}
if ((flags & 64) != 0) {
pinned_msg_id = stream.readInt32(exception);
@@ -53964,7 +54823,7 @@ public class TLRPC {
}
notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception);
if ((flags & 8) != 0) {
- bot_info = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ bot_info = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
}
if ((flags & 64) != 0) {
pinned_msg_id = stream.readInt32(exception);
@@ -54117,7 +54976,7 @@ public class TLRPC {
}
notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception);
if ((flags & 8) != 0) {
- bot_info = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ bot_info = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
}
if ((flags & 64) != 0) {
pinned_msg_id = stream.readInt32(exception);
@@ -54265,7 +55124,7 @@ public class TLRPC {
}
notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception);
if ((flags & 8) != 0) {
- bot_info = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ bot_info = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
}
if ((flags & 64) != 0) {
pinned_msg_id = stream.readInt32(exception);
@@ -54405,7 +55264,7 @@ public class TLRPC {
}
notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception);
if ((flags & 8) != 0) {
- bot_info = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ bot_info = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
}
if ((flags & 64) != 0) {
pinned_msg_id = stream.readInt32(exception);
@@ -54535,7 +55394,7 @@ public class TLRPC {
}
notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception);
if ((flags & 8) != 0) {
- bot_info = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ bot_info = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
}
if ((flags & 64) != 0) {
pinned_msg_id = stream.readInt32(exception);
@@ -54658,7 +55517,7 @@ public class TLRPC {
}
notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception);
if ((flags & 8) != 0) {
- bot_info = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ bot_info = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
}
if ((flags & 64) != 0) {
pinned_msg_id = stream.readInt32(exception);
@@ -54777,7 +55636,7 @@ public class TLRPC {
}
notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception);
if ((flags & 8) != 0) {
- bot_info = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ bot_info = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
}
if ((flags & 64) != 0) {
pinned_msg_id = stream.readInt32(exception);
@@ -54870,7 +55729,7 @@ public class TLRPC {
}
notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception);
if ((flags & 8) != 0) {
- bot_info = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ bot_info = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
}
if ((flags & 64) != 0) {
pinned_msg_id = stream.readInt32(exception);
@@ -54952,7 +55811,7 @@ public class TLRPC {
}
notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception);
if ((flags & 8) != 0) {
- bot_info = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ bot_info = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
}
if ((flags & 64) != 0) {
pinned_msg_id = stream.readInt32(exception);
@@ -55026,7 +55885,7 @@ public class TLRPC {
}
notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception);
if ((flags & 8) != 0) {
- bot_info = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ bot_info = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
}
if ((flags & 64) != 0) {
pinned_msg_id = stream.readInt32(exception);
@@ -55086,7 +55945,7 @@ public class TLRPC {
}
notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception);
if ((flags & 8) != 0) {
- bot_info = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ bot_info = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
}
if ((flags & 64) != 0) {
pinned_msg_id = stream.readInt32(exception);
@@ -55142,7 +56001,7 @@ public class TLRPC {
}
notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception);
if ((flags & 8) != 0) {
- bot_info = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ bot_info = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
}
if ((flags & 64) != 0) {
pinned_msg_id = stream.readInt32(exception);
@@ -55212,7 +56071,7 @@ public class TLRPC {
}
notify_settings = PeerNotifySettings.TLdeserialize(stream, stream.readInt32(exception), exception);
if ((flags & 8) != 0) {
- bot_info = BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ bot_info = TL_bots.BotInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
}
if ((flags & 64) != 0) {
pinned_msg_id = stream.readInt32(exception);
@@ -57907,6 +58766,9 @@ public class TLRPC {
case 0x1b2286b8:
result = new TL_reactionEmoji();
break;
+ case TL_reactionPaid.constructor:
+ result = new TL_reactionPaid();
+ break;
}
if (result == null && exception) {
throw new RuntimeException(String.format("can't parse magic %x in Reaction", constructor));
@@ -57954,6 +58816,15 @@ public class TLRPC {
}
}
+ public static class TL_reactionPaid extends Reaction {
+ public static final int constructor = 0x523da4eb;
+
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ }
+ }
+
public static class TL_reactionEmoji extends Reaction {
public static final int constructor = 0x1b2286b8;
@@ -60690,6 +61561,7 @@ public class TLRPC {
public boolean forward_chats;
public boolean groups;
public boolean channels;
+ public boolean bots_app;
public int offset;
public int limit;
public long hash;
@@ -60708,6 +61580,7 @@ public class TLRPC {
flags = forward_chats ? (flags | 32) : (flags &~ 32);
flags = groups ? (flags | 1024) : (flags &~ 1024);
flags = channels ? (flags | 32768) : (flags &~ 32768);
+ flags = bots_app ? (flags | 65536) : (flags &~ 65536);
stream.writeInt32(flags);
stream.writeInt32(offset);
stream.writeInt32(limit);
@@ -61807,7 +62680,7 @@ public class TLRPC {
}
public static class TL_messages_exportChatInvite extends TLObject {
- public static final int constructor = 0xa02ce5d5;
+ public static final int constructor = 0xa455de90;
public int flags;
public boolean legacy_revoke_permanent;
@@ -61816,6 +62689,7 @@ public class TLRPC {
public int expire_date;
public int usage_limit;
public String title;
+ public TL_starsSubscriptionPricing subscription_pricing;
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
return ExportedChatInvite.TLdeserialize(stream, constructor, exception);
@@ -61836,6 +62710,9 @@ public class TLRPC {
if ((flags & 16) != 0) {
stream.writeString(title);
}
+ if ((flags & 32) != 0) {
+ subscription_pricing.serializeToStream(stream);
+ }
}
}
@@ -63314,6 +64191,50 @@ public class TLRPC {
}
}
+ public static class TL_messages_sendPaidReaction extends TLObject {
+ public static final int constructor = 0x25c8fe3e;
+
+ public int flags;
+ public boolean isPrivate;
+ public InputPeer peer;
+ public int msg_id;
+ public int count;
+ public long random_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 = isPrivate ? (flags | 1) : (flags &~ 1);
+ stream.writeInt32(flags);
+ peer.serializeToStream(stream);
+ stream.writeInt32(msg_id);
+ stream.writeInt32(count);
+ stream.writeInt64(random_id);
+ }
+ }
+
+ public static class TL_messages_togglePaidReactionPrivacy extends TLObject {
+ public static final int constructor = 0x849ad397;
+
+ public InputPeer peer;
+ public int msg_id;
+ public boolean isPrivate;
+
+ 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.writeInt32(msg_id);
+ stream.writeBool(isPrivate);
+ }
+ }
+
public static class TL_messages_setDefaultReaction extends TLObject {
public static final int constructor = 0x4f47a016;
@@ -63493,12 +64414,13 @@ public class TLRPC {
}
public static class TL_messages_setChatAvailableReactions extends TLObject {
- public static final int constructor = 0x5a150bd4;
+ public static final int constructor = 0x864b2581;
public int flags;
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 Updates.TLdeserialize(stream, constructor, exception);
@@ -63512,6 +64434,9 @@ public class TLRPC {
if ((flags & 1) != 0) {
stream.writeInt32(reactions_limit);
}
+ if ((flags & 2) != 0) {
+ stream.writeBool(paid_enabled);
+ }
}
}
@@ -64075,6 +65000,7 @@ public class TLRPC {
public int flags;
public boolean requested;
+ public boolean subscription_expired;
public InputPeer peer;
public String link;
public String q;
@@ -64089,6 +65015,7 @@ public class TLRPC {
public void serializeToStream(AbstractSerializedData 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) {
@@ -65023,10 +65950,12 @@ public class TLRPC {
}
public static class TL_channels_toggleSignatures extends TLObject {
- public static final int constructor = 0x1f69b606;
+ public static final int constructor = 0x418d549c;
public InputChannel channel;
- public boolean enabled;
+ 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);
@@ -65034,8 +65963,10 @@ public class TLRPC {
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);
- stream.writeBool(enabled);
}
}
@@ -66517,8 +67448,11 @@ public class TLRPC {
case TL_inputStorePaymentPremiumGiveaway.constructor:
result = new TL_inputStorePaymentPremiumGiveaway();
break;
- case TL_inputStorePaymentStars.constructor:
- result = new TL_inputStorePaymentStars();
+ case TL_inputStorePaymentStarsGift.constructor:
+ result = new TL_inputStorePaymentStarsGift();
+ break;
+ case TL_inputStorePaymentStarsTopup.constructor:
+ result = new TL_inputStorePaymentStarsTopup();
break;
}
if (result == null && exception) {
@@ -67062,6 +67996,7 @@ public class TLRPC {
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;
@@ -67633,7 +68568,7 @@ public class TLRPC {
public String post_author;
public long grouped_id;
public TL_messageReactions reactions;
- public ArrayList restriction_reason = new ArrayList<>();
+ public ArrayList restriction_reason = new ArrayList<>();
public int ttl_period;
public int quick_reply_shortcut_id;
public long effect;
@@ -68601,7 +69536,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -68825,7 +69760,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -69043,7 +69978,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -69250,7 +70185,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -69452,7 +70387,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -69645,7 +70580,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -69832,7 +70767,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -70013,7 +70948,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -70189,7 +71124,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -70364,7 +71299,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -70532,7 +71467,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -70693,7 +71628,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -70854,7 +71789,7 @@ public class TLRPC {
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
- TL_restrictionReason object = TL_restrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
+ RestrictionReason object = RestrictionReason.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
@@ -73633,6 +74568,37 @@ public class TLRPC {
}
}
+ public static class TL_messages_requestMainWebView extends TLObject {
+ public static final int constructor = 0xc9e01e7b;
+
+ public int flags;
+ public boolean compact;
+ 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);
+ 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_messages_prolongWebView extends TLObject {
public static final int constructor = 0xb0d81a83;
@@ -74168,117 +75134,6 @@ public class TLRPC {
}
}
- public static abstract class BotMenuButton extends TLObject {
-
- public static BotMenuButton TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
- BotMenuButton result = null;
- switch (constructor) {
- case 0xc7b57ce6:
- result = new TL_botMenuButton();
- break;
- case 0x7533a588:
- result = new TL_botMenuButtonDefault();
- break;
- case 0x4258c205:
- result = new TL_botMenuButtonCommands();
- break;
- }
- if (result == null && exception) {
- throw new RuntimeException(String.format("can't parse magic %x in BotMenuButton", constructor));
- }
- if (result != null) {
- result.readParams(stream, exception);
- }
- return result;
- }
- }
-
- public static class TL_botMenuButton extends BotMenuButton {
- public static final int constructor = 0xc7b57ce6;
-
- public String text;
- public String url;
-
- 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 TL_botMenuButtonDefault extends BotMenuButton {
- public static final int constructor = 0x7533a588;
-
-
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- }
- }
-
- public static class TL_botMenuButtonCommands extends BotMenuButton {
- public static final int constructor = 0x4258c205;
-
-
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- }
- }
-
- public static class TL_updateBotMenuButton extends Update {
- public static final int constructor = 0x14b85813;
-
- public long bot_id;
- public BotMenuButton button;
-
- public void readParams(AbstractSerializedData stream, boolean exception) {
- bot_id = stream.readInt64(exception);
- button = BotMenuButton.TLdeserialize(stream, stream.readInt32(exception), exception);
- }
-
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- stream.writeInt64(bot_id);
- button.serializeToStream(stream);
- }
- }
-
- public static class TL_bots_setBotMenuButton extends TLObject {
- public static final int constructor = 0x4504d54f;
-
- public InputUser user_id;
- public BotMenuButton button;
-
- public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
- return Bool.TLdeserialize(stream, constructor, exception);
- }
-
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- user_id.serializeToStream(stream);
- button.serializeToStream(stream);
- }
- }
-
- public static class TL_bots_getBotMenuButton extends TLObject {
- public static final int constructor = 0x9c60eb28;
-
- public InputUser user_id;
-
- public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
- return BotMenuButton.TLdeserialize(stream, constructor, exception);
- }
-
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- user_id.serializeToStream(stream);
- }
- }
-
public static abstract class InputBotApp extends TLObject {
public static InputBotApp TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
@@ -74710,9 +75565,12 @@ public class TLRPC {
case 0xc326caef:
result = new TL_inputInvoiceSlug();
break;
- case 0x1da33ad8:
+ case TL_inputInvoiceStars.constructor:
result = new TL_inputInvoiceStars();
break;
+ case TL_inputInvoiceChatInviteSubscription.constructor:
+ result = new TL_inputInvoiceChatInviteSubscription();
+ break;
}
if (result == null && exception) {
throw new RuntimeException(String.format("can't parse magic %x in InputInvoice", constructor));
@@ -76955,55 +77813,6 @@ public class TLRPC {
}
}
- public static class TL_bots_canSendMessage extends TLObject {
- public static final int constructor = 0x1359f4e6;
-
- public InputUser bot;
-
- public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
- return Bool.TLdeserialize(stream, constructor, exception);
- }
-
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- bot.serializeToStream(stream);
- }
- }
-
- public static class TL_bots_allowSendMessage extends TLObject {
- public static final int constructor = 0xf132e3ef;
-
- public InputUser bot;
-
- public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
- return Updates.TLdeserialize(stream, constructor, exception);
- }
-
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- bot.serializeToStream(stream);
- }
- }
-
- public static class TL_bots_invokeWebViewCustomMethod extends TLObject {
- public static final int constructor = 0x87fc5e7;
-
- public InputUser bot;
- public String custom_method;
- public TL_dataJSON params;
-
- public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
- return TL_dataJSON.TLdeserialize(stream, constructor, exception);
- }
-
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- bot.serializeToStream(stream);
- stream.writeString(custom_method);
- params.serializeToStream(stream);
- }
- }
-
public static class TL_messages_webPage extends TLObject {
public static final int constructor = 0xfd5e12bd;
@@ -77302,16 +78111,14 @@ public class TLRPC {
}
}
- public static class TL_inputStorePaymentStars extends InputStorePaymentPurpose {
- public static final int constructor = 0x4f0ee8df;
+ public static class TL_inputStorePaymentStarsTopup extends InputStorePaymentPurpose {
+ public static final int constructor = 0xdddd0f56;
- public int flags;
public long stars;
public String currency;
public long amount;
public void readParams(AbstractSerializedData stream, boolean exception) {
- flags = stream.readInt32(exception);
stars = stream.readInt64(exception);
currency = stream.readString(exception);
amount = stream.readInt64(exception);
@@ -77319,7 +78126,30 @@ public class TLRPC {
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
- stream.writeInt32(flags);
+ stream.writeInt64(stars);
+ stream.writeString(currency);
+ stream.writeInt64(amount);
+ }
+ }
+
+ public static class TL_inputStorePaymentStarsGift extends InputStorePaymentPurpose {
+ public static final int constructor = 0x1d741ef7;
+
+ public InputUser user_id;
+ public long stars;
+ public String currency;
+ public long amount;
+
+ 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 void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ user_id.serializeToStream(stream);
stream.writeInt64(stars);
stream.writeString(currency);
stream.writeInt64(amount);
@@ -77345,17 +78175,32 @@ public class TLRPC {
}
public static class TL_inputInvoiceStars extends InputInvoice {
- public static int constructor = 0x1da33ad8;
+ public static final int constructor = 0x65f00ce3;
- public TL_starsTopupOption option;
+ public InputStorePaymentPurpose purpose;
public void readParams(AbstractSerializedData stream, boolean exception) {
- option = TL_starsTopupOption.TLdeserialize(stream, stream.readInt32(exception), exception);
+ purpose = InputStorePaymentPurpose.TLdeserialize(stream, stream.readInt32(exception), exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
- option.serializeToStream(stream);
+ purpose.serializeToStream(stream);
+ }
+ }
+
+ public static class TL_inputInvoiceChatInviteSubscription extends InputInvoice {
+ public static final int constructor = 0x34e793f1;
+
+ public String hash;
+
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ hash = stream.readString(exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeString(hash);
}
}
@@ -81400,12 +82245,13 @@ public class TLRPC {
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 collapsed; //custom
public boolean loadingStorePrice; //custom
+ public boolean missingStorePrice; //custom
public static TL_starsTopupOption TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
if (TL_starsTopupOption.constructor != constructor) {
@@ -81422,6 +82268,7 @@ public class TLRPC {
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);
@@ -81432,6 +82279,56 @@ public class TLRPC {
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
+ flags = extended ? flags | 2 : flags &~ 2;
+ stream.writeInt32(flags);
+ stream.writeInt64(stars);
+ if ((flags & 1) != 0) {
+ stream.writeString(store_product);
+ }
+ stream.writeString(currency);
+ stream.writeInt64(amount);
+ }
+ }
+
+ public static class TL_starsGiftOption extends TLObject {
+ public static final int constructor = 0x5e0589f1;
+
+ 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_starsGiftOption TLdeserialize(AbstractSerializedData 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));
+ } else {
+ return null;
+ }
+ }
+ TL_starsGiftOption result = new TL_starsGiftOption();
+ 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);
+ amount = stream.readInt64(exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = extended ? flags | 2 : flags &~ 2;
stream.writeInt32(flags);
stream.writeInt64(stars);
if ((flags & 1) != 0) {
@@ -81560,6 +82457,9 @@ public class TLRPC {
public boolean refund;
public boolean pending;
public boolean failed;
+ public boolean gift;
+ public boolean reaction;
+ public boolean subscription;
public String id;
public long stars;
public int date;
@@ -81572,6 +82472,10 @@ public class TLRPC {
public byte[] bot_payload;
public int msg_id;
public ArrayList extended_media = new ArrayList<>();
+ public int subscription_period;
+
+ public Peer sent_by; //custom
+ public Peer received_by; //custom
public static StarsTransaction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
StarsTransaction result = null;
@@ -81582,6 +82486,9 @@ public class TLRPC {
case TL_starsTransaction_layer182.constructor:
result = new TL_starsTransaction_layer182();
break;
+ case TL_starsTransaction_layer185.constructor:
+ result = new TL_starsTransaction_layer185();
+ break;
case TL_starsTransaction.constructor:
result = new TL_starsTransaction();
break;
@@ -81690,6 +82597,107 @@ public class TLRPC {
}
public static class TL_starsTransaction extends StarsTransaction {
+ public static final int constructor = 0x433aeb2b;
+
+ public void readParams(AbstractSerializedData 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;
+ subscription = (flags & 4096) != 0;
+ id = stream.readString(exception);
+ stars = stream.readInt64(exception);
+ date = stream.readInt32(exception);
+ peer = StarsTransactionPeer.TLdeserialize(stream, stream.readInt32(exception), exception);
+ if ((flags & 1) != 0) {
+ title = stream.readString(exception);
+ }
+ if ((flags & 2) != 0) {
+ description = stream.readString(exception);
+ }
+ if ((flags & 4) != 0) {
+ photo = WebDocument.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ if ((flags & 32) != 0) {
+ transaction_date = stream.readInt32(exception);
+ transaction_url = stream.readString(exception);
+ }
+ if ((flags & 128) != 0) {
+ bot_payload = stream.readByteArray(exception);
+ }
+ if ((flags & 256) != 0) {
+ 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++) {
+ MessageMedia object = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception);
+ if (object == null) {
+ return;
+ }
+ extended_media.add(object);
+ }
+ }
+ if ((flags & 4096) != 0) {
+ subscription_period = stream.readInt32(exception);
+ }
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = refund ? flags | 8 : flags &~ 8;
+ flags = pending ? flags | 16 : flags &~ 16;
+ flags = failed ? flags | 64 : flags &~ 64;
+ flags = gift ? flags | 1024 : flags &~ 1024;
+ flags = reaction ? flags | 2048 : flags &~ 2048;
+ flags = subscription ? flags | 4096 : flags &~ 4096;
+ stream.writeInt32(flags);
+ stream.writeInt64(stars);
+ stream.writeInt32(date);
+ peer.serializeToStream(stream);
+ if ((flags & 1) != 0) {
+ stream.writeString(title);
+ }
+ if ((flags & 2) != 0) {
+ stream.writeString(description);
+ }
+ if ((flags & 4) != 0) {
+ photo.serializeToStream(stream);
+ }
+ if ((flags & 32) != 0) {
+ stream.writeInt32(transaction_date);
+ stream.writeString(transaction_url);
+ }
+ if ((flags & 128) != 0) {
+ stream.writeByteArray(bot_payload);
+ }
+ if ((flags & 256) != 0) {
+ 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);
+ }
+ }
+ if ((flags & 4096) != 0) {
+ stream.writeInt32(subscription_period);
+ }
+ }
+ }
+
+ public static class TL_starsTransaction_layer185 extends TL_starsTransaction {
public static final int constructor = 0x2db5418f;
public void readParams(AbstractSerializedData stream, boolean exception) {
@@ -81697,6 +82705,7 @@ public class TLRPC {
refund = (flags & 8) != 0;
pending = (flags & 16) != 0;
failed = (flags & 64) != 0;
+ gift = (flags & 1024) != 0;
id = stream.readString(exception);
stars = stream.readInt64(exception);
date = stream.readInt32(exception);
@@ -81744,6 +82753,7 @@ public class TLRPC {
flags = refund ? flags | 8 : flags &~ 8;
flags = pending ? flags | 16 : flags &~ 16;
flags = failed ? flags | 64 : flags &~ 64;
+ flags = gift ? flags | 1024 : flags &~ 1024;
stream.writeInt32(flags);
stream.writeInt64(stars);
stream.writeInt32(date);
@@ -81779,10 +82789,13 @@ public class TLRPC {
}
public static class TL_payments_starsStatus extends TLObject {
- public static final int constructor = 0x8cf4ee60;
+ public static final int constructor = 0xbbfa316c;
public int flags;
public long balance;
+ public ArrayList subscriptions = new ArrayList<>();
+ public String subscriptions_next_offset;
+ public long subscriptions_missing_balance;
public ArrayList history = new ArrayList<>();
public String next_offset;
public ArrayList chats = new ArrayList<>();
@@ -81804,6 +82817,49 @@ public class TLRPC {
public void readParams(AbstractSerializedData stream, boolean exception) {
flags = stream.readInt32(exception);
balance = 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);
+ }
+ }
+ if ((flags & 4) != 0) {
+ subscriptions_next_offset = stream.readString(exception);
+ }
+ if ((flags & 16) != 0) {
+ 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);
+ }
+ }
+ if ((flags & 1) != 0) {
+ next_offset = stream.readString(exception);
+ }
int magic = stream.readInt32(exception);
if (magic != 0x1cb5c415) {
if (exception) {
@@ -81812,24 +82868,6 @@ public class TLRPC {
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);
- }
- 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++) {
Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
@@ -81858,6 +82896,20 @@ public class TLRPC {
stream.writeInt32(constructor);
stream.writeInt32(flags);
stream.writeInt64(balance);
+ 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);
+ }
+ }
+ if ((flags & 4) != 0) {
+ stream.writeString(subscriptions_next_offset);
+ }
+ if ((flags & 16) != 0) {
+ stream.writeInt64(subscriptions_missing_balance);
+ }
stream.writeInt32(0x1cb5c415);
int count = history.size();
stream.writeInt32(count);
@@ -81903,6 +82955,34 @@ public class TLRPC {
}
}
+ public static class TL_payments_getStarsGiftOptions extends TLObject {
+ public static final int constructor = 0xd3c96bc8;
+
+ public int flags;
+ public InputUser user_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_starsGiftOption object = TL_starsGiftOption.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.writeInt32(flags);
+ if ((flags & 1) != 0) {
+ user_id.serializeToStream(stream);
+ }
+ }
+ }
+
public static class TL_payments_getStarsStatus extends TLObject {
public static final int constructor = 0x104fcfa7;
@@ -82261,5 +83341,230 @@ public class TLRPC {
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) {
+ if (TL_paymentCharge.constructor != constructor) {
+ if (exception) {
+ throw new RuntimeException(String.format("can't parse magic %x in TL_paymentCharge", constructor));
+ } else {
+ return null;
+ }
+ }
+ TL_paymentCharge result = new TL_paymentCharge();
+ result.readParams(stream, exception);
+ return result;
+ }
+
+ @Override
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ id = stream.readString(exception);
+ provider_charge_id = stream.readString(exception);
+ }
+
+ @Override
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeString(id);
+ stream.writeString(provider_charge_id);
+ }
+ }
+
+ public static class StarsSubscription extends TLObject {
+
+ public int flags;
+ public boolean canceled;
+ public boolean can_refulfill;
+ public boolean missing_balance;
+ public String id;
+ public Peer peer;
+ public int until_date;
+ public TL_starsSubscriptionPricing pricing;
+ public String chat_invite_hash;
+
+ public static StarsSubscription TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
+ StarsSubscription result = null;
+ switch (constructor) {
+ case TL_starsSubscription.constructor:
+ result = new TL_starsSubscription();
+ break;
+ case TL_starsSubscription_old.constructor:
+ result = new TL_starsSubscription_old();
+ break;
+ }
+ if (result == null && exception) {
+ throw new RuntimeException(String.format("can't parse magic %x in StarsTransaction", constructor));
+ }
+ if (result != null) {
+ result.readParams(stream, exception);
+ }
+ return result;
+ }
+
+ }
+
+ public static class TL_starsSubscription extends StarsSubscription {
+ public static final int constructor = 0x538ecf18;
+
+ @Override
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ canceled = (flags & 1) != 0;
+ can_refulfill = (flags & 2) != 0;
+ missing_balance = (flags & 4) != 0;
+ id = stream.readString(exception);
+ peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception);
+ until_date = stream.readInt32(exception);
+ pricing = TL_starsSubscriptionPricing.TLdeserialize(stream, stream.readInt32(exception), exception);
+ if ((flags & 8) != 0) {
+ chat_invite_hash = stream.readString(exception);
+ }
+ }
+
+ @Override
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = canceled ? (flags | 1) : (flags &~ 1);
+ flags = can_refulfill ? (flags | 2) : (flags &~ 2);
+ flags = missing_balance ? (flags | 4) : (flags &~ 4);
+ stream.writeInt32(flags);
+ stream.writeString(id);
+ peer.serializeToStream(stream);
+ stream.writeInt32(until_date);
+ pricing.serializeToStream(stream);
+ if ((flags & 8) != 0) {
+ stream.writeString(chat_invite_hash);
+ }
+ }
+ }
+
+ public static class TL_starsSubscription_old extends TL_starsSubscription {
+ public static final int constructor = 0xd073f1e6;
+
+ @Override
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ canceled = (flags & 1) != 0;
+ can_refulfill = (flags & 2) != 0;
+ missing_balance = (flags & 4) != 0;
+ id = stream.readString(exception);
+ peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception);
+ until_date = stream.readInt32(exception);
+ pricing = TL_starsSubscriptionPricing.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+
+ @Override
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = canceled ? (flags | 1) : (flags &~ 1);
+ flags = can_refulfill ? (flags | 2) : (flags &~ 2);
+ flags = missing_balance ? (flags | 4) : (flags &~ 4);
+ stream.writeInt32(flags);
+ stream.writeString(id);
+ peer.serializeToStream(stream);
+ stream.writeInt32(until_date);
+ pricing.serializeToStream(stream);
+ }
+ }
+
+ public static class TL_starsSubscriptionPricing extends TLObject {
+ public static final int constructor = 0x5416d58;
+
+ public int period;
+ public long amount;
+
+ public static TL_starsSubscriptionPricing TLdeserialize(AbstractSerializedData 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));
+ } else {
+ return null;
+ }
+ }
+ TL_starsSubscriptionPricing result = new TL_starsSubscriptionPricing();
+ result.readParams(stream, exception);
+ return result;
+ }
+
+ @Override
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ period = stream.readInt32(exception);
+ amount = stream.readInt64(exception);
+ }
+
+ @Override
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeInt32(period);
+ stream.writeInt64(amount);
+ }
+ }
+
+ public static class TL_getStarsSubscriptions extends TLObject {
+ public static final int constructor = 0x32512c5;
+
+ public int flags;
+ public boolean missing_balance;
+ public InputPeer peer;
+ public String offset;
+
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return TL_payments_starsStatus.TLdeserialize(stream, constructor, exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = missing_balance ? (flags | 1) : (flags &~ 1);
+ stream.writeInt32(flags);
+ peer.serializeToStream(stream);
+ stream.writeString(offset);
+ }
+ }
+
+ public static class TL_changeStarsSubscription extends TLObject {
+ public static final int constructor = 0xc7770878;
+
+ public int flags;
+ public InputPeer peer;
+ public String subscription_id;
+ public Boolean canceled;
+
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return Bool.TLdeserialize(stream, constructor, exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = (canceled != null) ? (flags | 1) : (flags &~ 1);
+ stream.writeInt32(flags);
+ peer.serializeToStream(stream);
+ stream.writeString(subscription_id);
+ if ((flags & 1) != 0) {
+ stream.writeBool(canceled);
+ }
+ }
+ }
+
+ public static class TL_fulfillStarsSubscription extends TLObject {
+ public static final int constructor = 0xcc5bebb3;
+
+ public InputPeer peer;
+ public String subscription_id;
+
+ 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.writeString(subscription_id);
+ }
+ }
}
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
new file mode 100644
index 000000000..34f0b3b0e
--- /dev/null
+++ b/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_account.java
@@ -0,0 +1,78 @@
+package org.telegram.tgnet.tl;
+
+import org.telegram.tgnet.AbstractSerializedData;
+import org.telegram.tgnet.TLObject;
+import org.telegram.tgnet.TLRPC;
+
+public class TL_account {
+
+ public static class contentSettings extends TLObject {
+ public static final int constructor = 0x57e28221;
+
+ public int flags;
+ public boolean sensitive_enabled;
+ public boolean sensitive_can_change;
+
+ public static contentSettings TLdeserialize(AbstractSerializedData 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));
+ } else {
+ return null;
+ }
+ }
+ contentSettings result = new contentSettings();
+ result.readParams(stream, exception);
+ return result;
+ }
+
+ @Override
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ sensitive_enabled = (flags & 1) != 0;
+ sensitive_can_change = (flags & 2) != 0;
+ }
+
+ @Override
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = sensitive_enabled ? (flags | 1) : (flags &~ 1);
+ flags = sensitive_can_change ? (flags | 2) : (flags &~ 2);
+ stream.writeInt32(flags);
+ }
+ }
+
+ public static class setContentSettings extends TLObject {
+ public static final int constructor = 0xb574b16b;
+
+ public int flags;
+ public boolean sensitive_enabled;
+
+ @Override
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return TLRPC.Bool.TLdeserialize(stream, constructor, exception);
+ }
+
+ @Override
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = sensitive_enabled ? (flags | 1) : (flags &~ 1);
+ stream.writeInt32(flags);
+ }
+ }
+
+ public static class getContentSettings extends TLObject {
+ public static final int constructor = 0x8b9b4dae;
+
+ @Override
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return contentSettings.TLdeserialize(stream, constructor, exception);
+ }
+
+ @Override
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ }
+ }
+
+}
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
new file mode 100644
index 000000000..b9fea938d
--- /dev/null
+++ b/TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_bots.java
@@ -0,0 +1,937 @@
+package org.telegram.tgnet.tl;
+
+import org.telegram.tgnet.AbstractSerializedData;
+import org.telegram.tgnet.TLObject;
+import org.telegram.tgnet.TLRPC;
+
+import java.util.ArrayList;
+
+public class TL_bots {
+
+ public static class botPreviewMedia extends TLObject {
+ public static final int constructor = 0x23e91ba3;
+
+ public int date;
+ public TLRPC.MessageMedia media;
+
+ public static botPreviewMedia TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
+ if (botPreviewMedia.constructor != constructor) {
+ if (exception) {
+ throw new RuntimeException(String.format("can't parse magic %x in botPreviewMedia", constructor));
+ } else {
+ return null;
+ }
+ }
+ botPreviewMedia result = new botPreviewMedia();
+ result.readParams(stream, exception);
+ return result;
+ }
+
+ @Override
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ date = stream.readInt32(exception);
+ media = TLRPC.MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+
+ @Override
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeInt32(date);
+ media.serializeToStream(stream);
+ }
+ }
+
+ public static class addPreviewMedia extends TLObject {
+ public static final int constructor = 0x17aeb75a;
+
+ public TLRPC.InputUser bot;
+ public String lang_code = "";
+ public TLRPC.InputMedia media;
+
+ @Override
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return botPreviewMedia.TLdeserialize(stream, constructor, exception);
+ }
+
+ @Override
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ bot.serializeToStream(stream);
+ stream.writeString(lang_code);
+ media.serializeToStream(stream);
+ }
+ }
+
+ public static class editPreviewMedia extends TLObject {
+ public static final int constructor = 0x8525606f;
+
+ public TLRPC.InputUser bot;
+ public String lang_code = "";
+
+ public TLRPC.InputMedia media;
+ public TLRPC.InputMedia new_media;
+
+ @Override
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return botPreviewMedia.TLdeserialize(stream, constructor, exception);
+ }
+
+ @Override
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ bot.serializeToStream(stream);
+ stream.writeString(lang_code);
+ media.serializeToStream(stream);
+ new_media.serializeToStream(stream);
+ }
+ }
+
+ public static class deletePreviewMedia extends TLObject {
+ public static final int constructor = 0x2d0135b3;
+
+ public TLRPC.InputUser bot;
+ public String lang_code = "";
+ public ArrayList media = new ArrayList<>();
+
+ @Override
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return TLRPC.Bool.TLdeserialize(stream, constructor, exception);
+ }
+
+ @Override
+ public void serializeToStream(AbstractSerializedData 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);
+ }
+ }
+ }
+
+ public static class reorderPreviewMedias extends TLObject {
+ public static final int constructor = 0xb627f3aa;
+
+ public TLRPC.InputUser bot;
+ public String lang_code = "";
+ public ArrayList order = new ArrayList<>();
+
+ @Override
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return TLRPC.Bool.TLdeserialize(stream, constructor, exception);
+ }
+
+ @Override
+ public void serializeToStream(AbstractSerializedData 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);
+ }
+ }
+ }
+
+ public static class getPreviewMedias extends TLObject {
+ public static final int constructor = 0xa2a5594d;
+
+ 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;
+ }
+
+ @Override
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ bot.serializeToStream(stream);
+ }
+ }
+
+ public static class getPreviewInfo extends TLObject {
+ public static final int constructor = 0x423ab3ad;
+
+ public TLRPC.InputUser bot;
+ public String lang_code = "";
+
+ @Override
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return previewInfo.TLdeserialize(stream, constructor, exception);
+ }
+
+ @Override
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ bot.serializeToStream(stream);
+ stream.writeString(lang_code);
+ }
+ }
+
+ public static class previewInfo extends TLObject {
+ public static final int constructor = 0xca71d64;
+
+ public ArrayList media = new ArrayList<>();
+ public ArrayList lang_codes = new ArrayList<>();
+
+ public static previewInfo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
+ if (previewInfo.constructor != constructor) {
+ if (exception) {
+ throw new RuntimeException(String.format("can't parse magic %x in previewInfo", constructor));
+ } else {
+ return null;
+ }
+ }
+ previewInfo result = new previewInfo();
+ 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 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));
+ }
+ }
+
+ @Override
+ public void serializeToStream(AbstractSerializedData 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));
+ }
+ }
+ }
+
+ public static class setBotInfo extends TLObject {
+ public static final int constructor = 0x10cf3123;
+
+ public int flags;
+ public TLRPC.InputUser bot;
+ public String lang_code;
+ public String name;
+ public String about;
+ public String description;
+
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return TLRPC.Bool.TLdeserialize(stream, constructor, exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeInt32(flags);
+ if ((flags & 4) != 0) {
+ bot.serializeToStream(stream);
+ }
+ stream.writeString(lang_code);
+ if ((flags & 8) != 0) {
+ stream.writeString(name);
+ }
+ if ((flags & 1) != 0) {
+ stream.writeString(about);
+ }
+ if ((flags & 2) != 0) {
+ stream.writeString(description);
+ }
+ }
+ }
+
+ public static class getBotInfo extends TLObject {
+ public static final int constructor = 0xdcd914fd;
+
+ public int flags;
+ public TLRPC.InputUser bot;
+ public String lang_code;
+
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return BotInfo.TLdeserialize(stream, constructor, exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeInt32(flags);
+ if ((flags & 1) != 0) {
+ bot.serializeToStream(stream);
+ }
+ stream.writeString(lang_code);
+ }
+ }
+
+ public static class reorderUsernames extends TLObject {
+ public static final int constructor = 0x9709b1c2;
+
+ public TLRPC.InputUser bot;
+ public ArrayList order = new ArrayList<>();
+
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return TLRPC.Bool.TLdeserialize(stream, constructor, exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData 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));
+ }
+ }
+ }
+
+ public static class toggleUsername extends TLObject {
+ public static final int constructor = 0x53ca973;
+
+ public TLRPC.InputUser bot;
+ public String username;
+ public boolean active;
+
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return TLRPC.Bool.TLdeserialize(stream, constructor, exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ bot.serializeToStream(stream);
+ stream.writeString(username);
+ stream.writeBool(active);
+ }
+ }
+
+ public static abstract class BotInfo extends TLObject {
+ public long user_id;
+ public String description;
+ public ArrayList commands = new ArrayList<>();
+ public int version;
+ public BotMenuButton menu_button;
+ public int flags;
+ public TLRPC.Photo description_photo;
+ public TLRPC.Document description_document;
+ public boolean has_preview_medias;
+ public String privacy_policy_url;
+
+ public static BotInfo TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
+ BotInfo result = null;
+ switch (constructor) {
+ case TL_botInfo_layer140.constructor:
+ result = new TL_botInfo_layer140();
+ break;
+ case TL_botInfoEmpty_layer48.constructor:
+ result = new TL_botInfoEmpty_layer48();
+ break;
+ case TL_botInfo_layer131.constructor:
+ result = new TL_botInfo_layer131();
+ break;
+ case TL_botInfo_layer48.constructor:
+ result = new TL_botInfo_layer48();
+ break;
+ case TL_botInfo_layer139.constructor:
+ result = new TL_botInfo_layer139();
+ break;
+ case TL_botInfo_layer185.constructor:
+ result = new TL_botInfo_layer185();
+ break;
+ case TL_botInfo.constructor:
+ result = new TL_botInfo();
+ break;
+ }
+ if (result == null && exception) {
+ throw new RuntimeException(String.format("can't parse magic %x in BotInfo", constructor));
+ }
+ if (result != null) {
+ result.readParams(stream, exception);
+ }
+ return result;
+ }
+ }
+
+ public static class TL_botInfoEmpty_layer48 extends TL_botInfo {
+ public static final int constructor = 0xbb2e37ce;
+
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ }
+ }
+
+ public static class TL_botInfo_layer131 extends TL_botInfo {
+ public static final int constructor = 0x98e81d3a;
+
+
+ public void readParams(AbstractSerializedData 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);
+ }
+ }
+
+ public void serializeToStream(AbstractSerializedData 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);
+ }
+ }
+ }
+
+ public static class TL_botInfo_layer48 extends TL_botInfo {
+ public static final int constructor = 0x9cf585d;
+
+
+ public void readParams(AbstractSerializedData 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);
+ }
+ }
+
+ public void serializeToStream(AbstractSerializedData 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);
+ }
+ }
+ }
+
+ public static class TL_botInfo_layer139 extends BotInfo {
+ public static final int constructor = 0x1b74b335;
+
+
+ public void readParams(AbstractSerializedData 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);
+ }
+ }
+
+ public void serializeToStream(AbstractSerializedData 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);
+ }
+ }
+ }
+
+ public static class TL_botInfo extends BotInfo {
+ public static final int constructor = 0x82437e74;
+
+
+ public void readParams(AbstractSerializedData 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) {
+ int magic = stream.readInt32(exception);
+ if (magic != 0x1cb5c415) {
+ if (exception) {
+ 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);
+ }
+ }
+ if ((flags & 8) != 0) {
+ menu_button = BotMenuButton.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ if ((flags & 128) != 0) {
+ privacy_policy_url = stream.readString(exception);
+ }
+ }
+
+ public void serializeToStream(AbstractSerializedData 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) {
+ stream.writeInt32(0x1cb5c415);
+ int count = commands.size();
+ stream.writeInt32(count);
+ for (int a = 0; a < count; a++) {
+ commands.get(a).serializeToStream(stream);
+ }
+ }
+ if ((flags & 8) != 0) {
+ menu_button.serializeToStream(stream);
+ }
+ if ((flags & 128) != 0) {
+ stream.writeString(privacy_policy_url);
+ }
+ }
+ }
+
+ public static class TL_botInfo_layer185 extends TL_botInfo {
+ public static final int constructor = 0x8f300b57;
+
+
+ public void readParams(AbstractSerializedData 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) {
+ int magic = stream.readInt32(exception);
+ if (magic != 0x1cb5c415) {
+ if (exception) {
+ 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);
+ }
+ }
+ if ((flags & 8) != 0) {
+ menu_button = BotMenuButton.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ }
+
+ public void serializeToStream(AbstractSerializedData 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) {
+ stream.writeInt32(0x1cb5c415);
+ int count = commands.size();
+ stream.writeInt32(count);
+ for (int a = 0; a < count; a++) {
+ commands.get(a).serializeToStream(stream);
+ }
+ }
+ if ((flags & 8) != 0) {
+ menu_button.serializeToStream(stream);
+ }
+ }
+ }
+
+ public static class TL_botInfo_layer140 extends TL_botInfo {
+ public static final int constructor = 0xe4169b5d;
+
+
+ public void readParams(AbstractSerializedData 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);
+ }
+ menu_button = BotMenuButton.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData 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);
+ }
+ menu_button.serializeToStream(stream);
+ }
+ }
+
+ public static abstract class BotMenuButton extends TLObject {
+
+ public static BotMenuButton TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
+ BotMenuButton result = null;
+ switch (constructor) {
+ case 0xc7b57ce6:
+ result = new TL_botMenuButton();
+ break;
+ case 0x7533a588:
+ result = new TL_botMenuButtonDefault();
+ break;
+ case 0x4258c205:
+ result = new TL_botMenuButtonCommands();
+ break;
+ }
+ if (result == null && exception) {
+ throw new RuntimeException(String.format("can't parse magic %x in BotMenuButton", constructor));
+ }
+ if (result != null) {
+ result.readParams(stream, exception);
+ }
+ return result;
+ }
+ }
+
+ public static class TL_botMenuButton extends BotMenuButton {
+ public static final int constructor = 0xc7b57ce6;
+
+ public String text;
+ public String url;
+
+ 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 TL_botMenuButtonDefault extends BotMenuButton {
+ public static final int constructor = 0x7533a588;
+
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ }
+ }
+
+ public static class TL_botMenuButtonCommands extends BotMenuButton {
+ public static final int constructor = 0x4258c205;
+
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ }
+ }
+
+ public static class TL_updateBotMenuButton extends TLRPC.Update {
+ public static final int constructor = 0x14b85813;
+
+ public long bot_id;
+ public BotMenuButton button;
+
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ bot_id = stream.readInt64(exception);
+ button = BotMenuButton.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeInt64(bot_id);
+ button.serializeToStream(stream);
+ }
+ }
+
+ public static class setBotMenuButton extends TLObject {
+ public static final int constructor = 0x4504d54f;
+
+ public TLRPC.InputUser user_id;
+ public BotMenuButton button;
+
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return TLRPC.Bool.TLdeserialize(stream, constructor, exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ user_id.serializeToStream(stream);
+ button.serializeToStream(stream);
+ }
+ }
+
+ public static class getBotMenuButton extends TLObject {
+ public static final int constructor = 0x9c60eb28;
+
+ public TLRPC.InputUser user_id;
+
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return BotMenuButton.TLdeserialize(stream, constructor, exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ user_id.serializeToStream(stream);
+ }
+ }
+
+ public static class canSendMessage extends TLObject {
+ public static final int constructor = 0x1359f4e6;
+
+ public TLRPC.InputUser bot;
+
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return TLRPC.Bool.TLdeserialize(stream, constructor, exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ bot.serializeToStream(stream);
+ }
+ }
+
+ public static class allowSendMessage extends TLObject {
+ public static final int constructor = 0xf132e3ef;
+
+ public TLRPC.InputUser bot;
+
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return TLRPC.Updates.TLdeserialize(stream, constructor, exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ bot.serializeToStream(stream);
+ }
+ }
+
+ public static class invokeWebViewCustomMethod extends TLObject {
+ public static final int constructor = 0x87fc5e7;
+
+ public TLRPC.InputUser bot;
+ public String custom_method;
+ public TLRPC.TL_dataJSON params;
+
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return TLRPC.TL_dataJSON.TLdeserialize(stream, constructor, exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ bot.serializeToStream(stream);
+ stream.writeString(custom_method);
+ params.serializeToStream(stream);
+ }
+ }
+
+ public static class getPopularAppBots extends TLObject {
+ public static final int constructor = 0xc2510192;
+
+ public String offset;
+ public int limit;
+
+ @Override
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return popularAppBots.TLdeserialize(stream, constructor, exception);
+ }
+
+ @Override
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeString(offset);
+ stream.writeInt32(limit);
+ }
+ }
+
+ public static class popularAppBots extends TLObject {
+ public static final int constructor = 0x1991b13b;
+
+ public int flags;
+ public String next_offset;
+ public ArrayList users = new ArrayList<>();
+
+ public static popularAppBots TLdeserialize(AbstractSerializedData 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));
+ } else {
+ return null;
+ }
+ }
+ popularAppBots result = new popularAppBots();
+ result.readParams(stream, exception);
+ return result;
+ }
+
+ public void readParams(AbstractSerializedData 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);
+ }
+ }
+
+ public void serializeToStream(AbstractSerializedData 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);
+ }
+ }
+ }
+}
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 35670094d..d79443907 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
@@ -3120,13 +3120,21 @@ public class TL_stories {
case TL_mediaAreaChannelPost.constructor:
result = new TL_mediaAreaChannelPost();
break;
-
case TL_inputMediaAreaVenue.constructor:
result = new TL_inputMediaAreaVenue();
break;
case TL_inputMediaAreaChannelPost.constructor:
result = new TL_inputMediaAreaChannelPost();
break;
+ case TL_mediaAreaWeather.constructor:
+ result = new TL_mediaAreaWeather();
+ break;
+ case TL_mediaAreaWeatherOld.constructor:
+ result = new TL_mediaAreaWeatherOld();
+ break;
+ case TL_mediaAreaWeather2.constructor:
+ result = new TL_mediaAreaWeather2();
+ break;
}
if (result == null && exception) {
throw new RuntimeException(String.format("can't parse magic %x in MediaArea", constructor));
@@ -3233,6 +3241,83 @@ public class TL_stories {
}
}
+ public static class TL_mediaAreaWeather2 extends MediaArea {
+ public static final int constructor = 0x855f223e;
+
+ public String emoji;
+ public int temperature_c;
+
+ @Override
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ dark = (flags & 1) != 0;
+ coordinates = MediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception);
+ emoji = stream.readString(exception);
+ temperature_c = stream.readInt32(exception);
+ }
+
+ @Override
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = dark ? flags | 1 : flags &~ 1;
+ stream.writeInt32(flags);
+ coordinates.serializeToStream(stream);
+ stream.writeString(emoji);
+ stream.writeInt32(temperature_c);
+ }
+ }
+
+ public static class TL_mediaAreaWeather extends MediaArea {
+ public static final int constructor = 0x49a6549c;
+
+ public String emoji;
+ public double temperature_c;
+ public int color;
+
+ @Override
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ coordinates = MediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception);
+ emoji = stream.readString(exception);
+ temperature_c = stream.readDouble(exception);
+ color = stream.readInt32(exception);
+ }
+
+ @Override
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ coordinates.serializeToStream(stream);
+ stream.writeString(emoji);
+ stream.writeDouble(temperature_c);
+ stream.writeInt32(color);
+ }
+ }
+
+ public static class TL_mediaAreaWeatherOld extends MediaArea {
+ public static final int constructor = 0x4386f849;
+
+ public String emoji;
+ public double temperature_c;
+
+ @Override
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ dark = (flags & 1) != 0;
+ coordinates = MediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception);
+ emoji = stream.readString(exception);
+ temperature_c = stream.readDouble(exception);
+ }
+
+ @Override
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = dark ? flags | 1 : flags &~ 1;
+ stream.writeInt32(flags);
+ coordinates.serializeToStream(stream);
+ stream.writeString(emoji);
+ stream.writeDouble(temperature_c);
+ }
+ }
+
public static class TL_inputMediaAreaVenue extends MediaArea {
public static final int constructor = 0xb282217f;
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 cb33c51af..cb68038b6 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java
@@ -27,6 +27,8 @@ import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
import android.graphics.RectF;
+import android.graphics.RenderEffect;
+import android.graphics.RuntimeShader;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
@@ -61,6 +63,9 @@ import org.telegram.messenger.R;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.Utilities;
import org.telegram.ui.Components.BackButtonMenu;
+import org.telegram.ui.Components.RLottieDrawable;
+import org.telegram.ui.EmptyBaseFragment;
+import org.telegram.ui.Stars.SuperRipple;
import org.telegram.ui.bots.BotWebViewSheet;
import org.telegram.ui.Components.Bulletin;
import org.telegram.ui.Components.ChatAttachAlert;
@@ -118,7 +123,12 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
if (!fragmentsStack.isEmpty()) {
lastFragment = fragmentsStack.get(fragmentsStack.size() - 1);
}
- if (storyViewerAttached() && lastFragment != null && lastFragment.getLastSheet() != null && lastFragment.getLastSheet().isFullyVisible() && lastFragment.getLastSheet().getWindowView() != child) {
+ if (sheetFragment != null && sheetFragment.sheetsStack != null && !sheetFragment.sheetsStack.isEmpty()) {
+ lastFragment = sheetFragment;
+ }
+ BaseFragment.AttachedSheet lastSheet = null;
+ if (lastFragment != null) lastSheet = lastFragment.getLastSheet();
+ if (lastSheet != null && lastSheet.isFullyVisible() && lastSheet.getWindowView() != child) {
return true;
}
if (child instanceof ActionBar) {
@@ -367,6 +377,11 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
}
}
+ @Override
+ public boolean allowSwipe() {
+ return (sheetFragment == null || sheetFragment.getLastSheet() == null || !sheetFragment.getLastSheet().isShown());
+ }
+
private static Drawable headerShadowDrawable;
private static Drawable layerShadowDrawable;
private static Paint scrimPaint;
@@ -381,11 +396,36 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
private ColorDrawable previewBackgroundDrawable;
public LayoutContainer containerView;
- private LayoutContainer containerViewBack;
+ public LayoutContainer containerViewBack;
+ public LayoutContainer sheetContainer;
private DrawerLayoutContainer drawerLayoutContainer;
private ActionBar currentActionBar;
private BottomSheetTabs bottomSheetTabs;
+ private EmptyBaseFragment sheetFragment;
+ public EmptyBaseFragment getSheetFragment() {
+ return getSheetFragment(true);
+ }
+ public EmptyBaseFragment getSheetFragment(boolean create) {
+ if (parentActivity == null)
+ return null;
+ if (sheetFragment == null) {
+ sheetFragment = new EmptyBaseFragment();
+ sheetFragment.setParentLayout(this);
+ View fragmentView = sheetFragment.fragmentView;
+ if (fragmentView == null) {
+ fragmentView = sheetFragment.createView(parentActivity);
+ }
+ if (fragmentView.getParent() != sheetContainer) {
+ AndroidUtilities.removeFromParent(fragmentView);
+ sheetContainer.addView(fragmentView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
+ }
+ sheetFragment.onResume();
+ sheetFragment.onBecomeFullyVisible();
+ }
+ return sheetFragment;
+ }
+
private BaseFragment newFragment;
private BaseFragment oldFragment;
@@ -476,7 +516,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
public void setFragmentStack(List stack) {
this.fragmentsStack = stack;
- FrameLayout.LayoutParams layoutParams;
+ LayoutParams layoutParams;
if (main) {
if (bottomSheetTabs != null) {
AndroidUtilities.removeFromParent(bottomSheetTabs);
@@ -484,7 +524,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
}
bottomSheetTabs = new BottomSheetTabs(parentActivity, this);
- layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dp(68 + 8));
+ layoutParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dp(68 + 8));
layoutParams.gravity = Gravity.BOTTOM | Gravity.FILL_HORIZONTAL;
addView(bottomSheetTabs, layoutParams);
@@ -493,22 +533,40 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
}
}
+ if (containerViewBack != null) {
+ AndroidUtilities.removeFromParent(containerViewBack);
+ }
this.containerViewBack = new LayoutContainer(parentActivity);
addView(containerViewBack);
- layoutParams = (FrameLayout.LayoutParams) containerViewBack.getLayoutParams();
+ layoutParams = (LayoutParams) containerViewBack.getLayoutParams();
layoutParams.width = LayoutHelper.MATCH_PARENT;
layoutParams.height = LayoutHelper.MATCH_PARENT;
layoutParams.gravity = Gravity.TOP | Gravity.LEFT;
containerViewBack.setLayoutParams(layoutParams);
+ if (containerView != null) {
+ AndroidUtilities.removeFromParent(containerView);
+ }
containerView = new LayoutContainer(parentActivity);
addView(containerView);
- layoutParams = (FrameLayout.LayoutParams) containerView.getLayoutParams();
+ layoutParams = (LayoutParams) containerView.getLayoutParams();
layoutParams.width = LayoutHelper.MATCH_PARENT;
layoutParams.height = LayoutHelper.MATCH_PARENT;
layoutParams.gravity = Gravity.TOP | Gravity.LEFT;
containerView.setLayoutParams(layoutParams);
+ if (sheetContainer != null) {
+ AndroidUtilities.removeFromParent(sheetContainer);
+ }
+ sheetContainer = new LayoutContainer(parentActivity);
+ addView(sheetContainer);
+ layoutParams = (LayoutParams) sheetContainer.getLayoutParams();
+ layoutParams.width = LayoutHelper.MATCH_PARENT;
+ layoutParams.height = LayoutHelper.MATCH_PARENT;
+ layoutParams.gravity = Gravity.TOP | Gravity.LEFT;
+ sheetContainer.setLayoutParams(layoutParams);
+
+
for (BaseFragment fragment : fragmentsStack) {
fragment.setParentLayout(this);
}
@@ -728,6 +786,9 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
BaseFragment lastFragment = fragmentsStack.get(fragmentsStack.size() - 1);
lastFragment.onResume();
}
+ if (sheetFragment != null) {
+ sheetFragment.onResume();
+ }
}
@Override
@@ -736,6 +797,9 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
BaseFragment lastFragment = fragmentsStack.get(fragmentsStack.size() - 1);
lastFragment.onUserLeaveHint();
}
+ if (sheetFragment != null) {
+ sheetFragment.onUserLeaveHint();
+ }
}
@Override
@@ -744,6 +808,9 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
BaseFragment lastFragment = fragmentsStack.get(fragmentsStack.size() - 1);
lastFragment.onPause();
}
+ if (sheetFragment != null) {
+ sheetFragment.onPause();
+ }
}
@Override
@@ -951,6 +1018,9 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
containerView = containerViewBack;
containerViewBack = temp;
bringChildToFront(containerView);
+ if (sheetContainer != null) {
+ bringChildToFront(sheetContainer);
+ }
lastFragment = fragmentsStack.get(fragmentsStack.size() - 1);
currentActionBar = lastFragment.actionBar;
@@ -1041,7 +1111,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (!checkTransitionAnimation() && !inActionMode && !animationInProgress) {
- if (fragmentsStack.size() > 1) {
+ if (fragmentsStack.size() > 1 && allowSwipe()) {
if (ev != null && ev.getAction() == MotionEvent.ACTION_DOWN) {
BaseFragment currentFragment = fragmentsStack.get(fragmentsStack.size() - 1);
if (!currentFragment.isSwipeBackEnabled(ev)) {
@@ -1189,6 +1259,9 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
currentActionBar.closeSearchField();
return;
}
+ if (sheetFragment != null && !sheetFragment.onBackPressed()) {
+ return;
+ }
BaseFragment lastFragment = fragmentsStack.get(fragmentsStack.size() - 1);
if (lastFragment.onBackPressed()) {
if (!fragmentsStack.isEmpty()) {
@@ -1340,7 +1413,18 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
Integer newNavigationBarColor = newFragment != null ? newFragment.getNavigationBarColor() : null;
if (newFragment != null && oldNavigationBarColor != null) {
float ratio = MathUtils.clamp(4f * animationProgress, 0f, 1f);
- newFragment.setNavigationBarColor(ColorUtils.blendARGB(oldNavigationBarColor, newNavigationBarColor, ratio));
+ int color = ColorUtils.blendARGB(oldNavigationBarColor, newNavigationBarColor, ratio);
+ if (sheetFragment != null) {
+ if (sheetFragment.sheetsStack != null) {
+ for (int i = 0; i < sheetFragment.sheetsStack.size(); ++i) {
+ BaseFragment.AttachedSheet sheet = sheetFragment.sheetsStack.get(i);
+ if (sheet.attachedToParent()) {
+ color = sheet.getNavigationBarColor(color);
+ }
+ }
+ }
+ }
+ newFragment.setNavigationBarColor(color);
}
float interpolated;
if (preview) {
@@ -1564,6 +1648,9 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
}
bringChildToFront(containerView);
+ if (sheetContainer != null) {
+ bringChildToFront(sheetContainer);
+ }
if (!needAnimation) {
presentFragmentInternalRemoveOld(removeLast, currentFragment);
if (backgroundView != null) {
@@ -1884,6 +1971,9 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
containerViewBack.setVisibility(View.INVISIBLE);
containerViewBack.setTranslationY(0);
bringChildToFront(containerView);
+ if (sheetContainer != null) {
+ bringChildToFront(sheetContainer);
+ }
onFragmentStackChanged("closeLastFragmentInternalRemoveOld");
}
@@ -2817,11 +2907,17 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
final boolean tabs = ev.getY() > getHeight() - getBottomTabsHeight(true);
- if (
- getLastFragment() != null &&
- getLastFragment().getLastSheet() != null &&
- getLastFragment().getLastSheet().attachedToParent()
- ) {
+
+ BaseFragment.AttachedSheet lastSheet = null;
+ if (lastSheet == null && sheetFragment != null && sheetFragment.getLastSheet() != null) {
+ lastSheet = sheetFragment.getLastSheet();
+ if (!lastSheet.attachedToParent() || lastSheet.getWindowView() == null) lastSheet = null;
+ }
+ if (lastSheet == null && getLastFragment() != null && getLastFragment().getLastSheet() != null) {
+ lastSheet = getLastFragment().getLastSheet();
+ if (!lastSheet.attachedToParent() || lastSheet.getWindowView() == null) lastSheet = null;
+ }
+ if (lastSheet != null) {
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
tabsEvents = tabs;
}
@@ -2829,7 +2925,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
if (ev.getAction() == MotionEvent.ACTION_UP || ev.getAction() == MotionEvent.ACTION_CANCEL) {
tabsEvents = false;
}
- return getLastFragment().getLastSheet().getWindowView().dispatchTouchEvent(ev);
+ return lastSheet.getWindowView().dispatchTouchEvent(ev);
}
}
if (ev.getAction() == MotionEvent.ACTION_UP || ev.getAction() == MotionEvent.ACTION_CANCEL) {
@@ -2885,6 +2981,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
requestLayout();
containerView.requestLayout();
containerViewBack.requestLayout();
+ sheetContainer.requestLayout();
if (animated) {
bottomTabsAnimator = ValueAnimator.ofFloat(bottomTabsProgress, bottomTabsHeight);
bottomTabsAnimator.addUpdateListener(anm -> {
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 69b74d6ad..dd9a24747 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenuSubItem.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenuSubItem.java
@@ -25,7 +25,7 @@ import org.telegram.ui.Components.RLottieImageView;
public class ActionBarMenuSubItem extends FrameLayout {
private TextView textView;
- private TextView subtextView;
+ public TextView subtextView;
public RLottieImageView imageView;
private boolean checkViewLeft;
private CheckBox2 checkView;
@@ -237,7 +237,9 @@ public class ActionBarMenuSubItem extends FrameLayout {
}
public void setSubtextColor(int color) {
- subtextView.setTextColor(color);
+ if (subtextView != null) {
+ subtextView.setTextColor(color);
+ }
}
public void setSubtext(String text) {
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 96ce38829..7b7b389c5 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/AlertDialog.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/AlertDialog.java
@@ -298,6 +298,7 @@ public class AlertDialog extends Dialog implements Drawable.Callback, Notificati
@Override
public void show() {
if (!AndroidUtilities.isSafeToShow(getContext())) return;
+ dismissed = false;
super.show();
if (progressViewContainer != null && progressViewStyle == ALERT_TYPE_SPINNER) {
progressViewContainer.setScaleX(0);
@@ -311,275 +312,285 @@ public class AlertDialog extends Dialog implements Drawable.Callback, Notificati
shownAt = System.currentTimeMillis();
}
- protected View inflateContent(boolean setContent) {
- LinearLayout containerView = new LinearLayout(getContext()) {
+ public class AlertDialogView extends LinearLayout {
+ public AlertDialogView(Context context) {
+ super(context);
+ }
- private boolean inLayout;
+ private boolean inLayout;
- @Override
- public boolean onTouchEvent(MotionEvent event) {
- if (progressViewStyle == ALERT_TYPE_SPINNER) {
- showCancelAlert();
- return false;
- }
- return super.onTouchEvent(event);
- }
-
- @Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- if (progressViewStyle == ALERT_TYPE_SPINNER) {
- showCancelAlert();
- return false;
- }
- return super.onInterceptTouchEvent(ev);
- }
-
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- if (progressViewStyle == ALERT_TYPE_SPINNER) {
- progressViewContainer.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(86), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(86), MeasureSpec.EXACTLY));
- setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.getSize(heightMeasureSpec));
- } else {
- inLayout = true;
- int width = MeasureSpec.getSize(widthMeasureSpec);
- int height = MeasureSpec.getSize(heightMeasureSpec);
-
- if (customWidth > 0) {
- width = customWidth + backgroundPaddings.left + backgroundPaddings.right;
- }
-
- int maxContentHeight;
- int availableHeight = maxContentHeight = height - getPaddingTop() - getPaddingBottom();
- int availableWidth = width - getPaddingLeft() - getPaddingRight();
-
- int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(availableWidth - AndroidUtilities.dp(48), MeasureSpec.EXACTLY);
- int childFullWidthMeasureSpec = MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.EXACTLY);
- LayoutParams layoutParams;
-
- if (buttonsLayout != null) {
- int count = buttonsLayout.getChildCount();
- for (int a = 0; a < count; a++) {
- View child = buttonsLayout.getChildAt(a);
- if (child instanceof TextView) {
- TextView button = (TextView) child;
- button.setMaxWidth(AndroidUtilities.dp((availableWidth - AndroidUtilities.dp(24)) / 2));
- }
- }
- buttonsLayout.measure(childFullWidthMeasureSpec, heightMeasureSpec);
- layoutParams = (LayoutParams) buttonsLayout.getLayoutParams();
- availableHeight -= buttonsLayout.getMeasuredHeight() + layoutParams.bottomMargin + layoutParams.topMargin;
- }
- if (secondTitleTextView != null) {
- secondTitleTextView.measure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(childWidthMeasureSpec), MeasureSpec.AT_MOST), heightMeasureSpec);
- }
- if (titleTextView != null) {
- if (secondTitleTextView != null) {
- titleTextView.measure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(childWidthMeasureSpec) - secondTitleTextView.getMeasuredWidth() - AndroidUtilities.dp(8), MeasureSpec.EXACTLY), heightMeasureSpec);
- } else {
- titleTextView.measure(childWidthMeasureSpec, heightMeasureSpec);
- }
- }
- if (titleContainer != null) {
- titleContainer.measure(childWidthMeasureSpec, heightMeasureSpec);
- layoutParams = (LayoutParams) titleContainer.getLayoutParams();
- availableHeight -= titleContainer.getMeasuredHeight() + layoutParams.bottomMargin + layoutParams.topMargin;
- }
- if (subtitleTextView != null) {
- subtitleTextView.measure(childWidthMeasureSpec, heightMeasureSpec);
- layoutParams = (LayoutParams) subtitleTextView.getLayoutParams();
- availableHeight -= subtitleTextView.getMeasuredHeight() + layoutParams.bottomMargin + layoutParams.topMargin;
- }
- if (topImageView != null) {
- topImageView.measure(MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(topHeight), MeasureSpec.EXACTLY));
- availableHeight -= topImageView.getMeasuredHeight();
- }
- if (topView != null) {
- int w = width;
- int h;
- if (aspectRatio == 0) {
- float scale = w / 936.0f;
- h = (int) (354 * scale);
- } else {
- h = (int) (w * aspectRatio);
- }
- topView.measure(MeasureSpec.makeMeasureSpec(w, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(h, MeasureSpec.EXACTLY));
- topView.getLayoutParams().height = h;
- availableHeight -= topView.getMeasuredHeight();
- }
- if (progressViewStyle == ALERT_TYPE_MESSAGE) {
- layoutParams = (LayoutParams) contentScrollView.getLayoutParams();
-
- if (customView != null) {
- layoutParams.topMargin = titleTextView == null && messageTextView.getVisibility() == GONE && items == null ? AndroidUtilities.dp(16) : 0;
- layoutParams.bottomMargin = buttonsLayout == null ? AndroidUtilities.dp(8) : 0;
- } else if (items != null) {
- layoutParams.topMargin = titleTextView == null && messageTextView.getVisibility() == GONE ? AndroidUtilities.dp(8) : 0;
- layoutParams.bottomMargin = AndroidUtilities.dp(8);
- } else if (messageTextView.getVisibility() == VISIBLE) {
- layoutParams.topMargin = titleTextView == null ? AndroidUtilities.dp(19) : 0;
- layoutParams.bottomMargin = AndroidUtilities.dp(20);
- }
-
- availableHeight -= layoutParams.bottomMargin + layoutParams.topMargin;
- contentScrollView.measure(childFullWidthMeasureSpec, MeasureSpec.makeMeasureSpec(availableHeight, MeasureSpec.AT_MOST));
- availableHeight -= contentScrollView.getMeasuredHeight();
- } else {
- if (progressViewContainer != null) {
- progressViewContainer.measure(childWidthMeasureSpec, MeasureSpec.makeMeasureSpec(availableHeight, MeasureSpec.AT_MOST));
- layoutParams = (LayoutParams) progressViewContainer.getLayoutParams();
- availableHeight -= progressViewContainer.getMeasuredHeight() + layoutParams.bottomMargin + layoutParams.topMargin;
- } else if (messageTextView != null) {
- messageTextView.measure(childWidthMeasureSpec, MeasureSpec.makeMeasureSpec(availableHeight, MeasureSpec.AT_MOST));
- if (messageTextView.getVisibility() != GONE) {
- layoutParams = (LayoutParams) messageTextView.getLayoutParams();
- availableHeight -= messageTextView.getMeasuredHeight() + layoutParams.bottomMargin + layoutParams.topMargin;
- }
- }
- if (lineProgressView != null) {
- lineProgressView.measure(childWidthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(4), MeasureSpec.EXACTLY));
- layoutParams = (LayoutParams) lineProgressView.getLayoutParams();
- availableHeight -= lineProgressView.getMeasuredHeight() + layoutParams.bottomMargin + layoutParams.topMargin;
-
- lineProgressViewPercent.measure(childWidthMeasureSpec, MeasureSpec.makeMeasureSpec(availableHeight, MeasureSpec.AT_MOST));
- layoutParams = (LayoutParams) lineProgressViewPercent.getLayoutParams();
- availableHeight -= lineProgressViewPercent.getMeasuredHeight() + layoutParams.bottomMargin + layoutParams.topMargin;
- }
- }
-
- setMeasuredDimension(width, maxContentHeight - availableHeight + getPaddingTop() + getPaddingBottom() - (topAnimationIsNew ? AndroidUtilities.dp(8) : 0));
- inLayout = false;
-
- if (lastScreenWidth != AndroidUtilities.displaySize.x) {
- AndroidUtilities.runOnUIThread(() -> {
- lastScreenWidth = AndroidUtilities.displaySize.x;
- final int calculatedWidth = AndroidUtilities.displaySize.x - AndroidUtilities.dp(56);
- int maxWidth;
- if (AndroidUtilities.isTablet()) {
- if (AndroidUtilities.isSmallTablet()) {
- maxWidth = AndroidUtilities.dp(446);
- } else {
- maxWidth = AndroidUtilities.dp(496);
- }
- } else {
- maxWidth = AndroidUtilities.dp(356);
- }
-
- Window window = getWindow();
- WindowManager.LayoutParams params = new WindowManager.LayoutParams();
- params.copyFrom(window.getAttributes());
- params.width = Math.min(maxWidth, calculatedWidth) + backgroundPaddings.left + backgroundPaddings.right;
- try {
- window.setAttributes(params);
- } catch (Throwable e) {
- FileLog.e(e);
- }
- });
- }
- }
- }
-
- @Override
- protected void onLayout(boolean changed, int l, int t, int r, int b) {
- super.onLayout(changed, l, t, r, b);
- if (progressViewStyle == ALERT_TYPE_SPINNER) {
- int x = (r - l - progressViewContainer.getMeasuredWidth()) / 2;
- int y = (b - t - progressViewContainer.getMeasuredHeight()) / 2;
- progressViewContainer.layout(x, y, x + progressViewContainer.getMeasuredWidth(), y + progressViewContainer.getMeasuredHeight());
- } else if (contentScrollView != null) {
- if (onScrollChangedListener == null) {
- onScrollChangedListener = () -> {
- runShadowAnimation(0, titleTextView != null && contentScrollView.getScrollY() > scrollContainer.getTop());
- runShadowAnimation(1, buttonsLayout != null && contentScrollView.getScrollY() + contentScrollView.getHeight() < scrollContainer.getBottom());
- contentScrollView.invalidate();
- };
- contentScrollView.getViewTreeObserver().addOnScrollChangedListener(onScrollChangedListener);
- }
- onScrollChangedListener.onScrollChanged();
- }
-
- getLocationOnScreen(containerViewLocation);
- if (blurMatrix != null && blurShader != null) {
- blurMatrix.reset();
- blurMatrix.postScale(8f, 8f);
- blurMatrix.postTranslate(-containerViewLocation[0], -containerViewLocation[1]);
- blurShader.setLocalMatrix(blurMatrix);
- }
- }
-
- @Override
- public void requestLayout() {
- if (inLayout) {
- return;
- }
- super.requestLayout();
- }
-
- @Override
- public boolean hasOverlappingRendering() {
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ if (progressViewStyle == ALERT_TYPE_SPINNER) {
+ showCancelAlert();
return false;
}
+ return super.onTouchEvent(event);
+ }
- private AnimatedFloat blurPaintAlpha = new AnimatedFloat(0, this);
- private Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ @Override
+ public boolean onInterceptTouchEvent(MotionEvent ev) {
+ if (progressViewStyle == ALERT_TYPE_SPINNER) {
+ showCancelAlert();
+ return false;
+ }
+ return super.onInterceptTouchEvent(ev);
+ }
- @Override
- public void draw(Canvas canvas) {
- if (blurredBackground && !blurredNativeBackground) {
- float r;
- if (progressViewStyle == ALERT_TYPE_SPINNER && progressViewContainer != null) {
- r = AndroidUtilities.dp(18);
- float w = progressViewContainer.getWidth() * progressViewContainer.getScaleX();
- float h = progressViewContainer.getHeight() * progressViewContainer.getScaleY();
- AndroidUtilities.rectTmp.set(
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ if (progressViewStyle == ALERT_TYPE_SPINNER) {
+ progressViewContainer.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(86), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(86), MeasureSpec.EXACTLY));
+ setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.getSize(heightMeasureSpec));
+ } else {
+ inLayout = true;
+ int width = MeasureSpec.getSize(widthMeasureSpec);
+ int height = MeasureSpec.getSize(heightMeasureSpec);
+
+ if (customWidth > 0) {
+ width = customWidth + backgroundPaddings.left + backgroundPaddings.right;
+ }
+
+ int maxContentHeight;
+ int availableHeight = maxContentHeight = height - getPaddingTop() - getPaddingBottom();
+ int availableWidth = width - getPaddingLeft() - getPaddingRight();
+
+ int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(availableWidth - AndroidUtilities.dp(48), MeasureSpec.EXACTLY);
+ int childFullWidthMeasureSpec = MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.EXACTLY);
+ LayoutParams layoutParams;
+
+ if (buttonsLayout != null) {
+ int count = buttonsLayout.getChildCount();
+ for (int a = 0; a < count; a++) {
+ View child = buttonsLayout.getChildAt(a);
+ if (child instanceof TextView) {
+ TextView button = (TextView) child;
+ button.setMaxWidth(AndroidUtilities.dp((availableWidth - AndroidUtilities.dp(24)) / 2));
+ }
+ }
+ buttonsLayout.measure(childFullWidthMeasureSpec, heightMeasureSpec);
+ layoutParams = (LayoutParams) buttonsLayout.getLayoutParams();
+ availableHeight -= buttonsLayout.getMeasuredHeight() + layoutParams.bottomMargin + layoutParams.topMargin;
+ }
+ if (secondTitleTextView != null) {
+ secondTitleTextView.measure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(childWidthMeasureSpec), MeasureSpec.AT_MOST), heightMeasureSpec);
+ }
+ if (titleTextView != null) {
+ if (secondTitleTextView != null) {
+ titleTextView.measure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(childWidthMeasureSpec) - secondTitleTextView.getMeasuredWidth() - AndroidUtilities.dp(8), MeasureSpec.EXACTLY), heightMeasureSpec);
+ } else {
+ titleTextView.measure(childWidthMeasureSpec, heightMeasureSpec);
+ }
+ }
+ if (titleContainer != null) {
+ titleContainer.measure(childWidthMeasureSpec, heightMeasureSpec);
+ layoutParams = (LayoutParams) titleContainer.getLayoutParams();
+ availableHeight -= titleContainer.getMeasuredHeight() + layoutParams.bottomMargin + layoutParams.topMargin;
+ }
+ if (subtitleTextView != null) {
+ subtitleTextView.measure(childWidthMeasureSpec, heightMeasureSpec);
+ layoutParams = (LayoutParams) subtitleTextView.getLayoutParams();
+ availableHeight -= subtitleTextView.getMeasuredHeight() + layoutParams.bottomMargin + layoutParams.topMargin;
+ }
+ if (topImageView != null) {
+ topImageView.measure(MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(topHeight), MeasureSpec.EXACTLY));
+ availableHeight -= topImageView.getMeasuredHeight();
+ }
+ if (topView != null) {
+ int w = width;
+ int h;
+ if (aspectRatio == 0) {
+ float scale = w / 936.0f;
+ h = (int) (354 * scale);
+ } else {
+ h = (int) (w * aspectRatio);
+ }
+ topView.measure(MeasureSpec.makeMeasureSpec(w, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(h, MeasureSpec.EXACTLY));
+ topView.getLayoutParams().height = h;
+ availableHeight -= topView.getMeasuredHeight();
+ }
+ if (progressViewStyle == ALERT_TYPE_MESSAGE) {
+ layoutParams = (LayoutParams) contentScrollView.getLayoutParams();
+
+ if (customView != null) {
+ layoutParams.topMargin = titleTextView == null && messageTextView.getVisibility() == GONE && items == null ? AndroidUtilities.dp(16) : 0;
+ layoutParams.bottomMargin = buttonsLayout == null ? AndroidUtilities.dp(8) : 0;
+ } else if (items != null) {
+ layoutParams.topMargin = titleTextView == null && messageTextView.getVisibility() == GONE ? AndroidUtilities.dp(8) : 0;
+ layoutParams.bottomMargin = AndroidUtilities.dp(8);
+ } else if (messageTextView.getVisibility() == VISIBLE) {
+ layoutParams.topMargin = titleTextView == null ? AndroidUtilities.dp(19) : 0;
+ layoutParams.bottomMargin = AndroidUtilities.dp(20);
+ }
+
+ availableHeight -= layoutParams.bottomMargin + layoutParams.topMargin;
+ contentScrollView.measure(childFullWidthMeasureSpec, MeasureSpec.makeMeasureSpec(availableHeight, MeasureSpec.AT_MOST));
+ availableHeight -= contentScrollView.getMeasuredHeight();
+ } else {
+ if (progressViewContainer != null) {
+ progressViewContainer.measure(childWidthMeasureSpec, MeasureSpec.makeMeasureSpec(availableHeight, MeasureSpec.AT_MOST));
+ layoutParams = (LayoutParams) progressViewContainer.getLayoutParams();
+ availableHeight -= progressViewContainer.getMeasuredHeight() + layoutParams.bottomMargin + layoutParams.topMargin;
+ } else if (messageTextView != null) {
+ messageTextView.measure(childWidthMeasureSpec, MeasureSpec.makeMeasureSpec(availableHeight, MeasureSpec.AT_MOST));
+ if (messageTextView.getVisibility() != GONE) {
+ layoutParams = (LayoutParams) messageTextView.getLayoutParams();
+ availableHeight -= messageTextView.getMeasuredHeight() + layoutParams.bottomMargin + layoutParams.topMargin;
+ }
+ }
+ if (lineProgressView != null) {
+ lineProgressView.measure(childWidthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(4), MeasureSpec.EXACTLY));
+ layoutParams = (LayoutParams) lineProgressView.getLayoutParams();
+ availableHeight -= lineProgressView.getMeasuredHeight() + layoutParams.bottomMargin + layoutParams.topMargin;
+
+ lineProgressViewPercent.measure(childWidthMeasureSpec, MeasureSpec.makeMeasureSpec(availableHeight, MeasureSpec.AT_MOST));
+ layoutParams = (LayoutParams) lineProgressViewPercent.getLayoutParams();
+ availableHeight -= lineProgressViewPercent.getMeasuredHeight() + layoutParams.bottomMargin + layoutParams.topMargin;
+ }
+ }
+
+ setMeasuredDimension(width, maxContentHeight - availableHeight + getPaddingTop() + getPaddingBottom() - (topAnimationIsNew ? AndroidUtilities.dp(8) : 0));
+ inLayout = false;
+
+ if (lastScreenWidth != AndroidUtilities.displaySize.x) {
+ AndroidUtilities.runOnUIThread(() -> {
+ lastScreenWidth = AndroidUtilities.displaySize.x;
+ final int calculatedWidth = AndroidUtilities.displaySize.x - AndroidUtilities.dp(56);
+ int maxWidth;
+ if (AndroidUtilities.isTablet()) {
+ if (AndroidUtilities.isSmallTablet()) {
+ maxWidth = AndroidUtilities.dp(446);
+ } else {
+ maxWidth = AndroidUtilities.dp(496);
+ }
+ } else {
+ maxWidth = AndroidUtilities.dp(356);
+ }
+
+ Window window = getWindow();
+ WindowManager.LayoutParams params = new WindowManager.LayoutParams();
+ params.copyFrom(window.getAttributes());
+ params.width = Math.min(maxWidth, calculatedWidth) + backgroundPaddings.left + backgroundPaddings.right;
+ try {
+ window.setAttributes(params);
+ } catch (Throwable e) {
+ FileLog.e(e);
+ }
+ });
+ }
+ }
+ }
+
+ @Override
+ protected void onLayout(boolean changed, int l, int t, int r, int b) {
+ super.onLayout(changed, l, t, r, b);
+ if (progressViewStyle == ALERT_TYPE_SPINNER) {
+ int x = (r - l - progressViewContainer.getMeasuredWidth()) / 2;
+ int y = (b - t - progressViewContainer.getMeasuredHeight()) / 2;
+ progressViewContainer.layout(x, y, x + progressViewContainer.getMeasuredWidth(), y + progressViewContainer.getMeasuredHeight());
+ } else if (contentScrollView != null) {
+ if (onScrollChangedListener == null) {
+ onScrollChangedListener = () -> {
+ runShadowAnimation(0, titleTextView != null && contentScrollView.getScrollY() > scrollContainer.getTop());
+ runShadowAnimation(1, buttonsLayout != null && contentScrollView.getScrollY() + contentScrollView.getHeight() < scrollContainer.getBottom());
+ contentScrollView.invalidate();
+ };
+ contentScrollView.getViewTreeObserver().addOnScrollChangedListener(onScrollChangedListener);
+ }
+ onScrollChangedListener.onScrollChanged();
+ }
+
+ getLocationOnScreen(containerViewLocation);
+ if (blurMatrix != null && blurShader != null) {
+ blurMatrix.reset();
+ blurMatrix.postScale(8f, 8f);
+ blurMatrix.postTranslate(-containerViewLocation[0], -containerViewLocation[1]);
+ blurShader.setLocalMatrix(blurMatrix);
+ }
+ }
+
+ @Override
+ public void requestLayout() {
+ if (inLayout) {
+ return;
+ }
+ super.requestLayout();
+ }
+
+ @Override
+ public boolean hasOverlappingRendering() {
+ return false;
+ }
+
+ private AnimatedFloat blurPaintAlpha = new AnimatedFloat(0, this);
+ private Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+
+ @Override
+ public void draw(Canvas canvas) {
+ if (blurredBackground && !blurredNativeBackground) {
+ float r;
+ if (progressViewStyle == ALERT_TYPE_SPINNER && progressViewContainer != null) {
+ r = AndroidUtilities.dp(18);
+ float w = progressViewContainer.getWidth() * progressViewContainer.getScaleX();
+ float h = progressViewContainer.getHeight() * progressViewContainer.getScaleY();
+ AndroidUtilities.rectTmp.set(
(getWidth() - w) / 2f,
(getHeight() - h) / 2f,
(getWidth() + w) / 2f,
(getHeight() + h) / 2f
- );
- } else {
- r = AndroidUtilities.dp(10);
- AndroidUtilities.rectTmp.set(getPaddingLeft(), getPaddingTop(), getMeasuredWidth() - getPaddingRight(), getMeasuredHeight() - getPaddingBottom());
- }
-
- // draw blur of background
- float blurAlpha = blurPaintAlpha.set(blurPaint != null ? 1f : 0f);
- if (blurPaint != null) {
- blurPaint.setAlpha((int) (0xFF * blurAlpha));
- canvas.drawRoundRect(AndroidUtilities.rectTmp, r, r, blurPaint);
- }
-
- // draw dim above blur
- if (dimBlurPaint == null) {
- dimBlurPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
- dimBlurPaint.setColor(ColorUtils.setAlphaComponent(0xff000000, (int) (0xFF * dimAlpha)));
- }
- canvas.drawRoundRect(AndroidUtilities.rectTmp, r, r, dimBlurPaint);
-
- // draw background
- backgroundPaint.setColor(backgroundColor);
- backgroundPaint.setAlpha((int) (backgroundPaint.getAlpha() * (blurAlpha * (blurOpacity - 1f) + 1f)));
- canvas.drawRoundRect(AndroidUtilities.rectTmp, r, r, backgroundPaint);
+ );
+ } else {
+ r = AndroidUtilities.dp(10);
+ AndroidUtilities.rectTmp.set(getPaddingLeft(), getPaddingTop(), getMeasuredWidth() - getPaddingRight(), getMeasuredHeight() - getPaddingBottom());
}
- super.draw(canvas);
- }
- @Override
- protected void dispatchDraw(Canvas canvas) {
- if (drawBackground && !blurredBackground) {
- shadowDrawable.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
- if (topView != null && notDrawBackgroundOnTopView) {
- int clipTop = topView.getBottom();
- canvas.save();
- canvas.clipRect(0, clipTop, getMeasuredWidth(), getMeasuredHeight());
- shadowDrawable.draw(canvas);
- canvas.restore();
- } else {
- shadowDrawable.draw(canvas);
- }
+ // draw blur of background
+ float blurAlpha = blurPaintAlpha.set(blurPaint != null ? 1f : 0f);
+ if (blurPaint != null) {
+ blurPaint.setAlpha((int) (0xFF * blurAlpha));
+ canvas.drawRoundRect(AndroidUtilities.rectTmp, r, r, blurPaint);
}
- super.dispatchDraw(canvas);
+
+ // draw dim above blur
+ if (dimBlurPaint == null) {
+ dimBlurPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ dimBlurPaint.setColor(ColorUtils.setAlphaComponent(0xff000000, (int) (0xFF * dimAlpha)));
+ }
+ canvas.drawRoundRect(AndroidUtilities.rectTmp, r, r, dimBlurPaint);
+
+ // draw background
+ backgroundPaint.setColor(backgroundColor);
+ backgroundPaint.setAlpha((int) (backgroundPaint.getAlpha() * (blurAlpha * (blurOpacity - 1f) + 1f)));
+ canvas.drawRoundRect(AndroidUtilities.rectTmp, r, r, backgroundPaint);
}
- };
+ super.draw(canvas);
+ }
+
+ @Override
+ protected void dispatchDraw(Canvas canvas) {
+ if (drawBackground && !blurredBackground) {
+ shadowDrawable.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
+ if (topView != null && notDrawBackgroundOnTopView) {
+ int clipTop = topView.getBottom();
+ canvas.save();
+ canvas.clipRect(0, clipTop, getMeasuredWidth(), getMeasuredHeight());
+ shadowDrawable.draw(canvas);
+ canvas.restore();
+ } else {
+ shadowDrawable.draw(canvas);
+ }
+ }
+ super.dispatchDraw(canvas);
+ }
+ }
+
+ private AlertDialogView containerView;
+ public AlertDialogView getContainerView() {
+ return containerView;
+ }
+
+ protected View inflateContent(boolean setContent) {
+ containerView = new AlertDialogView(getContext());
containerView.setOrientation(LinearLayout.VERTICAL);
if ((blurredBackground || progressViewStyle == ALERT_TYPE_SPINNER) && progressViewStyle != ALERT_TYPE_LOADING) {
containerView.setBackgroundDrawable(null);
@@ -1320,6 +1331,11 @@ public class AlertDialog extends Dialog implements Drawable.Callback, Notificati
}
}
+ private boolean dismissed;
+ public boolean isDismissed() {
+ return dismissed;
+ }
+
@Override
public void dismiss() {
if (overridenDissmissListener != null) {
@@ -1328,6 +1344,8 @@ public class AlertDialog extends Dialog implements Drawable.Callback, Notificati
listener.run(this::dismiss);
return;
}
+ if (dismissed) return;
+ dismissed = true;
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiLoaded);
if (onDismissListener != null) {
onDismissListener.onDismiss(this);
@@ -1681,8 +1699,24 @@ public class AlertDialog extends Dialog implements Drawable.Callback, Notificati
return alertDialog;
}
+ private final boolean[] red = new boolean[3];
+ public Builder makeRed(int button) {
+ int index = (-button) - 1;
+ if (index >= 0 && index < red.length) {
+ red[index] = true;
+ }
+ return this;
+ }
+
public AlertDialog show() {
alertDialog.show();
+ for (int i = 0; i < red.length; i++) {
+ if (!red[i]) continue;
+ TextView button = (TextView) alertDialog.getButton(-(i + 1));
+ if (button != null) {
+ button.setTextColor(alertDialog.getThemedColor(Theme.key_text_RedBold));
+ }
+ }
return alertDialog;
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BackDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BackDrawable.java
index bfe7df8d9..314e2776a 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BackDrawable.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BackDrawable.java
@@ -39,6 +39,10 @@ public class BackDrawable extends Drawable {
private boolean rotated = true;
private int arrowRotation;
+ public float getRotation() {
+ return finalRotation;
+ }
+
public BackDrawable(boolean close) {
super();
paint.setStrokeWidth(AndroidUtilities.dp(2));
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java
index 9b3a90d43..95ccde75e 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java
@@ -53,6 +53,7 @@ import org.telegram.messenger.SecretChatHelper;
import org.telegram.messenger.SendMessagesHelper;
import org.telegram.messenger.UserConfig;
import org.telegram.tgnet.ConnectionsManager;
+import org.telegram.ui.ArticleViewer;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.LaunchActivity;
import org.telegram.ui.Stories.StoryViewer;
@@ -83,6 +84,7 @@ public abstract class BaseFragment {
private boolean removingFromStack;
private PreviewDelegate previewDelegate;
protected Theme.ResourcesProvider resourceProvider;
+ private boolean isFullyVisible;
// public ArrayList storyViewerStack;
// public ArrayList botsStack;
//
@@ -99,14 +101,17 @@ public abstract class BaseFragment {
public boolean attachedToParent();
- public boolean onBackPressed();
+ public boolean onAttachedBackPressed();
public boolean showDialog(Dialog dialog);
public void setKeyboardHeightFromParent(int keyboardHeight);
+ public boolean isAttachedLightStatusBar();
public int getNavigationBarColor(int color);
public void setOnDismissListener(Runnable onDismiss);
+
+ default void setLastVisible(boolean lastVisible) {};
}
public static interface AttachedSheetWindow {}
@@ -142,6 +147,24 @@ public abstract class BaseFragment {
return sheetsStack != null && !sheetsStack.isEmpty();
}
+ public boolean hasShownSheet() {
+ if (!hasSheet()) return false;
+ for (int i = sheetsStack.size() - 1; i >= 0; --i) {
+ if (sheetsStack.get(i).isShown()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean hasSheets(BaseFragment fragment) {
+ if (fragment == null) return false;
+ if (fragment.hasShownSheet()) return true;
+ if (!(fragment.getParentLayout() instanceof ActionBarLayout)) return false;
+ final BaseFragment sheetFragment = ((ActionBarLayout) fragment.getParentLayout()).getSheetFragment(false);
+ return sheetFragment != null && sheetFragment.hasShownSheet();
+ }
+
public void clearSheets() {
if (sheetsStack == null || sheetsStack.isEmpty())
return;
@@ -286,7 +309,9 @@ public abstract class BaseFragment {
}
public void onRemoveFromParent() {
- clearSheets();
+ if (sheetsStack == null || sheetsStack.isEmpty())
+ return;
+ updateSheetsVisibility();
}
public void setParentFragment(BaseFragment fragment) {
@@ -425,6 +450,15 @@ public abstract class BaseFragment {
if (hasForceLightStatusBar() && !AndroidUtilities.isTablet() && getParentLayout().getLastFragment() == this && getParentActivity() != null && !finishing) {
AndroidUtilities.setLightStatusBar(getParentActivity().getWindow(), Theme.getColor(Theme.key_actionBarDefault) == Color.WHITE);
}
+
+ if (sheetsStack != null) {
+ for (int i = sheetsStack.size() - 1; i >= 0; --i) {
+ AttachedSheet sheet = sheetsStack.get(i);
+ sheet.setLastVisible(false);
+ sheet.dismiss(true);
+ sheetsStack.remove(i);
+ }
+ }
}
public boolean needDelayOpenAnimation() {
@@ -509,7 +543,7 @@ public abstract class BaseFragment {
if (sheetsStack != null) {
for (int i = sheetsStack.size() - 1; i >= 0; --i) {
if (sheetsStack.get(i).isShown()) {
- return sheetsStack.get(i).onBackPressed();
+ return sheetsStack.get(i).onAttachedBackPressed();
}
}
}
@@ -656,6 +690,7 @@ public abstract class BaseFragment {
}
public void onBecomeFullyVisible() {
+ isFullyVisible = true;
AccessibilityManager mgr = (AccessibilityManager) ApplicationLoader.applicationContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
if (mgr.isEnabled()) {
ActionBar actionBar = getActionBar();
@@ -671,6 +706,15 @@ public abstract class BaseFragment {
fullyVisibleListener = null;
c.run();
}
+ updateSheetsVisibility();
+ }
+
+ private void updateSheetsVisibility() {
+ if (sheetsStack == null) return;
+ for (int i = 0; i < sheetsStack.size(); ++i) {
+ AttachedSheet sheet = sheetsStack.get(i);
+ sheet.setLastVisible(i == sheetsStack.size() - 1 && isFullyVisible);
+ }
}
private Runnable fullyVisibleListener;
@@ -683,7 +727,8 @@ public abstract class BaseFragment {
}
public void onBecomeFullyHidden() {
-
+ isFullyVisible = false;
+ updateSheetsVisibility();
}
public AnimatorSet onCustomTransitionAnimation(boolean isOpen, Runnable callback) {
@@ -1191,10 +1236,29 @@ public abstract class BaseFragment {
storyViewer.fromBottomSheet = true;
}
sheetsStack.add(storyViewer);
+ updateSheetsVisibility();
}
return storyViewer;
}
+ public void removeSheet(BaseFragment.AttachedSheet sheet) {
+ if (sheetsStack == null) return;
+ sheetsStack.remove(sheet);
+ updateSheetsVisibility();
+ }
+
+ public void addSheet(BaseFragment.AttachedSheet sheet) {
+ if (sheetsStack == null) {
+ sheetsStack = new ArrayList<>();
+ }
+ StoryViewer storyViewer = getLastStoryViewer();
+ if (storyViewer != null) {
+ storyViewer.listenToAttachedSheet(sheet);
+ }
+ sheetsStack.add(sheet);
+ updateSheetsVisibility();
+ }
+
public StoryViewer createOverlayStoryViewer() {
if (sheetsStack == null) {
sheetsStack = new ArrayList<>();
@@ -1204,19 +1268,39 @@ public abstract class BaseFragment {
storyViewer.fromBottomSheet = true;
}
sheetsStack.add(storyViewer);
+ updateSheetsVisibility();
return storyViewer;
}
- public BotWebViewAttachedSheet createBotViewer() {
+ public ArticleViewer createArticleViewer(boolean forceRecreate) {
if (sheetsStack == null) {
sheetsStack = new ArrayList<>();
}
- BotWebViewAttachedSheet botViewer = new BotWebViewAttachedSheet(this);
- StoryViewer storyViewer = getLastStoryViewer();
- if (storyViewer != null) {
- storyViewer.listenToAttachedSheet(botViewer);
+ if (!forceRecreate) {
+ if (getLastSheet() instanceof ArticleViewer.Sheet && getLastSheet().isShown()) {
+ return ((ArticleViewer.Sheet) getLastSheet()).getArticleViewer();
+ }
+ if (
+ parentLayout instanceof ActionBarLayout &&
+ ((ActionBarLayout) parentLayout).getSheetFragment(false) != null &&
+ ((ActionBarLayout) parentLayout).getSheetFragment(false).getLastSheet() instanceof ArticleViewer.Sheet
+ ) {
+ ArticleViewer.Sheet lastSheet = (ArticleViewer.Sheet) ((ActionBarLayout) parentLayout).getSheetFragment(false).getLastSheet();
+ if (lastSheet.isShown()) {
+ return lastSheet.getArticleViewer();
+ }
+ }
}
- sheetsStack.add(botViewer);
+ ArticleViewer articleViewer = ArticleViewer.makeSheet(this);
+ addSheet(articleViewer.sheet);
+ BottomSheetTabDialog.checkSheet(articleViewer.sheet);
+ return articleViewer;
+ }
+
+ public BotWebViewAttachedSheet createBotViewer() {
+ BotWebViewAttachedSheet botViewer = new BotWebViewAttachedSheet(this);
+ addSheet(botViewer);
+ BottomSheetTabDialog.checkSheet(botViewer);
return botViewer;
}
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 442d53179..dcc5a4ea2 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheet.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheet.java
@@ -30,6 +30,7 @@ import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
+import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.KeyEvent;
@@ -43,12 +44,15 @@ import android.view.WindowInsets;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.Interpolator;
+import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
+import androidx.core.graphics.ColorUtils;
import androidx.core.view.NestedScrollingParent;
import androidx.core.view.NestedScrollingParentHelper;
import androidx.core.view.ViewCompat;
@@ -60,15 +64,17 @@ import org.telegram.messenger.LocaleController;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.messenger.UserConfig;
+import org.telegram.messenger.Utilities;
import org.telegram.messenger.camera.CameraView;
import org.telegram.ui.Components.AnimationProperties;
import org.telegram.ui.Components.Bulletin;
import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.LayoutHelper;
+import org.telegram.ui.LaunchActivity;
import java.util.ArrayList;
-public class BottomSheet extends Dialog {
+public class BottomSheet extends Dialog implements BaseFragment.AttachedSheet {
private final static boolean AVOID_SYSTEM_CUTOUT_FULLSCREEN = false;
protected int currentAccount = UserConfig.selectedAccount;
@@ -382,7 +388,7 @@ public class BottomSheet extends Dialog {
container.invalidate();
}
} else if (ev == null || ev.getPointerId(0) == startedTrackingPointerId && (ev.getAction() == MotionEvent.ACTION_CANCEL || ev.getAction() == MotionEvent.ACTION_UP || ev.getAction() == MotionEvent.ACTION_POINTER_UP)) {
- containerView.setTranslationX(0);
+// containerView.setTranslationX(0);
if (velocityTracker == null) {
velocityTracker = VelocityTracker.obtain();
}
@@ -394,13 +400,15 @@ public class BottomSheet extends Dialog {
ValueAnimator animator = ValueAnimator.ofFloat(swipeBackX, 0);
animator.addUpdateListener(animation -> {
swipeBackX = (float) animation.getAnimatedValue();
- setTranslationX(swipeBackX);
+ containerView.setTranslationX(swipeBackX);
+ container.invalidate();
});
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
swipeBackX = 0;
- setTranslationX(0);
+ containerView.setTranslationX(0);
+ container.invalidate();
}
});
animator.setInterpolator(CubicBezierInterpolator.DEFAULT);
@@ -410,18 +418,30 @@ public class BottomSheet extends Dialog {
ValueAnimator animator = ValueAnimator.ofFloat(swipeBackX, getMeasuredWidth());
animator.addUpdateListener(animation -> {
swipeBackX = (float) animation.getAnimatedValue();
- setTranslationX(swipeBackX);
+ containerView.setTranslationX(swipeBackX);
+ container.invalidate();
});
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
skipDismissAnimation = true;
+ containerView.setTranslationX(getMeasuredWidth());
dismiss();
+ container.invalidate();
}
});
- animator.setInterpolator(CubicBezierInterpolator.DEFAULT);
- animator.setDuration(150);
+ animator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
+ animator.setDuration(320);
animator.start();
+
+ ValueAnimator dimAnimator = ValueAnimator.ofFloat(1f, 0f);
+ dimAnimator.addUpdateListener(animation -> {
+ final float t = (float) animation.getAnimatedValue();
+ backDrawable.setAlpha(dimBehind ? (int) (dimBehindAlpha * t) : 0);
+ });
+ dimAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
+ dimAnimator.setDuration(320);
+ dimAnimator.start();
}
maybeStartTracking = false;
startedTracking = false;
@@ -1104,7 +1124,7 @@ public class BottomSheet extends Dialog {
Bulletin.removeDelegate(this);
}
};
- container.setBackgroundDrawable(backDrawable);
+ container.setBackground(backDrawable);
focusable = needFocus;
if (Build.VERSION.SDK_INT >= 21) {
container.setFitsSystemWindows(true);
@@ -1155,10 +1175,32 @@ public class BottomSheet extends Dialog {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ onCreateInternal();
+ }
- Window window = getWindow();
- window.setWindowAnimations(R.style.DialogNoAnimation);
- setContentView(container, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
+ private void onCreateInternal() {
+
+ Window window = null;
+ if (attachedFragment != null) {
+ attachedFragment.addSheet(this);
+ if (attachedFragment.getLayoutContainer() == null) return;
+
+ InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
+ if (imm.hideSoftInputFromWindow(attachedFragment.getLayoutContainer().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS)) {
+ AndroidUtilities.runOnUIThread(() -> {
+ AndroidUtilities.removeFromParent(container);
+ attachedFragment.getLayoutContainer().addView(container);
+ }, 80);
+ } else {
+ AndroidUtilities.removeFromParent(container);
+ attachedFragment.getLayoutContainer().addView(container);
+ }
+
+ } else {
+ window = getWindow();
+ window.setWindowAnimations(R.style.DialogNoAnimation);
+ setContentView(container, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
+ }
if (useLightStatusBar && Build.VERSION.SDK_INT >= 23) {
int color = Theme.getColor(Theme.key_actionBarDefault, null, true);
@@ -1183,7 +1225,7 @@ public class BottomSheet extends Dialog {
public void setTranslationY(float translationY) {
super.setTranslationY(translationY);
if (topBulletinContainer != null) {
- topBulletinContainer.setTranslationY(-getHeight() + translationY - getPaddingTop() - AndroidUtilities.statusBarHeight + backgroundPaddingTop);
+ topBulletinContainer.setTranslationY(-(container.getHeight() - containerView.getY()) + backgroundPaddingTop);
}
onContainerTranslationYChanged(translationY);
}
@@ -1281,30 +1323,34 @@ public class BottomSheet extends Dialog {
}
}
- WindowManager.LayoutParams params = window.getAttributes();
- params.width = ViewGroup.LayoutParams.MATCH_PARENT;
- params.gravity = Gravity.TOP | Gravity.LEFT;
- params.dimAmount = 0;
- params.flags &= ~WindowManager.LayoutParams.FLAG_DIM_BEHIND;
- if (focusable) {
- params.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
- } else {
- params.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
- }
- if (isFullscreen) {
- if (Build.VERSION.SDK_INT >= 21) {
- params.flags |= WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
- WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR |
- WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
+ if (attachedFragment != null) {
+
+ } else if (window != null) {
+ WindowManager.LayoutParams params = window.getAttributes();
+ params.width = ViewGroup.LayoutParams.MATCH_PARENT;
+ params.gravity = Gravity.TOP | Gravity.LEFT;
+ params.dimAmount = 0;
+ params.flags &= ~WindowManager.LayoutParams.FLAG_DIM_BEHIND;
+ if (focusable) {
+ params.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
+ } else {
+ params.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
}
- params.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
- container.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_FULLSCREEN);
+ if (isFullscreen) {
+ if (Build.VERSION.SDK_INT >= 21) {
+ params.flags |= WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
+ WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR |
+ WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
+ }
+ params.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
+ container.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_FULLSCREEN);
+ }
+ params.height = ViewGroup.LayoutParams.MATCH_PARENT;
+ if (Build.VERSION.SDK_INT >= 28) {
+ params.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
+ }
+ window.setAttributes(params);
}
- params.height = ViewGroup.LayoutParams.MATCH_PARENT;
- if (Build.VERSION.SDK_INT >= 28) {
- params.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
- }
- window.setAttributes(params);
}
@Override
@@ -1324,6 +1370,14 @@ public class BottomSheet extends Dialog {
}
container.setSystemUiVisibility(flags);
}
+ if (attachedFragment != null) {
+ LaunchActivity.instance.checkSystemBarColors(true, true, true, false);
+ }
+ }
+
+ @Override
+ public boolean isAttachedLightStatusBar() {
+ return useLightStatusBar;
}
public boolean isFocusable() {
@@ -1358,7 +1412,11 @@ public class BottomSheet extends Dialog {
@Override
public void show() {
if (!AndroidUtilities.isSafeToShow(getContext())) return;
- super.show();
+ if (attachedFragment != null) {
+ onCreateInternal();
+ } else {
+ super.show();
+ }
setShowing(true);
if (focusable) {
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
@@ -1738,6 +1796,16 @@ public class BottomSheet extends Dialog {
forceKeyboardOnDismiss = true;
}
+ @Override
+ public View getWindowView() {
+ return container;
+ }
+
+ @Override
+ public boolean isShown() {
+ return !dismissed;
+ }
+
@Override
public void dismiss() {
if (delegate != null && !delegate.canDismiss()) {
@@ -1836,16 +1904,77 @@ public class BottomSheet extends Dialog {
setShowing(false);
}
+ @Override
+ public void dismiss(boolean tabs) {
+ this.dismiss();
+ }
+
+ @Override
+ public void release() {
+ dismissInternal();
+ }
+
+ @Override
+ public boolean isFullyVisible() {
+ return false;
+ }
+
+ @Override
+ public boolean attachedToParent() {
+ return container != null && container.isAttachedToWindow();
+ }
+
+ @Override
+ public boolean showDialog(Dialog dialog) {
+ return false;
+ }
+
+ @Override
+ public void setKeyboardHeightFromParent(int keyboardHeight) {
+
+ }
+
+ @Override
+ public int getNavigationBarColor(int color) {
+ final float t;
+ if (!attachedToParent() || containerView == null) {
+ t = 0;
+ } else if (transitionFromRight) {
+ t = containerView.getAlpha();
+ } else {
+ final float fullHeight = getContainerViewHeight() + keyboardHeight + AndroidUtilities.dp(10) + (scrollNavBar ? getBottomInset() : 0);
+ t = Utilities.clamp01(1f - containerView.getTranslationY() / fullHeight);
+ }
+ return ColorUtils.blendARGB(color, navBarColor, t);
+ }
+
+ @Override
+ public void setOnDismissListener(Runnable onDismiss) {
+ if (onDismiss != null) {
+ setOnHideListener(d -> onDismiss.run());
+ }
+ }
+
+ @Override
+ public void setOnDismissListener(@Nullable OnDismissListener listener) {
+ super.setOnDismissListener(listener);
+ }
+
public int getSheetAnimationType() {
return currentSheetAnimationType;
}
public void dismissInternal() {
- try {
- super.dismiss();
- } catch (Exception e) {
- //ignore: not attached to window manager
- FileLog.e(e, false);
+ if (attachedFragment != null) {
+ attachedFragment.removeSheet(this);
+ AndroidUtilities.removeFromParent(container);
+ } else {
+ try {
+ super.dismiss();
+ } catch (Exception e) {
+ //ignore: not attached to window manager
+ FileLog.e(e, false);
+ }
}
}
@@ -2061,6 +2190,12 @@ public class BottomSheet extends Dialog {
container.invalidate();
}
+ if (attachedFragment != null) {
+ LaunchActivity.instance.checkSystemBarColors(true, true, true, false);
+ AndroidUtilities.setLightNavigationBar(getWindowView(), AndroidUtilities.computePerceivedBrightness(getNavigationBarColor(getThemedColor(Theme.key_windowBackgroundGray))) >= .721f);
+// AndroidUtilities.setLightStatusBar(dialog != null ? dialog.windowView : windowView, attachedToActionBar && AndroidUtilities.computePerceivedBrightness(actionBar.getBackgroundColor()) > .721f);
+ return;
+ }
// if (Color.alpha(color) > 120) {
// AndroidUtilities.setLightStatusBar(getWindow(), false);
// AndroidUtilities.setLightNavigationBar(getWindow(), false);
@@ -2124,4 +2259,28 @@ public class BottomSheet extends Dialog {
protected void onSmoothContainerViewLayout(float ty) {
}
+
+
+ public BaseFragment attachedFragment;
+
+ public void makeAttached(BaseFragment fragment) {
+ if (AndroidUtilities.isTablet()) return;
+ this.attachedFragment = fragment;
+ }
+
+ @Override
+ public boolean onAttachedBackPressed() {
+ onBackPressed();
+ return true;
+ }
+
+ @Override
+ public void onBackPressed() {
+ if (attachedFragment == null) {
+ super.onBackPressed();
+ } else {
+ dismiss();
+ }
+ }
+
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheetTabDialog.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheetTabDialog.java
new file mode 100644
index 000000000..03e169303
--- /dev/null
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheetTabDialog.java
@@ -0,0 +1,157 @@
+package org.telegram.ui.ActionBar;
+
+import android.app.Dialog;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.RectF;
+import android.os.Build;
+import android.os.Bundle;
+import android.view.Gravity;
+import android.view.KeyboardShortcutGroup;
+import android.view.Menu;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.Window;
+import android.view.WindowInsets;
+import android.view.WindowManager;
+import android.widget.FrameLayout;
+
+import androidx.annotation.Nullable;
+
+import org.telegram.messenger.AndroidUtilities;
+import org.telegram.messenger.R;
+import org.telegram.ui.Components.LayoutHelper;
+import org.telegram.ui.LaunchActivity;
+
+import java.util.List;
+
+public class BottomSheetTabDialog extends Dialog {
+
+ public static BottomSheetTabsOverlay.Sheet checkSheet(BottomSheetTabsOverlay.Sheet sheet) {
+ BaseFragment fragment = LaunchActivity.getSafeLastFragment();
+ if (fragment == null) return sheet;
+ if (AndroidUtilities.isTablet() || AndroidUtilities.hasDialogOnTop(fragment)) {
+ final BottomSheetTabDialog dialog = new BottomSheetTabDialog(sheet);
+ if (sheet.setDialog(dialog)) {
+ dialog.windowView.putView();
+ return sheet;
+ }
+ }
+ return sheet;
+ }
+
+ public final BottomSheetTabsOverlay.Sheet sheet;
+ public final BottomSheetTabsOverlay.SheetView sheetView;
+
+ public final WindowView windowView;
+
+ public BottomSheetTabDialog(BottomSheetTabsOverlay.Sheet sheet) {
+ super(sheet.getWindowView().getContext(), R.style.TransparentDialog);
+
+ this.sheet = sheet;
+ this.sheetView = sheet.getWindowView();
+
+ setContentView(windowView = new WindowView(sheetView), new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ Window window = getWindow();
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
+ window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
+ } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
+ }
+ window.setWindowAnimations(R.style.DialogNoAnimation);
+
+ WindowManager.LayoutParams params = window.getAttributes();
+ params.width = ViewGroup.LayoutParams.MATCH_PARENT;
+ params.gravity = Gravity.TOP | Gravity.LEFT;
+ params.dimAmount = 0;
+ params.flags &= ~WindowManager.LayoutParams.FLAG_DIM_BEHIND;
+ params.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
+ params.height = ViewGroup.LayoutParams.MATCH_PARENT;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
+ params.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
+ }
+ window.setAttributes(params);
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ window.setStatusBarColor(Color.TRANSPARENT);
+ }
+
+ windowView.setFitsSystemWindows(true);
+ windowView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
+ windowView.setPadding(0, 0, 0, 0);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ windowView.setOnApplyWindowInsetsListener((v, insets) -> {
+ v.setPadding(0, 0, 0, insets.getSystemWindowInsetBottom());
+ if (Build.VERSION.SDK_INT >= 30) {
+ return WindowInsets.CONSUMED;
+ } else {
+ return insets.consumeSystemWindowInsets();
+ }
+ });
+ }
+ }
+
+ public void updateNavigationBarColor() {
+ final int color = sheet.getNavigationBarColor(0);
+ AndroidUtilities.setNavigationBarColor(getWindow(), color);
+ AndroidUtilities.setLightNavigationBar(getWindow(), AndroidUtilities.computePerceivedBrightness(color) >= .721f);
+ }
+
+ public static class WindowView extends FrameLayout implements BottomSheetTabsOverlay.SheetView {
+
+ public final BottomSheetTabsOverlay.SheetView sheetView;
+
+ public WindowView(BottomSheetTabsOverlay.SheetView sheetView) {
+ super(sheetView.getContext());
+ this.sheetView = sheetView;
+ }
+
+ public void putView() {
+ View view = (View) sheetView;
+ AndroidUtilities.removeFromParent(view);
+ addView(view, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL));
+ }
+
+ @Override
+ public void setDrawingFromOverlay(boolean value) {
+ sheetView.setDrawingFromOverlay(value);
+ }
+
+ @Override
+ public RectF getRect() {
+ return sheetView.getRect();
+ }
+
+ @Override
+ public float drawInto(Canvas canvas, RectF finalRect, float progress, RectF clipRect, float alpha, boolean opening) {
+ return sheetView.drawInto(canvas, finalRect, progress, clipRect, alpha, opening);
+ }
+
+ }
+
+ private boolean attached;
+ public void attach() {
+ if (attached) return;
+ attached = true;
+ super.show();
+ }
+
+ public void detach() {
+ sheet.setDialog(null);
+ if (!attached) return;
+ attached = false;
+ super.dismiss();
+ }
+
+ @Override
+ public void dismiss() {
+ sheet.dismiss(false);
+ }
+
+}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheetTabs.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheetTabs.java
index cf6788616..c8d06bbfb 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheetTabs.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheetTabs.java
@@ -2,15 +2,22 @@ package org.telegram.ui.ActionBar;
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.Bitmap;
import android.graphics.Canvas;
+import android.graphics.Color;
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.os.Bundle;
+import android.text.TextPaint;
+import android.text.TextUtils;
+import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;
@@ -21,14 +28,17 @@ import androidx.core.graphics.ColorUtils;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ContactsController;
+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.UserConfig;
import org.telegram.messenger.UserObject;
import org.telegram.messenger.Utilities;
import org.telegram.tgnet.TLRPC;
+import org.telegram.ui.ArticleViewer;
import org.telegram.ui.ChatActivity;
import org.telegram.ui.Components.AnimatedColor;
import org.telegram.ui.Components.AnimatedFloat;
@@ -36,8 +46,9 @@ import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.Text;
import org.telegram.ui.LaunchActivity;
import org.telegram.ui.bots.BotWebViewAttachedSheet;
-import org.telegram.ui.bots.BotWebViewContainer;
+import org.telegram.ui.web.BotWebViewContainer;
import org.telegram.ui.bots.BotWebViewSheet;
+import org.telegram.ui.bots.WebViewRequestProps;
import java.util.ArrayList;
import java.util.HashMap;
@@ -61,7 +72,10 @@ public class BottomSheetTabs extends FrameLayout {
final int count = tabs.size();
if (count == 0) return;
WebTabData lastTab = tabs.get(tabs.size() - 1);
- BottomSheetTabsOverlay overlay = LaunchActivity.instance.getBottomSheetTabsOverlay();
+ BottomSheetTabsOverlay overlay = LaunchActivity.instance == null ? null : LaunchActivity.instance.getBottomSheetTabsOverlay();
+ if (overlay != null) {
+ overlay.stopAnimations();
+ }
if (count == 1 || overlay == null) {
openTab(lastTab);
@@ -82,6 +96,18 @@ public class BottomSheetTabs extends FrameLayout {
((ChatActivity) lastFragment).getChatActivityEnterView().hidePopup(true, false);
}
}
+ if (tab.articleViewer != null) {
+ BaseFragment fragment = actionBarLayout.getSheetFragment();
+ final ArticleViewer articleViewer = tab.articleViewer;
+ BottomSheetTabDialog.checkSheet(articleViewer.sheet);
+ fragment.addSheet(articleViewer.sheet);
+ articleViewer.sheet.reset();
+ articleViewer.setParentActivity(fragment.getParentActivity(), fragment);
+ articleViewer.sheet.attachInternal(fragment);
+ articleViewer.sheet.animateOpen(true, true, null);
+ removeTab(tab, false);
+ return;
+ }
boolean closed = closeAttachedSheets();
Utilities.Callback open = fragment -> {
if (fragment == null) return;
@@ -91,10 +117,10 @@ public class BottomSheetTabs extends FrameLayout {
((ChatActivity) fragment).getChatActivityEnterView().hidePopup(true, false);
}
}
- if (fragment.getContext() == null) {
+ if (fragment.getContext() == null || fragment.getParentActivity() == null) {
return;
}
- if (AndroidUtilities.isTablet()) {
+ if (AndroidUtilities.isTablet() && !tab.isWeb) {
BotWebViewSheet sheet = new BotWebViewSheet(fragment.getContext(), fragment.getResourceProvider());
sheet.setParentActivity(fragment.getParentActivity());
if (sheet.restoreState(fragment, tab)) {
@@ -102,30 +128,26 @@ public class BottomSheetTabs extends FrameLayout {
sheet.show();
}
} else {
- BottomSheetTabsOverlay overlay = LaunchActivity.instance.getBottomSheetTabsOverlay();
- BotWebViewAttachedSheet webViewSheet = fragment.createBotViewer();
+ BaseFragment sheetFragment = actionBarLayout.getSheetFragment();
+ if (sheetFragment == null) return;
+ BotWebViewAttachedSheet webViewSheet = sheetFragment.createBotViewer();
webViewSheet.setParentActivity(fragment.getParentActivity());
if (webViewSheet.restoreState(fragment, tab)) {
-// if (overlay != null && overlay.isOpened() && overlay.openSheet(webViewSheet, tab, null)) {
-// removeTab(tab, false);
-// webViewSheet.show(closed, true);
-// } else {
- removeTab(tab, false);
- webViewSheet.show(closed);
-// }
+ removeTab(tab, false);
+ webViewSheet.show(closed);
}
}
};
+ open.run(lastFragment);
if (tab.needsContext && (!(lastFragment instanceof ChatActivity) || ((ChatActivity) lastFragment).getDialogId() != tab.props.botId)) {
BaseFragment chatActivity = ChatActivity.of(tab.props.botId);
- chatActivity.whenFullyVisible(() -> open.run(chatActivity));
- lastFragment.presentFragment(chatActivity);
- } else {
- open.run(lastFragment);
+ AndroidUtilities.runOnUIThread(() -> {
+ lastFragment.presentFragment(chatActivity);
+ }, 220);
}
}
- public WebTabData tryReopenTab(BotWebViewAttachedSheet.WebViewRequestProps props) {
+ public WebTabData tryReopenTab(WebViewRequestProps props) {
ArrayList tabs = this.tabs.get(currentAccount);
if (tabs == null) this.tabs.put(currentAccount, tabs = new ArrayList<>());
@@ -140,6 +162,63 @@ public class BottomSheetTabs extends FrameLayout {
return null;
}
+ public static String urlWithoutFragment(String url) {
+ if (url == null) return null;
+ int index = url.indexOf('#');
+ if (index >= 0) return url.substring(0, index + 1);
+ return url;
+ }
+
+ public WebTabData tryReopenTab(String url) {
+ if (TextUtils.isEmpty(url)) return null;
+ final ArrayList tabs = getTabs();
+ for (int i = 0; i < tabs.size(); ++i) {
+ WebTabData tab = tabs.get(i);
+ if (tab.articleViewer != null && !tab.articleViewer.pagesStack.isEmpty()) {
+ Object lastPage = tab.articleViewer.pagesStack.get(tab.articleViewer.pagesStack.size() - 1);
+ if (lastPage instanceof ArticleViewer.CachedWeb) {
+ ArticleViewer.CachedWeb web = (ArticleViewer.CachedWeb) lastPage;
+ BotWebViewContainer.MyWebView webView = web.webView;
+ if (webView == null && tab.articleViewer.pages != null && tab.articleViewer.pages[0] != null) {
+ webView = tab.articleViewer.pages[0].getWebView();
+ }
+ if (webView != null && TextUtils.equals(urlWithoutFragment(webView.canGoBack() ? webView.getUrl() : webView.getOpenURL()), urlWithoutFragment(url))) {
+ openTab(tab);
+ return tab;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public WebTabData tryReopenTab(TLRPC.WebPage webpage) {
+ if (webpage == null) return null;
+ final ArrayList tabs = getTabs();
+ for (int i = 0; i < tabs.size(); ++i) {
+ WebTabData tab = tabs.get(i);
+ if (tab.articleViewer != null && !tab.articleViewer.pagesStack.isEmpty()) {
+ Object lastPage = tab.articleViewer.pagesStack.get(tab.articleViewer.pagesStack.size() - 1);
+ if (lastPage instanceof TLRPC.WebPage) {
+ TLRPC.WebPage pageWebPage = (TLRPC.WebPage) lastPage;
+ if (pageWebPage != null && pageWebPage.id == webpage.id) {
+ openTab(tab);
+ return tab;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public WebTabData tryReopenTab(MessageObject messageObject) {
+ if (messageObject == null) return null;
+ if (messageObject.messageOwner == null) return null;
+ if (messageObject.messageOwner.media == null) return null;
+ if (messageObject.messageOwner.media.webpage == null) return null;
+ return tryReopenTab(messageObject.messageOwner.media.webpage);
+ }
+
public boolean closeAttachedSheets() {
boolean had = false;
BottomSheetTabsOverlay overlay = LaunchActivity.instance.getBottomSheetTabsOverlay();
@@ -221,12 +300,20 @@ public class BottomSheetTabs extends FrameLayout {
}
public ArrayList getTabs() {
+ return getTabs(this.currentAccount);
+ }
+
+ public ArrayList getTabDrawables() {
+ return getTabDrawables(this.currentAccount);
+ }
+
+ public ArrayList getTabs(int currentAccount) {
ArrayList tabs = this.tabs.get(currentAccount);
if (tabs == null) this.tabs.put(currentAccount, tabs = new ArrayList<>());
return tabs;
}
- public ArrayList getTabDrawables() {
+ public ArrayList getTabDrawables(int currentAccount) {
ArrayList tabDrawables = this.tabDrawables.get(currentAccount);
if (tabDrawables == null) this.tabDrawables.put(currentAccount, tabDrawables = new ArrayList<>());
return tabDrawables;
@@ -274,21 +361,31 @@ public class BottomSheetTabs extends FrameLayout {
return super.verifyDrawable(who) || true;
}
+ private static TextPaint textPaint;
+ private static TextPaint getTextPaint() {
+ if (textPaint == null) {
+ textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
+ textPaint.setTypeface(AndroidUtilities.bold());
+ textPaint.setTextSize(AndroidUtilities.dp(17));
+ }
+ return textPaint;
+ }
+
private void updateMultipleTitle() {
final ArrayList tabs = getTabs();
final ArrayList tabDrawables = getTabDrawables();
- String title = null;
+ CharSequence title = null;
for (int i = 0; i < tabDrawables.size(); ++i) {
TabDrawable drawable = tabDrawables.get(i);
if (tabs.size() > 1 && drawable.position == 0) {
- TLRPC.User user = MessagesController.getInstance(drawable.tab.props.currentAccount).getUser(drawable.tab.props.botId);
- title = LocaleController.formatPluralString("BotMoreTabs", tabs.size() - 1, UserObject.getUserName(user));
+ title = LocaleController.formatPluralString("BotMoreTabs", tabs.size() - 1, drawable.tab.getTitle());
+ title = Emoji.replaceEmoji(title, getTextPaint().getFontMetricsInt(), false);
drawable.setOverrideTitle(title);
} else {
- TLRPC.User user = MessagesController.getInstance(drawable.tab.props.currentAccount).getUser(drawable.tab.props.botId);
- title = UserObject.getUserName(user);
+ title = drawable.tab.getTitle();
+ title = Emoji.replaceEmoji(title, getTextPaint().getFontMetricsInt(), false);
drawable.setOverrideTitle(null);
}
}
@@ -320,6 +417,20 @@ public class BottomSheetTabs extends FrameLayout {
return tabs.isEmpty();
}
+ public boolean tryRemoveTabWith(ArticleViewer articleViewer) {
+ for (int account = 0; account < this.tabs.size(); ++account) {
+ ArrayList tabs = this.tabs.get(account);
+ if (tabs != null) {
+ for (WebTabData tab : tabs) {
+ if (tab.articleViewer == articleViewer) {
+ return removeTab(account, tab, true);
+ }
+ }
+ }
+ }
+ return false;
+ }
+
public void removeTab(WebTabData tab, Utilities.Callback callback) {
if (tab == null) {
callback.run(true);
@@ -341,14 +452,14 @@ public class BottomSheetTabs extends FrameLayout {
final AlertDialog[] dialog = new AlertDialog[1];
dialog[0] = new AlertDialog.Builder(getContext())
.setTitle(botName)
- .setMessage(LocaleController.getString(R.string.BotWebViewChangesMayNotBeSaved))
- .setPositiveButton(LocaleController.getString(R.string.BotWebViewCloseAnyway), (d, w) -> {
+ .setMessage(getString(R.string.BotWebViewChangesMayNotBeSaved))
+ .setPositiveButton(getString(R.string.BotWebViewCloseAnyway), (d, w) -> {
clicked[0] = true;
removeTab(tab, true);
callback.run(true);
dialog[0].dismiss();
})
- .setNegativeButton(LocaleController.getString(R.string.Cancel), (d, w) -> {
+ .setNegativeButton(getString(R.string.Cancel), (d, w) -> {
clicked[0] = true;
callback.run(false);
dialog[0].dismiss();
@@ -366,8 +477,12 @@ public class BottomSheetTabs extends FrameLayout {
}
public boolean removeTab(WebTabData tab, boolean destroy) {
- final ArrayList tabs = getTabs();
- final ArrayList tabDrawables = getTabDrawables();
+ return removeTab(currentAccount, tab, destroy);
+ }
+
+ public boolean removeTab(int currentAccount, WebTabData tab, boolean destroy) {
+ final ArrayList tabs = getTabs(currentAccount);
+ final ArrayList tabDrawables = getTabDrawables(currentAccount);
tabs.remove(tab);
if (destroy) {
@@ -495,7 +610,9 @@ public class BottomSheetTabs extends FrameLayout {
public final AnimatedFloat animatedAlpha;
private final Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ private final Paint progressPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private final Paint iconPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ private final Paint faviconPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
public int closeRippleColor;
public final Drawable closeRipple = Theme.createSelectorDrawable(0x30ffffff, Theme.RIPPLE_MASK_CIRCLE_20DP);
@@ -504,7 +621,12 @@ public class BottomSheetTabs extends FrameLayout {
private int backgroundColor, tabColor;
private boolean backgroundIsDark, tabIsDark;
- private Text title;
+ private float progress;
+
+ private Bitmap favicon;
+ private Drawable iconDrawable;
+ private int iconDrawableColor = Color.WHITE;
+ private final Text title;
private Text overrideTitle;
public TabDrawable(View view, WebTabData tab) {
@@ -519,10 +641,15 @@ public class BottomSheetTabs extends FrameLayout {
animatedPosition = new AnimatedFloat(view, 320, CubicBezierInterpolator.EASE_OUT_QUINT);
animatedAlpha = new AnimatedFloat(view, 320, CubicBezierInterpolator.EASE_OUT_QUINT);
- TLRPC.User user = MessagesController.getInstance(tab.props.currentAccount).getUser(tab.getBotId());
- this.title = new Text(UserObject.getUserName(user), 17, AndroidUtilities.bold());
+ this.favicon = tab.favicon;
+ CharSequence title = Emoji.replaceEmoji(tab.getTitle(), getTextPaint().getFontMetricsInt(), false);
+ this.title = new Text(title, 17, AndroidUtilities.bold());
this.tabColor = tab.actionBarColor;
this.tabIsDark = AndroidUtilities.computePerceivedBrightness(tabColor) < .721f;
+ if (tab.isArticle()) {
+ iconDrawable = view.getContext().getResources().getDrawable(R.drawable.msg_instant).mutate();
+ }
+ progress = tab.articleProgress;
closePath.rewind();
closePath.moveTo(0, 0);
@@ -536,7 +663,7 @@ public class BottomSheetTabs extends FrameLayout {
expandPath.lineTo(dp(12.66f), dp(6.33f) / 2f);
}
- public void setOverrideTitle(String title) {
+ public void setOverrideTitle(CharSequence title) {
if (title == null) {
overrideTitle = null;
} else {
@@ -595,6 +722,14 @@ public class BottomSheetTabs extends FrameLayout {
rectPath.addRoundRect(bounds, radii, Path.Direction.CW);
canvas.drawPath(rectPath, backgroundPaint);
+ if (progress > 0 && expandProgress > 0 && alpha > 0) {
+ canvas.save();
+ canvas.clipPath(rectPath);
+ progressPaint.setColor(Theme.multAlpha(AndroidUtilities.computePerceivedBrightness(backgroundColor) > .721f ? Color.BLACK : Color.WHITE, .07f * alpha * expandProgress));
+ canvas.drawRect(bounds.left, bounds.top, bounds.left + bounds.width() * progress, bounds.bottom, progressPaint);
+ canvas.restore();
+ }
+
final float isDark = lerp(backgroundIsDark ? 1f : 0f, tabIsDark ? 1f : 0f, expandProgress);
final int iconColor = ColorUtils.blendARGB(0xFF000000, 0xFFFFFFFF, isDark);
@@ -628,28 +763,69 @@ public class BottomSheetTabs extends FrameLayout {
canvas.drawPath(expandPath, iconPaint);
canvas.restore();
+ int leftPadding = 0;
+ if (favicon != null) {
+ final int sz = dp(24);
+
+ canvas.save();
+ AndroidUtilities.rectTmp2.set(
+ (int) (bounds.left + dp(56)),
+ (int) (bounds.centerY() - sz / 2f),
+ (int) (bounds.left + dp(56) + sz),
+ (int) (bounds.centerY() + sz / 2f)
+ );
+ faviconPaint.setAlpha((int) (0xFF * alpha * contentAlpha));
+ canvas.drawBitmap(favicon, null, AndroidUtilities.rectTmp2, faviconPaint);
+ canvas.restore();
+
+ leftPadding = sz + dp(4);
+ } else if (iconDrawable != null) {
+ final int sz = dp(24);
+
+ final int h = sz;
+ final int w = (int) (sz / (float) iconDrawable.getIntrinsicHeight() * iconDrawable.getIntrinsicWidth());
+ final float s = .7f;
+
+ AndroidUtilities.rectTmp2.set(
+ (int) (bounds.left + dp(56)),
+ (int) (bounds.centerY() - h / 2f * s),
+ (int) (bounds.left + dp(56) + w * s),
+ (int) (bounds.centerY() + h / 2f * s)
+ );
+ if (iconColor != iconDrawableColor) {
+ iconDrawable.setColorFilter(new PorterDuffColorFilter(iconDrawableColor = iconColor, PorterDuff.Mode.SRC_IN));
+ }
+ iconDrawable.setAlpha((int) (0xFF * alpha * contentAlpha));
+ iconDrawable.setBounds(AndroidUtilities.rectTmp2);
+ iconDrawable.draw(canvas);
+
+ leftPadding = w - dp(2);
+ }
+
if (overrideTitle != null) {
overrideTitle
- .ellipsize((int) (bounds.width() - dp(100)))
- .draw(canvas, bounds.left + dp(60), bounds.centerY(), iconColor, (1f - expandProgress) * alpha * contentAlpha);
+ .ellipsize((int) (bounds.width() - dp(100) - leftPadding))
+ .draw(canvas, bounds.left + dp(60) + leftPadding, bounds.centerY(), iconColor, (1f - expandProgress) * alpha * contentAlpha);
}
title
- .ellipsize((int) (bounds.width() - dp(100)))
- .draw(canvas, bounds.left + dp(60), bounds.centerY(), iconColor, (overrideTitle == null ? 1f : expandProgress) * alpha * contentAlpha);
+ .ellipsize((int) (bounds.width() - dp(100) - leftPadding))
+ .draw(canvas, bounds.left + dp(60) + leftPadding, bounds.centerY(), iconColor, (overrideTitle == null ? 1f : expandProgress) * alpha * contentAlpha);
}
}
public static class WebTabData {
- public BotWebViewAttachedSheet.WebViewRequestProps props;
+ public WebViewRequestProps props;
public Bundle webViewState;
public BotWebViewContainer.MyWebView webView;
- public BotWebViewContainer.WebViewProxy webViewProxy;
- public int webViewWidth, webViewHeight;
- public int webViewScroll;
+ public View view2;
+ public Object proxy;
+ public int viewWidth, viewHeight;
+ public int viewScroll;
public boolean expanded;
public float expandedOffset = Float.MAX_VALUE;
+ public boolean allowSwipes = true;
public Bitmap previewBitmap;
public Object previewNode;
@@ -671,6 +847,19 @@ public class BottomSheetTabs extends FrameLayout {
public boolean themeIsDark;
+ public boolean isWeb;
+ public String title;
+ public Bitmap favicon;
+ public String startUrl;
+ public String currentUrl;
+
+ public boolean error;
+ public int errorCode;
+ public String errorDescription;
+
+ public float articleProgress;
+ public ArticleViewer articleViewer;
+
public long getBotId() {
if (props == null) return 0;
return props.botId;
@@ -682,11 +871,29 @@ public class BottomSheetTabs extends FrameLayout {
webView.destroy();
webView = null;
}
+ if (articleViewer != null) {
+ articleViewer.destroy();
+ }
} catch (Exception e) {
FileLog.e(e);
}
}
+ public boolean isArticle() {
+ return articleViewer != null && articleViewer.isLastArticle();
+ }
+
+ public String getTitle() {
+ if (isWeb || articleViewer != null) {
+ if (TextUtils.isEmpty(title))
+ return getString(R.string.WebEmpty);
+ return title;
+ }
+ if (props == null) return "";
+ TLRPC.User user = MessagesController.getInstance(props.currentAccount).getUser(props.botId);
+ return UserObject.getUserName(user);
+ }
+
}
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheetTabsOverlay.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheetTabsOverlay.java
index 88ee535fa..e42571ee1 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheetTabsOverlay.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheetTabsOverlay.java
@@ -2,6 +2,7 @@ package org.telegram.ui.ActionBar;
import static org.telegram.messenger.AndroidUtilities.dp;
import static org.telegram.messenger.AndroidUtilities.lerp;
+import static org.telegram.messenger.AndroidUtilities.scaleRect;
import static org.telegram.messenger.LocaleController.getString;
import static org.telegram.messenger.Utilities.clamp01;
@@ -50,20 +51,43 @@ import org.telegram.ui.Components.ButtonBounce;
import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.Text;
import org.telegram.ui.GradientClip;
-import org.telegram.ui.bots.BotWebViewAttachedSheet;
-import org.telegram.ui.bots.BotWebViewMenuContainer;
-import org.telegram.ui.bots.BotWebViewSheet;
import java.util.ArrayList;
public class BottomSheetTabsOverlay extends FrameLayout {
- private BottomSheetTabs tabsView;
+ public interface Sheet {
+ public SheetView getWindowView();
- private BotWebViewAttachedSheet dismissingSheet;
- private BotWebViewSheet dismissingSheet2;
- private BotWebViewAttachedSheet openingSheet;
- private BotWebViewMenuContainer dismissingMenuContainer;
+ public void show();
+ public void dismiss(boolean tabs);
+
+ public BottomSheetTabs.WebTabData saveState();
+ public boolean restoreState(BaseFragment fragment, BottomSheetTabs.WebTabData tab);
+
+ public void release();
+ public boolean isFullSize();
+
+ public boolean setDialog(BottomSheetTabDialog dialog);
+
+ default void setLastVisible(boolean lastVisible) {};
+
+ public int getNavigationBarColor(int color);
+ }
+
+ public interface SheetView {
+ public Context getContext();
+
+ public void setDrawingFromOverlay(boolean value);
+ public RectF getRect();
+ public float drawInto(Canvas canvas, RectF finalRect, float progress, RectF clipRect, float alpha, boolean opening);
+
+ public boolean post(Runnable r);
+ }
+
+ private BottomSheetTabs tabsView;
+ private Sheet dismissingSheet;
+ private Sheet openingSheet;
private BottomSheetTabs.TabDrawable dismissingTab;
private BottomSheetTabs.TabDrawable openingTab;
private float openingTabScroll;
@@ -361,6 +385,10 @@ public class BottomSheetTabsOverlay extends FrameLayout {
return Math.min(SharedConfig.botTabs3DEffect ? 3 : 6, getScrollRange());
}
+ public float getScrollWindow(boolean animated) {
+ return Math.min(SharedConfig.botTabs3DEffect ? 3 : 6, getScrollRange(animated));
+ }
+
public float getScrollMin() {
return getScrollMin(true);
}
@@ -374,7 +402,7 @@ public class BottomSheetTabsOverlay extends FrameLayout {
}
public float getScrollMax(boolean animated) {
- return getScrollRange(animated) - getScrollWindow() - getScrollWindow() / 3f * Utilities.clamp(4f - getScrollRange(animated), .5f, 0);
+ return getScrollRange(animated) - getScrollWindow(animated) - getScrollWindow(animated) / 3f * Utilities.clamp(4f - getScrollRange(animated), .5f, 0);
}
public boolean canScroll() {
@@ -401,7 +429,7 @@ public class BottomSheetTabsOverlay extends FrameLayout {
this.slowerDismiss = slowerDismiss;
}
- public boolean openSheet(BotWebViewAttachedSheet sheet, BottomSheetTabs.WebTabData tab, Runnable whenOpened) {
+ public boolean openSheet(Sheet sheet, BottomSheetTabs.WebTabData tab, Runnable whenOpened) {
if (sheet == null) return false;
if (tabsView == null) return false;
@@ -455,7 +483,14 @@ public class BottomSheetTabsOverlay extends FrameLayout {
return true;
}
- public boolean dismissSheet(BotWebViewAttachedSheet sheet) {
+ public void stopAnimations() {
+ if (animator != null) {
+ animator.cancel();
+ animator = null;
+ }
+ }
+
+ public boolean dismissSheet(Sheet sheet) {
if (sheet == null) return false;
if (tabsView == null) return false;
@@ -467,6 +502,7 @@ public class BottomSheetTabsOverlay extends FrameLayout {
}
dismissingSheet = sheet;
+ sheet.setLastVisible(false);
sheet.getWindowView().setDrawingFromOverlay(true);
invalidate();
@@ -477,10 +513,6 @@ public class BottomSheetTabsOverlay extends FrameLayout {
BottomSheetTabs.WebTabData tab = sheet.saveState();
dismissingTab = tabsView.pushTab(tab);
- if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
- renderHardwareViewToBitmap(tab.webView, -tab.webViewScroll, b -> tab.previewBitmap = b);
- }
-
dismissProgress = 0;
animator = ValueAnimator.ofFloat(0, 1);
animator.addUpdateListener(anm -> {
@@ -490,12 +522,16 @@ public class BottomSheetTabsOverlay extends FrameLayout {
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
- if (tab.webView != null && tab.previewBitmap == null && tab.webViewWidth > 0 && tab.webViewHeight > 0) {
- if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.O) {
- tab.previewBitmap = Bitmap.createBitmap(tab.webViewWidth, tab.webViewHeight, Bitmap.Config.RGB_565);
+ sheet.getWindowView().setDrawingFromOverlay(false);
+ View view = tab.webView != null ? tab.webView : tab.view2;
+ if (view != null && tab.previewBitmap == null && tab.viewWidth > 0 && tab.viewHeight > 0) {
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
+ renderHardwareViewToBitmap(view, -tab.viewScroll, b -> tab.previewBitmap = b);
+ } else {
+ tab.previewBitmap = Bitmap.createBitmap(tab.viewWidth, tab.viewHeight, Bitmap.Config.RGB_565);
Canvas canvas = new Canvas(tab.previewBitmap);
- canvas.translate(0, -tab.webViewScroll);
- tab.webView.draw(canvas);
+ canvas.translate(0, -tab.viewScroll);
+ view.draw(canvas);
}
}
sheet.release();
@@ -503,8 +539,8 @@ public class BottomSheetTabsOverlay extends FrameLayout {
invalidate();
}
});
- if (slowerDismiss || sheet.getFullSize()) {
- AndroidUtilities.applySpring(animator, 260, 30, 1);
+ if (slowerDismiss || sheet.isFullSize()) {
+ AndroidUtilities.applySpring(animator, 220, 30, 1);
} else {
AndroidUtilities.applySpring(animator, 350, 30, 1);
}
@@ -515,112 +551,6 @@ public class BottomSheetTabsOverlay extends FrameLayout {
return true;
}
- public boolean dismissSheet(BotWebViewSheet sheet) {
- if (sheet == null) return false;
- if (tabsView == null) return false;
-
- if (dismissingSheet != null || openingSheet != null) {
- if (animator != null) {
- animator.end();
- animator = null;
- }
- }
-
- dismissingSheet2 = sheet;
- sheet.getWindowView().setDrawingFromOverlay(true);
- invalidate();
-
- if (animator != null) {
- animator.cancel();
- }
-
- BottomSheetTabs.WebTabData tab = sheet.saveState();
- dismissingTab = tabsView.pushTab(tab);
-
- if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
- renderHardwareViewToBitmap(tab.webView, -tab.webViewScroll, b -> tab.previewBitmap = b);
- }
-
- dismissProgress = 0;
- animator = ValueAnimator.ofFloat(0, 1);
- animator.addUpdateListener(anm -> {
- dismissProgress = (float) anm.getAnimatedValue();
- invalidate();
- });
- animator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- if (tab.webView != null && tab.previewBitmap == null && tab.webViewWidth > 0 && tab.webViewHeight > 0) {
- if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.O) {
- tab.previewBitmap = Bitmap.createBitmap(tab.webViewWidth, tab.webViewHeight, Bitmap.Config.RGB_565);
- Canvas canvas = new Canvas(tab.previewBitmap);
- canvas.translate(0, -tab.webViewScroll);
- tab.webView.draw(canvas);
- }
- }
- sheet.release();
- dismissingSheet2 = null;
- invalidate();
- }
- });
- AndroidUtilities.applySpring(animator, 350, 30, 1);
- animator.setDuration(animator.getDuration() * 2);
- animator.start();
-
- slowerDismiss = false;
-
- return true;
- }
-
- public boolean dismissSheet(BotWebViewMenuContainer menuContainer) {
- if (menuContainer == null) return false;
- if (tabsView == null) return false;
-
- dismissingMenuContainer = menuContainer;
- menuContainer.setDrawingFromOverlay(true);
- invalidate();
-
- if (animator != null) {
- animator.cancel();
- }
-
- BottomSheetTabs.WebTabData tab = menuContainer.saveState();
- dismissingTab = tabsView.pushTab(tab);
-
- if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
- renderHardwareViewToBitmap(tab.webView, -tab.webViewScroll, b -> tab.previewBitmap = b);
- }
-
- dismissProgress = 0;
- animator = ValueAnimator.ofFloat(0, 1);
- animator.addUpdateListener(anm -> {
- dismissProgress = (float) anm.getAnimatedValue();
- invalidate();
- });
- animator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- if (tab.webView != null && tab.previewBitmap == null && tab.webViewWidth > 0 && tab.webViewHeight > 0) {
- if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.O) {
- tab.previewBitmap = Bitmap.createBitmap(tab.webViewWidth, tab.webViewHeight, Bitmap.Config.RGB_565);
- Canvas canvas = new Canvas(tab.previewBitmap);
- canvas.translate(0, -tab.webViewScroll);
- tab.webView.draw(canvas);
- }
- }
- menuContainer.onDismiss();
- menuContainer.setDrawingFromOverlay(false);
- dismissingMenuContainer = null;
- invalidate();
- }
- });
- AndroidUtilities.applySpring(animator, 350, 30, 1);
- animator.setDuration(animator.getDuration());
- animator.start();
-
- return true;
- }
-
public boolean onBackPressed() {
if (isOpen) {
closeTabsView();
@@ -634,7 +564,9 @@ public class BottomSheetTabsOverlay extends FrameLayout {
private Paint blurBitmapPaint;
private Matrix blurMatrix;
private void prepareBlur(View view) {
+ AndroidUtilities.makingGlobalBlurBitmap = true;
blurBitmap = AndroidUtilities.makeBlurBitmap(view, 14, 14);
+ AndroidUtilities.makingGlobalBlurBitmap = false;
blurBitmapPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
blurBitmapPaint.setShader(blurBitmapShader = new BitmapShader(blurBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP));
@@ -651,6 +583,8 @@ public class BottomSheetTabsOverlay extends FrameLayout {
public void openTabsView() {
if (tabsView == null || !(tabsView.getParent() instanceof View)) return;
+ stopAnimations();
+
actionBarLayout = (View) tabsView.getParent();
if (actionBarLayout != null) {
actionBarLayout.getLocationOnScreen(pos);
@@ -777,48 +711,6 @@ public class BottomSheetTabsOverlay extends FrameLayout {
canvas.restore();
}
}
-
- if (dismissingSheet2 != null) {
- BotWebViewSheet.WindowView windowView = dismissingSheet2.getWindowView();
- getLocationOnScreen(pos2);
- tabsView.getLocationOnScreen(pos);
- tabsView.getTabBounds(rect, 0);
- rect.offset(pos[0] - pos2[0], pos[1] - pos2[1]);
- float radius = windowView.drawInto(canvas, rect, dismissProgress, clipRect);
-
- if (dismissingTab != null) {
- clipPath.rewind();
- clipPath.addRoundRect(clipRect, radius, radius, Path.Direction.CW);
- canvas.save();
- canvas.clipPath(clipPath);
- final float y = clipRect.top - dp(50) * (1f - dismissProgress);
- rect.set(clipRect.left, y, clipRect.right, y + dp(50));
- tabsView.setupTab(dismissingTab);
- dismissingTab.draw(canvas, rect, radius, dismissProgress, 1f);
- canvas.restore();
- }
- }
-
- if (dismissingMenuContainer != null) {
- getLocationOnScreen(pos2);
- dismissingMenuContainer.getLocationOnScreen(pos3);
- tabsView.getLocationOnScreen(pos);
- tabsView.getTabBounds(rect, 0);
- rect.offset(pos[0] - pos2[0], pos[1] - pos2[1]);
- float radius = dismissingMenuContainer.drawInto(canvas, rect, dismissProgress, clipRect);
-
- if (dismissingTab != null) {
- clipPath.rewind();
- clipPath.addRoundRect(clipRect, radius, radius, Path.Direction.CW);
- canvas.save();
- canvas.clipPath(clipPath);
- final float y = clipRect.top - dp(50) * (1f - dismissProgress);
- rect.set(clipRect.left, y, clipRect.right, y + dp(50));
- tabsView.setupTab(dismissingTab);
- dismissingTab.draw(canvas, rect, radius, dismissProgress, 1f);
- canvas.restore();
- }
- }
}
@Override
@@ -867,7 +759,7 @@ public class BottomSheetTabsOverlay extends FrameLayout {
final float paddingBottom = dp(68);
final int width = (int) Math.min(dp(340), thisWidth * .95f);
- final int height = (int) (AndroidUtilities.isTablet() ? Math.min(thisWidth, thisHeight) * .75f : thisHeight * .75f);
+ final int height = (int) (AndroidUtilities.isTablet() ? tabsViewBounds.height() * .5f : thisHeight * .75f);
final float cx = thisWidth / 2f;
float tabCount = 0;
for (int i = 0; i < tabs.size(); ++i) {
@@ -922,8 +814,7 @@ public class BottomSheetTabsOverlay extends FrameLayout {
boolean drawSimple = tab.tabDrawable != openingTab && (rect2.top > thisHeight || rect2.bottom < 0 || open < .1f) && position < count - 3;
if (openingSheet != null && tab.tabDrawable == openingTab) {
- BotWebViewAttachedSheet.WindowView windowView = openingSheet.getWindowView();
- rect.set(windowView.getRect());
+ rect.set(openingSheet.getWindowView().getRect());
AndroidUtilities.lerpCentered(rect2, rect, opening, rect2);
} else {
tabsView.getTabBounds(rect, Utilities.clamp(tab.tabDrawable.getPosition(), 1, 0));
@@ -979,8 +870,7 @@ public class BottomSheetTabsOverlay extends FrameLayout {
);
if (openingSheet != null && tab.tabDrawable == openingTab) {
- BotWebViewAttachedSheet.WindowView windowView = openingSheet.getWindowView();
- windowView.drawInto(canvas, rect2, 1f, rect2, opening, true);
+ openingSheet.getWindowView().drawInto(canvas, rect2, 1f, rect2, opening, true);
}
canvas.restore();
@@ -995,7 +885,7 @@ public class BottomSheetTabsOverlay extends FrameLayout {
openProgress
);
canvas.scale(s, s, rect2.centerX(), rect2.top);
- scale(tab.clickBounds, s, rect.centerX(), rect2.top);
+ scaleRect(tab.clickBounds, s, rect.centerX(), rect2.top);
tab.draw(canvas, rect2, drawSimple, lerp(tab.tabDrawable.getAlpha(), 1f, openProgress), open, 0f, lerp(clamp01(position - count + 2), 1f, clamp01((open - .1f) / .8f)));
canvas.restore();
@@ -1036,17 +926,6 @@ public class BottomSheetTabsOverlay extends FrameLayout {
canvas.restore();
}
- private void scale(RectF rect, float s, float px, float py) {
- final float wl = px - rect.left, wr = rect.right - px;
- final float ht = py - rect.top, hb = rect.bottom - py;
- rect.set(
- px - wl * s,
- py - ht * s,
- px + wr * s,
- py + hb * s
- );
- }
-
@Override
protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
@@ -1062,9 +941,7 @@ public class BottomSheetTabsOverlay extends FrameLayout {
public final View parentView;
public final BottomSheetTabs.WebTabData tabData;
public final BottomSheetTabs.TabDrawable tabDrawable;
- public final Bitmap previewBitmap;
public WebView webView;
- public final Object previewNode;
private final Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
@@ -1122,9 +999,7 @@ public class BottomSheetTabsOverlay extends FrameLayout {
this.parentView = parentView;
this.tabData = tabData;
this.tabDrawable = tabDrawable;
- this.previewBitmap = tabData.previewBitmap;
this.webView = null;// tabData.webView;
- this.previewNode = tabData.previewNode;
this.bounce = new ButtonBounce(parentView);
backgroundPaint.setColor(tabData.backgroundColor);
@@ -1155,7 +1030,7 @@ public class BottomSheetTabsOverlay extends FrameLayout {
final float s = bounce.getScale(.01f);
canvas.scale(s, s, bounds.centerX(), bounds.centerY());
- final float r = lerp(dp(10), dp(8), expandProgress);
+ final float r = lerp(dp(10), dp(6), expandProgress);
if (simple) {
shadowPaint.setColor(0);
shadowPaint.setShadowLayer(dp(30), 0, dp(10), Theme.multAlpha(0x20000000, alpha * expandProgress * (1f - openingProgress)));
@@ -1174,23 +1049,23 @@ public class BottomSheetTabsOverlay extends FrameLayout {
canvas.drawPath(clipPath, shadowPaint);
canvas.clipPath(clipPath);
- backgroundPaint.setAlpha((int) (0xFF * alpha));
+ backgroundPaint.setAlpha((int) (0xFF * alpha * expandProgress));
canvas.drawRoundRect(bounds, r, r, backgroundPaint);
canvas.save();
canvas.translate(bounds.left, bounds.top + dp(50) * tabScaleY + tabTranslateY);
canvas.scale(1f, lerp(1f, 1.25f, expandProgress * (1f - openingProgress)));
- if (previewNode != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && ((RenderNode) previewNode).hasDisplayList()) {
- RenderNode node = (RenderNode) previewNode;
+ if (tabData != null && tabData.previewNode != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && ((RenderNode) tabData.previewNode).hasDisplayList()) {
+ RenderNode node = (RenderNode) tabData.previewNode;
final float s2 = bounds.width() / node.getWidth();
canvas.scale(s2, s2);
node.setAlpha(alpha * expandProgress);
canvas.drawRenderNode(node);
- } else if (previewBitmap != null) {
- final float s2 = bounds.width() / previewBitmap.getWidth();
+ } else if (tabData != null && tabData.previewBitmap != null) {
+ final float s2 = bounds.width() / tabData.previewBitmap.getWidth();
canvas.scale(s2, s2);
bitmapPaint.setAlpha((int) (0xFF * alpha * expandProgress));
- canvas.drawBitmap(previewBitmap, 0, 0, bitmapPaint);
+ canvas.drawBitmap(tabData.previewBitmap, 0, 0, bitmapPaint);
} else if (webView != null) {
final float s2 = bounds.width() / webView.getWidth();
canvas.scale(s2, s2);
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/DrawerLayoutContainer.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/DrawerLayoutContainer.java
index bf797933c..ea367c6be 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/DrawerLayoutContainer.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/DrawerLayoutContainer.java
@@ -47,6 +47,7 @@ import org.telegram.messenger.FileLog;
import org.telegram.messenger.R;
import org.telegram.messenger.Utilities;
import org.telegram.ui.Components.PasscodeView;
+import org.telegram.ui.Stars.SuperRipple;
public class DrawerLayoutContainer extends FrameLayout {
@@ -449,7 +450,7 @@ public class DrawerLayoutContainer extends FrameLayout {
return true;
}
- if ((allowOpenDrawerBySwipe || drawerOpened) && allowOpenDrawer && parentActionBarLayout.getFragmentStack().size() == 1 && (parentActionBarLayout.getLastFragment().getLastSheet() == null || !parentActionBarLayout.getLastFragment().getLastSheet().attachedToParent())) {
+ if ((allowOpenDrawerBySwipe || drawerOpened) && allowOpenDrawer && parentActionBarLayout.getFragmentStack().size() == 1 && parentActionBarLayout.allowSwipe() && (parentActionBarLayout.getLastFragment().getLastSheet() == null || !parentActionBarLayout.getLastFragment().getLastSheet().attachedToParent())) {
if (ev != null && (ev.getAction() == MotionEvent.ACTION_DOWN || ev.getAction() == MotionEvent.ACTION_MOVE) && !startedTracking && !maybeStartTracking) {
View scrollingChild = findScrollingChild(this, ev.getX(),ev.getY());
if (scrollingChild != null) {
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/INavigationLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/INavigationLayout.java
index 234622a67..1c489e500 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/INavigationLayout.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/INavigationLayout.java
@@ -41,6 +41,7 @@ public interface INavigationLayout {
void setFragmentStackChangedListener(Runnable onFragmentStackChanged);
boolean isTransitionAnimationInProgress();
void resumeDelayedFragmentAnimation();
+ boolean allowSwipe();
boolean isInPassivePreviewMode();
void setInBubbleMode(boolean bubbleMode);
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 8f64af7e8..902bff228 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/SimpleTextView.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/SimpleTextView.java
@@ -282,7 +282,7 @@ public class SimpleTextView extends View implements Drawable.Callback {
return size;
}
- public Paint getPaint() {
+ public TextPaint getPaint() {
return textPaint;
}
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 4fa4bb5d9..3ae0f49af 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java
@@ -4160,6 +4160,11 @@ public class Theme {
public static final int key_code_comment = colorsCount++;
public static final int key_code_function = colorsCount++;
+ public static final int key_iv_background = colorsCount++;
+ public static final int key_iv_backgroundGray = colorsCount++;
+ public static final int key_iv_ab_progress = colorsCount++;
+ public static final int key_iv_navigationBackground = 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";
@@ -4248,6 +4253,10 @@ public class Theme {
static {
defaultColors = ThemeColors.createDefaultColors();
+ fallbackKeys.put(key_iv_background, key_windowBackgroundWhite);
+ fallbackKeys.put(key_iv_backgroundGray, key_windowBackgroundGray);
+ fallbackKeys.put(key_iv_navigationBackground, key_windowBackgroundGray);
+ fallbackKeys.put(key_iv_ab_progress, key_featuredStickers_addButton);
fallbackKeys.put(key_chat_inQuote, key_featuredStickers_addButtonPressed);
fallbackKeys.put(key_chat_outQuote, key_chat_outReplyLine);
fallbackKeys.put(key_chat_outReplyLine2, key_chat_outReplyLine);
@@ -5222,6 +5231,21 @@ public class Theme {
return defaultDrawable;
}
+ public static ShapeDrawable createCircleDrawable(int size, int colorTop, int colorBottom) {
+ OvalShape ovalShape = new OvalShape();
+ ovalShape.resize(size, size);
+ ShapeDrawable defaultDrawable = new ShapeDrawable(ovalShape);
+ defaultDrawable.setIntrinsicWidth(size);
+ defaultDrawable.setIntrinsicHeight(size);
+ LinearGradient gradient = new LinearGradient(
+ 0, 0, 0, size,
+ colorTop, colorBottom,
+ Shader.TileMode.CLAMP
+ );
+ defaultDrawable.getPaint().setShader(gradient);
+ return defaultDrawable;
+ }
+
public static CombinedDrawable createCircleDrawableWithIcon(int size, int iconRes) {
return createCircleDrawableWithIcon(size, iconRes, 0);
}
@@ -5314,13 +5338,13 @@ public class Theme {
}
}
- public static Drawable createRoundRectDrawable(int rad, int defaultColor) {
+ public static ShapeDrawable createRoundRectDrawable(int rad, int defaultColor) {
ShapeDrawable defaultDrawable = new ShapeDrawable(new RoundRectShape(new float[]{rad, rad, rad, rad, rad, rad, rad, rad}, null, null));
defaultDrawable.getPaint().setColor(defaultColor);
return defaultDrawable;
}
- public static Drawable createRoundRectDrawable(int topRad, int bottomRad, int defaultColor) {
+ public static ShapeDrawable createRoundRectDrawable(int topRad, int bottomRad, int defaultColor) {
ShapeDrawable defaultDrawable = new ShapeDrawable(new RoundRectShape(new float[]{topRad, topRad, topRad, topRad, bottomRad, bottomRad, bottomRad, bottomRad}, null, null));
defaultDrawable.getPaint().setColor(defaultColor);
return defaultDrawable;
@@ -10543,6 +10567,10 @@ public class Theme {
}
}
+ public interface Colorable {
+ public void updateColors();
+ }
+
public static Paint DEBUG_RED = new Paint(); static { DEBUG_RED.setColor(0xffff0000); }
public static Paint DEBUG_BLUE = new Paint(); static { DEBUG_BLUE.setColor(0xff0000ff); }
}
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 28822f696..2f15e9042 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ThemeColors.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ThemeColors.java
@@ -790,6 +790,11 @@ public class ThemeColors {
defaultColors[key_code_comment] = 0x80000000;
defaultColors[key_code_function] = 0xFFF28C39;
+ defaultColors[key_iv_background] = 0xFFFFFFFF;
+ defaultColors[key_iv_backgroundGray] = 0xfff0f0f0;
+ defaultColors[key_iv_ab_progress] = 0xff50a8eb;
+ defaultColors[key_iv_navigationBackground] = 0xfff0f0f0;
+
return defaultColors;
}
@@ -1538,6 +1543,10 @@ public class ThemeColors {
colorKeysMap.put(key_code_number, "code_number");
colorKeysMap.put(key_code_comment, "code_comment");
colorKeysMap.put(key_code_function, "code_function");
+ colorKeysMap.put(key_iv_background, "iv_background");
+ colorKeysMap.put(key_iv_backgroundGray, "iv_backgroundGray");
+ colorKeysMap.put(key_iv_navigationBackground, "iv_navigationBackground");
+ colorKeysMap.put(key_iv_ab_progress, "iv_ab_progress");
return colorKeysMap;
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/MentionsAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/MentionsAdapter.java
index 5a6909ce5..3592a51c0 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/MentionsAdapter.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/MentionsAdapter.java
@@ -46,6 +46,7 @@ import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.RequestDelegate;
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.Theme;
import org.telegram.ui.Business.QuickRepliesActivity;
@@ -103,7 +104,7 @@ public class MentionsAdapter extends RecyclerListView.SelectionAdapter implement
private TLRPC.TL_inlineBotSwitchPM searchResultBotContextSwitch;
private TLRPC.TL_inlineBotWebView searchResultBotWebViewSwitch;
private MentionsAdapterDelegate delegate;
- private LongSparseArray botInfo;
+ private LongSparseArray botInfo;
private int resultStartPosition;
private int resultLength;
private String lastText;
@@ -494,7 +495,7 @@ public class MentionsAdapter extends RecyclerListView.SelectionAdapter implement
needBotContext = value;
}
- public void setBotInfo(LongSparseArray info) {
+ public void setBotInfo(LongSparseArray info) {
botInfo = info;
}
@@ -1417,7 +1418,7 @@ public class MentionsAdapter extends RecyclerListView.SelectionAdapter implement
ArrayList newResultUsers = new ArrayList<>();
String command = result.toString().toLowerCase();
for (int b = 0; b < botInfo.size(); b++) {
- TLRPC.BotInfo info = botInfo.valueAt(b);
+ TL_bots.BotInfo info = botInfo.valueAt(b);
for (int a = 0; a < info.commands.size(); a++) {
TLRPC.TL_botCommand botCommand = info.commands.get(a);
if (botCommand != null && botCommand.command != null && botCommand.command.startsWith(command)) {
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/MessagesSearchAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/MessagesSearchAdapter.java
index 1665b5c8a..f6411fd61 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/MessagesSearchAdapter.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/MessagesSearchAdapter.java
@@ -86,8 +86,8 @@ public class MessagesSearchAdapter extends RecyclerListView.SelectionAdapter imp
};
public void searchStories(String hashtag, boolean instant) {
- if (hashtag.startsWith("$")) hashtag = "";
- if (hashtag.startsWith("#")) hashtag = hashtag.substring(1);
+// if (hashtag.startsWith("$")) hashtag = hashtag.substring(1);
+// if (hashtag.startsWith("#")) hashtag = hashtag.substring(1);
final String currentHashtag = storiesList == null ? "" : storiesList.query;
if (TextUtils.equals(currentHashtag, hashtag)) return;
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java
index 723e9de94..14e4c119e 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java
@@ -8,6 +8,9 @@
package org.telegram.ui;
+import static org.telegram.messenger.AndroidUtilities.dp;
+import static org.telegram.messenger.AndroidUtilities.lerp;
+import static org.telegram.messenger.LocaleController.formatString;
import static org.telegram.messenger.LocaleController.getString;
import static org.telegram.messenger.MessageObject.POSITION_FLAG_BOTTOM;
import static org.telegram.messenger.MessageObject.POSITION_FLAG_LEFT;
@@ -31,7 +34,9 @@ import android.database.DataSetObserver;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
+import android.graphics.ColorFilter;
import android.graphics.Paint;
+import android.graphics.Path;
import android.graphics.PixelFormat;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
@@ -40,9 +45,11 @@ import android.graphics.RectF;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
+import android.location.LocationListener;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
+import android.os.Looper;
import android.text.Editable;
import android.text.Layout;
import android.text.Spannable;
@@ -55,16 +62,14 @@ import android.text.TextWatcher;
import android.text.style.DynamicDrawableSpan;
import android.text.style.MetricAffectingSpan;
import android.text.style.URLSpan;
+import android.text.util.Linkify;
import android.util.Property;
import android.util.SparseArray;
import android.util.TypedValue;
-import android.view.ActionMode;
import android.view.DisplayCutout;
import android.view.Gravity;
import android.view.HapticFeedbackConstants;
import android.view.KeyEvent;
-import android.view.Menu;
-import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.SoundEffectConstants;
import android.view.Surface;
@@ -72,18 +77,18 @@ import android.view.SurfaceView;
import android.view.TextureView;
import android.view.VelocityTracker;
import android.view.View;
-import android.view.ViewAnimationUtils;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.WindowInsets;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.DecelerateInterpolator;
-import android.view.inputmethod.EditorInfo;
import android.webkit.CookieManager;
import android.webkit.JavascriptInterface;
import android.webkit.RenderProcessGoneDetail;
+import android.webkit.WebBackForwardList;
import android.webkit.WebChromeClient;
+import android.webkit.WebHistoryItem;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
@@ -96,8 +101,11 @@ import android.widget.Toast;
import androidx.annotation.Keep;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.collection.LongSparseArray;
import androidx.core.content.ContextCompat;
+import androidx.core.graphics.ColorUtils;
+import androidx.core.view.ViewCompat;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.GridLayoutManagerFixed;
@@ -123,11 +131,13 @@ import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.ImageReceiver;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaController;
+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.R;
+import org.telegram.messenger.SendMessagesHelper;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.Utilities;
@@ -138,31 +148,37 @@ 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.ActionBarMenuItem;
+import org.telegram.ui.ActionBar.ActionBarLayout;
+import org.telegram.ui.ActionBar.ActionBarMenuSubItem;
import org.telegram.ui.ActionBar.ActionBarPopupWindow;
import org.telegram.ui.ActionBar.AlertDialog;
-import org.telegram.ui.ActionBar.BackDrawable;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.BottomSheet;
-import org.telegram.ui.ActionBar.SimpleTextView;
+import org.telegram.ui.ActionBar.BottomSheetTabDialog;
+import org.telegram.ui.ActionBar.BottomSheetTabs;
+import org.telegram.ui.ActionBar.BottomSheetTabsOverlay;
import org.telegram.ui.ActionBar.Theme;
+import org.telegram.ui.Cells.CheckBoxCell;
import org.telegram.ui.Cells.HeaderCell;
import org.telegram.ui.Cells.TextSelectionHelper;
import org.telegram.ui.Components.AlertsCreator;
import org.telegram.ui.Components.AnchorSpan;
import org.telegram.ui.Components.AnimatedArrowDrawable;
+import org.telegram.ui.Components.AnimatedColor;
+import org.telegram.ui.Components.AnimatedFloat;
+import org.telegram.ui.Components.AnimatedTextView;
import org.telegram.ui.Components.AnimationProperties;
import org.telegram.ui.Components.AvatarDrawable;
+import org.telegram.ui.Components.BackupImageView;
import org.telegram.ui.Components.BulletinFactory;
-import org.telegram.ui.Components.CloseProgressDrawable2;
import org.telegram.ui.Components.CombinedDrawable;
import org.telegram.ui.Components.ContextProgressView;
import org.telegram.ui.Components.CubicBezierInterpolator;
-import org.telegram.ui.Components.EditTextBoldCursor;
+import org.telegram.ui.Components.ItemOptions;
import org.telegram.ui.Components.LayoutHelper;
-import org.telegram.ui.Components.LineProgressView;
import org.telegram.ui.Components.LinkPath;
import org.telegram.ui.Components.LinkSpanDrawable;
+import org.telegram.ui.Components.LoadingDrawable;
import org.telegram.ui.Components.MediaActionDrawable;
import org.telegram.ui.Components.RadialProgress2;
import org.telegram.ui.Components.RadioButton;
@@ -171,6 +187,7 @@ import org.telegram.ui.Components.SeekBar;
import org.telegram.ui.Components.SeekBarView;
import org.telegram.ui.Components.ShareAlert;
import org.telegram.ui.Components.SizeNotifierFrameLayout;
+import org.telegram.ui.Components.SmoothScroller;
import org.telegram.ui.Components.StaticLayoutEx;
import org.telegram.ui.Components.TableLayout;
import org.telegram.ui.Components.TextPaintImageReceiverSpan;
@@ -182,8 +199,22 @@ import org.telegram.ui.Components.TranslateAlert2;
import org.telegram.ui.Components.TypefaceSpan;
import org.telegram.ui.Components.VideoPlayer;
import org.telegram.ui.Components.WebPlayerView;
+import org.telegram.ui.Stories.DarkThemeResourceProvider;
+import org.telegram.ui.Stories.recorder.ButtonWithCounterView;
+import org.telegram.ui.Stories.recorder.KeyboardNotifier;
+import org.telegram.ui.web.AddressBarList;
+import org.telegram.ui.web.BookmarksFragment;
+import org.telegram.ui.web.BotWebViewContainer;
+import org.telegram.ui.bots.ChatAttachAlertBotWebViewLayout;
+import org.telegram.ui.web.BrowserHistory;
+import org.telegram.ui.web.HistoryFragment;
+import org.telegram.ui.web.RestrictedDomainsList;
+import org.telegram.ui.web.SearchEngine;
+import org.telegram.ui.web.WebActionBar;
+import org.telegram.ui.web.WebBrowserSettings;
import java.io.File;
+import java.net.IDN;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Collections;
@@ -193,12 +224,20 @@ import java.util.Locale;
public class ArticleViewer implements NotificationCenter.NotificationCenterDelegate {
+ public static final boolean BOTTOM_ACTION_BAR = false;
+
public final boolean isSheet;
public final ArticleViewer.Sheet sheet;
- public ArticleViewer(boolean sheet, Context context) {
- this.isSheet = sheet;
- this.sheet = sheet ? new ArticleViewer.Sheet(context) : null;
+ public ArticleViewer() {
+ this.isSheet = false;
+ this.sheet = null;
+ }
+
+ public ArticleViewer(BaseFragment fragment) {
+ this.isSheet = true;
+ this.sheet = new Sheet(fragment);
+ setParentActivity(fragment.getParentActivity(), fragment);
}
private Activity parentActivity;
@@ -230,20 +269,28 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
private long transitionAnimationStartTime;
private DecelerateInterpolator interpolator = new DecelerateInterpolator(1.5f);
- private ArrayList pagesStack = new ArrayList<>();
+ public final ArrayList