Skip to content

Commit

Permalink
add minApi back
Browse files Browse the repository at this point in the history
  • Loading branch information
DerGoogler committed Jul 2, 2024
1 parent 32a4219 commit 968a2d8
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 76 deletions.
12 changes: 10 additions & 2 deletions Website/src/activitys/ModuleViewActivity/tabs/OverviewTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ import { ModuleViewActivity } from "..";
import { useRepos } from "@Hooks/useRepos";
import { blacklistedModules } from "@Util/blacklisted-modules";
import { useModuleInfo } from "@Hooks/useModuleInfo";
import { Build } from "@Native/Build";
import { os } from "@Native/Os";

const OverviewTab = () => {
const { strings } = useStrings();
const { context, extra } = useActivity<Module>();
const { settings } = useSettings();
const { modules } = useRepos();
const { id, name, description, versions, track } = extra;
const { id, name, description, versions, minApi, track } = extra;

const { icon, screenshots, require, readme: moduleReadme, categories } = useModuleInfo(extra);

Expand Down Expand Up @@ -66,12 +68,18 @@ const OverviewTab = () => {
<>
<Stack direction="column" justifyContent="center" alignItems="flex-start" spacing={1}>
{isLowQuality && (
<Alert severity="warning">
<Alert sx={{ width: "100%" }} severity="warning">
<AlertTitle>{strings("low_quality_module")}</AlertTitle>
{strings("low_quality_module_warn")}
</Alert>
)}

{minApi && minApi > os.sdk && (
<Alert sx={{ width: "100%" }} severity="warning">
{strings("module_require_android_ver", { andro_ver: Build.parseVersion(minApi) })}
</Alert>
)}

<Card
sx={{
width: "100%",
Expand Down
2 changes: 2 additions & 0 deletions Website/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,6 @@ export const en = {

exit_app: "Exit app?",
exit_app_desc: "Are you sure that you want to leave the app?",

module_require_android_ver: "This module requires {andro_ver}. It may doesn't work for your device."
};
73 changes: 73 additions & 0 deletions Website/src/native/Build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,79 @@ class Build {

public static TIRAMISU = 33;
};

public static parseVersion(version: number) {
switch (version) {
case this.VERSION_CODES.BASE:
return "Android 1.0";
case this.VERSION_CODES.BASE_1_1:
return "Android 1.1 (Petit Four)";
case this.VERSION_CODES.CUPCAKE:
return "Android 1.5 (Cupcake)";
case this.VERSION_CODES.DONUT:
return "Android 1.6 (Donut)";
case this.VERSION_CODES.ECLAIR:
return "Android 2.0 (Eclair)";
case this.VERSION_CODES.ECLAIR_0_1:
return "Android 2.0.1 (Eclair)";
case this.VERSION_CODES.ECLAIR_MR1:
return "Android 2.1 (Eclair)";
case this.VERSION_CODES.FROYO:
return "Android 2.2 (Froyo)";
case this.VERSION_CODES.GINGERBREAD:
return "Android 2.3.0 - 2.3.2 (Gingerbread)";
case this.VERSION_CODES.GINGERBREAD_MR1:
return "Android 2.3.3 - 2.3.7 (Gingerbread)";
case this.VERSION_CODES.HONEYCOMB:
return "Android 3.0 (Honeycomb)";
case this.VERSION_CODES.HONEYCOMB_MR1:
return "Android 3.1 (Honeycomb)";
case this.VERSION_CODES.HONEYCOMB_MR2:
return "Android 3.2 (Honeycomb)";
case this.VERSION_CODES.ICE_CREAM_SANDWICH:
return "Android 4.0.1 - 4.0.2 (Ice Cream Sandwich)";
case this.VERSION_CODES.ICE_CREAM_SANDWICH_MR1:
return "Android 4.0.3 - 4.0.4 (Ice Cream Sandwich)";
case this.VERSION_CODES.JELLY_BEAN:
return "Android 4.1 (Jelly Bean)";
case this.VERSION_CODES.JELLY_BEAN_MR1:
return "Android 4.2 (Jelly Bean)";
case this.VERSION_CODES.JELLY_BEAN_MR2:
return "Android 4.3 (Jelly Bean)";
case this.VERSION_CODES.KITKAT:
return "Android 4.4 (KikKat)";
case this.VERSION_CODES.KITKAT_WATCH:
return "Android 4.4 (KitKat)";
case this.VERSION_CODES.LOLLIPOP:
return "Android 5.0 (Lollipop)";
case this.VERSION_CODES.LOLLIPOP_MR1:
return "Android 5.1 (Lollipop)";
case this.VERSION_CODES.M:
return "Android 6.0 (Marshmallow)";
case this.VERSION_CODES.N:
return "Android 7.0 (Nougat)";
case this.VERSION_CODES.N_MR1:
return "Android 7.1 (Nougat)";
case this.VERSION_CODES.O:
return "Android 8.0 (Oreo)";
case this.VERSION_CODES.O_MR1:
return "Android 8.1 (Oreo)";
case this.VERSION_CODES.P:
return "Android 9.0 (Pie)";
case this.VERSION_CODES.Q:
return "Android 10 (Quince Tart)";
case this.VERSION_CODES.R:
return "Android 11 (Red Velvet Cake)";
case this.VERSION_CODES.S:
return "Android 12 (Snow Cone)";
case this.VERSION_CODES.S_V2:
return "Android 12L (Snow Cone)";
case this.VERSION_CODES.TIRAMISU:
return "Android 12 (Tiramisu)";
default:
return "Sdk: " + version;
}
}
}

export { Build };
74 changes: 0 additions & 74 deletions Website/src/util/parseAndroidVersion.ts

This file was deleted.

0 comments on commit 968a2d8

Please sign in to comment.