Minor fixes

This commit is contained in:
世界 2020-10-04 10:14:58 +00:00
parent 244a082e96
commit 3251959c47
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
21 changed files with 138 additions and 3534 deletions

View File

@ -5,8 +5,8 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-android-extensions'
def verName = "7.0.1.3" def verName = "7.1.2-rc01"
def verCode = 70 def verCode = 73
def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json") def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json")
@ -31,9 +31,7 @@ void setupPlay(boolean beta) {
play { play {
track = beta ? "beta" : "production" track = beta ? "beta" : "production"
defaultToAppBundles = true defaultToAppBundles = true
userFraction = 1 userFraction = 1
} }
@ -59,7 +57,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'cn.hutool:hutool-all:5.4.0' classpath 'cn.hutool:hutool-all:5.4.3'
} }
} }
@ -86,14 +84,13 @@ dependencies {
// TODO: fix problem with android L // TODO: fix problem with android L
implementation 'com.google.zxing:core:3.4.1' implementation 'com.google.zxing:core:3.4.1'
compileOnly 'org.checkerframework:checker-qual:3.6.1' compileOnly 'org.checkerframework:checker-qual:3.7.0'
compileOnly 'org.checkerframework:checker-compat-qual:2.5.5' compileOnly 'org.checkerframework:checker-compat-qual:2.5.5'
// don't change this :) // don't change this :)
//noinspection GradleDependency //noinspection GradleDependency
implementation 'com.googlecode.mp4parser:isoparser:1.0.6' implementation 'com.googlecode.mp4parser:isoparser:1.0.6'
implementation 'com.stripe:stripe-android:2.0.2'
implementation 'com.google.code.gson:gson:2.8.6' implementation 'com.google.code.gson:gson:2.8.6'
implementation 'org.osmdroid:osmdroid-android:6.1.8' implementation 'org.osmdroid:osmdroid-android:6.1.8'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10' implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10'
@ -301,7 +298,7 @@ android {
sourceSets { sourceSets {
main { main {
jni.srcDirs = ['./jni/'] jni.srcDirs = []
} }
debug { debug {
@ -359,13 +356,6 @@ android {
} }
sourceSets.all { set -> sourceSets.all { set ->
if (set.name.startsWith("full")) {
set.dependencies {
implementation files('libs/libv2ray.aar')
implementation files('libs/ss-rust-release.aar')
implementation files('libs/ssr-libev-release.aar')
}
}
if (set.name.matches("(mini|full).*")) { if (set.name.matches("(mini|full).*")) {
if (set.name.contains("Apple")) { if (set.name.contains("Apple")) {
set.assets.srcDirs = ["src/main/assets", "src/emojis/apple"] set.assets.srcDirs = ["src/main/assets", "src/emojis/apple"]
@ -394,6 +384,12 @@ android {
} }
dependencies {
fullImplementation files('libs/libv2ray.aar','libs/ss-rust-release.aar','libs/ssr-libev-release.aar')
}
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics' apply plugin: 'com.google.firebase.crashlytics'

View File

@ -372,27 +372,6 @@
<service <service
android:name=".NotificationRepeat" android:name=".NotificationRepeat"
android:exported="false" /> android:exported="false" />
<service
android:name=".VideoEncodingService"
android:enabled="true" />
<service
android:name=".LocationSharingService"
android:enabled="true"
android:foregroundServiceType="location" />
<service
android:name=".voip.VoIPService"
android:enabled="true" />
<service
android:name=".MusicPlayerService"
android:enabled="true"
android:exported="true" />
<service
android:name=".MusicBrowserService"
android:exported="true">
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
</service>
<service <service
android:name="tw.nekomimi.nekogram.NekoXPushService" android:name="tw.nekomimi.nekogram.NekoXPushService"
android:enabled="true" android:enabled="true"

View File

@ -3675,21 +3675,21 @@ public class MessagesController extends BaseController implements NotificationCe
if (totalBlockedCount == 0) return; if (totalBlockedCount == 0) return;
if (blockedUsers.size() == 0) getBlockedUsers(true); if (blockePeers.size() == 0) getBlockedPeers(true);
SparseIntArray blockedCopy = blockedUsers.clone(); SparseIntArray blockedCopy = blockePeers.clone();
if (blockedCopy.size() == 0) return; if (blockedCopy.size() == 0) return;
for (int index = 0; index < blockedCopy.size(); index++) { for (int index = 0; index < blockedCopy.size(); index++) {
TLRPC.TL_contacts_unblock req = new TLRPC.TL_contacts_unblock(); TLRPC.TL_contacts_unblock req = new TLRPC.TL_contacts_unblock();
int user_id = blockedCopy.keyAt(index); int peer_id = blockedCopy.keyAt(index);
req.id = getInputUser(user_id); req.id = getInputPeer(peer_id);
getConnectionsManager().sendRequest(req, (response, error) -> { getConnectionsManager().sendRequest(req, (response, error) -> {
totalBlockedCount--; totalBlockedCount--;
blockedUsers.delete(user_id); blockePeers.delete(peer_id);
UIUtil.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.blockedUsersDidLoad)); UIUtil.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.blockedUsersDidLoad));

View File

@ -1902,7 +1902,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
if (!messageObject.isGif() && (videoEditedInfo == null || !videoEditedInfo.muted)) { if (!messageObject.isGif() && (videoEditedInfo == null || !videoEditedInfo.muted)) {
uploadedDocument.nosound_video = true; uploadedDocument.nosound_video = true;
if (BuildVars.DEBUG_VERSION) { if (BuildVars.DEBUG_VERSION) {
FileLog.e("nosound_video = true"); FileLog.d("nosound_video = true");
} }
} }
if (document.access_hash == 0) { if (document.access_hash == 0) {
@ -5554,7 +5554,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
sendingMedia.geo = new TLRPC.TL_geoPoint(); sendingMedia.geo = new TLRPC.TL_geoPoint();
sendingMedia.geo.lat = location.getLatitude(); sendingMedia.geo.lat = location.getLatitude();
sendingMedia.geo._long = location.getLongitude(); sendingMedia.geo._long = location.getLongitude();
accountInstance.getSendMessagesHelper().sendMessage(sendingMedia, dialog_id, null, null, null, true, 0); accountInstance.getSendMessagesHelper().sendMessage(sendingMedia, dialog_id, null, null, null, null, true, 0);
}))); })));
} }

View File

@ -1935,7 +1935,11 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
return getText(page, parentView, parentRichText, richText, parentBlock, maxWidth, false); return getText(page, parentView, parentRichText, richText, parentBlock, maxWidth, false);
} }
private CharSequence getText(TLRPC.WebPage page, View parentView, TLRPC.RichText parentRichText, TLRPC.RichText richText, TLRPC.PageBlock parentBlock, int maxWidth, boolean noTranslate) { public CharSequence getText(WebpageAdapter adapter, View parentView, TLRPC.RichText parentRichText, TLRPC.RichText richText, TLRPC.PageBlock parentBlock, int maxWidth, boolean noTranslate) {
return getText(adapter.currentPage, parentView, parentRichText, richText, parentBlock, maxWidth, noTranslate);
}
public CharSequence getText(TLRPC.WebPage page, View parentView, TLRPC.RichText parentRichText, TLRPC.RichText richText, TLRPC.PageBlock parentBlock, int maxWidth, boolean noTranslate) {
if (richText == null) { if (richText == null) {
return null; return null;
} }
@ -1973,7 +1977,7 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
return spannableStringBuilder; return spannableStringBuilder;
} else if (richText instanceof TLRPC.TL_textPlain) { } else if (richText instanceof TLRPC.TL_textPlain) {
String plainText = ((TLRPC.TL_textPlain) richText).text; String plainText = ((TLRPC.TL_textPlain) richText).text;
if (!noTranslate && StrUtil.isNotBlank(plainText) && adapter.trans && TranslateDb.currentTarget().contains(plainText)) { if (!noTranslate && StrUtil.isNotBlank(plainText) && adapter[0].trans && TranslateDb.currentTarget().contains(plainText)) {
plainText = TranslateDb.currentTarget().query(plainText); plainText = TranslateDb.currentTarget().query(plainText);
} }
return plainText; return plainText;
@ -4823,7 +4827,7 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
} }
} }
private class WebpageAdapter extends RecyclerListView.SelectionAdapter { public class WebpageAdapter extends RecyclerListView.SelectionAdapter {
private Context context; private Context context;
private ArrayList<TLRPC.PageBlock> localBlocks = new ArrayList<>(); private ArrayList<TLRPC.PageBlock> localBlocks = new ArrayList<>();

View File

@ -758,8 +758,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
private int currentFocusedVirtualView = -1; private int currentFocusedVirtualView = -1;
private boolean isBlockedUserMessage() { private boolean isBlockedUserMessage() {
return MessagesController.getInstance(currentAccount).blockedUsers.indexOfKey( return MessagesController.getInstance(currentAccount).blockePeers.indexOfKey(
currentMessageObject.getFromId()) >= 0 && NekoConfig.ignoreBlocked; currentMessageObject.getFromChatId()) >= 0 && NekoConfig.ignoreBlocked;
} }
public ChatMessageCell(Context context) { public ChatMessageCell(Context context) {

View File

@ -22,6 +22,7 @@ import android.app.PendingIntent;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.IntentSender; import android.content.IntentSender;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -78,6 +79,7 @@ import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.DecelerateInterpolator; import android.view.animation.DecelerateInterpolator;
import android.widget.DatePicker;
import android.widget.EditText; import android.widget.EditText;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
@ -762,7 +764,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (textLayout != null) { if (textLayout != null) {
int lineWidth = (int) Math.ceil(textLayout.getLineWidth(0)); int lineWidth = (int) Math.ceil(textLayout.getLineWidth(0));
int contentWidth; int contentWidth;
if (getMeasuredWidth() == ((View)getParent()).getMeasuredWidth()) { if (getMeasuredWidth() == ((View) getParent()).getMeasuredWidth()) {
contentWidth = getMeasuredWidth() - AndroidUtilities.dp(96); contentWidth = getMeasuredWidth() - AndroidUtilities.dp(96);
} else { } else {
if (botInfo != null) { if (botInfo != null) {
@ -2216,7 +2218,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
actionMode.getItem(edit).setVisibility(canEditMessagesCount == 1 && selectedMessagesIds[0].size() + selectedMessagesIds[1].size() == 1 ? View.VISIBLE : View.GONE); actionMode.getItem(edit).setVisibility(canEditMessagesCount == 1 && selectedMessagesIds[0].size() + selectedMessagesIds[1].size() == 1 ? View.VISIBLE : View.GONE);
actionMode.getItem(copy).setVisibility(selectedMessagesCanCopyIds[0].size() + selectedMessagesCanCopyIds[1].size() != 0 ? View.VISIBLE : View.GONE); actionMode.getItem(copy).setVisibility(selectedMessagesCanCopyIds[0].size() + selectedMessagesCanCopyIds[1].size() != 0 ? View.VISIBLE : View.GONE);
actionMode.getItem(star).setVisibility(View.GONE); actionMode.getItem(star).setVisibility(View.GONE);
actionMode.getItem(delete).setVisibility(cantDeleteMessagesCount == 0 ? View.VISIBLE : View.GONE); actionMode.getItem(delete).setVisibility(cantDeleteMessagesCount > 0 && selectedMessagesIds[0].size() + selectedMessagesIds[1].size() > 1 ? View.VISIBLE : View.GONE);
checkActionBarMenu(); checkActionBarMenu();
scrimPaint = new Paint() { scrimPaint = new Paint() {
@ -2646,7 +2649,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
heightSize -= actionBarHeight; heightSize -= actionBarHeight;
} }
if (lastHeight != allHeight ) { if (lastHeight != allHeight) {
measureKeyboardHeight(); measureKeyboardHeight();
} }
int keyboardSize = getKeyboardHeight(); int keyboardSize = getKeyboardHeight();
@ -7510,7 +7513,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
String str = StrUtil.utf8Str(os.toByteArray()); String str = StrUtil.utf8Str(os.toByteArray());
if (StrUtil.isBlank(str)) return; if (StrUtil.isBlank(str)) return;
getSendMessagesHelper().sendMessage(str, dialog_id, null, null, false, null, null, null, true, 0); getSendMessagesHelper().sendMessage(str, dialog_id, null, null, null,
false, null, null, null, true, 0);
if (!inScheduleMode) { if (!inScheduleMode) {
moveScrollToLastMessage(); moveScrollToLastMessage();
} }
@ -14876,12 +14880,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
SharedPreferences preferences = MessagesController.getNotificationsSettings(currentAccount); SharedPreferences preferences = MessagesController.getNotificationsSettings(currentAccount);
if (threadMessageObject == null && (chatInfo == null && userInfo == null || pinned_msg_id == 0 || actionBar != null && (actionBar.isActionModeShowed() || actionBar.isSearchFieldVisible()))) { if (threadMessageObject == null && (chatInfo == null && userInfo == null || pinned_msg_id == 0 || actionBar != null && (actionBar.isActionModeShowed() || actionBar.isSearchFieldVisible()))) {
changed = hidePinnedMessageView(animated); changed = hidePinnedMessageView(animated);
headerItem.hideSubItem(show_pinned); if (headerItem != null) headerItem.hideSubItem(show_pinned);
} else if (pinned_msg_id == preferences.getInt("pin_" + dialog_id, 0)) { } else if (pinned_msg_id == preferences.getInt("pin_" + dialog_id, 0)) {
changed = hidePinnedMessageView(animated); changed = hidePinnedMessageView(animated);
headerItem.showSubItem(show_pinned); if (headerItem != null) headerItem.showSubItem(show_pinned);
} else { } else {
headerItem.hideSubItem(show_pinned); if (headerItem != null) headerItem.hideSubItem(show_pinned);
if (pinnedMessageObject != null) { if (pinnedMessageObject != null) {
if (pinnedMessageView.getTag() != null) { if (pinnedMessageView.getTag() != null) {
pinnedMessageView.setTag(null); pinnedMessageView.setTag(null);
@ -15186,11 +15190,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
} }
if (shareKeyItem != null) {
if (StrUtil.isBlank(NekoConfig.openPGPApp)) { if (StrUtil.isBlank(NekoConfig.openPGPApp)) {
shareKeyItem.setVisibility(View.GONE); shareKeyItem.setVisibility(View.GONE);
} else { } else {
shareKeyItem.setVisibility(View.VISIBLE); shareKeyItem.setVisibility(View.VISIBLE);
} }
}
if (userBlocked || addToContactsButton.getVisibility() == View.GONE && reportSpamButton.getVisibility() == View.GONE) { if (userBlocked || addToContactsButton.getVisibility() == View.GONE && reportSpamButton.getVisibility() == View.GONE) {
show = false; show = false;
@ -16593,7 +16599,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (chatInfo != null && chatInfo.participants != null && chatInfo.participants.participants != null) { if (chatInfo != null && chatInfo.participants != null && chatInfo.participants.participants != null) {
for (int a = 0; a < chatInfo.participants.participants.size(); a++) { for (int a = 0; a < chatInfo.participants.participants.size(); a++) {
TLRPC.ChatParticipant participant = chatInfo.participants.participants.get(a); TLRPC.ChatParticipant participant = chatInfo.participants.participants.get(a);
if (participant.user_id != selectedObject.messageOwner.from_id || participant.user_id == getUserConfig().getCurrentUser().id) { if (participant.user_id != selectedObject.messageOwner.from_id.user_id || participant.user_id == getUserConfig().getCurrentUser().id) {
continue; continue;
} }
@ -17558,8 +17564,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
break; break;
} }
case 90: { case 90: {
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(selectedObject.messageOwner.from_id); TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(selectedObject.messageOwner.from_id.user_id);
getMediaDataController().searchMessagesInChat("", dialog_id, mergeDialogId, classGuid, 0, user); getMediaDataController().searchMessagesInChat("", dialog_id, mergeDialogId, classGuid, 0, 0, user);
showMessagesSearchListView(true); showMessagesSearchListView(true);
break; break;
} }
@ -17807,8 +17813,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
toSend.append(c); toSend.append(c);
} }
} }
SendMessagesHelper.getInstance(currentAccount).sendMessage(toSend.toString(), dialog_id, selectedObject, null, false, SendMessagesHelper.getInstance(currentAccount).sendMessage(toSend.toString(), dialog_id, selectedObject, null, null,
null, null, null, true, 0); false, null, null, null, true, 0);
return 2; return 2;
} }
} }
@ -19514,7 +19520,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
boolean handled = false; boolean handled = false;
if (message.canPreviewDocument()) { if (message.canPreviewDocument()) {
PhotoViewer.getInstance().setParentActivity(getParentActivity()); PhotoViewer.getInstance().setParentActivity(getParentActivity());
PhotoViewer.getInstance().openPhoto(message, message.type != 0 ? dialog_id : 0, message.type != 0 ? mergeDialogId : 0, photoViewerProvider); PhotoViewer.getInstance().openPhoto(message, message.type != 0 ? dialog_id : 0, message.type != 0 ? mergeDialogId : 0, photoViewerProvider, false);
handled = true; handled = true;
} }
if (!handled) { if (!handled) {
@ -19765,7 +19771,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} else if (position >= messagesStartRow && position < messagesEndRow) { } else if (position >= messagesStartRow && position < messagesEndRow) {
MessageObject message = messages.get(position - messagesStartRow); MessageObject message = messages.get(position - messagesStartRow);
View view = holder.itemView; View view = holder.itemView;
boolean fromUserBlocked = getMessagesController().blockedUsers.indexOfKey(message.getFromId()) >= 0 && NekoConfig.ignoreBlocked; boolean fromUserBlocked = getMessagesController().blockePeers.indexOfKey(message.getFromChatId()) >= 0 && NekoConfig.ignoreBlocked;
if (view instanceof ChatMessageCell) { if (view instanceof ChatMessageCell) {
final ChatMessageCell messageCell = (ChatMessageCell) view; final ChatMessageCell messageCell = (ChatMessageCell) view;
@ -21050,7 +21056,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
for (int a = 0; a < chatInfo.participants.participants.size(); a++) { for (int a = 0; a < chatInfo.participants.participants.size(); a++) {
TLRPC.ChatParticipant participant = chatInfo.participants.participants.get(a); TLRPC.ChatParticipant participant = chatInfo.participants.participants.get(a);
if (participant.user_id != selectedObject.messageOwner.from_id || participant.user_id == getUserConfig().getCurrentUser().id) { if (participant.user_id != selectedObject.messageOwner.from_id.user_id || participant.user_id == getUserConfig().getCurrentUser().id) {
continue; continue;
} }
final TLRPC.ChannelParticipant channelParticipant; final TLRPC.ChannelParticipant channelParticipant;

View File

@ -1537,7 +1537,7 @@ private int lastMeasuredTopPadding;
super.onFragmentCreate(); super.onFragmentCreate();
getConnectionsManager().updateDcSettings(); getConnectionsManager().updateDcSettings();
getMessagesController().getBlockedUsers(true); getMessagesController().getBlockedPeers(true);
if (getArguments() != null) { if (getArguments() != null) {
onlySelect = arguments.getBoolean("onlySelect", false); onlySelect = arguments.getBoolean("onlySelect", false);

View File

@ -327,7 +327,7 @@ public class DocumentSelectActivity extends BaseFragment {
selectedFiles.clear(); selectedFiles.clear();
sizeNotifierFrameLayout = new SizeNotifierFrameLayout(context, SharedConfig.smoothKeyboard) { sizeNotifierFrameLayout = new SizeNotifierFrameLayout(context, parentLayout) {
private int lastNotifyWidth; private int lastNotifyWidth;
private boolean ignoreLayout; private boolean ignoreLayout;
@ -355,12 +355,6 @@ public class DocumentSelectActivity extends BaseFragment {
ignoreLayout = false; ignoreLayout = false;
} }
if (SharedConfig.smoothKeyboard && commentTextView != null && commentTextView.isPopupShowing()) {
fragmentView.setTranslationY(getCurrentPanTranslationY());
listView.setTranslationY(0);
emptyView.setTranslationY(0);
}
int childCount = getChildCount(); int childCount = getChildCount();
for (int i = 0; i < childCount; i++) { for (int i = 0; i < childCount; i++) {
View child = getChildAt(i); View child = getChildAt(i);
@ -887,21 +881,6 @@ public class DocumentSelectActivity extends BaseFragment {
} }
@Override
protected void onPanTranslationUpdate(int y) {
if (listView == null) {
return;
}
if (commentTextView.isPopupShowing()) {
fragmentView.setTranslationY(y);
listView.setTranslationY(0);
emptyView.setTranslationY(0);
} else {
listView.setTranslationY(y);
emptyView.setTranslationY(y);
}
}
private boolean onItemClick(View view, ListItem item) { private boolean onItemClick(View view, ListItem item) {
if (item == null || item.file == null || item.file.isDirectory()) { if (item == null || item.file == null || item.file.isDirectory()) {
return false; return false;
@ -1541,7 +1520,7 @@ public class DocumentSelectActivity extends BaseFragment {
view = headerCell; view = headerCell;
break; break;
case 1: case 1:
view = new SharedDocumentCell(mContext, true); view = new SharedDocumentCell(mContext, SharedDocumentCell.VIEW_TYPE_PICKER);
break; break;
case 2: case 2:
default: default:
@ -1683,7 +1662,7 @@ public class DocumentSelectActivity extends BaseFragment {
@Override @Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = new SharedDocumentCell(mContext, true); View view = new SharedDocumentCell(mContext, SharedDocumentCell.VIEW_TYPE_PICKER);
return new RecyclerListView.Holder(view); return new RecyclerListView.Holder(view);
} }

View File

@ -58,9 +58,6 @@ import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.google.firebase.appindexing.Action;
import com.google.firebase.appindexing.FirebaseUserActions;
import com.google.firebase.appindexing.builders.AssistActionBuilder;
import com.v2ray.ang.V2RayConfig; import com.v2ray.ang.V2RayConfig;
import org.telegram.PhoneFormat.PhoneFormat; import org.telegram.PhoneFormat.PhoneFormat;
@ -1559,7 +1556,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
Integer threadId = null; Integer threadId = null;
Integer commentId = null; Integer commentId = null;
boolean hasUrl = false; boolean hasUrl = false;
finalString scheme = data.getScheme(); final String scheme = data.getScheme();
boolean internal = intent.getExtras() != null && intent.getExtras().get("internal") != null && (boolean) intent.getExtras().get("internal"); boolean internal = intent.getExtras() != null && intent.getExtras().get("internal") != null && (boolean) intent.getExtras().get("internal");
if (scheme != null) { if (scheme != null) {
switch (scheme) { switch (scheme) {
@ -2021,7 +2018,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
} }
} }
} }
if (intent.hasExtra(EXTRA_ACTION_TOKEN)) { /*if (intent.hasExtra(EXTRA_ACTION_TOKEN)) {
final boolean success = UserConfig.getInstance(currentAccount).isClientActivated() && "tg".equals(scheme) && unsupportedUrl == null; final boolean success = UserConfig.getInstance(currentAccount).isClientActivated() && "tg".equals(scheme) && unsupportedUrl == null;
final Action action = new AssistActionBuilder() final Action action = new AssistActionBuilder()
.setActionToken(intent.getStringExtra(EXTRA_ACTION_TOKEN)) .setActionToken(intent.getStringExtra(EXTRA_ACTION_TOKEN))
@ -2029,7 +2026,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
.build(); .build();
FirebaseUserActions.getInstance().end(action); FirebaseUserActions.getInstance().end(action);
intent.removeExtra(EXTRA_ACTION_TOKEN); intent.removeExtra(EXTRA_ACTION_TOKEN);
} }*/
if (code != null || UserConfig.getInstance(currentAccount).isClientActivated()) { if (code != null || UserConfig.getInstance(currentAccount).isClientActivated()) {
if (phone != null || phoneHash != null) { if (phone != null || phoneHash != null) {
final Bundle args = new Bundle(); final Bundle args = new Bundle();
@ -3979,7 +3976,6 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
if (!toDark) { if (!toDark) {
darkThemeView.setVisibility(View.VISIBLE); darkThemeView.setVisibility(View.VISIBLE);
} }
DrawerProfileCell.switchingTheme = false;
} }
}); });
anim.start(); anim.start();
@ -3989,7 +3985,6 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
try { try {
themeSwitchImageView.setImageDrawable(null); themeSwitchImageView.setImageDrawable(null);
frameLayout.removeView(themeSwitchImageView); frameLayout.removeView(themeSwitchImageView);
DrawerProfileCell.switchingTheme = false;
} catch (Exception e2) { } catch (Exception e2) {
FileLog.e(e2); FileLog.e(e2);
} }

View File

@ -352,7 +352,7 @@ public class LoginActivity extends BaseFragment implements NotificationCenter.No
MessagesStorage.getInstance(currentAccount).putUsersAndChats(users, null, true, true); MessagesStorage.getInstance(currentAccount).putUsersAndChats(users, null, true, true);
MessagesController.getInstance(currentAccount).putUser(res.user, false); MessagesController.getInstance(currentAccount).putUser(res.user, false);
ContactsController.getInstance(currentAccount).checkAppAccount(); ContactsController.getInstance(currentAccount).checkAppAccount();
MessagesController.getInstance(currentAccount).getBlockedUsers(true); MessagesController.getInstance(currentAccount).getBlockedPeers(true);
MessagesController.getInstance(currentAccount).checkPromoInfo(true); MessagesController.getInstance(currentAccount).checkPromoInfo(true);
ConnectionsManager.getInstance(currentAccount).updateDcSettings(); ConnectionsManager.getInstance(currentAccount).updateDcSettings();
needFinishActivity(false); needFinishActivity(false);

View File

@ -1841,6 +1841,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
listView.stopScroll(); listView.stopScroll();
avatarContainer.setVisibility(expanded ? INVISIBLE : VISIBLE); avatarContainer.setVisibility(expanded ? INVISIBLE : VISIBLE);
nameTextView[1].setVisibility(expanded ? INVISIBLE : VISIBLE); nameTextView[1].setVisibility(expanded ? INVISIBLE : VISIBLE);
idTextView.setVisibility(expanded ? INVISIBLE : VISIBLE);
onlineTextView[1].setVisibility(expanded ? INVISIBLE : VISIBLE); onlineTextView[1].setVisibility(expanded ? INVISIBLE : VISIBLE);
onlineTextView[2].setVisibility(expanded ? INVISIBLE : VISIBLE); onlineTextView[2].setVisibility(expanded ? INVISIBLE : VISIBLE);
callItem.setVisibility(expanded || !callItemVisible ? GONE : INVISIBLE); callItem.setVisibility(expanded || !callItemVisible ? GONE : INVISIBLE);
@ -4098,7 +4099,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
nameTextView[a].setScaleY(nameScale); nameTextView[a].setScaleY(nameScale);
} }
if (diff > 0.85 && NekoConfig.showIdAndDc) { if (diff > 0.85 && !searchMode && NekoConfig.showIdAndDc) {
idTextView.setVisibility(View.VISIBLE); idTextView.setVisibility(View.VISIBLE);
} else { } else {
idTextView.setVisibility(View.GONE); idTextView.setVisibility(View.GONE);
@ -5785,6 +5786,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
avatarContainer.setAlpha(progressHalf); avatarContainer.setAlpha(progressHalf);
nameTextView[1].setAlpha(progressHalf); nameTextView[1].setAlpha(progressHalf);
onlineTextView[1].setAlpha(progressHalf); onlineTextView[1].setAlpha(progressHalf);
idTextView.setAlpha(progressHalf);
searchItem.getSearchField().setAlpha(progressHalfEnd); searchItem.getSearchField().setAlpha(progressHalfEnd);
if (enter && searchTransitionProgress < 0.7f) { if (enter && searchTransitionProgress < 0.7f) {
@ -5846,6 +5848,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
avatarContainer.setAlpha(1f); avatarContainer.setAlpha(1f);
nameTextView[1].setAlpha(1f); nameTextView[1].setAlpha(1f);
onlineTextView[1].setAlpha(1f); onlineTextView[1].setAlpha(1f);
idTextView.setAlpha(1f);
searchItem.setAlpha(1f); searchItem.setAlpha(1f);
listView.setAlpha(1f); listView.setAlpha(1f);
searchListView.setAlpha(1f); searchListView.setAlpha(1f);

View File

@ -121,13 +121,13 @@ public class MessageDetailsActivity extends BaseFragment implements Notification
public MessageDetailsActivity(MessageObject messageObject) { public MessageDetailsActivity(MessageObject messageObject) {
this.messageObject = messageObject; this.messageObject = messageObject;
if (messageObject.messageOwner.to_id != null && messageObject.messageOwner.to_id.channel_id != 0) { if (messageObject.messageOwner.peer_id != null && messageObject.messageOwner.peer_id.channel_id != 0) {
fromChat = getMessagesController().getChat(messageObject.messageOwner.to_id.channel_id); fromChat = getMessagesController().getChat(messageObject.messageOwner.peer_id.channel_id);
} else if (messageObject.messageOwner.to_id != null && messageObject.messageOwner.to_id.chat_id != 0) { } else if (messageObject.messageOwner.peer_id != null && messageObject.messageOwner.peer_id.chat_id != 0) {
fromChat = getMessagesController().getChat(messageObject.messageOwner.to_id.chat_id); fromChat = getMessagesController().getChat(messageObject.messageOwner.peer_id.chat_id);
} }
if (messageObject.messageOwner.from_id != 0) { if (messageObject.messageOwner.from_id.user_id != 0) {
fromUser = getMessagesController().getUser(messageObject.messageOwner.from_id); fromUser = getMessagesController().getUser(messageObject.messageOwner.from_id.user_id);
} }
filePath = messageObject.messageOwner.attachPath; filePath = messageObject.messageOwner.attachPath;
if (!TextUtils.isEmpty(filePath)) { if (!TextUtils.isEmpty(filePath)) {
@ -433,8 +433,8 @@ public class MessageDetailsActivity extends BaseFragment implements Notification
textCell.setTextAndValue("Edited", LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, LocaleController.getInstance().formatterYear.format(new Date(date)), LocaleController.getInstance().formatterDay.format(new Date(date))), divider); textCell.setTextAndValue("Edited", LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, LocaleController.getInstance().formatterYear.format(new Date(date)), LocaleController.getInstance().formatterDay.format(new Date(date))), divider);
} else if (position == forwardRow) { } else if (position == forwardRow) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
if (messageObject.messageOwner.fwd_from.channel_id != 0) { if (messageObject.messageOwner.fwd_from.from_id.channel_id != 0) {
TLRPC.Chat chat = getMessagesController().getChat(messageObject.messageOwner.fwd_from.channel_id); TLRPC.Chat chat = getMessagesController().getChat(messageObject.messageOwner.fwd_from.from_id.channel_id);
builder.append(chat.title); builder.append(chat.title);
builder.append("\n"); builder.append("\n");
if (!TextUtils.isEmpty(chat.username)) { if (!TextUtils.isEmpty(chat.username)) {
@ -443,8 +443,8 @@ public class MessageDetailsActivity extends BaseFragment implements Notification
builder.append("\n"); builder.append("\n");
} }
builder.append(chat.id); builder.append(chat.id);
} else if (messageObject.messageOwner.fwd_from.from_id != 0) { } else if (messageObject.messageOwner.fwd_from.from_id.user_id != 0) {
TLRPC.User user = getMessagesController().getUser(messageObject.messageOwner.fwd_from.from_id); TLRPC.User user = getMessagesController().getUser(messageObject.messageOwner.fwd_from.from_id.channel_id);
builder.append(ContactsController.formatName(user.first_name, user.last_name)); builder.append(ContactsController.formatName(user.first_name, user.last_name));
builder.append("\n"); builder.append("\n");
if (!TextUtils.isEmpty(user.username)) { if (!TextUtils.isEmpty(user.username)) {

View File

@ -89,8 +89,8 @@ public class MessageHelper extends BaseController {
if (message.random_id != 0) { if (message.random_id != 0) {
random_ids.add(message.random_id); random_ids.add(message.random_id);
} }
if (message.to_id.channel_id != 0) { if (message.peer_id.channel_id != 0) {
channelId = message.to_id.channel_id; channelId = message.peer_id.channel_id;
} }
if (message.id > lastMessageId) { if (message.id > lastMessageId) {
lastMessageId = message.id; lastMessageId = message.id;
@ -150,8 +150,8 @@ public class MessageHelper extends BaseController {
for (int a = 0; a < res.messages.size(); a++) { for (int a = 0; a < res.messages.size(); a++) {
TLRPC.Message message = res.messages.get(a); TLRPC.Message message = res.messages.get(a);
ids.add(message.id); ids.add(message.id);
if (message.from_id > 0) { if (message.from_id.user_id > 0) {
ids.add(message.from_id); ids.add(message.peer_id.user_id);
} else { } else {
msgIds.add(message.id); msgIds.add(message.id);
if (message.random_id != 0) { if (message.random_id != 0) {
@ -180,7 +180,7 @@ public class MessageHelper extends BaseController {
public void deleteUserChannelHistory(final TLRPC.Chat chat, int userId, int offset) { public void deleteUserChannelHistory(final TLRPC.Chat chat, int userId, int offset) {
if (offset == 0) { if (offset == 0) {
getMessagesStorage().deleteUserChannelHistory(chat.id, userId); getMessagesStorage().deleteUserChatHistory(chat.id, chat.id, userId);
} }
TLRPC.TL_channels_deleteUserHistory req = new TLRPC.TL_channels_deleteUserHistory(); TLRPC.TL_channels_deleteUserHistory req = new TLRPC.TL_channels_deleteUserHistory();
req.channel = getMessagesController().getInputChannel(chat.id); req.channel = getMessagesController().getInputChannel(chat.id);

View File

@ -55,7 +55,8 @@ public class StickerSizePreviewMessagesCell extends LinearLayout {
message.date = date + 10; message.date = date + 10;
message.dialog_id = 1; message.dialog_id = 1;
message.flags = 257; message.flags = 257;
message.from_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId(); message.from_id = new TLRPC.TL_peerUser();
message.from_id.user_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId();
message.id = 1; message.id = 1;
message.media = new TLRPC.TL_messageMediaDocument(); message.media = new TLRPC.TL_messageMediaDocument();
message.media.flags = 1; message.media.flags = 1;
@ -73,8 +74,8 @@ public class StickerSizePreviewMessagesCell extends LinearLayout {
message.media.document.attributes.add(attributeImageSize); message.media.document.attributes.add(attributeImageSize);
message.message = ""; message.message = "";
message.out = true; message.out = true;
message.to_id = new TLRPC.TL_peerUser(); message.peer_id = new TLRPC.TL_peerUser();
message.to_id.user_id = 0; message.peer_id.user_id = 0;
messageObjects[0] = new MessageObject(UserConfig.selectedAccount, message, true, false); messageObjects[0] = new MessageObject(UserConfig.selectedAccount, message, true, false);
messageObjects[0].useCustomPhoto = true; messageObjects[0].useCustomPhoto = true;
@ -86,8 +87,8 @@ public class StickerSizePreviewMessagesCell extends LinearLayout {
message.id = 2; message.id = 2;
message.media = new TLRPC.TL_messageMediaEmpty(); message.media = new TLRPC.TL_messageMediaEmpty();
message.out = false; message.out = false;
message.to_id = new TLRPC.TL_peerUser(); message.peer_id = new TLRPC.TL_peerUser();
message.to_id.user_id = 1; message.peer_id.user_id = 1;
messageObjects[0].customReplyName = LocaleController.getString("StickerSizeDialogName", R.string.StickerSizeDialogName); messageObjects[0].customReplyName = LocaleController.getString("StickerSizeDialogName", R.string.StickerSizeDialogName);
messageObjects[0].replyMessageObject = new MessageObject(UserConfig.selectedAccount, message, true, false); messageObjects[0].replyMessageObject = new MessageObject(UserConfig.selectedAccount, message, true, false);
@ -100,8 +101,8 @@ public class StickerSizePreviewMessagesCell extends LinearLayout {
message.id = 2; message.id = 2;
message.media = new TLRPC.TL_messageMediaEmpty(); message.media = new TLRPC.TL_messageMediaEmpty();
message.out = false; message.out = false;
message.to_id = new TLRPC.TL_peerUser(); message.peer_id = new TLRPC.TL_peerUser();
message.to_id.user_id = 1; message.peer_id.user_id = 1;
messageObjects[1] = new MessageObject(UserConfig.selectedAccount, message, true, false); messageObjects[1] = new MessageObject(UserConfig.selectedAccount, message, true, false);
TLRPC.User currentUser = MessagesController.getInstance(UserConfig.selectedAccount).getUser(UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId()); TLRPC.User currentUser = MessagesController.getInstance(UserConfig.selectedAccount).getUser(UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId());
messageObjects[1].customReplyName = ContactsController.formatName(currentUser.first_name, currentUser.last_name); messageObjects[1].customReplyName = ContactsController.formatName(currentUser.first_name, currentUser.last_name);

View File

@ -64,7 +64,6 @@ object AlertUtil {
}) })
@JvmStatic @JvmStatic
@JvmOverloads
fun showSimpleAlert(ctx: Context?, error: Throwable) { fun showSimpleAlert(ctx: Context?, error: Throwable) {
showSimpleAlert(ctx, null, error.message ?: error.javaClass.simpleName) {} showSimpleAlert(ctx, null, error.message ?: error.javaClass.simpleName) {}

View File

@ -1,19 +1,19 @@
#!/bin/bash #!/bin/bash
V2RAY_CORE_VERSION="4.30.0"
if [ ! -x "$(command -v go)" ]; then if [ ! -x "$(command -v go)" ]; then
# if [ ! -x "$(command -v gvm)" ]; then # if [ ! -x "$(command -v gvm)" ]; then
# #
# apt install -y bison # apt install -y bison
#
# bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) # bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
#
# source "$HOME/.bashrc" # source "$HOME/.bashrc"
# #
# fi # fi
# #
# gvm install go1.14 -B # gvm install go1.15 -B
# gvm use go1.14 --default # gvm use go1.15 --default
echo "install golang please!" echo "install golang please!"
@ -24,9 +24,7 @@ fi
if [ ! -x "$(command -v rustc)" ]; then if [ ! -x "$(command -v rustc)" ]; then
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# echo "source \$HOME/.cargo/env" >> $HOME/.bashrc && source $HOME/.cargo/env
# source $HOME/.cargo/env
# rustup target install armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android # rustup target install armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android
echo "install rust please!" echo "install rust please!"
@ -60,7 +58,7 @@ go get -v golang.org/x/mobile/cmd/... &&
v2rayCore="$(go env GOPATH)/src/v2ray.com/core" && v2rayCore="$(go env GOPATH)/src/v2ray.com/core" &&
rm -rf "$v2rayCore" && rm -rf "$v2rayCore" &&
mkdir -p "$v2rayCore" && mkdir -p "$v2rayCore" &&
git clone https://github.com/v2fly/v2ray-core.git "$v2rayCore" -b "v4.28.2" && git clone https://github.com/v2fly/v2ray-core.git "$v2rayCore" -b "v$V2RAY_CORE_VERSION" &&
go get -d github.com/2dust/AndroidLibV2rayLite && go get -d github.com/2dust/AndroidLibV2rayLite &&
gomobile init && gomobile init &&
@ -76,16 +74,16 @@ DIR=TMessagesProj/src/main/libs &&
rm -rf $DIR/armeabi-v7a && rm -rf $DIR/armeabi-v7a &&
mkdir -p $DIR/armeabi-v7a && mkdir -p $DIR/armeabi-v7a &&
cp $OUT/armeabi-v7a/*.so $DIR/armeabi-v7a && cp $OUT/armeabi-v7a/libtmessages*.so $DIR/armeabi-v7a &&
rm -rf $DIR/arm64-v8a && rm -rf $DIR/arm64-v8a &&
mkdir -p $DIR/arm64-v8a && mkdir -p $DIR/arm64-v8a &&
cp $OUT/arm64-v8a/*.so $DIR/arm64-v8a && cp $OUT/arm64-v8a/libtmessages*.so $DIR/arm64-v8a &&
rm -rf $DIR/x86 && rm -rf $DIR/x86 &&
mkdir -p $DIR/x86 && mkdir -p $DIR/x86 &&
cp $OUT/x86/*.so $DIR/x86 && cp $OUT/x86/libtmessages*.so $DIR/x86 &&
rm -rf $DIR/x86_64 && rm -rf $DIR/x86_64 &&
mkdir -p $DIR/x86_64 && mkdir -p $DIR/x86_64 &&
cp $OUT/x86_64/*.so $DIR/x86_64 cp $OUT/x86_64/libtmessages*.so $DIR/x86_64

View File

@ -1,8 +1,13 @@
#!/bin/bash #!/bin/bash
outPath="TMessagesProj/build/outputs/apk/full/release" ./gradlew TMessagesProj:assembleFullRelease \
TMessagesProj:assembleFullReleaseNoGcm
for apk in $outPath/*.apk; do trap 'kill $(jobs -p)' SIGINT
function upload() {
for apk in $outPath/*.apk; do
echo ">> Uploading $apk" echo ">> Uploading $apk"
@ -10,12 +15,20 @@ for apk in $outPath/*.apk; do
-X POST \ -X POST \
-F chat_id="$TELEGRAM_CHANNEL" \ -F chat_id="$TELEGRAM_CHANNEL" \
-F document="@$apk" \ -F document="@$apk" \
--silent --show-error --fail > /dev/null & --silent --show-error --fail >/dev/null &
done done
trap 'kill $(jobs -p)' SIGINT for job in $(jobs -p); do
for job in `jobs -p`; do
wait $job wait $job
done done
}
outPath="TMessagesProj/build/outputs/apk/full/release"
upload
outPath="TMessagesProj/build/outputs/apk/full/releaseNoGcm"
upload

View File

@ -1,6 +1,8 @@
#!/bin/bash #!/bin/bash
function upload { trap 'kill $(jobs -p)' SIGINT
function upload() {
for apk in $outPath/*.apk; do for apk in $outPath/*.apk; do
@ -10,10 +12,14 @@ function upload {
-X POST \ -X POST \
-F chat_id="$TELEGRAM_CHANNEL" \ -F chat_id="$TELEGRAM_CHANNEL" \
-F document="@$apk" \ -F document="@$apk" \
--silent --show-error --fail >/dev/null --silent --show-error --fail >/dev/null &
done done
for job in $(jobs -p); do
wait $job
done
} }
outPath="TMessagesProj/build/outputs/apk/full/release" outPath="TMessagesProj/build/outputs/apk/full/release"
@ -28,7 +34,6 @@ outPath="TMessagesProj/build/outputs/apk/mini/release"
upload upload
outPath="TMessagesProj/build/outputs/apk/mini/releaseNoGcm" outPath="TMessagesProj/build/outputs/apk/mini/releaseNoGcm"
upload upload

View File

@ -9,7 +9,7 @@ buildscript {
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.0.1' classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10"
classpath 'com.google.gms:google-services:4.3.3' classpath 'com.google.gms:google-services:4.3.4'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
classpath 'gradle.plugin.org.mozilla.rust-android-gradle:plugin:0.8.3' classpath 'gradle.plugin.org.mozilla.rust-android-gradle:plugin:0.8.3'
classpath 'com.github.triplet.gradle:play-publisher:2.8.0' classpath 'com.github.triplet.gradle:play-publisher:2.8.0'