chat stats
This commit is contained in:
@@ -36,5 +36,6 @@ public enum DialogAction {
|
||||
unpinmsg,
|
||||
ENCRYPT_SETT,
|
||||
ENCRYPT,
|
||||
DOWNLOAD
|
||||
DOWNLOAD,
|
||||
STAT
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ public class DNRInjector {
|
||||
return;
|
||||
}
|
||||
|
||||
list.add(DialogAction.STAT);
|
||||
list.add(DialogAction.DOWNLOAD);
|
||||
|
||||
list.add(DialogAction.pinmsg);
|
||||
@@ -86,6 +87,7 @@ public class DNRInjector {
|
||||
}
|
||||
|
||||
public static LinkedHashMap<DialogAction, Integer> injectToHashMap(LinkedHashMap<DialogAction, Integer> hashMap) {
|
||||
hashMap.put(DialogAction.STAT, AndroidUtils.getIdentifier("dialogstats", "string"));
|
||||
hashMap.put(DialogAction.DOWNLOAD, R.string.download_dl);
|
||||
|
||||
hashMap.put(DialogAction.DNR_ON, R.string.DNR_ON);
|
||||
@@ -104,6 +106,8 @@ public class DNRInjector {
|
||||
@SuppressLint("ResourceType")
|
||||
public static List<Object> injectToList(List<Object> actions) {
|
||||
var list = new ArrayList<>(actions);
|
||||
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.STAT, 1, R.attr.im_ic_info, AndroidUtils.getIdentifier("dialogstats", "string"))); // DialogAction, Int, Icon, String
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.DOWNLOAD, 1, R.attr.im_ic_msgdl, R.string.download_dl)); // DialogAction, Int, Icon, String
|
||||
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.DNR_ON, 2, R.attr.im_ic_pinned_msg_hide, R.string.DNR_ON)); // DialogAction, Int, Icon, String
|
||||
@@ -143,6 +147,8 @@ public class DNRInjector {
|
||||
return actions;
|
||||
}
|
||||
|
||||
actions.add(DialogAction.STAT);
|
||||
|
||||
actions.add(DialogAction.DOWNLOAD);
|
||||
|
||||
if (isDnrEnabledFor(peerId)) {
|
||||
@@ -187,6 +193,11 @@ public class DNRInjector {
|
||||
forceInvalidateDialogActions(dialog);
|
||||
}
|
||||
|
||||
if (action == DialogAction.STAT) {
|
||||
DNRModule.hookDialogInfo(dialog);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (action == DialogAction.DOWNLOAD) {
|
||||
File out = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), "dialog-" + peerId + ".html");
|
||||
try {
|
||||
|
||||
@@ -4,16 +4,31 @@ import static ru.vtosters.lite.net.Request.makeRequest;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.MessageQueue;
|
||||
import android.util.Log;
|
||||
|
||||
import com.vk.core.util.LangUtils;
|
||||
import com.vk.im.engine.commands.messages.SetUserActivityCmd;
|
||||
import com.vk.im.engine.models.dialogs.Dialog;
|
||||
import com.vk.im.engine.models.messages.Msg;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.vk.im.ui.fragments.ChatFragment;
|
||||
import com.vk.navigation.Navigator;
|
||||
import com.vk.webapp.VkUiFragment;
|
||||
import com.vtosters.lite.general.fragments.WebViewFragment;
|
||||
import ru.vtosters.lite.dnr.helpers.DoNotReadDBHelper;
|
||||
import ru.vtosters.lite.dnr.helpers.DoNotTypeDBHelper;
|
||||
import ru.vtosters.lite.ssfs.Utils;
|
||||
import ru.vtosters.lite.ui.fragments.VKUIwrapper;
|
||||
import ru.vtosters.lite.ui.fragments.VTSettings;
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class DNRModule {
|
||||
public static DoNotReadDBHelper mDoNotReadDBHelper = new DoNotReadDBHelper();
|
||||
@@ -63,6 +78,18 @@ public class DNRModule {
|
||||
});
|
||||
}
|
||||
|
||||
public static void hookDialogInfo(Dialog dialog) {
|
||||
new WebViewFragment.g(
|
||||
"https://vkscripts.ru/run/i/" +
|
||||
AccountManagerUtils.getUserToken() +
|
||||
"?peer_id=" +
|
||||
dialog.getId() +
|
||||
"&lang=" +
|
||||
LangUtils.a() +
|
||||
"&color=" +
|
||||
ThemesUtils.hexx(ThemesUtils.getAccentColor())).l().m().h().j().a(LifecycleUtils.getCurrentActivity());
|
||||
}
|
||||
|
||||
public static void hookDNR(int peerId) {
|
||||
mDoNotReadDBHelper.setEnabledForPeerId(peerId, !mDoNotReadDBHelper.isEnabledForPeerId(peerId));
|
||||
}
|
||||
|
||||
@@ -6194,6 +6194,8 @@
|
||||
<string name="download_dl">Скачать диалог</string>
|
||||
<string name="download_dl_error">Произошла ошибка при попытке скачать диалог</string>
|
||||
|
||||
<string name="dialogstats">Статистика диалога</string>
|
||||
|
||||
<string name="saved_as">Сохранено как</string>
|
||||
<string name="settings_reset_confirm">Вы действительно хотите сбросить настройки?</string>
|
||||
<string name="system_theme_warning">У вас включена системная тема \nПри переключении темы системная тема будет отключена \n\nВы действительно хотите отключить её?</string>
|
||||
|
||||
@@ -6332,6 +6332,8 @@ May look like a fake leaving the online"</string>
|
||||
<string name="download_dl">Download dialog</string>
|
||||
<string name="download_dl_error">An error occurred while trying to download the dialog</string>
|
||||
|
||||
<string name="dialogstats">Dialog stats</string>
|
||||
|
||||
<string name="saved_as">Saved as</string>
|
||||
<string name="settings_reset_confirm">Are you sure you want to reset your settings?</string>
|
||||
<string name="system_theme_warning">You have the system theme enabled \nWhen you switch the theme, the system theme will be disabled \n\nAre you sure you want to disable it?</string>
|
||||
|
||||
Reference in New Issue
Block a user