From cea8d1668d06a3e55cbec334fd83f78a4460ea03 Mon Sep 17 00:00:00 2001
From: Der_Googler <54764558+DerGoogler@users.noreply.github.com>
Date: Sun, 29 Oct 2023 00:12:11 +0200
Subject: [PATCH] Hover more low quality modules
---
Website/src/activitys/ModuleViewActivity.tsx | 12 +++++++++++-
Website/src/components/DeviceModule.tsx | 18 ++++++++++++++++--
Website/src/components/ExploreModule.tsx | 12 ++++++------
Website/src/locales/de.ts | 6 +++++-
Website/src/locales/en.ts | 6 +++++-
5 files changed, 43 insertions(+), 11 deletions(-)
diff --git a/Website/src/activitys/ModuleViewActivity.tsx b/Website/src/activitys/ModuleViewActivity.tsx
index d5aa43bb..f8257865 100644
--- a/Website/src/activitys/ModuleViewActivity.tsx
+++ b/Website/src/activitys/ModuleViewActivity.tsx
@@ -49,6 +49,7 @@ import PicturePreviewActivity from "./PicturePreviewActivity";
import GitHubIcon from "@mui/icons-material/GitHub";
import TerminalIcon from "@mui/icons-material/Terminal";
import { isLiteralObject } from "@Util/util";
+import { useLowQualityModule } from "@Hooks/useLowQualityModule";
function a11yProps(index: number) {
return {
@@ -93,6 +94,8 @@ const ModuleViewActivity = () => {
const search = React.useMemo(() => new URLSearchParams(window.location.search), [window.location.search]);
+ const isLowQuality = useLowQualityModule(extra, !settings._low_quality_module);
+
React.useEffect(() => {
search.set("module", id);
const newRelativePathQuery = window.location.pathname + "?" + search.toString();
@@ -347,6 +350,13 @@ const ModuleViewActivity = () => {
)}
+ {isLowQuality && (
+
+ {strings("low_quality_module")}
+ {strings("low_quality_module_warn")}
+
+ )}
+
{mmrl.screenshots && (
@@ -436,7 +446,7 @@ const ModuleViewActivity = () => {
- {isLiteralObject(description) ? String((description as ModuleDescription)[currentLanguage]) : String(description)}
+ {isLiteralObject(description) ? String((description as ModuleDescription)[currentLanguage]) : String(description)}
{strings("updated_on")}
diff --git a/Website/src/components/DeviceModule.tsx b/Website/src/components/DeviceModule.tsx
index b01ef6c5..e146846e 100644
--- a/Website/src/components/DeviceModule.tsx
+++ b/Website/src/components/DeviceModule.tsx
@@ -3,7 +3,7 @@ import { DeleteRounded, RefreshRounded } from "@mui/icons-material";
import React from "react";
import { useStrings } from "@Hooks/useStrings";
import { Android12Switch } from "./Android12Switch";
-import { Box, Button, Card, Divider, Stack, SxProps, Theme, Typography } from "@mui/material";
+import { Alert, AlertTitle, Box, Button, Card, Divider, Stack, SxProps, Theme, Typography } from "@mui/material";
import SettingsIcon from "@mui/icons-material/Settings";
import { useActivity } from "@Hooks/useActivity";
import { ConfigureActivity } from "@Activitys/ConfigureActivity";
@@ -15,6 +15,7 @@ import { useTheme } from "@Hooks/useTheme";
import TerminalActivity from "@Activitys/TerminalActivity";
import { useRepos } from "@Hooks/useRepos";
import { ModConf, useModConf } from "@Hooks/useModConf";
+import { useLowQualityModule } from "@Hooks/useLowQualityModule";
export const badgeStyle: (color: (typeof colors)["blue" | "teal" | "red" | "orange"]) => SxProps = (color) => {
return {
@@ -66,6 +67,10 @@ const DeviceModule = React.memo((props) => {
const findOnlineModule = React.useMemo(() => modules.find((module) => module.id === id), [modules]) as Module;
+ const hasUpdate = React.useMemo(() => findOnlineModule && versionCode < findOnlineModule.versionCode, [findOnlineModule]);
+
+ const isLowQuality = useLowQualityModule(props.module, !settings._low_quality_module);
+
return (
<>
((props) => {
)}
- {findOnlineModule && versionCode < findOnlineModule.versionCode && (
+ {isLowQuality && (
+
+ {strings("low_quality_module")}
+ {strings("low_quality_module_warn")}
+
+ )}
+ {hasUpdate && (
diff --git a/Website/src/locales/de.ts b/Website/src/locales/de.ts
index 28195373..e4fef7bf 100644
--- a/Website/src/locales/de.ts
+++ b/Website/src/locales/de.ts
@@ -65,7 +65,8 @@ export const de = {
// Explore Module View
verified_module: "Verifiziertes Modul",
- verified_module_desc: "Dieses Modul wurde einer Überprüfung unterzogen und wurde als vertrauenswürdiges Modul bestätigt, das von einem seriösen Entwickler entwickelt wurde.",
+ verified_module_desc:
+ "Dieses Modul wurde einer Überprüfung unterzogen und wurde als vertrauenswürdiges Modul bestätigt, das von einem seriösen Entwickler entwickelt wurde.",
update_json: "Verwendet eigene Update.json",
update_json_desc: "Dieses Modul verwendet seine eigene update.json für Aktualisierungs- und Installationszwecke.",
@@ -77,8 +78,11 @@ export const de = {
module: "Modul",
+ low_quality_module: "Modul von geringer Qualität",
low_quality_modules: "Module von geringer Qualität",
low_quality_modules_subtitle: "Zeigt eine Warnung unterhalb des Moduls an, wenn es eine niedrige Qualität hat",
+ low_quality_module_warn:
+ "Diesem Magisk-Modul fehlen wichtige Eigenschaften wie ID, Version, Versionscode, Autor usw., was sich auf seine Funktionalität und Herkunft auswirken kann.",
invaild_modules: "Ungültige Module",
invaild_modules_subtitle: "Ungültige Module anzeigen",
diff --git a/Website/src/locales/en.ts b/Website/src/locales/en.ts
index 9ab3e8bf..634da1cb 100644
--- a/Website/src/locales/en.ts
+++ b/Website/src/locales/en.ts
@@ -63,7 +63,8 @@ export const en = {
// Explore Module View
verified_module: "Verified module",
- verified_module_desc: "This module has undergone verification and has been confirmed as a trusted module developed by a reputable developer.",
+ verified_module_desc:
+ "This module has undergone verification and has been confirmed as a trusted module developed by a reputable developer.",
update_json: "Uses own update.json",
update_json_desc: "This module utilizes its own update.json for updating and installation purposes.",
@@ -75,8 +76,11 @@ export const en = {
module: "Module",
+ low_quality_module: "Low quality module",
low_quality_modules: "Low quality modules",
low_quality_modules_subtitle: "Shows a alert below the module if it has a low quality",
+ low_quality_module_warn:
+ "This Magisk module is missing crucial properties, such as id, version, versionCode, author, etc., which may affect its functionality and origin.",
invaild_modules: "Invaild modules",
invaild_modules_subtitle: "Show invaild modules",