This commit is contained in:
世界 2020-07-30 20:11:37 +08:00
parent 8ca90a6467
commit 3b75cb665d
21 changed files with 228 additions and 469 deletions

View File

@ -25,10 +25,13 @@ jobs:
java-version: 1.8
- name: Run Gradle Build
run: |
export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}"
sudo bash <<EOF
[ -d "$HOME/.gradle" ] && mv $HOME/.gradle /root
export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}"
./gradlew assembleFullRelease
mv /root/.gradle $HOME
chgrp -R $UID $HOME/.gradle
chown -R $UID $HOME/.gradle
EOF
echo ::set-env name=APK_FILE::$(find TMessagesProj/build/outputs/apk -name "*arm64-v8a*.apk")
echo ::set-env name=APK_FILE_ARMV7::$(find TMessagesProj/build/outputs/apk -name "*armeabi*.apk")
@ -57,143 +60,4 @@ jobs:
with:
to: ${{ secrets.CANARY_CHANNEL }}
token: ${{ secrets.TELEGRAM_TOKEN }}
document: ${{ env.APK_FILE_X64 }}
nativeBuild:
name: Native Build
runs-on: ubuntu-latest
if: "contains(github.event.head_commit.message, '[n]')"
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.gradle
key: native-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- run: git submodule update --init --recursive
- uses: actions/cache@v1
with:
path: TMessagesProj/jni/boringssl/build
key: boringssl-${{ hashFiles('TMessagesProj/jni/boringssl/.git') }}
- uses: actions/cache@v1
with:
path: TMessagesProj/jni/ffmpeg/build
key: ffmpeg-${{ hashFiles('TMessagesProj/jni/ffmpeg/.git') }}
- uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build native libraries
run: |
while :
do
sudo apt-get install -y ninja-build && break
sleep 5
done
bash bin/native_libs.sh
- name: assemble
run: |
sudo bash <<EOF
export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" &&
./gradlew assembleFullFoss
EOF
ls TMessagesProj/build/outputs/apk
echo ::set-env name=APK_FILE::$(find TMessagesProj/build/outputs/apk -name "*universal*")
- uses: actions/upload-artifact@master
with:
name: NekoX-Foss
path: ${{ env.APK_FILE }}
- uses: actions/upload-artifact@master
with:
name: Boringssl Library
path: "TMessagesProj/jni/boringssl/build"
- uses: actions/upload-artifact@master
with:
name: Ffmpeg Library
path: "TMessagesProj/jni/ffmpeg/build"
v2rayBuild:
name: V2ray Build
runs-on: ubuntu-latest
if: "contains(github.event.head_commit.message, '[v]')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.14
- name: Build V2ray
run: |
go env -w GOPATH=$HOME/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
go get -u github.com/golang/protobuf/protoc-gen-go
go get -v golang.org/x/mobile/cmd/...
go get -v go.starlark.net/starlark
go get -v github.com/refraction-networking/utls
go get -v github.com/gorilla/websocket
go get -v -insecure v2ray.com/core
go get github.com/2dust/AndroidLibV2rayLite
gomobile init
env GO111MODULE=off gomobile bind -v -ldflags='-s -w' github.com/2dust/AndroidLibV2rayLite
- uses: actions/upload-artifact@master
with:
name: libv2ray
path: libv2ray.aar
rbBuild:
name: RelayBaton Build
runs-on: ubuntu-latest
if: "contains(github.event.head_commit.message, '[rb]')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.14
- uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build RelayBaton
run: bash .github/scripts/build-relaybaton.sh
- name: package
run: |
./gradlew relaybaton:assembleRelease
ls relaybaton/build/outputs/aar
- uses: actions/upload-artifact@master
with:
name: relaybaton
path: relaybaton/build/outputs/aar
ssBuild:
name: SS-Rust Build
runs-on: ubuntu-latest
if: "contains(github.event.head_commit.message, '[ss-rust]')"
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.gradle
key: native-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- run: git submodule update --init --recursive
- uses: actions/setup-java@v1
with:
java-version: 1.8
- name: install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
- name: setup rust targets
run: rustup target install armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android
- name: assemble
run: |
./gradlew ss-rust:assembleRelease
ls ss-rust/build/outputs/aar
- uses: actions/upload-artifact@master
with:
name: ss-rust
path: ss-rust/build/outputs/aar
document: ${{ env.APK_FILE_X64 }}

View File

@ -1,36 +0,0 @@
name: Release Build
on:
push:
tags:
- 'v*'
jobs:
releaseBuild:
name: Release Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.gradle
key: gradle-${{ hashFiles('**/*.gradle') }}
- uses: actions/setup-java@v1
with:
java-version: 1.8
- name: assembleRelease
run: |
sudo bash <<EOF
export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}"
export GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}"
rm -rf /root/.ssh
mkdir -p /root/.ssh
echo "${{ secrets.SSH_KEY }}" > $HOME/.ssh/id_rsa
chmod 600 /root/.ssh/id_rsa
cat > service_account_credentials.json << EOX
${{ secrets.GOOGLE_ACCOUNT_SERVICE }}
EOX
ref="${{ github.ref }}"
ref=${ref/"refs/tags/"/}
./bin/release.sh "$ref"
EOF

View File

@ -7,8 +7,8 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
def verName = "6.3.0.0-preview-1"
def verCode = 58
def verName = "6.3.0.0-preview-3"
def verCode = 60
def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json")

