112 lines
4.0 KiB
TypeScript
112 lines
4.0 KiB
TypeScript
// Metro module 13008 (f13009).
|
|
import { Image as Image2, View } from "react-native";
|
|
import BuildOverrideStore from "../BuildOverrideStore";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import useTheme from "../../../hooks/useTheme";
|
|
import { isThemeDark } from "../../../design/shared";
|
|
import Module13009 from "../../../_bundle/Module13009";
|
|
import Module13010 from "../../../_bundle/Module13010";
|
|
import { useStateFromStores } from "../../../_bundle/Module589";
|
|
import { DEVICE_FIELD, setBuildOverrideFromLink } from "./BuildOverrideUtils";
|
|
import Module3771 from "../../../_bundle/Module3771";
|
|
import { SafeAreaPaddingView } from "../../../components_native/common/SafeAreaView";
|
|
import { Text } from "../../../design/components/Text/native/Text";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import { Button } from "../../../design/components/Button/native/Button.native";
|
|
import ModalActionCreators from "../../../actions/ModalActionCreators";
|
|
const useStyles = createStyles({
|
|
container: {
|
|
flex: 1,
|
|
height: "100%",
|
|
alignItems: "center",
|
|
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER,
|
|
paddingHorizontal: 16
|
|
},
|
|
content: {
|
|
marginTop: 160,
|
|
flex: 1,
|
|
alignItems: "center"
|
|
},
|
|
imageWrapper: {
|
|
width: 100,
|
|
height: 100,
|
|
borderRadius: Module712.radii.round,
|
|
marginBottom: 16,
|
|
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST,
|
|
alignItems: "center",
|
|
justifyContent: "center"
|
|
},
|
|
text: {
|
|
lineHeight: 24,
|
|
textAlign: "center"
|
|
},
|
|
buildOverrideName: {
|
|
marginTop: 8
|
|
},
|
|
buildOverrideExpiration: {
|
|
lineHeight: 24
|
|
},
|
|
buildOverrideInvalid: {
|
|
marginTop: 8
|
|
},
|
|
buttonWrapper: {
|
|
alignSelf: "stretch"
|
|
},
|
|
actionButton: {
|
|
marginBottom: 8
|
|
}
|
|
});
|
|
export default function BuildOverrideModal(props) {
|
|
let overrideUrl = props.overrideUrl;
|
|
if (overrideUrl === void 0) {
|
|
overrideUrl = "";
|
|
}
|
|
let c20336_0 = overrideUrl;
|
|
const styles = useStyles();
|
|
const source = isThemeDark(useTheme()) ? Module13009 : Module13010;
|
|
const stateFromStores = useStateFromStores([BuildOverrideStore], () => BuildOverrideStore.getBuildOverride(c20336_0), [overrideUrl]);
|
|
const override = stateFromStores.override;
|
|
const r2 = override == null;
|
|
let r10 = void 0;
|
|
if (!r2) {
|
|
const targetBuildOverride = override.targetBuildOverride;
|
|
r10 = targetBuildOverride == null ? void 0 : targetBuildOverride[DEVICE_FIELD]?.id;
|
|
}
|
|
const expirationDuration = Module3771.duration(Module3771().diff(override?.expiresAt)).humanize();
|
|
return <SafeAreaPaddingView top bottom style={styles.container}>
|
|
<View style={styles.content}>
|
|
<View style={styles.imageWrapper}>
|
|
<Image2 source={source} />
|
|
</View>
|
|
<Text style={styles.text} variant="text-md/medium">
|
|
{intl.string(t["6ILkNN"])}
|
|
</Text>
|
|
{r10 != null ? <>
|
|
<Text style={styles.buildOverrideName} variant="heading-xl/extrabold" color="mobile-text-heading-primary">{r10}</Text>
|
|
<Text style={styles.buildOverrideExpiration} variant="text-md/medium" color="text-default">
|
|
{intl.format(t.lOsPpu, {
|
|
expirationDuration
|
|
})}
|
|
</Text>
|
|
</> : <Text style={styles.buildOverrideInvalid} variant="heading-xl/extrabold" color="mobile-text-heading-primary">
|
|
{intl.string(t["cz+sue"])}
|
|
</Text>}
|
|
</View>
|
|
<View style={styles.buttonWrapper}>
|
|
{r10 != null ? <>
|
|
<View style={styles.actionButton}>
|
|
<Button text={intl.string(t.v0MBqF)} grow onPress={() => {
|
|
let validatedURL = stateFromStores.validatedURL;
|
|
if (validatedURL == null) {
|
|
validatedURL = "";
|
|
}
|
|
setBuildOverrideFromLink(validatedURL);
|
|
}} />
|
|
</View>
|
|
<Button text={intl.string(t.b5KKph)} variant="secondary" grow onPress={() => ModalActionCreators.pop()} />
|
|
</> : <Button text={intl.string(t.WRkdCQ)} grow onPress={() => ModalActionCreators.pop()} />}
|
|
</View>
|
|
</SafeAreaPaddingView>;
|
|
};
|