mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-06-13 13:47:47 +02:00
bridge getRulesIds
This commit is contained in:
@ -60,6 +60,13 @@ interface BridgeInterface {
|
||||
*/
|
||||
List<String> getRules(String uuid);
|
||||
|
||||
/**
|
||||
* Get all ids for a specific rule
|
||||
* @param type rule type (MessagingRuleType)
|
||||
* @return list of ids
|
||||
*/
|
||||
List<String> getRuleIds(String type);
|
||||
|
||||
/**
|
||||
* Update rule for a giver user or conversation
|
||||
*
|
||||
|
@ -142,6 +142,10 @@ class BridgeClient(
|
||||
return service.getRules(targetUuid).map { MessagingRuleType.getByName(it) }
|
||||
}
|
||||
|
||||
fun getRuleIds(ruleType: MessagingRuleType): List<String> {
|
||||
return service.getRuleIds(ruleType.key)
|
||||
}
|
||||
|
||||
fun setRule(targetUuid: String, type: MessagingRuleType, state: Boolean)
|
||||
= service.setRule(targetUuid, type.key, state)
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ class PinConversations : BridgeFileFeature("PinConversations", BridgeFileType.PI
|
||||
|
||||
context.classCache.feedEntry.hookConstructor(HookStage.AFTER) { param ->
|
||||
val instance = param.thisObject<Any>()
|
||||
val conversationUUID = SnapUUID(instance.getObjectField("mConversationId"))
|
||||
val conversationUUID = SnapUUID(instance.getObjectField("mConversationId") ?: return@hookConstructor)
|
||||
val isPinned = exists(conversationUUID.toString())
|
||||
if (isPinned) {
|
||||
instance.setObjectField("mPinnedTimestampMs", 1L)
|
||||
|
Reference in New Issue
Block a user