parent
e000d8384c
commit
13cf5e6872
6 changed files with 5 additions and 19 deletions
1
src/def.d.ts
vendored
1
src/def.d.ts
vendored
|
@ -369,7 +369,6 @@ interface VendettaObject {
|
|||
HTTP_REGEX: RegExp;
|
||||
};
|
||||
utils: {
|
||||
copyText: (content: string) => void;
|
||||
findInReactTree: (tree: SearchTree, filter: SearchFilter) => any;
|
||||
findInTree: (tree: SearchTree, filter: SearchFilter, options: FindInTreeOptions) => any;
|
||||
safeFetch: (input: RequestInfo, options: RequestInit) => Promise<Response>;
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
import { clipboard } from "@metro/common";
|
||||
|
||||
// TODO: Remove/deprecate this, the clipboard module works the same way.
|
||||
|
||||
export default function copyText(content: string) {
|
||||
try {
|
||||
clipboard.setString(content);
|
||||
} catch (e) {
|
||||
throw new Error("Failed to set clipboard content.");
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
// Makes mass-importing utils cleaner, chosen over moving utils to one file
|
||||
export { default as copyText } from "@utils/copyText";
|
||||
export { default as findInReactTree } from "@utils/findInReactTree";
|
||||
export { default as findInTree } from "@utils/findInTree";
|
||||
export { default as safeFetch } from "@utils/safeFetch";
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import { Asset } from "@types";
|
||||
import { ReactNative as RN, stylesheet } from "@metro/common";
|
||||
import { ReactNative as RN, stylesheet, clipboard } from "@metro/common";
|
||||
import { showToast } from "@ui/toasts";
|
||||
import { getAssetIDByName } from "@ui/assets";
|
||||
import { Forms } from "@ui/components";
|
||||
import copyText from "@lib/utils/copyText";
|
||||
|
||||
interface AssetDisplayProps {
|
||||
asset: Asset;
|
||||
|
@ -24,7 +23,7 @@ export default function AssetDisplay({ asset }: AssetDisplayProps) {
|
|||
label={`${asset.name} - ${asset.id}`}
|
||||
trailing={<RN.Image source={asset.id} style={styles.asset} />}
|
||||
onPress={() => {
|
||||
copyText(asset.name);
|
||||
clipboard.setString(asset.name);
|
||||
showToast("Copied asset name to clipboard.", getAssetIDByName("toast_copy_link"));
|
||||
}}
|
||||
/>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ReactNative as RN, clipboard, stylesheet } from "@metro/common";
|
||||
import { ReactNative as RN, stylesheet, clipboard } from "@metro/common";
|
||||
import { HTTP_REGEX } from "@lib/constants";
|
||||
import { showInputAlert } from "@ui/alerts";
|
||||
import { getAssetIDByName } from "@ui/assets";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { clipboard } from "@metro/common";
|
||||
import { getAssetIDByName } from "@ui/assets";
|
||||
import { showToast } from "@ui/toasts";
|
||||
import { Forms } from "@ui/components";
|
||||
import copyText from "@utils/copyText";
|
||||
|
||||
interface VersionProps {
|
||||
label: string;
|
||||
|
@ -18,7 +18,7 @@ export default function Version({ label, version, icon }: VersionProps) {
|
|||
leading={<FormRow.Icon source={getAssetIDByName(icon)} />}
|
||||
trailing={<FormText>{version}</FormText>}
|
||||
onPress={() => {
|
||||
copyText(`${label} - ${version}`);
|
||||
clipboard.setString(`${label} - ${version}`);
|
||||
showToast("Copied version to clipboard.", getAssetIDByName("toast_copy_link"));
|
||||
}}
|
||||
/>
|
||||
|
|
Loading…
Reference in a new issue