Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a9eb29488d | ||
|
|
be3957db33 | ||
|
|
3852425d2c |
@@ -28,7 +28,7 @@ jobs:
|
|||||||
uses: nttld/setup-ndk@v1
|
uses: nttld/setup-ndk@v1
|
||||||
with:
|
with:
|
||||||
ndk-version: r25c
|
ndk-version: r25c
|
||||||
add-to-path: true
|
add-to-path: false
|
||||||
|
|
||||||
- name: Set up JDK
|
- name: Set up JDK
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
|
|||||||
+2
-2
@@ -4,7 +4,7 @@ import java.util.zip.ZipFile
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.android.application'
|
id 'com.android.application'
|
||||||
id 'net.nemerosa.versioning' version '3.1.0'
|
id 'net.nemerosa.versioning' version '2.15.1'
|
||||||
id 'org.mozilla.rust-android-gradle.rust-android'
|
id 'org.mozilla.rust-android-gradle.rust-android'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ dependencies {
|
|||||||
implementation 'com.microsoft.appcenter:appcenter-crashes:5.0.4'
|
implementation 'com.microsoft.appcenter:appcenter-crashes:5.0.4'
|
||||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
|
||||||
implementation 'net.sourceforge.streamsupport:streamsupport-minifuture:1.7.4'
|
implementation 'net.sourceforge.streamsupport:streamsupport-minifuture:1.7.4'
|
||||||
implementation 'com.google.guava:guava:33.2.1-android'
|
implementation 'com.google.guava:guava:32.0.0-android'
|
||||||
|
|
||||||
implementation 'com.mpatric:mp3agic:0.9.1'
|
implementation 'com.mpatric:mp3agic:0.9.1'
|
||||||
|
|
||||||
|
|||||||
@@ -11,37 +11,37 @@ import com.vtosters.lite.R;
|
|||||||
import ru.vtosters.lite.utils.AndroidUtils;
|
import ru.vtosters.lite.utils.AndroidUtils;
|
||||||
|
|
||||||
public class GmsHook {
|
public class GmsHook {
|
||||||
private static final String[] spoofPackages = {"com.mgoogle", "app.revanced"};
|
private static final boolean needToSpoof = !isGmsInstalled() && (isFakeGmsInstalled() || isFakeGms2Installed());
|
||||||
private static final String currentGms;
|
|
||||||
|
|
||||||
static {
|
public static boolean isGmsInstalled() {
|
||||||
currentGms = getSpoofPackagePrefix();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isPackageInstalled(String packageName) {
|
|
||||||
try {
|
try {
|
||||||
AndroidUtils.getGlobalContext().getPackageManager().getPackageInfo(packageName, 0);
|
AndroidUtils.getGlobalContext().getPackageManager().getPackageInfo("com.google.android.gms", 0);
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception unused) {
|
} catch (Exception unused) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} // Google Market Services check
|
||||||
|
|
||||||
public static boolean isGmsInstalled() {
|
public static boolean isFakeGmsInstalled() {
|
||||||
return isPackageInstalled("com.google.android.gms");
|
try {
|
||||||
}
|
AndroidUtils.getGlobalContext().getPackageManager().getPackageInfo("com.mgoogle.android.gms", 0);
|
||||||
|
return true;
|
||||||
|
} catch (Exception unused) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} // Microg Google Market Services check
|
||||||
|
|
||||||
public static boolean isSpoofPackageInstalled(String packageName) {
|
public static boolean isFakeGms2Installed() {
|
||||||
return isPackageInstalled(packageName + ".android.gms");
|
try {
|
||||||
}
|
AndroidUtils.getGlobalContext().getPackageManager().getPackageInfo("app.revanced.android.gms", 0);
|
||||||
|
return true;
|
||||||
|
} catch (Exception unused) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} // Microg Google Market Services check
|
||||||
|
|
||||||
public static boolean isAnyServicesInstalled() {
|
public static boolean isAnyServicesInstalled() {
|
||||||
for (String packageName : spoofPackages) {
|
return isGmsInstalled() || isFakeGmsInstalled() || isFakeGms2Installed();
|
||||||
if (isSpoofPackageInstalled(packageName)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void fixGapps() {
|
public static void fixGapps() {
|
||||||
@@ -52,10 +52,10 @@ public class GmsHook {
|
|||||||
notificationManager.createNotificationChannel(new NotificationChannel("audio_playback_channel", AndroidUtils.getResources().getString(R.string.audio_message_play_error), NotificationManager.IMPORTANCE_LOW));
|
notificationManager.createNotificationChannel(new NotificationChannel("audio_playback_channel", AndroidUtils.getResources().getString(R.string.audio_message_play_error), NotificationManager.IMPORTANCE_LOW));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // Music channels fix
|
||||||
|
|
||||||
public static String replaceGMSPackage(String str) {
|
public static String replaceGMSPackage(String str) {
|
||||||
return shouldSpoof() ? str.replaceAll("com.google", currentGms) : str;
|
return needToSpoof ? str.replaceAll("com.google", (isFakeGms2Installed() ? "app.revanced" : "com.mgoogle")) : str;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getFirebaseInstanceIdReceiver() {
|
public static String getFirebaseInstanceIdReceiver() {
|
||||||
@@ -63,37 +63,6 @@ public class GmsHook {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Class getFirebaseInstanceIdReceiverClass() {
|
public static Class getFirebaseInstanceIdReceiverClass() {
|
||||||
return getSpoofFirebaseInstanceIdReceiverClass();
|
return needToSpoof ? (isFakeGms2Installed() ? FirebaseInstanceIdReceiver3.class : FirebaseInstanceIdReceiver2.class) : FirebaseInstanceIdReceiver.class;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public static String getCurrentGms() {
|
|
||||||
return currentGms;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean shouldSpoof() {
|
|
||||||
return !isGmsInstalled() && (isSpoofPackageInstalled("com.mgoogle") || isSpoofPackageInstalled("app.revanced"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getSpoofPackagePrefix() {
|
|
||||||
for (String packageName : spoofPackages) {
|
|
||||||
if (isSpoofPackageInstalled(packageName)) {
|
|
||||||
return packageName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "com.google";
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Class getSpoofFirebaseInstanceIdReceiverClass() {
|
|
||||||
switch (currentGms) {
|
|
||||||
case "com.mgoogle" -> {
|
|
||||||
return FirebaseInstanceIdReceiver2.class;
|
|
||||||
}
|
|
||||||
case "app.revanced" -> {
|
|
||||||
return FirebaseInstanceIdReceiver3.class;
|
|
||||||
}
|
|
||||||
default -> {
|
|
||||||
return FirebaseInstanceIdReceiver.class;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
package ru.vtosters.hooks;
|
|
||||||
|
|
||||||
import com.vtosters.lite.api.execute.GetWallInfo;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Since June 12, 2024, there are troubles with API method "execute.getUserInfo" in the old versions of VK Client (<6.16),
|
|
||||||
* to fix that issue we need to upgrade "execute.getUserInfo" for new API versions
|
|
||||||
* and implement the new API method "newsfeed.getPostTopics" (TODO)*/
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public class PostTopicsHook {
|
|
||||||
public static void hook(final GetWallInfo.a model) throws Exception {
|
|
||||||
model.f = new ArrayList<>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,6 +4,7 @@ import android.util.Log;
|
|||||||
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
|
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
|
||||||
import com.vk.core.network.Network;
|
import com.vk.core.network.Network;
|
||||||
import com.vk.core.util.DeviceIdProvider;
|
import com.vk.core.util.DeviceIdProvider;
|
||||||
|
import okhttp3.Headers;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
@@ -47,7 +48,7 @@ public class CatalogJsonInjector {
|
|||||||
fetchCatalogId("https://vk.com/audio?section=albums", oldItems);
|
fetchCatalogId("https://vk.com/audio?section=albums", oldItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Preferences.sendMusicMetrics() && Preferences.getBoolValue("playStatCatalog", false)) {
|
if (Preferences.sendMusicMetrics() && Preferences.getBoolValue("playStatsCatalog", false)) {
|
||||||
fetchCatalogId("https://vk.com/audio?section=recent", oldItems);
|
fetchCatalogId("https://vk.com/audio?section=recent", oldItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,11 +58,7 @@ public class CatalogJsonInjector {
|
|||||||
if (!MusicCacheImpl.isEmpty() && !LibVKXClient.isIntegrationEnabled()) { // inj in playlist list
|
if (!MusicCacheImpl.isEmpty() && !LibVKXClient.isIntegrationEnabled()) { // inj in playlist list
|
||||||
var noPlaylists = !json.has("playlists");
|
var noPlaylists = !json.has("playlists");
|
||||||
|
|
||||||
if (noPlaylists) {
|
PlaylistHelper.addCachedPlaylists(json.optJSONArray("playlists"), noPlaylists);
|
||||||
PlaylistHelper.addCachedPlaylists(new JSONArray());
|
|
||||||
} else {
|
|
||||||
PlaylistHelper.addCachedPlaylists(json.optJSONArray("playlists"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!useOldAppVer || noPlaylists) {
|
if (!useOldAppVer || noPlaylists) {
|
||||||
var newBlocks = new JSONArray();
|
var newBlocks = new JSONArray();
|
||||||
@@ -102,11 +99,7 @@ public class CatalogJsonInjector {
|
|||||||
|
|
||||||
var noPlaylists = !json.has("playlists");
|
var noPlaylists = !json.has("playlists");
|
||||||
|
|
||||||
if (noPlaylists) {
|
PlaylistHelper.addCachedPlaylists(json.optJSONArray("playlists"), noPlaylists);
|
||||||
PlaylistHelper.addCachedPlaylists(new JSONArray());
|
|
||||||
} else {
|
|
||||||
PlaylistHelper.addCachedPlaylists(json.optJSONArray("playlists"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!useOldAppVer && !noPlaylists) {
|
if (!useOldAppVer && !noPlaylists) {
|
||||||
var newBlocks = new JSONArray();
|
var newBlocks = new JSONArray();
|
||||||
@@ -220,14 +213,10 @@ public class CatalogJsonInjector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void removeUnsupportedLayouts(JSONArray blocks) {
|
private static void removeUnsupportedLayouts(JSONArray blocks) throws JSONException {
|
||||||
for (int i = blocks.length() - 1; i >= 0; i--) {
|
for (int i = blocks.length() - 1; i >= 0; i--) {
|
||||||
JSONObject block = blocks.optJSONObject(i);
|
JSONObject block = blocks.optJSONObject(i);
|
||||||
if (block == null) continue;
|
|
||||||
|
|
||||||
JSONObject layout = block.optJSONObject("layout");
|
JSONObject layout = block.optJSONObject("layout");
|
||||||
if (layout == null) continue;
|
|
||||||
|
|
||||||
String data_type = block.optString("data_type");
|
String data_type = block.optString("data_type");
|
||||||
|
|
||||||
if (Objects.equals(data_type, "music_recommended_playlists") || Objects.equals(data_type, "radiostations")) {
|
if (Objects.equals(data_type, "music_recommended_playlists") || Objects.equals(data_type, "radiostations")) {
|
||||||
@@ -237,6 +226,8 @@ public class CatalogJsonInjector {
|
|||||||
continue; // Skip to the next iteration after removing
|
continue; // Skip to the next iteration after removing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (layout == null) continue; // Skip to the next iteration if layout is null
|
||||||
|
|
||||||
String name = layout.optString("name");
|
String name = layout.optString("name");
|
||||||
if (!name.equals("header_extended")) {
|
if (!name.equals("header_extended")) {
|
||||||
continue; // Skip to the next iteration if not header_extended
|
continue; // Skip to the next iteration if not header_extended
|
||||||
@@ -245,14 +236,11 @@ public class CatalogJsonInjector {
|
|||||||
if (layout.has("top_title")) {
|
if (layout.has("top_title")) {
|
||||||
blocks.remove(i);
|
blocks.remove(i);
|
||||||
}
|
}
|
||||||
try {
|
layout.put("name", "header");
|
||||||
layout.put("name", "header");
|
|
||||||
} catch (JSONException e) {
|
|
||||||
e.fillInStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void setDefaultAudioPage(JSONArray jsonArray, JSONObject catalog) throws JSONException {
|
private static void setDefaultAudioPage(JSONArray jsonArray, JSONObject catalog) throws JSONException {
|
||||||
for (int i = 0; i < jsonArray.length(); i++) {
|
for (int i = 0; i < jsonArray.length(); i++) {
|
||||||
var item = jsonArray.optJSONObject(i);
|
var item = jsonArray.optJSONObject(i);
|
||||||
|
|||||||
@@ -165,12 +165,12 @@ public class TracklistInjector {
|
|||||||
boolean noPlaylists = hasNoPlaylists(blocks);
|
boolean noPlaylists = hasNoPlaylists(blocks);
|
||||||
|
|
||||||
if (noPlaylists) {
|
if (noPlaylists) {
|
||||||
PlaylistHelper.addCachedPlaylists(new JSONArray());
|
PlaylistHelper.addCachedPlaylists(catalogNode.optJSONArray("playlists"), true);
|
||||||
|
|
||||||
firstSection.put("blocks", createNewBlocks(blocks));
|
firstSection.put("blocks", createNewBlocks(blocks));
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
PlaylistHelper.addCachedPlaylists(catalogNode.optJSONArray("playlists"));
|
PlaylistHelper.addCachedPlaylists(catalogNode.optJSONArray("playlists"), false);
|
||||||
|
|
||||||
updatePlaylistsIds(blocks);
|
updatePlaylistsIds(blocks);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -246,7 +246,7 @@ public class TracklistInjector {
|
|||||||
.put(getCatalogPlaylist());
|
.put(getCatalogPlaylist());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PlaylistCacheDbDelegate.isPlaylistEmpty(AndroidUtils.getGlobalContext(), AccountManagerUtils.getUserId() + "_-1")) {
|
if (!MusicCacheImpl.getAllOwnTracks().isEmpty()) {
|
||||||
if (MusicCacheImpl.hasPlaylist()) blocks.put(getCatalogSeparator());
|
if (MusicCacheImpl.hasPlaylist()) blocks.put(getCatalogSeparator());
|
||||||
blocks.put(getCatalogHeader(AndroidUtils.getString(R.string.cached_tracks_title)))
|
blocks.put(getCatalogHeader(AndroidUtils.getString(R.string.cached_tracks_title)))
|
||||||
.put(getShuffleButton())
|
.put(getShuffleButton())
|
||||||
@@ -270,7 +270,7 @@ public class TracklistInjector {
|
|||||||
|
|
||||||
return new JSONObject()
|
return new JSONObject()
|
||||||
.put("catalog", catalog)
|
.put("catalog", catalog)
|
||||||
.put("playlists", addCachedPlaylists(new JSONArray()))
|
.put("playlists", addCachedPlaylists(new JSONArray(), false))
|
||||||
.put("audios", TracklistHelper.tracksToJsons(tracks));
|
.put("audios", TracklistHelper.tracksToJsons(tracks));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ public class Device {
|
|||||||
+ "- Manufacturer: " + this.manufacturerName + "\n"
|
+ "- Manufacturer: " + this.manufacturerName + "\n"
|
||||||
+ "- Brand: " + this.brandName + "\n"
|
+ "- Brand: " + this.brandName + "\n"
|
||||||
+ "- Model: " + this.modelName + "\n"
|
+ "- Model: " + this.modelName + "\n"
|
||||||
+ (isMIUI() || isHyperOs() ? "- Miui/HyperOS Version Code: " + this.MiuiUiVersionCode + "\n" + "- Miui/HyperOS Version Name: " + this.MiuiUiVersionName + "\n" : "")
|
+ (isMIUI() ? "- Miui Version Code: " + this.MiuiUiVersionCode + "\n" + "- Miui Version Name: " + this.MiuiUiVersionName + "\n" : "")
|
||||||
+ (isSamsung() ? "- OneUi Major Version: " + this.OneUiMajorVersion + "\n" + "- OneUi Minor Version: " + this.OneUiMinorVersion + "\n" : "")
|
+ (isSamsung() ? "- OneUi Major Version: " + this.OneUiMajorVersion + "\n" + "- OneUi Minor Version: " + this.OneUiMinorVersion + "\n" : "")
|
||||||
+ (hasMiuiIncrCode() ? "- Miui Version Incremental Code: " + this.MiuiIncrementalCode + "\n" : "")
|
+ (hasMiuiIncrCode() ? "- Miui Version Incremental Code: " + this.MiuiIncrementalCode + "\n" : "")
|
||||||
+ (isEMUI() ? "- Emui Version: " + this.EmuiVersion : "");
|
+ (isEMUI() ? "- Emui Version: " + this.EmuiVersion : "");
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class OEMDetector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isOEM() {
|
public static boolean isOEM() {
|
||||||
return isMIUI() || isEMUI() || isFlyme() || isZenUI() || isSamsung() || isVivo() || isOneUi() || isHyperOs();
|
return isMIUI() || isEMUI() || isFlyme() || isZenUI() || isSamsung() || isVivo() || isOneUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isMIUI() {
|
public static boolean isMIUI() {
|
||||||
@@ -68,15 +68,6 @@ public class OEMDetector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isHyperOs() {
|
|
||||||
try {
|
|
||||||
int miuiVer = Integer.parseInt(getMiuiUiVersionCode()); // cuz hyperos gives 816 and etc
|
|
||||||
return miuiVer > 14 && isMIUI();
|
|
||||||
} catch (Exception unused) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isIntentResolved(Context ctx, Intent intent) {
|
public static boolean isIntentResolved(Context ctx, Intent intent) {
|
||||||
return (intent != null && ctx.getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY) != null);
|
return (intent != null && ctx.getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY) != null);
|
||||||
}
|
}
|
||||||
@@ -133,6 +124,7 @@ public class OEMDetector {
|
|||||||
try {
|
try {
|
||||||
return (String) getPropMtd.invoke(null, prop);
|
return (String) getPropMtd.invoke(null, prop);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,12 +59,12 @@ public class MusicCacheImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasPlaylist() {
|
public static boolean hasPlaylist() {
|
||||||
return !PlaylistCacheDbDelegate.isPlaylistsDbEmpty(AndroidUtils.getGlobalContext()); // has playlists or not
|
return PlaylistCacheDbDelegate.getPlaylistsCount(AndroidUtils.getGlobalContext()) != 0; // has playlists or not
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getTracksCount() {
|
public static long getTracksCount() {
|
||||||
return !LibVKXClient.isIntegrationEnabled()
|
return !LibVKXClient.isIntegrationEnabled()
|
||||||
? PlaylistCacheDbDelegate.getTracksCountInPlaylist(AndroidUtils.getGlobalContext(),AccountManagerUtils.getUserId() + "_-1")
|
? MusicCacheDbDelegate.getTracksCount(AndroidUtils.getGlobalContext())
|
||||||
: LibVKXClient.getInstance().runOnServiceSync(
|
: LibVKXClient.getInstance().runOnServiceSync(
|
||||||
new LibVKXClientImpl.LibVKXActionGeneric<Long>() {
|
new LibVKXClientImpl.LibVKXActionGeneric<Long>() {
|
||||||
@Override
|
@Override
|
||||||
@@ -89,7 +89,7 @@ public class MusicCacheImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEmpty() {
|
public static boolean isEmpty() {
|
||||||
return !LibVKXClient.isIntegrationEnabled() && MusicCacheDbDelegate.isEmpty(AndroidUtils.getGlobalContext());
|
return !LibVKXClient.isIntegrationEnabled() && getTracksCount() == 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clear() {
|
public static void clear() {
|
||||||
|
|||||||
@@ -174,15 +174,6 @@ public class MusicCacheDb extends SQLiteOpenHelper implements AutoCloseable { //
|
|||||||
return DatabaseUtils.queryNumEntries(getReadableDatabase(), Constants.TABLE_NAME);
|
return DatabaseUtils.queryNumEntries(getReadableDatabase(), Constants.TABLE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDatabaseEmpty() {
|
|
||||||
SQLiteDatabase db = getReadableDatabase();
|
|
||||||
Cursor cursor = db.rawQuery("SELECT EXISTS(SELECT 1 FROM " + Constants.TABLE_NAME + " LIMIT 1)", null);
|
|
||||||
cursor.moveToFirst();
|
|
||||||
boolean isEmpty = cursor.getInt(0) == 0;
|
|
||||||
cursor.close();
|
|
||||||
return isEmpty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MusicTrack getTrackById(String trackId) {
|
public MusicTrack getTrackById(String trackId) {
|
||||||
SQLiteDatabase db = getReadableDatabase();
|
SQLiteDatabase db = getReadableDatabase();
|
||||||
Cursor cursor = db.query(Constants.TABLE_NAME, null, Constants.COLUMN_TRACK_ID + " = ?", new String[]{trackId}, null, null, null);
|
Cursor cursor = db.query(Constants.TABLE_NAME, null, Constants.COLUMN_TRACK_ID + " = ?", new String[]{trackId}, null, null, null);
|
||||||
|
|||||||
@@ -53,7 +53,8 @@ public class PlaylistCacheDb extends SQLiteOpenHelper implements AutoCloseable {
|
|||||||
Boolean.parseBoolean(cur.getString(cur.getColumnIndex(Constants.COLUMN_IS_EXPLICIT))),
|
Boolean.parseBoolean(cur.getString(cur.getColumnIndex(Constants.COLUMN_IS_EXPLICIT))),
|
||||||
cur.getString(cur.getColumnIndex(Constants.COLUMN_TITLE)),
|
cur.getString(cur.getColumnIndex(Constants.COLUMN_TITLE)),
|
||||||
cur.getString(cur.getColumnIndex(Constants.COLUMN_DESCRIPTION)),
|
cur.getString(cur.getColumnIndex(Constants.COLUMN_DESCRIPTION)),
|
||||||
photo);
|
photo,
|
||||||
|
0);
|
||||||
|
|
||||||
Log.d("Playlist", "generated " + Playlist.U.a(playlist).v1());
|
Log.d("Playlist", "generated " + Playlist.U.a(playlist).v1());
|
||||||
|
|
||||||
@@ -169,50 +170,6 @@ public class PlaylistCacheDb extends SQLiteOpenHelper implements AutoCloseable {
|
|||||||
return playlists;
|
return playlists;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTracksCountInPlaylist(String playlistId) {
|
|
||||||
SQLiteDatabase db = getReadableDatabase();
|
|
||||||
Cursor cursor = db.query(
|
|
||||||
Constants.TABLE_PLAYLIST_TRACKS,
|
|
||||||
new String[]{Constants.COLUMN_TRACK_ID},
|
|
||||||
Constants.COLUMN_PLAYLIST_ID + " = ?",
|
|
||||||
new String[]{playlistId},
|
|
||||||
null, null, null
|
|
||||||
);
|
|
||||||
|
|
||||||
long count = cursor.getCount();
|
|
||||||
cursor.close();
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getAllPlaylistIds() {
|
|
||||||
SQLiteDatabase db = getReadableDatabase();
|
|
||||||
List<String> playlistIds = new ArrayList<>();
|
|
||||||
Cursor cursor = db.query(
|
|
||||||
Constants.TABLE_NAME,
|
|
||||||
new String[]{Constants.COLUMN_ID, Constants.COLUMN_OWNER_ID},
|
|
||||||
null, null, null, null, null
|
|
||||||
);
|
|
||||||
|
|
||||||
if (cursor.moveToFirst()) {
|
|
||||||
do {
|
|
||||||
String playlistId = cursor.getString(cursor.getColumnIndexOrThrow(Constants.COLUMN_OWNER_ID)) + "_" + cursor.getString(cursor.getColumnIndexOrThrow(Constants.COLUMN_ID));
|
|
||||||
playlistIds.add(playlistId);
|
|
||||||
} while (cursor.moveToNext());
|
|
||||||
}
|
|
||||||
|
|
||||||
cursor.close();
|
|
||||||
return playlistIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isPlaylistsDbEmpty() {
|
|
||||||
SQLiteDatabase db = getReadableDatabase();
|
|
||||||
Cursor cursor = db.rawQuery("SELECT EXISTS(SELECT 1 FROM " + Constants.TABLE_NAME + " LIMIT 1)", null);
|
|
||||||
cursor.moveToFirst();
|
|
||||||
boolean isEmpty = cursor.getInt(0) == 0;
|
|
||||||
cursor.close();
|
|
||||||
return isEmpty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addTrackToPlaylist(String playlistId, String trackId) {
|
public void addTrackToPlaylist(String playlistId, String trackId) {
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
values.put(Constants.COLUMN_PLAYLIST_ID, playlistId);
|
values.put(Constants.COLUMN_PLAYLIST_ID, playlistId);
|
||||||
@@ -224,15 +181,6 @@ public class PlaylistCacheDb extends SQLiteOpenHelper implements AutoCloseable {
|
|||||||
getWritableDatabase().delete(Constants.TABLE_PLAYLIST_TRACKS, Constants.COLUMN_PLAYLIST_ID + " = ? AND " + Constants.COLUMN_TRACK_ID + " = ?", new String[]{playlistId, trackId});
|
getWritableDatabase().delete(Constants.TABLE_PLAYLIST_TRACKS, Constants.COLUMN_PLAYLIST_ID + " = ? AND " + Constants.COLUMN_TRACK_ID + " = ?", new String[]{playlistId, trackId});
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPlaylistEmpty(String playlistId) {
|
|
||||||
SQLiteDatabase db = getReadableDatabase();
|
|
||||||
Cursor cursor = db.rawQuery("SELECT EXISTS(SELECT 1 FROM " + Constants.TABLE_PLAYLIST_TRACKS + " WHERE " + Constants.COLUMN_PLAYLIST_ID + " = ? LIMIT 1)", new String[]{playlistId});
|
|
||||||
cursor.moveToFirst();
|
|
||||||
boolean isEmpty = cursor.getInt(0) == 0;
|
|
||||||
cursor.close();
|
|
||||||
return isEmpty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MusicTrack> getTracksInPlaylist(String playlistId) {
|
public List<MusicTrack> getTracksInPlaylist(String playlistId) {
|
||||||
SQLiteDatabase db = getReadableDatabase();
|
SQLiteDatabase db = getReadableDatabase();
|
||||||
Cursor cursor = db.query(
|
Cursor cursor = db.query(
|
||||||
|
|||||||
-6
@@ -55,12 +55,6 @@ public class MusicCacheDbDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEmpty(Context context) {
|
|
||||||
try (var db = connectToDb(context)) {
|
|
||||||
return db.isDatabaseEmpty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isCachedTrack(Context context, String trackId) {
|
public static boolean isCachedTrack(Context context, String trackId) {
|
||||||
try (var db = connectToDb(context)) {
|
try (var db = connectToDb(context)) {
|
||||||
return db.isCachedTrack(trackId);
|
return db.isCachedTrack(trackId);
|
||||||
|
|||||||
-31
@@ -62,31 +62,6 @@ public class PlaylistCacheDbDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getTracksCountInPlaylist(Context context, String playlistId) {
|
|
||||||
try (var db = connectToDb(context)) {
|
|
||||||
return db.getTracksCountInPlaylist(playlistId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isPlaylistsDbEmpty(Context context) {
|
|
||||||
try (var db = connectToDb(context)) {
|
|
||||||
return db.isPlaylistsDbEmpty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void removeAllPlaylists(Context context) {
|
|
||||||
List<String> playlistIds = getAllPlaylistIds(context);
|
|
||||||
for (String playlistId : playlistIds) {
|
|
||||||
deletePlaylist(context, playlistId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<String> getAllPlaylistIds(Context context) {
|
|
||||||
try (var db = connectToDb(context)) {
|
|
||||||
return db.getAllPlaylistIds();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isCachedPlaylist(Context context, String id) {
|
public static boolean isCachedPlaylist(Context context, String id) {
|
||||||
try (var db = connectToDb(context)) {
|
try (var db = connectToDb(context)) {
|
||||||
String[] parts = id.split("_");
|
String[] parts = id.split("_");
|
||||||
@@ -137,12 +112,6 @@ public class PlaylistCacheDbDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPlaylistEmpty(Context context, String playlistId) {
|
|
||||||
try (var db = connectToDb(context)) {
|
|
||||||
return db.isPlaylistEmpty(playlistId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void drop(Context context) {
|
public static void drop(Context context) {
|
||||||
context.deleteDatabase(PlaylistCacheDb.Constants.DB_NAME);
|
context.deleteDatabase(PlaylistCacheDb.Constants.DB_NAME);
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-14
@@ -7,7 +7,6 @@ import org.json.JSONArray;
|
|||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import ru.vtosters.lite.music.cache.MusicCacheImpl;
|
import ru.vtosters.lite.music.cache.MusicCacheImpl;
|
||||||
import ru.vtosters.lite.music.cache.delegate.PlaylistCacheDbDelegate;
|
|
||||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||||
import ru.vtosters.lite.utils.AndroidUtils;
|
import ru.vtosters.lite.utils.AndroidUtils;
|
||||||
import ru.vtosters.lite.utils.NetworkUtils;
|
import ru.vtosters.lite.utils.NetworkUtils;
|
||||||
@@ -23,18 +22,22 @@ public class PlaylistHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSONArray addCachedPlaylists(JSONArray jsonArray) {
|
public static JSONArray addCachedPlaylists(JSONArray jsonArray, Boolean noPlaylists) {
|
||||||
try {
|
try {
|
||||||
if (!PlaylistCacheDbDelegate.isPlaylistEmpty(AndroidUtils.getGlobalContext(), AccountManagerUtils.getUserId() + "_-1")) {
|
if (noPlaylists) {
|
||||||
|
jsonArray.put(new JSONArray().put(getCachedSongsPlaylist()));
|
||||||
|
} else {
|
||||||
jsonArray.put(getCachedSongsPlaylist());
|
jsonArray.put(getCachedSongsPlaylist());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MusicCacheImpl.hasPlaylist()) {
|
for (Playlist playlist : MusicCacheImpl.getPlaylists()) {
|
||||||
for (Playlist playlist : MusicCacheImpl.getPlaylists()) {
|
if (noPlaylists) {
|
||||||
jsonArray.put(generatePlaylist(playlist.a, playlist.b, playlist.C, playlist.g, playlist.B, PlaylistUtils.getThumb(playlist)));
|
jsonArray.put(new JSONArray().put(generatePlaylist(playlist.a, playlist.b, playlist.C, playlist.g, playlist.B, PlaylistUtils.getThumb(playlist), playlist.O)));
|
||||||
|
} else {
|
||||||
Log.d("PlaylistHelper", "Playlist cache added: " + playlist.a + " " + playlist.b + " " + playlist.C + " " + playlist.g + " " + playlist.B);
|
jsonArray.put(generatePlaylist(playlist.a, playlist.b, playlist.C, playlist.g, playlist.B, PlaylistUtils.getThumb(playlist), playlist.O));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.d("PlaylistHelper", "Playlist cache added: " + playlist.a + " " + playlist.b + " " + playlist.C + " " + playlist.g + " " + playlist.B);
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.fillInStackTrace();
|
e.fillInStackTrace();
|
||||||
@@ -42,7 +45,7 @@ public class PlaylistHelper {
|
|||||||
return jsonArray;
|
return jsonArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSONObject generatePlaylist(int id, int owner_id, boolean is_explicit, String title, String description, JSONObject photo) throws JSONException {
|
public static JSONObject generatePlaylist(int id, int owner_id, boolean is_explicit, String title, String description, JSONObject photo, int count) throws JSONException {
|
||||||
JSONObject playlist = new JSONObject()
|
JSONObject playlist = new JSONObject()
|
||||||
.put("id", id)
|
.put("id", id)
|
||||||
.put("owner_id", owner_id)
|
.put("owner_id", owner_id)
|
||||||
@@ -61,7 +64,7 @@ public class PlaylistHelper {
|
|||||||
.put("subtitle", "")
|
.put("subtitle", "")
|
||||||
.put("meta", new JSONObject()
|
.put("meta", new JSONObject()
|
||||||
.put("view", "compact"))
|
.put("view", "compact"))
|
||||||
.put("count", 0);
|
.put("count", count);
|
||||||
|
|
||||||
if (photo != null) {
|
if (photo != null) {
|
||||||
playlist.put("photo", photo);
|
playlist.put("photo", photo);
|
||||||
@@ -98,18 +101,18 @@ public class PlaylistHelper {
|
|||||||
.put("height", 600))
|
.put("height", 600))
|
||||||
.put("meta", new JSONObject()
|
.put("meta", new JSONObject()
|
||||||
.put("view", "compact"))
|
.put("view", "compact"))
|
||||||
.put("count", 0);
|
.put("count", MusicCacheImpl.getAllOwnTracks().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSONArray getCachedPlaylistsIds() {
|
public static JSONArray getCachedPlaylistsIds() {
|
||||||
JSONArray arr = new JSONArray();
|
JSONArray arr = new JSONArray();
|
||||||
|
|
||||||
if (NetworkUtils.isNetworkConnected() && !PlaylistCacheDbDelegate.isPlaylistEmpty(AndroidUtils.getGlobalContext(), AccountManagerUtils.getUserId() + "_-1")) {
|
if (NetworkUtils.isNetworkConnected() && !MusicCacheImpl.getAllOwnTracks().isEmpty()) {
|
||||||
arr.put(AccountManagerUtils.getUserId() + "_-1");
|
arr.put(AccountManagerUtils.getUserId() + "_-1");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String playlist : PlaylistCacheDbDelegate.getAllPlaylistIds(AndroidUtils.getGlobalContext())) {
|
for (var playlist : MusicCacheImpl.getPlaylists()) {
|
||||||
arr.put(playlist);
|
arr.put(playlist.v1());
|
||||||
}
|
}
|
||||||
|
|
||||||
return arr;
|
return arr;
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ public class TracklistHelper {
|
|||||||
|
|
||||||
boolean doNotinvertOrder = Preferences.getBoolValue("invertCachedTracks", false);
|
boolean doNotinvertOrder = Preferences.getBoolValue("invertCachedTracks", false);
|
||||||
|
|
||||||
if (doNotinvertOrder) {
|
if (!doNotinvertOrder) {
|
||||||
Collections.reverse(tracks);
|
Collections.reverse(tracks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import ru.vtosters.lite.utils.NavigatorUtils;
|
|||||||
|
|
||||||
public class InstallGMS {
|
public class InstallGMS {
|
||||||
public static void alert(final Activity activity) {
|
public static void alert(final Activity activity) {
|
||||||
if (!GmsHook.isAnyServicesInstalled() && !GmsHook.isGmsInstalled() && Preferences.getBoolValue("showAlertGms", true)) {
|
if (!GmsHook.isAnyServicesInstalled() && Preferences.getBoolValue("showAlertGms", true)) {
|
||||||
new VkAlertDialog.Builder(activity)
|
new VkAlertDialog.Builder(activity)
|
||||||
.setTitle(activity.getString(R.string.warning))
|
.setTitle(activity.getString(R.string.warning))
|
||||||
.setMessage(activity.getString(R.string.gmsissuesumm))
|
.setMessage(activity.getString(R.string.gmsissuesumm))
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import ru.vtosters.lite.music.LastFMScrobbler;
|
|||||||
import ru.vtosters.lite.music.cache.MusicCacheImpl;
|
import ru.vtosters.lite.music.cache.MusicCacheImpl;
|
||||||
import ru.vtosters.lite.music.cache.delegate.PlaylistCacheDbDelegate;
|
import ru.vtosters.lite.music.cache.delegate.PlaylistCacheDbDelegate;
|
||||||
import ru.vtosters.lite.ui.PreferenceFragmentUtils;
|
import ru.vtosters.lite.ui.PreferenceFragmentUtils;
|
||||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
|
||||||
import ru.vtosters.lite.utils.AndroidUtils;
|
import ru.vtosters.lite.utils.AndroidUtils;
|
||||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||||
|
|
||||||
@@ -56,7 +55,7 @@ public class MusicFragment extends TrackedMaterialPreferenceToolbarFragment {
|
|||||||
if (MusicCacheImpl.isEmpty()) {
|
if (MusicCacheImpl.isEmpty()) {
|
||||||
AndroidUtils.sendToast(requireContext().getString(com.vtosters.lite.R.string.no_cache_error));
|
AndroidUtils.sendToast(requireContext().getString(com.vtosters.lite.R.string.no_cache_error));
|
||||||
} else {
|
} else {
|
||||||
delcache(requireContext(), false);
|
delcache(requireContext());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -74,18 +73,6 @@ public class MusicFragment extends TrackedMaterialPreferenceToolbarFragment {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
PreferenceFragmentUtils.addPreference(
|
|
||||||
getPreferenceScreen(),
|
|
||||||
"cached_playlists",
|
|
||||||
"Удалить все скачанные плейлисты",
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
preference -> {
|
|
||||||
delcache(requireContext(), true);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PreferenceFragmentUtils.addPreference(
|
PreferenceFragmentUtils.addPreference(
|
||||||
@@ -234,13 +221,13 @@ public class MusicFragment extends TrackedMaterialPreferenceToolbarFragment {
|
|||||||
|
|
||||||
PreferenceFragmentUtils.addMaterialSwitchPreference(
|
PreferenceFragmentUtils.addMaterialSwitchPreference(
|
||||||
getPreferenceScreen(),
|
getPreferenceScreen(),
|
||||||
"playStatCatalog",
|
"playStatsCatalog",
|
||||||
"Список истории прослушиваний",
|
"Список истории прослушиваний",
|
||||||
"Показывать вкладку истории прослушиваний в музыкальном разделе\n\nОтключение ускорит открытие музыкального раздела при медленном интернете",
|
"Показывать вкладку истории прослушиваний в музыкальном разделе\n\nОтключение ускорит открытие музыкального раздела при медленном интернете",
|
||||||
null,
|
null,
|
||||||
false,
|
false,
|
||||||
(preference, o) -> {
|
(preference, o) -> {
|
||||||
Preferences.getPreferences().edit().putBoolean("playStatCatalog", (boolean) o).apply();
|
Preferences.getPreferences().edit().putBoolean("playStatsCatalog", (boolean) o).apply();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
).setVisible(Preferences.sendMusicMetrics() && !getBoolValue("useOldAppVer", false));
|
).setVisible(Preferences.sendMusicMetrics() && !getBoolValue("useOldAppVer", false));
|
||||||
@@ -361,7 +348,7 @@ public class MusicFragment extends TrackedMaterialPreferenceToolbarFragment {
|
|||||||
null,
|
null,
|
||||||
true,
|
true,
|
||||||
(preference, o) -> {
|
(preference, o) -> {
|
||||||
Preferences.getPreferences().edit().putBoolean("playlistsCatalogs", (boolean) o).apply();
|
Preferences.getPreferences().edit().putBoolean("playStatsCatalog", (boolean) o).apply();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
).setVisible(!getBoolValue("useOldAppVer", false));
|
).setVisible(!getBoolValue("useOldAppVer", false));
|
||||||
@@ -456,18 +443,12 @@ public class MusicFragment extends TrackedMaterialPreferenceToolbarFragment {
|
|||||||
builder.show();
|
builder.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void delcache(Context ctx, boolean isPlaylists) {
|
private void delcache(Context ctx) {
|
||||||
new VkAlertDialog.Builder(ctx)
|
new VkAlertDialog.Builder(ctx)
|
||||||
.setTitle(com.vtosters.lite.R.string.warning)
|
.setTitle(com.vtosters.lite.R.string.warning)
|
||||||
.setMessage(com.vtosters.lite.R.string.cached_tracks_remove_confirm)
|
.setMessage(com.vtosters.lite.R.string.cached_tracks_remove_confirm)
|
||||||
.setPositiveButton(com.vtosters.lite.R.string.yes, (dialog, which) -> {
|
.setPositiveButton(com.vtosters.lite.R.string.yes, (dialog, which) -> {
|
||||||
executor.submit(() -> {
|
executor.submit(MusicCacheImpl::clear);
|
||||||
if (isPlaylists) {
|
|
||||||
PlaylistCacheDbDelegate.removeAllPlaylists(ctx);
|
|
||||||
} else {
|
|
||||||
PlaylistCacheDbDelegate.deletePlaylist(ctx, AccountManagerUtils.getUserId() + "_-1");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
findPreference("cached_tracks").setSummary(String.format(requireContext().getString(com.vtosters.lite.R.string.cached_tracks_counter), MusicCacheImpl.getTracksCount()));
|
findPreference("cached_tracks").setSummary(String.format(requireContext().getString(com.vtosters.lite.R.string.cached_tracks_counter), MusicCacheImpl.getTracksCount()));
|
||||||
})
|
})
|
||||||
.setNeutralButton(com.vtosters.lite.R.string.no, (dialog, which) -> dialog.cancel())
|
.setNeutralButton(com.vtosters.lite.R.string.no, (dialog, which) -> dialog.cancel())
|
||||||
|
|||||||
@@ -60,12 +60,12 @@ public class OtherFragment extends TrackedMaterialPreferenceToolbarFragment {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
findPreference("microgsettings").setVisible(GmsHook.isAnyServicesInstalled() && !GmsHook.isGmsInstalled());
|
findPreference("microgsettings").setVisible(GmsHook.isFakeGmsInstalled() && !GmsHook.isGmsInstalled());
|
||||||
|
|
||||||
findPreference("microgsettings").setOnPreferenceClickListener(preference -> {
|
findPreference("microgsettings").setOnPreferenceClickListener(preference -> {
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||||
intent.setComponent(new ComponentName(GmsHook.getCurrentGms() + ".android.gms", "org.microg.gms.ui.SettingsActivity"));
|
intent.setComponent(new ComponentName((GmsHook.isFakeGms2Installed() ? "app.revanced.android.gms" : "com.mgoogle.android.gms"), "org.microg.gms.ui.SettingsActivity"));
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ import ru.vtosters.lite.ui.PreferenceFragmentUtils;
|
|||||||
import ru.vtosters.lite.utils.AndroidUtils;
|
import ru.vtosters.lite.utils.AndroidUtils;
|
||||||
import ru.vtosters.lite.utils.VersionReader;
|
import ru.vtosters.lite.utils.VersionReader;
|
||||||
|
|
||||||
import static ru.vtosters.hooks.GmsHook.isSpoofPackageInstalled;
|
|
||||||
|
|
||||||
public class SystemInfo extends TrackedMaterialPreferenceToolbarFragment {
|
public class SystemInfo extends TrackedMaterialPreferenceToolbarFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -48,11 +46,11 @@ public class SystemInfo extends TrackedMaterialPreferenceToolbarFragment {
|
|||||||
boolean isZenUI = OEMDetector.isZenUI();
|
boolean isZenUI = OEMDetector.isZenUI();
|
||||||
boolean isEMUI = OEMDetector.isEMUI();
|
boolean isEMUI = OEMDetector.isEMUI();
|
||||||
boolean hasMiuiIncrCode = OEMDetector.hasMiuiIncrCode();
|
boolean hasMiuiIncrCode = OEMDetector.hasMiuiIncrCode();
|
||||||
boolean isHyperOS = OEMDetector.isHyperOs();
|
|
||||||
|
|
||||||
boolean hasGMS = GmsHook.isGmsInstalled();
|
boolean hasGMS = GmsHook.isGmsInstalled();
|
||||||
boolean hasVancedMicroG = GmsHook.isAnyServicesInstalled();
|
boolean hasVancedMicroG = GmsHook.isFakeGmsInstalled();
|
||||||
String GMSPackageName = hasGMS ? "com.google.android.gms" : hasVancedMicroG ? GmsHook.getCurrentGms() + ".android.gms" : "no gms or microg";
|
boolean hasReVancedMicroG = GmsHook.isFakeGms2Installed();
|
||||||
|
String GMSPackageName = hasGMS ? "com.google.android.gms" : hasVancedMicroG ? "com.mgoogle.android.gms" : hasReVancedMicroG ? "app.revanced.android.gms" : "no gms or microg";
|
||||||
|
|
||||||
boolean isValidSignature = Preferences.isValidSignature();
|
boolean isValidSignature = Preferences.isValidSignature();
|
||||||
boolean isTablet = AndroidUtils.isTablet();
|
boolean isTablet = AndroidUtils.isTablet();
|
||||||
@@ -106,7 +104,9 @@ public class SystemInfo extends TrackedMaterialPreferenceToolbarFragment {
|
|||||||
|
|
||||||
PreferenceFragmentUtils.addPreference(getPreferenceScreen(), "", "isInstalledGoogleGMS", "Value: " + hasGMS, 0, null);
|
PreferenceFragmentUtils.addPreference(getPreferenceScreen(), "", "isInstalledGoogleGMS", "Value: " + hasGMS, 0, null);
|
||||||
|
|
||||||
PreferenceFragmentUtils.addPreference(getPreferenceScreen(), "", "isInstalledMicroG", "Value: " + hasVancedMicroG, 0, null);
|
PreferenceFragmentUtils.addPreference(getPreferenceScreen(), "", "isInstalledVancedMicroG", "Value: " + hasVancedMicroG, 0, null);
|
||||||
|
|
||||||
|
PreferenceFragmentUtils.addPreference(getPreferenceScreen(), "", "isInstalledReVancedMicroG", "Value: " + hasReVancedMicroG, 0, null);
|
||||||
|
|
||||||
PreferenceFragmentUtils.addPreference(getPreferenceScreen(), "", "Product Name", productName, 0, preference -> {
|
PreferenceFragmentUtils.addPreference(getPreferenceScreen(), "", "Product Name", productName, 0, preference -> {
|
||||||
((ClipboardManager) requireActivity().getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", productName));
|
((ClipboardManager) requireActivity().getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", productName));
|
||||||
@@ -194,8 +194,6 @@ public class SystemInfo extends TrackedMaterialPreferenceToolbarFragment {
|
|||||||
|
|
||||||
PreferenceFragmentUtils.addPreference(getPreferenceScreen(), "", "isMiui", "Value: " + isMiui, 0, null);
|
PreferenceFragmentUtils.addPreference(getPreferenceScreen(), "", "isMiui", "Value: " + isMiui, 0, null);
|
||||||
|
|
||||||
PreferenceFragmentUtils.addPreference(getPreferenceScreen(), "", "isHyperOS", "Value: " + isHyperOS, 0, null);
|
|
||||||
|
|
||||||
PreferenceFragmentUtils.addPreference(getPreferenceScreen(), "", "isEMUI", "Value: " + isEMUI, 0, null);
|
PreferenceFragmentUtils.addPreference(getPreferenceScreen(), "", "isEMUI", "Value: " + isEMUI, 0, null);
|
||||||
|
|
||||||
PreferenceFragmentUtils.addPreference(getPreferenceScreen(), "", "isFlyme", "Value: " + isFlyme, 0, null);
|
PreferenceFragmentUtils.addPreference(getPreferenceScreen(), "", "isFlyme", "Value: " + isFlyme, 0, null);
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment {
|
|||||||
boolean isLinksUnverified = AndroidUtils.isLinksUnverified(requireActivity());
|
boolean isLinksUnverified = AndroidUtils.isLinksUnverified(requireActivity());
|
||||||
boolean isDozingAvailable = Build.VERSION.SDK_INT >= 23 && !manager.isIgnoringBatteryOptimizations(AndroidUtils.getPackageName());
|
boolean isDozingAvailable = Build.VERSION.SDK_INT >= 23 && !manager.isIgnoringBatteryOptimizations(AndroidUtils.getPackageName());
|
||||||
boolean areNotificationsDisabled = !AndroidUtils.areNotificationsEnabled() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
|
boolean areNotificationsDisabled = !AndroidUtils.areNotificationsEnabled() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
|
||||||
boolean isGMSNotInstalled = !GmsHook.isAnyServicesInstalled() && !GmsHook.isGmsInstalled();
|
boolean isGMSNotInstalled = !GmsHook.isAnyServicesInstalled();
|
||||||
|
|
||||||
if (AccountManagerUtils.isLogin()) {
|
if (AccountManagerUtils.isLogin()) {
|
||||||
Preference accountSwitcher = PreferenceFragmentUtils.addPreference(
|
Preference accountSwitcher = PreferenceFragmentUtils.addPreference(
|
||||||
@@ -584,7 +584,7 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= 33 && (!OEMDetector.isMIUI() || OEMDetector.isHyperOs())) {
|
if (Build.VERSION.SDK_INT >= 33 && !OEMDetector.isMIUI()) {
|
||||||
PreferenceFragmentUtils.addPreference(
|
PreferenceFragmentUtils.addPreference(
|
||||||
getPreferenceScreen(),
|
getPreferenceScreen(),
|
||||||
"",
|
"",
|
||||||
|
|||||||
Regular → Executable
Regular → Executable
+403
-566
File diff suppressed because it is too large
Load Diff
+545
-541
File diff suppressed because it is too large
Load Diff
+1
-1128
File diff suppressed because it is too large
Load Diff
@@ -474,7 +474,7 @@
|
|||||||
invoke-virtual {p1, v1, v0}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V
|
invoke-virtual {p1, v1, v0}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V
|
||||||
|
|
||||||
.line 15
|
.line 15
|
||||||
const-string v0, "48761EEF50EE53AFC4CC9C5F10E6BDE7F8F5B82F"
|
const-string v0, "C8EAB7342DA62B4A229E1BFDEB27B029DD6788A1"
|
||||||
|
|
||||||
const-string v1, "X-Android-Cert"
|
const-string v1, "X-Android-Cert"
|
||||||
|
|
||||||
|
|||||||
@@ -390,8 +390,6 @@
|
|||||||
.method public static final b(Lorg/json/JSONObject;)Lcom/vk/dto/newsfeed/Owner;
|
.method public static final b(Lorg/json/JSONObject;)Lcom/vk/dto/newsfeed/Owner;
|
||||||
.locals 1
|
.locals 1
|
||||||
|
|
||||||
invoke-static {p0}, Lru/vtosters/hooks/RenameHook;->injectIntoJsonGroup(Lorg/json/JSONObject;)V
|
|
||||||
|
|
||||||
sget-object v0, Lcom/vk/dto/newsfeed/Owner;->h:Lcom/vk/dto/newsfeed/Owner$b;
|
sget-object v0, Lcom/vk/dto/newsfeed/Owner;->h:Lcom/vk/dto/newsfeed/Owner$b;
|
||||||
|
|
||||||
invoke-virtual {v0, p0}, Lcom/vk/dto/newsfeed/Owner$b;->b(Lorg/json/JSONObject;)Lcom/vk/dto/newsfeed/Owner;
|
invoke-virtual {v0, p0}, Lcom/vk/dto/newsfeed/Owner$b;->b(Lorg/json/JSONObject;)Lcom/vk/dto/newsfeed/Owner;
|
||||||
@@ -404,8 +402,6 @@
|
|||||||
.method public static final c(Lorg/json/JSONObject;)Lcom/vk/dto/newsfeed/Owner;
|
.method public static final c(Lorg/json/JSONObject;)Lcom/vk/dto/newsfeed/Owner;
|
||||||
.locals 1
|
.locals 1
|
||||||
|
|
||||||
invoke-static {p0}, Lru/vtosters/hooks/RenameHook;->injectIntoJson(Lorg/json/JSONObject;)V
|
|
||||||
|
|
||||||
sget-object v0, Lcom/vk/dto/newsfeed/Owner;->h:Lcom/vk/dto/newsfeed/Owner$b;
|
sget-object v0, Lcom/vk/dto/newsfeed/Owner;->h:Lcom/vk/dto/newsfeed/Owner$b;
|
||||||
|
|
||||||
invoke-virtual {v0, p0}, Lcom/vk/dto/newsfeed/Owner$b;->c(Lorg/json/JSONObject;)Lcom/vk/dto/newsfeed/Owner;
|
invoke-virtual {v0, p0}, Lcom/vk/dto/newsfeed/Owner$b;->c(Lorg/json/JSONObject;)Lcom/vk/dto/newsfeed/Owner;
|
||||||
|
|||||||
@@ -194,8 +194,6 @@
|
|||||||
|
|
||||||
move-result v0
|
move-result v0
|
||||||
|
|
||||||
const v0, 0x0
|
|
||||||
|
|
||||||
if-eqz v0, :cond_2
|
if-eqz v0, :cond_2
|
||||||
|
|
||||||
const/4 v0, 0x1
|
const/4 v0, 0x1
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
const-string v0, "func_v"
|
const-string v0, "func_v"
|
||||||
|
|
||||||
const/16 v1, 0x25
|
const/16 v1, 0x1b
|
||||||
|
|
||||||
.line 3
|
.line 3
|
||||||
invoke-virtual {p0, v0, v1}, Lcom/vk/api/base/ApiRequest;->b(Ljava/lang/String;I)Lcom/vk/api/base/ApiRequest;
|
invoke-virtual {p0, v0, v1}, Lcom/vk/api/base/ApiRequest;->b(Ljava/lang/String;I)Lcom/vk/api/base/ApiRequest;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
.line 3
|
.line 3
|
||||||
invoke-virtual {p0, v0, p1}, Lcom/vk/api/base/ApiRequest;->b(Ljava/lang/String;I)Lcom/vk/api/base/ApiRequest;
|
invoke-virtual {p0, v0, p1}, Lcom/vk/api/base/ApiRequest;->b(Ljava/lang/String;I)Lcom/vk/api/base/ApiRequest;
|
||||||
|
|
||||||
const/16 v0, 0x17
|
const/16 v0, 0xb
|
||||||
|
|
||||||
const-string v1, "func_v"
|
const-string v1, "func_v"
|
||||||
|
|
||||||
@@ -476,89 +476,89 @@
|
|||||||
|
|
||||||
invoke-direct {v2}, Landroid/util/SparseArray;-><init>()V
|
invoke-direct {v2}, Landroid/util/SparseArray;-><init>()V
|
||||||
|
|
||||||
# const-string v4, "cities"
|
const-string v4, "cities"
|
||||||
|
|
||||||
# .line 20
|
.line 20
|
||||||
# invoke-virtual {v1, v4}, Lorg/json/JSONObject;->getJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;
|
invoke-virtual {v1, v4}, Lorg/json/JSONObject;->getJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;
|
||||||
|
|
||||||
# move-result-object v4
|
move-result-object v4
|
||||||
|
|
||||||
# const/4 v9, 0x0
|
const/4 v9, 0x0
|
||||||
|
|
||||||
# .line 21
|
.line 21
|
||||||
# :goto_3
|
:goto_3
|
||||||
# invoke-virtual {v4}, Lorg/json/JSONArray;->length()I
|
invoke-virtual {v4}, Lorg/json/JSONArray;->length()I
|
||||||
|
|
||||||
# move-result v10
|
move-result v10
|
||||||
|
|
||||||
const-string v11, "title"
|
const-string v11, "title"
|
||||||
|
|
||||||
# if-ge v9, v10, :cond_4
|
if-ge v9, v10, :cond_4
|
||||||
|
|
||||||
# .line 22
|
.line 22
|
||||||
# invoke-virtual {v4, v9}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;
|
invoke-virtual {v4, v9}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;
|
||||||
|
|
||||||
# move-result-object v10
|
move-result-object v10
|
||||||
|
|
||||||
# .line 23
|
.line 23
|
||||||
# invoke-virtual {v10, v3}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I
|
invoke-virtual {v10, v3}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I
|
||||||
|
|
||||||
# move-result v12
|
move-result v12
|
||||||
|
|
||||||
# invoke-virtual {v10, v11}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;
|
invoke-virtual {v10, v11}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;
|
||||||
|
|
||||||
# move-result-object v10
|
move-result-object v10
|
||||||
|
|
||||||
# invoke-virtual {v2, v12, v10}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V
|
invoke-virtual {v2, v12, v10}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V
|
||||||
|
|
||||||
# add-int/lit8 v9, v9, 0x1
|
add-int/lit8 v9, v9, 0x1
|
||||||
|
|
||||||
# goto :goto_3
|
goto :goto_3
|
||||||
|
|
||||||
# .line 24
|
.line 24
|
||||||
# :cond_4
|
:cond_4
|
||||||
# new-instance v4, Landroid/util/SparseArray;
|
new-instance v4, Landroid/util/SparseArray;
|
||||||
|
|
||||||
# invoke-direct {v4}, Landroid/util/SparseArray;-><init>()V
|
invoke-direct {v4}, Landroid/util/SparseArray;-><init>()V
|
||||||
|
|
||||||
# const-string v9, "cities"
|
const-string v9, "cities"
|
||||||
|
|
||||||
# .line 25
|
.line 25
|
||||||
# invoke-virtual {v1, v9}, Lorg/json/JSONObject;->getJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;
|
invoke-virtual {v1, v9}, Lorg/json/JSONObject;->getJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;
|
||||||
|
|
||||||
# move-result-object v9
|
move-result-object v9
|
||||||
|
|
||||||
# const/4 v10, 0x0
|
const/4 v10, 0x0
|
||||||
|
|
||||||
# .line 26
|
.line 26
|
||||||
# :goto_4
|
:goto_4
|
||||||
# invoke-virtual {v9}, Lorg/json/JSONArray;->length()I
|
invoke-virtual {v9}, Lorg/json/JSONArray;->length()I
|
||||||
|
|
||||||
# move-result v12
|
move-result v12
|
||||||
|
|
||||||
# if-ge v10, v12, :cond_5
|
if-ge v10, v12, :cond_5
|
||||||
|
|
||||||
# .line 27
|
.line 27
|
||||||
# invoke-virtual {v9, v10}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;
|
invoke-virtual {v9, v10}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;
|
||||||
|
|
||||||
# move-result-object v12
|
move-result-object v12
|
||||||
|
|
||||||
# .line 28
|
.line 28
|
||||||
# invoke-virtual {v12, v3}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I
|
invoke-virtual {v12, v3}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I
|
||||||
|
|
||||||
# move-result v13
|
move-result v13
|
||||||
|
|
||||||
# invoke-virtual {v12, v11}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;
|
invoke-virtual {v12, v11}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;
|
||||||
|
|
||||||
# move-result-object v12
|
move-result-object v12
|
||||||
|
|
||||||
# invoke-virtual {v4, v13, v12}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V
|
invoke-virtual {v4, v13, v12}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V
|
||||||
|
|
||||||
# add-int/lit8 v10, v10, 0x1
|
add-int/lit8 v10, v10, 0x1
|
||||||
|
|
||||||
# goto :goto_4
|
goto :goto_4
|
||||||
|
|
||||||
# :cond_5
|
:cond_5
|
||||||
const-string v4, "can_write_private_message"
|
const-string v4, "can_write_private_message"
|
||||||
|
|
||||||
.line 29
|
.line 29
|
||||||
|
|||||||
@@ -285,8 +285,7 @@
|
|||||||
|
|
||||||
const-string p1, "func_v"
|
const-string p1, "func_v"
|
||||||
|
|
||||||
#upgrade func_v to 0x16 to fix issue related with outdated gettings of post topics
|
const/16 v0, 0x15
|
||||||
const/16 v0, 0x16
|
|
||||||
|
|
||||||
.line 9
|
.line 9
|
||||||
invoke-virtual {p0, p1, v0}, Lcom/vk/api/base/ApiRequest;->b(Ljava/lang/String;I)Lcom/vk/api/base/ApiRequest;
|
invoke-virtual {p0, p1, v0}, Lcom/vk/api/base/ApiRequest;->b(Ljava/lang/String;I)Lcom/vk/api/base/ApiRequest;
|
||||||
@@ -386,7 +385,6 @@
|
|||||||
.end annotation
|
.end annotation
|
||||||
.end param
|
.end param
|
||||||
|
|
||||||
|
|
||||||
const/4 v0, 0x0
|
const/4 v0, 0x0
|
||||||
|
|
||||||
:try_start_0
|
:try_start_0
|
||||||
@@ -505,22 +503,18 @@
|
|||||||
|
|
||||||
iput-object v1, v3, Lcom/vtosters/lite/api/execute/GetWallInfo$a;->e:Lcom/vk/auth/api/AccountPhoneVerify;
|
iput-object v1, v3, Lcom/vtosters/lite/api/execute/GetWallInfo$a;->e:Lcom/vk/auth/api/AccountPhoneVerify;
|
||||||
|
|
||||||
invoke-static {v3}, Lru/vtosters/hooks/PostTopicsHook;->hook(Lcom/vtosters/lite/api/execute/GetWallInfo$a;)V
|
const-string v1, "post_topics"
|
||||||
|
|
||||||
# const-string v1, "post_topics"
|
.line 17
|
||||||
|
invoke-virtual {p1, v1}, Lorg/json/JSONObject;->optJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;
|
||||||
|
|
||||||
# .line 17
|
move-result-object v1
|
||||||
# invoke-virtual {p1, v1}, Lorg/json/JSONObject;->optJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;
|
|
||||||
|
|
||||||
# move-result-object v1
|
invoke-static {v1}, Lcom/vk/dto/newsfeed/PostTopic;->a(Lorg/json/JSONArray;)Ljava/util/List;
|
||||||
|
|
||||||
# invoke-static {v1}, Lcom/vk/dto/newsfeed/PostTopic;->a(Lorg/json/JSONArray;)Ljava/util/List;
|
|
||||||
|
|
||||||
# move-result-object v1
|
|
||||||
|
|
||||||
# iput-object v1, v3, Lcom/vtosters/lite/api/execute/GetWallInfo$a;->f:Ljava/util/List;
|
|
||||||
|
|
||||||
|
move-result-object v1
|
||||||
|
|
||||||
|
iput-object v1, v3, Lcom/vtosters/lite/api/execute/GetWallInfo$a;->f:Ljava/util/List;
|
||||||
|
|
||||||
const-string v1, "special_events"
|
const-string v1, "special_events"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user