fix: missing properties
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package me.rhunk.snapenhance.features.impl.experiments
|
||||
|
||||
import me.rhunk.snapenhance.config.ConfigProperty
|
||||
import me.rhunk.snapenhance.features.Feature
|
||||
import me.rhunk.snapenhance.features.FeatureLoadParams
|
||||
import me.rhunk.snapenhance.hook.HookStage
|
||||
@@ -9,7 +10,9 @@ class InfiniteStoryBoost : Feature("InfiniteStoryBoost", loadParams = FeatureLoa
|
||||
override fun asyncOnActivityCreate() {
|
||||
val storyBoostStateClass = context.mappings.getMappedClass("StoryBoostStateClass")
|
||||
|
||||
storyBoostStateClass.hookConstructor(HookStage.BEFORE) { param ->
|
||||
storyBoostStateClass.hookConstructor(HookStage.BEFORE, {
|
||||
context.config.bool(ConfigProperty.INFINITE_STORY_BOOST)
|
||||
}) { param ->
|
||||
val startTimeMillis = param.arg<Long>(1)
|
||||
//reset timestamp if it's more than 24 hours
|
||||
if (System.currentTimeMillis() - startTimeMillis > 86400000) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package me.rhunk.snapenhance.features.impl.tweaks
|
||||
|
||||
import me.rhunk.snapenhance.config.ConfigProperty
|
||||
import me.rhunk.snapenhance.features.Feature
|
||||
import me.rhunk.snapenhance.features.FeatureLoadParams
|
||||
import me.rhunk.snapenhance.hook.HookStage
|
||||
@@ -9,7 +10,9 @@ class DisableVideoLengthRestriction : Feature("DisableVideoLengthRestriction", l
|
||||
override fun asyncOnActivityCreate() {
|
||||
val defaultMediaItem = context.mappings.getMappedClass("DefaultMediaItem")
|
||||
|
||||
Hooker.hookConstructor(defaultMediaItem, HookStage.BEFORE) { param ->
|
||||
Hooker.hookConstructor(defaultMediaItem, HookStage.BEFORE, {
|
||||
context.config.bool(ConfigProperty.DISABLE_VIDEO_LENGTH_RESTRICTION)
|
||||
}) { param ->
|
||||
//set the video length argument
|
||||
param.setArg(5, -1L)
|
||||
}
|
||||
|
||||
@@ -14,15 +14,15 @@ import me.rhunk.snapenhance.util.protobuf.ProtoReader
|
||||
class GalleryMediaSendOverride : Feature("Gallery Media Send Override", loadParams = FeatureLoadParams.INIT_SYNC) {
|
||||
override fun init() {
|
||||
Hooker.hook(context.classCache.conversationManager, "sendMessageWithContent", HookStage.BEFORE) { param ->
|
||||
val localMessageContent = MessageContent(param.arg(1))
|
||||
val overrideType = context.config.state(ConfigProperty.GALLERY_MEDIA_SEND_OVERRIDE).also { if (it == "OFF") return@hook }
|
||||
|
||||
val localMessageContent = MessageContent(param.arg(1))
|
||||
if (localMessageContent.contentType != ContentType.EXTERNAL_MEDIA) return@hook
|
||||
//story replies
|
||||
val messageProtoReader = ProtoReader(localMessageContent.content)
|
||||
if (messageProtoReader.exists(7)) return@hook
|
||||
val overrideType = context.config.state(ConfigProperty.GALLERY_MEDIA_SEND_OVERRIDE)
|
||||
|
||||
if (overrideType != "OFF" && messageProtoReader.readPath(3)?.getCount(3) != 1) {
|
||||
if (messageProtoReader.readPath(3)?.getCount(3) != 1) {
|
||||
context.runOnUiThread {
|
||||
AlertDialog.Builder(context.mainActivity!!)
|
||||
.setMessage("You can only send one media at a time")
|
||||
|
||||
Reference in New Issue
Block a user