View File

@ -7,7 +7,6 @@
-keep class org.telegram.messenger.camera.* { *; }
-keep class org.telegram.messenger.secretmedia.* { *; }
-keep class org.telegram.messenger.support.* { *; }
-keep class org.telegram.messenger.support.* { *; }
-keep class org.telegram.messenger.time.* { *; }
-keep class org.telegram.messenger.video.* { *; }
-keep class org.telegram.messenger.voip.* { *; }

View File

@ -47,11 +47,6 @@ import android.provider.CallLog;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
import android.provider.Settings;
import androidx.core.content.FileProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.viewpager.widget.ViewPager;
import android.telephony.TelephonyManager;
import android.text.Selection;
import android.text.Spannable;
@ -90,6 +85,7 @@ import android.widget.ScrollView;
import android.widget.TextView;
import androidx.core.content.FileProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.viewpager.widget.ViewPager;
import com.android.internal.telephony.ITelephony;

View File

@ -16,7 +16,7 @@ import android.content.pm.PackageManager;
@SuppressWarnings("ConstantConditions")
public class BuildVars {
public static boolean DEBUG_VERSION = BuildConfig.BUILD_TYPE.equals("debug");
public static boolean DEBUG_VERSION = BuildConfig.BUILD_TYPE.equals("debug") || BuildConfig.VERSION_NAME.contains("preview");
public static boolean DEBUG_PRIVATE_VERSION = DEBUG_VERSION;
public static boolean LOGS_ENABLED;
public static boolean USE_CLOUD_STRINGS = true;
@ -46,7 +46,7 @@ public class BuildVars {
if (ApplicationLoader.applicationContext != null) {
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("systemConfig", Context.MODE_PRIVATE);
LOGS_ENABLED = sharedPreferences.getBoolean("logsEnabled", LOGS_ENABLED);
LOGS_ENABLED = sharedPreferences.getBoolean("logsEnabled", DEBUG_VERSION);
}
}
}

View File

