64 lines
2.7 KiB
TypeScript
64 lines
2.7 KiB
TypeScript
// Metro module 14488 (f14489).
|
|
import { createElement, useState } from "react";
|
|
import { View } from "react-native";
|
|
import UserStore from "../../../stores/UserStore";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import { FreemiumAppIconIds } from "../AppIconTypes";
|
|
import { TableRowGroup } from "../../../design/components/TableRow/native/TableRowGroup.native";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import AppIconRow from "./AppIconRow/AppIconRow";
|
|
import { useAppIcons } from "./AppIconUtils";
|
|
import { useStateFromStores } from "../../../_bundle/Module589";
|
|
import * as _PremiumTypeUtils from "../../../utils/PremiumTypeUtils";
|
|
import { HermesBuiltin } from "../../../_hermes/prelude";
|
|
let useStyles;
|
|
const BackwardsCompatibleAppIconRows = function BackwardsCompatibleAppIconRows(props) {
|
|
if (props == null) {
|
|
HermesBuiltin.throwTypeError("Cannot destructure 'undefined' or 'null'.");
|
|
throw new Error("unreachable");
|
|
}
|
|
let state, setState;
|
|
const r3 = HermesBuiltin.copyDataProperties({}, props, void 0);
|
|
let c21201_0 = r3;
|
|
state = void 0;
|
|
setState = void 0;
|
|
const onLongPress2 = function onLongPress(a0) {
|
|
return a0 === FreemiumAppIconIds.DEFAULT ? setState(true) : null;
|
|
};
|
|
const styles = useStyles();
|
|
[state, setState] = useState(false);
|
|
const icons = r3.icons;
|
|
return <View style={styles.container}>
|
|
<TableRowGroup title={r3.title} accessibilityRole="radiogroup" accessibilityLabel={intl.string(t.N4YDao)} hasIcons>
|
|
{icons.map((a0) => createElement(AppIconRow, {
|
|
...c21201_0,
|
|
key: a0.id,
|
|
icon: a0,
|
|
showEasterEgg: state,
|
|
onLongPress: onLongPress2
|
|
}))}
|
|
</TableRowGroup>
|
|
</View>;
|
|
};
|
|
useStyles = createStyles({
|
|
container: {
|
|
padding: 16
|
|
},
|
|
bottomUpsellPadding: {
|
|
paddingBottom: 56
|
|
}
|
|
});
|
|
export default function AppIconRows(props) {
|
|
const onSelect = props.onSelect;
|
|
const styles = useStyles();
|
|
const appIcons = useAppIcons();
|
|
const { officialAppIcons, limitedTimeAppIcons, currentAppIcon } = appIcons;
|
|
const isPremium = _PremiumTypeUtils.isPremium(useStateFromStores([UserStore], () => UserStore.getCurrentUser()));
|
|
const r2 = limitedTimeAppIcons.length > 0 && limitedTimeAppIcons.filter((limitedTimeAppIcon) => !limitedTimeAppIcon.isHidden).length > 0;
|
|
return <>
|
|
{[r2 ? <BackwardsCompatibleAppIconRows hasNitro={isPremium} icons={limitedTimeAppIcons} currentAppIcon={currentAppIcon} title={intl.string(t.anqaFd)} onSelect={onSelect} /> : null, <View style={isPremium ? !isPremium : styles.bottomUpsellPadding}>
|
|
<BackwardsCompatibleAppIconRows hasNitro={isPremium} icons={officialAppIcons} currentAppIcon={currentAppIcon} title={r2 ? intl.string(t.Ipxkog) : void 0} onSelect={onSelect} />
|
|
</View>]}
|
|
</>;
|
|
};
|