mirror of
https://github.com/wrwrabbit/Partisan-Telegram-Android.git
synced 2026-05-31 05:04:47 +00:00
commit
2dbeedd367
24 changed files with 110 additions and 149 deletions
2
.github/workflows/alpha.yml
vendored
2
.github/workflows/alpha.yml
vendored
|
|
@ -23,7 +23,7 @@ jobs:
|
|||
- name: Save artifact
|
||||
uses: actions/upload-artifact@master
|
||||
with:
|
||||
name: PTelegram-v3_0_1a.apk
|
||||
name: PTelegram-v3_0_4a.apk
|
||||
path: TMessagesProj/build/outputs/apk/afat/standalone/app.apk
|
||||
- name: Create cleanup request
|
||||
run: touch delete_request
|
||||
|
|
|
|||
4
.github/workflows/beta.yml
vendored
4
.github/workflows/beta.yml
vendored
|
|
@ -13,8 +13,8 @@ jobs:
|
|||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
|
||||
with:
|
||||
tag_name: 3.0.1b
|
||||
release_name: 3.0.1b
|
||||
tag_name: 3.0.4b
|
||||
release_name: 3.0.4b
|
||||
body: |
|
||||
Bug fixes.
|
||||
draft: false
|
||||
|
|
|
|||
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
|
|
@ -13,8 +13,8 @@ jobs:
|
|||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
|
||||
with:
|
||||
tag_name: 3.0.1
|
||||
release_name: 3.0.1
|
||||
tag_name: 3.0.4
|
||||
release_name: 3.0.4
|
||||
body: |
|
||||
Bug fixes.
|
||||
draft: false
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@
|
|||
</activity-alias>
|
||||
|
||||
<activity-alias
|
||||
android:enabled="true"
|
||||
android:enabled="false"
|
||||
android:name="org.telegram.messenger.market.DefaultIcon"
|
||||
android:targetActivity="org.telegram.ui.LaunchActivity"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
|
|
|
|||
|
|
@ -142,8 +142,6 @@
|
|||
<string name="ResetChangedTitlesTitle">Скінуць зменяныя назвы чатаў?</string>
|
||||
<string name="NotClear">Не ачышчаць</string>
|
||||
<string name="NotReset">Не скідваць</string>
|
||||
<string name="ShowUpdates">Паказваць абнаўленне</string>
|
||||
<string name="ShowUpdatesInfo">Паказваць апавяшчэнне, калі даступна новае абнаўленне прыкладання.</string>
|
||||
<string name="ShowCallButton">Паказваць кнопку званка</string>
|
||||
<string name="ShowCallButtonInfo">Паказваць кнопку званка ў экране чата.</string>
|
||||
<string name="IsClearAllDraftsOnScreenLock">Выдаляць чарнавікі пры блакаванні экрана</string>
|
||||
|
|
|
|||
|
|
@ -142,8 +142,6 @@
|
|||
<string name="ResetChangedTitlesTitle">بازنشانی عنوان گفتگوی تغییریافته؟</string>
|
||||
<string name="NotClear">پاکسازی نشود</string>
|
||||
<string name="NotReset">بازنشانی نشود</string>
|
||||
<string name="ShowUpdates">نمایش آپدیت ها</string>
|
||||
<string name="ShowUpdatesInfo">نمایش یک اعلان وقتی یک آپدیت در دسترس است</string>
|
||||
<string name="ShowCallButton">نمایش دکمه تماس</string>
|
||||
<string name="ShowCallButtonInfo">نمایش دکمه تماس در گفتگو</string>
|
||||
<string name="IsClearAllDraftsOnScreenLock">حذف تمامی پیشنویس ها در صفحه قفل</string>
|
||||
|
|
|
|||
|
|
@ -142,8 +142,6 @@
|
|||
<string name="ResetChangedTitlesTitle">Zresetować zmienione nazwy czatów?</string>
|
||||
<string name="NotClear">Nie czyść</string>
|
||||
<string name="NotReset">Nie resetuj</string>
|
||||
<string name="ShowUpdates">Pokaż aktualizacje</string>
|
||||
<string name="ShowUpdatesInfo">Pokaż powiadomienie, gdy dostępna jest nowa aktualizacja aplikacji.</string>
|
||||
<string name="ShowCallButton">Pokaż przycisk połączenia</string>
|
||||
<string name="ShowCallButtonInfo">Pokaż przycisk połączenia w oknie czatu.</string>
|
||||
<string name="IsClearAllDraftsOnScreenLock">Usuwanie wszystkich szkiców po zablokowaniu ekranu</string>
|
||||
|
|
|
|||
|
|
@ -142,8 +142,6 @@
|
|||
<string name="ResetChangedTitlesTitle">Сбросить изменённые названия чатов?</string>
|
||||
<string name="NotClear">Не очищать</string>
|
||||
<string name="NotReset">Не сбрасывать</string>
|
||||
<string name="ShowUpdates">Показывать обновления</string>
|
||||
<string name="ShowUpdatesInfo">Показывать уведомление, когда доступно новое обновление приложения.</string>
|
||||
<string name="ShowCallButton">Показывать кнопку звонка</string>
|
||||
<string name="ShowCallButtonInfo">Показывать кнопку звонка в окне чата.</string>
|
||||
<string name="IsClearAllDraftsOnScreenLock">Очищать черновики при блокировке экрана</string>
|
||||
|
|
|
|||
|
|
@ -142,8 +142,6 @@
|
|||
<string name="ResetChangedTitlesTitle">Очистити редаговані назви чатів?</string>
|
||||
<string name="NotClear">Не очищати</string>
|
||||
<string name="NotReset">Не скидати</string>
|
||||
<string name="ShowUpdates">Показувати оновлення</string>
|
||||
<string name="ShowUpdatesInfo">Показувати повідомлення, коли з\'явилося нове оновлення PTelegram.</string>
|
||||
<string name="ShowCallButton">Показувати кнопку дзвінка</string>
|
||||
<string name="ShowCallButtonInfo">Показувати кнопку дзвінка у діалозі.</string>
|
||||
<string name="IsClearAllDraftsOnScreenLock">Видаляти чернетки під час блокування екрану</string>
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class BuildVars {
|
|||
|
||||
public static String HUAWEI_APP_ID = "101184875";
|
||||
|
||||
public static String PARTISAN_VERSION_STRING = "3.0.1";
|
||||
public static String PARTISAN_VERSION_STRING = "3.0.4";
|
||||
|
||||
// You can use this flag to disable Google Play Billing (If you're making fork and want it to be in Google Play)
|
||||
public static boolean IS_BILLING_UNAVAILABLE = false;
|
||||
|
|
|
|||
|
|
@ -172,7 +172,6 @@ public class SharedConfig {
|
|||
|
||||
private static int devicePerformanceClass;
|
||||
|
||||
public static boolean showUpdates;
|
||||
public static boolean showCallButton;
|
||||
public static boolean marketIcons;
|
||||
|
||||
|
|
@ -648,7 +647,6 @@ public class SharedConfig {
|
|||
disableVoiceAudioEffects = preferences.getBoolean("disableVoiceAudioEffects", false);
|
||||
noiseSupression = preferences.getBoolean("noiseSupression", false);
|
||||
chatSwipeAction = preferences.getInt("ChatSwipeAction", -1);
|
||||
showUpdates = preferences.getBoolean("showUpdates", true);
|
||||
showCallButton = preferences.getBoolean("showCallButton", true);
|
||||
marketIcons = preferences.getBoolean("marketIcons", false);
|
||||
messageSeenHintCount = preferences.getInt("messageSeenCount", 3);
|
||||
|
|
@ -687,14 +685,6 @@ public class SharedConfig {
|
|||
}
|
||||
}
|
||||
|
||||
public static void toggleShowUpdates() {
|
||||
showUpdates = !showUpdates;
|
||||
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putBoolean("showUpdates", showUpdates);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public static void toggleShowCallButton() {
|
||||
showCallButton = !showCallButton;
|
||||
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
||||
|
|
@ -817,10 +807,12 @@ public class SharedConfig {
|
|||
}
|
||||
|
||||
public static boolean isAppUpdateAvailable() {
|
||||
if (pendingPtgAppUpdate == null || pendingPtgAppUpdate.document == null) {
|
||||
if (pendingPtgAppUpdate == null || pendingPtgAppUpdate.document == null || isFakePasscodeActivated()) {
|
||||
return false;
|
||||
}
|
||||
return pendingPtgAppUpdate.version.greater(AppVersion.getCurrentVersion());
|
||||
return isFakePasscodeActivated()
|
||||
? pendingPtgAppUpdate.originalVersion.greater(AppVersion.getCurrentOriginalVersion())
|
||||
: pendingPtgAppUpdate.version.greater(AppVersion.getCurrentVersion());
|
||||
}
|
||||
|
||||
public static boolean setNewAppVersionAvailable(UpdateData data) {
|
||||
|
|
|
|||
|
|
@ -327,13 +327,8 @@ public class FakePasscode {
|
|||
}
|
||||
|
||||
public boolean autoAddAccountHidings() {
|
||||
if (UserConfig.getActivatedAccountsCount(true) == 1 && getHideOrLogOutCount() == 1) {
|
||||
for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) {
|
||||
if (AccountInstance.getInstance(a).getUserConfig().isClientActivated()) {
|
||||
getAccountActions(a).toggleHideAccountAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
disableHidingForDeactivatedAccounts();
|
||||
checkSingleAccountHidden();
|
||||
|
||||
int targetCount = UserConfig.getActivatedAccountsCount(true) - UserConfig.getFakePasscodeMaxAccountCount();
|
||||
if (targetCount > getHideOrLogOutCount()) {
|
||||
|
|
@ -386,6 +381,30 @@ public class FakePasscode {
|
|||
}
|
||||
}
|
||||
|
||||
private void disableHidingForDeactivatedAccounts() {
|
||||
for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) {
|
||||
if (!AccountInstance.getInstance(a).getUserConfig().isClientActivated()) {
|
||||
AccountActions accountActions = getAccountActions(a);
|
||||
if (accountActions != null && accountActions.isHideAccount()) {
|
||||
accountActions.toggleHideAccountAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkSingleAccountHidden() {
|
||||
if (UserConfig.getActivatedAccountsCount(true) == 1 && getHideOrLogOutCount() == 1) {
|
||||
for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) {
|
||||
if (AccountInstance.getInstance(a).getUserConfig().isClientActivated()) {
|
||||
AccountActions accountActions = getAccountActions(a);
|
||||
if (accountActions != null) {
|
||||
accountActions.toggleHideAccountAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean autoAddHidingsToAllFakePasscodes() {
|
||||
boolean result = false;
|
||||
for (FakePasscode fakePasscode: SharedConfig.fakePasscodes) {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
package org.telegram.messenger.fakepasscode;
|
||||
|
||||
import android.telephony.SmsManager;
|
||||
|
||||
import org.telegram.messenger.SharedConfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@ public class AppVersion {
|
|||
return currentVersion;
|
||||
}
|
||||
|
||||
public static synchronized AppVersion getCurrentOriginalVersion() {
|
||||
return parseVersion(BuildVars.BUILD_VERSION_STRING, "(\\d+).(\\d+).(\\d+)");
|
||||
}
|
||||
|
||||
public static AppVersion parseVersion(String versionString, String regex) {
|
||||
return parseVersion(versionString, Pattern.compile(regex));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,45 +1,29 @@
|
|||
package org.telegram.messenger.partisan;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.os.Build;
|
||||
import android.text.Layout;
|
||||
import android.text.StaticLayout;
|
||||
import android.text.TextUtils;
|
||||
import android.transition.Transition;
|
||||
import android.transition.TransitionManager;
|
||||
import android.transition.TransitionValues;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import org.telegram.messenger.AccountInstance;
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.BuildVars;
|
||||
import org.telegram.messenger.Emoji;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
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.SharedConfig;
|
||||
import org.telegram.tgnet.ConnectionsManager;
|
||||
import org.telegram.tgnet.TLRPC;
|
||||
import org.telegram.ui.Components.BulletinFactory;
|
||||
import org.telegram.ui.Components.StickersAlert;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class UpdateChecker implements NotificationCenter.NotificationCenterDelegate {
|
||||
public interface UpdateCheckedDelegate {
|
||||
void onUpdateResult(boolean updateFounded, UpdateData update);
|
||||
}
|
||||
|
||||
private final long CYBER_PARTISAN_SECURITY_TG_CHANNEL_ID = BuildVars.isAlphaApp() ? -1716369838 : -1164492294; // For checking for updates
|
||||
private final String CYBER_PARTISAN_SECURITY_TG_CHANNEL_USERNAME = BuildVars.isAlphaApp() ? "ptg_update_test" : "cpartisans_security";
|
||||
private final long CYBER_PARTISAN_SECURITY_TG_CHANNEL_ID = BuildVars.isAlphaApp() ? -1716369838 : -1808776994; // For checking for updates
|
||||
private final String CYBER_PARTISAN_SECURITY_TG_CHANNEL_USERNAME = BuildVars.isAlphaApp() ? "ptg_update_test" : "ptgprod";
|
||||
|
||||
private boolean partisanTgChannelLastMessageLoaded = false;
|
||||
private boolean appUpdatesChecked = false;
|
||||
|
|
@ -85,7 +69,7 @@ public class UpdateChecker implements NotificationCenter.NotificationCenterDeleg
|
|||
@Override
|
||||
public void didReceivedNotification(int id, int account, Object... args) {
|
||||
if (id == NotificationCenter.messagesDidLoad) {
|
||||
if (SharedConfig.showUpdates && SharedConfig.fakePasscodeActivatedIndex == -1) {
|
||||
if (!SharedConfig.isFakePasscodeActivated()) {
|
||||
if ((Long)args[0] == getUpdateTgChannelId()) {
|
||||
if (!partisanTgChannelLastMessageLoaded) {
|
||||
partisanTgChannelLastMessageLoaded = true;
|
||||
|
|
@ -105,7 +89,7 @@ public class UpdateChecker implements NotificationCenter.NotificationCenterDeleg
|
|||
if (!oldReq.peers.isEmpty() && oldReq.peers.get(0) instanceof TLRPC.TL_inputDialogPeer) {
|
||||
peer = ((TLRPC.TL_inputDialogPeer)oldReq.peers.get(0)).peer;
|
||||
}
|
||||
if (!partisanTgChannelUsernameResolved && SharedConfig.showUpdates && SharedConfig.fakePasscodeActivatedIndex == -1
|
||||
if (!partisanTgChannelUsernameResolved && SharedConfig.fakePasscodeActivatedIndex == -1
|
||||
&& (int)args[0] == classGuid && peer != null
|
||||
&& (peer.channel_id == getUpdateTgChannelId() || peer.chat_id == getUpdateTgChannelId()
|
||||
|| peer.channel_id == -getUpdateTgChannelId() || peer.chat_id == -getUpdateTgChannelId())) {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ class UpdateMessageParser {
|
|||
private boolean controlLine = true;
|
||||
private int blockStart = 0;
|
||||
private String lang = "en";
|
||||
private int langInaccuracy = 0;
|
||||
|
||||
private final int currentAccount;
|
||||
private final long dialogId;
|
||||
|
|
@ -39,6 +40,8 @@ class UpdateMessageParser {
|
|||
newLine = true;
|
||||
controlLine = true;
|
||||
blockStart = 0;
|
||||
lang = "en";
|
||||
langInaccuracy = Integer.MAX_VALUE;
|
||||
for (int pos = 0; pos <= text.length(); pos++) {
|
||||
if (newLine && pos < text.length() && text.charAt(pos) == '#') {
|
||||
if (blockStart < pos - 1) {
|
||||
|
|
@ -68,18 +71,24 @@ class UpdateMessageParser {
|
|||
}
|
||||
|
||||
private void processDescription(CharSequence text, int start, int end) {
|
||||
String description = text.subSequence(start, end).toString();
|
||||
if (lang.equals("ru")) {
|
||||
String userLang = LocaleController.getInstance().getCurrentLocale().getLanguage();
|
||||
if (isRu(userLang)) {
|
||||
currentUpdate.text = description;
|
||||
addMessageEntities(start, end);
|
||||
}
|
||||
int inaccuracy = getLangInaccuracy(lang);
|
||||
if (inaccuracy < langInaccuracy) {
|
||||
currentUpdate.text = text.subSequence(start, end).toString();
|
||||
addMessageEntities(start, end);
|
||||
langInaccuracy = inaccuracy;
|
||||
}
|
||||
}
|
||||
|
||||
private int getLangInaccuracy(String lang) {
|
||||
String userLang = LocaleController.getInstance().getCurrentLocale().getLanguage();
|
||||
if (lang.equals(userLang)) {
|
||||
return 0;
|
||||
} else if (lang.equals("ru") && isRu(userLang)) {
|
||||
return 1;
|
||||
} else if (lang.equals("en")) {
|
||||
return 2;
|
||||
} else {
|
||||
if (currentUpdate.text == null) {
|
||||
currentUpdate.text = description;
|
||||
addMessageEntities(start, end);
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -113,8 +122,8 @@ class UpdateMessageParser {
|
|||
}
|
||||
|
||||
private static boolean isRu(String lang) {
|
||||
List ruLangList = Arrays.asList("ru", "be", "uk", "kk", "ky", "mo", "hy", "ka", "az", "uz");
|
||||
return new HashSet<String>(ruLangList).contains(lang);
|
||||
List<String> ruLangList = Arrays.asList("ru", "be", "uk", "kk", "ky", "mo", "hy", "ka", "az", "uz");
|
||||
return new HashSet<>(ruLangList).contains(lang);
|
||||
}
|
||||
|
||||
private void processControlLine(String command) {
|
||||
|
|
@ -129,6 +138,8 @@ class UpdateMessageParser {
|
|||
currentUpdate.canNotSkip = value == null || value.equals("true");
|
||||
} else if (name.equals("lang")) {
|
||||
lang = value;
|
||||
} else if (name.equals("url")) {
|
||||
currentUpdate.url = value;
|
||||
} else if (name.equals("document")) {
|
||||
String[] urlParts = value.split("/");
|
||||
if (urlParts.length == 5) {
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ public class DrawerLayoutAdapter extends RecyclerListView.SelectionAdapter {
|
|||
correct = false;
|
||||
break;
|
||||
}
|
||||
if (accountCount < getMaxAccountCount()) {
|
||||
if (accountCount < getMaxAccountCount(true)) {
|
||||
accountCount++;
|
||||
accountNumbers.add(a);
|
||||
}
|
||||
|
|
@ -257,7 +257,7 @@ public class DrawerLayoutAdapter extends RecyclerListView.SelectionAdapter {
|
|||
accountNumbers.clear();
|
||||
for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) {
|
||||
if (UserConfig.getInstance(a).isClientActivated() && !FakePasscode.isHideAccount(a)
|
||||
&& accountNumbers.size() < getMaxAccountCount()) {
|
||||
&& accountNumbers.size() < getMaxAccountCount(true)) {
|
||||
accountNumbers.add(a);
|
||||
}
|
||||
}
|
||||
|
|
@ -386,9 +386,16 @@ public class DrawerLayoutAdapter extends RecyclerListView.SelectionAdapter {
|
|||
}
|
||||
|
||||
private int getMaxAccountCount() {
|
||||
return (SharedConfig.fakePasscodeActivatedIndex == -1)
|
||||
? UserConfig.MAX_ACCOUNT_COUNT
|
||||
: UserConfig.getFakePasscodeMaxAccountCount();
|
||||
return getMaxAccountCount(false);
|
||||
}
|
||||
|
||||
private int getMaxAccountCount(boolean checkPremium) {
|
||||
if (!SharedConfig.isFakePasscodeActivated()) {
|
||||
return UserConfig.MAX_ACCOUNT_COUNT;
|
||||
}
|
||||
return checkPremium
|
||||
? UserConfig.getMaxAccountCount()
|
||||
: UserConfig.FAKE_PASSCODE_MAX_PREMIUM_ACCOUNT_COUNT;
|
||||
}
|
||||
|
||||
private static class Item {
|
||||
|
|
|
|||
|
|
@ -117,10 +117,6 @@ public class BasePermissionsActivity extends Activity {
|
|||
}
|
||||
} else if (requestCode == REQUEST_CODE_GEOLOCATION) {
|
||||
NotificationCenter.getGlobalInstance().postNotificationName(granted ? NotificationCenter.locationPermissionGranted : NotificationCenter.locationPermissionDenied);
|
||||
} else if (requestCode == 1000) {
|
||||
if (!granted) {
|
||||
showPermissionErrorAlert(R.raw.permission_request_folder, LocaleController.getString("PermissionNoSmsSend", R.string.PermissionNoSmsSend));
|
||||
}
|
||||
} else if (requestCode == 1001) {
|
||||
if (granted) {
|
||||
receiveZip();
|
||||
|
|
|
|||
|
|
@ -22,13 +22,15 @@ public class DialogButtonWithTimer {
|
|||
info.text = text;
|
||||
info.timeout = timeout;
|
||||
|
||||
dialog.setButton(buttonType,text + "(" + timeout + ")", (dlg, which) -> {
|
||||
dialog.setButton(buttonType, text, (dlg, which) -> {
|
||||
if (info.timeout == 0) {
|
||||
listener.onClick(dlg, which);
|
||||
}
|
||||
});
|
||||
dialog.setOnShowListener(dlg -> {
|
||||
TextView button = (TextView)dialog.getButton(buttonType);
|
||||
info.text = button.getText().toString();
|
||||
button.setText(info.text + " (" + timeout + ")");
|
||||
button.setTextColor(Theme.getColor(Theme.key_dialogTextGray3));
|
||||
button.setEnabled(false);
|
||||
TimeoutRunnable timeoutRunnable = new TimeoutRunnable(button, info);
|
||||
|
|
@ -51,10 +53,10 @@ public class DialogButtonWithTimer {
|
|||
info.timeout--;
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
if (info.timeout > 0) {
|
||||
cancelButton.setText((info.text + " (" + info.timeout + ")").toUpperCase(Locale.ROOT));
|
||||
cancelButton.setText(info.text + " (" + info.timeout + ")");
|
||||
} else {
|
||||
cancelButton.setText(info.text.toUpperCase(Locale.ROOT));
|
||||
cancelButton.setTextColor(Theme.getColor(Theme.key_dialogTextGray));
|
||||
cancelButton.setText(info.text);
|
||||
cancelButton.setTextColor(Theme.getColor(Theme.key_dialogButton));
|
||||
cancelButton.setEnabled(true);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4853,7 +4853,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
boolean hasNotStoragePermission = (Build.VERSION.SDK_INT <= 28 || BuildVars.NO_SCOPED_STORAGE) && activity.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED;
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
afterSignup = false;
|
||||
if (hasNotContactsPermission || hasNotStoragePermission) {
|
||||
if ((hasNotContactsPermission || hasNotStoragePermission) && !(SharedConfig.filesCopiedFromOldTelegram && !SharedConfig.oldTelegramRemoved)) {
|
||||
askingForPermissions = true;
|
||||
if (hasNotContactsPermission && askAboutContacts && getUserConfig().syncContacts && activity.shouldShowRequestPermissionRationale(Manifest.permission.READ_CONTACTS)) {
|
||||
AlertDialog.Builder builder = AlertsCreator.createContactsPermissionDialog(activity, param -> {
|
||||
|
|
@ -4873,7 +4873,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
|||
}
|
||||
}, afterSignup && hasNotContactsPermission ? 4000 : 0);
|
||||
}
|
||||
} else if (!onlySelect && XiaomiUtilities.isMIUI() && Build.VERSION.SDK_INT >= 19 && !XiaomiUtilities.isCustomPermissionGranted(XiaomiUtilities.OP_SHOW_WHEN_LOCKED)) {
|
||||
} else if (!onlySelect && XiaomiUtilities.isMIUI() && Build.VERSION.SDK_INT >= 19 && !XiaomiUtilities.isCustomPermissionGranted(XiaomiUtilities.OP_SHOW_WHEN_LOCKED) && !(SharedConfig.filesCopiedFromOldTelegram && !SharedConfig.oldTelegramRemoved)) {
|
||||
if (getParentActivity() == null) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4742,21 +4742,25 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
|
|||
SharedConfig.saveConfig();
|
||||
if (updateFounded) {
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
if (SharedConfig.pendingPtgAppUpdate != null && SharedConfig.pendingPtgAppUpdate.version.equals(data.version)) {
|
||||
if (SharedConfig.pendingPtgAppUpdate != null &&
|
||||
(SharedConfig.isFakePasscodeActivated() && SharedConfig.pendingPtgAppUpdate.originalVersion.equals(data.originalVersion)
|
||||
|| SharedConfig.pendingPtgAppUpdate.version.equals(data.version))) {
|
||||
return;
|
||||
}
|
||||
if (SharedConfig.setNewAppVersionAvailable(data)) {
|
||||
if (data.canNotSkip) {
|
||||
showUpdateActivity(accountNum, data, false);
|
||||
} else {
|
||||
drawerLayoutAdapter.notifyDataSetChanged();
|
||||
try {
|
||||
(new UpdateAppAlertDialog(LaunchActivity.this, data, accountNum)).show();
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
if (SharedConfig.isAppUpdateAvailable()) {
|
||||
if (data.canNotSkip) {
|
||||
showUpdateActivity(accountNum, data, false);
|
||||
} else {
|
||||
drawerLayoutAdapter.notifyDataSetChanged();
|
||||
try {
|
||||
(new UpdateAppAlertDialog(LaunchActivity.this, data, accountNum)).show();
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
}
|
||||
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.appUpdateAvailable);
|
||||
}
|
||||
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.appUpdateAvailable);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -6017,7 +6021,8 @@ public class LaunchActivity extends BasePermissionsActivity implements INavigati
|
|||
}
|
||||
} else if (id == NotificationCenter.fakePasscodeActivated) {
|
||||
switchToAvailableAccountIfCurrentAccountIsHidden();
|
||||
if (SharedConfig.getActivatedFakePasscode() != null) {
|
||||
updateAppUpdateViews(false);
|
||||
if (SharedConfig.isFakePasscodeActivated()) {
|
||||
Utilities.globalQueue.postRunnable(() -> {
|
||||
List<BaseFragment> fragmentsStack = actionBarLayout.getFragmentStack();
|
||||
if (fragmentsStack.stream().noneMatch(f -> f instanceof DialogsActivity)) {
|
||||
|
|
|
|||
|
|
@ -423,33 +423,4 @@ public class OldTelegramWarningActivity extends BaseFragment implements Notifica
|
|||
public boolean isDismissed = false;
|
||||
public int timeout = 5;
|
||||
}
|
||||
|
||||
private static class TimeoutRunnable implements Runnable {
|
||||
TextView cancelButton;
|
||||
public DialogDismissedInfo dialogInfo;
|
||||
|
||||
public TimeoutRunnable(TextView cancelButton, DialogDismissedInfo dialogInfo) {
|
||||
this.cancelButton = cancelButton;
|
||||
this.dialogInfo = dialogInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (!dialogInfo.isDismissed) {
|
||||
dialogInfo.timeout--;
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
if (dialogInfo.timeout > 0) {
|
||||
cancelButton.setText((getString("Continue") + " (" + dialogInfo.timeout + ")").toUpperCase(Locale.ROOT));
|
||||
} else {
|
||||
cancelButton.setText(getString("Continue").toUpperCase(Locale.ROOT));
|
||||
cancelButton.setTextColor(Theme.getColor(Theme.key_dialogTextGray));
|
||||
cancelButton.setEnabled(true);
|
||||
}
|
||||
});
|
||||
if (dialogInfo.timeout > 0) {
|
||||
Utilities.globalQueue.postRunnable(this, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,8 +77,6 @@ public class PartisanSettingsActivity extends BaseFragment {
|
|||
private int onScreenLockActionDetailRow;
|
||||
private int isClearAllDraftsOnScreenLockRow;
|
||||
private int isClearAllDraftsOnScreenLockDetailRow;
|
||||
private int showUpdatesRow;
|
||||
private int showUpdatesDetailRow;
|
||||
private int showCallButtonRow;
|
||||
private int showCallButtonDetailRow;
|
||||
private int isDeleteMessagesForAllByDefaultRow;
|
||||
|
|
@ -267,9 +265,6 @@ public class PartisanSettingsActivity extends BaseFragment {
|
|||
} else if (position == isClearAllDraftsOnScreenLockRow) {
|
||||
SharedConfig.toggleClearAllDraftsOnScreenLock();
|
||||
((TextCheckCell) view).setChecked(SharedConfig.clearAllDraftsOnScreenLock);
|
||||
} else if (position == showUpdatesRow) {
|
||||
SharedConfig.toggleShowUpdates();
|
||||
((TextCheckCell) view).setChecked(SharedConfig.showUpdates);
|
||||
} else if (position == showCallButtonRow) {
|
||||
SharedConfig.toggleShowCallButton();
|
||||
((TextCheckCell) view).setChecked(SharedConfig.showCallButton);
|
||||
|
|
@ -327,8 +322,6 @@ public class PartisanSettingsActivity extends BaseFragment {
|
|||
onScreenLockActionDetailRow = rowCount++;
|
||||
isClearAllDraftsOnScreenLockRow = rowCount++;
|
||||
isClearAllDraftsOnScreenLockDetailRow = rowCount++;
|
||||
showUpdatesRow = rowCount++;
|
||||
showUpdatesDetailRow = rowCount++;
|
||||
showCallButtonRow = rowCount++;
|
||||
showCallButtonDetailRow = rowCount++;
|
||||
isDeleteMessagesForAllByDefaultRow = rowCount++;
|
||||
|
|
@ -367,8 +360,8 @@ public class PartisanSettingsActivity extends BaseFragment {
|
|||
&& position != renameChatDetailRow && position != deleteMyMessagesDetailRow && position != deleteAfterReadDetailRow
|
||||
&& position != savedChannelsDetailRow && position != reactionsDetailRow && position != foreignAgentsDetailRow
|
||||
&& position != onScreenLockActionDetailRow && position != isClearAllDraftsOnScreenLockDetailRow
|
||||
&& position != showUpdatesDetailRow && position != showCallButtonDetailRow
|
||||
&& position != isDeleteMessagesForAllByDefaultDetailRow && position != marketIconsDetailRow;
|
||||
&& position != showCallButtonDetailRow && position != isDeleteMessagesForAllByDefaultDetailRow
|
||||
&& position != marketIconsDetailRow;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -432,9 +425,6 @@ public class PartisanSettingsActivity extends BaseFragment {
|
|||
} else if (position == isClearAllDraftsOnScreenLockRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("IsClearAllDraftsOnScreenLock", R.string.IsClearAllDraftsOnScreenLock),
|
||||
SharedConfig.clearAllDraftsOnScreenLock, false);
|
||||
} else if (position == showUpdatesRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("ShowUpdates", R.string.ShowUpdates),
|
||||
SharedConfig.showUpdates, false);
|
||||
} else if (position == showCallButtonRow) {
|
||||
textCell.setTextAndCheck(LocaleController.getString("ShowCallButton", R.string.ShowCallButton),
|
||||
SharedConfig.showCallButton, false);
|
||||
|
|
@ -482,9 +472,6 @@ public class PartisanSettingsActivity extends BaseFragment {
|
|||
} else if (position == isClearAllDraftsOnScreenLockDetailRow) {
|
||||
cell.setText(LocaleController.getString("IsClearAllDraftsOnScreenLockInfo", R.string.IsClearAllDraftsOnScreenLockInfo));
|
||||
cell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
|
||||
} else if (position == showUpdatesDetailRow) {
|
||||
cell.setText(LocaleController.getString("ShowUpdatesInfo", R.string.ShowUpdatesInfo));
|
||||
cell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
|
||||
} else if (position == showCallButtonDetailRow) {
|
||||
cell.setText(LocaleController.getString("ShowCallButtonInfo", R.string.ShowCallButtonInfo));
|
||||
cell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
|
||||
|
|
@ -523,15 +510,14 @@ public class PartisanSettingsActivity extends BaseFragment {
|
|||
if (position == versionRow || position == idRow || position == disableAvatarRow
|
||||
|| position == renameChatRow || position == deleteMyMessagesRow || position == deleteAfterReadRow
|
||||
|| position == savedChannelsRow || position == reactionsRow || position == foreignAgentsRow
|
||||
|| position == isClearAllDraftsOnScreenLockRow || position == showUpdatesRow
|
||||
|| position == showCallButtonRow || position == isDeleteMessagesForAllByDefaultRow
|
||||
|| position == marketIconsRow) {
|
||||
|| position == isClearAllDraftsOnScreenLockRow || position == showCallButtonRow
|
||||
|| position == isDeleteMessagesForAllByDefaultRow || position == marketIconsRow) {
|
||||
return 0;
|
||||
} else if (position == versionDetailRow || position == idDetailRow || position == disableAvatarDetailRow
|
||||
|| position == renameChatDetailRow || position == deleteMyMessagesDetailRow || position == deleteAfterReadDetailRow
|
||||
|| position == savedChannelsDetailRow || position == reactionsDetailRow || position == foreignAgentsDetailRow
|
||||
|| position == onScreenLockActionDetailRow || position == isClearAllDraftsOnScreenLockDetailRow
|
||||
|| position == showUpdatesDetailRow || position == showCallButtonDetailRow || position == isDeleteMessagesForAllByDefaultDetailRow
|
||||
|| position == showCallButtonDetailRow || position == isDeleteMessagesForAllByDefaultDetailRow
|
||||
|| position == marketIconsDetailRow) {
|
||||
return 1;
|
||||
} else if (position == onScreenLockActionRow) {
|
||||
|
|
|
|||
|
|
@ -5919,8 +5919,6 @@
|
|||
<string name="ResetChangedTitlesTitle">Reset Changed Chat Titles?</string>
|
||||
<string name="NotClear">Not Clear</string>
|
||||
<string name="NotReset">Not Reset</string>
|
||||
<string name="ShowUpdates">Show Updates</string>
|
||||
<string name="ShowUpdatesInfo">Show a notification when a new app update is available</string>
|
||||
<string name="ShowCallButton">Show Call Button</string>
|
||||
<string name="ShowCallButtonInfo">Show call button in chat</string>
|
||||
<string name="IsClearAllDraftsOnScreenLock">Delete all drafts on screen lock</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue