Skip to content

Commit

Permalink
Update to 7.9.1 (2387)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrKLO committed Jul 30, 2021
1 parent 3e5d2ba commit 24c6968
Show file tree
Hide file tree
Showing 23 changed files with 266 additions and 138 deletions.
4 changes: 2 additions & 2 deletions TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ android {
}
}

defaultConfig.versionCode = 2384
defaultConfig.versionCode = 2387

applicationVariants.all { variant ->
variant.outputs.all { output ->
Expand All @@ -318,7 +318,7 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 29
versionName "7.9.0"
versionName "7.9.1"

vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']

Expand Down
58 changes: 30 additions & 28 deletions TMessagesProj/jni/voip/org_telegram_messenger_voip_Instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,38 +394,40 @@ JNIEXPORT jlong JNICALL Java_org_telegram_messenger_voip_NativeInstance_makeGrou
});
},
.videoCapture = videoCapture,
.requestBroadcastPart = [](std::shared_ptr<PlatformContext> platformContext, int64_t timestamp, int64_t duration, std::function<void(BroadcastPart &&)> callback) -> std::shared_ptr<BroadcastPartTask> {
std::shared_ptr<BroadcastPartTask> task = std::make_shared<BroadcastPartTaskJava>(platformContext, callback, timestamp);
((AndroidContext *) platformContext.get())->streamTask = task;
tgvoip::jni::DoWithJNI([platformContext, timestamp, duration, task](JNIEnv *env) {
jobject globalRef = ((AndroidContext *) platformContext.get())->getJavaInstance();
env->CallVoidMethod(globalRef, env->GetMethodID(NativeInstanceClass, "onRequestBroadcastPart", "(JJ)V"), timestamp, duration);
});
return task;
},
.videoContentType = screencast ? VideoContentType::Screencast : VideoContentType::Generic,
.initialEnableNoiseSuppression = (bool) noiseSupression,
.requestMediaChannelDescriptions = [platformContext](std::vector<uint32_t> const &ssrcs, std::function<void(std::vector<MediaChannelDescription> &&)> callback) -> std::shared_ptr<RequestMediaChannelDescriptionTask> {
std::shared_ptr<RequestMediaChannelDescriptionTaskJava> task = std::make_shared<RequestMediaChannelDescriptionTaskJava>(platformContext, callback);
((AndroidContext *) platformContext.get())->descriptionTasks.push_back(task);
tgvoip::jni::DoWithJNI([platformContext, ssrcs, task](JNIEnv *env) {
unsigned int size = ssrcs.size();
jintArray intArray = env->NewIntArray(size);

jint intFill[size];
for (int a = 0; a < size; a++) {
intFill[a] = ssrcs[a];
}
env->SetIntArrayRegion(intArray, 0, size, intFill);

jobject globalRef = ((AndroidContext *) platformContext.get())->getJavaInstance();
env->CallVoidMethod(globalRef, env->GetMethodID(NativeInstanceClass, "onParticipantDescriptionsRequired", "(J[I)V"), (jlong) task.get(), intArray);
env->DeleteLocalRef(intArray);
});
return task;
},
.platformContext = platformContext
};
if (!screencast) {
descriptor.requestBroadcastPart = [](std::shared_ptr<PlatformContext> platformContext, int64_t timestamp, int64_t duration, std::function<void(BroadcastPart &&)> callback) -> std::shared_ptr<BroadcastPartTask> {
std::shared_ptr<BroadcastPartTask> task = std::make_shared<BroadcastPartTaskJava>(platformContext, callback, timestamp);
((AndroidContext *) platformContext.get())->streamTask = task;
tgvoip::jni::DoWithJNI([platformContext, timestamp, duration, task](JNIEnv *env) {
jobject globalRef = ((AndroidContext *) platformContext.get())->getJavaInstance();
env->CallVoidMethod(globalRef, env->GetMethodID(NativeInstanceClass, "onRequestBroadcastPart", "(JJ)V"), timestamp, duration);
});
return task;
};
descriptor.requestMediaChannelDescriptions = [platformContext](std::vector<uint32_t> const &ssrcs, std::function<void(std::vector<MediaChannelDescription> &&)> callback) -> std::shared_ptr<RequestMediaChannelDescriptionTask> {
std::shared_ptr<RequestMediaChannelDescriptionTaskJava> task = std::make_shared<RequestMediaChannelDescriptionTaskJava>(platformContext, callback);
((AndroidContext *) platformContext.get())->descriptionTasks.push_back(task);
tgvoip::jni::DoWithJNI([platformContext, ssrcs, task](JNIEnv *env) {
unsigned int size = ssrcs.size();
jintArray intArray = env->NewIntArray(size);

jint intFill[size];
for (int a = 0; a < size; a++) {
intFill[a] = ssrcs[a];
}
env->SetIntArrayRegion(intArray, 0, size, intFill);

jobject globalRef = ((AndroidContext *) platformContext.get())->getJavaInstance();
env->CallVoidMethod(globalRef, env->GetMethodID(NativeInstanceClass, "onParticipantDescriptionsRequired", "(J[I)V"), (jlong) task.get(), intArray);
env->DeleteLocalRef(intArray);
});
return task;
};
}

