From ffbbe8f81126f9f078a5e7ab8f2fbb46a0175b6d Mon Sep 17 00:00:00 2001 From: ACh Sulfate Date: Mon, 24 Jul 2023 21:37:57 +0800 Subject: [PATCH] fix: FileShareExtHook: check for duplicate before add item --- .../main/java/cc/ioctl/hook/msg/FileShareExtHook.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/main/java/cc/ioctl/hook/msg/FileShareExtHook.java b/app/src/main/java/cc/ioctl/hook/msg/FileShareExtHook.java index eec08b9cdd..29a3fd5760 100644 --- a/app/src/main/java/cc/ioctl/hook/msg/FileShareExtHook.java +++ b/app/src/main/java/cc/ioctl/hook/msg/FileShareExtHook.java @@ -161,6 +161,15 @@ protected boolean initOnce() throws Exception { return; } ArrayList row2 = results[1]; + // check if already added + if (!row2.isEmpty()) { + Object lastItem = row2.get(row2.size() - 1); + int id = Reflex.getInstanceObject(lastItem, "id", int.class); + if (id == R.id.ShareActionSheet_shareFileWithExtApp) { + // already added + return; + } + } Object item = ctorActionSheetItem.newInstance(); Context ctx = Reflex.getFirstByType(param.thisObject, Activity.class); Parasitics.injectModuleResources(ctx.getResources());