@ -10,26 +10,24 @@ package org.telegram.messenger;
import android.util.Log;
import org.telegram.messenger.time.FastDateFormat;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.util.Locale;
import cn.hutool.core.lang.caller.CallerUtil;
import cn.hutool.core.lang.caller.StackTraceCaller;
import cn.hutool.core.util.StrUtil;
public class FileLog {
private final static StackTraceCaller caller = new StackTraceCaller();
public static String getNetworkLogPath() {
if (BuildVars.DEBUG_VERSION) return "/dev/null";
return "";
}
private static String mkTag() {
return caller.getCaller(3).getSimpleName();
final StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
return StrUtil.subAfter(stackTrace[2].getClassName(), ".", true);
}
private static String mkMessage(Throwable e) {
@ -47,7 +45,7 @@ public class FileLog {
}
public static void e(final Throwable e) {
Log.e(mkTag(),mkMessage(e),e);
Log.e(mkTag(), mkMessage(e), e);
}
public static void d(final String message) {

View File

@ -20,6 +20,7 @@ import android.util.Base64;
import android.util.SparseArray;
import androidx.annotation.Nullable;
import androidx.core.content.pm.ShortcutManagerCompat;
import com.v2ray.ang.V2RayConfig;
import com.v2ray.ang.dto.AngConfig;
@ -33,7 +34,6 @@ import org.telegram.tgnet.ConnectionsManager;
import java.io.File;
import java.io.RandomAccessFile;
import java.util.ConcurrentModificationException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
@ -50,14 +50,11 @@ import tw.nekomimi.nekogram.sub.SubManager;
import tw.nekomimi.nekogram.utils.AlertUtil;
import tw.nekomimi.nekogram.utils.EnvUtil;
import tw.nekomimi.nekogram.utils.FileUtil;
import tw.nekomimi.nekogram.utils.ThreadUtil;
import tw.nekomimi.nekogram.utils.UIUtil;
import static com.v2ray.ang.V2RayConfig.SSR_PROTOCOL;
import static com.v2ray.ang.V2RayConfig.SS_PROTOCOL;
import androidx.core.content.pm.ShortcutManagerCompat;
public class SharedConfig {
public static String pushString = "";
@ -501,6 +498,16 @@ public class SharedConfig {
public AngConfig.VmessBean bean;
public VmessLoader loader;
{
if (BuildVars.isMini) {
throw new RuntimeException(LocaleController.getString("MiniVersionAlert", R.string.MiniVersionAlert));
}
}
public VmessProxy(String vmessLink) {
this(VmessLoader.parseVmessLink(vmessLink));
@ -511,12 +518,6 @@ public class SharedConfig {
this.bean = bean;
if (BuildVars.isMini) {
throw new RuntimeException(LocaleController.getString("MiniVersionAlert", R.string.MiniVersionAlert));
}
}
@Override
@ -989,7 +990,7 @@ public class SharedConfig {
return new LinkedList<>(proxyList);
} catch (ConcurrentModificationException ignored) {
} catch (Exception ignored) {
}
}
@ -1700,12 +1701,11 @@ public class SharedConfig {
}
if (!proxyList.isEmpty()) {
for (ProxyInfo proxyInfo : proxyList) {
for (ProxyInfo proxyInfo : getProxyList()) {
if (proxyInfo instanceof ExternalSocks5Proxy) {
((ExternalSocks5Proxy) proxyInfo).stop();
}
}
ThreadUtil.sleep(500L);
}
proxyListLoaded = true;
@ -2002,10 +2002,15 @@ public class SharedConfig {
proxyList.remove(proxyInfo);
if (proxyInfo.subId != 0) {
SubInfo sub = SubManager.getSubList().find(ObjectFilters.eq("id", proxyInfo.subId)).firstOrDefault();
sub.proxies.remove(proxyInfo.toUrl());
SubManager.getSubList().update(sub);
try {
if (sub.proxies.remove(proxyInfo.toUrl())) {
SubManager.getSubList().update(sub);
}
} catch (UnsupportedOperationException ignored) {
}
} else {
saveProxyList();
}
saveProxyList();
}
public static void deleteAllProxy() {

View File

@ -26,6 +26,8 @@ import java.util.Arrays;
import java.util.Calendar;
import java.util.Locale;
import tw.nekomimi.nekogram.utils.EnvUtil;
public class VoIPController{
public static final int NET_TYPE_UNKNOWN=0;
@ -226,30 +228,11 @@ public class VoIPController{
}
private String getLogFilePath(String name){
Calendar c=Calendar.getInstance();
return new File(ApplicationLoader.applicationContext.getExternalFilesDir(null),
String.format(Locale.US, "logs/%02d_%02d_%04d_%02d_%02d_%02d_%s.txt",
c.get(Calendar.DATE), c.get(Calendar.MONTH)+1, c.get(Calendar.YEAR),
c.get(Calendar.HOUR_OF_DAY), c.get(Calendar.MINUTE), c.get(Calendar.SECOND), name)).getAbsolutePath();
return new File(EnvUtil.getTelegramPath(),"logs/" + name + ".log").getPath();
}
private String getLogFilePath(long callID){
File dir=VoIPHelper.getLogsDir();
if(!BuildVars.DEBUG_VERSION){
File[] _logs=dir.listFiles();
ArrayList<File> logs=new ArrayList<>();
logs.addAll(Arrays.asList(_logs));
while(logs.size()>20){
File oldest=logs.get(0);
for(File file : logs){
if(file.getName().endsWith(".log") && file.lastModified()<oldest.lastModified())
oldest=file;
}
oldest.delete();
logs.remove(oldest);
}
}
return new File(dir, callID+".log").getAbsolutePath();
return new File(EnvUtil.getTelegramPath(),"logs/" + callID + ".log").getPath();
}
public String getDebugLog(){

View File

@ -549,7 +549,7 @@ public class ActionIntroActivity extends BaseFragment implements LocationControl
case ACTION_TYPE_CHANGE_PHONE_NUMBER: {
BottomBuilder builder = new BottomBuilder(getParentActivity());
builder.addTitle(LocaleController.getString("PhoneNumberAlert", R.string.PhoneNumberAlert));
builder.addItem(LocaleController.getString("Change", R.string.Change), (i) -> {
builder.addItem(LocaleController.getString("Change", R.string.Change),R.drawable.baseline_check_circle_24, i -> {
presentFragment(new ChangePhoneActivity(), true);
return Unit.INSTANCE;
});

View File

@ -210,8 +210,8 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
layoutParams = (LayoutParams) actionBarShadow.getLayoutParams();
layoutParams.topMargin = ActionBar.getCurrentActionBarHeight();
layoutParams = (LayoutParams) blurredView.getLayoutParams();
layoutParams.topMargin = -getPaddingTop();
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) blurredView.getLayoutParams();
lp.topMargin = -getPaddingTop();
int contentSize = AndroidUtilities.dp(179);
if (playlist.size() > 1) {

View File

@ -3196,7 +3196,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
((LaunchActivity) parentActivity).callbacks.put(115, result -> {
long keyId = result.getLongExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, 0L);
long keyId = result == null ? 0L : result.getLongExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, 0L);
if (save && keyId != 0L) NekoConfig.setOpenPGPKeyId(keyId);

View File

@ -71,8 +71,7 @@ public class ProfileGalleryView extends CircularViewPager implements Notificatio
}
public interface Callback {
void onDown(boolean left);
void onRelease();
void onClick();
void onPhotosLoaded();
void onVideoSet();
}
@ -199,95 +198,95 @@ public class ProfileGalleryView extends CircularViewPager implements Notificatio
drawable.setInvalidateParentViewWithSecond(true);
}
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (parentListView.getScrollState() != RecyclerView.SCROLL_STATE_IDLE && !isScrollingListView && isSwipingViewPager) {
isSwipingViewPager = false;
final MotionEvent cancelEvent = MotionEvent.obtain(ev);
cancelEvent.setAction(MotionEvent.ACTION_CANCEL);
super.onTouchEvent(cancelEvent);
cancelEvent.recycle();
return false;
}
final int action = ev.getAction();
if (action == MotionEvent.ACTION_DOWN) {
isScrollingListView = true;
isSwipingViewPager = true;
scrolledByUser = true;
downPoint.set(ev.getX(), ev.getY());
//if (adapter.getCount() > 1) {
callback.onDown(ev.getX() < getWidth() / 3f);
//}
isDownReleased = false;
} else if (action == MotionEvent.ACTION_UP) {
if (!isDownReleased) {
final int itemsCount = adapter.getCount();
int currentItem = getCurrentItem();
if (itemsCount > 1) {
if (ev.getX() > getWidth() / 3f) {
final int extraCount = adapter.getExtraCount();
if (++currentItem >= itemsCount - extraCount) {
currentItem = extraCount;
}
} else {
final int extraCount = adapter.getExtraCount();
if (--currentItem < extraCount) {
currentItem = itemsCount - extraCount - 1;
}
}
callback.onRelease();
setCurrentItem(currentItem, false);
}
}
} else if (action == MotionEvent.ACTION_MOVE) {
final float dx = ev.getX() - downPoint.x;
final float dy = ev.getY() - downPoint.y;
boolean move = Math.abs(dy) >= touchSlop || Math.abs(dx) >= touchSlop;
if (move) {
isDownReleased = true;
callback.onRelease();
}
if (isSwipingViewPager && isScrollingListView) {
if (move) {
if (Math.abs(dy) > Math.abs(dx)) {
isSwipingViewPager = false;
final MotionEvent cancelEvent = MotionEvent.obtain(ev);
cancelEvent.setAction(MotionEvent.ACTION_CANCEL);
super.onTouchEvent(cancelEvent);
cancelEvent.recycle();
} else {
isScrollingListView = false;
final MotionEvent cancelEvent = MotionEvent.obtain(ev);
cancelEvent.setAction(MotionEvent.ACTION_CANCEL);
parentListView.onTouchEvent(cancelEvent);
cancelEvent.recycle();
}
}
} else if (isSwipingViewPager && !canScrollHorizontally(-1) && dx > touchSlop) {
return false;
}
}
boolean result = false;
if (isScrollingListView) {
result |= parentListView.onTouchEvent(ev);
}
if (isSwipingViewPager) {
result |= super.onTouchEvent(ev);
}
if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
isScrollingListView = false;
isSwipingViewPager = false;
}
return result;
}
//
// @Override
// public boolean onTouchEvent(MotionEvent ev) {
// if (parentListView.getScrollState() != RecyclerView.SCROLL_STATE_IDLE && !isScrollingListView && isSwipingViewPager) {
// isSwipingViewPager = false;
// final MotionEvent cancelEvent = MotionEvent.obtain(ev);
// cancelEvent.setAction(MotionEvent.ACTION_CANCEL);
// super.onTouchEvent(cancelEvent);
// cancelEvent.recycle();
// return false;
// }
//
// final int action = ev.getAction();
// if (action == MotionEvent.ACTION_DOWN) {
//
// isScrollingListView = true;
// isSwipingViewPager = true;
// scrolledByUser = true;
// downPoint.set(ev.getX(), ev.getY());
// //if (adapter.getCount() > 1) {
// callback.onDown(ev.getX() < getWidth() / 3f);
// //}
// isDownReleased = false;
// } else if (action == MotionEvent.ACTION_UP) {
// if (!isDownReleased) {
// final int itemsCount = adapter.getCount();
// int currentItem = getCurrentItem();
// if (itemsCount > 1) {
// if (ev.getX() > getWidth() / 3f) {
// final int extraCount = adapter.getExtraCount();
// if (++currentItem >= itemsCount - extraCount) {
// currentItem = extraCount;
// }
// } else {
// final int extraCount = adapter.getExtraCount();
// if (--currentItem < extraCount) {
// currentItem = itemsCount - extraCount - 1;
// }
// }
// callback.onRelease();
// setCurrentItem(currentItem, false);
// }
// }
// } else if (action == MotionEvent.ACTION_MOVE) {
// final float dx = ev.getX() - downPoint.x;
// final float dy = ev.getY() - downPoint.y;
// boolean move = Math.abs(dy) >= touchSlop || Math.abs(dx) >= touchSlop;
// if (move) {
// isDownReleased = true;
// callback.onRelease();
// }
// if (isSwipingViewPager && isScrollingListView) {
// if (move) {
// if (Math.abs(dy) > Math.abs(dx)) {
// isSwipingViewPager = false;
// final MotionEvent cancelEvent = MotionEvent.obtain(ev);
// cancelEvent.setAction(MotionEvent.ACTION_CANCEL);
// super.onTouchEvent(cancelEvent);
// cancelEvent.recycle();
// } else {
// isScrollingListView = false;
// final MotionEvent cancelEvent = MotionEvent.obtain(ev);
// cancelEvent.setAction(MotionEvent.ACTION_CANCEL);
// parentListView.onTouchEvent(cancelEvent);
// cancelEvent.recycle();
// }
// }
// } else if (isSwipingViewPager && !canScrollHorizontally(-1) && dx > touchSlop) {
// return false;
// }
// }
//
// boolean result = false;
//
// if (isScrollingListView) {
// result |= parentListView.onTouchEvent(ev);
// }
//
// if (isSwipingViewPager) {
// result |= super.onTouchEvent(ev);
// }
//
// if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
// isScrollingListView = false;
// isSwipingViewPager = false;
// }
//
// return result;
// }
public void setChatInfo(TLRPC.ChatFull chatFull) {
chatInfo = chatFull;
@ -574,7 +573,7 @@ public class ProfileGalleryView extends CircularViewPager implements Notificatio
imagesLocationsSizes.add(-1);
}
}
/*for (int a = 0; a < arrayList.size(); a++) {
for (int a = 0; a < arrayList.size(); a++) {
TLRPC.Photo photo = arrayList.get(a);
if (photo == null || photo instanceof TLRPC.TL_photoEmpty || photo.sizes == null) {
continue;
@ -629,7 +628,6 @@ public class ProfileGalleryView extends CircularViewPager implements Notificatio
}
}
loadNeighboringThumbs();
*/
getAdapter().notifyDataSetChanged();
if (!scrolledByUser) {
resetCurrentItem();
@ -783,6 +781,9 @@ public class ProfileGalleryView extends CircularViewPager implements Notificatio
}
});
getImageReceiver().setCrossfadeAlpha((byte) 2);
setOnClickListener(__ -> {
callback.onClick();;
});
}
@Override

View File

@ -37,7 +37,6 @@ import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
@ -172,7 +171,6 @@ import tw.nekomimi.nekogram.settings.NekoSettingsActivity;
import tw.nekomimi.nekogram.utils.AlertUtil;
import tw.nekomimi.nekogram.utils.EnvUtil;
import tw.nekomimi.nekogram.utils.FileUtil;
import tw.nekomimi.nekogram.utils.IoUtil;
import tw.nekomimi.nekogram.utils.LangsKt;
import tw.nekomimi.nekogram.utils.ProxyUtil;
import tw.nekomimi.nekogram.utils.ShareUtil;
@ -916,7 +914,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
@Override
public void onDown(boolean left) {
public void onClick() {
if (imageUpdater != null) {
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId());
@ -931,14 +929,6 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
openAvatar();
}
// pressedOverlayVisible[left ? 0 : 1] = true;
// postInvalidateOnAnimation();
}
@Override
public void onRelease() {
// Arrays.fill(pressedOverlayVisible, false);
// postInvalidateOnAnimation();
}
@Override
@ -2237,21 +2227,21 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
@Override
public void onItemClick(View view, int position, float x, float y) {
if (ProfileActivity.this.getParentActivity() == null) {
if (getParentActivity() == null) {
return;
}
if (position == settingsKeyRow) {
Bundle args = new Bundle();
args.putInt("chat_id", (int) (dialog_id >> 32));
ProfileActivity.this.presentFragment(new IdenticonActivity(args));
presentFragment(new IdenticonActivity(args));
} else if (position == settingsTimerRow) {
ProfileActivity.this.showDialog(AlertsCreator.createTTLAlert(ProfileActivity.this.getParentActivity(), currentEncryptedChat).create());
showDialog(AlertsCreator.createTTLAlert(getParentActivity(), currentEncryptedChat).create());
} else if (position == notificationsRow) {
if (LocaleController.isRTL && x <= AndroidUtilities.dp(76) || !LocaleController.isRTL && x >= view.getMeasuredWidth() - AndroidUtilities.dp(76)) {
NotificationsCheckCell checkCell = (NotificationsCheckCell) view;
boolean checked = !checkCell.isChecked();
boolean defaultEnabled = ProfileActivity.this.getNotificationsController().isGlobalNotificationsEnabled(did);
boolean defaultEnabled = getNotificationsController().isGlobalNotificationsEnabled(did);
if (checked) {
SharedPreferences preferences = MessagesController.getNotificationsSettings(currentAccount);
@ -2261,9 +2251,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
} else {
editor.putInt("notify2_" + did, 0);
}
ProfileActivity.this.getMessagesStorage().setDialogFlags(did, 0);
getMessagesStorage().setDialogFlags(did, 0);
editor.commit();
TLRPC.Dialog dialog = ProfileActivity.this.getMessagesController().dialogs_dict.get(did);
TLRPC.Dialog dialog = getMessagesController().dialogs_dict.get(did);
if (dialog != null) {
dialog.notify_settings = new TLRPC.TL_peerNotifySettings();
}
@ -2279,10 +2269,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
editor.putInt("notify2_" + did, 2);
flags = 1;
}
ProfileActivity.this.getNotificationsController().removeNotificationsForDialog(did);
ProfileActivity.this.getMessagesStorage().setDialogFlags(did, flags);
getNotificationsController().removeNotificationsForDialog(did);
getMessagesStorage().setDialogFlags(did, flags);
editor.commit();
TLRPC.Dialog dialog = ProfileActivity.this.getMessagesController().dialogs_dict.get(did);
TLRPC.Dialog dialog = getMessagesController().dialogs_dict.get(did);
if (dialog != null) {
dialog.notify_settings = new TLRPC.TL_peerNotifySettings();
if (defaultEnabled) {
@ -2290,7 +2280,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
}
}
ProfileActivity.this.getNotificationsController().updateServerNotificationsSettings(did);
getNotificationsController().updateServerNotificationsSettings(did);
checkCell.setChecked(checked);
RecyclerListView.Holder holder = (RecyclerListView.Holder) listView.findViewHolderForPosition(notificationsRow);
if (holder != null) {
@ -2300,12 +2290,12 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
AlertsCreator.showCustomNotificationsDialog(ProfileActivity.this, did, -1, null, currentAccount, param -> listAdapter.notifyItemChanged(notificationsRow));
} else if (position == unblockRow) {
ProfileActivity.this.getMessagesController().unblockUser(user_id);
getMessagesController().unblockUser(user_id);
AlertsCreator.showSimpleToast(ProfileActivity.this, LocaleController.getString("UserUnblocked", R.string.UserUnblocked));
} else if (position == sendMessageRow) {
writeButton.callOnClick();
} else if (position == reportRow) {
AlertsCreator.createReportAlert(ProfileActivity.this.getParentActivity(), ProfileActivity.this.getDialogId(), 0, ProfileActivity.this);
AlertsCreator.createReportAlert(getParentActivity(), getDialogId(), 0, ProfileActivity.this);
} else if (position >= membersStartRow && position < membersEndRow) {
TLRPC.ChatParticipant participant;
if (!sortedUsers.isEmpty()) {
@ -2313,20 +2303,20 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
} else {
participant = chatInfo.participants.participants.get(position - membersStartRow);
}
ProfileActivity.this.onMemberClick(participant, false);
onMemberClick(participant, false);
} else if (position == addMemberRow) {
ProfileActivity.this.openAddMember();
openAddMember();
} else if (position == usernameRow) {
if (currentChat != null) {
try {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
if (!TextUtils.isEmpty(chatInfo.about)) {
intent.putExtra(Intent.EXTRA_TEXT, currentChat.title + "\n" + chatInfo.about + "\nhttps://" + ProfileActivity.this.getMessagesController().linkPrefix + "/" + currentChat.username);
intent.putExtra(Intent.EXTRA_TEXT, currentChat.title + "\n" + chatInfo.about + "\nhttps://" + getMessagesController().linkPrefix + "/" + currentChat.username);
} else {
intent.putExtra(Intent.EXTRA_TEXT, currentChat.title + "\nhttps://" + ProfileActivity.this.getMessagesController().linkPrefix + "/" + currentChat.username);
intent.putExtra(Intent.EXTRA_TEXT, currentChat.title + "\nhttps://" + getMessagesController().linkPrefix + "/" + currentChat.username);
}
ProfileActivity.this.getParentActivity().startActivityForResult(Intent.createChooser(intent, LocaleController.getString("BotShare", R.string.BotShare)), 500);
getParentActivity().startActivityForResult(Intent.createChooser(intent, LocaleController.getString("BotShare", R.string.BotShare)), 500);
} catch (Exception e) {
FileLog.e(e);
}
@ -2335,10 +2325,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
if (chatInfo.location instanceof TLRPC.TL_channelLocation) {
LocationActivity fragment = new LocationActivity(LocationActivity.LOCATION_TYPE_GROUP_VIEW);
fragment.setChatLocation(chat_id, (TLRPC.TL_channelLocation) chatInfo.location);
ProfileActivity.this.presentFragment(fragment);
presentFragment(fragment);
}
} else if (position == joinRow) {
ProfileActivity.this.getMessagesController().addUserToChat(currentChat.id, ProfileActivity.this.getUserConfig().getCurrentUser(), null, 0, null, ProfileActivity.this, null);
getMessagesController().addUserToChat(currentChat.id, getUserConfig().getCurrentUser(), null, 0, null, ProfileActivity.this, null);
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.closeSearchByActiveAction);
} else if (position == subscribersRow) {
Bundle args = new Bundle();
@ -2346,21 +2336,21 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
args.putInt("type", ChatUsersActivity.TYPE_USERS);
ChatUsersActivity fragment = new ChatUsersActivity(args);
fragment.setInfo(chatInfo);
ProfileActivity.this.presentFragment(fragment);
presentFragment(fragment);
} else if (position == administratorsRow) {
Bundle args = new Bundle();
args.putInt("chat_id", chat_id);
args.putInt("type", ChatUsersActivity.TYPE_ADMIN);
ChatUsersActivity fragment = new ChatUsersActivity(args);
fragment.setInfo(chatInfo);
ProfileActivity.this.presentFragment(fragment);
presentFragment(fragment);
} else if (position == blockedUsersRow) {
Bundle args = new Bundle();
args.putInt("chat_id", chat_id);
args.putInt("type", ChatUsersActivity.TYPE_BANNED);
ChatUsersActivity fragment = new ChatUsersActivity(args);
fragment.setInfo(chatInfo);
ProfileActivity.this.presentFragment(fragment);
presentFragment(fragment);
} else if (position == notificationRow) {
presentFragment(new NotificationsSettingsActivity());
} else if (position == privacyRow) {
@ -2457,22 +2447,22 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
builder.addTitle(number);
builder.addItem(LocaleController.getString("Edit",R.string.Edit),R.drawable.baseline_edit_24, __ -> {
builder.addItem(LocaleController.getString("Edit", R.string.Edit), R.drawable.baseline_edit_24, __ -> {
presentFragment(new ActionIntroActivity(ActionIntroActivity.ACTION_TYPE_CHANGE_PHONE_NUMBER));
return Unit.INSTANCE;
});
builder.addItem(LocaleController.getString("Call",R.string.Call),R.drawable.baseline_call_24, __ -> {
AlertUtil.call(user.phone);
builder.addItem(LocaleController.getString("Call", R.string.Call), R.drawable.baseline_call_24, __ -> {
AlertUtil.call(user.phone);
return Unit.INSTANCE;
});
builder.addItem(LocaleController.getString("Copy",R.string.Copy),R.drawable.baseline_content_copy_24, __ -> {
AlertUtil.copyAndAlert(number);
builder.addItem(LocaleController.getString("Copy", R.string.Copy), R.drawable.baseline_content_copy_24, __ -> {
AlertUtil.copyAndAlert(number);
return Unit.INSTANCE;
});
builder.addItem(LocaleController.getString("ShareContact",R.string.ShareContact),R.drawable.baseline_forward_24, __ -> {
builder.addItem(LocaleController.getString("ShareContact", R.string.ShareContact), R.drawable.baseline_forward_24, __ -> {
Bundle args = new Bundle();
args.putBoolean("onlySelect", true);
args.putInt("dialogsType", 3);
@ -3419,17 +3409,17 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
builder.addTitle(number);
builder.addItem(LocaleController.getString("Call",R.string.Call),R.drawable.baseline_call_24, __ -> {
builder.addItem(LocaleController.getString("Call", R.string.Call), R.drawable.baseline_call_24, __ -> {
AlertUtil.call(user.phone);
return Unit.INSTANCE;
});
builder.addItem(LocaleController.getString("Copy",R.string.Copy),R.drawable.baseline_content_copy_24, __ -> {
builder.addItem(LocaleController.getString("Copy", R.string.Copy), R.drawable.baseline_content_copy_24, __ -> {
AlertUtil.copyAndAlert(number);
return Unit.INSTANCE;
});
builder.addItem(LocaleController.getString("ShareContact",R.string.ShareContact),R.drawable.baseline_forward_24, __ -> {
builder.addItem(LocaleController.getString("ShareContact", R.string.ShareContact), R.drawable.baseline_forward_24, __ -> {
Bundle args = new Bundle();
args.putBoolean("onlySelect", true);
args.putInt("dialogsType", 3);
@ -5144,6 +5134,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
int id = 0;
if (user_id != 0) {
TLRPC.User user = getMessagesController().getUser(user_id);
if (user == null) return;
TLRPC.FileLocation photoBig = null;
if (user.photo != null) {
photoBig = user.photo.photo_big;
@ -5879,42 +5870,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
avatarAnimation.cancel();
avatarAnimation = null;
}
if (animated) {
avatarAnimation = new AnimatorSet();
if (show) {
avatarProgressView.setVisibility(View.VISIBLE);
avatarAnimation.playTogether(ObjectAnimator.ofFloat(avatarProgressView, View.ALPHA, 1.0f));
} else {
avatarAnimation.playTogether(ObjectAnimator.ofFloat(avatarProgressView, View.ALPHA, 0.0f));
}
avatarAnimation.setDuration(180);
avatarAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (avatarAnimation == null || avatarProgressView == null) {
return;
}
if (!show) {
avatarProgressView.setVisibility(View.INVISIBLE);
}
avatarAnimation = null;
}
@Override
public void onAnimationCancel(Animator animation) {
avatarAnimation = null;
}
});
avatarAnimation.start();
} else {
if (show) {
avatarProgressView.setAlpha(1.0f);
avatarProgressView.setVisibility(View.VISIBLE);
} else {
avatarProgressView.setAlpha(0.0f);
avatarProgressView.setVisibility(View.INVISIBLE);
}
}
avatarProgressView.setAlpha(0.0f);
avatarProgressView.setVisibility(View.INVISIBLE);
}
@Override
@ -5948,11 +5907,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
try {
Process process = RuntimeUtil.exec("logcat", "-d");
RuntimeUtil.exec("logcat", "-df", logcatFile.getPath()).waitFor();
IoUtil.copy(process, logcatFile);
RuntimeUtil.exec("logcat", "-c");
RuntimeUtil.exec("logcat", "-c").waitFor();
ShareUtil.shareFile(getParentActivity(), logcatFile);
@ -6427,16 +6384,6 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
@Override
public boolean isEnabled(RecyclerView.ViewHolder holder) {
if (notificationRow != -1) {
int position = holder.getAdapterPosition();
return position == notificationRow || position == numberRow || position == privacyRow ||
position == languageRow || position == setUsernameRow || position == bioRow ||
position == versionRow || position == dataRow || position == chatRow ||
position == questionRow || position == devicesRow || position == filtersRow ||
position == faqRow || position == policyRow || position == sendLogsRow ||
position == clearLogsRow || position == switchBackendRow || position == setAvatarRow ||
position == nekoRow;
}
int type = holder.getItemViewType();
return type != 1 && type != 5 && type != 7 && type != 9 && type != 10 && type != 11 && type != 12 && type != 13;
}
@ -6456,16 +6403,6 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
return 2;
} else if (position == userInfoRow || position == channelInfoRow) {
return 3;
} else if (position == settingsTimerRow || position == settingsKeyRow || position == reportRow ||
position == subscribersRow || position == administratorsRow || position == blockedUsersRow ||
position == addMemberRow || position == joinRow || position == unblockRow ||
position == sendMessageRow || position == notificationRow || position == privacyRow ||
position == languageRow || position == dataRow || position == chatRow ||
position == questionRow || position == devicesRow || position == filtersRow ||
position == faqRow || position == policyRow || position == sendLogsRow ||
position == clearLogsRow || position == switchBackendRow || position == setAvatarRow ||
position == nekoRow || position == stickersRow) {
return 4;
} else if (position == notificationsDividerRow) {
return 5;
} else if (position == notificationsRow) {
@ -6485,7 +6422,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
} else if (position == versionRow) {
return 14;
}
return 0;
return 4;
}
}

View File

@ -304,7 +304,7 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.didUpdateConnectionState);
final SharedPreferences preferences = MessagesController.getGlobalMainSettings();
useProxySettings = SharedConfig.proxyEnabled && !SharedConfig.proxyList.isEmpty();
useProxySettings = SharedConfig.proxyEnabled && !proxyList.isEmpty();
useProxyForCalls = preferences.getBoolean("proxy_enabled_calls", false);
updateRows(true);
@ -728,7 +728,7 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
editor.putBoolean("proxy_enabled_calls", useProxyForCalls);
editor.apply();
} else if (position >= proxyStartRow && position < proxyEndRow) {
SharedConfig.ProxyInfo info = SharedConfig.proxyList.get(position - proxyStartRow);
SharedConfig.ProxyInfo info = proxyList.get(position - proxyStartRow);
useProxySettings = true;
SharedConfig.setCurrentProxy(info);
updateRows(true);
@ -952,13 +952,14 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
}
private void updateRows(boolean notify) {
proxyList = SharedConfig.getProxyList();
rowCount = 0;
useProxyRow = rowCount++;
useProxyDetailRow = rowCount++;
connectionsHeaderRow = rowCount++;
if (!SharedConfig.proxyList.isEmpty()) {
if (!proxyList.isEmpty()) {
proxyStartRow = rowCount;
rowCount += SharedConfig.proxyList.size();
rowCount += proxyList.size();
proxyEndRow = rowCount;
} else {
proxyStartRow = -1;
@ -1255,7 +1256,7 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
if (currentConnectionState != state) {
currentConnectionState = state;
if (listView != null && SharedConfig.currentProxy != null) {
int idx = SharedConfig.proxyList.indexOf(SharedConfig.currentProxy);
int idx = proxyList.indexOf(SharedConfig.currentProxy);
if (idx >= 0) {
RecyclerListView.Holder holder = (RecyclerListView.Holder) listView.findViewHolderForAdapterPosition(idx + proxyStartRow);
if (holder != null && holder.itemView instanceof TextDetailProxyCell) {
@ -1271,7 +1272,7 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
updateRows(true);
} else {
SharedConfig.ProxyInfo proxyInfo = (SharedConfig.ProxyInfo) args[0];
int idx = SharedConfig.proxyList.indexOf(proxyInfo);
int idx = proxyList.indexOf(proxyInfo);
if (idx >= 0) {
RecyclerListView.Holder holder = (RecyclerListView.Holder) listView.findViewHolderForAdapterPosition(idx + proxyStartRow);
if (holder != null && holder.itemView instanceof TextDetailProxyCell) {
@ -1336,9 +1337,11 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
}
case 5: {
TextDetailProxyCell cell = (TextDetailProxyCell) holder.itemView;
SharedConfig.ProxyInfo info = SharedConfig.proxyList.get(position - proxyStartRow);
cell.setProxy(info);
cell.setChecked(SharedConfig.currentProxy == info);
try {
SharedConfig.ProxyInfo info = proxyList.get(position - proxyStartRow);
cell.setProxy(info);
cell.setChecked(SharedConfig.currentProxy == info);
} catch (IndexOutOfBoundsException e) {}
break;
}
}

View File

@ -23,9 +23,11 @@ fun mkDatabase(name: String): Nitrite {
.filePath(file.path)
.openOrCreate()!!
}
}.onFailure {
file.deleteRecursively()
file.deleteRecursively()
}
return Nitrite.builder().compressed()
.filePath(file.path)

View File

@ -206,6 +206,10 @@ object FileUtil {
FileLog.d("lib extracted with default abi$index ($abi): $execFile")
}.onFailure {
FileLog.d("$abi: ${it.message ?: it.javaClass.simpleName}")
}
}

20
bin/init_release.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
function assemble() {
./gradlew TMessagesProj:assembleFullRelease \
TMessagesProj:assembleFullReleaseNoGcm \
TMessagesProj:assembleMiniRelease \
TMessagesProj:assembleMiniReleaseNoGcm \
TMessagesProj:assembleMiniNoEmojiRelease \
TMessagesProj:assembleMiniNoEmojiReleaseNoGcm
return $?
}
#./gradlew TMessagesProj:assembleRelease \
# TMessagesProj:assembleReleaseNoGcm
assemble &&
assemble

View File

@ -10,7 +10,7 @@ if [ ! -x "$(command -v ghr)" ]; then
fi
rm -rf build/apks &&
mkdir -p build/apks &&
find TMessagesProj/build/outputs/apk -name "*.apk" -exec cp {} build/apks \; &&
ghr -delete -n "$1" "$1" build/apks/
rm -rf build/release &&
mkdir -p build/release &&
find TMessagesProj/build/outputs/apk -name "*.apk" -exec cp {} build/release \; &&
ghr -delete -n "$1" "$1" build/release

View File

@ -1,23 +1,6 @@
#!/usr/bin/env bash
function assemble() {
./gradlew TMessagesProj:assembleFullRelease \
TMessagesProj:assembleFullReleaseNoGcm \
TMessagesProj:assembleMiniRelease \
TMessagesProj:assembleMiniReleaseNoGcm \
TMessagesProj:assembleMiniNoEmojiRelease \
TMessagesProj:assembleMiniNoEmojiReleaseNoGcm
return $?
}
#./gradlew TMessagesProj:assembleRelease \
# TMessagesProj:assembleReleaseNoGcm
assemble &&
assemble &&
./bin/publish_release_apks.sh "$1" #&&
#./bin/publish_repo_apks.sh &&
#./bin/publish_play.sh
./bin/init_release.sh &&
./bin/publish_release_apks.sh "$1" &&
./bin/publish_repo_apks.sh &&
./bin/publish_play.sh