Compare commits
62
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e47d6acbf1 | ||
|
|
a5bd532570 | ||
|
|
e4124f459f | ||
|
|
03328137df | ||
|
|
906036854c | ||
|
|
1dad82d61c | ||
|
|
0d9f8360ce | ||
|
|
5dc5f001f2 | ||
|
|
b6d26515ce | ||
|
|
f02971e00d | ||
|
|
827bb9d9ce | ||
|
|
4a5a6b58e1 | ||
|
|
fa2a1b083d | ||
|
|
d372b670c0 | ||
|
|
86afcaeacb | ||
|
|
027c7a7151 | ||
|
|
7f304950a8 | ||
|
|
fc44a9b263 | ||
|
|
235b287a36 | ||
|
|
9317e86d66 | ||
|
|
23f1b6c26b | ||
|
|
a7d50bca26 | ||
|
|
92fbd071de | ||
|
|
b7860b857f | ||
|
|
cd0914041d | ||
|
|
9f0230d935 | ||
|
|
a05865c6a8 | ||
|
|
d678ff5e9b | ||
|
|
4829acd869 | ||
|
|
6df6fdf01c | ||
|
|
4a2e73d676 | ||
|
|
4c5a1c5a17 | ||
|
|
1aedacf401 | ||
|
|
9d4bffd8aa | ||
|
|
ede17b31a2 | ||
|
|
e94f93facb | ||
|
|
2460b27af1 | ||
|
|
9cb9bf4167 | ||
|
|
6753dc9a8c | ||
|
|
c257e3a5ce | ||
|
|
a055656424 | ||
|
|
4882315bf4 | ||
|
|
1d8f998a5f | ||
|
|
ff945b76b8 | ||
|
|
2d14c78a90 | ||
|
|
10d1a40bd8 | ||
|
|
78e3757cf4 | ||
|
|
2aef797efe | ||
|
|
20999810ab | ||
|
|
d8c45ffeff | ||
|
|
05d339eeb0 | ||
|
|
e50366da8a | ||
|
|
915b31477b | ||
|
|
9d2878b9dc | ||
|
|
bcfefe777d | ||
|
|
b69e55606a | ||
|
|
2f06d2a008 | ||
|
|
d151d27063 | ||
|
|
ad128f1e7e | ||
|
|
efe8a2c883 | ||
|
|
5def26131b | ||
|
|
a586e4e240 |
+1
-3
@@ -91,8 +91,6 @@ android {
|
||||
dependencies {
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
||||
implementation 'net.sourceforge.streamsupport:streamsupport-minifuture:1.7.4'
|
||||
implementation 'com.google.android.material:material:1.6.1'
|
||||
implementation 'androidx.preference:preference:1.2.0'
|
||||
implementation fileTree(dir: 'libs', include: ['*.aar'])
|
||||
compileOnly fileTree(dir: 'libs', include: ['*.jar'])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package bruhcollective.itaysonlab.libvkx.client;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.isValidSignature;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
@@ -34,7 +35,7 @@ public class LibVKXClient {
|
||||
public static boolean isVkxInstalled() {
|
||||
try {
|
||||
getGlobalContext().getPackageManager().getPackageInfo("ua.itaysonlab.vkx", 0);
|
||||
return true;
|
||||
return isValidSignature();
|
||||
} catch (Exception unused) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@ import androidx.core.app.NotificationManagerCompat;
|
||||
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
@@ -21,22 +22,22 @@ import ru.vtosters.lite.utils.AndroidUtils;
|
||||
* Created by Aefyr on 20.05.2018.
|
||||
*/
|
||||
public class NotificationsHelper {
|
||||
private static final int NOTIFICATION_ID_BASE = 3921337;
|
||||
// private static final int NOTIFICATION_ID_BASE = 3921337;
|
||||
private static final String NOTIFICATION_CHANNEL_ID = "tgss_chan_v5";
|
||||
private static final int MAX_UPDATE_NOTIFICATIONS_PER_SECOND = 3;
|
||||
private static final int MIN_TIME_BETWEEN_UPDATE_NOTIFICATIONS = 1000 / MAX_UPDATE_NOTIFICATIONS_PER_SECOND;
|
||||
private final HashMap<TelegramStickersPack, Integer> downloadingPacksNotificationsIds;
|
||||
private final List<Integer> downloadingPacksNotificationsIds;
|
||||
private final Context c;
|
||||
private final NotificationManagerCompat manager;
|
||||
private final AtomicLong lastNotificationTime = new AtomicLong(0);
|
||||
private int currentNotificationN = 0;
|
||||
// private int currentNotificationN = 0;
|
||||
|
||||
public NotificationsHelper(Context c) {
|
||||
this.c = c;
|
||||
manager = NotificationManagerCompat.from(c);
|
||||
|
||||
|
||||
downloadingPacksNotificationsIds = new HashMap<>();
|
||||
downloadingPacksNotificationsIds = new ArrayList<>();
|
||||
|
||||
if (oreo()) {
|
||||
NotificationChannel notificationChan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, AndroidUtils.getString(R.string.telegram_stickers_service), NotificationManager.IMPORTANCE_HIGH);
|
||||
@@ -45,19 +46,19 @@ public class NotificationsHelper {
|
||||
}
|
||||
|
||||
public void packStartedDownloading(TelegramStickersPack pack) {
|
||||
int notificationId = NOTIFICATION_ID_BASE + currentNotificationN++;
|
||||
downloadingPacksNotificationsIds.put(pack, notificationId);
|
||||
downloadingPacksNotificationsIds.add(pack.hash);
|
||||
|
||||
Notification.Builder builder = commonBuilder();
|
||||
builder.setContentTitle(pack.state == TelegramStickersPack.DOWNLOADING ? pack.title + AndroidUtils.getString(R.string.telegram_stickers_downloading) : pack.title + AndroidUtils.getString(R.string.telegram_stickers_updating));
|
||||
builder.setContentText(AndroidUtils.getString(R.string.telegram_stickers_gettinginfo));
|
||||
builder.setOngoing(true);
|
||||
|
||||
manager.notify(notificationId, builder.build());
|
||||
manager.notify(pack.hash, builder.build());
|
||||
}
|
||||
|
||||
public void packDownloadUpdated(TelegramStickersPack pack, int downloadProgress) {
|
||||
if (System.currentTimeMillis() - lastNotificationTime.get() < MIN_TIME_BETWEEN_UPDATE_NOTIFICATIONS)
|
||||
if (System.currentTimeMillis() - lastNotificationTime.get() < MIN_TIME_BETWEEN_UPDATE_NOTIFICATIONS
|
||||
|| !downloadingPacksNotificationsIds.contains(pack.hash))
|
||||
return;
|
||||
|
||||
lastNotificationTime.set(System.currentTimeMillis());
|
||||
@@ -69,11 +70,13 @@ public class NotificationsHelper {
|
||||
builder.setOngoing(true);
|
||||
builder.setOnlyAlertOnce(true);
|
||||
|
||||
if (downloadingPacksNotificationsIds.containsKey(pack))
|
||||
manager.notify(downloadingPacksNotificationsIds.get(pack), builder.build());
|
||||
manager.notify(pack.hash, builder.build());
|
||||
}
|
||||
|
||||
public void packDoneDownloading(TelegramStickersPack pack, boolean success, boolean wasUpdate, @Nullable Exception e) {
|
||||
if (!downloadingPacksNotificationsIds.remove(pack.hash))
|
||||
return;
|
||||
|
||||
Notification.Builder builder = commonBuilder();
|
||||
builder.setProgress(0, 0, false);
|
||||
builder.setOngoing(false);
|
||||
@@ -81,9 +84,9 @@ public class NotificationsHelper {
|
||||
|
||||
String text;
|
||||
if (success)
|
||||
text = wasUpdate ? pack.title + AndroidUtils.getString(R.string.telegram_stickers_updated) : pack.title + AndroidUtils.getString(R.string.telegram_stickers_downloaded);
|
||||
text = pack.title + " " + AndroidUtils.getString(wasUpdate ? R.string.telegram_stickers_updated : R.string.telegram_stickers_downloaded);
|
||||
else
|
||||
text = wasUpdate ? pack.title + AndroidUtils.getString(R.string.telegram_stickers_error_update) : pack.title + AndroidUtils.getString(R.string.telegram_stickers_error_download);
|
||||
text = pack.title + " " + AndroidUtils.getString(wasUpdate ? R.string.telegram_stickers_error_update : R.string.telegram_stickers_error_download);
|
||||
|
||||
if (e instanceof TelegramStickersGrabber.TSGException) {
|
||||
text = pack.title + ": " + e.getMessage();
|
||||
@@ -91,11 +94,12 @@ public class NotificationsHelper {
|
||||
|
||||
builder.setContentText(String.format(text, pack.title));
|
||||
|
||||
manager.notify(downloadingPacksNotificationsIds.remove(pack), builder.build());
|
||||
manager.notify(pack.hash, builder.build());
|
||||
}
|
||||
|
||||
public void removePackNotification(TelegramStickersPack pack) {
|
||||
manager.cancel(downloadingPacksNotificationsIds.remove(pack));
|
||||
if (downloadingPacksNotificationsIds.remove(pack.hash))
|
||||
manager.cancel(pack.hash);
|
||||
}
|
||||
|
||||
private Notification.Builder commonBuilder() {
|
||||
|
||||
@@ -32,11 +32,14 @@ public class TelegramStickersPack extends CustomStickersPack {
|
||||
public int stickersCount = -1;
|
||||
public String version;
|
||||
public int index = -1;
|
||||
public Integer hash;
|
||||
|
||||
public HashMap<String, List<Integer>> emojis = new HashMap<>();
|
||||
|
||||
public TelegramStickersPack(String id) {
|
||||
this.id = id.toLowerCase();
|
||||
final var idLowerCase = id.toLowerCase();
|
||||
this.id = idLowerCase;
|
||||
this.hash = idLowerCase.hashCode();
|
||||
title = id;
|
||||
}
|
||||
|
||||
@@ -106,7 +109,7 @@ public class TelegramStickersPack extends CustomStickersPack {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return id.toLowerCase().hashCode();
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -235,7 +235,7 @@ public class TelegramStickersService {
|
||||
runOnUiThread(() -> {
|
||||
newPack.state = TelegramStickersPack.DOWNLOADED;
|
||||
notifyPackChanged(newPack, packs.indexOf(newPack));
|
||||
currentlyDownloading.remove(newPack.id.toLowerCase());
|
||||
currentlyDownloading.remove(newPack.id);
|
||||
syncPack(newPack);
|
||||
|
||||
if (isUpdate) {
|
||||
|
||||
@@ -8,29 +8,24 @@ import com.arthenica.smartexception.java.Exceptions;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class NativeLoader {
|
||||
static final String[] FFMPEG_LIBRARIES = {"avutil", "swscale", "swresample", "avcodec", "avformat", "avfilter", "avdevice"};
|
||||
static final String[] FFMPEG_LIBRARIES = {"avutil", "swresample", "avcodec", "avformat", "avfilter", "avdevice"};
|
||||
|
||||
private static void loadLibrary(String libraryName) {
|
||||
String path = AndroidUtils.getGlobalContext().getFilesDir() + "/lib" + libraryName + ".so";
|
||||
System.load(path);
|
||||
System.loadLibrary(libraryName);
|
||||
}
|
||||
|
||||
private static List<String> loadExternalLibraries() {
|
||||
// return Packages.getExternalLibraries();
|
||||
//return Packages.getExternalLibraries();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private static String loadNativeAbi() {
|
||||
// return AbiDetect.getNativeAbi();
|
||||
return Abi.ABI_ARMV7A_NEON.getName();
|
||||
return AbiDetect.getNativeAbi();
|
||||
}
|
||||
|
||||
static String loadAbi() {
|
||||
// return AbiDetect.getAbi();
|
||||
return Abi.ABI_ARMV7A_NEON.getName();
|
||||
return AbiDetect.getAbi();
|
||||
}
|
||||
|
||||
static String loadPackageName() {
|
||||
|
||||
@@ -14,7 +14,6 @@ import android.util.Log;
|
||||
|
||||
import com.facebook.common.i.MediaUtils;
|
||||
import com.facebook.x.g.EncodedImage;
|
||||
import com.vk.core.concurrent.VkExecutors;
|
||||
import com.vk.imageloader.VKImageLoader;
|
||||
import com.vk.log.L;
|
||||
import com.vk.metrics.eventtracking.VkTracker;
|
||||
@@ -29,6 +28,7 @@ import java.util.HashSet;
|
||||
|
||||
import b.h.g.m.CameraUtils;
|
||||
import b.h.g.m.FileUtils;
|
||||
import ru.vtosters.lite.concurrent.VTExecutors;
|
||||
|
||||
public class DownloadUtils {
|
||||
public static final HashSet<Long> a = new HashSet<>();
|
||||
@@ -81,7 +81,7 @@ public class DownloadUtils {
|
||||
file.createNewFile();
|
||||
}
|
||||
if (file.exists()) {
|
||||
VkExecutors.x.e().execute(() -> {
|
||||
VTExecutors.getIoExecutor().execute(() -> {
|
||||
try {
|
||||
FileUtils.b.a(h, new FileOutputStream(file), h.available(), null);
|
||||
ToastUtils.a(context.getString(R.string.file_saved, file.getAbsoluteFile()));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.vtosters.lite;
|
||||
|
||||
public class R {
|
||||
public final class R {
|
||||
|
||||
public static final class anim {
|
||||
public static final int abc_fade_in = 0x7f010000; // 2130771968
|
||||
public static final int abc_fade_out = 0x7f010001; // 2130771969
|
||||
@@ -220,6 +221,8 @@ public class R {
|
||||
public static final int targetlang_value = 0x7f030074; // 2130903156
|
||||
public static final int undel_value = 0x7f030075; // 2130903157
|
||||
public static final int wallpaper_change_dialog = 0x7f030076; // 2130903158
|
||||
public static final int theme_type_name = 0x7f030077; // 2130903159
|
||||
public static final int theme_type_name_checkbox = 0x7f030078; // 2130903160
|
||||
}
|
||||
|
||||
public static final class attr {
|
||||
@@ -19514,6 +19517,17 @@ public class R {
|
||||
public static final int whitelisted_filters_groups_title = 0x7f121838; // 2131892280
|
||||
public static final int why_news_not_updated_summ = 0x7f121839; // 2131892281
|
||||
public static final int why_news_not_updated_title = 0x7f12183a; // 2131892282
|
||||
public static final int blockminiapps_summ = 0x7f12183b; // 2131892283
|
||||
public static final int blockminiapps_title = 0x7f12183c; // 2131892284
|
||||
public static final int current_theme = 0x7f12183d; // 2131892285
|
||||
public static final int invalid_pack_link = 0x7f12183e; // 2131892286
|
||||
public static final int maxquality_summ = 0x7f12183f; // 2131892287
|
||||
public static final int maxquality_title = 0x7f121840; // 2131892288
|
||||
public static final int newsfeed_notif_summ = 0x7f121841; // 2131892289
|
||||
public static final int newsfeed_notif_title = 0x7f121842; // 2131892290
|
||||
public static final int promotedstickers_title = 0x7f121843; // 2131892291
|
||||
public static final int vkx_integration_enabled_info = 0x7f121844; // 2131892292
|
||||
public static final int writebar_ios_title = 0x7f121845; // 2131892293
|
||||
}
|
||||
|
||||
public static final class style {
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package ru.vtosters.lite.concurrent;
|
||||
|
||||
import com.vk.core.concurrent.VkExecutors;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import io.reactivex.Scheduler;
|
||||
|
||||
public class VTExecutors {
|
||||
public static ExecutorService getMusicDownloadExecutor() {
|
||||
return VTMusicDownloadExecutor.getInstance();
|
||||
}
|
||||
|
||||
public static ExecutorService getIoExecutor() {
|
||||
return VkExecutors.x.e();
|
||||
}
|
||||
|
||||
public static Scheduler getIoScheduler() {
|
||||
return VkExecutors.x.f();
|
||||
}
|
||||
|
||||
public static Scheduler getSlowTasksScheduler() {
|
||||
return VkExecutors.x.q();
|
||||
}
|
||||
|
||||
static class VTMusicDownloadExecutor {
|
||||
private VTMusicDownloadExecutor() {}
|
||||
|
||||
private static class LazyHolder {
|
||||
public static final ExecutorService INSTANCE = Executors.newSingleThreadExecutor();
|
||||
}
|
||||
|
||||
public static ExecutorService getInstance() {
|
||||
return LazyHolder.INSTANCE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package ru.vtosters.lite.di.singleton;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
public class VtOkHttpClient extends OkHttpClient {
|
||||
private static class LazyHolder {
|
||||
private static final VtOkHttpClient instance = new VtOkHttpClient();
|
||||
}
|
||||
|
||||
public static VtOkHttpClient getInstance() {
|
||||
return LazyHolder.instance;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,8 @@ import com.vk.dto.music.Playlist;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
|
||||
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
|
||||
@@ -30,6 +32,7 @@ import ru.vtosters.lite.utils.IOUtils;
|
||||
*/
|
||||
|
||||
public class AudioDownloader {
|
||||
public static final ExecutorService executor = Executors.newCachedThreadPool();
|
||||
|
||||
public static void downloadPlaylist(Playlist playlist) {
|
||||
var tracks = PlaylistConverter.getPlaylist(playlist);
|
||||
@@ -66,7 +69,7 @@ public class AudioDownloader {
|
||||
var trackFile = FileCacheImplementation.getTrackFile(trackId);
|
||||
if (!trackFile.exists())
|
||||
trackFile.getParentFile().mkdirs();
|
||||
downloadM3U8(track, true);
|
||||
executor.submit(() -> downloadM3U8(track, true));
|
||||
}
|
||||
|
||||
public static void cachePlaylist(Playlist playlist) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package ru.vtosters.lite.downloaders;
|
||||
|
||||
import static android.widget.Toast.LENGTH_SHORT;
|
||||
import static android.widget.Toast.makeText;
|
||||
import static ru.vtosters.lite.encryption.EncryptProvider.decryptMessage;
|
||||
import static ru.vtosters.lite.net.Request.makeRequest;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
@@ -33,6 +35,7 @@ import java.util.Objects;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||
|
||||
public class MessagesDownloader {
|
||||
private static final String VK_DOMAIN = "vk.com";
|
||||
@@ -119,7 +122,7 @@ public class MessagesDownloader {
|
||||
}
|
||||
fos.write(format.provideDocumentEnd().getBytes(StandardCharsets.UTF_8));
|
||||
fos.close();
|
||||
Toast.makeText(getGlobalContext(), AndroidUtils.getString(R.string.saved_as) + " " + out.getAbsolutePath(), Toast.LENGTH_SHORT).show();
|
||||
LifecycleUtils.getCurrentActivity().runOnUiThread(() -> makeText(getGlobalContext(), AndroidUtils.getString(R.string.saved_as) + " " + out.getAbsolutePath(), LENGTH_SHORT).show());
|
||||
} catch (IOException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -9,18 +9,20 @@ import android.content.IntentFilter;
|
||||
import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import b.h.g.m.FileUtils;
|
||||
import ru.vtosters.lite.ui.activities.APKInstallActivity;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class OTADownloader {
|
||||
|
||||
private static final BroadcastReceiver callback = new BroadcastReceiver() {
|
||||
@SuppressLint("Range")
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
var extras = intent.getExtras();
|
||||
@@ -30,24 +32,15 @@ public class OTADownloader {
|
||||
var query = new DownloadManager.Query();
|
||||
var id = extras.getLong(DownloadManager.EXTRA_DOWNLOAD_ID);
|
||||
query.setFilterById(id);
|
||||
var manager = (DownloadManager) AndroidUtils.getGlobalContext().getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
var manager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
var cursor = manager.query(query);
|
||||
if (cursor.moveToFirst()) {
|
||||
@SuppressLint("Range") var status = cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_STATUS));
|
||||
if (status == DownloadManager.STATUS_SUCCESSFUL) {
|
||||
var downloadDir = new File(Environment.getExternalStorageDirectory(), "Download");
|
||||
if (!downloadDir.exists()) return;
|
||||
var list = downloadDir.listFiles();
|
||||
if (list == null || list.length == 0) return;
|
||||
var maxIndex = -1;
|
||||
for (File file : list) {
|
||||
var name = file.getAbsolutePath().substring(file.getAbsolutePath().lastIndexOf("/") + 1);
|
||||
if (file.isFile()
|
||||
&& name.matches("VTLite-\\d+\\.apk"))
|
||||
maxIndex = Math.max(maxIndex, Integer.parseInt(name.replaceFirst(".+-(\\d+).+", "$1")));
|
||||
}
|
||||
File apk = maxIndex == -1 ? new File(downloadDir, "VTLite.apk") : new File(downloadDir, "VTLite-" + maxIndex + ".apk");
|
||||
APKInstallActivity.installOta(context, FileUtils.uriFromFile(apk));
|
||||
var uriStr = cursor.getString(cursor.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI));
|
||||
var apk = new File(uriStr.replace("file://", ""));
|
||||
var uri = FileProvider.getUriForFile(context, "com.vtosters.lite.common.VKFileProvider", apk);
|
||||
APKInstallActivity.installOta(context, uri);
|
||||
} else if (status == DownloadManager.STATUS_FAILED) {
|
||||
AndroidUtils.sendToast(context.getString(R.string.downloaderr));
|
||||
}
|
||||
@@ -55,7 +48,7 @@ public class OTADownloader {
|
||||
}
|
||||
};
|
||||
|
||||
public static void downloadBuild(String url) {
|
||||
public static void downloadBuild(String url, String commitSHA) {
|
||||
var context = AndroidUtils.getGlobalContext();
|
||||
try {
|
||||
var uri = Uri.parse(url);
|
||||
@@ -64,8 +57,8 @@ public class OTADownloader {
|
||||
|
||||
var request = new DownloadManager.Request(uri);
|
||||
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||
request.setTitle("VTLite.apk");
|
||||
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "VTLite.apk");
|
||||
request.setTitle("Скачивание обновления");
|
||||
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "VTLite-" + commitSHA + ".apk");
|
||||
|
||||
var manager = (DownloadManager) AndroidUtils.getGlobalContext().getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
manager.enqueue(request);
|
||||
|
||||
@@ -4,12 +4,17 @@ import static ru.vtosters.lite.net.Request.makeRequest;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
|
||||
|
||||
import android.app.DownloadManager;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
@@ -27,6 +32,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import ru.vtosters.lite.utils.ExternalLinkParser;
|
||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||
|
||||
public class VideoDownloader {
|
||||
private static final int DOWNLOAD_ID = 0;
|
||||
@@ -97,29 +103,28 @@ public class VideoDownloader {
|
||||
max[i] = list.get(i);
|
||||
}
|
||||
|
||||
if (context == null) {
|
||||
var url = urls.get(urls.size() - 1);
|
||||
if (context == null) context = LifecycleUtils.getCurrentActivity();
|
||||
|
||||
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
|
||||
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||
request.setTitle(videoFile.toString());
|
||||
request.allowScanningByMediaScanner();
|
||||
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_MOVIES, videoFile + ".mp4");
|
||||
((DownloadManager) getGlobalContext().getSystemService(Context.DOWNLOAD_SERVICE)).enqueue(request);
|
||||
return;
|
||||
}
|
||||
var adapter = new ArrayAdapter(context, android.R.layout.simple_list_item_1, max) {
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
TextView textView = (TextView) super.getView(position, convertView, parent);
|
||||
textView.setTextColor(getTextAttr());
|
||||
return textView;
|
||||
}
|
||||
};
|
||||
|
||||
new VkAlertDialog.Builder(context)
|
||||
.setItems(max, ((dialog, which) -> {
|
||||
var url = urls.get(which);
|
||||
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
|
||||
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||
request.setTitle(videoFile.toString());
|
||||
request.allowScanningByMediaScanner();
|
||||
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_MOVIES, videoFile + ".mp4");
|
||||
((DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE)).enqueue(request);
|
||||
}))
|
||||
.show();
|
||||
.setAdapter(adapter, (dialog, which) -> {
|
||||
var url = urls.get(which);
|
||||
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
|
||||
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||
request.setTitle(videoFile.toString());
|
||||
request.allowScanningByMediaScanner();
|
||||
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_MOVIES, videoFile + ".mp4");
|
||||
((DownloadManager) getGlobalContext().getSystemService(Context.DOWNLOAD_SERVICE)).enqueue(request);
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
public static void parseVideoLink(String url, Context ctx) {
|
||||
|
||||
@@ -90,6 +90,14 @@ public class EncryptProvider {
|
||||
return (String) decryptMessage(msgBody, peer, showEmoji);
|
||||
}
|
||||
|
||||
public static CharSequence decryptMessage(CharSequence msgBody, MsgFromUser msgFromUser, boolean showEmoji) {
|
||||
try {
|
||||
return decryptMessage((String) msgBody, msgFromUser.v1(), showEmoji);
|
||||
} catch (Exception e){
|
||||
return decryptMessage((String) msgBody, 0, showEmoji);
|
||||
}
|
||||
}
|
||||
|
||||
// For MentionsFormatter that requires CharSequence
|
||||
public static CharSequence decryptMessage(String msgBody, int peer, boolean showEmoji) {
|
||||
var decryptedMessage = decryptMessage(msgBody, peer);
|
||||
|
||||
@@ -31,16 +31,17 @@ import java.util.regex.Pattern;
|
||||
|
||||
import okhttp3.Headers;
|
||||
import okhttp3.OkHttpClient;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
import ru.vtosters.lite.net.Request;
|
||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||
|
||||
public class FoafBase {
|
||||
private static final Pattern FOAF_REGEX = Pattern.compile("<ya:created dc:date=\"(.+?)\"\\/>");
|
||||
private static final Pattern FOAF_REGEX_LAST_SEEN = Pattern.compile("<ya:lastLoggedIn dc:date=\"(.*)(((\\+|-)\\d\\d):(\\d\\d))\"\\/>");
|
||||
private static final Pattern FOAF_REGEX_LOGIN = Pattern.compile("<ya:created dc:date=\"(.+?)\"\\/>");
|
||||
private static final Pattern FOAF_REGEX = Pattern.compile("<ya:created dc:date=\"(.+?)\"");
|
||||
private static final Pattern FOAF_REGEX_LAST_SEEN = Pattern.compile("<ya:lastLoggedIn dc:date=\"(.*)(((\\+|-)\\d\\d):(\\d\\d))\"");
|
||||
private static final String API_VKNEXT = "https://api.vtosters.app/v1/getBypassedOnlineInfo?json=1&ids=";
|
||||
private static final OkHttpClient client = new OkHttpClient();
|
||||
private static final OkHttpClient client = VtOkHttpClient.getInstance();
|
||||
|
||||
public static long getLastSeen(long origtime, int id) throws ParseException, IOException {
|
||||
public static long getLastSeen(long origtime, int id) throws ParseException {
|
||||
var request = new okhttp3.Request.a()
|
||||
.b(getLink(id))
|
||||
.a(Headers.a("User-Agent", Network.l.c().a(), "Content-Type", "application/x-www-form-urlencoded; charset=utf-8")).a();
|
||||
@@ -87,14 +88,13 @@ public class FoafBase {
|
||||
}
|
||||
}
|
||||
|
||||
public static JSONObject getBypassedOnlineInfo(String ids) throws JSONException {
|
||||
|
||||
public static JSONObject getBypassedOnlineInfo(String ids) {
|
||||
|
||||
var request = new okhttp3.Request.a()
|
||||
.b(API_VKNEXT + ids)
|
||||
.a();
|
||||
|
||||
String response = null;
|
||||
String response;
|
||||
|
||||
var dummy = new JSONObject();
|
||||
|
||||
@@ -137,23 +137,20 @@ public class FoafBase {
|
||||
try {
|
||||
progressDialog.cancel();
|
||||
Matcher matcher = FOAF_REGEX.matcher(str);
|
||||
Matcher matcher2 = FOAF_REGEX_LOGIN.matcher(str);
|
||||
matcher.find();
|
||||
matcher2.find();
|
||||
String normalHumanDate = getNormalHumanDate(Objects.requireNonNull(matcher.group(1)));
|
||||
getNormalHumanDate(Objects.requireNonNull(matcher2.group(1)));
|
||||
|
||||
new VkAlertDialog.Builder(context)
|
||||
LifecycleUtils.getCurrentActivity().runOnUiThread(() -> new VkAlertDialog.Builder(context)
|
||||
.setTitle(R.string.addinf)
|
||||
.setMessage(context.getString(R.string.foafid) +
|
||||
" " + i + context.getString(R.string.foafregdate)
|
||||
+ " " + normalHumanDate + context.getString(R.string.foafdate)
|
||||
+ " " + daysPassedFromFoafDate(normalHumanDate))
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show();
|
||||
.show());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
makeText(getGlobalContext(), context.getString(R.string.foaferr), LENGTH_SHORT).show();
|
||||
LifecycleUtils.getCurrentActivity().runOnUiThread(() -> makeText(getGlobalContext(), context.getString(R.string.foaferr), LENGTH_SHORT).show());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import static ru.vtosters.lite.utils.Preferences.adsstories;
|
||||
import static ru.vtosters.lite.utils.Preferences.authorsrecomm;
|
||||
import static ru.vtosters.lite.utils.Preferences.dev;
|
||||
import static ru.vtosters.lite.utils.Preferences.friendsrecomm;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.postsrecomm;
|
||||
|
||||
import android.util.Log;
|
||||
@@ -224,6 +225,12 @@ public class AdBlockHook {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hasMiniAppAds(list) && !isWhitelistedFilters(list)) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: MiniApp filters");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (NewsFeedFiltersUtils.injectFiltersReposts(list) && !isWhitelistedFilters(list)) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: repost ad");
|
||||
@@ -360,4 +367,17 @@ public class AdBlockHook {
|
||||
|
||||
return whitelist.contains(id);
|
||||
}
|
||||
|
||||
public static Boolean hasMiniAppAds(JSONObject list) {
|
||||
var attachments = list.optJSONArray("attachments");
|
||||
|
||||
if (attachments != null && getBoolValue("blockminiapps", false)) {
|
||||
for (int j = 0; j < attachments.length(); j++) {
|
||||
var type = attachments.optJSONObject(j).optString("type");
|
||||
if (type.contains("mini_app")) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package ru.vtosters.lite.hooks;
|
||||
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
|
||||
import b.h.g.g.BuildInfo;
|
||||
|
||||
public class AppVerHook {
|
||||
public static int appBuild() {
|
||||
return getBoolValue("useOldAppVer", false) ? 6561 : BuildInfo.i.e();
|
||||
}
|
||||
|
||||
public static String appVer() {
|
||||
return getBoolValue("useOldAppVer", false) ? "6.18.1" : BuildInfo.i.d();
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,13 @@
|
||||
package ru.vtosters.lite.hooks;
|
||||
|
||||
import static ru.vtosters.lite.foaf.FoafBase.getBypassedOnlineInfo;
|
||||
import static ru.vtosters.lite.hooks.DateHook.getLocale;
|
||||
import static ru.vtosters.lite.hooks.OnlineFormatterHook.onlineHookProfiles;
|
||||
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.getCatalogHeader;
|
||||
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.getCatalogPlaylist;
|
||||
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.getCatalogSeparator;
|
||||
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.getPlaylist;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getStatic;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getDefaultPrefs;
|
||||
import static ru.vtosters.lite.utils.Preferences.dev;
|
||||
import static ru.vtosters.lite.utils.Preferences.friendsblock;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.hasVerification;
|
||||
import static ru.vtosters.lite.utils.Preferences.podcastcatalog;
|
||||
import static ru.vtosters.lite.utils.VTVerifications.isDeveloper;
|
||||
import static ru.vtosters.lite.utils.VTVerifications.isPrometheus;
|
||||
import static ru.vtosters.lite.utils.VTVerifications.isVerified;
|
||||
@@ -22,8 +15,6 @@ import static ru.vtosters.lite.utils.VTVerifications.isVerified;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.vk.core.network.Network;
|
||||
import com.vk.core.util.DeviceIdProvider;
|
||||
import com.vk.core.util.LangUtils;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
@@ -37,16 +28,13 @@ import java.util.LinkedHashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
|
||||
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
|
||||
import okhttp3.Headers;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class JsonInjectors {
|
||||
private static final OkHttpClient mClient = new OkHttpClient();
|
||||
private static final OkHttpClient mClient = VtOkHttpClient.getInstance();
|
||||
|
||||
public static JSONObject profileButton(JSONObject orig) throws JSONException {
|
||||
var id = orig.getInt("id");
|
||||
@@ -165,7 +153,8 @@ public class JsonInjectors {
|
||||
|
||||
var isPicture = pic.endsWith(".png") || pic.endsWith(".jpg") || pic.endsWith(".jpeg") || pic.endsWith(".webp");
|
||||
|
||||
if (isVerified(peerid)) text = AndroidUtils.getString(R.string.i_bought) + " VTosters Premium";
|
||||
if (isVerified(peerid))
|
||||
text = AndroidUtils.getString(R.string.i_bought) + " VTosters Premium";
|
||||
if (isPrometheus(peerid))
|
||||
text = AndroidUtils.getString(R.string.i_bought) + " VTosters Premium Gold Prime Pro Plus";
|
||||
if (isDeveloper(peerid)) text = AndroidUtils.getString(R.string.i_created_poop);
|
||||
@@ -242,19 +231,7 @@ public class JsonInjectors {
|
||||
return json.putOpt("items", newItems);
|
||||
}
|
||||
|
||||
public static JSONObject musiclink(JSONObject json) {
|
||||
var links = json.optJSONArray("links");
|
||||
|
||||
if (links != null) {
|
||||
if (links.optJSONObject(0).optString("url").contains("?section=recent")) {
|
||||
json.remove("links");
|
||||
|
||||
if (dev()) Log.d("VKMusic", "Removed links buttons");
|
||||
}
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public static JSONObject setOnlineInfo(JSONObject json) throws JSONException {
|
||||
var id = json.optInt("id");
|
||||
@@ -368,159 +345,6 @@ public class JsonInjectors {
|
||||
return items;
|
||||
}
|
||||
|
||||
public static JSONObject music(JSONObject json) throws JSONException {
|
||||
var catalog = json.optJSONObject("catalog");
|
||||
|
||||
JSONArray oldItems = null;
|
||||
|
||||
if (catalog != null) {
|
||||
oldItems = catalog.optJSONArray("sections");
|
||||
}
|
||||
|
||||
if (oldItems != null && oldItems.optJSONObject(0).optString("url").contains("general")) {
|
||||
json.optJSONArray("playlists").put(getPlaylist());
|
||||
|
||||
if (podcastcatalog()) {
|
||||
var podcasts = fetchCatalogPodcast();
|
||||
if (podcasts != null) {
|
||||
var catalogarr = podcasts.optJSONObject("catalog").optJSONArray("sections").optJSONObject(0);
|
||||
|
||||
var title = catalogarr.optString("title");
|
||||
var id = catalogarr.optString("id");
|
||||
var url = catalogarr.optString("url");
|
||||
|
||||
if (dev()) Log.d("VKMusic", "Added " + title + " in music sections");
|
||||
|
||||
oldItems.put(new JSONObject().put("id", id).put("title", title).put("url", url));
|
||||
}
|
||||
}
|
||||
|
||||
var playlists = fetchCatalogId("https://vk.com/audio?section=my_playlists");
|
||||
if (playlists != null) {
|
||||
var catalogarr = playlists.optJSONObject("catalog").optJSONArray("sections").optJSONObject(0);
|
||||
|
||||
var title = catalogarr.optString("title");
|
||||
var id = catalogarr.optString("id");
|
||||
var url = catalogarr.optString("url");
|
||||
|
||||
if (dev()) Log.d("VKMusic", "Added " + title + " in music sections");
|
||||
|
||||
oldItems.put(new JSONObject().put("id", id).put("title", title).put("url", url));
|
||||
}
|
||||
|
||||
var albums = fetchCatalogId("https://vk.com/audio?section=albums");
|
||||
if (albums != null) {
|
||||
var catalogarr = albums.optJSONObject("catalog").optJSONArray("sections").optJSONObject(0);
|
||||
|
||||
var title = catalogarr.optString("title");
|
||||
var id = catalogarr.optString("id");
|
||||
var url = catalogarr.optString("url");
|
||||
|
||||
if (dev()) Log.d("VKMusic", "Added " + title + " in music sections");
|
||||
|
||||
oldItems.put(new JSONObject().put("id", id).put("title", title).put("url", url));
|
||||
}
|
||||
|
||||
var recent = fetchCatalogId("https://vk.com/audio?section=recent");
|
||||
if (recent != null) {
|
||||
var catalogarr = recent.optJSONObject("catalog").optJSONArray("sections").optJSONObject(0);
|
||||
|
||||
var title = catalogarr.optString("title");
|
||||
var id = catalogarr.optString("id");
|
||||
var url = catalogarr.optString("url");
|
||||
|
||||
if (dev()) Log.d("VKMusic", "Added " + title + " in music sections");
|
||||
|
||||
oldItems.put(new JSONObject().put("id", id).put("title", title).put("url", url));
|
||||
}
|
||||
|
||||
for (int i = 0; i < oldItems.length(); i++) {
|
||||
var item = oldItems.optJSONObject(i);
|
||||
var title = item.optString("title");
|
||||
var id = item.optString("id");
|
||||
var url = item.optString("url");
|
||||
var value = AndroidUtils.getPrefsValue("musicdefcatalog");
|
||||
|
||||
Log.d("VKMusic", "title: " + title + " id: " + id + " url: " + url + " value: " + value);
|
||||
|
||||
if (url.contains(value) && !value.isEmpty()) {
|
||||
catalog.put("default_section", id);
|
||||
if (dev()) Log.d("VKMusic", "Added " + title + " as default music section");
|
||||
}
|
||||
}
|
||||
|
||||
if (CacheDatabaseDelegate.hasTracks() && !LibVKXClient.isIntegrationEnabled()){ // inj in playlist list
|
||||
var blocks = oldItems.optJSONObject(0).optJSONArray("blocks");
|
||||
var newBlocks = new JSONArray();
|
||||
|
||||
if (blocks != null){
|
||||
newBlocks
|
||||
.put(getCatalogHeader())
|
||||
.put(getCatalogPlaylist())
|
||||
.put(getCatalogSeparator());
|
||||
|
||||
Log.d("VKMusic", "added cache catalog playlist");
|
||||
|
||||
for (int i = 0; i < blocks.length(); i++) {
|
||||
newBlocks.put(blocks.optJSONObject(i));
|
||||
}
|
||||
|
||||
oldItems.optJSONObject(0).put("blocks", newBlocks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public static JSONObject fetchCatalogId(String section) {
|
||||
if (section.isEmpty()) return null;
|
||||
|
||||
var request = new Request.a()
|
||||
.b("https://" + getApi() + "/method/catalog.getAudio"
|
||||
+ "?v=5.119"
|
||||
+ "&https=1"
|
||||
+ "&need_blocks=1"
|
||||
+ "&lang="
|
||||
+ getLocale()
|
||||
+ "&device_id="
|
||||
+ DeviceIdProvider.d(AndroidUtils.getGlobalContext())
|
||||
+ "&url="
|
||||
+ section
|
||||
+ "&access_token="
|
||||
+ AccountManagerUtils.getUserToken())
|
||||
.a(Headers.a("User-Agent", Network.l.c().a(), "Content-Type", "application/x-www-form-urlencoded; charset=utf-8")).a();
|
||||
try {
|
||||
return new JSONObject(mClient.a(request).execute().a().g()).getJSONObject("response");
|
||||
} catch (JSONException | IOException e) {
|
||||
Log.d("VTLMusic", "Error: " + e.getMessage());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static JSONObject fetchCatalogPodcast() {
|
||||
var request = new Request.a()
|
||||
.b("https://" + getApi() + "/method/catalog.getPodcasts"
|
||||
+ "?v=5.119"
|
||||
+ "&https=1"
|
||||
+ "&need_blocks=1"
|
||||
+ "&lang="
|
||||
+ getLocale()
|
||||
+ "&device_id="
|
||||
+ DeviceIdProvider.d(AndroidUtils.getGlobalContext())
|
||||
+ "&access_token="
|
||||
+ AccountManagerUtils.getUserToken())
|
||||
.a(Headers.a("User-Agent", Network.l.c().a(), "Content-Type", "application/x-www-form-urlencoded; charset=utf-8")).a();
|
||||
try {
|
||||
return new JSONObject(mClient.a(request).execute().a().g()).getJSONObject("response");
|
||||
} catch (JSONException | IOException e) {
|
||||
Log.d("VTLMusic", "Error: " + e.getMessage());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static JSONObject friends(JSONObject json) throws JSONException, ParseException, IOException {
|
||||
JSONObject catalog = onlineHookProfiles(json);
|
||||
boolean sectionexecute = true;
|
||||
|
||||
@@ -11,9 +11,8 @@ import android.app.Activity;
|
||||
import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import com.vk.core.concurrent.VkExecutors;
|
||||
|
||||
import ru.vtosters.lite.downloaders.notifications.NotificationChannels;
|
||||
import ru.vtosters.lite.concurrent.VTExecutors;
|
||||
import ru.vtosters.lite.ui.dialogs.DisableBattery;
|
||||
import ru.vtosters.lite.ui.dialogs.InstallGMS;
|
||||
import ru.vtosters.lite.ui.dialogs.OTADialog;
|
||||
@@ -25,17 +24,12 @@ public class MainActivityInjector {
|
||||
setNeededTheme(activity);
|
||||
sendRequest();
|
||||
if (checkupdates()) OTADialog.checkUpdates(activity);
|
||||
VkExecutors.x.f().a(DeletedMessagesHandler::reloadMessagesList); // ioScheduler
|
||||
VTExecutors.getIoScheduler().a(DeletedMessagesHandler::reloadMessagesList); // ioScheduler
|
||||
Start.alert(activity);
|
||||
InstallGMS.alert(activity);
|
||||
DisableBattery.alert(activity);
|
||||
PreferenceManager.getDefaultSharedPreferences(activity)
|
||||
.edit()
|
||||
.putBoolean("isdark", isDarkTheme())
|
||||
.commit();
|
||||
|
||||
|
||||
VkExecutors.x.q().a(() -> {
|
||||
VTExecutors.getSlowTasksScheduler().a(() -> {
|
||||
getInstance().autoCleaningCache();
|
||||
}); // slowTasksScheduler
|
||||
|
||||
|
||||
@@ -37,11 +37,12 @@ import okhttp3.Callback;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class PhotoViewer {
|
||||
static OkHttpClient client = new OkHttpClient();
|
||||
static OkHttpClient client = VtOkHttpClient.getInstance();
|
||||
|
||||
public static boolean interceptClick(AttachmentWithMedia attachment, MenuItem item, View view) {
|
||||
if (item.getItemId() == R.id.search_photo) {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package ru.vtosters.lite.hooks;
|
||||
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
|
||||
public class PromoStickersHook {
|
||||
public static String hook(){
|
||||
return getBoolValue("promotedstickers", true) ? "purchased,active" : "purchased,active,promoted";
|
||||
}
|
||||
}
|
||||
@@ -19,15 +19,11 @@ import com.vk.music.common.MusicPlaybackLaunchContext;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import bruhcollective.itaysonlab.libvkx.client.LibVKXClientImpl;
|
||||
import ru.vtosters.lite.downloaders.AudioDownloader;
|
||||
|
||||
public class MusicBottomSheetHook {
|
||||
private static final ExecutorService executor = Executors.newCachedThreadPool();
|
||||
|
||||
public static ArrayList<MusicAction> hook(ArrayList<MusicAction> actions, MusicTrack musicTrack) {
|
||||
if (musicTrack.F1()) return actions;
|
||||
|
||||
@@ -149,7 +145,7 @@ public class MusicBottomSheetHook {
|
||||
return tryPlayInVKX(null, null, playlist);
|
||||
|
||||
if (actionId == R.id.add_to_cache) {
|
||||
executor.submit(() -> AudioDownloader.cachePlaylist(playlist));
|
||||
AudioDownloader.cachePlaylist(playlist);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -183,7 +179,7 @@ public class MusicBottomSheetHook {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
executor.submit(() -> AudioDownloader.downloadPlaylist(playlist));
|
||||
AudioDownloader.downloadPlaylist(playlist);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import okhttp3.FormBody;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
import ru.vtosters.lite.downloaders.AudioDownloader;
|
||||
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
@@ -35,7 +36,7 @@ public class LastFMScrobbler {
|
||||
private static final String KEY = "5965d63402414776c54c266db0211746";
|
||||
private static final String KEY_SECRET = "d982180eed13275bb948e41cf225f88f";
|
||||
private static final String URL = "https://ws.audioscrobbler.com/2.0/";
|
||||
private static final OkHttpClient CLIENT = new OkHttpClient();
|
||||
private static final OkHttpClient CLIENT = VtOkHttpClient.getInstance();
|
||||
private static final List<String> SCROBBLED_UUIDS = new ArrayList<>();
|
||||
|
||||
public static void grabMusicTrack(MusicTrack musictrack) {
|
||||
@@ -199,7 +200,7 @@ public class LastFMScrobbler {
|
||||
}
|
||||
|
||||
public static boolean needScrobbling(String uid) {
|
||||
return isLoggedIn() && isScrobblingEnabled() && !SCROBBLED_UUIDS.contains(uid);
|
||||
return isLoggedIn() && isScrobblingEnabled() && (SCROBBLED_UUIDS.isEmpty() || !SCROBBLED_UUIDS.get(SCROBBLED_UUIDS.size() - 1).contains(uid));
|
||||
}
|
||||
|
||||
public static boolean isLoggedIn() {
|
||||
|
||||
@@ -10,8 +10,6 @@ import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
@@ -19,6 +17,7 @@ import javax.crypto.NoSuchPaddingException;
|
||||
import java8.util.concurrent.CompletableFuture;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
import ru.vtosters.lite.music.converter.ts.FFMpeg;
|
||||
import ru.vtosters.lite.music.converter.ts.TSMerger;
|
||||
import ru.vtosters.lite.music.downloader.ThumbnailDownloader;
|
||||
@@ -27,8 +26,7 @@ import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.IOUtils;
|
||||
|
||||
public class M3UDownloader implements ITrackDownloader {
|
||||
private static final OkHttpClient client = new OkHttpClient();
|
||||
private ExecutorService executorService = Executors.newSingleThreadExecutor();
|
||||
private static final OkHttpClient client = VtOkHttpClient.getInstance();
|
||||
|
||||
public static M3UDownloader getInstance() {
|
||||
return Holder.INSTANCE;
|
||||
@@ -99,6 +97,7 @@ public class M3UDownloader implements ITrackDownloader {
|
||||
}));
|
||||
}
|
||||
var future = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]));
|
||||
future.join();
|
||||
future.exceptionally(throwable -> {
|
||||
callback.onFailure();
|
||||
return null;
|
||||
|
||||
+4
-1
@@ -13,6 +13,8 @@ import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
|
||||
import io.reactivex.Observable;
|
||||
@@ -23,11 +25,12 @@ import ru.vtosters.lite.music.cache.helpers.PlaylistHelper;
|
||||
import ru.vtosters.lite.music.cache.helpers.TracklistHelper;
|
||||
|
||||
public class PlaylistInjector {
|
||||
private static final ExecutorService executor = Executors.newCachedThreadPool();
|
||||
|
||||
public final static String CHANNEL_NAME = "VTCH";
|
||||
|
||||
public static void injectDownloadPlaylist(Playlist playlist) {
|
||||
AudioDownloader.cachePlaylist(playlist);
|
||||
executor.submit(() -> AudioDownloader.cachePlaylist(playlist));
|
||||
}
|
||||
|
||||
public static boolean eligibleForOfflineCaching() {
|
||||
|
||||
+61
-66
@@ -1,6 +1,11 @@
|
||||
package ru.vtosters.lite.music.cache.injectors;
|
||||
|
||||
import static ru.vtosters.lite.music.cache.CacheDatabaseDelegate.hasTracks;
|
||||
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.getCatalogHeader;
|
||||
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.getCatalogPlaylist;
|
||||
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.getCatalogSeparator;
|
||||
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.getPlaylist;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserId;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
@@ -20,9 +25,8 @@ import java.util.UUID;
|
||||
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import ru.vtosters.lite.music.cache.helpers.PlaylistHelper;
|
||||
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
|
||||
import ru.vtosters.lite.music.cache.helpers.TracklistHelper;
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.NetworkUtils;
|
||||
|
||||
@@ -76,76 +80,67 @@ public class TracklistInjector {
|
||||
public static void injectIntoExistingCatalog(JSONObject catalogNode) {
|
||||
Log.d("TracklistInjector", "injectIntoExistingCatalog");
|
||||
|
||||
if (!hasTracks()) return;
|
||||
try {
|
||||
var sectionsNode = catalogNode.getJSONObject("catalog")
|
||||
.getJSONArray("sections");
|
||||
var catalog = catalogNode.getJSONObject("catalog");
|
||||
var sectionsNode = catalog.getJSONArray("sections");
|
||||
var firstSection = sectionsNode.getJSONObject(0);
|
||||
if (!firstSection.getString("url").equals("https://vk.com/audios" + AccountManagerUtils.getUserId() + "?section=all"))
|
||||
return;
|
||||
|
||||
var foundPlaylistBlock = false;
|
||||
var suitableIndex = 0;
|
||||
if (!firstSection.getString("url").equals("https://vk.com/audios" + getUserId() + "?section=all"))
|
||||
return;
|
||||
|
||||
var blocks = firstSection.getJSONArray("blocks");
|
||||
for (int i = 0; i < blocks.length(); i++) {
|
||||
var block = blocks.getJSONObject(i);
|
||||
var dataType = block.getString("data_type");
|
||||
if ("music_audios".equals(dataType)) {
|
||||
suitableIndex = i - 1;
|
||||
continue;
|
||||
|
||||
if (CacheDatabaseDelegate.hasTracks() && !LibVKXClient.isIntegrationEnabled()) { // inj in playlist list
|
||||
var noPlaylists = blocks.optJSONObject(0).optJSONArray("buttons").optJSONObject(0).optJSONObject("action").optString("type").equals("create_playlist");
|
||||
|
||||
if (noPlaylists) {
|
||||
catalogNode.put("playlists", new JSONArray().put(getPlaylist()));
|
||||
Log.d("catalogInjector", "added new pl");
|
||||
|
||||
var newBlocks = new JSONArray();
|
||||
|
||||
newBlocks
|
||||
.put(getCatalogHeader())
|
||||
.put(getCatalogPlaylist())
|
||||
.put(getCatalogSeparator());
|
||||
|
||||
Log.d("catalogInjector", "added cache catalog playlist");
|
||||
|
||||
for (int i = 0; i < blocks.length(); i++) {
|
||||
newBlocks.put(blocks.optJSONObject(i));
|
||||
}
|
||||
|
||||
firstSection.put("blocks", newBlocks);
|
||||
} else {
|
||||
try {
|
||||
catalogNode.optJSONArray("playlists").put(getPlaylist());
|
||||
Log.d("catalogInjector", "added to exist pl");
|
||||
|
||||
for (int i = 0; i < blocks.length(); i++) {
|
||||
var j = blocks.optJSONObject(i);
|
||||
var type = j.optString("data_type");
|
||||
|
||||
if (type.equals("music_playlists") && j.has("playlists_ids")) {
|
||||
var newarr = new JSONArray();
|
||||
var playlists_ids = j.optJSONArray("playlists_ids");
|
||||
|
||||
newarr.put(getUserId() + "_-1");
|
||||
|
||||
for (int n = 0; n < playlists_ids.length(); n++) {
|
||||
newarr.put(playlists_ids.optString(n));
|
||||
}
|
||||
|
||||
j.put("playlists_ids", newarr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("catalogInjector", e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
if (!"music_playlists".equals(dataType))
|
||||
continue;
|
||||
|
||||
var playlistIds = block.getJSONArray("playlists_ids");
|
||||
var newPlaylistIds = new JSONArray()
|
||||
.put(AccountManagerUtils.getUserId() + "_-1");
|
||||
|
||||
for (int j = 0; j < playlistIds.length(); j++)
|
||||
newPlaylistIds.put(playlistIds.get(j));
|
||||
|
||||
block.put("playlists_ids", newPlaylistIds);
|
||||
|
||||
// need test
|
||||
blocks.remove(i);
|
||||
blocks.put(i, block);
|
||||
|
||||
foundPlaylistBlock = true;
|
||||
}
|
||||
|
||||
if (foundPlaylistBlock) {
|
||||
var playlists = catalogNode.getJSONArray("playlists")
|
||||
.put(0, PlaylistHelper.createCachedPlaylistMetadata().J());
|
||||
catalogNode.put("playlists", playlists);
|
||||
return;
|
||||
}
|
||||
|
||||
var ids = new JSONArray()
|
||||
.put(0, AccountManagerUtils.getUserId() + "_-1");
|
||||
|
||||
var playlistsBlock = new JSONObject()
|
||||
.put("id", getRandomId())
|
||||
.put("data_type", "music_playlists")
|
||||
.put("url", "synth:cache:playlists")
|
||||
.put("playlists_ids", ids);
|
||||
|
||||
var layout = new JSONObject()
|
||||
.put("name", "large_slider")
|
||||
.put("owner_id", AccountManagerUtils.getUserId());
|
||||
|
||||
playlistsBlock.put("layout", layout);
|
||||
|
||||
blocks.put(suitableIndex, playlistsBlock);
|
||||
|
||||
firstSection.put("blocks", blocks);
|
||||
|
||||
var playlists = new JSONArray()
|
||||
.put(0, PlaylistHelper.createCachedPlaylistMetadata().J());
|
||||
catalogNode.put("playlists", playlists);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
Log.d("TracklistInjector", e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +170,7 @@ public class TracklistInjector {
|
||||
|
||||
var layout = new JSONObject()
|
||||
.put("name", "list")
|
||||
.put("owner_id", AccountManagerUtils.getUserId());
|
||||
.put("owner_id", getUserId());
|
||||
|
||||
audiosBlock.put("layout", layout);
|
||||
|
||||
|
||||
@@ -0,0 +1,294 @@
|
||||
package ru.vtosters.lite.music.catalog.inject;
|
||||
|
||||
import static ru.vtosters.lite.hooks.DateHook.getLocale;
|
||||
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.getCatalogHeader;
|
||||
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.getCatalogPlaylist;
|
||||
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.getCatalogSeparator;
|
||||
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.getPlaylist;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserId;
|
||||
import static ru.vtosters.lite.utils.Preferences.dev;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.podcastcatalog;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.vk.core.network.Network;
|
||||
import com.vk.core.util.DeviceIdProvider;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
|
||||
import okhttp3.Headers;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class CatalogJsonInjector {
|
||||
private static final OkHttpClient mClient = VtOkHttpClient.getInstance();
|
||||
|
||||
public static JSONObject music(JSONObject json) throws JSONException {
|
||||
var catalog = json.optJSONObject("catalog");
|
||||
|
||||
JSONArray oldItems = null;
|
||||
|
||||
if (catalog != null) {
|
||||
oldItems = catalog.optJSONArray("sections");
|
||||
}
|
||||
|
||||
var useOldAppVer = getBoolValue("useOldAppVer", false);
|
||||
var isUsersCatalog = oldItems.optJSONObject(0).optString("url").equals("https://vk.com/audios" + getUserId() + "?section=" + (useOldAppVer ? "all" : "general"));
|
||||
|
||||
if (oldItems != null && isUsersCatalog) {
|
||||
var blocks = oldItems.optJSONObject(0).optJSONArray("blocks");
|
||||
|
||||
if (!useOldAppVer) {
|
||||
if (blocks != null) {
|
||||
for (int i = 0; i < blocks.length(); i++) {
|
||||
var block = blocks.optJSONObject(i);
|
||||
var layout = block.optJSONObject("layout");
|
||||
if (layout != null) {
|
||||
var name = layout.optString("name");
|
||||
if (name.equals("header_extended")) {
|
||||
if (layout.has("top_title")) blocks.remove(i);
|
||||
try {
|
||||
layout.put("name", "header");
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var playlists = fetchCatalogId("https://vk.com/audio?section=my_playlists");
|
||||
if (playlists != null) {
|
||||
var catalogarr = playlists.optJSONObject("catalog").optJSONArray("sections").optJSONObject(0);
|
||||
|
||||
var title = catalogarr.optString("title");
|
||||
var id = catalogarr.optString("id");
|
||||
var url = catalogarr.optString("url");
|
||||
|
||||
if (dev()) Log.d("VKMusic", "Added " + title + " in music sections");
|
||||
|
||||
oldItems.put(new JSONObject().put("id", id).put("title", title).put("url", url));
|
||||
}
|
||||
|
||||
var albums = fetchCatalogId("https://vk.com/audio?section=albums");
|
||||
if (albums != null) {
|
||||
var catalogarr = albums.optJSONObject("catalog").optJSONArray("sections").optJSONObject(0);
|
||||
|
||||
var title = catalogarr.optString("title");
|
||||
var id = catalogarr.optString("id");
|
||||
var url = catalogarr.optString("url");
|
||||
|
||||
if (dev()) Log.d("VKMusic", "Added " + title + " in music sections");
|
||||
|
||||
oldItems.put(new JSONObject().put("id", id).put("title", title).put("url", url));
|
||||
}
|
||||
|
||||
var recent = fetchCatalogId("https://vk.com/audio?section=recent");
|
||||
if (recent != null) {
|
||||
var catalogarr = recent.optJSONObject("catalog").optJSONArray("sections").optJSONObject(0);
|
||||
|
||||
var title = catalogarr.optString("title");
|
||||
var id = catalogarr.optString("id");
|
||||
var url = catalogarr.optString("url");
|
||||
|
||||
if (dev()) Log.d("VKMusic", "Added " + title + " in music sections");
|
||||
|
||||
oldItems.put(new JSONObject().put("id", id).put("title", title).put("url", url));
|
||||
}
|
||||
|
||||
for (int i = 0; i < oldItems.length(); i++) {
|
||||
var item = oldItems.optJSONObject(i);
|
||||
var title = item.optString("title");
|
||||
var id = item.optString("id");
|
||||
var url = item.optString("url");
|
||||
var value = AndroidUtils.getPrefsValue("musicdefcatalog");
|
||||
|
||||
Log.d("VKMusic", "title: " + title + " id: " + id + " url: " + url + " value: " + value);
|
||||
|
||||
if (url.contains(value) && !value.isEmpty()) {
|
||||
catalog.put("default_section", id);
|
||||
if (dev()) Log.d("VKMusic", "Added " + title + " as default music section");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (CacheDatabaseDelegate.hasTracks() && !LibVKXClient.isIntegrationEnabled()) { // inj in playlist list
|
||||
var noPlaylists = !json.has("playlists");
|
||||
|
||||
if (noPlaylists) {
|
||||
json.put("playlists", new JSONArray().put(getPlaylist()));
|
||||
Log.d("catalogInjector", "added new pl");
|
||||
} else {
|
||||
try {
|
||||
json.optJSONArray("playlists").put(getPlaylist());
|
||||
Log.d("catalogInjector", "added to exist pl");
|
||||
} catch (Exception e) {
|
||||
Log.d("catalogInjector", e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
if (blocks != null && (!useOldAppVer || noPlaylists)) {
|
||||
var newBlocks = new JSONArray();
|
||||
|
||||
newBlocks
|
||||
.put(getCatalogHeader())
|
||||
.put(getCatalogPlaylist())
|
||||
.put(getCatalogSeparator());
|
||||
|
||||
Log.d("VKMusic", "added cache catalog playlist");
|
||||
|
||||
for (int i = 0; i < blocks.length(); i++) {
|
||||
newBlocks.put(blocks.optJSONObject(i));
|
||||
}
|
||||
|
||||
oldItems.optJSONObject(0).put("blocks", newBlocks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public static JSONObject catalogInjector(JSONObject json) {
|
||||
try {
|
||||
var section = json.optJSONObject("section");
|
||||
var useOldAppVer = getBoolValue("useOldAppVer", false);
|
||||
var isUsersCatalog = section.optString("url").equals("https://vk.com/audios" + getUserId() + "?section=" + (useOldAppVer ? "all" : "general"));
|
||||
|
||||
if (isUsersCatalog && CacheDatabaseDelegate.hasTracks() && !LibVKXClient.isIntegrationEnabled()) {
|
||||
var blocks = section.getJSONArray("blocks");
|
||||
var noPlaylists = !json.has("playlists");
|
||||
|
||||
// Log.d("catalogInjector", "type: " + blocks.optJSONObject(0).optJSONArray("buttons").optJSONObject(0).optJSONObject("action").optString("type"));
|
||||
|
||||
if (noPlaylists) {
|
||||
json.put("playlists", new JSONArray().put(getPlaylist()));
|
||||
Log.d("catalogInjector", "added new pl");
|
||||
} else {
|
||||
try {
|
||||
json.optJSONArray("playlists").put(getPlaylist());
|
||||
Log.d("catalogInjector", "added to exist pl");
|
||||
} catch (Exception e) {
|
||||
Log.d("catalogInjector", e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
if (!useOldAppVer || noPlaylists) {
|
||||
var newBlocks = new JSONArray();
|
||||
|
||||
newBlocks
|
||||
.put(getCatalogHeader())
|
||||
.put(getCatalogPlaylist())
|
||||
.put(getCatalogSeparator());
|
||||
|
||||
Log.d("catalogInjector", "added cache catalog playlist");
|
||||
|
||||
for (int i = 0; i < blocks.length(); i++) {
|
||||
newBlocks.put(blocks.optJSONObject(i));
|
||||
}
|
||||
|
||||
section.put("blocks", newBlocks);
|
||||
} else {
|
||||
for (int i = 0; i < blocks.length(); i++) {
|
||||
var j = blocks.optJSONObject(i);
|
||||
var type = j.optString("data_type");
|
||||
|
||||
if (type.equals("music_playlists") && j.has("playlists_ids")) {
|
||||
var newarr = new JSONArray();
|
||||
var playlists_ids = j.optJSONArray("playlists_ids");
|
||||
|
||||
newarr.put(getUserId() + "_-1");
|
||||
|
||||
for (int n = 0; n < playlists_ids.length(); n++) {
|
||||
newarr.put(playlists_ids.optString(n));
|
||||
}
|
||||
|
||||
Log.d("catalogInjector", "added to pl ids");
|
||||
|
||||
j.put("playlists_ids", newarr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (JSONException e) {
|
||||
Log.d("catalogInjector", e.toString());
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public static JSONObject musiclink(JSONObject json) {
|
||||
var links = json.optJSONArray("links");
|
||||
|
||||
if (links != null && !getBoolValue("useOldAppVer", false)) {
|
||||
if (links.optJSONObject(0).optString("url").contains("?section=recent")) {
|
||||
json.remove("links");
|
||||
|
||||
if (dev()) Log.d("VKMusic", "Removed links buttons");
|
||||
}
|
||||
}
|
||||
|
||||
var section = json.optJSONObject("section");
|
||||
if (section != null) {
|
||||
var blocks = section.optJSONArray("blocks");
|
||||
if (blocks != null) {
|
||||
for (int i = 0; i < blocks.length(); i++) {
|
||||
var block = blocks.optJSONObject(i);
|
||||
var layout = block.optJSONObject("layout");
|
||||
if (layout != null) {
|
||||
var name = layout.optString("name");
|
||||
if (name.equals("header_extended")) {
|
||||
if (layout.has("top_title")) blocks.remove(i);
|
||||
try {
|
||||
layout.put("name", "header");
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return catalogInjector(json);
|
||||
}
|
||||
|
||||
private static JSONObject fetchCatalogId(String section) {
|
||||
if (section.isEmpty()) return null;
|
||||
|
||||
var request = new Request.a()
|
||||
.b("https://" + getApi() + "/method/" + "catalog.getAudio"
|
||||
+ "?v=5.119"
|
||||
+ "&https=1"
|
||||
+ "&need_blocks=1"
|
||||
+ "&lang="
|
||||
+ getLocale()
|
||||
+ "&device_id="
|
||||
+ DeviceIdProvider.d(AndroidUtils.getGlobalContext())
|
||||
+ "&url="
|
||||
+ section
|
||||
+ "&access_token="
|
||||
+ AccountManagerUtils.getUserToken())
|
||||
.a(Headers.a("User-Agent", Network.l.c().a(), "Content-Type", "application/x-www-form-urlencoded; charset=utf-8")).a();
|
||||
try {
|
||||
return new JSONObject(mClient.a(request).execute().a().g()).getJSONObject("response");
|
||||
} catch (JSONException | IOException e) {
|
||||
Log.d("VTLMusic", "Error: " + e.getMessage());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -28,15 +28,13 @@ public class FFMpeg {
|
||||
* @return True if success, else false
|
||||
*/
|
||||
public static boolean convert(File in, String out, MusicTrack track) {
|
||||
checkFFMpegLibs();
|
||||
|
||||
|
||||
// convert .ts file to .mp3 file via ffmpeg
|
||||
var sb = new StringBuilder();
|
||||
sb.append("-y -i \"").append(in.getAbsolutePath()).append("\"");
|
||||
sb.append(" -map 0 -dn ");
|
||||
//sb.append(" -loglevel error");
|
||||
sb.append(" -hide_banner");
|
||||
//sb.append(" -hide_banner");
|
||||
sb.append(" -write_id3v2 1");
|
||||
|
||||
String title = null;
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.vk.dto.music.MusicTrack;
|
||||
import java.io.File;
|
||||
|
||||
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
|
||||
import ru.vtosters.lite.concurrent.VTExecutors;
|
||||
import ru.vtosters.lite.music.Callback;
|
||||
import ru.vtosters.lite.music.M3UDownloader;
|
||||
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
|
||||
@@ -36,6 +37,9 @@ public class TrackDownloader {
|
||||
Log.v("TrackDownloader", "Directory created");
|
||||
else
|
||||
Log.e("TrackDownloader", "Directory creation failed");
|
||||
downloader.downloadTrack(track, outDir, callback, cache);
|
||||
|
||||
VTExecutors.getMusicDownloadExecutor().execute(
|
||||
() -> downloader.downloadTrack(track, outDir, callback, cache)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package ru.vtosters.lite.net;
|
||||
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -14,30 +15,24 @@ import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
public final class NetCall {
|
||||
private final NetRequest req;
|
||||
private final NetClient cl;
|
||||
private final Executor executor;
|
||||
|
||||
protected NetCall(NetClient cl, NetRequest req, Executor executor) {
|
||||
protected NetCall(NetClient cl, NetRequest req) {
|
||||
this.req = req;
|
||||
this.cl = cl;
|
||||
this.executor = executor;
|
||||
}
|
||||
|
||||
private static String constructArgs(Map<String, String> args) throws UnsupportedEncodingException {
|
||||
args = new TreeMap<>(args);
|
||||
StringBuilder str = new StringBuilder();
|
||||
String str = "";
|
||||
for (Map.Entry<String, String> en : args.entrySet()) {
|
||||
if (str.length() > 0)
|
||||
str.append("&");
|
||||
str.append(URLEncoder.encode(en.getKey(), "UTF-8"))
|
||||
.append("=")
|
||||
.append(URLEncoder.encode(en.getValue(), "UTF-8"));
|
||||
if (!str.isEmpty()) str += "&";
|
||||
str += URLEncoder.encode(en.getKey(), "UTF-8") + "=" + URLEncoder.encode(en.getValue(), "UTF-8");
|
||||
}
|
||||
return str.toString();
|
||||
return str;
|
||||
}
|
||||
|
||||
public NetRequest request() {
|
||||
@@ -82,13 +77,22 @@ public final class NetCall {
|
||||
}
|
||||
|
||||
public void enqueue(NetCallback cb) {
|
||||
executor.execute(() -> {
|
||||
try {
|
||||
NetResponse resp = execute();
|
||||
cb.onResponse(NetCall.this, resp);
|
||||
} catch (IOException e) {
|
||||
cb.onFailure(NetCall.this, e);
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
NetResponse resp = execute();
|
||||
cb.onResponse(NetCall.this, resp);
|
||||
} catch (IOException e) {
|
||||
cb.onFailure(NetCall.this, e);
|
||||
}
|
||||
try {
|
||||
interrupt();
|
||||
join();
|
||||
} catch (Exception e) {
|
||||
Log.e("NetCall", "Failed to interrupt and join thread", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}.start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,16 +2,12 @@ package ru.vtosters.lite.net;
|
||||
|
||||
import java.net.PasswordAuthentication;
|
||||
import java.net.Proxy;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class NetClient {
|
||||
private final long timeout;
|
||||
private final Proxy proxy;
|
||||
private final PasswordAuthentication authenticator;
|
||||
private final Executor executor
|
||||
= Executors.newSingleThreadExecutor();
|
||||
|
||||
protected NetClient(Builder b) {
|
||||
timeout = b.timeout;
|
||||
@@ -28,7 +24,7 @@ public class NetClient {
|
||||
}
|
||||
|
||||
public NetCall newCall(NetRequest req) {
|
||||
return new NetCall(this, req, executor);
|
||||
return new NetCall(this, req);
|
||||
}
|
||||
|
||||
public PasswordAuthentication getAuthenticator() {
|
||||
|
||||
@@ -2,77 +2,75 @@ package ru.vtosters.lite.net;
|
||||
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import com.vk.core.network.Network;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public class Request {
|
||||
|
||||
private static final Executor EXECUTOR =
|
||||
Executors.newSingleThreadExecutor();
|
||||
|
||||
public static void makeRequest(byte[] bArr, RequestCallback callback) {
|
||||
EXECUTOR.execute(new MakeRequestTask(bArr, callback));
|
||||
public static void makeRequest(byte[] bArr, RequestCallback RequestCallback) {
|
||||
new MakeRequestTask(bArr, RequestCallback).execute();
|
||||
}
|
||||
|
||||
public static void makeRequest(String str, RequestCallback callback) {
|
||||
makeRequest(str.getBytes(), callback);
|
||||
public static void makeRequest(String str, RequestCallback RequestCallback) {
|
||||
new MakeRequestTask(str.getBytes(), RequestCallback).execute();
|
||||
}
|
||||
|
||||
public interface RequestCallback {
|
||||
void onResponse(String str);
|
||||
}
|
||||
|
||||
private static class MakeRequestTask implements Runnable {
|
||||
private static class MakeRequestTask extends AsyncTask<Void, Void, String> {
|
||||
private final RequestCallback callback;
|
||||
private final byte[] url;
|
||||
private final boolean mIsPut;
|
||||
private final boolean mIsVTostersRequest;
|
||||
|
||||
public MakeRequestTask(byte[] bArr, RequestCallback callback) {
|
||||
this.mIsVTostersRequest = false;
|
||||
this.mIsPut = false;
|
||||
this.callback = callback;
|
||||
this.url = bArr;
|
||||
public MakeRequestTask(byte[] bArr, RequestCallback RequestCallback) {
|
||||
mIsVTostersRequest = false;
|
||||
mIsPut = false;
|
||||
callback = RequestCallback;
|
||||
url = bArr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
public String doInBackground(Void... voidArr) {
|
||||
try {
|
||||
HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(new String(url)).openConnection();
|
||||
httpURLConnection.setRequestMethod(mIsPut ? "PUT" : "GET");
|
||||
|
||||
if (mIsVTostersRequest) {
|
||||
httpURLConnection.setRequestProperty("Token", getUserToken());
|
||||
} else {
|
||||
}
|
||||
if (!mIsVTostersRequest) {
|
||||
httpURLConnection.setRequestProperty("User-Agent", Network.l.c().a());
|
||||
}
|
||||
|
||||
httpURLConnection.setRequestProperty("Content-Type", mIsVTostersRequest
|
||||
? "Content-Type"
|
||||
: "application/x-www-form-urlencoded");
|
||||
httpURLConnection.setRequestProperty("Content-Type", mIsVTostersRequest ? "Content-Type" : "application/x-www-form-urlencoded");
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream()));
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
while (true) {
|
||||
String readLine = bufferedReader.readLine();
|
||||
if (readLine != null) {
|
||||
builder.append(readLine);
|
||||
stringBuffer.append(readLine);
|
||||
} else {
|
||||
bufferedReader.close();
|
||||
callback.onResponse(builder.toString());
|
||||
break;
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
callback.onResponse(e.getLocalizedMessage());
|
||||
return e.getLocalizedMessage();
|
||||
}
|
||||
}
|
||||
|
||||
public void onPostExecute(String str) {
|
||||
super.onPostExecute(str);
|
||||
callback.onResponse(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,10 @@ import java.util.Arrays;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
|
||||
public class GithubList {
|
||||
private static final OkHttpClient mClient = new OkHttpClient();
|
||||
private static final OkHttpClient mClient = VtOkHttpClient.getInstance();
|
||||
|
||||
public static ArrayList<String> getProxy(String url, String proxyname) throws IOException {
|
||||
Request link = new Request.a()
|
||||
|
||||
@@ -16,10 +16,11 @@ import okhttp3.MediaType;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
|
||||
public class DeepLTranslator extends BaseTranslator {
|
||||
|
||||
private static final OkHttpClient client = new OkHttpClient();
|
||||
private static final OkHttpClient client = VtOkHttpClient.getInstance();
|
||||
private static final Pattern pattern = Pattern.compile("[i]");
|
||||
private static final String REQUEST_BODY_FORMAT = "{\n" +
|
||||
" \"method\": \"LMT_handle_texts\",\n" +
|
||||
|
||||
@@ -10,10 +10,11 @@ import java.net.URLEncoder;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
|
||||
public class GoogleTranslator extends BaseTranslator {
|
||||
|
||||
private static final OkHttpClient client = new OkHttpClient();
|
||||
private static final OkHttpClient client = VtOkHttpClient.getInstance();
|
||||
private static final String[] devices = new String[]{
|
||||
"Linux; U; Android 10; Pixel 4",
|
||||
"Linux; U; Android 10; Pixel 4 XL",
|
||||
|
||||
@@ -13,10 +13,11 @@ import okhttp3.MediaType;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
|
||||
public class YandexTranslator extends BaseTranslator {
|
||||
|
||||
private static final OkHttpClient client = new OkHttpClient();
|
||||
private static final OkHttpClient client = VtOkHttpClient.getInstance();
|
||||
private static final String uuid = UUID.randomUUID().toString().replace("-", "");
|
||||
|
||||
private static YandexTranslator instance;
|
||||
|
||||
@@ -67,6 +67,7 @@ public class APKInstallActivity extends AppCompatActivity {
|
||||
|
||||
startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(this, getString(R.string.apk_install_error) + " " + e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@ public class StickerPackAdapter extends RecyclerView.Adapter<StickerPackAdapter.
|
||||
var holder = new StickerPackViewHolder(view);
|
||||
|
||||
holder.mStickerPreview.setImageResource(R.drawable.icon_vk_104);
|
||||
holder.mUpdateButton.setImageDrawable(recolorDrawable(getResources().getDrawable(R.drawable.ic_camera_switch_48)));
|
||||
holder.mDeleteButton.setImageDrawable(recolorDrawable(getResources().getDrawable(R.drawable.vkim_ic_msg_delete)));
|
||||
holder.mUpdateButton.setImageDrawable(recolorDrawable(getResources().getDrawable(R.drawable.ic_camera_switch_outline_24)));
|
||||
holder.mDeleteButton.setImageDrawable(recolorDrawable(getResources().getDrawable(R.drawable.ic_delete_outline_28)));
|
||||
|
||||
return holder;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class OTADialog implements OTAUtils.OTAListener {
|
||||
.setTitle(mActivity.getString(R.string.newversion) + " " + mHelper.getNewVersionName())
|
||||
.setUpdateInfoView(mHelper.getUpdateDescription())
|
||||
.setPositiveButton(mActivity.getString(R.string.updateanddownload), () -> {
|
||||
OTADownloader.downloadBuild(mHelper.getDownloadUrl());
|
||||
OTADownloader.downloadBuild(mHelper.getDownloadUrl(), mHelper.getCommitSHA());
|
||||
})
|
||||
.show();
|
||||
});
|
||||
|
||||
@@ -22,10 +22,11 @@ import okhttp3.Callback;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||
|
||||
public class ServerDialog {
|
||||
private static final OkHttpClient client = new OkHttpClient();
|
||||
private static final OkHttpClient client = VtOkHttpClient.getInstance();
|
||||
public static Boolean showAlert;
|
||||
private static String title;
|
||||
private static String message;
|
||||
|
||||
@@ -26,6 +26,7 @@ public class InterfaceFragment extends MaterialPreferenceToolbarFragment {
|
||||
findPreference("stories").setOnPreferenceClickListener(new restart());
|
||||
findPreference("swipe").setOnPreferenceClickListener(new restart());
|
||||
findPreference("is_likes_on_right").setOnPreferenceClickListener(new restart());
|
||||
findPreference("superapp").setOnPreferenceClickListener(new restart());
|
||||
|
||||
if (isTablet()) {
|
||||
findPreference("menusett").setVisible(false);
|
||||
|
||||
@@ -9,6 +9,7 @@ import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getAccentColor;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getSTextAttr;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
|
||||
@@ -131,6 +132,12 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
findPreference("vkx_sett").setVisible(false);
|
||||
}
|
||||
|
||||
findPreference("musicdefcatalog").setVisible(!getBoolValue("useOldAppVer", false));
|
||||
findPreference("useOldAppVer").setOnPreferenceClickListener(preference -> {
|
||||
restartApplicationWithTimer();
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("select_photo_search_engine").setOnPreferenceClickListener(preference -> {
|
||||
var items = Arrays.asList(
|
||||
new ImagineArrayAdapter.ImagineArrayAdapterItem(R.drawable.yandex, "Yandex"),
|
||||
@@ -212,7 +219,7 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
private void dlaudio(Context ctx) {
|
||||
if (LibVKXClient.isIntegrationEnabled()) {
|
||||
sendToast("Включена интеграция VKX. Глобальное кеширование доступно внутри VKX");
|
||||
sendToast(AndroidUtils.getString("vkx_integration_enabled_info"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,12 +11,14 @@ import static ru.vtosters.lite.utils.ThemesUtils.recolorDrawable;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.navigation.Navigator;
|
||||
import com.vk.stickers.Stickers;
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
@@ -39,6 +41,7 @@ public class MessagesFragment extends MaterialPreferenceToolbarFragment {
|
||||
findPreference("vkme_notifs").setOnPreferenceClickListener(new MessagesFragment.restart());
|
||||
findPreference("systememoji").setOnPreferenceClickListener(new MessagesFragment.restart());
|
||||
findPreference("wallpapers").setOnPreferenceClickListener(new MessagesFragment.openwp());
|
||||
findPreference("promotedstickers").setOnPreferenceChangeListener(new clearStickersCache());
|
||||
|
||||
findPreference("autotranslate").setEnabled(!autoalltranslate());
|
||||
|
||||
@@ -76,6 +79,7 @@ public class MessagesFragment extends MaterialPreferenceToolbarFragment {
|
||||
public boolean onPreferenceTreeClick(Preference preference) {
|
||||
findPreference("autotranslate").setEnabled(!autoalltranslate());
|
||||
findPreference("vkme_notifs").setEnabled(vkme());
|
||||
findPreference("promotedstickers").setOnPreferenceChangeListener(new clearStickersCache());
|
||||
return super.onPreferenceTreeClick(preference);
|
||||
}
|
||||
|
||||
@@ -98,6 +102,16 @@ public class MessagesFragment extends MaterialPreferenceToolbarFragment {
|
||||
}
|
||||
}
|
||||
|
||||
public class clearStickersCache implements Preference.OnPreferenceChangeListener {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object o) {
|
||||
SharedPreferences prefs2 = getContext().getSharedPreferences("stickers_storage", Context.MODE_PRIVATE);
|
||||
prefs2.edit().clear().commit();
|
||||
Stickers.l.c();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class openwp implements Preference.OnPreferenceClickListener {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
|
||||
@@ -10,7 +10,9 @@ import static ru.vtosters.lite.ui.components.BackupManager.restoreBackup;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getDefaultPrefs;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplication;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
@@ -23,10 +25,13 @@ import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.view.ContextThemeWrapper;
|
||||
@@ -155,52 +160,25 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
@SuppressLint({"CommitPrefEdits", "SetTextI18n"})
|
||||
private void cacheAutoCleanDialog() {
|
||||
String[] cacheText = {null, "100 MB", "500 MB", "1 GB", "2 GB", "5 GB"};
|
||||
|
||||
var val = getDefaultPrefs().getInt("autoclearcache_size", 0);
|
||||
RadioGroup rg = new RadioGroup(getContext());
|
||||
|
||||
rg.setPadding(dp2px(18f), dp2px(12f), dp2px(18f), 0);
|
||||
|
||||
RadioButton zero = new RadioButton(new ContextThemeWrapper(getContext(), R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
RadioButton one = new RadioButton(new ContextThemeWrapper(getContext(), R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
RadioButton two = new RadioButton(new ContextThemeWrapper(getContext(), R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
RadioButton three = new RadioButton(new ContextThemeWrapper(getContext(), R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
RadioButton four = new RadioButton(new ContextThemeWrapper(getContext(), R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
RadioButton five = new RadioButton(new ContextThemeWrapper(getContext(), R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
for (int item = 0; item <= 5; item++) {
|
||||
RadioButton rb = new RadioButton(new ContextThemeWrapper(getContext(), com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
rg.addView(rb);
|
||||
rb.setId(item);
|
||||
rb.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
|
||||
|
||||
rg.addView(zero);
|
||||
rg.addView(one);
|
||||
rg.addView(two);
|
||||
rg.addView(three);
|
||||
rg.addView(four);
|
||||
rg.addView(five);
|
||||
var text = cacheText[item];
|
||||
rb.setText(text != null ? text : AndroidUtils.getString("autoclearcachedisabled"));
|
||||
|
||||
zero.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
|
||||
one.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
|
||||
two.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
|
||||
three.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
|
||||
four.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
|
||||
five.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
|
||||
|
||||
zero.setText(requireContext().getString(R.string.autoclearcachedisabled));
|
||||
one.setText("100 MB");
|
||||
two.setText("500 MB");
|
||||
three.setText("1 GB");
|
||||
four.setText("2 GB");
|
||||
five.setText("5 GB");
|
||||
|
||||
zero.setTextColor(getTextAttr());
|
||||
one.setTextColor(getTextAttr());
|
||||
two.setTextColor(getTextAttr());
|
||||
three.setTextColor(getTextAttr());
|
||||
four.setTextColor(getTextAttr());
|
||||
five.setTextColor(getTextAttr());
|
||||
|
||||
zero.setChecked(val == 0);
|
||||
one.setChecked(val == 1);
|
||||
two.setChecked(val == 2);
|
||||
three.setChecked(val == 3);
|
||||
four.setChecked(val == 4);
|
||||
five.setChecked(val == 5);
|
||||
rb.setTextColor(getTextAttr());
|
||||
rb.setChecked(val == item);
|
||||
}
|
||||
|
||||
new VkAlertDialog.Builder(getContext())
|
||||
.setTitle(requireContext().getString(R.string.cache_clean_title))
|
||||
@@ -346,8 +324,17 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
AndroidUtils.getGlobalContext().getSharedPreferences("gcm", 0).edit().clear().apply();
|
||||
OtherFragment.this.getListView().postDelayed(() -> {
|
||||
PushSubscriber.e.a(true);
|
||||
ToastUtils.a(requireContext().getString(R.string.fcmtokenget));
|
||||
ToastUtils.a(requireContext().getString(R.string.fcmtokenfixed));
|
||||
|
||||
Context ctx;
|
||||
|
||||
try {
|
||||
ctx = requireContext();
|
||||
} catch (Exception unused) {
|
||||
ctx = getGlobalContext();
|
||||
}
|
||||
|
||||
ToastUtils.a(ctx.getString(R.string.fcmtokenget));
|
||||
ToastUtils.a(ctx.getString(R.string.fcmtokenfixed));
|
||||
}, 1000);
|
||||
return true;
|
||||
}
|
||||
@@ -357,12 +344,20 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
var arr = BackupManager.getBackupsNames();
|
||||
var adapter = new ArrayAdapter(getContext(), android.R.layout.simple_list_item_1, arr);
|
||||
var adapter = new ArrayAdapter(getContext(), android.R.layout.simple_list_item_1, arr) {
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
TextView textView = (TextView) super.getView(position, convertView, parent);
|
||||
textView.setTextColor(getTextAttr());
|
||||
return textView;
|
||||
}
|
||||
};
|
||||
new VkAlertDialog.Builder(getContext())
|
||||
.setTitle(requireContext().getString(R.string.select_backup))
|
||||
.setAdapter(adapter, (dialog, which) -> {
|
||||
try {
|
||||
restoreBackup(arr[which]);
|
||||
restartApplicationWithTimer();
|
||||
Toast.makeText(getContext(), requireContext().getString(R.string.backup_success), LENGTH_LONG).show();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -18,6 +18,7 @@ import static ru.vtosters.lite.utils.GmsUtils.isGmsInstalled;
|
||||
import static ru.vtosters.lite.utils.ImageUtils.getDrawableFromUrl;
|
||||
import static ru.vtosters.lite.utils.Preferences.ads;
|
||||
import static ru.vtosters.lite.utils.Preferences.autotranslate;
|
||||
import static ru.vtosters.lite.utils.Preferences.dev;
|
||||
import static ru.vtosters.lite.utils.Preferences.devmenu;
|
||||
import static ru.vtosters.lite.utils.Preferences.disableSettingsSumms;
|
||||
import static ru.vtosters.lite.utils.Preferences.hasSpecialVerif;
|
||||
@@ -119,25 +120,22 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
if (disableSettingsSumms()) return null;
|
||||
|
||||
String str;
|
||||
String[] themeTypeName = AndroidUtils.getArray("theme_type_name");
|
||||
|
||||
switch (getPrefsValue("currsystemtheme")) {
|
||||
default:
|
||||
case "system":
|
||||
str = "Системная";
|
||||
str = themeTypeName[0];
|
||||
break;
|
||||
case "dark":
|
||||
str = "Темная";
|
||||
str = themeTypeName[1];
|
||||
break;
|
||||
case "light":
|
||||
str = "Светлая";
|
||||
str = themeTypeName[2];
|
||||
break;
|
||||
}
|
||||
|
||||
return "Текущая тема" + ": " + str;
|
||||
}
|
||||
|
||||
public static SharedPreferences getCurrentAccount() {
|
||||
return AndroidUtils.getGlobalContext().getSharedPreferences("pref_account_manager", Context.MODE_PRIVATE);
|
||||
return AndroidUtils.getString("current_theme") + ": " + str;
|
||||
}
|
||||
|
||||
public static String getSuperappsumm() {
|
||||
@@ -146,15 +144,8 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
return AndroidUtils.getString(R.string.elements_hidden_count) + ": " + SuperAppEditorManager.getInstance().getDisabledTabs().size();
|
||||
}
|
||||
|
||||
public static String getCachesumm() {
|
||||
if (disableSettingsSumms()) return null;
|
||||
|
||||
return AndroidUtils.getString(R.string.autoclearcachesumm) + " " + humanReadableByteCountBin(CacheUtils.getInstance().size);
|
||||
}
|
||||
|
||||
private void switchTheme(boolean isDarkTheme) {
|
||||
setTheme(isDarkTheme ? getDarkTheme() : getLightTheme(), requireActivity());
|
||||
edit().putBoolean("isdark", isDarkTheme).commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -210,7 +201,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
"system",
|
||||
requireContext().getString(R.string.appearance_theme_use_system),
|
||||
R.drawable.ic_palette_outline_28, getThemesumm(),
|
||||
new String[] { "Системная тема", "Тёмная тема", "Светлая тема" },
|
||||
AndroidUtils.getArray("theme_type_name_checkbox"),
|
||||
new String[] { "system", "dark", "light" },
|
||||
(preference, o) -> {
|
||||
String value = (String) o;
|
||||
@@ -259,6 +250,14 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
edit().putBoolean("ssl", value).commit();
|
||||
return true;
|
||||
});
|
||||
|
||||
if (dev() && isValidSignature()) {
|
||||
addMaterialSwitchPreference(this, "autoupdates", requireContext().getString(R.string.checkupdates), "", R.drawable.ic_camera_switch_outline_24, true, (preference, o) -> {
|
||||
boolean value = (boolean) o;
|
||||
edit().putBoolean("autoupdates", value).commit();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
addPreferenceCategory(this, requireContext().getString(R.string.vtsettaccount));
|
||||
|
||||
@@ -45,6 +45,7 @@ import ru.vtosters.lite.tgs.TGPref;
|
||||
import ru.vtosters.lite.ui.adapters.StickerPackAdapter;
|
||||
import ru.vtosters.lite.ui.components.StickerTouchHelperCallback;
|
||||
import ru.vtosters.lite.ui.fragments.BaseToolbarFragment;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class StickersFragment extends BaseToolbarFragment {
|
||||
public final static String ACTION_RELOAD = "com.vtosters.lite.action.RELOAD_TGS_LIST";
|
||||
@@ -189,7 +190,7 @@ public class StickersFragment extends BaseToolbarFragment {
|
||||
if (!pack.startsWith("https://")) {
|
||||
pack = "https://" + pack;
|
||||
} else if (!pack.contains("addstickers")) {
|
||||
sendToast("Invalid pack name");
|
||||
sendToast(AndroidUtils.getString("invalid_pack_link"));
|
||||
}
|
||||
pack = parsePack(pack);
|
||||
mService.requestPackDownload(pack, new File(getContext().getFilesDir(), new File("VT-Stickers", pack).getAbsolutePath()));
|
||||
|
||||
@@ -52,8 +52,7 @@ public class About {
|
||||
return "0000000";
|
||||
}
|
||||
|
||||
public static String getAppVersion() throws IOException {
|
||||
var appver = isValidSignature() ? VERSIONNAME : "Dev";
|
||||
return getApplicationName() + " " + appver + " | " + getBuildNumber();
|
||||
public static String getAppVersion() {
|
||||
return getApplicationName() + " " + (isValidSignature() ? VERSIONNAME : "Dev") + " | " + getBuildNumber();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,13 @@ public class AccountManagerUtils {
|
||||
} // Current UserId
|
||||
|
||||
public static boolean isVKTester() {
|
||||
return VKAccountManager.d().i();
|
||||
return VKAccountManager.d().k0().equals("tester");
|
||||
} // is vk tester
|
||||
|
||||
public static boolean isVKWorker() {
|
||||
return VKAccountManager.d().k0().equals("worker");
|
||||
}
|
||||
|
||||
public static String getUserSecret() {
|
||||
return VKAccountManager.d().l0();
|
||||
}
|
||||
|
||||
@@ -72,6 +72,10 @@ public class AndroidUtils {
|
||||
return getResources().getStringArray(arrayId);
|
||||
} // Get array from arrays.xml
|
||||
|
||||
public static String[] getArray(String resourcename) {
|
||||
return getResources().getStringArray(getIdentifier(resourcename, "array"));
|
||||
}
|
||||
|
||||
public static String getString(int id) {
|
||||
return getGlobalContext().getString(id);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package ru.vtosters.lite.utils;
|
||||
|
||||
import static android.text.TextUtils.isEmpty;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.isEnableExternalOpening;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
@@ -59,7 +60,7 @@ public class ExternalLinkParser {
|
||||
if (!isEnabled || file.isEmpty()) return false;
|
||||
|
||||
if (checkVkVideo(file)) {
|
||||
if (qualities.size() == 1) {
|
||||
if (qualities.size() == 1 || getBoolValue("maxquality", false)) {
|
||||
startExternalVideo((String) qualities.values().toArray()[0], context);
|
||||
} else {
|
||||
String[] titles = qualities.keySet().toArray(new String[0]);
|
||||
|
||||
@@ -25,10 +25,11 @@ import okhttp3.Callback;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
|
||||
public class ImageUtils {
|
||||
|
||||
private static final OkHttpClient client = new OkHttpClient();
|
||||
private static final OkHttpClient client = VtOkHttpClient.getInstance();
|
||||
|
||||
public static Bitmap bmp = null;
|
||||
|
||||
|
||||
@@ -12,15 +12,17 @@ import okhttp3.Callback;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
|
||||
public class OTAUtils {
|
||||
|
||||
private static final String LATEST_RELEASE_URL = "https://api.github.com/repositories/473685743/releases/latest";
|
||||
private static final String LATEST_RELEASE_COMMIT_URL = "https://api.github.com/repositories/473685743/git/ref/tags/%s";
|
||||
private final OkHttpClient mClient = new OkHttpClient();
|
||||
private final OkHttpClient mClient = VtOkHttpClient.getInstance();
|
||||
private final OTAListener mListener;
|
||||
private JSONObject mReleaseJson;
|
||||
private JSONObject mCommitJson;
|
||||
private String mCommitSHA = "";
|
||||
|
||||
public OTAUtils(OTAListener listener) {
|
||||
this.mListener = listener;
|
||||
@@ -69,9 +71,11 @@ public class OTAUtils {
|
||||
public void a(Call call, Response response) throws IOException {
|
||||
try {
|
||||
mCommitJson = new JSONObject(response.a().g());
|
||||
mCommitSHA = mCommitJson.getJSONObject("object").getString("sha");
|
||||
if (isNewVersion())
|
||||
mListener.onUpdateApplied();
|
||||
else mListener.onUpdateCanceled();
|
||||
else
|
||||
mListener.onUpdateCanceled();
|
||||
} catch (NullPointerException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
mListener.onUpdateCanceled();
|
||||
@@ -80,10 +84,13 @@ public class OTAUtils {
|
||||
});
|
||||
}
|
||||
|
||||
public String getCommitSHA() {
|
||||
return mCommitSHA;
|
||||
}
|
||||
|
||||
public boolean isNewVersion() {
|
||||
try {
|
||||
String commitSHA = mCommitJson.getJSONObject("object").getString("sha");
|
||||
return !commitSHA.startsWith(About.getBuildNumber());
|
||||
return !mCommitSHA.startsWith(About.getBuildNumber());
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -37,12 +37,11 @@ public class Preferences {
|
||||
|
||||
GmsUtils.fixGapps();
|
||||
setProxy();
|
||||
VTVerifications.load(application);
|
||||
LifecycleUtils.registerActivities(application);
|
||||
} // VK Init
|
||||
|
||||
public static void forceOffline() {
|
||||
edit().putBoolean("isdark", isDarkTheme()).commit();
|
||||
|
||||
setupFilters();
|
||||
|
||||
if (setoffline() && offline()) {
|
||||
@@ -329,7 +328,7 @@ public class Preferences {
|
||||
}
|
||||
|
||||
public static boolean checkupdates() {
|
||||
return !getBoolValue("isRoamingState", false) && isValidSignature();
|
||||
return !getBoolValue("isRoamingState", false) && isValidSignature() && (!dev() || getBoolValue("autoupdates", true));
|
||||
}
|
||||
|
||||
public static boolean isValidSignature() {
|
||||
|
||||
@@ -20,10 +20,11 @@ import java.util.HashMap;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
|
||||
// Jesus cries
|
||||
public class ProfileHider {
|
||||
private static final OkHttpClient client = new OkHttpClient();
|
||||
private static final OkHttpClient client = VtOkHttpClient.getInstance();
|
||||
|
||||
public static void injectMap(HashMap<Integer, UserPresenter.a.a> hashMap) {
|
||||
if (VTVerifications.isServiceAccount(getUserId())) {
|
||||
|
||||
@@ -23,13 +23,14 @@ import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
|
||||
public class VTVerifications {
|
||||
public static final List<Integer> sVerifications = new ArrayList<>();
|
||||
public static final List<Integer> sPrometheuses = new ArrayList<>();
|
||||
public static final List<Integer> sDevelopers = new ArrayList<>();
|
||||
public static final List<Integer> sServiceAccounts = new ArrayList<>();
|
||||
private static final OkHttpClient sClient = new OkHttpClient();
|
||||
private static final OkHttpClient sClient = VtOkHttpClient.getInstance();
|
||||
|
||||
public static void load(Context context) {
|
||||
var prefs = context.getSharedPreferences("vt_another_data", 0);
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.3.0'
|
||||
classpath 'com.android.tools.build:gradle:7.3.1'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,36 @@
|
||||
@echo off
|
||||
|
||||
cd scripts
|
||||
|
||||
echo.
|
||||
echo Decompile release APK...
|
||||
echo.
|
||||
call java -jar apktool.jar d VTLite.apk -f -o tmp -s --use-aapt2 -p ../scripts/framework/
|
||||
if "%ERRORLEVEL%" == "0" (
|
||||
echo %ESC%[92mSuccessful%ESC%[0m
|
||||
) else (
|
||||
echo %ESC%[31mFailed%ESC%[0m
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo Generate R.java
|
||||
echo.
|
||||
call java -jar rclass-generator.jar -f tmp/res/values/public.xml -o ..\app\src\main\java\com\vtosters\lite\R.java -p com.vtosters.lite --comments
|
||||
if "%ERRORLEVEL%" == "0" (
|
||||
echo %ESC%[92mSuccessful%ESC%[0m
|
||||
) else (
|
||||
echo %ESC%[31mFailed%ESC%[0m
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo Clean temp dir
|
||||
echo.
|
||||
call rmdir /s/q tmp
|
||||
if "%ERRORLEVEL%" == "0" (
|
||||
echo %ESC%[92mSuccessful%ESC%[0m
|
||||
) else (
|
||||
echo %ESC%[31mFailed%ESC%[0m
|
||||
exit /B 1
|
||||
)
|
||||
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
RED='\033[31m'
|
||||
GREEN='\033[92m'
|
||||
NC='\033[0m'
|
||||
BOLD='\033[1m'
|
||||
UNDERLINE='\033[4m'
|
||||
|
||||
cd ../
|
||||
|
||||
echo -e "${BOLD}${UNDERLINE}Decompile release APK...${NC}\n"
|
||||
java -jar ../scripts/apktool.jar d VTLite.apk -f -o tmp -s --use-aapt2 -p ../scripts/framework/
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "${GREEN}Успех!${NC}\n"
|
||||
else
|
||||
echo -e "${RED}Провал.${NC}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${BOLD}${UNDERLINE}Regenerate R.java file...${NC}\n"
|
||||
java -jar ../scripts/rclass-generator.jar -f ../scripts/tmp/res/values/public.xml -o ../scripts/app/src/main/java/com/vtosters/lite/R.java -p com.vtosters.lite --comments
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "${GREEN}Успех!${NC}\n"
|
||||
else
|
||||
echo -e "${RED}Провал.${NC}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${BOLD}${UNDERLINE}Clean temp dir...${NC}\n"
|
||||
rm -rf ../scripts/tmp
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "${GREEN}Успех!${NC}\n"
|
||||
else
|
||||
echo -e "${RED}Провал.${NC}\n"
|
||||
exit 1
|
||||
fi
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user