auto *holder = new InstanceHolder;
holder->groupNativeInstance = std::make_unique<GroupInstanceCustomImpl>(std::move(descriptor));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import android.graphics.PointF;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
import android.widget.OverScroller;

import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.BuildConfig;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.FileLog;

Expand Down Expand Up @@ -2776,7 +2775,7 @@ public View focusSearch(View focused, int direction) {
* same View may still get the focus as a result of that search.
*/
private boolean isPreferredNextFocus(View focused, View next, int direction) {
if (next == null || next == this) {
if (next == null || next == this || next == focused) {
return false;
}
// panic, result view is not a child anymore, maybe workaround b/37864393
Expand Down Expand Up @@ -2826,9 +2825,9 @@ private boolean isPreferredNextFocus(View focused, View next, int direction) {
case View.FOCUS_DOWN:
return downness > 0;
case View.FOCUS_FORWARD:
return downness > 0 || (downness == 0 && rightness * rtl >= 0);
return downness > 0 || (downness == 0 && rightness * rtl > 0);
case View.FOCUS_BACKWARD:
return downness < 0 || (downness == 0 && rightness * rtl <= 0);
return downness < 0 || (downness == 0 && rightness * rtl < 0);
}
throw new IllegalArgumentException("Invalid direction: " + direction + exceptionLabel());
}
Expand Down Expand Up @@ -5107,7 +5106,7 @@ void dispatchOnScrolled(int hresult, int vresult) {
// but some general-purpose code may choose to respond to changes this way.
final int scrollX = getScrollX();
final int scrollY = getScrollY();
onScrollChanged(scrollX, scrollY, scrollX, scrollY);
onScrollChanged(scrollX, scrollY, scrollX - hresult, scrollY - vresult);

// Pass the real deltas to onScrolled, the RecyclerView-specific method.
onScrolled(hresult, vresult);
Expand Down Expand Up @@ -5327,7 +5326,7 @@ public void run() {

postOnAnimation();
if (mGapWorker != null) {
mGapWorker.postFromTraversal(RecyclerView.this, unconsumedX, unconsumedY);
mGapWorker.postFromTraversal(RecyclerView.this, consumedX, consumedY);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,22 +390,6 @@ private static class LinkSpec {
int end;
}

private static Boolean standaloneApp;
public static boolean isStandaloneApp() {
if (standaloneApp == null) {
standaloneApp = "org.telegram.messenger.web".equals(ApplicationLoader.applicationContext.getPackageName());
}
return standaloneApp;
}

private static Boolean betaApp;
public static boolean isBetaApp() {
if (betaApp == null) {
betaApp = "org.telegram.messenger.beta".equals(ApplicationLoader.applicationContext.getPackageName());
}
return betaApp;
}

private static String makeUrl(String url, String[] prefixes, Matcher matcher) {
boolean hasPrefix = false;
for (int i = 0; i < prefixes.length; i++) {
Expand Down Expand Up @@ -1784,7 +1768,7 @@ public static boolean isValidWallChar(char ch) {

public static boolean isTablet() {
if (isTablet == null) {
isTablet = ApplicationLoader.applicationContext.getResources().getBoolean(R.bool.isTablet);
isTablet = ApplicationLoader.applicationContext != null && ApplicationLoader.applicationContext.getResources().getBoolean(R.bool.isTablet);
}
return isTablet;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public void onReceive(Context context, Intent intent) {
FileLog.d("screen state = " + isScreenOn);
}
} catch (Exception e) {
FileLog.e(e);
e.printStackTrace();
}

SharedConfig.loadConfig();
Expand Down
22 changes: 19 additions & 3 deletions TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static boolean NO_SCOPED_STORAGE = true/* || Build.VERSION.SDK_INT <= 28*/;
public static int BUILD_VERSION = 2384;
public static String BUILD_VERSION_STRING = "7.9.0";
public static int BUILD_VERSION = 2387;
public static String BUILD_VERSION_STRING = "7.9.1";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
public static String APPCENTER_HASH = "a5b5c4f5-51da-dedc-9918-d9766a22ca7c";
public static String APPCENTER_HASH_DEBUG = "f9726602-67c9-48d2-b5d0-4761f1c1a8f3";
//
public static String SMS_HASH = AndroidUtilities.isStandaloneApp() ? "w0lkcmTZkKh" : (DEBUG_VERSION ? "O2P2z+/jBpJ" : "oLeq9AcOZkT");
public static String SMS_HASH = isStandaloneApp() ? "w0lkcmTZkKh" : (DEBUG_VERSION ? "O2P2z+/jBpJ" : "oLeq9AcOZkT");
public static String PLAYSTORE_APP_URL = "https://play.google.com/store/apps/details?id=org.telegram.messenger";

static {
Expand All @@ -35,4 +35,20 @@ public class BuildVars {
LOGS_ENABLED = DEBUG_VERSION || sharedPreferences.getBoolean("logsEnabled", DEBUG_VERSION);
}
}

private static Boolean standaloneApp;
public static boolean isStandaloneApp() {
if (standaloneApp == null) {
standaloneApp = ApplicationLoader.applicationContext != null && "org.telegram.messenger.web".equals(ApplicationLoader.applicationContext.getPackageName());
}
return standaloneApp;
}

private static Boolean betaApp;
public static boolean isBetaApp() {
if (betaApp == null) {
betaApp = ApplicationLoader.applicationContext != null && "org.telegram.messenger.beta".equals(ApplicationLoader.applicationContext.getPackageName());
}
return betaApp;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ public int getOpacity() {

@Override
public void setAlpha(int alpha) {
placeholderPaint.setAlpha(alpha);
paint.setAlpha(alpha);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14187,7 +14187,7 @@ public static String getRestrictionReason(ArrayList<TLRPC.TL_restrictionReason>
}
for (int a = 0, N = reasons.size(); a < N; a++) {
TLRPC.TL_restrictionReason reason = reasons.get(a);
if ("all".equals(reason.platform) || !AndroidUtilities.isStandaloneApp() && !AndroidUtilities.isBetaApp() && "android".equals(reason.platform)) {
if ("all".equals(reason.platform) || !BuildVars.isStandaloneApp() && !BuildVars.isBetaApp() && "android".equals(reason.platform)) {
return reason.text;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ public static HashMap<String, String> getCountryLangs() {
}

public static boolean isAppUpdateAvailable() {
if (pendingAppUpdate == null || pendingAppUpdate.document == null || !AndroidUtilities.isStandaloneApp()) {
if (pendingAppUpdate == null || pendingAppUpdate.document == null || !BuildVars.isStandaloneApp()) {
return false;
}
int currentVersion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2899,10 +2899,12 @@ public void onDestroy() {
}
stopForeground(true);
stopRinging();
if (ApplicationLoader.mainInterfacePaused || !ApplicationLoader.isScreenOn) {
MessagesController.getInstance(currentAccount).ignoreSetOnline = false;
if (currentAccount >= 0) {
if (ApplicationLoader.mainInterfacePaused || !ApplicationLoader.isScreenOn) {
MessagesController.getInstance(currentAccount).ignoreSetOnline = false;
}
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.appDidLogout);
}
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.appDidLogout);
SensorManager sm = (SensorManager) getSystemService(SENSOR_SERVICE);
Sensor proximity = sm.getDefaultSensor(Sensor.TYPE_PROXIMITY);
if (proximity != null) {
Expand Down Expand Up @@ -3006,15 +3008,17 @@ public void onDestroy() {
}
}

ConnectionsManager.getInstance(currentAccount).setAppPaused(true, false);
VoIPHelper.lastCallTime = SystemClock.elapsedRealtime();

setSinks(null, null);
if (onDestroyRunnable != null) {
onDestroyRunnable.run();
}
if (ChatObject.isChannel(chat)) {
MessagesController.getInstance(currentAccount).startShortPoll(chat, classGuid, true);
if (currentAccount >= 0) {
ConnectionsManager.getInstance(currentAccount).setAppPaused(true, false);
if (ChatObject.isChannel(chat)) {
MessagesController.getInstance(currentAccount).startShortPoll(chat, classGuid, true);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ public void captureEndValues(TransitionValues transitionValues) {

@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
if (startValues.view instanceof SimpleTextView) {
if (startValues != null && startValues.view instanceof SimpleTextView) {
AnimatorSet animatorSet = new AnimatorSet();
Animator animator = super.createAnimator(sceneRoot, startValues, endValues);
float s = (float) startValues.values.get("text_size") / (float) endValues.values.get("text_size");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public boolean onTouchEvent(MotionEvent event) {
toggleSubMenu();
return true;
}
} else if (popupWindow != null && popupWindow.isShowing()) {
} else if (showSubmenuByMove && popupWindow != null && popupWindow.isShowing()) {
getLocationOnScreen(location);
float x = event.getX() + location[0];
float y = event.getY() + location[1];
Expand All @@ -245,14 +245,14 @@ public boolean onTouchEvent(MotionEvent event) {
if (!rect.contains((int) x, (int) y)) {
child.setPressed(false);
child.setSelected(false);
if (Build.VERSION.SDK_INT == 21) {
if (Build.VERSION.SDK_INT == 21 && child.getBackground() != null) {
child.getBackground().setVisible(false, false);
}
} else {
child.setPressed(true);
child.setSelected(true);
if (Build.VERSION.SDK_INT >= 21) {
if (Build.VERSION.SDK_INT == 21) {
if (Build.VERSION.SDK_INT == 21 && child.getBackground() != null) {
child.getBackground().setVisible(true, false);
}
child.drawableHotspotChanged(x, y - child.getTop());
Expand Down
18 changes: 14 additions & 4 deletions TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java
Original file line number Diff line number Diff line change
Expand Up @@ -7460,10 +7460,6 @@ public static void createCommonChatResources() {
chat_statusRecordPaint.setStrokeCap(Paint.Cap.ROUND);
chat_actionTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
chat_actionTextPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
chat_actionBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
chat_actionBackgroundSelectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
chat_actionBackgroundPaint2 = new Paint(Paint.ANTI_ALIAS_FLAG);
chat_actionBackgroundSelectedPaint2 = new Paint(Paint.ANTI_ALIAS_FLAG);
chat_actionBackgroundGradientDarkenPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
chat_actionBackgroundGradientDarkenPaint.setColor(0x2a000000);
chat_timeBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
Expand All @@ -7474,6 +7470,18 @@ public static void createCommonChatResources() {
chat_radialProgressPausedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
chat_radialProgressPausedSeekbarPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
}
if (chat_actionBackgroundPaint == null) {
chat_actionBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
}
if (chat_actionBackgroundSelectedPaint == null) {
chat_actionBackgroundSelectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
}
if (chat_actionBackgroundPaint2 == null) {
chat_actionBackgroundPaint2 = new Paint(Paint.ANTI_ALIAS_FLAG);
}
if (chat_actionBackgroundSelectedPaint2 == null) {
chat_actionBackgroundSelectedPaint2 = new Paint(Paint.ANTI_ALIAS_FLAG);
}
}

public static void createChatResources(Context context, boolean fontsOnly) {
Expand Down Expand Up @@ -8046,6 +8054,8 @@ public static void applyChatServiceMessageColor(int[] custom, Drawable wallpaper
}
if (servicePressedColor == null) {
servicePressedColor = serviceSelectedMessageColor;
}
if (servicePressedColor2 == null) {
servicePressedColor2 = serviceSelectedMessage2Color;
}

Expand Down
Loading

0 comments on commit 24c6968

Please sign in to comment.