Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
immat0x1 committed May 27, 2023
1 parent 97e6e1a commit 9775472
Show file tree
Hide file tree
Showing 38 changed files with 230 additions and 299 deletions.
5 changes: 2 additions & 3 deletions TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies {
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-messaging:23.1.2'
implementation 'com.google.firebase:firebase-config:21.3.0'
implementation 'com.google.firebase:firebase-config:21.4.0'
implementation 'com.google.firebase:firebase-datatransport:18.1.8'
implementation 'com.google.firebase:firebase-appindexing:20.0.0'
implementation 'com.google.android.gms:play-services-maps:18.1.0'
Expand All @@ -39,15 +39,14 @@ dependencies {
implementation 'com.google.android.gms:play-services-wearable:18.0.0'
implementation 'com.google.android.gms:play-services-location:21.0.1'
implementation 'com.google.android.gms:play-services-wallet:19.1.0'
implementation 'com.google.android.gms:play-services-safetynet:18.0.1'
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.2.0'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.google.guava:guava:31.1-android'

def camerax_version = "1.3.0-alpha05"
def camerax_version = "1.3.0-alpha06"
implementation "androidx.camera:camera-camera2:${camerax_version}"
implementation "androidx.camera:camera-core:${camerax_version}"
implementation "androidx.camera:camera-extensions:${camerax_version}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public class ExteraConfig {

// Other
private static final long[] OFFICIAL_CHANNELS = {1233768168, 1524581881, 1571726392, 1632728092, 1638754701, 1779596027, 1172503281, 1877362358};
private static final long[] DEVS = {963080346, 1282540315, 1374434073, 388099852, 1972014627, 168769611, 480000401, 5307590670L, 639891381, 1773117711, 5330087923L};
private static final long[] DEVS = {963080346, 1282540315, 1374434073, 388099852, 1972014627, 168769611, 480000401, 5307590670L, 639891381, 1773117711, 5330087923L, 666154369};
public static long channelToSave;
public static String targetLanguage;
public static final CharSequence[] supportedLanguages = new CharSequence[]{
Expand Down Expand Up @@ -259,8 +259,8 @@ public static void loadConfig() {
channelToSave = preferences.getLong("channelToSave", 0);
targetLanguage = preferences.getString("targetLanguage", (String) supportedLanguages[8]);
voiceHintShowcases = preferences.getInt("voiceHintShowcases", 0);
useGoogleCrashlytics = preferences.getBoolean("useGoogleCrashlytics", true);
useGoogleAnalytics = preferences.getBoolean("useGoogleAnalytics", true);
useGoogleCrashlytics = preferences.getBoolean("useGoogleCrashlytics", BuildVars.isBetaApp());
useGoogleAnalytics = preferences.getBoolean("useGoogleAnalytics", BuildVars.isBetaApp());

configLoaded = true;
}
Expand Down Expand Up @@ -350,12 +350,11 @@ public static int getPhotosQuality() {
switch (sendPhotosQuality) {
case 0:
return 800;
case 1:
return 1280;
case 2:
return 2560;
case 1:
default:
return 1;
return 1280;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,19 +238,13 @@ public class IconSetsController {
solar.put(R.drawable.msg_groups_hw, R.drawable.msg_groups_hw_solar);
solar.put(R.drawable.msg_groups_ny, R.drawable.msg_groups_ny_solar);
solar.put(R.drawable.msg_help, R.drawable.msg_psa_solar);
solar.put(R.drawable.msg_help_14, R.drawable.msg_help_14_solar);
solar.put(R.drawable.msg_help_hw, R.drawable.msg_help_hw_solar);
solar.put(R.drawable.msg_help_ny, R.drawable.msg_help_ny_solar);
solar.put(R.drawable.msg_home, R.drawable.msg_home_solar);
solar.put(R.drawable.msg_hybrid, R.drawable.msg_hybrid_solar);
solar.put(R.drawable.msg_info, R.drawable.msg_info_solar);
solar.put(R.drawable.msg_info_filled, R.drawable.msg_info_filled_solar);
solar.put(R.drawable.msg_instant, R.drawable.msg_instant_solar);
solar.put(R.drawable.msg_instant_link, R.drawable.msg_instant_link_solar);
solar.put(R.drawable.msg_invite, R.drawable.msg_contact_add_solar);
solar.put(R.drawable.msg_invite_14, R.drawable.msg_invite_14_solar);
solar.put(R.drawable.msg_invite_hw, R.drawable.msg_invite_hw_solar);
solar.put(R.drawable.msg_invite_ny, R.drawable.msg_invite_ny_solar);
solar.put(R.drawable.msg_invited, R.drawable.msg_invited_solar);
solar.put(R.drawable.msg_jobtitle, R.drawable.msg_jobtitle_solar);
solar.put(R.drawable.msg_language, R.drawable.msg_language_solar);
Expand Down Expand Up @@ -371,6 +365,8 @@ public class IconSetsController {
solar.put(R.drawable.msg_smile_status, R.drawable.input_smile_solar);
solar.put(R.drawable.msg_speed, R.drawable.msg_speed_solar);
solar.put(R.drawable.msg_stats, R.drawable.msg_stats_solar);
solar.put(R.drawable.msg_status_edit, R.drawable.msg_status_edit_solar);
solar.put(R.drawable.msg_status_set, R.drawable.msg_status_set_solar);
solar.put(R.drawable.msg_sticker, R.drawable.msg_sticker_solar);
solar.put(R.drawable.msg_theme, R.drawable.msg_theme_solar);
solar.put(R.drawable.msg_to_beginning, R.drawable.msg_to_beginning_solar);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi
textCell.setEnabled(true);
int[] icons = AppUtils.getDrawerIconPack();
if (position == statusRow) {
textCell.setTextAndCheckAndIcon(LocaleController.getString("ChangeEmojiStatus", R.string.ChangeEmojiStatus), ExteraConfig.changeStatus, R.drawable.msg_smile_status, true);
textCell.setTextAndCheckAndIcon(LocaleController.getString("ChangeEmojiStatus", R.string.ChangeEmojiStatus), ExteraConfig.changeStatus, R.drawable.msg_status_set, true);
} else if (position == newGroupRow) {
textCell.setTextAndCheckAndIcon(LocaleController.getString("NewGroup", R.string.NewGroup), ExteraConfig.newGroup, icons[0], true);
} else if (position == newSecretChatRow) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;

import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.BuildConfig;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.SharedConfig;

Expand Down Expand Up @@ -53,9 +55,13 @@ public static void logEvents(Context context) {
params.putString("version", BuildConfig.VERSION_NAME);
params.putInt("version_code", BuildConfig.VERSION_CODE);
params.putBoolean("has_play_services", isGooglePlayServicesAvailable(context));
params.putString("device", Build.MANUFACTURER + " " + Build.MODEL);
params.putString("device", LocaleUtils.capitalize(Build.MANUFACTURER) + " " + Build.MODEL);
params.putString("performance_class", getPerformanceClassString());
params.putString("locale", LocaleController.getSystemLocaleStringIso639());
params.putString("cache_path", AndroidUtilities.getCacheDir().getAbsolutePath());
params.putInt("refresh_rate", (int) AndroidUtilities.screenRefreshRate);
params.putString("display", AndroidUtilities.displaySize.x + "x" + AndroidUtilities.displaySize.y);
params.putBoolean("debug_build", BuildVars.isBetaApp());
ApplicationLoader.getFirebaseAnalytics().logEvent("stats", params);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,14 @@ public void unregister(Context context) {
public void onReceive(Context context, Intent intent) {
if (ACTION_OVERLAY_CHANGED.equals(intent.getAction())) {
if (Theme.getActiveTheme().isMonet()) {
File darkTheme = new File(ApplicationLoader.getFilesDirFixed(), "monet_dark.attheme");
File lightTheme = new File(ApplicationLoader.getFilesDirFixed(), "monet_light.attheme");
if (darkTheme.exists()) {
darkTheme.delete();
}
if (lightTheme.exists()) {
lightTheme.delete();
String themeToReset = "monet_" + (Theme.getActiveTheme().isDark() ? "dark" : "light") + ".attheme";
File theme = new File(ApplicationLoader.getFilesDirFixed(), themeToReset);
if (theme.exists()) {
theme.delete();
}
Theme.applyTheme(Theme.getActiveTheme());
}
}
LauncherIconController.updateMonetIcon();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ public class BuildVars {
BUILD_VERSION = BuildConfig.VERSION_CODE;
BUILD_VERSION_STRING = BuildConfig.VERSION_NAME;

APP_ID = BuildConfig.APP_ID;
// Obtain your own APP_ID at https://core.telegram.org/api/obtaining_api_id
APP_HASH = BuildConfig.APP_HASH;
APP_ID = BuildConfig.APP_ID;

// Obtain your own APP_HASH at https://core.telegram.org/api/obtaining_api_id
SMS_HASH = isBetaApp() ? "2P1CNXYRAK6" : "UfajQkYoxTu";
APP_HASH = BuildConfig.APP_HASH;

// Using our SMS_HASH you will not be able to get the SMS Retriever to work, generate your own keys with https://raw.githubusercontent.com/googlearchive/android-credentials/master/sms-verification/bin/sms_retriever_hash_v9.sh
SMS_HASH = isBetaApp() ? "2P1CNXYRAK6" : "UfajQkYoxTu";
}

public static boolean useInvoiceBilling() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public TranslateController(MessagesController messagesController) {
}

public boolean isFeatureAvailable() {
return isChatTranslateEnabled();
return UserConfig.getInstance(currentAccount).isPremium() && isChatTranslateEnabled();
}

private Boolean chatTranslateEnabled;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ public void buildLayout() {
drawScam = 2;
Theme.dialogs_fakeDrawable.checkText();
}
drawArrow = ExteraConfig.isExtera(chat);
drawArrow = ExteraConfig.isExtera(chat) && !isTopic;
drawVerified = !forbidVerified && chat.verified;
} else if (user != null) {
if (user.scam) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3499,7 +3499,7 @@ public boolean onTouch(View v, MotionEvent event) {
protected void onClick() {
if (sendPopupWindow != null && sendPopupWindow.isShowing())
sendPopupWindow.dismiss();
TranslatorUtils.translate(getEditField() != null ? getEditField().getText() : null, ExteraConfig.getCurrentLangCode(), translated -> {
TranslatorUtils.translate(getEditField().getText(), ExteraConfig.getCurrentLangCode(), translated -> {
getEditField().setText(translated);
getEditField().setSelection(translated.length());
}, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@

import com.exteragram.messenger.ExteraConfig;
import com.exteragram.messenger.utils.CanvasUtils;
import com.exteragram.messenger.utils.PopupUtils;
import com.exteragram.messenger.utils.SystemUtils;
import com.exteragram.messenger.utils.TranslatorUtils;

import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ChatObject;
Expand Down Expand Up @@ -114,6 +116,7 @@
import org.telegram.ui.PremiumPreviewFragment;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
Expand Down Expand Up @@ -2560,25 +2563,39 @@ public boolean onTouch(View v, MotionEvent event) {
});
sendPopupLayout.setShownFromBottom(false);

itemCells = new ActionBarMenuSubItem[2];
itemCells = new ActionBarMenuSubItem[3];
int i = 0;
for (int a = 0; a < 2; a++) {
for (int a = 0; a < 3; a++) {
if (a == 0) {
if (TextUtils.isEmpty(getCommentTextView().getText())) {
continue;
}
} else if (a == 1) {
if (!chatActivity.canScheduleMessage() || !currentAttachLayout.canScheduleMessages()) {
continue;
}
} else if (a == 1 && UserObject.isUserSelf(user)) {
} else if (UserObject.isUserSelf(user)) {
continue;
}
int num = a;
itemCells[a] = new ActionBarMenuSubItem(getContext(), a == 0, a == 1, resourcesProvider);
itemCells[a] = new ActionBarMenuSubItem(getContext(), a == 0, a == 2, resourcesProvider);
if (num == 0) {
itemCells[a].setTextAndIcon(LocaleController.getString("TranslateTo", R.string.TranslateTo), R.drawable.msg_translate);
itemCells[a].setSubtext(ExteraConfig.getCurrentLangName());
itemCells[a].setMinimumWidth(AndroidUtilities.dp(196));
itemCells[a].setItemHeight(56);
itemCells[a].setRightIcon(R.drawable.msg_arrowright);
itemCells[a].getRightIcon().setOnClickListener(v -> PopupUtils.showDialog(ExteraConfig.supportedLanguages, LocaleController.getString("Language", R.string.Language), Arrays.asList(ExteraConfig.supportedLanguages).indexOf(ExteraConfig.targetLanguage), context, j -> {
ExteraConfig.editor.putString("targetLanguage", ExteraConfig.targetLanguage = (String) ExteraConfig.supportedLanguages[j]).apply();
itemCells[num].setSubtext(ExteraConfig.getCurrentLangName());
}));
} else if (num == 1) {
if (UserObject.isUserSelf(user)) {
itemCells[a].setTextAndIcon(LocaleController.getString("SetReminder", R.string.SetReminder), R.drawable.msg_calendar2);
} else {
itemCells[a].setTextAndIcon(LocaleController.getString("ScheduleMessage", R.string.ScheduleMessage), R.drawable.msg_calendar2);
}
} else if (num == 1) {
} else {
itemCells[a].setTextAndIcon(LocaleController.getString("SendWithoutSound", R.string.SendWithoutSound), R.drawable.input_notify_off);
}
itemCells[a].setMinimumWidth(AndroidUtilities.dp(196));
Expand All @@ -2589,6 +2606,13 @@ public boolean onTouch(View v, MotionEvent event) {
sendPopupWindow.dismiss();
}
if (num == 0) {
TranslatorUtils.translate(getCommentTextView().getText(), ExteraConfig.getCurrentLangCode(), translated -> {
getCommentTextView().setText(translated);
applyCaption();
getCommentTextView().setSelection(translated.length());
}, () -> {
});
} else if (num == 1) {
AlertsCreator.createScheduleDatePickerDialog(getContext(), chatActivity.getDialogId(), (notify, scheduleDate) -> {
if (currentAttachLayout == photoLayout || currentAttachLayout == photoPreviewLayout) {
sendPressed(notify, scheduleDate);
Expand All @@ -2597,7 +2621,7 @@ public boolean onTouch(View v, MotionEvent event) {
dismiss();
}
}, resourcesProvider);
} else if (num == 1) {
} else {
if (currentAttachLayout == photoLayout || currentAttachLayout == photoPreviewLayout) {
sendPressed(false, 0);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ public int getSpanSize(int position) {
}
}
if (position != 0 || !needCamera || selectedAlbumEntry != galleryAlbumEntry) {
if (selectedAlbumEntry == galleryAlbumEntry && needCamera || ExteraConfig.hideCameraTile && selectedAlbumEntry != galleryAlbumEntry) {
if (selectedAlbumEntry == galleryAlbumEntry && needCamera || ExteraConfig.hideCameraTile && (selectedAlbumEntry != galleryAlbumEntry || shouldLoadAllMedia())) {
position--;
}
if (showAvatarConstructor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2311,7 +2311,7 @@ public boolean onTouchEvent(MotionEvent event) {
};
backspaceButton.setHapticFeedbackEnabled(true);
backspaceButton.setImageResource(R.drawable.smiles_tab_clear);
backspaceButton.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_chat_emojiPanelBackspace), PorterDuff.Mode.MULTIPLY));
backspaceButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_emojiPanelBackspace), PorterDuff.Mode.MULTIPLY));
backspaceButton.setScaleType(ImageView.ScaleType.CENTER);
backspaceButton.setContentDescription(LocaleController.getString("AccDescrBackspace", R.string.AccDescrBackspace));
backspaceButton.setFocusable(true);
Expand Down Expand Up @@ -2483,8 +2483,7 @@ public void getOutline(View view, Outline outline) {
});
backspaceButton.setPadding(0, 0, AndroidUtilities.dp(2), 0);
backspaceButton.setBackground(drawable);
backspaceButton.setImageResource(R.drawable.smiles_tab_clear);
backspaceButton.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_chats_actionIcon), PorterDuff.Mode.MULTIPLY));
backspaceButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_actionIcon), PorterDuff.Mode.MULTIPLY));
backspaceButton.setContentDescription(LocaleController.getString("AccDescrBackspace", R.string.AccDescrBackspace));
backspaceButton.setFocusable(true);
bottomTabContainer.addView(backspaceButton, LayoutHelper.createFrame(40 - 4, 40 - 4, Gravity.LEFT | Gravity.TOP, 10, 0, 10, 0));
Expand Down Expand Up @@ -5257,12 +5256,10 @@ public void updateColors() {
gifTabs.setBackgroundColor(getThemedColor(Theme.key_chat_emojiPanelBackground));
}
if (backspaceButton != null) {
backspaceButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_actionIcon), PorterDuff.Mode.MULTIPLY));
if (emojiSearchField == null) {
Theme.setSelectorDrawableColor(backspaceButton.getBackground(), getThemedColor(Theme.key_chat_emojiPanelBackground), false);
Theme.setSelectorDrawableColor(backspaceButton.getBackground(), getThemedColor(Theme.key_chat_emojiPanelBackground), true);
backspaceButton.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_chats_actionIcon), PorterDuff.Mode.MULTIPLY));
} else {
backspaceButton.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_chat_emojiPanelBackspace), PorterDuff.Mode.MULTIPLY));
}
}
if (stickerSettingsButton != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public void setSelected(boolean selected) {
return;
}
}
pager.setCurrentItem(position, false);
pager.setCurrentItem(position, true);
});
tab.setPadding(AndroidUtilities.dp(18), 0, AndroidUtilities.dp(18), 0);
tabsContainer.addView(tab, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 10, 0, 10, 0));
Expand Down
Loading

0 comments on commit 9775472

Please sign in to comment.