Skip to content

Commit

Permalink
Use i18n instead of findByProps
Browse files Browse the repository at this point in the history
this improves performance a bit
  • Loading branch information
fres621 committed May 11, 2024
1 parent 8d444c1 commit ddeba80
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions plugins/FileContentPreview/patches/RowManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import { findByProps, findByName } from "@vendetta/metro";
import { after, before } from "@vendetta/patcher";
import translations from "../translations";
import filetypes from "../filetypes";
import { ReactNative } from "@vendetta/metro/common";
import { ReactNative, i18n } from "@vendetta/metro/common";

const RowManager = findByName("RowManager");

const Locale = findByProps("Messages");
const loc = findByProps("getLocale");

function makeRPL(filename = "unknown", size = "? bytes") {
return { borderColor: -251658241,
Expand All @@ -20,7 +19,7 @@ function makeRPL(filename = "unknown", size = "? bytes") {
type: null,
extendedType: 4,
participantAvatarUris: [],
acceptLabelText: translations.PREVIEW[loc.getLocale()] ?? "Preview",
acceptLabelText: translations.PREVIEW[i18n.getLocale()] ?? "Preview",
noParticipantsText: '\n' + filename,
ctaEnabled: true }
};
Expand Down

0 comments on commit ddeba80

Please sign in to comment.