Skip to content

Commit

Permalink
Merge pull request #188 from frknkrc44/feat-24-xx-support
Browse files Browse the repository at this point in the history
feat: Fix stable 24.xx bugs
  • Loading branch information
Dev4Mod authored Nov 27, 2024
2 parents 8c0934a + 99c55df commit acafbc6
Showing 1 changed file with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

import java.lang.reflect.Method;
import java.util.List;
import java.util.Objects;

import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XSharedPreferences;
Expand Down Expand Up @@ -193,27 +192,25 @@ private void setFilter(int position) {
try {
ReflectionUtils.callMethod(methodInitFilter, null, mConversationFragment);
if (mFilterInstance == null) return;
var listField = ReflectionUtils.getFieldByType(mFilterInstance.getClass(), List.class);
var list = (List<Object>) ReflectionUtils.getObjectField(listField, mFilterInstance);
var listField = ReflectionUtils.getFieldByExtendType(mFilterInstance.getClass(), List.class);
var list = (List) ReflectionUtils.getObjectField(listField, mFilterInstance);
if (list == null) return;
var name = position == 0 ? "CONTACTS_FILTER" : "GROUP_FILTER";
Object result = null;
int index = -1;
for (var item : list) {
for (var field : item.getClass().getFields()) {
if (Objects.equals(XposedHelpers.getObjectField(item, field.getName()), name)) {
result = item;
break;
}
if (item == null) continue;
if (item.toString().contains(name)) {
index = list.indexOf(item);
break;
}
}
if (result == null) return;
var index = list.indexOf(result);
if (index == -1) return;
ReflectionUtils.callMethod(methodSetFilter, mFilterInstance, index);
} catch (Exception e) {
logDebug(e);
}
}

@NonNull
@Override
public String getPluginName() {
Expand Down

0 comments on commit acafbc6

Please sign in to comment.