read to feature

This commit is contained in:
gdlbo
2022-08-01 00:39:02 +03:00
parent 55dbb029c0
commit 83d13dce1e
6 changed files with 20 additions and 1 deletions
@@ -10,5 +10,6 @@ public enum MsgAction {
SPAM,
PIN,
UNPIN,
TRANSLATE
TRANSLATE,
READTO
}
@@ -33,6 +33,7 @@ public final class MsgActionHelper {
CollectionExt.a(arrayList, MsgAction.PIN, MsgPermissionHelper.b.e(aVar));
CollectionExt.a(arrayList, MsgAction.UNPIN, MsgPermissionHelper.b.i(aVar));
CollectionExt.a(arrayList, MsgAction.TRANSLATE, true);
CollectionExt.a(arrayList, MsgAction.READTO, true);
return arrayList;
}
@@ -96,6 +96,7 @@ public class DNRInjector {
public static LinkedHashMap<MsgAction, DelegateMsg.a.a> injectToHashMapMsg(LinkedHashMap<MsgAction, DelegateMsg.a.a> hashMap) {
hashMap.put(MsgAction.valueOf("TRANSLATE"), new DelegateMsg.a.a(getIdentifier("translator", "string")));
hashMap.put(MsgAction.valueOf("READTO"), new DelegateMsg.a.a(getIdentifier("readto", "string")));
return hashMap;
}
@@ -104,6 +105,11 @@ public class DNRInjector {
var fullMsg = ((MsgFromUser) msg).j2(); // text + reply
var reply = fullMsg.substring(text.length() + 1);
if (action == MsgAction.valueOf("READTO")) {
DNRModule.hookReadStartMsgTo(msg);
return true;
}
var isTextExist = !text.isEmpty() && !text.equals(" ");
var isReplyExist = !reply.isEmpty() && !reply.equals(" ");
@@ -4,8 +4,11 @@ import static ru.vtosters.lite.net.Request.makeRequest;
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
import static ru.vtosters.lite.utils.ProxyUtils.getApi;
import android.util.Log;
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;
@@ -54,6 +57,12 @@ public class DNRModule {
});
}
public static void hookReadStartMsgTo(Msg dialog) {
Log.d("DNR", "hookReadStartMsgTo: " + dialog.C1() + " " + dialog.v1());
makeRequest("https://" + getApi() + "/method/messages.markAsRead?start_message_id=" + dialog.C1() + "&peer_id=" + dialog.v1() + "&v=5.119&access_token=" + getUserToken(), response -> {
});
}
public static void hookDNR(int peerId) {
mDoNotReadDBHelper.setEnabledForPeerId(peerId, !mDoNotReadDBHelper.isEnabledForPeerId(peerId));
}
+1
View File
@@ -5795,6 +5795,7 @@
<string name="getdonate">Поддержи проект донатом и получи бонусы</string>
<string name="wallpapers">Обои</string>
<string name="readto">Прочитать до</string>
<string name="translator">Перевести</string>
</resources>
+1
View File
@@ -5955,6 +5955,7 @@ May look like a fake leaving the online"</string>
<string name="wallpapers">Wallpapers</string>
<string name="translator">Translate</string>
<string name="readto">Read to</string>
<string name="vkiddisable">Disable protection</string>
<string name="vkidsumm">VK has started blocking the use of third-party applications, so for the stable operation of all parts of the application, it is necessary to disable Protection from suspicious applications \n\nVK ID -> Security and Login -> Protection from suspicious applications</string>