1
0
mirror of https://github.com/areteruhiro/LIME-beta-hiro.git synced 2025-02-06 05:21:37 +09:00
This commit is contained in:
areteruhiro 2024-11-21 09:15:14 +09:00
parent be8811ef5c
commit de692d6f7d
4 changed files with 42 additions and 40 deletions

View File

@ -10,7 +10,7 @@ android {
minSdk 28
targetSdk 35
versionCode 15
versionName "1.12.5fd"
versionName "1.12.5f"
multiDexEnabled false
proguardFiles += 'proguard-rules.pro'
buildConfigField 'String', 'HOOK_TARGET_VERSION', '"141700420"'

View File

@ -231,18 +231,25 @@ public class EmbedOptions implements IHook {
}
});
layout.addView(restorefolderButton);
Button MuteGroups_Button = new Button(context);
MuteGroups_Button.setLayoutParams(buttonParams);
MuteGroups_Button.setText("通知を無効にしているグループ");
MuteGroups_Button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MuteGroups_Button(context);
}
});
layout.addView(MuteGroups_Button);
if (limeOptions.Notif_invalid.checked) {
// 条件が満たされた場合にのみボタンを作成
layout.addView(restorefolderButton);
Button MuteGroups_Button = new Button(context);
MuteGroups_Button.setLayoutParams(buttonParams);
MuteGroups_Button.setText("通知を無効にしているグループ");
MuteGroups_Button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MuteGroups_Button(context); // ボタンクリック時の処理
}
});
layout.addView(MuteGroups_Button);
}
builder.setPositiveButton(R.string.positive_button, new DialogInterface.OnClickListener() {
@Override

View File

@ -58,15 +58,11 @@ public class Notif_invalid implements IHook {
private void saveChatNameToFile(String chatName, File dir) {
if (!dir.exists() && !dir.mkdirs()) {
XposedBridge.log("Failed to create directory: " + dir.getPath());
return;
}
File file = new File(dir, "Notification.txt");
try {
if (!file.exists() && !file.createNewFile()) {
XposedBridge.log("Failed to create file: " + file.getPath());
return;
}
@ -77,21 +73,15 @@ public class Notif_invalid implements IHook {
existingChatNames.add(line.trim());
}
} catch (IOException e) {
XposedBridge.log("Error reading file: " + e.getMessage());
}
if (!existingChatNames.contains(chatName.trim())) {
try (FileWriter writer = new FileWriter(file, true)) {
writer.write(chatName + "\n");
XposedBridge.log("Saved chatName: " + chatName);
} catch (IOException e) {
XposedBridge.log("Error writing to file: " + e.getMessage());
}
} else {
XposedBridge.log("Chat name already exists: " + chatName);
}
} catch (IOException e) {
XposedBridge.log("Error accessing file: " + e.getMessage());
}
}
});
@ -104,11 +94,16 @@ public class Notif_invalid implements IHook {
int id = (int) param.args[1];
Notification notification = (Notification) param.args[2];
logNotificationDetails("NotificationManager.notify (with tag)", id, notification);
// logNotificationDetails("NotificationManager.notify (with tag)", id, notification);
String subText = notification.extras.getString(Notification.EXTRA_SUB_TEXT);
List<String> chatNamesFromFile = loadNamesFromFile();
for (String chatName : chatNamesFromFile) {
if (subText != null && subText.contains(chatName)) {
param.setResult(null);
return;
}

View File

@ -97,7 +97,7 @@ public class ReadChecker implements IHook {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
String chatId = (String) param.getResult();
XposedBridge.log(chatId);
//(chatId);
if (isGroupExists(chatId)) {
shouldHookOnCreate = true;
currentGroupId = chatId;
@ -128,7 +128,7 @@ public class ReadChecker implements IHook {
private boolean isGroupExists(String groupId) {
if (limeDatabase == null) {
// XposedBridge.log("Database is not initialized.");
//("Database is not initialized.");
return false;
}
@ -144,7 +144,7 @@ public class ReadChecker implements IHook {
private boolean isNoGroup(String groupId) {
if (limeDatabase == null) {
// XposedBridge.log("Database is not initialized.");
//("Database is not initialized.");
return true;
}
@ -313,9 +313,9 @@ public class ReadChecker implements IHook {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
String paramValue = param.args[0].toString();
XposedBridge.log(paramValue);
//(paramValue);
if (appContext == null) {
XposedBridge.log("appContext is null!");
//("appContext is null!");
return;
}
@ -324,7 +324,7 @@ public class ReadChecker implements IHook {
moduleContext = appContext.createPackageContext(
"io.github.hiro.lime", Context.CONTEXT_IGNORE_SECURITY);
} catch (PackageManager.NameNotFoundException e) {
// XposedBridge.log("Failed to create package context: " + e.getMessage());
//("Failed to create package context: " + e.getMessage());
return;
}
@ -425,7 +425,7 @@ public class ReadChecker implements IHook {
limeDatabase.update("group_messages", values, "group_id=? AND server_id=?",
new String[]{groupId, previousServerId});
// XposedBridge.log("Marked as read in lime_data.db: Group_id: " + groupId + ", Server_id: " + previousServerId + ", Updated user_name: " + updatedUserName);
//("Marked as read in lime_data.db: Group_id: " + groupId + ", Server_id: " + previousServerId + ", Updated user_name: " + updatedUserName);
}
cursor.close();
@ -479,13 +479,13 @@ public class ReadChecker implements IHook {
writer.append("Missing serverId in paramValue:").append(paramValue).append("\n");
writer.close();
} catch (IOException e) {
// XposedBridge.log("Error writing paramValue to file: " + e.getMessage());
//("Error writing paramValue to file: " + e.getMessage());
}
}
private String queryDatabase(SQLiteDatabase db, String query, String... selectionArgs) {
if (db == null) {
// XposedBridge.log("Database is not initialized.");
//("Database is not initialized.");
return null;
}
Cursor cursor = db.rawQuery(query, selectionArgs);
@ -503,9 +503,9 @@ public class ReadChecker implements IHook {
if (oldDbFile.exists()) {
boolean deleted = oldDbFile.delete();
if (deleted) {
XposedBridge.log("Old database file lime_data.db deleted.");
//("Old database file lime_data.db deleted.");
} else {
XposedBridge.log("Failed to delete old database file lime_data.db.");
//("Failed to delete old database file lime_data.db.");
}
}
// 新しいデータベースファイルの初期化
@ -524,7 +524,7 @@ public class ReadChecker implements IHook {
");";
limeDatabase.execSQL(createGroupTable);
// XposedBridge.log("Database initialized and group_messages table created.");
//XposedBridge.log("Database initialized and group_messages table created.");
}
private void saveData(String groupId, String serverId, String checkedUser, String groupName, String content, String user_name, String createdTime, Context context) {
@ -551,7 +551,7 @@ public class ReadChecker implements IHook {
ContentValues values = new ContentValues();
values.put("user_name", updatedUserName);
limeDatabase.update("group_messages", values, "server_id=? AND checked_user=?", new String[]{serverId, checkedUser});
// XposedBridge.log("User name updated for server_id: " + serverId + ", checked_user: " + checkedUser);
//XposedBridge.log("User name updated for server_id: " + serverId + ", checked_user: " + checkedUser);
}
} else {
// 新しいレコードを挿入
@ -588,7 +588,7 @@ public class ReadChecker implements IHook {
values.put("user_name", updatedUserName);
limeDatabase.update("group_messages", values, "group_id=? AND server_id=?", new String[]{groupId, serverId});
// XposedBridge.log("Updated user_name for other records in group_id: " + groupId + ", server_id: " + serverId);
//XposedBridge.log("Updated user_name for other records in group_id: " + groupId + ", server_id: " + serverId);
}
}
} catch (Exception e) {
@ -606,8 +606,8 @@ public class ReadChecker implements IHook {
"VALUES(?, ?, ?, ?, ?, ?, ?);";
limeDatabase.execSQL(insertQuery, new Object[]{groupId, serverId, checkedUser, groupName, content, user_name, createdTime});
XposedBridge.log("Saved to DB: Group_Id: " + groupId + ", Server_id: " + serverId + ", Checked_user: " + checkedUser +
", Group_Name: " + groupName + ", Content: " + content + ", user_name: " + user_name + ", Created_Time: " + createdTime);
//XposedBridge.log("Saved to DB: Group_Id: " + groupId + ", Server_id: " + serverId + ", Checked_user: " + checkedUser +
// ", Group_Name: " + groupName + ", Content: " + content + ", user_name: " + user_name + ", Created_Time: " + createdTime);
} catch (Exception e) {
Log.e("insertNewRecord", "Error saving data to database:", e);
}