Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d41d423f8 | ||
|
|
37a4ba4462 | ||
|
|
7fba308f99 | ||
|
|
5ef2f2f6cd | ||
|
|
522f6cd42b | ||
|
|
7dd9e5ff3a | ||
|
|
07f8542f56 |
Vendored
+1
-1
@@ -35,7 +35,7 @@
|
||||
-optimizationpasses 5
|
||||
-keepattributes SourceFile, LineNumberTable
|
||||
|
||||
-keep,allowoptimization class ru.vtosters.hooks.**, ru.vtosters.lite.utils.AndroidUtils, ru.vtosters.lite.utils.NetworkUtils, ru.vtosters.lite.utils.CrashReporter, ru.vtosters.lite.ui.activities.**, ru.vtosters.lite.services.**, ru.vtosters.lite.ui.fragments.**, ru.vtosters.lite.themes.**, ru.vtosters.lite.music.hook.**, ru.vtosters.lite.music.cache.injectors.**, ru.vtosters.lite.ui.wallpapers.NativeEffects, com.aefyr.tsg.g2.TelegramStickersService {
|
||||
-keep,allowoptimization class ru.vtosters.hooks.**, ru.vtosters.sponsorpost.internal.Native, ru.vtosters.lite.utils.AndroidUtils, ru.vtosters.lite.utils.NetworkUtils, ru.vtosters.lite.utils.CrashReporter, ru.vtosters.lite.ui.activities.**, ru.vtosters.lite.services.**, ru.vtosters.lite.ui.fragments.**, ru.vtosters.lite.themes.**, ru.vtosters.lite.music.hook.**, ru.vtosters.lite.music.cache.injectors.**, ru.vtosters.lite.ui.wallpapers.NativeEffects, com.aefyr.tsg.g2.TelegramStickersService {
|
||||
public <fields>;
|
||||
public <methods>;
|
||||
public <init>(...);
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" android:maxSdkVersion="22"/>
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
|
||||
|
||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" android:maxSdkVersion="22"/>
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
package com.vk.contacts;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.RadioButton;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.core.ui.themes.VKThemeHelper;
|
||||
import com.vk.core.util.ContextExtKt;
|
||||
import com.vk.navigation.NavigatorKeys;
|
||||
import com.vk.permission.PermissionHelper;
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.VKActivity;
|
||||
import com.vtosters.lite.activities.LogoutReceiver;
|
||||
import java.util.List;
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.b.Functions;
|
||||
import kotlin.jvm.b.Functions2;
|
||||
|
||||
public class ContactsSyncAcitvity extends VKActivity implements View.OnClickListener {
|
||||
private boolean I;
|
||||
private View J;
|
||||
private RadioButton K;
|
||||
private RadioButton L;
|
||||
private RadioButton M;
|
||||
@Nullable
|
||||
private String G = null;
|
||||
private int H = 2;
|
||||
private LogoutReceiver N = null;
|
||||
|
||||
public static void a(Context context) {
|
||||
b(context, ContactsSyncUtils.b());
|
||||
}
|
||||
|
||||
public static void b(Context context, int i) {
|
||||
a(context, i, null);
|
||||
}
|
||||
|
||||
private void f(int i) {
|
||||
this.H = i;
|
||||
this.K.setChecked(i == 0);
|
||||
this.L.setChecked(i == 1);
|
||||
this.M.setChecked(i == 2);
|
||||
CheckBox checkBox = this.J.findViewById(R.id.sync_big_pictures);
|
||||
checkBox.setEnabled(i != 2);
|
||||
if (i == 2) {
|
||||
checkBox.setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void onDismiss() {
|
||||
ContactsSyncReporter.a.a(ContactsSyncUtils.b(), this.G);
|
||||
finish();
|
||||
}
|
||||
|
||||
private void x1() {
|
||||
this.H = getIntent().getIntExtra("force_select_sync_contacts", ContactsSyncUtils.b());
|
||||
this.I = ContactsSyncUtils.d();
|
||||
|
||||
this.K = this.J.findViewById(R.id.welcome_sync_opt1);
|
||||
this.L = this.J.findViewById(R.id.welcome_sync_opt2);
|
||||
this.M = this.J.findViewById(R.id.welcome_sync_opt3);
|
||||
|
||||
this.K.setChecked(this.H == 0);
|
||||
this.L.setChecked(this.H == 1);
|
||||
this.M.setChecked(this.H == 2);
|
||||
|
||||
this.J.findViewById(R.id.welcome_sync1).setOnClickListener(this);
|
||||
this.J.findViewById(R.id.welcome_sync2).setOnClickListener(this);
|
||||
this.J.findViewById(R.id.welcome_sync3).setOnClickListener(this);
|
||||
|
||||
CheckBox checkBox = this.J.findViewById(R.id.sync_big_pictures);
|
||||
checkBox.setChecked(this.I);
|
||||
checkBox.setEnabled(this.H != 2);
|
||||
checkBox.setOnCheckedChangeListener(ContactsSyncAcitvity.this::a);
|
||||
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(this);
|
||||
builder.setTitle(R.string.sett_sync);
|
||||
builder.setView(this.J);
|
||||
builder.setCancelable(false);
|
||||
builder.setPositiveButton(R.string.save, ContactsSyncAcitvity.this::a);
|
||||
builder.setNegativeButton(R.string.cancel, ContactsSyncAcitvity.this::b);
|
||||
builder.show();
|
||||
}
|
||||
|
||||
public Unit c(List list) {
|
||||
ContactsSyncReporter.a.a(this.G);
|
||||
finish();
|
||||
return Unit.a;
|
||||
}
|
||||
|
||||
@SuppressLint("NonConstantResourceId")
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.welcome_sync1 /* 2131365835 */:
|
||||
f(0);
|
||||
return;
|
||||
case R.id.welcome_sync2 /* 2131365836 */:
|
||||
f(1);
|
||||
return;
|
||||
case R.id.welcome_sync3 /* 2131365837 */:
|
||||
f(2);
|
||||
return;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.vtosters.lite.VKActivity, com.vk.core.ui.themes.ThemableActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
|
||||
public void onCreate(Bundle bundle) {
|
||||
setTheme(VKThemeHelper.n());
|
||||
super.onCreate(bundle);
|
||||
this.G = getIntent().getStringExtra(NavigatorKeys.l0);
|
||||
this.N = LogoutReceiver.a(this);
|
||||
overridePendingTransition(0, 0);
|
||||
getWindow().setBackgroundDrawableResource(R.drawable.transparent);
|
||||
setContentView(new View(this));
|
||||
this.J = View.inflate(new ContextThemeWrapper(this, VKThemeHelper.n()), R.layout.welcome, null);
|
||||
VKThemeHelper.d(this);
|
||||
PermissionHelper permissionHelper = PermissionHelper.r;
|
||||
permissionHelper.a(this, permissionHelper.e(), R.string.permissions_contacts_sync, R.string.permissions_contacts_sync_settings, new Functions() { // from class: com.vk.contacts.c
|
||||
@Override // kotlin.jvm.b.Functions
|
||||
public Object invoke() {
|
||||
return ContactsSyncAcitvity.this.w1();
|
||||
}
|
||||
}, new Functions2() { // from class: com.vk.contacts.a
|
||||
@Override // kotlin.jvm.b.Functions2
|
||||
public Object invoke(Object obj) {
|
||||
return ContactsSyncAcitvity.this.c((List) obj);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // com.vtosters.lite.VKActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
||||
public void onDestroy() {
|
||||
this.N.a();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override // android.app.Activity
|
||||
protected void onRestoreInstanceState(Bundle bundle) {
|
||||
super.onRestoreInstanceState(bundle);
|
||||
this.H = bundle.getInt("state_option", 2);
|
||||
this.I = bundle.getBoolean("state_sync_hq_photo", false);
|
||||
f(this.H);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
|
||||
public void onSaveInstanceState(Bundle bundle) {
|
||||
super.onSaveInstanceState(bundle);
|
||||
bundle.putInt("state_option", this.H);
|
||||
bundle.putBoolean("state_sync_hq_photo", this.I);
|
||||
}
|
||||
|
||||
public Unit w1() {
|
||||
x1();
|
||||
return Unit.a;
|
||||
}
|
||||
|
||||
public static void a(Context context, int i, @Nullable String str) {
|
||||
Intent intent = new Intent(context, ContactsSyncAcitvity.class);
|
||||
intent.setAction("syncsettings");
|
||||
intent.putExtra("force_select_sync_contacts", i);
|
||||
intent.putExtra(NavigatorKeys.l0, str);
|
||||
if (ContextExtKt.e(context) == null) {
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
}
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
public void b(DialogInterface dialogInterface, int i) {
|
||||
onDismiss();
|
||||
}
|
||||
|
||||
public void a(CompoundButton compoundButton, boolean z) {
|
||||
this.I = z;
|
||||
}
|
||||
|
||||
public void a(DialogInterface dialogInterface, int i) {
|
||||
ContactsSyncUtils.b(this.H);
|
||||
ContactsSyncUtils.a(this.I);
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("option", this.H);
|
||||
setResult(-1, intent);
|
||||
onDismiss();
|
||||
}
|
||||
|
||||
public void a(DialogInterface dialogInterface) {
|
||||
onDismiss();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.vk.contacts;
|
||||
|
||||
import com.vk.metrics.eventtracking.Event;
|
||||
import com.vk.metrics.eventtracking.VkTracker;
|
||||
import com.vk.navigation.NavigatorKeys;
|
||||
|
||||
|
||||
public final class ContactsSyncReporter {
|
||||
public static final ContactsSyncReporter a = new ContactsSyncReporter();
|
||||
private static final String EVENT_NAME = "LoggingTracker";
|
||||
private static final String ENABLE_CONTACTS_SYNC = "enable_contacts_sync";
|
||||
private static final String HAS_CONTACTS_PERMISSION = "has_contacts_permission";
|
||||
private static final String SELECTED_SYNC_OPTION = "selected_sync_option";
|
||||
private static final String NAVIGATOR_KEYS_L0 = NavigatorKeys.l0;
|
||||
|
||||
private ContactsSyncReporter() {
|
||||
}
|
||||
|
||||
private static Event createEvent(boolean z, int i, String str) {
|
||||
Event.a a2 = Event.b.a();
|
||||
a2.a(EVENT_NAME);
|
||||
a2.a(ENABLE_CONTACTS_SYNC);
|
||||
a2.a(HAS_CONTACTS_PERMISSION, z);
|
||||
a2.a(SELECTED_SYNC_OPTION, i != 0 ? (i != 1 ? "disabled" : "contacts") : "all");
|
||||
if (str == null) {
|
||||
str = "";
|
||||
}
|
||||
a2.a(NAVIGATOR_KEYS_L0, str);
|
||||
return a2.a();
|
||||
}
|
||||
|
||||
public void a(String str) {
|
||||
a(false, 2, str);
|
||||
}
|
||||
|
||||
public void a(int i, String str) {
|
||||
a(true, i, str);
|
||||
}
|
||||
|
||||
private void a(boolean z, int i, String str) {
|
||||
VkTracker vkTracker = VkTracker.k;
|
||||
Event event = createEvent(z, i, str);
|
||||
vkTracker.a(event);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.vk.contacts;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import com.vk.auth.VKAuthUtils;
|
||||
import com.vk.core.concurrent.VkExecutors;
|
||||
import com.vk.core.preference.Preference;
|
||||
import com.vk.core.util.AppContextHolder;
|
||||
import com.vk.metrics.eventtracking.VkTracker;
|
||||
import com.vtosters.lite.auth.VKAccountManager;
|
||||
|
||||
public final class ContactsSyncUtils {
|
||||
private static final SharedPreferences prefs;
|
||||
|
||||
static {
|
||||
prefs = Preference.b();
|
||||
}
|
||||
|
||||
public static void a(boolean z) { // setSyncHqPhotos
|
||||
try {
|
||||
prefs.edit().putBoolean("sync_hq_photos", z).apply();
|
||||
Log.d("Contacts", "setSyncHqPhotos");
|
||||
} catch (Exception e) {
|
||||
VkTracker.k.b(e);
|
||||
e.fillInStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void b(int i) { // setSyncOption
|
||||
try {
|
||||
prefs.edit().putInt("key_sync_option", i).apply();
|
||||
syncAccount(i);
|
||||
Log.d("Contacts", "setSyncOption");
|
||||
} catch (Exception e) {
|
||||
VkTracker.k.b(e);
|
||||
e.fillInStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean d() { // getSyncHqPhotos
|
||||
return prefs.getBoolean("sync_hq_photos", false);
|
||||
}
|
||||
|
||||
public static void e() { // syncAccount
|
||||
syncAccount(b());
|
||||
Log.d("Contacts", "syncAccount");
|
||||
}
|
||||
|
||||
public static int b() { // getSyncOption
|
||||
Account[] accounts;
|
||||
try {
|
||||
AccountManager accountManager = AccountManager.get(AppContextHolder.a);
|
||||
accounts = accountManager.getAccountsByType("com.vkontakte.account");
|
||||
if (accounts.length == 0) {
|
||||
Account account = new Account(VKAccountManager.d().Z(), "com.vkontakte.account");
|
||||
try {
|
||||
accountManager.addAccountExplicitly(account, null, null);
|
||||
} catch (Exception e) {
|
||||
VkTracker.k.a(e);
|
||||
e.fillInStackTrace();
|
||||
}
|
||||
accounts = new Account[]{account};
|
||||
}
|
||||
if (ContentResolver.getSyncAutomatically(accounts[0], "com.android.contacts")) {
|
||||
if (prefs.contains("key_sync_option")) {
|
||||
return prefs.getInt("key_sync_option", 2);
|
||||
}
|
||||
if (prefs.contains("sync_all")) {
|
||||
return prefs.getBoolean("sync_all", false) ? 0 : 1;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
return 2;
|
||||
} catch (Exception e2) {
|
||||
VkTracker.k.b(e2);
|
||||
e2.fillInStackTrace();
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
private static void syncAccount(int i) {
|
||||
Log.d("Contacts", String.valueOf(i));
|
||||
if (!VKAccountManager.d().b1()) {
|
||||
syncAllAccounts();
|
||||
Log.d("Contacts", "VKAccountManager.d().b1() is not false");
|
||||
return;
|
||||
}
|
||||
Account account = VKAuthUtils.a.a(VKAccountManager.d().Z());
|
||||
if (i != 2 && account != null) {
|
||||
syncSingleAccount(account);
|
||||
Log.d("Contacts", "sync single account, account is " + account);
|
||||
} else {
|
||||
syncAllAccounts();
|
||||
Log.d("Contacts", "sync all accounts, account is " + account);
|
||||
}
|
||||
}
|
||||
|
||||
private static void syncSingleAccount(Account account) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean("com.vtosters.lite.EXTRA_FORCE_KEY", true);
|
||||
ContentResolver.requestSync(account, "com.android.contacts", bundle);
|
||||
VkExecutors.x.l().submit(() -> ContactsSyncAdapterService.a(AppContextHolder.a, account, new Bundle()));
|
||||
}
|
||||
|
||||
private static void syncAllAccounts() {
|
||||
VkExecutors.x.l().submit(() -> ContactsSyncAdapterService.a(AppContextHolder.a.getContentResolver()));
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import android.util.Log;
|
||||
import androidx.annotation.Keep;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
import ru.vtosters.sponsorpost.internal.Native;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.lang.ref.WeakReference;
|
||||
@@ -274,6 +275,7 @@ public final class MediaNative {
|
||||
SoLoader.init(context2, false);
|
||||
NativeLibLoader.loadLibrary("gnustl_shared");
|
||||
NativeLibLoader.loadLibrary("vkchronicle");
|
||||
Native.canVote = NativeLibLoader.loadLibrary("sponsorpost");
|
||||
loadVKMediaLibs();
|
||||
f17443d.notifyAll();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.vk.newsfeed.holders;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.core.ui.themes.VKThemeHelper;
|
||||
import com.vk.dto.newsfeed.entries.NewsEntry;
|
||||
import com.vk.dto.newsfeed.entries.Post;
|
||||
import com.vk.dto.newsfeed.entries.PromoPost;
|
||||
import com.vk.extensions.ViewExtKt;
|
||||
import com.vtosters.lite.R;
|
||||
import ru.vtosters.hooks.other.Preferences;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.newsfeed.NewsFeedFiltersUtils;
|
||||
import ru.vtosters.sponsorpost.internal.Native;
|
||||
import ru.vtosters.sponsorpost.internal.VotesPreferences;
|
||||
import ru.vtosters.sponsorpost.internal.VotesService;
|
||||
import ru.vtosters.sponsorpost.utils.PostsPreferences;
|
||||
|
||||
public final class AdMarkHolder extends BaseNewsEntryHolder<NewsEntry> {
|
||||
private final TextView F;
|
||||
|
||||
@SuppressLint("ResourceType")
|
||||
public AdMarkHolder(ViewGroup viewGroup) {
|
||||
super(R.layout.marked_as_ads, viewGroup);
|
||||
View view = ((RecyclerView.ViewHolder) this).itemView;
|
||||
this.F = ViewExtKt.a(view, R.id.text, (View.OnClickListener) null);
|
||||
}
|
||||
|
||||
@SuppressLint("ResourceType")
|
||||
public void b(NewsEntry newsEntry) { // onBind
|
||||
String disclamer = null;
|
||||
Drawable drawable = null;
|
||||
int height = 0;
|
||||
|
||||
if (newsEntry instanceof Post) {
|
||||
Post post = ((Post) newsEntry);
|
||||
if (post.L1()) {
|
||||
drawable = VKThemeHelper.a(R.drawable.marked_as_ads, R.attr.icon_tertiary);
|
||||
int ownerId = post.b();
|
||||
int postId = post.P1();
|
||||
int date = post.K();
|
||||
String text = post.getText();
|
||||
|
||||
if (PostsPreferences.isPostAd(ownerId, postId)) {
|
||||
disclamer = "SponsorPost: Реклама";
|
||||
if (Preferences.isValidSignature() && Native.canVote()) {
|
||||
this.F.setOnClickListener(listener -> voteDialog(ownerId, postId, date, this.F.getContext()));
|
||||
}
|
||||
} else if (VotesPreferences.isPostAd(ownerId, postId)) {
|
||||
disclamer = "SponsorPost: Возможно реклама";
|
||||
if (Preferences.isValidSignature() && Native.canVote()) {
|
||||
this.F.setOnClickListener(listener -> voteDialog(ownerId, postId, date, this.F.getContext()));
|
||||
}
|
||||
} else if (NewsFeedFiltersUtils.sponsorFilters(text)) {
|
||||
disclamer = "SponsorPost: Заблокировано фильтрами";
|
||||
this.F.setOnClickListener(listener -> AndroidUtils.sendToast("Заблокировано по выражению: " + NewsFeedFiltersUtils.sponsorFiltersBanWord(text)));
|
||||
} else {
|
||||
disclamer = m(R.string.sponsored_post_in_group);
|
||||
}
|
||||
|
||||
height = e0().getDimensionPixelSize(R.dimen.newsfeed_ad_mark_post_height);
|
||||
}
|
||||
} else if (newsEntry instanceof PromoPost) {
|
||||
PromoPost promoPost = (PromoPost) newsEntry;
|
||||
if (!promoPost.E1().isEmpty()) {
|
||||
height = e0().getDimensionPixelSize(R.dimen.newsfeed_ad_mark_promo_post_height);
|
||||
disclamer = promoPost.E1();
|
||||
}
|
||||
}
|
||||
|
||||
this.F.setCompoundDrawablesRelativeWithIntrinsicBounds(drawable, null, null, null);
|
||||
this.F.setMinHeight(height);
|
||||
this.F.setText(disclamer);
|
||||
}
|
||||
|
||||
public static void voteDialog(int ownerId, int postId, int date, Context ctx) {
|
||||
new VkAlertDialog.Builder(ctx)
|
||||
.setTitle("SponsorPost")
|
||||
.setMessage("Этот пост является рекламным?")
|
||||
.setPositiveButton("Да", ((dialog, which) -> {
|
||||
int resp = VotesService.ratePost(ownerId, postId, date, true).optInt("code");
|
||||
|
||||
if (resp == 201 || resp == 100) {
|
||||
AndroidUtils.sendToast("Спасибо за голос!");
|
||||
} else {
|
||||
AndroidUtils.sendToast("Ваш голос уже учтен");
|
||||
}
|
||||
}))
|
||||
.setNeutralButton("Нет", ((dialog, which) -> {
|
||||
int resp = VotesService.ratePost(ownerId, postId, date, false).optInt("code");
|
||||
|
||||
if (resp == 201 || resp == 100) {
|
||||
AndroidUtils.sendToast("Спасибо за голос!");
|
||||
} else {
|
||||
AndroidUtils.sendToast("Ваш голос уже учтен");
|
||||
}
|
||||
}))
|
||||
.show();
|
||||
}
|
||||
}
|
||||
@@ -11,13 +11,12 @@ import com.vk.discover.DiscoverItemDecorator;
|
||||
import ru.vtosters.hooks.other.Preferences;
|
||||
import ru.vtosters.lite.concurrent.VTExecutors;
|
||||
import ru.vtosters.lite.utils.NetworkUtils;
|
||||
import ru.vtosters.sponsorpost.internal.VotesPreferences;
|
||||
import ru.vtosters.sponsorpost.internal.VotesService;
|
||||
import ru.vtosters.sponsorpost.services.PostService;
|
||||
import ru.vtosters.sponsorpost.utils.PostsPreferences;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
import static java.lang.Long.MAX_VALUE;
|
||||
import static ru.vtosters.hooks.other.Preferences.*;
|
||||
@@ -102,8 +101,16 @@ public class NewsfeedHook {
|
||||
public static void takeOwnerIdSponsorPost(int ownerid) {
|
||||
if (NetworkUtils.isNetworkConnected() && PostsPreferences.isEnabled() && !Preferences.serverFeaturesDisable()) {
|
||||
VTExecutors.getIoScheduler().a(() -> {
|
||||
List<Long> postIds = PostService.getPostIdsByOwnerId((long) ownerid, 0L);
|
||||
PostsPreferences.saveGroupSpecifiedPosts(postIds, (long) ownerid);
|
||||
if (PostsPreferences.isGroupAd(ownerid) || VotesPreferences.isGroupAd(ownerid)) {
|
||||
if (VotesPreferences.isEnabled()) {
|
||||
Map<String, List<String>> postIds = VotesService.getPostIdsByOwnerId((long) ownerid, 0L);
|
||||
VotesPreferences.saveGroupSpecifiedPosts(postIds.get("vote"), (long) ownerid);
|
||||
PostsPreferences.saveGroupSpecifiedPosts(postIds.get("prod"), (long) ownerid);
|
||||
} else {
|
||||
List<Long> postIds = PostService.getPostIdsByOwnerId((long) ownerid, 0L);
|
||||
PostsPreferences.saveGroupSpecifiedPosts(postIds, (long) ownerid);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -112,17 +119,28 @@ public class NewsfeedHook {
|
||||
long ownerid = Long.parseLong(strArr[0].split("_")[0]);
|
||||
long postId = Long.parseLong(strArr[0].split("_")[1]);
|
||||
|
||||
if (PostsPreferences.isPostAd(ownerid, postId)) {
|
||||
if (PostsPreferences.isPostAd(ownerid, postId) || VotesPreferences.isPostAd(ownerid, postId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (NetworkUtils.isNetworkConnected() && PostsPreferences.isEnabled() && !Preferences.serverFeaturesDisable() && PostsPreferences.isGroupAd(ownerid)) {
|
||||
if (NetworkUtils.isNetworkConnected() && PostsPreferences.isEnabled() && !Preferences.serverFeaturesDisable()) {
|
||||
VTExecutors.getIoScheduler().a(() -> {
|
||||
boolean postIds = PostService.isPostAd(ownerid, postId);
|
||||
if (VotesPreferences.isEnabled()) {
|
||||
boolean postIds = VotesService.isPostAd(ownerid, postId);
|
||||
|
||||
if (postIds) {
|
||||
PostsPreferences.saveAdPostInfo(ownerid, postId);
|
||||
sendToast("Этот пост помечен как рекламный");
|
||||
if (postIds) {
|
||||
VotesPreferences.saveAdPostInfo(ownerid, postId);
|
||||
}
|
||||
} else {
|
||||
boolean postIds = PostService.isPostAd(ownerid, postId);
|
||||
|
||||
if (postIds) {
|
||||
PostsPreferences.saveAdPostInfo(ownerid, postId);
|
||||
|
||||
if (!PostsPreferences.isEnabledMarking()) {
|
||||
sendToast("Этот пост помечен как рекламный");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package ru.vtosters.hooks;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import com.vk.dto.newsfeed.entries.NewsEntry;
|
||||
import com.vk.dto.newsfeed.entries.Post;
|
||||
import com.vk.newsfeed.NewsEntryActionsAdapter;
|
||||
import com.vk.newsfeed.holders.AdMarkHolder;
|
||||
import ru.vtosters.hooks.other.Preferences;
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
import ru.vtosters.sponsorpost.internal.Native;
|
||||
import ru.vtosters.sponsorpost.utils.PostsPreferences;
|
||||
|
||||
public class PostsMenuHook {
|
||||
private static final int id = 200;
|
||||
|
||||
public static void injectList(NewsEntryActionsAdapter actionsAdapter, NewsEntry newsEntry) {
|
||||
if (newsEntry instanceof Post && Preferences.isValidSignature() && Native.canVote()) {
|
||||
int ownerId = ((Post) newsEntry).b();
|
||||
|
||||
if (ownerId != AccountManagerUtils.getUserId() && PostsPreferences.isEnabled()) {
|
||||
actionsAdapter.a(id, "SponsorPost");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void injectButtons(int i, NewsEntry newsEntry, Context context) {
|
||||
if (newsEntry instanceof Post) {
|
||||
Post post = (Post) newsEntry;
|
||||
int ownerId = post.b();
|
||||
int postId = post.P1();
|
||||
int date = post.K();
|
||||
|
||||
AdMarkHolder.voteDialog(ownerId, postId, date, context);
|
||||
} else {
|
||||
Log.d("PostsMenuHook", "unsupported instance");
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isCustomButton(int i) {
|
||||
return i == id;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.vk.core.network.Network;
|
||||
import com.vk.core.util.DeviceIdProvider;
|
||||
import okhttp3.Headers;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
@@ -13,6 +14,7 @@ import ru.vtosters.hooks.other.Preferences;
|
||||
import ru.vtosters.lite.music.cache.MusicCacheImpl;
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.sponsorpost.utils.GzipDecompressor;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -260,9 +262,10 @@ public class CatalogJsonInjector {
|
||||
+ sectionUrl
|
||||
+ "&access_token="
|
||||
+ AccountManagerUtils.getUserToken())
|
||||
.a("Accept-Encoding", "gzip")
|
||||
.a(Headers.a("User-Agent", Network.l.c().a(), "Content-Type", "application/x-www-form-urlencoded; charset=utf-8")).a();
|
||||
try {
|
||||
var json = new JSONObject(Network.b(CLIENT_API).a(request).execute().a().g()).getJSONObject("response");
|
||||
try (Response resp = Network.b(CLIENT_API).a(request).execute()) {
|
||||
var json = new JSONObject(GzipDecompressor.decompressResponse(resp)).getJSONObject("response");
|
||||
var catalogarr = json.optJSONObject("catalog").optJSONArray("sections").optJSONObject(0);
|
||||
|
||||
var title = catalogarr.optString("title");
|
||||
@@ -276,4 +279,4 @@ public class CatalogJsonInjector {
|
||||
Log.d("VTLMusic", "Error: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -311,6 +311,10 @@ public class Preferences {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String getId() {
|
||||
return String.valueOf(AccountManagerUtils.getUserId());
|
||||
}
|
||||
|
||||
public static void updateBuildNumber() {
|
||||
try {
|
||||
getPreferences().edit().putLong("setupTime", AndroidUtils.getGlobalContext().getPackageManager().getPackageInfo(AndroidUtils.getPackageName(), 0).lastUpdateTime).apply();
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||
import ru.vtosters.sponsorpost.utils.GzipDecompressor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
@@ -168,6 +169,7 @@ public class VideoDownloader {
|
||||
|
||||
var req = new Request.a()
|
||||
.b("https://" + getApi() + "/method/stories.getById?stories=" + storyId + "&v=5.99&access_token=" + getUserToken())
|
||||
.a("Accept-Encoding", "gzip")
|
||||
.a();
|
||||
|
||||
Network.b(CLIENT_API).a(req).a(new Callback() {
|
||||
@@ -183,7 +185,7 @@ public class VideoDownloader {
|
||||
progressDialog.cancel();
|
||||
|
||||
try {
|
||||
JSONObject mainJson = new JSONObject(response.a().g());
|
||||
JSONObject mainJson = new JSONObject(GzipDecompressor.decompressResponse(response));
|
||||
JSONObject responseJson = mainJson.getJSONObject("response").optJSONArray("items").optJSONObject(0);
|
||||
StoryEntry story = new StoryEntry(responseJson);
|
||||
StoryDownloader.downloadStory(story);
|
||||
@@ -211,6 +213,7 @@ public class VideoDownloader {
|
||||
|
||||
var req = new Request.a()
|
||||
.b("https://" + getApi() + "/method/video.get?owner_id=" + ownerId + "&videos=" + videoId + "&v=5.99&access_token=" + getUserToken())
|
||||
.a("Accept-Encoding", "gzip")
|
||||
.a();
|
||||
|
||||
Network.b(CLIENT_API).a(req).a(new Callback() {
|
||||
@@ -225,7 +228,7 @@ public class VideoDownloader {
|
||||
progressDialog.cancel();
|
||||
|
||||
try {
|
||||
JSONObject mainJson = new JSONObject(response.a().g());
|
||||
JSONObject mainJson = new JSONObject(GzipDecompressor.decompressResponse(response));
|
||||
JSONObject responseJson = mainJson.getJSONObject("response");
|
||||
JSONArray itemsJson = responseJson.getJSONArray("items");
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import ru.vtosters.lite.downloaders.messages.items.MiniUser;
|
||||
import ru.vtosters.lite.proxy.ProxyUtils;
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.sponsorpost.utils.GzipDecompressor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
@@ -106,6 +107,7 @@ public class MessagesDownloader {
|
||||
AccountManagerUtils.getUserToken());
|
||||
var req = new Request.a()
|
||||
.b(url)
|
||||
.a("Accept-Encoding", "gzip")
|
||||
.a();
|
||||
Network.b(CLIENT_API).a(req).a(new Callback() {
|
||||
@Override
|
||||
@@ -116,7 +118,7 @@ public class MessagesDownloader {
|
||||
@Override
|
||||
public void a(Call call, Response response) {
|
||||
try {
|
||||
JSONObject obj = new JSONObject(response.a().g()).getJSONObject("response");
|
||||
JSONObject obj = new JSONObject(GzipDecompressor.decompressResponse(response)).getJSONObject("response");
|
||||
|
||||
SparseArray<MiniUser> users = new SparseArray<>();
|
||||
parseUsers(users, obj.optJSONArray("profiles"), false);
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package ru.vtosters.lite.foaf;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.core.network.Network;
|
||||
import com.vtosters.lite.R;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
@@ -15,6 +17,7 @@ import ru.vtosters.lite.proxy.ProxyUtils;
|
||||
import ru.vtosters.lite.proxy.api.VikaMobile;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||
import ru.vtosters.sponsorpost.utils.GzipDecompressor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
@@ -26,6 +29,8 @@ import java.util.Optional;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static com.vk.core.network.Network.ClientType.CLIENT_API;
|
||||
|
||||
public class FoafBase {
|
||||
private static final Pattern FOAF_REGEX = Pattern.compile("<ya:created dc:date=\"(.+?)\"");
|
||||
private static final String DELETED = "<ya:profileState>deleted</ya:profileState>";
|
||||
@@ -35,13 +40,14 @@ public class FoafBase {
|
||||
public static JSONObject getBypassedOnlineInfo(int id) throws JSONException {
|
||||
Request request = new Request.a()
|
||||
.b(API_VKNEXT + id)
|
||||
.a("Accept-Encoding", "gzip")
|
||||
.a();
|
||||
|
||||
JSONObject dummy = new JSONObject();
|
||||
dummy.put("last_seen", 0);
|
||||
|
||||
try (Response response = client.a(request).execute()) {
|
||||
JSONObject online_info = new JSONObject(response.a().g()).getJSONObject("response").optJSONObject(Integer.toString(id));
|
||||
JSONObject online_info = new JSONObject(GzipDecompressor.decompressResponse(response)).getJSONObject("response").optJSONObject(Integer.toString(id));
|
||||
return online_info == null ? dummy : online_info;
|
||||
} catch (Exception e) {
|
||||
Log.e("GetBypassedOnlineInfo", e.getMessage());
|
||||
@@ -52,12 +58,13 @@ public class FoafBase {
|
||||
public static JSONObject getBypassedOnlineInfo(String ids) {
|
||||
Request request = new Request.a()
|
||||
.b(API_VKNEXT + ids)
|
||||
.a("Accept-Encoding", "gzip")
|
||||
.a();
|
||||
|
||||
JSONObject dummy = new JSONObject();
|
||||
|
||||
try (Response response = client.a(request).execute()) {
|
||||
JSONObject online_info = new JSONObject(response.a().g()).getJSONObject("response").optJSONObject("response");
|
||||
JSONObject online_info = new JSONObject(GzipDecompressor.decompressResponse(response)).getJSONObject("response").optJSONObject("response");
|
||||
return online_info == null ? dummy : online_info;
|
||||
} catch (Exception e) {
|
||||
Log.e("GetBypassedOnlineInfo1", e.getMessage());
|
||||
@@ -65,9 +72,9 @@ public class FoafBase {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
private static String getLink(int i) {
|
||||
String prefix = (ProxyUtils.isAnyProxyEnabled() || ProxyUtils.isVKProxyEnabled()) ? "https://" + (ProxyUtils.isVKProxyEnabled() ? VikaMobile.getApiHost() : ProxyUtils.getApi()) + "/_/vk.com/foaf.php?id=" : "https://vk.com/foaf.php?id=";
|
||||
return prefix + i;
|
||||
return ProxyUtils.isAnyProxyEnabled() ? String.format("https://%s/_/vk.com/foaf.php?id=%d", ProxyUtils.getApi(), i) : String.format("https://vk.com/foaf.php?id=%d", i);
|
||||
}
|
||||
|
||||
public static void loadAndShow(Context context, int i) {
|
||||
@@ -78,12 +85,13 @@ public class FoafBase {
|
||||
|
||||
Request request = new Request.a()
|
||||
.b(getLink(i))
|
||||
.a("Accept-Encoding", "gzip")
|
||||
.a();
|
||||
|
||||
try (Response response = client.a(request).execute()) {
|
||||
try (Response response = Network.b(CLIENT_API).a(request).execute()) {
|
||||
LifecycleUtils.getCurrentActivity().runOnUiThread(() -> {
|
||||
try {
|
||||
showFoafInfo(progressDialog, context, i, response.a().g());
|
||||
showFoafInfo(progressDialog, context, i, GzipDecompressor.decompressResponse(response));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -119,6 +127,7 @@ public class FoafBase {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
private static void showFoafDialog(Context context, int i, String normalHumanDate, long daysPassed) {
|
||||
String message = String.format("%s %d%s %s%s %d", context.getString(R.string.foafid), i, context.getString(R.string.foafregdate), normalHumanDate, context.getString(R.string.foafdate), daysPassed);
|
||||
new VkAlertDialog.Builder(context)
|
||||
|
||||
@@ -11,7 +11,9 @@ import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
import ru.vtosters.lite.music.downloader.M3UDownloader;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.sponsorpost.utils.GzipDecompressor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
@@ -22,10 +24,10 @@ public class Genius {
|
||||
private static final OkHttpClient client = VtOkHttpClient.getInstance();
|
||||
|
||||
public static String getTextMusic(MusicTrack musictrack) {
|
||||
var uid = musictrack.y1();
|
||||
var artist = removeExtras(musictrack.C);
|
||||
var title = removeExtras(musictrack.f);
|
||||
var duration = musictrack.h;
|
||||
String uid = musictrack.y1();
|
||||
String artist = removeExtras(M3UDownloader.getArtists(musictrack));
|
||||
String title = removeExtras(musictrack.f);
|
||||
int duration = musictrack.h;
|
||||
|
||||
if (TextUtils.isEmpty(uid) || TextUtils.isEmpty(artist) || TextUtils.isEmpty(title) || duration == 0) {
|
||||
Log.d("Genius", "grabTrackInfo: " + "Empty track, info: " + artist + " - " + title + " - " + duration + " - " + uid);
|
||||
@@ -42,17 +44,18 @@ public class Genius {
|
||||
}
|
||||
|
||||
Request request = new Request.a()
|
||||
.b(URL + "/search/songs?q=" + URLEncoder.encode(artist + " " + track) + "&from_background=0" + "&page=1")
|
||||
.a("User-Agent", "Genius/5.14.0 (Android; Android 13; Google Pixel 4 XL)")
|
||||
.b(String.format("%s/search/songs?q=%s&from_background=0&page=1", URL, URLEncoder.encode(artist + " " + track)))
|
||||
.a("User-Agent", "Genius/5.21.3 (Android; Android 13; Google Pixel 4 XL)")
|
||||
.a("Authorization", KEY)
|
||||
.a("x-genius-app-background-request", "0")
|
||||
.a("x-genius-logged-out", "true")
|
||||
.a("host", "api.genius.com")
|
||||
.a("Content-Type", "application/x-www-form-urlencoded")
|
||||
.a("Accept-Encoding", "gzip")
|
||||
.b()
|
||||
.a();
|
||||
try (Response resp = client.a(request).execute()) {
|
||||
String payload = resp.a().g();
|
||||
String payload = GzipDecompressor.decompressResponse(resp);
|
||||
JSONArray sections = new JSONObject(payload).getJSONObject("response").getJSONArray("sections");
|
||||
|
||||
for (int i = 0; i < sections.length(); i++) {
|
||||
@@ -86,17 +89,18 @@ public class Genius {
|
||||
|
||||
private static String getText(String track) {
|
||||
Request request = new Request.a()
|
||||
.b(URL + track + "?text_format=plain")
|
||||
.a("User-Agent", "Genius/5.14.0 (Android; Android 13; Google Pixel 4 XL)")
|
||||
.b(String.format("%s%s?text_format=plain", URL, track))
|
||||
.a("User-Agent", "Genius/5.21.3 (Android; Android 13; Google Pixel 4 XL)")
|
||||
.a("Authorization", KEY)
|
||||
.a("x-genius-app-background-request", "0")
|
||||
.a("x-genius-logged-out", "true")
|
||||
.a("host", "api.genius.com")
|
||||
.a("Content-Type", "application/x-www-form-urlencoded")
|
||||
.a("Accept-Encoding", "gzip")
|
||||
.b()
|
||||
.a();
|
||||
try {
|
||||
JSONObject payload = new JSONObject(client.a(request).execute().a().g());
|
||||
try (Response resp = client.a(request).execute()) {
|
||||
JSONObject payload = new JSONObject(GzipDecompressor.decompressResponse(resp));
|
||||
|
||||
if (!payload.has("response")) {
|
||||
return AndroidUtils.getString("error_no_text");
|
||||
@@ -107,4 +111,4 @@ public class Genius {
|
||||
return AndroidUtils.getString("error_no_text") + "\n\n" + AndroidUtils.getString(R.string.error) + ": \n" + e.getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import ru.vtosters.hooks.other.Preferences;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
import ru.vtosters.lite.downloaders.AudioDownloader;
|
||||
import ru.vtosters.lite.music.cache.MusicCacheImpl;
|
||||
import ru.vtosters.lite.music.downloader.M3UDownloader;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -32,7 +33,7 @@ public class LastFMScrobbler {
|
||||
|
||||
public static void grabMusicTrack(MusicTrack musictrack) {
|
||||
var uid = musictrack.y1();
|
||||
var artist = musictrack.C;
|
||||
var artist = M3UDownloader.getArtists(musictrack);
|
||||
var title = musictrack.f;
|
||||
var duration = musictrack.h;
|
||||
var track_id = musictrack.d;
|
||||
|
||||
@@ -6,6 +6,7 @@ import bruhcollective.itaysonlab.libvkx.ILibVkxService;
|
||||
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
|
||||
import bruhcollective.itaysonlab.libvkx.client.LibVKXClientImpl;
|
||||
import com.vk.dto.music.MusicTrack;
|
||||
import ru.vtosters.lite.music.downloader.M3UDownloader;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.music.MusicCacheStorageUtils;
|
||||
|
||||
@@ -19,7 +20,7 @@ public class MusicCacheImpl {
|
||||
track.I != null ? track.I.getId() + "" : "-1",
|
||||
track.f,
|
||||
!TextUtils.isEmpty(track.g) ? track.g : "",
|
||||
track.C,
|
||||
M3UDownloader.getArtists(track),
|
||||
track.I != null ? track.I.getTitle() : "",
|
||||
track.K,
|
||||
track.h,
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.vk.dto.music.AlbumLink;
|
||||
import com.vk.dto.music.MusicTrack;
|
||||
import com.vk.dto.music.Thumb;
|
||||
import org.json.JSONObject;
|
||||
import ru.vtosters.lite.music.downloader.M3UDownloader;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.music.MusicCacheStorageUtils;
|
||||
|
||||
@@ -116,7 +117,7 @@ public class MusicCacheDb extends SQLiteOpenHelper implements AutoCloseable { //
|
||||
vals.put(Constants.COLUMN_ALBUM_ID, track.I != null ? track.I.getId() + "" : "-1");
|
||||
vals.put(Constants.COLUMN_TITLE, track.f);
|
||||
vals.put(Constants.COLUMN_SUBTITLE, track.g);
|
||||
vals.put(Constants.COLUMN_ARTIST, track.C);
|
||||
vals.put(Constants.COLUMN_ARTIST, M3UDownloader.getArtists(track));
|
||||
vals.put(Constants.COLUMN_ALBUM_TITLE, track.I != null ? track.I.getTitle() : "");
|
||||
vals.put(Constants.COLUMN_EXPLICIT, Boolean.compare(track.K, true));
|
||||
vals.put(Constants.COLUMN_DURATION, track.h);
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import ru.vtosters.lite.music.cache.MusicCacheImpl;
|
||||
import ru.vtosters.lite.music.downloader.M3UDownloader;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.music.MusicCacheStorageUtils;
|
||||
|
||||
@@ -33,7 +34,7 @@ public class PlaylistHelper {
|
||||
return createAlbum(
|
||||
thumb != null ? thumb.h(600) : "",
|
||||
albumLink.getTitle(),
|
||||
track.C,
|
||||
M3UDownloader.getArtists(track),
|
||||
track.y1(),
|
||||
albumLink.getId()
|
||||
);
|
||||
@@ -75,7 +76,7 @@ public class PlaylistHelper {
|
||||
list.add(createAlbum(
|
||||
thumb != null ? thumb.h(600) : "",
|
||||
albumLink.getTitle(),
|
||||
track.C,
|
||||
M3UDownloader.getArtists(track),
|
||||
track.y1(),
|
||||
albumLink.getId()
|
||||
));
|
||||
|
||||
@@ -7,10 +7,12 @@ import com.vk.dto.music.Playlist;
|
||||
import java8.util.concurrent.CompletableFuture;
|
||||
import okhttp3.Headers;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.sponsorpost.utils.GzipDecompressor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@@ -50,17 +52,17 @@ public class PlaylistConverter {
|
||||
|
||||
var request = new Request.a()
|
||||
.b(requestUrl)
|
||||
.a("Accept-Encoding", "gzip")
|
||||
.a(Headers.a("User-Agent", Network.l.c().a(), "Content-Type", "application/x-www-form-urlencoded; charset=utf-8")).a();
|
||||
|
||||
try {
|
||||
var response = CompletableFuture.supplyAsync(() -> {
|
||||
try {
|
||||
return Network.b(CLIENT_API).a(request).execute().a().g();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
).get();
|
||||
try (Response resp = Network.b(CLIENT_API).a(request).execute()) {
|
||||
return GzipDecompressor.decompressResponse(resp);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}).get();
|
||||
var jsonObj = new JSONObject(response);
|
||||
if (!jsonObj.has("response"))
|
||||
return null;
|
||||
|
||||
@@ -7,9 +7,11 @@ import com.vk.dto.music.MusicTrack;
|
||||
import java8.util.concurrent.CompletableFuture;
|
||||
import okhttp3.Headers;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.sponsorpost.utils.GzipDecompressor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@@ -44,12 +46,13 @@ public class AudioGet {
|
||||
|
||||
var request = new Request.a()
|
||||
.b(requestUrl)
|
||||
.a("Accept-Encoding", "gzip")
|
||||
.a(Headers.a("User-Agent", Network.l.c().a(), "Content-Type", "application/x-www-form-urlencoded; charset=utf-8")).a();
|
||||
|
||||
try {
|
||||
var response = CompletableFuture.supplyAsync(() -> {
|
||||
try {
|
||||
return Network.b(CLIENT_API).a(request).execute().a().g();
|
||||
try (Response resp = Network.b(CLIENT_API).a(request).execute()) {
|
||||
return GzipDecompressor.decompressResponse(resp);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.util.Log;
|
||||
import com.google.android.exoplayer2.source.hls.playlist.e;
|
||||
import com.google.android.exoplayer2.source.hls.playlist.f;
|
||||
import com.google.android.exoplayer2.source.hls.playlist.f.a;
|
||||
import com.vk.dto.music.Artist;
|
||||
import com.vk.dto.music.MusicTrack;
|
||||
import java8.util.concurrent.CompletableFuture;
|
||||
import java8.util.concurrent.CompletionException;
|
||||
@@ -26,6 +27,7 @@ import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class M3UDownloader
|
||||
implements ITrackDownloader {
|
||||
@@ -151,7 +153,7 @@ public class M3UDownloader
|
||||
}
|
||||
|
||||
static File getResultMp3File(File outDir, boolean cache, MusicTrack track) {
|
||||
return new File(outDir, IOUtils.getValidFileName((cache ? "track" : track.C + " - " + getTitle(track)) + ".mp3"));
|
||||
return new File(outDir, IOUtils.getValidFileName((cache ? "track" : getArtists(track) + " - " + getTitle(track)) + ".mp3"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -178,4 +180,14 @@ public class M3UDownloader
|
||||
private static class Holder {
|
||||
private static final M3UDownloader INSTANCE = new M3UDownloader();
|
||||
}
|
||||
}
|
||||
|
||||
public static String getArtists(MusicTrack track) {
|
||||
return (track.L == null || track.I == null
|
||||
? normalizeMetadata(track.C)
|
||||
: normalizeMetadata(track.L.stream().map(Artist::w1).collect(Collectors.joining(", "))));
|
||||
}
|
||||
|
||||
private static String normalizeMetadata(String in) {
|
||||
return in.replaceAll("[\\\\/:*?\"<>|]", "");
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.NetworkUtils;
|
||||
import ru.vtosters.sponsorpost.utils.GzipDecompressor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@@ -32,6 +33,7 @@ public class UsersList {
|
||||
|
||||
Request request = new Request.a()
|
||||
.b(Utils.getDomain() + "/api/getUsersWithServiceDescriptionsAndBanners")
|
||||
.a("Accept-Encoding", "gzip")
|
||||
.a();
|
||||
|
||||
VtOkHttpClient.getInstance().a(request).a(new Callback() {
|
||||
@@ -43,7 +45,7 @@ public class UsersList {
|
||||
@Override
|
||||
public void a(Call call, Response response) {
|
||||
try {
|
||||
parseJson(new JSONObject(response.a().g()).getJSONObject("response"));
|
||||
parseJson(new JSONObject(GzipDecompressor.decompressResponse(response)).getJSONObject("response"));
|
||||
} catch (JSONException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -105,6 +105,7 @@ public class OtherFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
|
||||
findPreference("updateverifdata").setOnPreferenceClickListener(preference -> {
|
||||
UsersList.getUsersList();
|
||||
VTVerifications.isLoaded = false;
|
||||
VTVerifications.load(requireContext());
|
||||
AndroidUtils.sendToast(AndroidUtils.getString("data_updated"));
|
||||
return true;
|
||||
|
||||
@@ -6,8 +6,10 @@ import android.os.Bundle;
|
||||
import ru.vtosters.hooks.other.Preferences;
|
||||
import ru.vtosters.hooks.other.ThemesUtils;
|
||||
import ru.vtosters.lite.ui.PreferenceFragmentUtils;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.NetworkUtils;
|
||||
import ru.vtosters.sponsorpost.data.Filter;
|
||||
import ru.vtosters.sponsorpost.internal.VotesPreferences;
|
||||
import ru.vtosters.sponsorpost.services.FilterService;
|
||||
import ru.vtosters.sponsorpost.utils.FiltersPreferences;
|
||||
import ru.vtosters.sponsorpost.utils.PostsPreferences;
|
||||
@@ -35,6 +37,40 @@ public class SponsorPostFragment extends TrackedMaterialPreferenceToolbarFragmen
|
||||
null
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), "Статистика блокировок");
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
"SponsorPost",
|
||||
"Заблокировано постов: " + PostsPreferences.getNumBlockedPosts(),
|
||||
null,
|
||||
null
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
"SponsorPost фильтры",
|
||||
"Заблокировано постов: " + FiltersPreferences.getNumBlockedPosts(),
|
||||
null,
|
||||
null
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
"Сброс статистики",
|
||||
null,
|
||||
null,
|
||||
preference -> {
|
||||
FiltersPreferences.dropNumBlockedPosts();
|
||||
PostsPreferences.dropNumBlockedPosts();
|
||||
AndroidUtils.sendToast("Статистика сброшена");
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), "Sponsor Post");
|
||||
|
||||
if (Preferences.serverFeaturesDisable()) {
|
||||
@@ -49,9 +85,9 @@ public class SponsorPostFragment extends TrackedMaterialPreferenceToolbarFragmen
|
||||
} else {
|
||||
PreferenceFragmentUtils.addMaterialSwitchPreference(
|
||||
getPreferenceScreen(),
|
||||
"sponsorpost",
|
||||
"",
|
||||
"Фильтр постов",
|
||||
"Получать списки рекламных постов в группах и ленте, которые не блокируются рекламными фильтрами",
|
||||
"Получать списки рекламных постов в группах и ленте, которые не блокируются рекламными фильтрами\n\nРекомендуется использовать совместно со Стандартным фильтром",
|
||||
null,
|
||||
PostsPreferences.isEnabled(),
|
||||
(preference, o) -> {
|
||||
@@ -59,6 +95,61 @@ public class SponsorPostFragment extends TrackedMaterialPreferenceToolbarFragmen
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addMaterialSwitchPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
"Не скрывать посты",
|
||||
"Помечать посты рекламной пометкой, но не скрывать их полностью",
|
||||
null,
|
||||
PostsPreferences.isEnabledMarking(),
|
||||
(preference, o) -> {
|
||||
PostsPreferences.setEnabledMarking((boolean) o);
|
||||
return true;
|
||||
}
|
||||
).setEnabled(PostsPreferences.isEnabled());
|
||||
|
||||
PreferenceFragmentUtils.addMaterialSwitchPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
"Предварительные списки",
|
||||
"Получать дополнительно более свежие списки которые ещё не попали в основной список. Нужно для активного голосования для блокировки постов. Возможно много ошибок!",
|
||||
null,
|
||||
VotesPreferences.isEnabled(),
|
||||
(preference, o) -> {
|
||||
VotesPreferences.setEnabled((boolean) o);
|
||||
return true;
|
||||
}
|
||||
).setEnabled(PostsPreferences.isEnabled());
|
||||
|
||||
if (NetworkUtils.isNetworkConnected()) {
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
"Обновить списки постов",
|
||||
null,
|
||||
null,
|
||||
preference -> {
|
||||
this.requireActivity().runOnUiThread(() -> {
|
||||
Updates.updatePosts();
|
||||
AndroidUtils.sendToast("Обновлено");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
"Телеграм чат",
|
||||
"Помогите улучшить качество блокировки постов в нашем телеграм чате\n\nДля перехода в чат вам необходима последняя версия Telegram",
|
||||
null,
|
||||
preference -> {
|
||||
requireContext().startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse("https://t.me/vtosterschat/3559729")));
|
||||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
@@ -123,6 +214,31 @@ public class SponsorPostFragment extends TrackedMaterialPreferenceToolbarFragmen
|
||||
);
|
||||
}
|
||||
|
||||
PreferenceFragmentUtils.addMaterialSwitchPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
"Не блокировать посты",
|
||||
"Помечать посты заблокированные фильтрами",
|
||||
null,
|
||||
FiltersPreferences.isEnabledMarking(),
|
||||
(preference, o) -> {
|
||||
FiltersPreferences.setEnabledMarking((boolean) o);
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
"Телеграм чат",
|
||||
"Помогите улучшить качество фильтров обсудив работу в нашем телеграм чате\n\nДля перехода в чат вам необходима последняя версия Telegram",
|
||||
null,
|
||||
preference -> {
|
||||
requireContext().startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse("https://t.me/vtosterschat/3559732")));
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
@@ -139,6 +255,20 @@ public class SponsorPostFragment extends TrackedMaterialPreferenceToolbarFragmen
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if (Preferences.dev()) {
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
"Сбросить токен пользователя",
|
||||
null,
|
||||
null,
|
||||
preference -> {
|
||||
VotesPreferences.remUserToken();
|
||||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,6 +5,7 @@ import okhttp3.*;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
import ru.vtosters.sponsorpost.utils.GzipDecompressor;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -25,6 +26,7 @@ public class OTAUtils {
|
||||
public void loadData(boolean isManualCheck) {
|
||||
Request release = new Request.a()
|
||||
.b(LATEST_RELEASE_URL)
|
||||
.a("Accept-Encoding", "gzip")
|
||||
.a();
|
||||
|
||||
mClient.a(release).a(new Callback() {
|
||||
@@ -46,12 +48,13 @@ public class OTAUtils {
|
||||
});
|
||||
}
|
||||
|
||||
void setData(Response response, boolean isManualCheck) throws IOException, JSONException {
|
||||
mReleaseJson = new JSONObject(response.a().g());
|
||||
void setData(Response response, boolean isManualCheck) throws JSONException, IOException {
|
||||
mReleaseJson = new JSONObject(GzipDecompressor.decompressResponse(response));
|
||||
|
||||
String tag = mReleaseJson.getString("tag_name");
|
||||
Request commit = new Request.a()
|
||||
.b(String.format(LATEST_RELEASE_COMMIT_URL, tag))
|
||||
.a("Accept-Encoding", "gzip")
|
||||
.a();
|
||||
|
||||
mClient.a(commit).a(new Callback() {
|
||||
@@ -62,15 +65,15 @@ public class OTAUtils {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Call call, Response response) throws IOException {
|
||||
public void a(Call call, Response response) {
|
||||
try {
|
||||
mCommitJson = new JSONObject(response.a().g());
|
||||
mCommitJson = new JSONObject(GzipDecompressor.decompressResponse(response));
|
||||
mCommitSHA = mCommitJson.getJSONObject("object").getString("sha");
|
||||
if (isNewVersion())
|
||||
mListener.onUpdateApplied(isManualCheck);
|
||||
else
|
||||
mListener.onUpdateLatest(isManualCheck);
|
||||
} catch (NullPointerException | JSONException e) {
|
||||
} catch (NullPointerException | JSONException | IOException e) {
|
||||
e.printStackTrace();
|
||||
mListener.onUpdateError();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package ru.vtosters.lite.utils;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.util.Log;
|
||||
import com.vk.core.network.Network;
|
||||
import com.vk.navigation.NavigatorKeys;
|
||||
import okhttp3.*;
|
||||
import org.json.JSONArray;
|
||||
@@ -10,12 +11,11 @@ import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import ru.vtosters.hooks.other.Preferences;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
import ru.vtosters.sponsorpost.utils.GzipDecompressor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import static ru.vtosters.hooks.other.Preferences.getBoolValue;
|
||||
|
||||
@@ -44,13 +44,14 @@ public class VTVerifications {
|
||||
Request request = new Request.a()
|
||||
.b("https://vtosters.app/vktoaster/getGalo4kiBatch")
|
||||
.a(RequestBody.a(MediaType.b("application/json; charset=UTF-8"), "{\"types\":[0,228,404]}"))
|
||||
.a("Accept-Encoding", "gzip")
|
||||
.a();
|
||||
|
||||
sClient.a(request).a(new Callback() {
|
||||
@Override
|
||||
public void a(Call call, Response response) {
|
||||
try {
|
||||
String payload = response.a().g();
|
||||
String payload = GzipDecompressor.decompressResponse(response);
|
||||
parseJson(payload);
|
||||
prefs.edit()
|
||||
.putString("ids", payload)
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
import ru.vtosters.sponsorpost.internal.VotesPreferences;
|
||||
import ru.vtosters.sponsorpost.utils.FiltersPreferences;
|
||||
import ru.vtosters.sponsorpost.utils.PostsPreferences;
|
||||
|
||||
@@ -185,7 +186,7 @@ public class NewsFeedFiltersUtils {
|
||||
return json;
|
||||
}
|
||||
|
||||
private static boolean needToSave(JSONObject post, String source, boolean needToShowToast) throws JSONException {
|
||||
private static boolean needToSave(JSONObject post, String source, boolean needToNotifyBlock) throws JSONException {
|
||||
String type = post.optString("type");
|
||||
|
||||
if (isAds(post, type)) {
|
||||
@@ -198,58 +199,84 @@ public class NewsFeedFiltersUtils {
|
||||
|| type.endsWith("playlists")
|
||||
|| type.endsWith("groups")))) {
|
||||
|
||||
logRemovedPost(post, source, "authors", needToShowToast);
|
||||
logRemovedPost(post, source, "authors", needToNotifyBlock);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (postsrecomm() && (type.equals("inline_user_rec") || type.equals("live_recommended"))) {
|
||||
logRemovedPost(post, source, "postsrecomm", needToShowToast);
|
||||
logRemovedPost(post, source, "postsrecomm", needToNotifyBlock);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (friendsrecomm() && (type.equals("user_rec") || type.equals("friends_recomm"))) {
|
||||
logRemovedPost(post, source, "friendsrecomm", needToShowToast);
|
||||
logRemovedPost(post, source, "friendsrecomm", needToNotifyBlock);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (adsgroup() && post.optInt("marked_as_ads") == 1 && !isWhitelistedAd(post)) {
|
||||
logRemovedPost(post, source, "marked_as_ads", needToShowToast);
|
||||
return false;
|
||||
if (adsgroup() && post.optInt("marked_as_ads") == 1 && !post.optBoolean("sponsorpost") && !isWhitelistedAd(post)) {
|
||||
logRemovedPost(post, source, "marked_as_ads", needToNotifyBlock);
|
||||
return needToNotifyBlock;
|
||||
}
|
||||
|
||||
if (PostsPreferences.isPostAd(getOwnerId(post), getPostId(post)) && !isWhitelistedAd(post)) {
|
||||
logRemovedPost(post, source, "sponsorpost", needToShowToast);
|
||||
return false;
|
||||
if (PostsPreferences.isPostAd(getOwnerId(post), getPostId(post)) && !post.optBoolean("sponsorpost") && !isWhitelistedAd(post)) {
|
||||
logRemovedPost(post, source, "sponsorpost", needToNotifyBlock);
|
||||
PostsPreferences.incrementNumBlockedPosts();
|
||||
|
||||
if (PostsPreferences.isEnabledMarking() || needToNotifyBlock) {
|
||||
addSponsorPostMark(post);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (sponsorFilters(post.optString("text")) && !isWhitelistedFilters(post)) {
|
||||
logRemovedPost(post, source, "sponsorpost filter", needToShowToast);
|
||||
return false;
|
||||
if (VotesPreferences.isPostAd(getOwnerId(post), getPostId(post)) && !post.optBoolean("sponsorpost") && !isWhitelistedAd(post)) {
|
||||
logRemovedPost(post, source, "sponsorpost vote base", needToNotifyBlock);
|
||||
addSponsorPostMark(post);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sponsorFilters(post.optString("text")) && !post.optBoolean("sponsorpost") && !isWhitelistedFilters(post)) {
|
||||
logRemovedPost(post, source, "sponsorpost filter", needToNotifyBlock);
|
||||
FiltersPreferences.incrementNumBlockedPosts();
|
||||
|
||||
if (FiltersPreferences.isEnabledMarking() || needToNotifyBlock) {
|
||||
addSponsorPostMark(post);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (checkCopyright(post)) {
|
||||
logRemovedPost(post, source, "copyright filters", needToShowToast);
|
||||
return false;
|
||||
logRemovedPost(post, source, "copyright filters", needToNotifyBlock);
|
||||
FiltersPreferences.incrementNumBlockedPosts();
|
||||
return needToNotifyBlock;
|
||||
}
|
||||
|
||||
if (checkCaption(post)) {
|
||||
logRemovedPost(post, source, "caption filters", needToShowToast);
|
||||
return false;
|
||||
logRemovedPost(post, source, "caption filters", needToNotifyBlock);
|
||||
return needToNotifyBlock;
|
||||
}
|
||||
|
||||
if (hasMiniAppAds(post) && !isWhitelistedFilters(post)) {
|
||||
logRemovedPost(post, source, "miniapps ban", needToShowToast);
|
||||
return false;
|
||||
logRemovedPost(post, source, "miniapps ban", needToNotifyBlock);
|
||||
return needToNotifyBlock;
|
||||
}
|
||||
|
||||
if (NewsFeedFiltersUtils.injectFiltersReposts(post) && !isWhitelistedFilters(post)) {
|
||||
logRemovedPost(post, source, "repost ad", needToShowToast);
|
||||
return false;
|
||||
logRemovedPost(post, source, "repost ad", needToNotifyBlock);
|
||||
return needToNotifyBlock;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void addSponsorPostMark(JSONObject post) throws JSONException {
|
||||
post.putOpt("marked_as_ads", 1);
|
||||
post.putOpt("sponsorpost", true);
|
||||
}
|
||||
|
||||
public static JSONArray feedInject(JSONArray items, boolean needToShowToast) {
|
||||
if (items.length() == 0) return items;
|
||||
|
||||
@@ -276,24 +303,26 @@ public class NewsFeedFiltersUtils {
|
||||
|
||||
public static boolean sponsorFilters(String text) {
|
||||
String textInLowerCase = text.toLowerCase();
|
||||
Set<String> list = filters.stream()
|
||||
.filter(adword -> !adword.isEmpty())
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
return list.stream().anyMatch(adword -> {
|
||||
if (textInLowerCase.contains(adword.toLowerCase())) {
|
||||
return filters.stream()
|
||||
.map(String::toLowerCase)
|
||||
.filter(adword -> !adword.isEmpty() && textInLowerCase.contains(adword))
|
||||
.peek(adword -> {
|
||||
if (dev()) {
|
||||
Log.d("NewsfeedAdBlockV2", text);
|
||||
Log.d("NewsfeedAdBlockV2", "Block word: " + adword);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
})
|
||||
.findAny()
|
||||
.isPresent();
|
||||
}
|
||||
|
||||
return false;
|
||||
public static String sponsorFiltersBanWord(String text) {
|
||||
String textInLowerCase = text.toLowerCase();
|
||||
return filters.stream()
|
||||
.map(String::toLowerCase)
|
||||
.filter(adword -> !adword.isEmpty() && textInLowerCase.contains(adword))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package ru.vtosters.sponsorpost.internal;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
public class Native {
|
||||
public static boolean canVote;
|
||||
|
||||
public static boolean canVote() {
|
||||
return canVote;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static native String sig();
|
||||
|
||||
@Nullable
|
||||
public static native String time();
|
||||
|
||||
@Nullable
|
||||
public static native String pkey();
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package ru.vtosters.sponsorpost.internal;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.util.Log;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class VotesPreferences {
|
||||
private static final SharedPreferences preferences;
|
||||
|
||||
static {
|
||||
preferences = getPreferences();
|
||||
}
|
||||
|
||||
private static SharedPreferences getPreferences() {
|
||||
return AndroidUtils.getGlobalContext().getSharedPreferences("ru.vtosters.sponsorpost.votes.prefs", Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
public static boolean isEnabled() {
|
||||
return preferences.getBoolean("sponsortesting", false);
|
||||
}
|
||||
|
||||
public static void setEnabled(boolean status) {
|
||||
preferences.edit().putBoolean("sponsortesting", status).apply();
|
||||
}
|
||||
|
||||
public static void setUserToken(String token) {
|
||||
preferences.edit()
|
||||
.putString("token", token)
|
||||
.apply();
|
||||
}
|
||||
|
||||
public static void remUserToken() {
|
||||
preferences.edit()
|
||||
.remove("token")
|
||||
.apply();
|
||||
}
|
||||
|
||||
public static String getUserToken() {
|
||||
return preferences.getString("token", "");
|
||||
}
|
||||
|
||||
public static void savePosts(List<String> posts) {
|
||||
preferences.edit()
|
||||
.putStringSet("posts", new HashSet<>(posts))
|
||||
.apply();
|
||||
}
|
||||
|
||||
public static void saveGroupsIds(List<String> ids) {
|
||||
preferences.edit()
|
||||
.putStringSet("groupIds", new HashSet<>(ids))
|
||||
.apply();
|
||||
}
|
||||
|
||||
public static void saveGroupSpecifiedPosts(List<String> postsIds, Long ownerId) {
|
||||
Set<String> stringSet = postsIds.stream()
|
||||
.map(post -> ownerId + "_" + post)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
preferences.edit()
|
||||
.putStringSet(ownerId + "_posts", stringSet)
|
||||
.apply();
|
||||
}
|
||||
|
||||
public static void saveAdPostInfo(long ownerId, long postId) {
|
||||
Set<String> currentStringSet = preferences.getStringSet("posts", new HashSet<>());
|
||||
Set<String> newStringSet = new HashSet<>(currentStringSet);
|
||||
|
||||
newStringSet.add(ownerId + "_" + postId);
|
||||
|
||||
Log.d("SponsorPost", ownerId + "_" + postId);
|
||||
|
||||
preferences.edit()
|
||||
.putStringSet("posts", newStringSet)
|
||||
.apply();
|
||||
}
|
||||
|
||||
public static boolean isGroupAd(long ownerId) {
|
||||
Set<String> isGroupAd = preferences.getStringSet("groupIds", new HashSet<>());
|
||||
|
||||
if (!isGroupAd.isEmpty() && isEnabled()) {
|
||||
return isGroupAd.contains(Long.toString(ownerId));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isPostAd(long ownerId, long postId) {
|
||||
if (isEnabled() && isGroupAd(ownerId)) {
|
||||
Set<String> hasSpecifiedGroupPosts = preferences.getStringSet(ownerId + "_posts", new HashSet<>());
|
||||
Set<String> hasPost = preferences.getStringSet("posts", new HashSet<>());
|
||||
|
||||
return hasPost.contains(ownerId + "_" + postId) || hasSpecifiedGroupPosts.contains(ownerId + "_" + postId);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
package ru.vtosters.sponsorpost.internal;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import ru.vtosters.sponsorpost.utils.ApiUtils;
|
||||
import ru.vtosters.sponsorpost.utils.GzipDecompressor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class VotesService {
|
||||
private static final OkHttpClient client = new OkHttpClient();
|
||||
private static final String apiPath = ApiUtils.getURL() + "/votes";
|
||||
private static final String userPath = ApiUtils.getURL() + "/users";
|
||||
|
||||
public static Map<String, List<String>> getPosts(Long date) {
|
||||
String getFromDate = date > 0 ? ("&date=" + date) : "";
|
||||
Request request = new Request.a()
|
||||
.b(apiPath + "/getAllPostIds" + "?needProd=true" + getFromDate)
|
||||
.a("Content-Type", "application/json")
|
||||
.a("Accept-Encoding", "gzip")
|
||||
.a();
|
||||
try (Response response = client.a(request).execute()) {
|
||||
if (response.h()) {
|
||||
return parseJSON(new JSONObject(GzipDecompressor.decompressResponse(response)));
|
||||
} else {
|
||||
throw new RuntimeException("Failed to get posts: " + response.l());
|
||||
}
|
||||
} catch (IOException | JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static Map<String, List<String>> parseJSON(JSONObject object) throws JSONException {
|
||||
String PROD_KEY = "prod";
|
||||
String VOTE_KEY = "vote";
|
||||
|
||||
JSONArray prodBase = object.getJSONArray(PROD_KEY);
|
||||
JSONArray testBase = object.getJSONArray(VOTE_KEY);
|
||||
|
||||
if (prodBase.length() == 0 && testBase.length() == 0) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
List<String> prodList = IntStream.range(0, prodBase.length())
|
||||
.mapToObj(prodBase::optString)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<String> voteList = IntStream.range(0, testBase.length())
|
||||
.mapToObj(testBase::optString)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return Map.of(PROD_KEY, prodList, VOTE_KEY, voteList);
|
||||
}
|
||||
|
||||
public static Map<String, List<String>> getPostIdsByOwnerId(Long ownerId, Long date) {
|
||||
String getFromDate = date > 0 ? ("&date=" + date) : "";
|
||||
String requestUrl = apiPath + "/getPostIdsByOwnerId" + "?ownerId=" + ownerId + getFromDate + "&needProd=true";
|
||||
Request request = new Request.a()
|
||||
.b(requestUrl)
|
||||
.a("Content-Type", "application/json")
|
||||
.a("Accept-Encoding", "gzip")
|
||||
.a();
|
||||
try (Response response = client.a(request).execute()) {
|
||||
if (response.h()) {
|
||||
return parseJSON(new JSONObject(GzipDecompressor.decompressResponse(response)));
|
||||
} else {
|
||||
throw new RuntimeException("Failed to get postIdsByOwnerId: " + response.l());
|
||||
}
|
||||
} catch (IOException | JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static Map<String, List<String>> getOwnerIds() {
|
||||
String requestUrl = apiPath + "/getOwnerIds" + "?needProd=true";
|
||||
Request request = new Request.a()
|
||||
.b(requestUrl)
|
||||
.a("Content-Type", "application/json")
|
||||
.a("Accept-Encoding", "gzip")
|
||||
.a();
|
||||
try (Response response = client.a(request).execute()) {
|
||||
if (response.h()) {
|
||||
return parseJSON(new JSONObject(GzipDecompressor.decompressResponse(response)));
|
||||
} else {
|
||||
throw new RuntimeException("Failed to get ownersIds: " + response.l());
|
||||
}
|
||||
} catch (IOException | JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static JSONObject ratePost(int ownerId, int postId, int date, boolean isAd) {
|
||||
String token = VotesPreferences.getUserToken() == null || VotesPreferences.getUserToken().isEmpty() ? getVoteToken() : VotesPreferences.getUserToken();
|
||||
String requestUrl = apiPath + (isAd ? "/dislike" : "/like") + "?ownerId=" + ownerId + "&postId=" + postId+ "&postDate=" + date + "&token=" + Uri.encode(token);
|
||||
Request request = new Request.a()
|
||||
.b(requestUrl)
|
||||
.a("Content-Type", "application/json")
|
||||
.a();
|
||||
try (Response response = client.a(request).execute()) {
|
||||
return new JSONObject(GzipDecompressor.decompressResponse(response));
|
||||
} catch (IOException | JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getVoteToken() {
|
||||
String requestUrl = userPath + "/getUserToken" + "?private_key=" + Uri.encode(Native.pkey());
|
||||
Request request = new Request.a()
|
||||
.b(requestUrl)
|
||||
.a("Content-Type", "application/json")
|
||||
.a("Timestamp", Native.time())
|
||||
.a("Signature", Native.sig())
|
||||
.a();
|
||||
try (Response response = client.a(request).execute()) {
|
||||
String userToken = new JSONObject(GzipDecompressor.decompressResponse(response)).getString("token");
|
||||
VotesPreferences.setUserToken(userToken);
|
||||
return userToken;
|
||||
} catch (IOException | JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isPostAd(long ownerId, long postId) {
|
||||
String requestUrl = apiPath + "/isPostAdvert?post=" + ownerId + "_" + postId + "&needProd=true";
|
||||
Request request = new Request.a()
|
||||
.b(requestUrl)
|
||||
.a("Content-Type", "application/json")
|
||||
.a();
|
||||
try (Response response = client.a(request).execute()) {
|
||||
if (response.h()) {
|
||||
return Boolean.parseBoolean(GzipDecompressor.decompressResponse(response));
|
||||
} else {
|
||||
throw new RuntimeException("Failed to check post for ad status: " + response.l());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,20 +42,7 @@ public class FilterService {
|
||||
try (Response response = client.a(request).execute()) {
|
||||
// Check if the response is successful
|
||||
if (response.h()) {
|
||||
// Determine the response encoding
|
||||
String encoding = response.a("Content-Encoding");
|
||||
String resp;
|
||||
|
||||
if (encoding != null && encoding.equals("gzip")) {
|
||||
// Decompress the response body
|
||||
resp = GzipDecompressor.decompress(response.a().b());
|
||||
} else {
|
||||
// Retrieve the response body directly
|
||||
resp = response.a().g();
|
||||
}
|
||||
|
||||
// Parse the response body as a JSONArray and extract filter objects
|
||||
return parseJSON(new JSONArray(resp));
|
||||
return parseJSON(new JSONArray(GzipDecompressor.decompressResponse(response)));
|
||||
} else {
|
||||
if (!FiltersPreferences.getAllFilterIds().isEmpty()) {
|
||||
return FiltersPreferences.getAllDownloadedFilters(); // check for offline server to get local filters
|
||||
@@ -75,11 +62,12 @@ public class FilterService {
|
||||
public static Set<String> downloadFilter(String link) {
|
||||
Request request = new Request.a()
|
||||
.b(link)
|
||||
.a("Accept-Encoding", "gzip")
|
||||
.a();
|
||||
|
||||
try (Response response = client.a(request).execute()) {
|
||||
if (response.h()) {
|
||||
return stringToSet(response.a().g());
|
||||
return stringToSet(GzipDecompressor.decompressResponse(response));
|
||||
} else {
|
||||
throw new RuntimeException("Failed to download filter: " + response.l());
|
||||
}
|
||||
|
||||
@@ -39,17 +39,7 @@ public class PostService {
|
||||
try (Response response = client.a(request).execute()) {
|
||||
// Check if the response is successful
|
||||
if (response.h()) {
|
||||
// Determine the response encoding
|
||||
String encoding = response.a("Content-Encoding");
|
||||
|
||||
// Handle GZIP-compressed responses
|
||||
if (encoding != null && encoding.equals("gzip")) {
|
||||
// Decompress the response body and parse JSON data
|
||||
return parseJSONPosts(new JSONArray(GzipDecompressor.decompress(response.a().b())));
|
||||
} else {
|
||||
// Parse JSON data from the response body
|
||||
return parseJSONPosts(new JSONArray(response.a().g()));
|
||||
}
|
||||
return parseJSONPosts(new JSONArray(GzipDecompressor.decompressResponse(response)));
|
||||
} else {
|
||||
// Handle error response
|
||||
throw new RuntimeException("Failed to get posts: " + response.l());
|
||||
@@ -78,20 +68,7 @@ public class PostService {
|
||||
try (Response response = client.a(request).execute()) {
|
||||
// Check if the response is successful
|
||||
if (response.h()) {
|
||||
// Determine the response encoding
|
||||
String encoding = response.a("Content-Encoding");
|
||||
String resp;
|
||||
|
||||
if (encoding != null && encoding.equals("gzip")) {
|
||||
// Decompress the response body
|
||||
resp = GzipDecompressor.decompress(response.a().b());
|
||||
} else {
|
||||
// Retrieve the response body directly
|
||||
resp = response.a().g();
|
||||
}
|
||||
|
||||
// Extract the boolean value indicating whether the post is an ad
|
||||
return Boolean.parseBoolean(resp);
|
||||
return Boolean.parseBoolean(GzipDecompressor.decompressResponse(response));
|
||||
} else {
|
||||
// Handle error response
|
||||
throw new RuntimeException("Failed to check post for ad status: " + response.l());
|
||||
@@ -101,10 +78,19 @@ public class PostService {
|
||||
}
|
||||
}
|
||||
|
||||
public static List<String> getAllPostsIds() {
|
||||
public static List<String> getAllPostsIds(Long date) {
|
||||
String getFromDate;
|
||||
// Get posts older than the specified date (if positive) or all posts (if zero or negative or empty)
|
||||
if (date > 0) {
|
||||
getFromDate = ("?date=" + date);
|
||||
} else {
|
||||
// No date parameter for retrieving all posts
|
||||
getFromDate = "";
|
||||
}
|
||||
|
||||
// Create a GET request for retrieving all post IDs
|
||||
Request request = new Request.a()
|
||||
.b(apiPath + "/getAllPostIds")
|
||||
.b(apiPath + "/getAllPostIds" + getFromDate)
|
||||
.a("Content-Type", "application/json")
|
||||
.a("Accept-Encoding", "gzip")
|
||||
.a();
|
||||
@@ -112,17 +98,7 @@ public class PostService {
|
||||
try (Response response = client.a(request).execute()) {
|
||||
// Check if the response is successful
|
||||
if (response.h()) {
|
||||
// Determine the response encoding
|
||||
String encoding = response.a("Content-Encoding");
|
||||
|
||||
// Handle GZIP-compressed responses
|
||||
if (encoding != null && encoding.equals("gzip")) {
|
||||
// Decompress the response body and extract the first element as a list of post IDs
|
||||
return new ArrayList<>(Collections.singleton(GzipDecompressor.decompress(response.a().b())));
|
||||
} else {
|
||||
// Extract the first element as a list of post IDs
|
||||
return new ArrayList<>(Collections.singleton(response.a().g()));
|
||||
}
|
||||
return new ArrayList<>(Collections.singleton(GzipDecompressor.decompressResponse(response)));
|
||||
} else {
|
||||
// Handle error response
|
||||
throw new RuntimeException("Failed to get posts IDs: " + response.l());
|
||||
@@ -137,7 +113,7 @@ public class PostService {
|
||||
// Retrieve post IDs for a specific owner and date
|
||||
// If date is positive, get posts older than the specified date
|
||||
// Otherwise, get all posts for the owner
|
||||
String getFromDate = date > 0 ? ("?date=" + date) : "";
|
||||
String getFromDate = date > 0 ? ("&date=" + date) : "";
|
||||
|
||||
// Construct the API request URL
|
||||
String requestUrl = apiPath + "/getPostIdsByOwnerId" + "?ownerId=" + ownerId + getFromDate;
|
||||
@@ -152,20 +128,7 @@ public class PostService {
|
||||
try (Response response = client.a(request).execute()) {
|
||||
// Check if the response is successful
|
||||
if (response.h()) {
|
||||
// Determine the response encoding
|
||||
String encoding = response.a("Content-Encoding");
|
||||
String resp;
|
||||
|
||||
if (encoding != null && encoding.equals("gzip")) {
|
||||
// Decompress the response body
|
||||
resp = GzipDecompressor.decompress(response.a().b());
|
||||
} else {
|
||||
// Retrieve the response body directly
|
||||
resp = response.a().g();
|
||||
}
|
||||
|
||||
// Parse the response body as a JSONArray and extract post IDs
|
||||
return parseJSONIds(new JSONArray(resp));
|
||||
return parseJSONIds(new JSONArray(GzipDecompressor.decompressResponse(response)));
|
||||
} else {
|
||||
// Handle error response
|
||||
throw new RuntimeException("Failed to get postIdsByOwnerId: " + response.l());
|
||||
@@ -192,20 +155,7 @@ public class PostService {
|
||||
try (Response response = client.a(request).execute()) {
|
||||
// Check if the response is successful
|
||||
if (response.h()) {
|
||||
// Determine the response encoding
|
||||
String encoding = response.a("Content-Encoding");
|
||||
String resp;
|
||||
|
||||
if (encoding != null && encoding.equals("gzip")) {
|
||||
// Decompress the response body
|
||||
resp = GzipDecompressor.decompress(response.a().b());
|
||||
} else {
|
||||
// Retrieve the response body directly
|
||||
resp = response.a().g();
|
||||
}
|
||||
|
||||
// Parse the response body as a JSONArray and extract owner IDs
|
||||
return parseJSONIds(new JSONArray(resp));
|
||||
return parseJSONIds(new JSONArray(GzipDecompressor.decompressResponse(response)));
|
||||
} else {
|
||||
// Handle error response
|
||||
throw new RuntimeException("Failed to get ownersIds: " + response.l());
|
||||
|
||||
@@ -31,6 +31,26 @@ public class FiltersPreferences {
|
||||
return AndroidUtils.getGlobalContext().getSharedPreferences("ru.vtosters.sponsorpost.filters.prefs", Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
public static boolean isEnabledMarking() {
|
||||
return preferences.getBoolean("sponsorpost_filters_marking", false);
|
||||
}
|
||||
|
||||
public static void setEnabledMarking(boolean status) {
|
||||
preferences.edit().putBoolean("sponsorpost_filters_marking", status).apply();
|
||||
}
|
||||
|
||||
public static int getNumBlockedPosts() {
|
||||
return preferences.getInt("numBlockedPosts", 0);
|
||||
}
|
||||
|
||||
public static void incrementNumBlockedPosts() {
|
||||
preferences.edit().putInt("numBlockedPosts", getNumBlockedPosts() + 1).apply();
|
||||
}
|
||||
|
||||
public static void dropNumBlockedPosts() {
|
||||
preferences.edit().putInt("numBlockedPosts", 0).apply();
|
||||
}
|
||||
|
||||
public static void clearAllCachedLists() {
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package ru.vtosters.sponsorpost.utils;
|
||||
|
||||
import android.util.Log;
|
||||
import okhttp3.Response;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -26,4 +29,17 @@ public class GzipDecompressor {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static String decompressResponse(Response response) throws IOException {
|
||||
String encoding = response.a("Content-Encoding");
|
||||
if (encoding != null && encoding.equals("gzip")) {
|
||||
// Decompress the response body
|
||||
Log.d("GZIP", "true, link " + response.o().g());
|
||||
return GzipDecompressor.decompress(response.a().b());
|
||||
} else {
|
||||
// Retrieve the response body directly
|
||||
Log.d("GZIP", "false, link " + response.o().g());
|
||||
return response.a().g();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,14 @@ public class PostsPreferences {
|
||||
preferences.edit().putBoolean("sponsorpost", status).apply();
|
||||
}
|
||||
|
||||
public static boolean isEnabledMarking() {
|
||||
return preferences.getBoolean("sponsorpost_marking", false);
|
||||
}
|
||||
|
||||
public static void setEnabledMarking(boolean status) {
|
||||
preferences.edit().putBoolean("sponsorpost_marking", status).apply();
|
||||
}
|
||||
|
||||
public static void savePosts(List<Post> posts) {
|
||||
Set<String> stringSet = posts.stream()
|
||||
.map(post -> post.getOwnerId() + "_" + post.getPostId())
|
||||
@@ -40,7 +48,13 @@ public class PostsPreferences {
|
||||
.apply();
|
||||
}
|
||||
|
||||
public static void saveGroupSpecifiedPosts(List<Long> postsIds, Long ownerId) {
|
||||
public static void savePostsStr(List<String> posts) {
|
||||
preferences.edit()
|
||||
.putStringSet("posts", new HashSet<>(posts))
|
||||
.apply();
|
||||
}
|
||||
|
||||
public static void saveGroupSpecifiedPosts(List<?> postsIds, Long ownerId) {
|
||||
Set<String> stringSet = postsIds.stream()
|
||||
.map(post -> ownerId + "_" + post)
|
||||
.collect(Collectors.toSet());
|
||||
@@ -50,7 +64,7 @@ public class PostsPreferences {
|
||||
.apply();
|
||||
}
|
||||
|
||||
public static void saveGroupsIds(List<Long> ids) {
|
||||
public static void saveGroupsIds(List<?> ids) {
|
||||
Set<String> stringSet = ids.stream().map(String::valueOf).collect(Collectors.toSet());
|
||||
|
||||
preferences.edit()
|
||||
@@ -81,6 +95,18 @@ public class PostsPreferences {
|
||||
}
|
||||
}
|
||||
|
||||
public static int getNumBlockedPosts() {
|
||||
return preferences.getInt("numBlockedPosts", 0);
|
||||
}
|
||||
|
||||
public static void incrementNumBlockedPosts() {
|
||||
preferences.edit().putInt("numBlockedPosts", getNumBlockedPosts() + 1).apply();
|
||||
}
|
||||
|
||||
public static void dropNumBlockedPosts() {
|
||||
preferences.edit().putInt("numBlockedPosts", 0).apply();
|
||||
}
|
||||
|
||||
public static boolean isPostAd(long ownerId, long postId) {
|
||||
if (isEnabled() && isGroupAd(ownerId)) {
|
||||
Set<String> hasSpecifiedGroupPosts = preferences.getStringSet(ownerId + "_posts", new HashSet<>());
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package ru.vtosters.sponsorpost.utils;
|
||||
|
||||
import ru.vtosters.hooks.other.Preferences;
|
||||
import ru.vtosters.lite.utils.NetworkUtils;
|
||||
import ru.vtosters.lite.utils.newsfeed.NewsFeedFiltersUtils;
|
||||
import ru.vtosters.sponsorpost.data.Filter;
|
||||
import ru.vtosters.sponsorpost.data.Post;
|
||||
import ru.vtosters.sponsorpost.internal.VotesPreferences;
|
||||
import ru.vtosters.sponsorpost.internal.VotesService;
|
||||
import ru.vtosters.sponsorpost.services.FilterService;
|
||||
import ru.vtosters.sponsorpost.services.PostService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -59,16 +61,31 @@ public class Updates {
|
||||
long weekAgo = currentTime - TimeUnit.DAYS.toMillis(7);
|
||||
|
||||
if (PostsPreferences.isEnabled() && NetworkUtils.isNetworkConnected()) {
|
||||
List<Post> posts = PostService.getPosts(weekAgo);
|
||||
List<Long> groupIds = PostService.getOwnerIds();
|
||||
if (VotesPreferences.isEnabled()) {
|
||||
Map<String, List<String>> posts = VotesService.getPosts(weekAgo / 1000);
|
||||
Map<String, List<String>> groupIds = VotesService.getOwnerIds();
|
||||
|
||||
if (!posts.isEmpty()) {
|
||||
PostsPreferences.savePosts(posts);
|
||||
}
|
||||
if (!posts.isEmpty()) {
|
||||
PostsPreferences.savePostsStr(posts.get("prod"));
|
||||
VotesPreferences.savePosts(posts.get("vote"));
|
||||
}
|
||||
|
||||
if (!groupIds.isEmpty()) {
|
||||
PostsPreferences.saveGroupsIds(groupIds);
|
||||
if (!groupIds.isEmpty()) {
|
||||
PostsPreferences.saveGroupsIds(groupIds.get("prod"));
|
||||
VotesPreferences.saveGroupsIds(groupIds.get("vote"));
|
||||
}
|
||||
} else {
|
||||
List<String> posts = PostService.getAllPostsIds(weekAgo / 1000);
|
||||
List<Long> groupIds = PostService.getOwnerIds();
|
||||
|
||||
if (!posts.isEmpty()) {
|
||||
PostsPreferences.savePostsStr(posts);
|
||||
}
|
||||
|
||||
if (!groupIds.isEmpty()) {
|
||||
PostsPreferences.saveGroupsIds(groupIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,116 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:custom="http://schemas.android.com/apk/res-auto">
|
||||
xmlns:custom="http://schemas.android.com/apk/res-auto">
|
||||
<PreferenceCategory
|
||||
android:key="app"
|
||||
android:title="@string/sett_app">
|
||||
android:key="app"
|
||||
android:title="@string/sett_app">
|
||||
<com.vtosters.lite.ui.SummaryListPreference
|
||||
android:defaultValue="firstname"
|
||||
android:dialogTitle="@string/sett_flist_sort"
|
||||
android:entries="@array/sett_friends_order"
|
||||
android:entryValues="@array/sett_friends_order_v"
|
||||
android:key="friendsOrderNew"
|
||||
android:textColor="?text_secondary"
|
||||
android:title="@string/sett_flist_sort" />
|
||||
android:defaultValue="firstname"
|
||||
android:dialogTitle="@string/sett_flist_sort"
|
||||
android:entries="@array/sett_friends_order"
|
||||
android:entryValues="@array/sett_friends_order_v"
|
||||
android:key="friendsOrderNew"
|
||||
android:textColor="?text_secondary"
|
||||
android:title="@string/sett_flist_sort"/>
|
||||
<com.vtosters.lite.ui.SummaryListPreference
|
||||
android:defaultValue="0"
|
||||
android:dialogTitle="@string/sett_font_size"
|
||||
android:entries="@array/sett_font_size_options"
|
||||
android:entryValues="@array/sett_font_size_values"
|
||||
android:key="fontSize"
|
||||
android:title="@string/sett_font_size" />
|
||||
android:defaultValue="0"
|
||||
android:dialogTitle="@string/sett_font_size"
|
||||
android:entries="@array/sett_font_size_options"
|
||||
android:entryValues="@array/sett_font_size_values"
|
||||
android:key="fontSize"
|
||||
android:title="@string/sett_font_size"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="sendByEnter"
|
||||
android:summary="@string/sett_send_by_enter_summary"
|
||||
android:title="@string/sett_send_by_enter" />
|
||||
android:defaultValue="false"
|
||||
android:key="sendByEnter"
|
||||
android:summary="@string/sett_send_by_enter_summary"
|
||||
android:title="@string/sett_send_by_enter"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="useChromeCustomTabs"
|
||||
android:summary="@string/sett_chrome_custom_tabs_summary"
|
||||
android:title="@string/sett_chrome_custom_tabs" />
|
||||
android:defaultValue="true"
|
||||
android:key="useChromeCustomTabs"
|
||||
android:summary="@string/sett_chrome_custom_tabs_summary"
|
||||
android:title="@string/sett_chrome_custom_tabs"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="trackInstalledApps"
|
||||
android:summary="@string/sett_mytracker_location_crap_summary"
|
||||
android:title="@string/sett_mytracker_apps" />
|
||||
android:defaultValue="true"
|
||||
android:key="trackInstalledApps"
|
||||
android:summary="@string/sett_mytracker_location_crap_summary"
|
||||
android:title="@string/sett_mytracker_apps"/>
|
||||
<!-- <com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="useProxyServer"
|
||||
android:title="@string/sett_use_proxy"
|
||||
android:visibility="gone" /> -->
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="isRoamingState"
|
||||
android:summary="@string/sett_roaming_state_submit"
|
||||
android:title="@string/sett_roaming_state" />
|
||||
<com.vtosters.lite.ui.MaterialSectionDividerPreference />
|
||||
android:defaultValue="false"
|
||||
android:key="isRoamingState"
|
||||
android:summary="@string/sett_roaming_state_submit"
|
||||
android:title="@string/sett_roaming_state"/>
|
||||
<com.vtosters.lite.ui.MaterialSectionDividerPreference/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:key="multimedia"
|
||||
android:title="@string/sett_media">
|
||||
android:key="multimedia"
|
||||
android:title="@string/sett_media">
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="saveProcessedImage"
|
||||
android:title="@string/sett_save_processed_image"
|
||||
custom:singleLine="false" />
|
||||
android:defaultValue="true"
|
||||
android:key="saveProcessedImage"
|
||||
android:title="@string/sett_save_processed_image"
|
||||
custom:singleLine="false"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="showMusicSuggestNotification"
|
||||
android:title="@string/sett_show_music_suggestion_notification"
|
||||
custom:singleLine="false" />
|
||||
android:defaultValue="true"
|
||||
android:key="showMusicSuggestNotification"
|
||||
android:title="@string/sett_show_music_suggestion_notification"
|
||||
custom:singleLine="false"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="prefetchAudioMsg"
|
||||
android:title="@string/vkim_settings_prefetch_audiomsg"
|
||||
custom:singleLine="false" />
|
||||
android:defaultValue="true"
|
||||
android:key="prefetchAudioMsg"
|
||||
android:title="@string/vkim_settings_prefetch_audiomsg"
|
||||
custom:singleLine="false"/>
|
||||
<ListPreference
|
||||
android:defaultValue="always"
|
||||
android:entries="@array/sett_gif_autoplay_entries"
|
||||
android:entryValues="@array/sett_gif_autoplay_entry_values"
|
||||
android:key="gif_autoplay"
|
||||
android:summary="%s"
|
||||
android:title="@string/sett_gif_autoplay_title" />
|
||||
android:defaultValue="always"
|
||||
android:entries="@array/sett_gif_autoplay_entries"
|
||||
android:entryValues="@array/sett_gif_autoplay_entry_values"
|
||||
android:key="gif_autoplay"
|
||||
android:summary="%s"
|
||||
android:title="@string/sett_gif_autoplay_title"/>
|
||||
<ListPreference
|
||||
android:defaultValue="always"
|
||||
android:entries="@array/sett_gif_autoplay_entries"
|
||||
android:entryValues="@array/sett_gif_autoplay_entry_values"
|
||||
android:key="video_autoplay"
|
||||
android:summary="%s"
|
||||
android:title="@string/sett_video_autoplay_title" />
|
||||
<com.vtosters.lite.ui.MaterialSectionDividerPreference />
|
||||
android:defaultValue="always"
|
||||
android:entries="@array/sett_gif_autoplay_entries"
|
||||
android:entryValues="@array/sett_gif_autoplay_entry_values"
|
||||
android:key="video_autoplay"
|
||||
android:summary="%s"
|
||||
android:title="@string/sett_video_autoplay_title"/>
|
||||
<com.vtosters.lite.ui.MaterialSectionDividerPreference/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:key="cache"
|
||||
android:title="@string/sett_cache">
|
||||
android:key="cache"
|
||||
android:title="@string/sett_cache">
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="enableAudioCache"
|
||||
android:title="@string/sett_enable_audio_cache" />
|
||||
android:defaultValue="true"
|
||||
android:key="enableAudioCache"
|
||||
android:title="@string/sett_enable_audio_cache"/>
|
||||
<com.vtosters.lite.ui.SummaryListPreference
|
||||
android:defaultValue=""
|
||||
android:dialogTitle="@string/sett_cache_location"
|
||||
android:key="audioCacheLocation"
|
||||
android:title="@string/sett_cache_location" />
|
||||
android:defaultValue=""
|
||||
android:dialogTitle="@string/sett_cache_location"
|
||||
android:key="audioCacheLocation"
|
||||
android:title="@string/sett_cache_location"/>
|
||||
<Preference
|
||||
android:key="downloadAudio"
|
||||
android:title="@string/cache_my_music" />
|
||||
android:key="downloadAudio"
|
||||
android:title="@string/cache_my_music"/>
|
||||
<Preference
|
||||
android:key="clearAudioCache"
|
||||
android:summary=""
|
||||
android:title="@string/sett_clear_audio_cache" />
|
||||
android:key="clearAudioCache"
|
||||
android:summary=""
|
||||
android:title="@string/sett_clear_audio_cache"/>
|
||||
<!-- <Preference-->
|
||||
<!-- android:key="clearImageCache"-->
|
||||
<!-- android:summary=""-->
|
||||
<!-- android:title="@string/sett_clear_img_cache"/>-->
|
||||
<!-- <Preference-->
|
||||
<!-- android:key="clearVideoCache"-->
|
||||
<!-- android:summary=""-->
|
||||
<!-- android:title="@string/sett_clear_video_cache"/>-->
|
||||
<!-- <Preference-->
|
||||
<!-- android:key="clearMessagesCache"-->
|
||||
<!-- android:summary=""-->
|
||||
<!-- android:title="@string/sett_clear_messages_cache"/>-->
|
||||
<Preference
|
||||
android:key="clearImageCache"
|
||||
android:summary=""
|
||||
android:title="@string/sett_clear_img_cache" />
|
||||
<Preference
|
||||
android:key="clearVideoCache"
|
||||
android:summary=""
|
||||
android:title="@string/sett_clear_video_cache" />
|
||||
<Preference
|
||||
android:key="clearMessagesCache"
|
||||
android:summary=""
|
||||
android:title="@string/sett_clear_messages_cache" />
|
||||
<com.vtosters.lite.ui.MaterialSectionDividerPreference />
|
||||
android:enabled="false"
|
||||
android:summary="@string/where_is_cache_settings_summ"
|
||||
android:title="@string/where_is_cache_settings"/>
|
||||
<com.vtosters.lite.ui.MaterialSectionDividerPreference/>
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
@@ -1,115 +1,119 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:custom="http://schemas.android.com/apk/res-auto">
|
||||
xmlns:custom="http://schemas.android.com/apk/res-auto">
|
||||
<PreferenceCategory
|
||||
android:key="app"
|
||||
android:title="@string/sett_app">
|
||||
android:key="app"
|
||||
android:title="@string/sett_app">
|
||||
<com.vtosters.lite.ui.SummaryListPreference
|
||||
android:defaultValue="firstname"
|
||||
android:dialogTitle="@string/sett_flist_sort"
|
||||
android:entries="@array/sett_friends_order"
|
||||
android:entryValues="@array/sett_friends_order_v"
|
||||
android:key="friendsOrderNew"
|
||||
android:layout="@layout/preference_with_value"
|
||||
android:textColor="?text_secondary"
|
||||
android:title="@string/sett_flist_sort" />
|
||||
android:defaultValue="firstname"
|
||||
android:dialogTitle="@string/sett_flist_sort"
|
||||
android:entries="@array/sett_friends_order"
|
||||
android:entryValues="@array/sett_friends_order_v"
|
||||
android:key="friendsOrderNew"
|
||||
android:layout="@layout/preference_with_value"
|
||||
android:textColor="?text_secondary"
|
||||
android:title="@string/sett_flist_sort"/>
|
||||
<com.vtosters.lite.ui.SummaryListPreference
|
||||
android:defaultValue="0"
|
||||
android:dialogTitle="@string/sett_font_size"
|
||||
android:entries="@array/sett_font_size_options"
|
||||
android:entryValues="@array/sett_font_size_values"
|
||||
android:key="fontSize"
|
||||
android:layout="@layout/preference_with_value"
|
||||
android:title="@string/sett_font_size" />
|
||||
android:defaultValue="0"
|
||||
android:dialogTitle="@string/sett_font_size"
|
||||
android:entries="@array/sett_font_size_options"
|
||||
android:entryValues="@array/sett_font_size_values"
|
||||
android:key="fontSize"
|
||||
android:layout="@layout/preference_with_value"
|
||||
android:title="@string/sett_font_size"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="sendByEnter"
|
||||
android:summary="@string/sett_send_by_enter_summary"
|
||||
android:title="@string/sett_send_by_enter" />
|
||||
android:defaultValue="false"
|
||||
android:key="sendByEnter"
|
||||
android:summary="@string/sett_send_by_enter_summary"
|
||||
android:title="@string/sett_send_by_enter"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="useChromeCustomTabs"
|
||||
android:summary="@string/sett_chrome_custom_tabs_summary"
|
||||
android:title="@string/sett_chrome_custom_tabs" />
|
||||
android:defaultValue="true"
|
||||
android:key="useChromeCustomTabs"
|
||||
android:summary="@string/sett_chrome_custom_tabs_summary"
|
||||
android:title="@string/sett_chrome_custom_tabs"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="trackInstalledApps"
|
||||
android:summary="@string/sett_mytracker_location_crap_summary"
|
||||
android:title="@string/sett_mytracker_apps" />
|
||||
android:defaultValue="true"
|
||||
android:key="trackInstalledApps"
|
||||
android:summary="@string/sett_mytracker_location_crap_summary"
|
||||
android:title="@string/sett_mytracker_apps"/>
|
||||
<!-- <com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="useProxyServer"
|
||||
android:title="@string/sett_use_proxy"
|
||||
android:visibility="gone" /> -->
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="isRoamingState"
|
||||
android:summary="@string/sett_roaming_state_submit"
|
||||
android:title="@string/sett_roaming_state" />
|
||||
android:defaultValue="false"
|
||||
android:key="isRoamingState"
|
||||
android:summary="@string/sett_roaming_state_submit"
|
||||
android:title="@string/sett_roaming_state"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:key="multimedia"
|
||||
android:title="@string/sett_media">
|
||||
android:key="multimedia"
|
||||
android:title="@string/sett_media">
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="saveProcessedImage"
|
||||
android:title="@string/sett_save_processed_image"
|
||||
custom:singleLine="false" />
|
||||
android:defaultValue="true"
|
||||
android:key="saveProcessedImage"
|
||||
android:title="@string/sett_save_processed_image"
|
||||
custom:singleLine="false"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="showMusicSuggestNotification"
|
||||
android:title="@string/sett_show_music_suggestion_notification"
|
||||
custom:singleLine="false" />
|
||||
android:defaultValue="true"
|
||||
android:key="showMusicSuggestNotification"
|
||||
android:title="@string/sett_show_music_suggestion_notification"
|
||||
custom:singleLine="false"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="prefetchAudioMsg"
|
||||
android:title="@string/vkim_settings_prefetch_audiomsg"
|
||||
custom:singleLine="false" />
|
||||
android:defaultValue="true"
|
||||
android:key="prefetchAudioMsg"
|
||||
android:title="@string/vkim_settings_prefetch_audiomsg"
|
||||
custom:singleLine="false"/>
|
||||
<ListPreference
|
||||
android:defaultValue="always"
|
||||
android:entries="@array/sett_gif_autoplay_entries"
|
||||
android:entryValues="@array/sett_gif_autoplay_entry_values"
|
||||
android:key="gif_autoplay"
|
||||
android:summary="%s"
|
||||
android:title="@string/sett_gif_autoplay_title" />
|
||||
android:defaultValue="always"
|
||||
android:entries="@array/sett_gif_autoplay_entries"
|
||||
android:entryValues="@array/sett_gif_autoplay_entry_values"
|
||||
android:key="gif_autoplay"
|
||||
android:summary="%s"
|
||||
android:title="@string/sett_gif_autoplay_title"/>
|
||||
<ListPreference
|
||||
android:defaultValue="always"
|
||||
android:entries="@array/sett_gif_autoplay_entries"
|
||||
android:entryValues="@array/sett_gif_autoplay_entry_values"
|
||||
android:key="video_autoplay"
|
||||
android:summary="%s"
|
||||
android:title="@string/sett_video_autoplay_title" />
|
||||
android:defaultValue="always"
|
||||
android:entries="@array/sett_gif_autoplay_entries"
|
||||
android:entryValues="@array/sett_gif_autoplay_entry_values"
|
||||
android:key="video_autoplay"
|
||||
android:summary="%s"
|
||||
android:title="@string/sett_video_autoplay_title"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:key="cache"
|
||||
android:title="@string/sett_cache">
|
||||
android:key="cache"
|
||||
android:title="@string/sett_cache">
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="enableAudioCache"
|
||||
android:title="@string/sett_enable_audio_cache" />
|
||||
android:defaultValue="true"
|
||||
android:key="enableAudioCache"
|
||||
android:title="@string/sett_enable_audio_cache"/>
|
||||
<com.vtosters.lite.ui.SummaryListPreference
|
||||
android:defaultValue=""
|
||||
android:dialogTitle="@string/sett_cache_location"
|
||||
android:key="audioCacheLocation"
|
||||
android:title="@string/sett_cache_location" />
|
||||
android:defaultValue=""
|
||||
android:dialogTitle="@string/sett_cache_location"
|
||||
android:key="audioCacheLocation"
|
||||
android:title="@string/sett_cache_location"/>
|
||||
<Preference
|
||||
android:key="downloadAudio"
|
||||
android:title="@string/cache_my_music" />
|
||||
android:key="downloadAudio"
|
||||
android:title="@string/cache_my_music"/>
|
||||
<Preference
|
||||
android:key="clearAudioCache"
|
||||
android:summary=""
|
||||
android:title="@string/sett_clear_audio_cache" />
|
||||
android:key="clearAudioCache"
|
||||
android:summary=""
|
||||
android:title="@string/sett_clear_audio_cache"/>
|
||||
<!-- <Preference-->
|
||||
<!-- android:key="clearImageCache"-->
|
||||
<!-- android:summary=""-->
|
||||
<!-- android:title="@string/sett_clear_img_cache"/>-->
|
||||
<!-- <Preference-->
|
||||
<!-- android:key="clearVideoCache"-->
|
||||
<!-- android:summary=""-->
|
||||
<!-- android:title="@string/sett_clear_video_cache"/>-->
|
||||
<!-- <Preference-->
|
||||
<!-- android:key="clearMessagesCache"-->
|
||||
<!-- android:summary=""-->
|
||||
<!-- android:title="@string/sett_clear_messages_cache"/>-->
|
||||
<Preference
|
||||
android:key="clearImageCache"
|
||||
android:summary=""
|
||||
android:title="@string/sett_clear_img_cache" />
|
||||
<Preference
|
||||
android:key="clearVideoCache"
|
||||
android:summary=""
|
||||
android:title="@string/sett_clear_video_cache" />
|
||||
<Preference
|
||||
android:key="clearMessagesCache"
|
||||
android:summary=""
|
||||
android:title="@string/sett_clear_messages_cache" />
|
||||
android:enabled="false"
|
||||
android:summary="@string/where_is_cache_settings_summ"
|
||||
android:title="@string/where_is_cache_settings"/>
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
@@ -1,790 +0,0 @@
|
||||
.class public Lcom/vk/contacts/ContactsSyncAcitvity;
|
||||
.super Lcom/vtosters/lite/VKActivity;
|
||||
.source "ContactsSyncAcitvity.java"
|
||||
|
||||
# interfaces
|
||||
.implements Landroid/view/View$OnClickListener;
|
||||
|
||||
|
||||
# instance fields
|
||||
.field private G:Ljava/lang/String;
|
||||
.annotation build Landroidx/annotation/Nullable;
|
||||
.end annotation
|
||||
.end field
|
||||
|
||||
.field private H:I
|
||||
|
||||
.field private I:Z
|
||||
|
||||
.field private J:Landroid/view/View;
|
||||
|
||||
.field private K:Landroid/widget/RadioButton;
|
||||
|
||||
.field private L:Landroid/widget/RadioButton;
|
||||
|
||||
.field private M:Landroid/widget/RadioButton;
|
||||
|
||||
.field private N:Lcom/vtosters/lite/activities/LogoutReceiver;
|
||||
|
||||
|
||||
# direct methods
|
||||
.method public constructor <init>()V
|
||||
.locals 2
|
||||
|
||||
.line 1
|
||||
invoke-direct {p0}, Lcom/vtosters/lite/VKActivity;-><init>()V
|
||||
|
||||
const/4 v0, 0x0
|
||||
|
||||
.line 2
|
||||
iput-object v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->G:Ljava/lang/String;
|
||||
|
||||
const/4 v1, 0x2
|
||||
|
||||
.line 3
|
||||
iput v1, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->H:I
|
||||
|
||||
.line 4
|
||||
iput-object v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->N:Lcom/vtosters/lite/activities/LogoutReceiver;
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method public static a(Landroid/content/Context;)V
|
||||
.locals 1
|
||||
|
||||
.line 1
|
||||
invoke-static {}, Lcom/vk/contacts/ContactsSyncUtils;->b()I
|
||||
|
||||
move-result v0
|
||||
|
||||
invoke-static {p0, v0}, Lcom/vk/contacts/ContactsSyncAcitvity;->b(Landroid/content/Context;I)V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method public static a(Landroid/content/Context;ILjava/lang/String;)V
|
||||
.locals 2
|
||||
.param p2 # Ljava/lang/String;
|
||||
.annotation build Landroidx/annotation/Nullable;
|
||||
.end annotation
|
||||
.end param
|
||||
|
||||
.line 2
|
||||
new-instance v0, Landroid/content/Intent;
|
||||
|
||||
const-class v1, Lcom/vk/contacts/ContactsSyncAcitvity;
|
||||
|
||||
invoke-direct {v0, p0, v1}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V
|
||||
|
||||
const-string v1, "syncsettings"
|
||||
|
||||
.line 3
|
||||
invoke-virtual {v0, v1}, Landroid/content/Intent;->setAction(Ljava/lang/String;)Landroid/content/Intent;
|
||||
|
||||
const-string v1, "force_select_sync_contacts"
|
||||
|
||||
.line 4
|
||||
invoke-virtual {v0, v1, p1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;
|
||||
|
||||
const-string p1, "track_code"
|
||||
|
||||
.line 5
|
||||
invoke-virtual {v0, p1, p2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;
|
||||
|
||||
.line 6
|
||||
invoke-static {p0}, Lcom/vk/core/util/ContextExtKt;->e(Landroid/content/Context;)Landroid/app/Activity;
|
||||
|
||||
move-result-object p1
|
||||
|
||||
if-nez p1, :cond_0
|
||||
|
||||
const/high16 p1, 0x10000000
|
||||
|
||||
.line 7
|
||||
invoke-virtual {v0, p1}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent;
|
||||
|
||||
.line 8
|
||||
:cond_0
|
||||
invoke-virtual {p0, v0}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method public static b(Landroid/content/Context;I)V
|
||||
.locals 1
|
||||
|
||||
const/4 v0, 0x0
|
||||
|
||||
.line 1
|
||||
invoke-static {p0, p1, v0}, Lcom/vk/contacts/ContactsSyncAcitvity;->a(Landroid/content/Context;ILjava/lang/String;)V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method private f(I)V
|
||||
.locals 5
|
||||
|
||||
.line 1
|
||||
iput p1, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->H:I
|
||||
|
||||
.line 2
|
||||
iget-object v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->K:Landroid/widget/RadioButton;
|
||||
|
||||
const/4 v1, 0x1
|
||||
|
||||
const/4 v2, 0x0
|
||||
|
||||
if-nez p1, :cond_0
|
||||
|
||||
const/4 v3, 0x1
|
||||
|
||||
goto :goto_0
|
||||
|
||||
:cond_0
|
||||
const/4 v3, 0x0
|
||||
|
||||
:goto_0
|
||||
invoke-virtual {v0, v3}, Landroid/widget/RadioButton;->setChecked(Z)V
|
||||
|
||||
.line 3
|
||||
iget-object v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->L:Landroid/widget/RadioButton;
|
||||
|
||||
if-ne p1, v1, :cond_1
|
||||
|
||||
const/4 v3, 0x1
|
||||
|
||||
goto :goto_1
|
||||
|
||||
:cond_1
|
||||
const/4 v3, 0x0
|
||||
|
||||
:goto_1
|
||||
invoke-virtual {v0, v3}, Landroid/widget/RadioButton;->setChecked(Z)V
|
||||
|
||||
.line 4
|
||||
iget-object v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->M:Landroid/widget/RadioButton;
|
||||
|
||||
const/4 v3, 0x2
|
||||
|
||||
if-ne p1, v3, :cond_2
|
||||
|
||||
const/4 v4, 0x1
|
||||
|
||||
goto :goto_2
|
||||
|
||||
:cond_2
|
||||
const/4 v4, 0x0
|
||||
|
||||
:goto_2
|
||||
invoke-virtual {v0, v4}, Landroid/widget/RadioButton;->setChecked(Z)V
|
||||
|
||||
.line 5
|
||||
iget-object v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->J:Landroid/view/View;
|
||||
|
||||
const v4, 0x7f0a0d0f
|
||||
|
||||
invoke-virtual {v0, v4}, Landroid/view/View;->findViewById(I)Landroid/view/View;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
check-cast v0, Landroid/widget/CheckBox;
|
||||
|
||||
if-eq p1, v3, :cond_3
|
||||
|
||||
goto :goto_3
|
||||
|
||||
:cond_3
|
||||
const/4 v1, 0x0
|
||||
|
||||
.line 6
|
||||
:goto_3
|
||||
invoke-virtual {v0, v1}, Landroid/widget/CheckBox;->setEnabled(Z)V
|
||||
|
||||
if-ne p1, v3, :cond_4
|
||||
|
||||
.line 7
|
||||
invoke-virtual {v0, v2}, Landroid/widget/CheckBox;->setChecked(Z)V
|
||||
|
||||
:cond_4
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method private onDismiss()V
|
||||
.locals 3
|
||||
|
||||
.line 1
|
||||
sget-object v0, Lcom/vk/contacts/ContactsSyncReporter;->a:Lcom/vk/contacts/ContactsSyncReporter;
|
||||
|
||||
invoke-static {}, Lcom/vk/contacts/ContactsSyncUtils;->b()I
|
||||
|
||||
move-result v1
|
||||
|
||||
iget-object v2, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->G:Ljava/lang/String;
|
||||
|
||||
invoke-virtual {v0, v1, v2}, Lcom/vk/contacts/ContactsSyncReporter;->a(ILjava/lang/String;)V
|
||||
|
||||
.line 2
|
||||
invoke-virtual {p0}, Lcom/vtosters/lite/VKActivity;->finish()V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method private x1()V
|
||||
.locals 5
|
||||
|
||||
.line 1
|
||||
invoke-virtual {p0}, Landroid/app/Activity;->getIntent()Landroid/content/Intent;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
.line 2
|
||||
invoke-static {}, Lcom/vk/contacts/ContactsSyncUtils;->b()I
|
||||
|
||||
move-result v1
|
||||
|
||||
const-string v2, "force_select_sync_contacts"
|
||||
|
||||
.line 3
|
||||
invoke-virtual {v0, v2, v1}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I
|
||||
|
||||
move-result v0
|
||||
|
||||
iput v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->H:I
|
||||
|
||||
.line 4
|
||||
invoke-static {}, Lcom/vk/contacts/ContactsSyncUtils;->d()Z
|
||||
|
||||
move-result v0
|
||||
|
||||
iput-boolean v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->I:Z
|
||||
|
||||
.line 5
|
||||
iget-object v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->J:Landroid/view/View;
|
||||
|
||||
const v1, 0x7f0a0fce
|
||||
|
||||
invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
check-cast v0, Landroid/widget/RadioButton;
|
||||
|
||||
iput-object v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->K:Landroid/widget/RadioButton;
|
||||
|
||||
.line 6
|
||||
iget-object v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->J:Landroid/view/View;
|
||||
|
||||
const v1, 0x7f0a0fcf
|
||||
|
||||
invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
check-cast v0, Landroid/widget/RadioButton;
|
||||
|
||||
iput-object v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->L:Landroid/widget/RadioButton;
|
||||
|
||||
.line 7
|
||||
iget-object v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->J:Landroid/view/View;
|
||||
|
||||
const v1, 0x7f0a0fd0
|
||||
|
||||
invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
check-cast v0, Landroid/widget/RadioButton;
|
||||
|
||||
iput-object v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->M:Landroid/widget/RadioButton;
|
||||
|
||||
.line 8
|
||||
iget-object v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->K:Landroid/widget/RadioButton;
|
||||
|
||||
iget v1, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->H:I
|
||||
|
||||
const/4 v2, 0x0
|
||||
|
||||
const/4 v3, 0x1
|
||||
|
||||
if-nez v1, :cond_0
|
||||
|
||||
const/4 v1, 0x1
|
||||
|
||||
goto :goto_0
|
||||
|
||||
:cond_0
|
||||
const/4 v1, 0x0
|
||||
|
||||
:goto_0
|
||||
invoke-virtual {v0, v1}, Landroid/widget/RadioButton;->setChecked(Z)V
|
||||
|
||||
.line 9
|
||||
iget-object v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->L:Landroid/widget/RadioButton;
|
||||
|
||||
iget v1, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->H:I
|
||||
|
||||
if-ne v1, v3, :cond_1
|
||||
|
||||
const/4 v1, 0x1
|
||||
|
||||
goto :goto_1
|
||||
|
||||
:cond_1
|
||||
const/4 v1, 0x0
|
||||
|
||||
:goto_1
|
||||
invoke-virtual {v0, v1}, Landroid/widget/RadioButton;->setChecked(Z)V
|
||||
|
||||
.line 10
|
||||
iget-object v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->M:Landroid/widget/RadioButton;
|
||||
|
||||
iget v1, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->H:I
|
||||
|
||||
const/4 v4, 0x2
|
||||
|
||||
if-ne v1, v4, :cond_2
|
||||
|
||||
const/4 v1, 0x1
|
||||
|
||||
goto :goto_2
|
||||
|
||||
:cond_2
|
||||
const/4 v1, 0x0
|
||||
|
||||
:goto_2
|
||||
invoke-virtual {v0, v1}, Landroid/widget/RadioButton;->setChecked(Z)V
|
||||
|
||||
.line 11
|
||||
iget-object v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->J:Landroid/view/View;
|
||||
|
||||
const v1, 0x7f0a0d0f
|
||||
|
||||
invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
check-cast v0, Landroid/widget/CheckBox;
|
||||
|
||||
.line 12
|
||||
iget-boolean v1, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->I:Z
|
||||
|
||||
invoke-virtual {v0, v1}, Landroid/widget/CheckBox;->setChecked(Z)V
|
||||
|
||||
.line 13
|
||||
iget v1, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->H:I
|
||||
|
||||
if-eq v1, v4, :cond_3
|
||||
|
||||
const/4 v2, 0x1
|
||||
|
||||
:cond_3
|
||||
invoke-virtual {v0, v2}, Landroid/widget/CheckBox;->setEnabled(Z)V
|
||||
|
||||
.line 14
|
||||
new-instance v1, Lcom/vk/contacts/d;
|
||||
|
||||
invoke-direct {v1, p0}, Lcom/vk/contacts/d;-><init>(Lcom/vk/contacts/ContactsSyncAcitvity;)V
|
||||
|
||||
invoke-virtual {v0, v1}, Landroid/widget/CheckBox;->setOnCheckedChangeListener(Landroid/widget/CompoundButton$OnCheckedChangeListener;)V
|
||||
|
||||
.line 15
|
||||
iget-object v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->J:Landroid/view/View;
|
||||
|
||||
const v1, 0x7f0a0fcb
|
||||
|
||||
invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
invoke-virtual {v0, p0}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V
|
||||
|
||||
.line 16
|
||||
iget-object v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->J:Landroid/view/View;
|
||||
|
||||
const v1, 0x7f0a0fcc
|
||||
|
||||
invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
invoke-virtual {v0, p0}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V
|
||||
|
||||
.line 17
|
||||
iget-object v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->J:Landroid/view/View;
|
||||
|
||||
const v1, 0x7f0a0fcd
|
||||
|
||||
invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
invoke-virtual {v0, p0}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V
|
||||
|
||||
.line 18
|
||||
new-instance v0, Lcom/vk/core/dialogs/alert/VkAlertDialog$Builder;
|
||||
|
||||
invoke-direct {v0, p0}, Lcom/vk/core/dialogs/alert/VkAlertDialog$Builder;-><init>(Landroid/content/Context;)V
|
||||
|
||||
const v1, 0x7f120d60
|
||||
|
||||
.line 19
|
||||
invoke-virtual {v0, v1}, Lcom/vk/core/dialogs/alert/VkAlertDialog$Builder;->setTitle(I)Lcom/vk/core/dialogs/alert/VkAlertDialog$Builder;
|
||||
|
||||
iget-object v1, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->J:Landroid/view/View;
|
||||
|
||||
.line 20
|
||||
invoke-virtual {v0, v1}, Lcom/vk/core/dialogs/alert/VkAlertDialog$Builder;->setView(Landroid/view/View;)Lcom/vk/core/dialogs/alert/VkAlertDialog$Builder;
|
||||
|
||||
const v1, 0x7f120cb1
|
||||
|
||||
new-instance v2, Lcom/vk/contacts/e;
|
||||
|
||||
invoke-direct {v2, p0}, Lcom/vk/contacts/e;-><init>(Lcom/vk/contacts/ContactsSyncAcitvity;)V
|
||||
|
||||
.line 21
|
||||
invoke-virtual {v0, v1, v2}, Lcom/vk/core/dialogs/alert/VkAlertDialog$Builder;->setPositiveButton(ILandroid/content/DialogInterface$OnClickListener;)Lcom/vk/core/dialogs/alert/VkAlertDialog$Builder;
|
||||
|
||||
const v1, 0x7f12018a
|
||||
|
||||
new-instance v2, Lcom/vk/contacts/f;
|
||||
|
||||
invoke-direct {v2, p0}, Lcom/vk/contacts/f;-><init>(Lcom/vk/contacts/ContactsSyncAcitvity;)V
|
||||
|
||||
.line 22
|
||||
invoke-virtual {v0, v1, v2}, Lcom/vk/core/dialogs/alert/VkAlertDialog$Builder;->setNegativeButton(ILandroid/content/DialogInterface$OnClickListener;)Lcom/vk/core/dialogs/alert/VkAlertDialog$Builder;
|
||||
|
||||
new-instance v1, Lcom/vk/contacts/b;
|
||||
|
||||
invoke-direct {v1, p0}, Lcom/vk/contacts/b;-><init>(Lcom/vk/contacts/ContactsSyncAcitvity;)V
|
||||
|
||||
.line 23
|
||||
invoke-virtual {v0, v1}, Landroidx/appcompat/app/AlertDialog$Builder;->setOnCancelListener(Landroid/content/DialogInterface$OnCancelListener;)Landroidx/appcompat/app/AlertDialog$Builder;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
.line 24
|
||||
invoke-virtual {v0}, Landroidx/appcompat/app/AlertDialog$Builder;->show()Landroidx/appcompat/app/AlertDialog;
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
|
||||
# virtual methods
|
||||
.method public synthetic a(Landroid/content/DialogInterface;)V
|
||||
.locals 0
|
||||
|
||||
.line 16
|
||||
invoke-direct {p0}, Lcom/vk/contacts/ContactsSyncAcitvity;->onDismiss()V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method public synthetic a(Landroid/content/DialogInterface;I)V
|
||||
.locals 1
|
||||
|
||||
.line 10
|
||||
iget p1, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->H:I
|
||||
|
||||
invoke-static {p1}, Lcom/vk/contacts/ContactsSyncUtils;->b(I)V
|
||||
|
||||
.line 11
|
||||
iget-boolean p1, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->I:Z
|
||||
|
||||
invoke-static {p1}, Lcom/vk/contacts/ContactsSyncUtils;->a(Z)V
|
||||
|
||||
.line 12
|
||||
new-instance p1, Landroid/content/Intent;
|
||||
|
||||
invoke-direct {p1}, Landroid/content/Intent;-><init>()V
|
||||
|
||||
.line 13
|
||||
iget p2, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->H:I
|
||||
|
||||
const-string v0, "option"
|
||||
|
||||
invoke-virtual {p1, v0, p2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;
|
||||
|
||||
const/4 p2, -0x1
|
||||
|
||||
.line 14
|
||||
invoke-virtual {p0, p2, p1}, Landroid/app/Activity;->setResult(ILandroid/content/Intent;)V
|
||||
|
||||
.line 15
|
||||
invoke-direct {p0}, Lcom/vk/contacts/ContactsSyncAcitvity;->onDismiss()V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method public synthetic a(Landroid/widget/CompoundButton;Z)V
|
||||
.locals 0
|
||||
|
||||
.line 9
|
||||
iput-boolean p2, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->I:Z
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method public synthetic b(Landroid/content/DialogInterface;I)V
|
||||
.locals 0
|
||||
|
||||
.line 2
|
||||
invoke-direct {p0}, Lcom/vk/contacts/ContactsSyncAcitvity;->onDismiss()V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method public synthetic c(Ljava/util/List;)Lkotlin/Unit;
|
||||
.locals 1
|
||||
|
||||
.line 1
|
||||
sget-object p1, Lcom/vk/contacts/ContactsSyncReporter;->a:Lcom/vk/contacts/ContactsSyncReporter;
|
||||
|
||||
iget-object v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->G:Ljava/lang/String;
|
||||
|
||||
invoke-virtual {p1, v0}, Lcom/vk/contacts/ContactsSyncReporter;->a(Ljava/lang/String;)V
|
||||
|
||||
.line 2
|
||||
invoke-virtual {p0}, Lcom/vtosters/lite/VKActivity;->finish()V
|
||||
|
||||
.line 3
|
||||
sget-object p1, Lkotlin/Unit;->a:Lkotlin/Unit;
|
||||
|
||||
return-object p1
|
||||
.end method
|
||||
|
||||
.method public onClick(Landroid/view/View;)V
|
||||
.locals 0
|
||||
|
||||
.line 1
|
||||
invoke-virtual {p1}, Landroid/view/View;->getId()I
|
||||
|
||||
move-result p1
|
||||
|
||||
packed-switch p1, :pswitch_data_0
|
||||
|
||||
goto :goto_0
|
||||
|
||||
:pswitch_0
|
||||
const/4 p1, 0x2
|
||||
|
||||
.line 2
|
||||
invoke-direct {p0, p1}, Lcom/vk/contacts/ContactsSyncAcitvity;->f(I)V
|
||||
|
||||
goto :goto_0
|
||||
|
||||
:pswitch_1
|
||||
const/4 p1, 0x1
|
||||
|
||||
.line 3
|
||||
invoke-direct {p0, p1}, Lcom/vk/contacts/ContactsSyncAcitvity;->f(I)V
|
||||
|
||||
goto :goto_0
|
||||
|
||||
:pswitch_2
|
||||
const/4 p1, 0x0
|
||||
|
||||
.line 4
|
||||
invoke-direct {p0, p1}, Lcom/vk/contacts/ContactsSyncAcitvity;->f(I)V
|
||||
|
||||
:goto_0
|
||||
return-void
|
||||
|
||||
nop
|
||||
|
||||
:pswitch_data_0
|
||||
.packed-switch 0x7f0a0fcb
|
||||
:pswitch_2
|
||||
:pswitch_1
|
||||
:pswitch_0
|
||||
.end packed-switch
|
||||
.end method
|
||||
|
||||
.method public onCreate(Landroid/os/Bundle;)V
|
||||
.locals 7
|
||||
|
||||
.line 1
|
||||
invoke-static {}, Lcom/vk/core/ui/themes/VKThemeHelper;->n()I
|
||||
|
||||
move-result v0
|
||||
|
||||
invoke-virtual {p0, v0}, Landroidx/appcompat/app/AppCompatActivity;->setTheme(I)V
|
||||
|
||||
.line 2
|
||||
invoke-super {p0, p1}, Lcom/vtosters/lite/VKActivity;->onCreate(Landroid/os/Bundle;)V
|
||||
|
||||
.line 3
|
||||
invoke-virtual {p0}, Landroid/app/Activity;->getIntent()Landroid/content/Intent;
|
||||
|
||||
move-result-object p1
|
||||
|
||||
const-string v0, "track_code"
|
||||
|
||||
invoke-virtual {p1, v0}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;
|
||||
|
||||
move-result-object p1
|
||||
|
||||
iput-object p1, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->G:Ljava/lang/String;
|
||||
|
||||
.line 4
|
||||
invoke-static {p0}, Lcom/vtosters/lite/activities/LogoutReceiver;->a(Landroid/app/Activity;)Lcom/vtosters/lite/activities/LogoutReceiver;
|
||||
|
||||
move-result-object p1
|
||||
|
||||
iput-object p1, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->N:Lcom/vtosters/lite/activities/LogoutReceiver;
|
||||
|
||||
const/4 p1, 0x0
|
||||
|
||||
.line 5
|
||||
invoke-virtual {p0, p1, p1}, Landroid/app/Activity;->overridePendingTransition(II)V
|
||||
|
||||
.line 6
|
||||
invoke-virtual {p0}, Landroid/app/Activity;->getWindow()Landroid/view/Window;
|
||||
|
||||
move-result-object p1
|
||||
|
||||
const v0, 0x7f080a50
|
||||
|
||||
invoke-virtual {p1, v0}, Landroid/view/Window;->setBackgroundDrawableResource(I)V
|
||||
|
||||
.line 7
|
||||
new-instance p1, Landroid/view/View;
|
||||
|
||||
invoke-direct {p1, p0}, Landroid/view/View;-><init>(Landroid/content/Context;)V
|
||||
|
||||
invoke-virtual {p0, p1}, Landroidx/appcompat/app/AppCompatActivity;->setContentView(Landroid/view/View;)V
|
||||
|
||||
.line 8
|
||||
new-instance p1, Landroid/view/ContextThemeWrapper;
|
||||
|
||||
invoke-static {}, Lcom/vk/core/ui/themes/VKThemeHelper;->n()I
|
||||
|
||||
move-result v0
|
||||
|
||||
invoke-direct {p1, p0, v0}, Landroid/view/ContextThemeWrapper;-><init>(Landroid/content/Context;I)V
|
||||
|
||||
const v0, 0x7f0d06d5
|
||||
|
||||
const/4 v1, 0x0
|
||||
|
||||
invoke-static {p1, v0, v1}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;
|
||||
|
||||
move-result-object p1
|
||||
|
||||
iput-object p1, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->J:Landroid/view/View;
|
||||
|
||||
.line 9
|
||||
invoke-static {p0}, Lcom/vk/core/ui/themes/VKThemeHelper;->d(Landroid/app/Activity;)V
|
||||
|
||||
.line 10
|
||||
sget-object v0, Lcom/vk/permission/PermissionHelper;->r:Lcom/vk/permission/PermissionHelper;
|
||||
|
||||
.line 11
|
||||
invoke-virtual {v0}, Lcom/vk/permission/PermissionHelper;->e()[Ljava/lang/String;
|
||||
|
||||
move-result-object v2
|
||||
|
||||
new-instance v5, Lcom/vk/contacts/c;
|
||||
|
||||
invoke-direct {v5, p0}, Lcom/vk/contacts/c;-><init>(Lcom/vk/contacts/ContactsSyncAcitvity;)V
|
||||
|
||||
new-instance v6, Lcom/vk/contacts/a;
|
||||
|
||||
invoke-direct {v6, p0}, Lcom/vk/contacts/a;-><init>(Lcom/vk/contacts/ContactsSyncAcitvity;)V
|
||||
|
||||
const v3, 0x7f120a13
|
||||
|
||||
const v4, 0x7f120a14
|
||||
|
||||
move-object v1, p0
|
||||
|
||||
.line 12
|
||||
invoke-virtual/range {v0 .. v6}, Lcom/vk/permission/PermissionHelper;->a(Landroid/app/Activity;[Ljava/lang/String;IILkotlin/jvm/b/Functions;Lkotlin/jvm/b/Functions2;)Z
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method protected onDestroy()V
|
||||
.locals 1
|
||||
|
||||
.line 1
|
||||
iget-object v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->N:Lcom/vtosters/lite/activities/LogoutReceiver;
|
||||
|
||||
invoke-virtual {v0}, Lcom/vtosters/lite/activities/LogoutReceiver;->a()V
|
||||
|
||||
.line 2
|
||||
invoke-super {p0}, Lcom/vtosters/lite/VKActivity;->onDestroy()V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method protected onRestoreInstanceState(Landroid/os/Bundle;)V
|
||||
.locals 2
|
||||
|
||||
.line 1
|
||||
invoke-super {p0, p1}, Landroid/app/Activity;->onRestoreInstanceState(Landroid/os/Bundle;)V
|
||||
|
||||
const-string v0, "state_option"
|
||||
|
||||
const/4 v1, 0x2
|
||||
|
||||
.line 2
|
||||
invoke-virtual {p1, v0, v1}, Landroid/os/Bundle;->getInt(Ljava/lang/String;I)I
|
||||
|
||||
move-result v0
|
||||
|
||||
iput v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->H:I
|
||||
|
||||
const-string v0, "state_sync_hq_photo"
|
||||
|
||||
const/4 v1, 0x0
|
||||
|
||||
.line 3
|
||||
invoke-virtual {p1, v0, v1}, Landroid/os/Bundle;->getBoolean(Ljava/lang/String;Z)Z
|
||||
|
||||
move-result p1
|
||||
|
||||
iput-boolean p1, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->I:Z
|
||||
|
||||
.line 4
|
||||
iget p1, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->H:I
|
||||
|
||||
invoke-direct {p0, p1}, Lcom/vk/contacts/ContactsSyncAcitvity;->f(I)V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method protected onSaveInstanceState(Landroid/os/Bundle;)V
|
||||
.locals 2
|
||||
|
||||
.line 1
|
||||
invoke-super {p0, p1}, Landroidx/appcompat/app/AppCompatActivity;->onSaveInstanceState(Landroid/os/Bundle;)V
|
||||
|
||||
.line 2
|
||||
iget v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->H:I
|
||||
|
||||
const-string v1, "state_option"
|
||||
|
||||
invoke-virtual {p1, v1, v0}, Landroid/os/Bundle;->putInt(Ljava/lang/String;I)V
|
||||
|
||||
.line 3
|
||||
iget-boolean v0, p0, Lcom/vk/contacts/ContactsSyncAcitvity;->I:Z
|
||||
|
||||
const-string v1, "state_sync_hq_photo"
|
||||
|
||||
invoke-virtual {p1, v1, v0}, Landroid/os/Bundle;->putBoolean(Ljava/lang/String;Z)V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method public synthetic w1()Lkotlin/Unit;
|
||||
.locals 1
|
||||
|
||||
.line 1
|
||||
invoke-direct {p0}, Lcom/vk/contacts/ContactsSyncAcitvity;->x1()V
|
||||
|
||||
.line 2
|
||||
sget-object v0, Lkotlin/Unit;->a:Lkotlin/Unit;
|
||||
|
||||
return-object v0
|
||||
.end method
|
||||
@@ -598,7 +598,7 @@
|
||||
:sswitch_2
|
||||
move/from16 v27, v14
|
||||
|
||||
const-string v14, "vnd.android.cursor.item/vnd.com.vkontakte.android.sendmsg"
|
||||
const-string v14, "vnd.android.cursor.item/vnd.com.vtosters.lite.sendmsg"
|
||||
|
||||
invoke-virtual {v0, v14}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
||||
|
||||
@@ -613,7 +613,7 @@
|
||||
:sswitch_3
|
||||
move/from16 v27, v14
|
||||
|
||||
const-string v14, "vnd.android.cursor.item/vnd.com.vkontakte.android.voipcall"
|
||||
const-string v14, "vnd.android.cursor.item/vnd.com.vtosters.lite.voipcall"
|
||||
|
||||
invoke-virtual {v0, v14}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
||||
|
||||
@@ -1619,7 +1619,7 @@
|
||||
.line 92
|
||||
invoke-virtual {v1, v6, v15}, Landroid/content/ContentProviderOperation$Builder;->withValueBackReference(Ljava/lang/String;I)Landroid/content/ContentProviderOperation$Builder;
|
||||
|
||||
const-string v3, "vnd.android.cursor.item/vnd.com.vkontakte.android.profile"
|
||||
const-string v3, "vnd.android.cursor.item/vnd.com.vtosters.lite.profile"
|
||||
|
||||
.line 93
|
||||
invoke-virtual {v1, v13, v3}, Landroid/content/ContentProviderOperation$Builder;->withValue(Ljava/lang/String;Ljava/lang/Object;)Landroid/content/ContentProviderOperation$Builder;
|
||||
@@ -1702,7 +1702,7 @@
|
||||
invoke-virtual {v1, v6, v3}, Landroid/content/ContentProviderOperation$Builder;->withValue(Ljava/lang/String;Ljava/lang/Object;)Landroid/content/ContentProviderOperation$Builder;
|
||||
|
||||
:goto_14
|
||||
const-string v3, "vnd.android.cursor.item/vnd.com.vkontakte.android.sendmsg"
|
||||
const-string v3, "vnd.android.cursor.item/vnd.com.vtosters.lite.sendmsg"
|
||||
|
||||
.line 102
|
||||
invoke-virtual {v1, v13, v3}, Landroid/content/ContentProviderOperation$Builder;->withValue(Ljava/lang/String;Ljava/lang/Object;)Landroid/content/ContentProviderOperation$Builder;
|
||||
@@ -1789,7 +1789,7 @@
|
||||
invoke-virtual {v1, v6, v3}, Landroid/content/ContentProviderOperation$Builder;->withValue(Ljava/lang/String;Ljava/lang/Object;)Landroid/content/ContentProviderOperation$Builder;
|
||||
|
||||
:goto_15
|
||||
const-string v3, "vnd.android.cursor.item/vnd.com.vkontakte.android.voipcall"
|
||||
const-string v3, "vnd.android.cursor.item/vnd.com.vtosters.lite.voipcall"
|
||||
|
||||
.line 112
|
||||
invoke-virtual {v1, v13, v3}, Landroid/content/ContentProviderOperation$Builder;->withValue(Ljava/lang/String;Ljava/lang/Object;)Landroid/content/ContentProviderOperation$Builder;
|
||||
@@ -1865,7 +1865,7 @@
|
||||
invoke-virtual {v1, v6, v3}, Landroid/content/ContentProviderOperation$Builder;->withValue(Ljava/lang/String;Ljava/lang/Object;)Landroid/content/ContentProviderOperation$Builder;
|
||||
|
||||
:goto_16
|
||||
const-string v3, "vnd.android.cursor.item/vnd.com.vkontakte.android.assistant.sendmsg"
|
||||
const-string v3, "vnd.android.cursor.item/vnd.com.vtosters.lite.assistant.sendmsg"
|
||||
|
||||
.line 121
|
||||
invoke-virtual {v1, v13, v3}, Landroid/content/ContentProviderOperation$Builder;->withValue(Ljava/lang/String;Ljava/lang/Object;)Landroid/content/ContentProviderOperation$Builder;
|
||||
@@ -2811,7 +2811,7 @@
|
||||
.line 41
|
||||
iput-boolean v4, v1, Landroid/content/SyncResult;->fullSyncRequested:Z
|
||||
|
||||
const-string v0, "com.vkontakte.android.EXTRA_FORCE_KEY"
|
||||
const-string v0, "com.vtosters.lite.EXTRA_FORCE_KEY"
|
||||
|
||||
move-object/from16 v6, p2
|
||||
|
||||
|
||||
@@ -1,146 +0,0 @@
|
||||
.class public final Lcom/vk/contacts/ContactsSyncReporter;
|
||||
.super Ljava/lang/Object;
|
||||
.source "ContactsSyncReporter.kt"
|
||||
|
||||
|
||||
# static fields
|
||||
.field public static final a:Lcom/vk/contacts/ContactsSyncReporter;
|
||||
|
||||
|
||||
# direct methods
|
||||
.method static constructor <clinit>()V
|
||||
.locals 1
|
||||
|
||||
.line 1
|
||||
new-instance v0, Lcom/vk/contacts/ContactsSyncReporter;
|
||||
|
||||
invoke-direct {v0}, Lcom/vk/contacts/ContactsSyncReporter;-><init>()V
|
||||
|
||||
sput-object v0, Lcom/vk/contacts/ContactsSyncReporter;->a:Lcom/vk/contacts/ContactsSyncReporter;
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method private constructor <init>()V
|
||||
.locals 0
|
||||
|
||||
.line 1
|
||||
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method private final a(ZILjava/lang/String;)V
|
||||
.locals 4
|
||||
|
||||
.line 3
|
||||
sget-object v0, Lcom/vk/metrics/eventtracking/VkTracker;->k:Lcom/vk/metrics/eventtracking/VkTracker;
|
||||
|
||||
sget-object v1, Lcom/vk/metrics/eventtracking/Event;->b:Lcom/vk/metrics/eventtracking/Event$b;
|
||||
|
||||
invoke-virtual {v1}, Lcom/vk/metrics/eventtracking/Event$b;->a()Lcom/vk/metrics/eventtracking/Event$a;
|
||||
|
||||
move-result-object v1
|
||||
|
||||
const-string v2, "StatlogTracker"
|
||||
|
||||
const-string v3, "LoggingTracker"
|
||||
|
||||
.line 4
|
||||
filled-new-array {v2, v3}, [Ljava/lang/String;
|
||||
|
||||
move-result-object v2
|
||||
|
||||
invoke-static {v2}, Lkotlin/collections/l;->c([Ljava/lang/Object;)Ljava/util/List;
|
||||
|
||||
move-result-object v2
|
||||
|
||||
invoke-virtual {v1, v2}, Lcom/vk/metrics/eventtracking/Event$a;->a(Ljava/util/List;)Lcom/vk/metrics/eventtracking/Event$a;
|
||||
|
||||
const-string v2, "enable_contacts_sync"
|
||||
|
||||
.line 5
|
||||
invoke-virtual {v1, v2}, Lcom/vk/metrics/eventtracking/Event$a;->a(Ljava/lang/String;)Lcom/vk/metrics/eventtracking/Event$a;
|
||||
|
||||
.line 6
|
||||
invoke-static {p1}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
|
||||
|
||||
move-result-object p1
|
||||
|
||||
const-string v2, "has_contacts_permission"
|
||||
|
||||
invoke-virtual {v1, v2, p1}, Lcom/vk/metrics/eventtracking/Event$a;->a(Ljava/lang/String;Ljava/lang/Object;)Lcom/vk/metrics/eventtracking/Event$a;
|
||||
|
||||
if-eqz p2, :cond_1
|
||||
|
||||
const/4 p1, 0x1
|
||||
|
||||
if-eq p2, p1, :cond_0
|
||||
|
||||
const-string p1, "disabled"
|
||||
|
||||
goto :goto_0
|
||||
|
||||
:cond_0
|
||||
const-string p1, "contacts"
|
||||
|
||||
goto :goto_0
|
||||
|
||||
:cond_1
|
||||
const-string p1, "all"
|
||||
|
||||
:goto_0
|
||||
const-string p2, "selected_sync_option"
|
||||
|
||||
.line 7
|
||||
invoke-virtual {v1, p2, p1}, Lcom/vk/metrics/eventtracking/Event$a;->a(Ljava/lang/String;Ljava/lang/String;)Lcom/vk/metrics/eventtracking/Event$a;
|
||||
|
||||
if-eqz p3, :cond_2
|
||||
|
||||
goto :goto_1
|
||||
|
||||
:cond_2
|
||||
const-string p3, ""
|
||||
|
||||
:goto_1
|
||||
const-string p1, "track_code"
|
||||
|
||||
.line 8
|
||||
invoke-virtual {v1, p1, p3}, Lcom/vk/metrics/eventtracking/Event$a;->a(Ljava/lang/String;Ljava/lang/String;)Lcom/vk/metrics/eventtracking/Event$a;
|
||||
|
||||
.line 9
|
||||
invoke-virtual {v1}, Lcom/vk/metrics/eventtracking/Event$a;->a()Lcom/vk/metrics/eventtracking/Event;
|
||||
|
||||
move-result-object p1
|
||||
|
||||
.line 10
|
||||
invoke-virtual {v0, p1}, Lcom/vk/metrics/eventtracking/VkTracker;->a(Lcom/vk/metrics/eventtracking/Event;)V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
|
||||
# virtual methods
|
||||
.method public final a(ILjava/lang/String;)V
|
||||
.locals 1
|
||||
|
||||
const/4 v0, 0x1
|
||||
|
||||
.line 2
|
||||
invoke-direct {p0, v0, p1, p2}, Lcom/vk/contacts/ContactsSyncReporter;->a(ZILjava/lang/String;)V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method public final a(Ljava/lang/String;)V
|
||||
.locals 2
|
||||
|
||||
const/4 v0, 0x0
|
||||
|
||||
const/4 v1, 0x2
|
||||
|
||||
.line 1
|
||||
invoke-direct {p0, v0, v1, p1}, Lcom/vk/contacts/ContactsSyncReporter;->a(ZILjava/lang/String;)V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
@@ -1,64 +0,0 @@
|
||||
.class final Lcom/vk/contacts/ContactsSyncUtils$a;
|
||||
.super Ljava/lang/Object;
|
||||
.source "ContactsSyncUtils.kt"
|
||||
|
||||
# interfaces
|
||||
.implements Ljava/lang/Runnable;
|
||||
|
||||
|
||||
# annotations
|
||||
.annotation system Ldalvik/annotation/EnclosingMethod;
|
||||
value = Lcom/vk/contacts/ContactsSyncUtils;->a()V
|
||||
.end annotation
|
||||
|
||||
.annotation system Ldalvik/annotation/InnerClass;
|
||||
accessFlags = 0x18
|
||||
name = null
|
||||
.end annotation
|
||||
|
||||
|
||||
# static fields
|
||||
.field public static final a:Lcom/vk/contacts/ContactsSyncUtils$a;
|
||||
|
||||
|
||||
# direct methods
|
||||
.method static constructor <clinit>()V
|
||||
.locals 1
|
||||
|
||||
new-instance v0, Lcom/vk/contacts/ContactsSyncUtils$a;
|
||||
|
||||
invoke-direct {v0}, Lcom/vk/contacts/ContactsSyncUtils$a;-><init>()V
|
||||
|
||||
sput-object v0, Lcom/vk/contacts/ContactsSyncUtils$a;->a:Lcom/vk/contacts/ContactsSyncUtils$a;
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method constructor <init>()V
|
||||
.locals 0
|
||||
|
||||
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
|
||||
# virtual methods
|
||||
.method public final run()V
|
||||
.locals 2
|
||||
|
||||
.line 1
|
||||
sget-object v0, Lcom/vk/core/util/AppContextHolder;->a:Landroid/content/Context;
|
||||
|
||||
const-string v1, "AppContextHolder.context"
|
||||
|
||||
invoke-static {v0, v1}, Lkotlin/jvm/internal/Intrinsics;->a(Ljava/lang/Object;Ljava/lang/String;)V
|
||||
|
||||
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
invoke-static {v0}, Lcom/vk/contacts/ContactsSyncAdapterService;->a(Landroid/content/ContentResolver;)V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
@@ -1,52 +0,0 @@
|
||||
.class final Lcom/vk/contacts/ContactsSyncUtils$b;
|
||||
.super Ljava/lang/Object;
|
||||
.source "ContactsSyncUtils.kt"
|
||||
|
||||
# interfaces
|
||||
.implements Ljava/lang/Runnable;
|
||||
|
||||
|
||||
# annotations
|
||||
.annotation system Ldalvik/annotation/EnclosingMethod;
|
||||
value = Lcom/vk/contacts/ContactsSyncUtils;->a(Landroid/accounts/Account;)V
|
||||
.end annotation
|
||||
|
||||
.annotation system Ldalvik/annotation/InnerClass;
|
||||
accessFlags = 0x18
|
||||
name = null
|
||||
.end annotation
|
||||
|
||||
|
||||
# instance fields
|
||||
.field final synthetic a:Landroid/accounts/Account;
|
||||
|
||||
|
||||
# direct methods
|
||||
.method constructor <init>(Landroid/accounts/Account;)V
|
||||
.locals 0
|
||||
|
||||
iput-object p1, p0, Lcom/vk/contacts/ContactsSyncUtils$b;->a:Landroid/accounts/Account;
|
||||
|
||||
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
|
||||
# virtual methods
|
||||
.method public final run()V
|
||||
.locals 3
|
||||
|
||||
.line 1
|
||||
sget-object v0, Lcom/vk/core/util/AppContextHolder;->a:Landroid/content/Context;
|
||||
|
||||
iget-object v1, p0, Lcom/vk/contacts/ContactsSyncUtils$b;->a:Landroid/accounts/Account;
|
||||
|
||||
new-instance v2, Landroid/os/Bundle;
|
||||
|
||||
invoke-direct {v2}, Landroid/os/Bundle;-><init>()V
|
||||
|
||||
invoke-static {v0, v1, v2}, Lcom/vk/contacts/ContactsSyncAdapterService;->a(Landroid/content/Context;Landroid/accounts/Account;Landroid/os/Bundle;)V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
@@ -1,78 +0,0 @@
|
||||
.class final Lcom/vk/contacts/ContactsSyncUtils$prefs$2;
|
||||
.super Lkotlin/jvm/internal/Lambda;
|
||||
.source "ContactsSyncUtils.kt"
|
||||
|
||||
# interfaces
|
||||
.implements Lkotlin/jvm/b/Functions;
|
||||
|
||||
|
||||
# annotations
|
||||
.annotation system Ldalvik/annotation/EnclosingClass;
|
||||
value = Lcom/vk/contacts/ContactsSyncUtils;
|
||||
.end annotation
|
||||
|
||||
.annotation system Ldalvik/annotation/InnerClass;
|
||||
accessFlags = 0x18
|
||||
name = null
|
||||
.end annotation
|
||||
|
||||
.annotation system Ldalvik/annotation/Signature;
|
||||
value = {
|
||||
"Lkotlin/jvm/internal/Lambda;",
|
||||
"Lkotlin/jvm/b/Functions<",
|
||||
"Landroid/content/SharedPreferences;",
|
||||
">;"
|
||||
}
|
||||
.end annotation
|
||||
|
||||
|
||||
# static fields
|
||||
.field public static final a:Lcom/vk/contacts/ContactsSyncUtils$prefs$2;
|
||||
|
||||
|
||||
# direct methods
|
||||
.method static constructor <clinit>()V
|
||||
.locals 1
|
||||
|
||||
new-instance v0, Lcom/vk/contacts/ContactsSyncUtils$prefs$2;
|
||||
|
||||
invoke-direct {v0}, Lcom/vk/contacts/ContactsSyncUtils$prefs$2;-><init>()V
|
||||
|
||||
sput-object v0, Lcom/vk/contacts/ContactsSyncUtils$prefs$2;->a:Lcom/vk/contacts/ContactsSyncUtils$prefs$2;
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method constructor <init>()V
|
||||
.locals 1
|
||||
|
||||
const/4 v0, 0x0
|
||||
|
||||
invoke-direct {p0, v0}, Lkotlin/jvm/internal/Lambda;-><init>(I)V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
|
||||
# virtual methods
|
||||
.method public final invoke()Landroid/content/SharedPreferences;
|
||||
.locals 1
|
||||
|
||||
.line 2
|
||||
invoke-static {}, Lcom/vk/core/preference/Preference;->b()Landroid/content/SharedPreferences;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
return-object v0
|
||||
.end method
|
||||
|
||||
.method public bridge synthetic invoke()Ljava/lang/Object;
|
||||
.locals 1
|
||||
|
||||
.line 1
|
||||
invoke-virtual {p0}, Lcom/vk/contacts/ContactsSyncUtils$prefs$2;->invoke()Landroid/content/SharedPreferences;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
return-object v0
|
||||
.end method
|
||||
@@ -1,502 +0,0 @@
|
||||
.class public final Lcom/vk/contacts/ContactsSyncUtils;
|
||||
.super Ljava/lang/Object;
|
||||
.source "ContactsSyncUtils.kt"
|
||||
|
||||
|
||||
# static fields
|
||||
.field static final synthetic a:[Lkotlin/u/KProperty5;
|
||||
|
||||
.field private static final b:Lkotlin/Lazy2;
|
||||
|
||||
.field public static final c:Lcom/vk/contacts/ContactsSyncUtils;
|
||||
|
||||
|
||||
# direct methods
|
||||
.method static constructor <clinit>()V
|
||||
.locals 5
|
||||
|
||||
const/4 v0, 0x1
|
||||
|
||||
new-array v0, v0, [Lkotlin/u/KProperty5;
|
||||
|
||||
new-instance v1, Lkotlin/jvm/internal/PropertyReference1Impl;
|
||||
|
||||
const-class v2, Lcom/vk/contacts/ContactsSyncUtils;
|
||||
|
||||
invoke-static {v2}, Lkotlin/jvm/internal/Reflection;->a(Ljava/lang/Class;)Lkotlin/u/KClass;
|
||||
|
||||
move-result-object v2
|
||||
|
||||
const-string v3, "prefs"
|
||||
|
||||
const-string v4, "getPrefs()Landroid/content/SharedPreferences;"
|
||||
|
||||
invoke-direct {v1, v2, v3, v4}, Lkotlin/jvm/internal/PropertyReference1Impl;-><init>(Lkotlin/u/KDeclarationContainer;Ljava/lang/String;Ljava/lang/String;)V
|
||||
|
||||
invoke-static {v1}, Lkotlin/jvm/internal/Reflection;->a(Lkotlin/jvm/internal/PropertyReference1;)Lkotlin/u/KProperty2;
|
||||
|
||||
const/4 v2, 0x0
|
||||
|
||||
aput-object v1, v0, v2
|
||||
|
||||
sput-object v0, Lcom/vk/contacts/ContactsSyncUtils;->a:[Lkotlin/u/KProperty5;
|
||||
|
||||
.line 1
|
||||
new-instance v0, Lcom/vk/contacts/ContactsSyncUtils;
|
||||
|
||||
invoke-direct {v0}, Lcom/vk/contacts/ContactsSyncUtils;-><init>()V
|
||||
|
||||
sput-object v0, Lcom/vk/contacts/ContactsSyncUtils;->c:Lcom/vk/contacts/ContactsSyncUtils;
|
||||
|
||||
.line 2
|
||||
sget-object v0, Lcom/vk/contacts/ContactsSyncUtils$prefs$2;->a:Lcom/vk/contacts/ContactsSyncUtils$prefs$2;
|
||||
|
||||
invoke-static {v0}, Lkotlin/g;->a(Lkotlin/jvm/b/Functions;)Lkotlin/Lazy2;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
sput-object v0, Lcom/vk/contacts/ContactsSyncUtils;->b:Lkotlin/Lazy2;
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method private constructor <init>()V
|
||||
.locals 0
|
||||
|
||||
.line 1
|
||||
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method private final a()V
|
||||
.locals 2
|
||||
|
||||
.line 14
|
||||
sget-object v0, Lcom/vk/core/concurrent/VkExecutors;->x:Lcom/vk/core/concurrent/VkExecutors;
|
||||
|
||||
invoke-virtual {v0}, Lcom/vk/core/concurrent/VkExecutors;->l()Ljava/util/concurrent/ExecutorService;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
sget-object v1, Lcom/vk/contacts/ContactsSyncUtils$a;->a:Lcom/vk/contacts/ContactsSyncUtils$a;
|
||||
|
||||
invoke-interface {v0, v1}, Ljava/util/concurrent/ExecutorService;->submit(Ljava/lang/Runnable;)Ljava/util/concurrent/Future;
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method private final a(I)V
|
||||
.locals 2
|
||||
|
||||
.line 5
|
||||
invoke-static {}, Lcom/vtosters/lite/auth/VKAccountManager;->d()Lcom/vk/auth/api/VKAccount;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
invoke-virtual {v0}, Lcom/vk/auth/api/VKAccount;->b1()Z
|
||||
|
||||
move-result v0
|
||||
|
||||
if-nez v0, :cond_0
|
||||
|
||||
.line 6
|
||||
invoke-direct {p0}, Lcom/vk/contacts/ContactsSyncUtils;->a()V
|
||||
|
||||
return-void
|
||||
|
||||
.line 7
|
||||
:cond_0
|
||||
sget-object v0, Lcom/vk/auth/VKAuthUtils;->a:Lcom/vk/auth/VKAuthUtils$a;
|
||||
|
||||
invoke-static {}, Lcom/vtosters/lite/auth/VKAccountManager;->d()Lcom/vk/auth/api/VKAccount;
|
||||
|
||||
move-result-object v1
|
||||
|
||||
invoke-virtual {v1}, Lcom/vk/auth/api/VKAccount;->Z()Ljava/lang/String;
|
||||
|
||||
move-result-object v1
|
||||
|
||||
invoke-virtual {v0, v1}, Lcom/vk/auth/VKAuthUtils$a;->a(Ljava/lang/String;)Landroid/accounts/Account;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
const/4 v1, 0x2
|
||||
|
||||
if-eq p1, v1, :cond_1
|
||||
|
||||
if-eqz v0, :cond_1
|
||||
|
||||
.line 8
|
||||
invoke-direct {p0, v0}, Lcom/vk/contacts/ContactsSyncUtils;->a(Landroid/accounts/Account;)V
|
||||
|
||||
goto :goto_0
|
||||
|
||||
.line 9
|
||||
:cond_1
|
||||
invoke-direct {p0}, Lcom/vk/contacts/ContactsSyncUtils;->a()V
|
||||
|
||||
:goto_0
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method private final a(Landroid/accounts/Account;)V
|
||||
.locals 3
|
||||
|
||||
.line 10
|
||||
new-instance v0, Landroid/os/Bundle;
|
||||
|
||||
invoke-direct {v0}, Landroid/os/Bundle;-><init>()V
|
||||
|
||||
const-string v1, "com.vkontakte.android.EXTRA_FORCE_KEY"
|
||||
|
||||
const/4 v2, 0x1
|
||||
|
||||
.line 11
|
||||
invoke-virtual {v0, v1, v2}, Landroid/os/Bundle;->putBoolean(Ljava/lang/String;Z)V
|
||||
|
||||
const-string v1, "com.android.contacts"
|
||||
|
||||
.line 12
|
||||
invoke-static {p1, v1, v0}, Landroid/content/ContentResolver;->requestSync(Landroid/accounts/Account;Ljava/lang/String;Landroid/os/Bundle;)V
|
||||
|
||||
.line 13
|
||||
sget-object v0, Lcom/vk/core/concurrent/VkExecutors;->x:Lcom/vk/core/concurrent/VkExecutors;
|
||||
|
||||
invoke-virtual {v0}, Lcom/vk/core/concurrent/VkExecutors;->l()Ljava/util/concurrent/ExecutorService;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
new-instance v1, Lcom/vk/contacts/ContactsSyncUtils$b;
|
||||
|
||||
invoke-direct {v1, p1}, Lcom/vk/contacts/ContactsSyncUtils$b;-><init>(Landroid/accounts/Account;)V
|
||||
|
||||
invoke-interface {v0, v1}, Ljava/util/concurrent/ExecutorService;->submit(Ljava/lang/Runnable;)Ljava/util/concurrent/Future;
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method public static final a(Z)V
|
||||
.locals 2
|
||||
|
||||
.line 1
|
||||
:try_start_0
|
||||
sget-object v0, Lcom/vk/contacts/ContactsSyncUtils;->c:Lcom/vk/contacts/ContactsSyncUtils;
|
||||
|
||||
invoke-direct {v0}, Lcom/vk/contacts/ContactsSyncUtils;->c()Landroid/content/SharedPreferences;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
const-string v1, "sync_hq_photos"
|
||||
|
||||
.line 2
|
||||
invoke-interface {v0, v1, p0}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor;
|
||||
|
||||
move-result-object p0
|
||||
|
||||
.line 3
|
||||
invoke-interface {p0}, Landroid/content/SharedPreferences$Editor;->apply()V
|
||||
:try_end_0
|
||||
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
||||
|
||||
goto :goto_0
|
||||
|
||||
:catch_0
|
||||
move-exception p0
|
||||
|
||||
.line 4
|
||||
sget-object v0, Lcom/vk/metrics/eventtracking/VkTracker;->k:Lcom/vk/metrics/eventtracking/VkTracker;
|
||||
|
||||
invoke-virtual {v0, p0}, Lcom/vk/metrics/eventtracking/VkTracker;->b(Ljava/lang/Throwable;)V
|
||||
|
||||
:goto_0
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method public static final b()I
|
||||
.locals 9
|
||||
|
||||
const-string v0, "sync_all"
|
||||
|
||||
const-string v1, "key_sync_option"
|
||||
|
||||
const-string v2, "com.vkontakte.account"
|
||||
|
||||
const/4 v3, 0x2
|
||||
|
||||
.line 4
|
||||
:try_start_0
|
||||
sget-object v4, Lcom/vk/core/util/AppContextHolder;->a:Landroid/content/Context;
|
||||
|
||||
invoke-static {v4}, Landroid/accounts/AccountManager;->get(Landroid/content/Context;)Landroid/accounts/AccountManager;
|
||||
|
||||
move-result-object v4
|
||||
|
||||
.line 5
|
||||
invoke-virtual {v4, v2}, Landroid/accounts/AccountManager;->getAccountsByType(Ljava/lang/String;)[Landroid/accounts/Account;
|
||||
|
||||
move-result-object v5
|
||||
|
||||
const-string v6, "am.getAccountsByType(VKAuth.ACCOUNT_TYPE)"
|
||||
|
||||
invoke-static {v5, v6}, Lkotlin/jvm/internal/Intrinsics;->a(Ljava/lang/Object;Ljava/lang/String;)V
|
||||
|
||||
.line 6
|
||||
array-length v6, v5
|
||||
|
||||
const/4 v7, 0x1
|
||||
|
||||
const/4 v8, 0x0
|
||||
|
||||
if-nez v6, :cond_0
|
||||
|
||||
const/4 v6, 0x1
|
||||
|
||||
goto :goto_0
|
||||
|
||||
:cond_0
|
||||
const/4 v6, 0x0
|
||||
|
||||
:goto_0
|
||||
if-eqz v6, :cond_1
|
||||
|
||||
.line 7
|
||||
new-instance v5, Landroid/accounts/Account;
|
||||
|
||||
invoke-static {}, Lcom/vtosters/lite/auth/VKAccountManager;->d()Lcom/vk/auth/api/VKAccount;
|
||||
|
||||
move-result-object v6
|
||||
|
||||
invoke-virtual {v6}, Lcom/vk/auth/api/VKAccount;->Z()Ljava/lang/String;
|
||||
|
||||
move-result-object v6
|
||||
|
||||
invoke-direct {v5, v6, v2}, Landroid/accounts/Account;-><init>(Ljava/lang/String;Ljava/lang/String;)V
|
||||
:try_end_0
|
||||
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_1
|
||||
|
||||
const/4 v2, 0x0
|
||||
|
||||
.line 8
|
||||
:try_start_1
|
||||
invoke-virtual {v4, v5, v2, v2}, Landroid/accounts/AccountManager;->addAccountExplicitly(Landroid/accounts/Account;Ljava/lang/String;Landroid/os/Bundle;)Z
|
||||
:try_end_1
|
||||
.catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0
|
||||
|
||||
goto :goto_1
|
||||
|
||||
:catch_0
|
||||
move-exception v2
|
||||
|
||||
.line 9
|
||||
:try_start_2
|
||||
sget-object v4, Lcom/vk/metrics/eventtracking/VkTracker;->k:Lcom/vk/metrics/eventtracking/VkTracker;
|
||||
|
||||
invoke-virtual {v4, v2}, Lcom/vk/metrics/eventtracking/VkTracker;->a(Ljava/lang/Throwable;)V
|
||||
|
||||
:goto_1
|
||||
new-array v2, v7, [Landroid/accounts/Account;
|
||||
|
||||
aput-object v5, v2, v8
|
||||
|
||||
goto :goto_2
|
||||
|
||||
:cond_1
|
||||
move-object v2, v5
|
||||
|
||||
.line 10
|
||||
:goto_2
|
||||
aget-object v2, v2, v8
|
||||
|
||||
const-string v4, "com.android.contacts"
|
||||
|
||||
invoke-static {v2, v4}, Landroid/content/ContentResolver;->getSyncAutomatically(Landroid/accounts/Account;Ljava/lang/String;)Z
|
||||
|
||||
move-result v2
|
||||
|
||||
if-nez v2, :cond_2
|
||||
|
||||
goto :goto_3
|
||||
|
||||
.line 11
|
||||
:cond_2
|
||||
sget-object v2, Lcom/vk/contacts/ContactsSyncUtils;->c:Lcom/vk/contacts/ContactsSyncUtils;
|
||||
|
||||
invoke-direct {v2}, Lcom/vk/contacts/ContactsSyncUtils;->c()Landroid/content/SharedPreferences;
|
||||
|
||||
move-result-object v2
|
||||
|
||||
invoke-interface {v2, v1}, Landroid/content/SharedPreferences;->contains(Ljava/lang/String;)Z
|
||||
|
||||
move-result v2
|
||||
|
||||
if-eqz v2, :cond_3
|
||||
|
||||
sget-object v0, Lcom/vk/contacts/ContactsSyncUtils;->c:Lcom/vk/contacts/ContactsSyncUtils;
|
||||
|
||||
invoke-direct {v0}, Lcom/vk/contacts/ContactsSyncUtils;->c()Landroid/content/SharedPreferences;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
invoke-interface {v0, v1, v3}, Landroid/content/SharedPreferences;->getInt(Ljava/lang/String;I)I
|
||||
|
||||
move-result v0
|
||||
|
||||
move v3, v0
|
||||
|
||||
goto :goto_3
|
||||
|
||||
.line 12
|
||||
:cond_3
|
||||
sget-object v1, Lcom/vk/contacts/ContactsSyncUtils;->c:Lcom/vk/contacts/ContactsSyncUtils;
|
||||
|
||||
invoke-direct {v1}, Lcom/vk/contacts/ContactsSyncUtils;->c()Landroid/content/SharedPreferences;
|
||||
|
||||
move-result-object v1
|
||||
|
||||
invoke-interface {v1, v0}, Landroid/content/SharedPreferences;->contains(Ljava/lang/String;)Z
|
||||
|
||||
move-result v1
|
||||
|
||||
if-eqz v1, :cond_5
|
||||
|
||||
.line 13
|
||||
sget-object v1, Lcom/vk/contacts/ContactsSyncUtils;->c:Lcom/vk/contacts/ContactsSyncUtils;
|
||||
|
||||
invoke-direct {v1}, Lcom/vk/contacts/ContactsSyncUtils;->c()Landroid/content/SharedPreferences;
|
||||
|
||||
move-result-object v1
|
||||
|
||||
invoke-interface {v1, v0, v8}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z
|
||||
|
||||
move-result v0
|
||||
:try_end_2
|
||||
.catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_1
|
||||
|
||||
if-eqz v0, :cond_4
|
||||
|
||||
const/4 v3, 0x0
|
||||
|
||||
goto :goto_3
|
||||
|
||||
:cond_4
|
||||
const/4 v3, 0x1
|
||||
|
||||
goto :goto_3
|
||||
|
||||
:catch_1
|
||||
move-exception v0
|
||||
|
||||
.line 14
|
||||
sget-object v1, Lcom/vk/metrics/eventtracking/VkTracker;->k:Lcom/vk/metrics/eventtracking/VkTracker;
|
||||
|
||||
invoke-virtual {v1, v0}, Lcom/vk/metrics/eventtracking/VkTracker;->b(Ljava/lang/Throwable;)V
|
||||
|
||||
:cond_5
|
||||
:goto_3
|
||||
return v3
|
||||
.end method
|
||||
|
||||
.method public static final b(I)V
|
||||
.locals 2
|
||||
|
||||
.line 1
|
||||
:try_start_0
|
||||
sget-object v0, Lcom/vk/contacts/ContactsSyncUtils;->c:Lcom/vk/contacts/ContactsSyncUtils;
|
||||
|
||||
invoke-direct {v0}, Lcom/vk/contacts/ContactsSyncUtils;->c()Landroid/content/SharedPreferences;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
const-string v1, "key_sync_option"
|
||||
|
||||
invoke-interface {v0, v1, p0}, Landroid/content/SharedPreferences$Editor;->putInt(Ljava/lang/String;I)Landroid/content/SharedPreferences$Editor;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->apply()V
|
||||
|
||||
.line 2
|
||||
sget-object v0, Lcom/vk/contacts/ContactsSyncUtils;->c:Lcom/vk/contacts/ContactsSyncUtils;
|
||||
|
||||
invoke-direct {v0, p0}, Lcom/vk/contacts/ContactsSyncUtils;->a(I)V
|
||||
:try_end_0
|
||||
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
||||
|
||||
goto :goto_0
|
||||
|
||||
:catch_0
|
||||
move-exception p0
|
||||
|
||||
.line 3
|
||||
sget-object v0, Lcom/vk/metrics/eventtracking/VkTracker;->k:Lcom/vk/metrics/eventtracking/VkTracker;
|
||||
|
||||
invoke-virtual {v0, p0}, Lcom/vk/metrics/eventtracking/VkTracker;->b(Ljava/lang/Throwable;)V
|
||||
|
||||
:goto_0
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method private final c()Landroid/content/SharedPreferences;
|
||||
.locals 3
|
||||
|
||||
sget-object v0, Lcom/vk/contacts/ContactsSyncUtils;->b:Lkotlin/Lazy2;
|
||||
|
||||
sget-object v1, Lcom/vk/contacts/ContactsSyncUtils;->a:[Lkotlin/u/KProperty5;
|
||||
|
||||
const/4 v2, 0x0
|
||||
|
||||
aget-object v1, v1, v2
|
||||
|
||||
invoke-interface {v0}, Lkotlin/Lazy2;->getValue()Ljava/lang/Object;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
check-cast v0, Landroid/content/SharedPreferences;
|
||||
|
||||
return-object v0
|
||||
.end method
|
||||
|
||||
.method public static final d()Z
|
||||
.locals 3
|
||||
|
||||
.line 1
|
||||
sget-object v0, Lcom/vk/contacts/ContactsSyncUtils;->c:Lcom/vk/contacts/ContactsSyncUtils;
|
||||
|
||||
invoke-direct {v0}, Lcom/vk/contacts/ContactsSyncUtils;->c()Landroid/content/SharedPreferences;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
const-string v1, "sync_hq_photos"
|
||||
|
||||
const/4 v2, 0x0
|
||||
|
||||
invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z
|
||||
|
||||
move-result v0
|
||||
|
||||
return v0
|
||||
.end method
|
||||
|
||||
.method public static final e()V
|
||||
.locals 2
|
||||
|
||||
.line 1
|
||||
sget-object v0, Lcom/vk/contacts/ContactsSyncUtils;->c:Lcom/vk/contacts/ContactsSyncUtils;
|
||||
|
||||
invoke-static {}, Lcom/vk/contacts/ContactsSyncUtils;->b()I
|
||||
|
||||
move-result v1
|
||||
|
||||
invoke-direct {v0, v1}, Lcom/vk/contacts/ContactsSyncUtils;->a(I)V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
@@ -891,6 +891,17 @@
|
||||
|
||||
if-eqz v0, :cond_a
|
||||
|
||||
invoke-static {p1}, Lru/vtosters/hooks/PostsMenuHook;->isCustomButton(I)Z
|
||||
|
||||
move-result v2
|
||||
|
||||
if-eqz v2, :cond_99
|
||||
|
||||
invoke-static {p1, p2, v0}, Lru/vtosters/hooks/PostsMenuHook;->injectButtons(ILcom/vk/dto/newsfeed/entries/NewsEntry;Landroid/content/Context;)V
|
||||
|
||||
return-void
|
||||
|
||||
:cond_99
|
||||
invoke-static {v0}, Lcom/vk/core/util/ContextExtKt;->e(Landroid/content/Context;)Landroid/app/Activity;
|
||||
|
||||
move-result-object v2
|
||||
|
||||
@@ -1536,6 +1536,10 @@
|
||||
invoke-virtual {v0, v1, v2}, Lcom/vk/newsfeed/NewsEntryActionsAdapter;->a(ILjava/lang/CharSequence;)V
|
||||
|
||||
:cond_26
|
||||
iget-object v1, p0, Lcom/vk/newsfeed/NewsEntryActionsMenuBuilder;->e:Lcom/vk/dto/newsfeed/entries/NewsEntry;
|
||||
|
||||
invoke-static {v0, v1}, Lru/vtosters/hooks/PostsMenuHook;->injectList(Lcom/vk/newsfeed/NewsEntryActionsAdapter;Lcom/vk/dto/newsfeed/entries/NewsEntry;)V
|
||||
|
||||
return-object p1
|
||||
.end method
|
||||
|
||||
|
||||
@@ -1367,6 +1367,10 @@
|
||||
invoke-virtual {v1, v2, v3, v4}, Lcom/vk/newsfeed/NewsEntryActionsAdapter;->b(III)V
|
||||
|
||||
:cond_35
|
||||
iget-object v2, v0, Lcom/vk/newsfeed/PostViewActionsMenuBuilder;->b:Lcom/vk/dto/newsfeed/entries/NewsEntry;
|
||||
|
||||
invoke-static {v1, v2}, Lru/vtosters/hooks/PostsMenuHook;->injectList(Lcom/vk/newsfeed/NewsEntryActionsAdapter;Lcom/vk/dto/newsfeed/entries/NewsEntry;)V
|
||||
|
||||
return-object v17
|
||||
.end method
|
||||
|
||||
|
||||
@@ -1,187 +0,0 @@
|
||||
.class public final Lcom/vk/newsfeed/holders/AdMarkHolder;
|
||||
.super Lcom/vk/newsfeed/holders/BaseNewsEntryHolder;
|
||||
.source "AdMarkHolder.kt"
|
||||
|
||||
|
||||
# annotations
|
||||
.annotation system Ldalvik/annotation/Signature;
|
||||
value = {
|
||||
"Lcom/vk/newsfeed/holders/BaseNewsEntryHolder<",
|
||||
"Lcom/vk/dto/newsfeed/entries/NewsEntry;",
|
||||
">;"
|
||||
}
|
||||
.end annotation
|
||||
|
||||
|
||||
# instance fields
|
||||
.field private final F:Landroid/widget/TextView;
|
||||
|
||||
|
||||
# direct methods
|
||||
.method public constructor <init>(Landroid/view/ViewGroup;)V
|
||||
.locals 3
|
||||
|
||||
const v0, 0x7f0d0307
|
||||
|
||||
.line 1
|
||||
invoke-direct {p0, v0, p1}, Lcom/vk/newsfeed/holders/BaseNewsEntryHolder;-><init>(ILandroid/view/ViewGroup;)V
|
||||
|
||||
.line 2
|
||||
iget-object p1, p0, Landroidx/recyclerview/widget/RecyclerView$ViewHolder;->itemView:Landroid/view/View;
|
||||
|
||||
const-string v0, "itemView"
|
||||
|
||||
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->a(Ljava/lang/Object;Ljava/lang/String;)V
|
||||
|
||||
const/4 v0, 0x0
|
||||
|
||||
const v1, 0x7f0a0d4e
|
||||
|
||||
const/4 v2, 0x2
|
||||
|
||||
invoke-static {p1, v1, v0, v2, v0}, Lcom/vk/extensions/ViewExtKt;->a(Landroid/view/View;ILkotlin/jvm/b/Functions2;ILjava/lang/Object;)Landroid/view/View;
|
||||
|
||||
move-result-object p1
|
||||
|
||||
check-cast p1, Landroid/widget/TextView;
|
||||
|
||||
iput-object p1, p0, Lcom/vk/newsfeed/holders/AdMarkHolder;->F:Landroid/widget/TextView;
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
|
||||
# virtual methods
|
||||
.method public b(Lcom/vk/dto/newsfeed/entries/NewsEntry;)V
|
||||
.locals 4
|
||||
|
||||
.line 2
|
||||
instance-of v0, p1, Lcom/vk/dto/newsfeed/entries/Post;
|
||||
|
||||
const/4 v1, 0x0
|
||||
|
||||
const/4 v2, 0x0
|
||||
|
||||
if-eqz v0, :cond_0
|
||||
|
||||
check-cast p1, Lcom/vk/dto/newsfeed/entries/Post;
|
||||
|
||||
invoke-virtual {p1}, Lcom/vk/dto/newsfeed/entries/Post;->L1()Z
|
||||
|
||||
move-result p1
|
||||
|
||||
if-eqz p1, :cond_2
|
||||
|
||||
const p1, 0x7f0808cf
|
||||
|
||||
const v0, 0x7f040256
|
||||
|
||||
.line 3
|
||||
invoke-static {p1, v0}, Lcom/vk/core/ui/themes/VKThemeHelper;->a(II)Lcom/vk/core/drawable/RecoloredDrawable;
|
||||
|
||||
move-result-object p1
|
||||
|
||||
const v0, 0x7f120def
|
||||
|
||||
.line 4
|
||||
invoke-virtual {p0, v0}, Lcom/vtosters/lite/ui/holder/RecyclerHolder;->m(I)Ljava/lang/String;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
.line 5
|
||||
invoke-virtual {p0}, Lcom/vtosters/lite/ui/holder/RecyclerHolder;->e0()Landroid/content/res/Resources;
|
||||
|
||||
move-result-object v1
|
||||
|
||||
const v3, 0x7f0701b8
|
||||
|
||||
invoke-virtual {v1, v3}, Landroid/content/res/Resources;->getDimensionPixelSize(I)I
|
||||
|
||||
move-result v1
|
||||
|
||||
goto :goto_1
|
||||
|
||||
.line 6
|
||||
:cond_0
|
||||
instance-of v0, p1, Lcom/vk/dto/newsfeed/entries/PromoPost;
|
||||
|
||||
if-eqz v0, :cond_2
|
||||
|
||||
check-cast p1, Lcom/vk/dto/newsfeed/entries/PromoPost;
|
||||
|
||||
invoke-virtual {p1}, Lcom/vk/dto/newsfeed/entries/PromoPost;->E1()Ljava/lang/String;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
invoke-interface {v0}, Ljava/lang/CharSequence;->length()I
|
||||
|
||||
move-result v0
|
||||
|
||||
if-lez v0, :cond_1
|
||||
|
||||
const/4 v0, 0x1
|
||||
|
||||
goto :goto_0
|
||||
|
||||
:cond_1
|
||||
const/4 v0, 0x0
|
||||
|
||||
:goto_0
|
||||
if-eqz v0, :cond_2
|
||||
|
||||
.line 7
|
||||
invoke-virtual {p1}, Lcom/vk/dto/newsfeed/entries/PromoPost;->E1()Ljava/lang/String;
|
||||
|
||||
move-result-object p1
|
||||
|
||||
.line 8
|
||||
invoke-virtual {p0}, Lcom/vtosters/lite/ui/holder/RecyclerHolder;->e0()Landroid/content/res/Resources;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
const v1, 0x7f0701b9
|
||||
|
||||
invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getDimensionPixelSize(I)I
|
||||
|
||||
move-result v1
|
||||
|
||||
move-object v0, p1
|
||||
|
||||
move-object p1, v2
|
||||
|
||||
goto :goto_1
|
||||
|
||||
:cond_2
|
||||
move-object p1, v2
|
||||
|
||||
move-object v0, p1
|
||||
|
||||
.line 9
|
||||
:goto_1
|
||||
iget-object v3, p0, Lcom/vk/newsfeed/holders/AdMarkHolder;->F:Landroid/widget/TextView;
|
||||
|
||||
invoke-virtual {v3, p1, v2, v2, v2}, Landroid/widget/TextView;->setCompoundDrawablesRelativeWithIntrinsicBounds(Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;Landroid/graphics/drawable/Drawable;)V
|
||||
|
||||
.line 10
|
||||
iget-object p1, p0, Lcom/vk/newsfeed/holders/AdMarkHolder;->F:Landroid/widget/TextView;
|
||||
|
||||
invoke-virtual {p1, v1}, Landroid/widget/TextView;->setMinHeight(I)V
|
||||
|
||||
.line 11
|
||||
iget-object p1, p0, Lcom/vk/newsfeed/holders/AdMarkHolder;->F:Landroid/widget/TextView;
|
||||
|
||||
invoke-virtual {p1, v0}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
.method public bridge synthetic b(Ljava/lang/Object;)V
|
||||
.locals 0
|
||||
|
||||
.line 1
|
||||
check-cast p1, Lcom/vk/dto/newsfeed/entries/NewsEntry;
|
||||
|
||||
invoke-virtual {p0, p1}, Lcom/vk/newsfeed/holders/AdMarkHolder;->b(Lcom/vk/dto/newsfeed/entries/NewsEntry;)V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
@@ -2860,7 +2860,17 @@
|
||||
|
||||
invoke-static {v2, v0}, Lkotlin/jvm/internal/Intrinsics;->a(Ljava/lang/Object;Ljava/lang/String;)V
|
||||
|
||||
.line 76
|
||||
invoke-static {p2}, Lru/vtosters/hooks/PostsMenuHook;->isCustomButton(I)Z
|
||||
|
||||
move-result v3
|
||||
|
||||
if-eqz v3, :cond_20
|
||||
|
||||
invoke-static {p2, p3, v2}, Lru/vtosters/hooks/PostsMenuHook;->injectButtons(ILcom/vk/dto/newsfeed/entries/NewsEntry;Landroid/content/Context;)V
|
||||
|
||||
goto/16 :goto_1
|
||||
|
||||
:cond_20
|
||||
invoke-interface {p0}, Lcom/vk/newsfeed/contracts/EntriesListContract;->v0()Ljava/lang/String;
|
||||
|
||||
move-result-object v3
|
||||
|
||||
@@ -3797,6 +3797,17 @@
|
||||
|
||||
if-eqz v4, :cond_6
|
||||
|
||||
invoke-static {p1}, Lru/vtosters/hooks/PostsMenuHook;->isCustomButton(I)Z
|
||||
|
||||
move-result v3
|
||||
|
||||
if-eqz v3, :cond_20
|
||||
|
||||
invoke-static {p1, v4, v0}, Lru/vtosters/hooks/PostsMenuHook;->injectButtons(ILcom/vk/dto/newsfeed/entries/NewsEntry;Landroid/content/Context;)V
|
||||
|
||||
goto/16 :goto_5
|
||||
|
||||
:cond_20
|
||||
const/4 v1, 0x1
|
||||
|
||||
const/4 v2, 0x0
|
||||
|
||||
@@ -526,7 +526,7 @@
|
||||
|
||||
move-result-object v0
|
||||
|
||||
const-string v1, "vnd.android.cursor.item/vnd.com.vkontakte.android.profile"
|
||||
const-string v1, "vnd.android.cursor.item/vnd.com.vtosters.lite.profile"
|
||||
|
||||
.line 28
|
||||
invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
||||
@@ -548,7 +548,7 @@
|
||||
goto :goto_0
|
||||
|
||||
:cond_6
|
||||
const-string v1, "vnd.android.cursor.item/vnd.com.vkontakte.android.sendmsg"
|
||||
const-string v1, "vnd.android.cursor.item/vnd.com.vtosters.lite.sendmsg"
|
||||
|
||||
.line 31
|
||||
invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
||||
@@ -582,7 +582,7 @@
|
||||
goto :goto_0
|
||||
|
||||
:cond_7
|
||||
const-string v1, "vnd.android.cursor.item/vnd.com.vkontakte.android.voipcall"
|
||||
const-string v1, "vnd.android.cursor.item/vnd.com.vtosters.lite.voipcall"
|
||||
|
||||
.line 34
|
||||
invoke-virtual {v1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
||||
|
||||
+2
-2
@@ -348,12 +348,12 @@
|
||||
return-object p1
|
||||
|
||||
:cond_0
|
||||
const-string p1, "vnd.android.cursor.item/vnd.com.vkontakte.android.providers.audio.cache"
|
||||
const-string p1, "vnd.android.cursor.item/vnd.com.vtosters.lite.providers.audio.cache"
|
||||
|
||||
return-object p1
|
||||
|
||||
:cond_1
|
||||
const-string p1, "vnd.android.cursor.dir/vnd.com.vkontakte.android.providers.audio.cache"
|
||||
const-string p1, "vnd.android.cursor.dir/vnd.com.vtosters.lite.providers.audio.cache"
|
||||
|
||||
return-object p1
|
||||
.end method
|
||||
|
||||
+1
-1
@@ -303,7 +303,7 @@
|
||||
goto :goto_0
|
||||
|
||||
:cond_0
|
||||
const-string p1, "vnd.android.cursor.dir/vnd.com.vkontakte.android.providers.im.state"
|
||||
const-string p1, "vnd.android.cursor.dir/vnd.com.vtosters.lite.providers.im.state"
|
||||
|
||||
:goto_0
|
||||
return-object p1
|
||||
|
||||
Reference in New Issue
Block a user