This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

+166
View File
@@ -0,0 +1,166 @@
// Metro module 11972 (f11973).
import { StatusTypes } from "../../_bundle/Module505";
import { humanizeStatus } from "../../utils/UserUtils";
import { intl, t } from "../../intl/index.native";
const r20 = Object.freeze({
MINUTES_30: 1800000,
HOURS_1: 3600000,
HOURS_4: 14400000,
TODAY: "TODAY",
DONT_CLEAR: "DONT_CLEAR"
});
const r24 = [{
value: StatusTypes.ONLINE,
label: () => humanizeStatus(StatusTypes.ONLINE)
}, {
value: StatusTypes.IDLE,
label: () => humanizeStatus(StatusTypes.IDLE)
}, {
value: StatusTypes.DND,
label: () => humanizeStatus(StatusTypes.DND)
}, {
value: StatusTypes.INVISIBLE,
label: () => humanizeStatus(StatusTypes.INVISIBLE)
}];
const r35 = [r20.TODAY, r20.HOURS_4, r20.HOURS_1, r20.MINUTES_30, r20.DONT_CLEAR];
const r40 = {
PLAYING: "PLAYING",
LISTENING_TO: "LISTENING_TO",
WATCHING: "WATCHING",
CURRENT_OBSESSION: "CURRENT_OBSESSION",
SHOWER_THOUGHT: "SHOWER_THOUGHT",
TODAY_I_LEARNED: "TODAY_I_LEARNED",
HOT_TAKE: "HOT_TAKE",
DAD_JOKE: "DAD_JOKE",
EMOJI_DAY: "EMOJI_DAY",
USELESS_TALENT: "USELESS_TALENT",
VIDEO_GAME_ITEM: "VIDEO_GAME_ITEM",
READING: "READING",
SONG_STUCK: "SONG_STUCK",
MOST_USED_EMOJI: "MOST_USED_EMOJI",
BEST_FOOD: "BEST_FOOD",
FICTIONAL_WORLD: "FICTIONAL_WORLD",
USERNAME_ORIGIN: "USERNAME_ORIGIN",
THEME_SONG: "THEME_SONG",
FAVORITE_COLLECTIBLE: "FAVORITE_COLLECTIBLE",
GAME_MECHANIC: "GAME_MECHANIC",
NPC_COMPANION: "NPC_COMPANION",
FOOD_CRAVING: "FOOD_CRAVING",
MYTHICAL_PET: "MYTHICAL_PET",
LATEST_HOBBY: "LATEST_HOBBY",
FAVORITE_ANIME: "FAVORITE_ANIME",
RANKED_UP: "RANKED_UP",
CHARACTER_CLASS: "CHARACTER_CLASS",
HIGH_SCORE: "HIGH_SCORE",
FINISHED_PLAYING: "FINISHED_PLAYING",
FINISHED_READING: "FINISHED_READING",
CANT_WAIT: "CANT_WAIT",
ADD_STATUS: "ADD_STATUS",
WHATS_ON_YOUR_MIND: "WHATS_ON_YOUR_MIND"
};
const r76 = [{
value: r40.PLAYING,
label: () => intl.string(t.r5TNmx)
}, {
value: r40.LISTENING_TO,
label: () => intl.string(t["ylzor/"])
}, {
value: r40.WATCHING,
label: () => intl.string(t.pzz9iP)
}, {
value: r40.CURRENT_OBSESSION,
label: () => intl.string(t.xaCthD)
}, {
value: r40.SHOWER_THOUGHT,
label: () => intl.string(t.Wf8fxL)
}, {
value: r40.TODAY_I_LEARNED,
label: () => intl.string(t.pycKiy)
}, {
value: r40.HOT_TAKE,
label: () => intl.string(t.l3pZci)
}, {
value: r40.DAD_JOKE,
label: () => intl.string(t["3XVZ0v"])
}, {
value: r40.EMOJI_DAY,
label: () => intl.string(t["4U+EJP"])
}, {
value: r40.USELESS_TALENT,
label: () => intl.string(t["Z3Vn/X"])
}, {
value: r40.VIDEO_GAME_ITEM,
label: () => intl.string(t.PiepBk)
}, {
value: r40.READING,
label: () => intl.string(t.pYQRnN)
}, {
value: r40.SONG_STUCK,
label: () => intl.string(t.S7UJ0u)
}, {
value: r40.MOST_USED_EMOJI,
label: () => intl.string(t["1TlHwx"])
}, {
value: r40.BEST_FOOD,
label: () => intl.string(t.ZPjuez)
}, {
value: r40.FICTIONAL_WORLD,
label: () => intl.string(t.lyOeXL)
}, {
value: r40.USERNAME_ORIGIN,
label: () => intl.string(t.l6Yb3T)
}, {
value: r40.THEME_SONG,
label: () => intl.string(t.Vok4QU)
}, {
value: r40.FAVORITE_COLLECTIBLE,
label: () => intl.string(t.T24umy)
}, {
value: r40.GAME_MECHANIC,
label: () => intl.string(t.kzToEh)
}, {
value: r40.NPC_COMPANION,
label: () => intl.string(t["/Zm5VV"])
}, {
value: r40.FOOD_CRAVING,
label: () => intl.string(t.ujnXus)
}, {
value: r40.MYTHICAL_PET,
label: () => intl.string(t["45r7ue"])
}, {
value: r40.LATEST_HOBBY,
label: () => intl.string(t.SluNa8)
}, {
value: r40.FAVORITE_ANIME,
label: () => intl.string(t.R1f9RT)
}, {
value: r40.RANKED_UP,
label: () => intl.string(t.nXJgjn)
}, {
value: r40.CHARACTER_CLASS,
label: () => intl.string(t.SWVxPM)
}, {
value: r40.HIGH_SCORE,
label: () => intl.string(t.gbUeX7)
}, {
value: r40.FINISHED_PLAYING,
label: () => intl.string(t.bIrdLj)
}, {
value: r40.FINISHED_READING,
label: () => intl.string(t["tcQn+J"])
}, {
value: r40.CANT_WAIT,
label: () => intl.string(t["40gTjw"])
}, {
value: r40.ADD_STATUS,
label: () => intl.string(t.Vq4UmS)
}, {
value: r40.WHATS_ON_YOUR_MIND,
label: () => intl.string(t.xod367)
}];
export const STATUS_MAX_LENGTH = 128;
export { r20 as ClearAfterValues };
export { r24 as StatusOptions };
export { r35 as ClearAfterOptions };
export { r40 as CustomStatusPromptValues };
export { r76 as CustomStatusPrompts };
@@ -0,0 +1,116 @@
// Metro module 16157 (f16158).
import SelfPresenceStore from "../../stores/SelfPresenceStore";
import { AnalyticsObjects, StatusTypes } from "../../Constants";
import { Timeout } from "../../_bundle/Timeout";
import AutomaticLifecycleManager from "../../lib/AutomaticLifecycleManager";
import { CustomStatusSetting, StatusExpiresAtSetting, StatusCreatedAtSetting, FocusModeExpiresAtSetting } from "../user_settings/UserSettings";
import setUserStatus from "../multi_account/setUserStatus";
import { PreloadedUserSettingsActionCreators, UserSettingsDelay } from "../user_settings/UserSettingsProtoActionCreators";
import { UInt64Value } from "../../_bundle/Module1337";
import { setFocusMode } from "../notifications/FocusModeUtils";
let c11576_6 = new Timeout();
let c11576_7 = new Timeout();
let c11576_8 = new Timeout();
class CustomStatusManager extends AutomaticLifecycleManager {
actions = {
POST_CONNECTION_OPEN: () => this.handlePostConnectionOpen(),
USER_SETTINGS_PROTO_UPDATE: () => this.handleUserSettingsProtoUpdate()
};
handlePostConnectionOpen = () => {
this.handleCommonUpdates();
};
handleUserSettingsProtoUpdate = () => {
this.handleCommonUpdates();
};
handleCommonUpdates = () => {
this.manageExpiringCustomStatus();
this.manageExpiringStatus();
this.lazilyMigrateStatusCreatedAt();
this.manageExpiringFocusMode();
};
manageExpiringCustomStatus = () => {
L9: {
const setting = CustomStatusSetting.getSetting();
if (setting == null) {
c11576_8.stop();
} else {
if (setting.expiresAtMs != null && setting.expiresAtMs !== "0") {
const r37 = new Date(Number(setting.expiresAtMs)).getTime() - new Date().getTime();
if (r37 > 0) {
c11576_8.start(r37, () => {
CustomStatusSetting.updateSetting(void 0);
}, true);
break L9;
}
CustomStatusSetting.updateSetting(void 0);
c11576_8.stop();
break L9;
}
if (c11576_8 != null) {
c11576_8.stop();
}
}
}
};
manageExpiringStatus = () => {
L8: {
const setting = StatusExpiresAtSetting.getSetting();
if (setting != null && (setting !== "0" && SelfPresenceStore.getStatus() !== StatusTypes.ONLINE)) {
const r39 = new Date(Number(setting)).getTime() - new Date().getTime();
if (r39 > 0) {
c11576_6.start(r39, () => {
setUserStatus({
nextStatus: StatusTypes.ONLINE,
analyticsContext: {
location: {
object: AnalyticsObjects.CUSTOM_STATUS_MANAGER
}
}
});
}, true);
break L8;
}
setUserStatus({
nextStatus: StatusTypes.ONLINE,
analyticsContext: {
location: {
object: AnalyticsObjects.CUSTOM_STATUS_MANAGER
}
}
});
c11576_6.stop();
} else if (c11576_6 != null) {
c11576_6.stop();
}
}
};
lazilyMigrateStatusCreatedAt = () => {
if (SelfPresenceStore.getStatus() !== StatusTypes.ONLINE && StatusCreatedAtSetting.getSetting() == null) {
PreloadedUserSettingsActionCreators.updateAsync("status", (a0) => {
a0.statusCreatedAtMs = UInt64Value.create({
value: `${Date.now()}`
});
}, UserSettingsDelay.INFREQUENT_USER_ACTION);
}
};
manageExpiringFocusMode = () => {
L7: {
const setting = FocusModeExpiresAtSetting.getSetting();
if (setting != null && setting !== "0") {
const r34 = new Date(Number(setting)).getTime() - new Date().getTime();
if (r34 > 0) {
c11576_7.start(r34, () => {
setFocusMode(false);
}, true);
break L7;
}
setFocusMode(false);
c11576_7.stop();
} else if (c11576_7 != null) {
c11576_7.stop();
}
}
};
}
const customStatusManager = new CustomStatusManager();
export default customStatusManager;
@@ -0,0 +1,39 @@
// Metro module 11981 (f11982).
import { useState } from "react";
import { View } from "react-native";
import { ClearAfterOptions } from "../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
import { BottomSheetTitleHeader } from "../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { intl, t } from "../../../intl/index.native";
import { TableRadioGroup } from "../../../design/components/TableRow/native/TableRadioGroup.native";
import { TableRadioRow } from "../../../design/components/TableRow/native/TableRadioRow.native";
import formatClearAfterOption from "../utils/formatClearAfterOption";
import { Button } from "../../../design/components/Button/native/Button.native";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
const useStyles = createStyles({
content: {
paddingHorizontal: Module712.space.PX_16
},
buttonWrapper: {
marginTop: Module712.space.PX_24,
paddingBottom: Module712.space.PX_16
}
});
export default function ClearAfterOptionsActionSheet(props) {
const { initialValue, onChange } = props;
const styles = useStyles();
const [state, onChange2] = useState(initialValue);
return <BottomSheet contentStyles={styles.content} header={<BottomSheetTitleHeader title={intl.string(t["5XnRQ+"])} />}>
<TableRadioGroup onChange={onChange2} title={intl.string(t.E45wvP)} defaultValue={initialValue} hasIcons={false}>
{ClearAfterOptions.map((clearAfterOption) => <TableRadioRow key={clearAfterOption} value={clearAfterOption} label={formatClearAfterOption(clearAfterOption)} />)}
</TableRadioGroup>
<View style={styles.buttonWrapper}>
<Button onPress={function onPress() {
onChange(state);
ActionSheetActionCreators.hideActionSheet();
}} text={intl.string(t.TyCVIq)} />
</View>
</BottomSheet>;
};
@@ -0,0 +1,79 @@
// Metro module 11978 (f11979).
import { useCallback } from "react";
import { View } from "react-native";
import { PROFILE_CONTENT_WITHOUT_STATUS_TOP_PADDING, UserProfileThemeTypes } from "../../user_profile/native/Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useDisplayProfile from "../../user_profile/hooks/useDisplayProfile";
import useBadges from "../../user_profile/hooks/useBadges";
import useProfileTheme from "../../user_profile/hooks/useProfileTheme";
import UserProfileSharedStyles from "../../user_profile/native/UserProfileSharedStyles";
import { useUserProfileColors } from "../../user_profile/hooks/native/useUserProfileColors";
import { dismissKeyboard } from "../../../utils/native/ChatInputUtils";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { ThemeContextProvider } from "../../../_bundle/Module3901";
import UserProfileBanner from "../../user_profile/native/UserProfileBanner";
import UserProfileAvatar from "../../user_profile/native/UserProfileAvatar";
import UserProfileGradientContainer from "../../user_profile/native/UserProfileGradientContainer";
import UserProfileCustomStatusBubble from "../../user_profile/native/UserProfileCustomStatusBubble";
import UserProfilePrimaryInfo from "../../user_profile/native/UserProfilePrimaryInfo";
import ProfileEffect from "../../collectibles/profile_effects/native/ProfileEffect";
const useStyles = createStyles((a0) => ({
profileContainer: {
flex: 1,
position: "relative",
overflow: "hidden",
width: 323,
maxHeight: 301,
borderWidth: a0 ? void 0 : 1,
borderColor: a0 ? Module712.colors.BORDER_MUTED : Module712.colors.BACKGROUND_SURFACE_HIGH,
borderRadius: Module712.radii.lg,
...Module712.shadows.SHADOW_HIGH
},
profileEffect: {
zIndex: 1
}
}));
export default function CustomStatusPreview(props) {
const { user, pendingStatusText, pendingStatusEmoji, placeholderText } = props;
const displayProfile = useDisplayProfile(user.id);
const badges = useBadges(displayProfile);
const profileTheme = useProfileTheme({
user,
displayProfile
});
const { theme, primaryColor, secondaryColor } = profileTheme;
const hasCustomProfileTheme = primaryColor != null;
const styles = useStyles(hasCustomProfileTheme);
const styles2 = UserProfileSharedStyles();
const userProfileColors = useUserProfileColors({
theme,
primaryColor,
secondaryColor
});
const { gradientFallbackBackground, avatarBackground, containerBackground } = userProfileColors;
const callback = useCallback(() => {
dismissKeyboard();
ActionSheetActionCreators.openLazy(import("../../user_profile/native/UserProfileCustomStatusActionSheet"), "UserProfileCustomStatusActionSheet", {
user,
previewText: pendingStatusText,
previewEmoji: pendingStatusEmoji
}, "stack");
}, [user, pendingStatusText, pendingStatusEmoji]);
const r64 = [<UserProfileBanner user={user} displayProfile={displayProfile} bannerHeight={132} disableInteraction />, , ,];
const r68 = [<UserProfileAvatar user={user} backgroundColor={avatarBackground} disableStatus />, ,];
const containerStyle = [styles2.profileContentWrapper, styles2.profileContent, ,];
const r1 = pendingStatusText !== "" || pendingStatusEmoji !== null || placeholderText !== "";
containerStyle[2] = r1 ? !r1 : {
paddingTop: PROFILE_CONTENT_WITHOUT_STATUS_TOP_PADDING
};
r68[1] = <UserProfileGradientContainer fallbackBackground={gradientFallbackBackground} primaryColor={primaryColor} secondaryColor={primaryColor} containerStyle={containerStyle}>
<UserProfileCustomStatusBubble hasCustomProfileTheme={hasCustomProfileTheme} style={styles2.customStatusBubble} emojiOnlyStyle={styles2.emojiOnlyCustomStatusBubble} onPressTruncatedStatus={callback} previewEmoji={pendingStatusEmoji} previewText={pendingStatusText} placeholderText={placeholderText} />
<UserProfilePrimaryInfo user={user} themeType={UserProfileThemeTypes.PREVIEW} pronouns={displayProfile?.pronouns} badges={badges} badgeContainerBackground={containerBackground} showBadgeToastOnPress={false} />
</UserProfileGradientContainer>;
r64[1] = <View>{r68}</View>;
r64[2] = displayProfile?.profileEffect != null && <ProfileEffect skuId={displayProfile == null ? void 0 : displayProfile.profileEffect.skuId} style={styles.profileEffect} />;
return <ThemeContextProvider theme={theme} primaryColor={primaryColor} secondaryColor={secondaryColor}>
<View style={[styles.profileContainer]}>{r64}</View>
</ThemeContextProvider>;
};
@@ -0,0 +1,10 @@
// Metro module 11970 (f11971).
import ModalActionCreators from "../../../actions/ModalActionCreators";
export function openEditCustomStatusModal({ analyticsLocations, prompt }) {
ModalActionCreators.pushLazy(import("./EditCustomStatusWithPreview"), {
analyticsLocations,
prompt
}, void 0, {
presentation: "modal"
});
}
@@ -0,0 +1,315 @@
// Metro module 11971 (f11972).
import { useRef, useEffect, useState, useCallback, useMemo, useLayoutEffect } from "react";
import { ScrollView, View } from "react-native";
import UserStore from "../../../stores/UserStore";
import { STATUS_MAX_LENGTH } from "../Constants";
import { AnalyticEvents, AnalyticsSections, NOOP, Fonts } from "../../../Constants";
import { EmojiIntention } from "../../emojis/EmojiConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
import { intl, t } from "../../../intl/index.native";
import { Icon } from "../../../design/void/native";
import Module8998 from "../../../_bundle/Module8998";
import getRandomCustomStatusPrompt from "../utils/getRandomCustomStatusPrompt";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { useCustomStatusActivity } from "../utils/userSettingToActivity";
import { useStateFromStores } from "../../../_bundle/Module589";
import computeInitialClearAfter from "../utils/computeInitialClearAfter";
import setCustomStatus from "../setCustomStatus";
import { AccessibilityAnnouncer } from "../../../design/shared";
import removeCustomStatus from "../utils/removeCustomStatus";
import { setAccessibilityFocus } from "../../a11y/native/setAccessibilityFocus.android";
import { openEmojiPickerActionSheet } from "../../emoji_picker/native/openEmojiPickerActionSheet";
import useSafeAreaInsetsKeyboardAware_native from "../../safe_area/useSafeAreaInsetsKeyboardAware.native";
import useSafeAreaAvoidingInputs_native from "../../safe_area/useSafeAreaAvoidingInputs.native";
import maybeShowDiscardChangesAlert from "../../user_settings/profiles/native/maybeShowDiscardChangesAlert";
import { dismissKeyboard } from "../../../utils/native/ChatInputUtils";
import CustomStatusPreview from "./CustomStatusPreview";
import { HeaderTextButton, GenericHeaderTitle } from "../../main_tabs_v2/native/shared_components/HeaderShared";
import { getHeaderCloseButton } from "../../../design/components/Navigator/native/NavigatorHeader.native";
import { Text } from "../../../design/components/Text/native/Text";
import ActivityEmoji from "../../activity_status/native/ActivityEmoji";
import FormInput from "../../../design/void/Form/native/FormInput";
import { TableRowGroup } from "../../../design/components/TableRow/native/TableRowGroup.native";
import { TableRow } from "../../../design/components/TableRow/native/TableRow.native";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import formatClearAfterValue from "../utils/formatClearAfterValue";
import { TrashIcon } from "../../../design/components/Icon/native/redesign/generated/TrashIcon";
import { isAndroid } from "../../../_bundle/Module501";
import { KeyboardAwareScrollView } from "../../../_bundle/Module1595";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { Navigator } from "../../../design/components/Navigator/native/Navigator.native";
let useStyles, EditCustomStatusWithPreview;
const ClearInputButton = function ClearInputButton(props) {
const onPress2 = props.onPress;
const styles = useStyles();
return <PressableOpacity style={{
borderRadius: 10,
paddingLeft: 8
}} accessibilityRole="button" accessibilityLabel={intl.string(t.VkKicb)} onPress={onPress2} hitSlop={{
top: 8,
bottom: 8,
right: 8
}}>
<Icon source={Module8998} style={styles.closeIcon} size={Icon.Sizes.SMALL} />
</PressableOpacity>;
};
EditCustomStatusWithPreview = function EditCustomStatusWithPreview(props) {
let stateFromStores, state, setState, state2, setState2, state3, setState3, placeholderText, callback, ref2, callback2, callback3, ref3, ref4, memo, callback4;
const { navigation, onClose, analyticsLocations } = props;
let prompt3 = props.prompt;
stateFromStores = void 0;
state = void 0;
setState = void 0;
state2 = void 0;
setState2 = void 0;
state3 = void 0;
setState3 = void 0;
placeholderText = void 0;
callback = void 0;
ref2 = void 0;
callback2 = void 0;
callback3 = void 0;
ref3 = void 0;
ref4 = void 0;
memo = void 0;
callback4 = void 0;
if (prompt3 == null) {
prompt3 = getRandomCustomStatusPrompt();
}
const ref = useRef(prompt3);
useEffect(() => {
AnalyticsUtils.track(AnalyticEvents.OPEN_MODAL, {
type: AnalyticsSections.EDIT_CUSTOM_STATUS_MODAL_WITH_PREVIEW,
location_stack: analyticsLocations
});
}, [analyticsLocations]);
const styles = useStyles();
const customStatusActivity = useCustomStatusActivity();
stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
const r16 = computeInitialClearAfter();
let r59 = customStatusActivity?.state;
if (r59 == null) {
r59 = "";
}
[state, setState] = useState(r59);
let r65 = customStatusActivity?.emoji;
if (r65 == null) {
r65 = null;
}
[state2, setState2] = useState(r65);
[state3, setState3] = useState(r16);
placeholderText = ref.current != null ? ref.current.label() : intl.string(t.xod367);
callback = useCallback(() => {
let current = ref.current;
if (current == null) {
current = void 0;
}
setCustomStatus({
text: state,
emojiInfo: state2,
clearAfter: state3,
analyticsLocations,
prompt: current
});
AccessibilityAnnouncer.announce(intl.string(t.Og40Yn));
onClose();
}, [state, state2, state3, onClose, analyticsLocations]);
const callback5 = useCallback(() => {
removeCustomStatus();
AccessibilityAnnouncer.announce(intl.string(t.YdUwBS));
onClose();
}, [onClose]);
ref2 = useRef(null);
callback2 = useCallback(() => {
setAccessibilityFocus({
ref: ref2,
delay: 500
});
}, []);
callback3 = useCallback((a0) => {
let surrogates;
if (a0.id == null && (a0.surrogates != null && a0.surrogates !== "")) {
surrogates = a0.surrogates;
} else {
surrogates = a0.name;
if (surrogates == null) {
surrogates = "";
}
}
setState2({
id: a0.id,
name: surrogates,
animated: a0.animated
});
callback2();
}, [callback2]);
const callback7 = useCallback(() => {
openEmojiPickerActionSheet({
onPressEmoji: callback3,
onClose: callback2,
pickerIntention: EmojiIntention.STATUS
});
}, [callback3, callback2]);
const callback6 = useCallback(() => {
setState2(null);
setState("");
}, [setState2, setState]);
ref3 = useRef(null);
const ref5 = useRef(null);
const insets = useSafeAreaInsetsKeyboardAware_native({
includeKeyboardHeight: true,
isKeyboardAwareOnIOS: false
}).insets;
const onFocus = useSafeAreaAvoidingInputs_native({
insets,
inputs: [{
ref: ref3
}],
scrollViewRef: ref5
}).onFocus;
const callback8 = useCallback(() => {
const current = ref3.current;
if (current != null) {
current.blur();
}
}, []);
ref4 = useRef({
statusText: state,
statusEmoji: state2,
clearAfter: state3
});
memo = useMemo(() => state !== ref4.current.statusText || state2 !== ref4.current.statusEmoji || state3 !== ref4.current.clearAfter, [state, state2, state3]);
callback4 = useCallback(() => {
maybeShowDiscardChangesAlert({
hasEdits: memo,
onHasEdits: dismissKeyboard,
resetPending: NOOP,
onConfirm: onClose
});
}, [memo, onClose]);
const memo2 = useMemo(() => stateFromStores != null ? <CustomStatusPreview user={stateFromStores} pendingStatusText={state} pendingStatusEmoji={state2} placeholderText={placeholderText} /> : null, [stateFromStores, state, state2, placeholderText]);
useLayoutEffect(() => {
navigation.setOptions({
headerRight: () => <HeaderTextButton label={intl.string(t["R3BPH+"])} onPress={callback} disabled={!memo} />,
headerLeft: getHeaderCloseButton(callback4)
});
}, [navigation, callback, memo, callback4]);
if (stateFromStores == null) {
return null;
}
const r274 = <View style={styles.container}>
<View style={styles.previewContainer}>{memo2}</View>
<View style={styles.statusSection}>
<View style={styles.statusSectionHeader}>
<Text accessibilityRole="header" variant="text-sm/semibold" color="text-default">
{intl.string(t.zOdg0A)}
</Text>
</View>
<View style={styles.statusInput}>
<View style={styles.statusInputRow}>
<PressableOpacity ref={ref2} accessibilityLabel={intl.string(t.WkfRZP)} accessibilityValue={{
text: state2?.name
}} accessibilityRole="button" onPress={callback7}>
<ActivityEmoji emoji={state2} size={20} style={styles.emoji} withPlaceholder />
</PressableOpacity>
<FormInput ref={ref3} maxLength={STATUS_MAX_LENGTH} placeholder={placeholderText} placeholderTextColor={styles.inputPlaceholder.color} accessibilityLabel={intl.string(t.xalUlT)} onSubmitEditing={callback8} onFocus={onFocus} style={styles.status} value={state} onChange={setState} autoCorrect={false} showBorder={false} showTopContainer={false} autoCapitalize="none" inputTextStyle={styles.statusText} multiline submitBehavior="blurAndSubmit" returnKeyType="done" autoFocus />
{(state2 != null || state !== "") && <ClearInputButton onPress={callback6} />}
</View>
</View>
</View>
<TableRowGroup hasIcons={false}>
<TableRow label={intl.string(t["+14vvU"])} arrow onPress={function onPress() {
dismissKeyboard();
ActionSheetActionCreators.openLazy(import("./ClearAfterOptionsActionSheet"), "ClearAfterOptionsActionSheet", {
initialValue: state3,
onChange: setState3
});
}} trailing={<Text variant="text-sm/medium">
{formatClearAfterValue(state3)}
</Text>} />
</TableRowGroup>
{customStatusActivity != null && <TableRowGroup hasIcons>
<TableRow icon={<TrashIcon color={Module712.colors.TEXT_FEEDBACK_CRITICAL} />} label={intl.string(t.wO53tu)} onPress={callback5} variant="danger" />
</TableRowGroup>}
</View>;
return isAndroid() ? <ScrollView ref={ref5} keyboardShouldPersistTaps="always" contentContainerStyle={{
paddingBottom: insets.bottom
}}>{r274}</ScrollView> : <KeyboardAwareScrollView keyboardShouldPersistTaps="always">{r274}</KeyboardAwareScrollView>;
};
useStyles = createStyles({
container: {
flexGrow: 1,
padding: 16,
rowGap: 24
},
statusSection: {
rowGap: 8
},
statusInput: {
flexDirection: "column",
rowGap: 4,
backgroundColor: Module712.colors.INPUT_BACKGROUND_DEFAULT,
borderRadius: Module712.radii.lg,
padding: 12
},
statusInputRow: {
flexDirection: "row",
alignItems: "center"
},
emoji: {
marginRight: 8
},
status: {
color: Module712.colors.TEXT_STRONG,
lineHeight: 16,
flexGrow: 1,
alignSelf: "flex-start",
paddingVertical: 0,
paddingHorizontal: 0
},
statusText: {
fontSize: 16,
lineHeight: 20,
fontFamily: Fonts.PRIMARY_MEDIUM,
color: Module712.colors.TEXT_STRONG,
flexGrow: 1,
height: "auto",
textAlignVertical: "center"
},
inputPlaceholder: {
color: Module712.colors.TEXT_MUTED
},
previewContainer: {
alignItems: "center",
...Module712.shadows.SHADOW_LOW
},
closeIcon: {
tintColor: Module712.colors.INTERACTIVE_TEXT_DEFAULT,
flexShrink: 0
},
statusSectionHeader: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between"
}
});
export default function EditCustomStatusWithPreviewModal(props) {
const { analyticsLocations: analyticsLocations2, prompt } = props;
return <Navigator initialRouteName="root" screens={useMemo(() => {
const analyticsLocations3 = analyticsLocations2;
const prompt2 = prompt;
return {
root: {
title: intl.string(t.Iuzg8R),
headerTitle: () => <GenericHeaderTitle title={intl.string(t.Iuzg8R)} />,
headerLeft: getHeaderCloseButton(ModalActionCreators.pop),
ignoreKeyboard: true,
render: (a0, a1) => <EditCustomStatusWithPreview navigation={a1} onClose={ModalActionCreators.pop} analyticsLocations={analyticsLocations3} prompt={prompt2} />
}
};
}, [analyticsLocations2, prompt])} headerStatusBarHeight={isAndroid() ? void 0 : 12} headerStyle={isAndroid() ? void 0 : {
height: 56
}} />;
};
+40
View File
@@ -0,0 +1,40 @@
// Metro module 11975 (f11976).
import { ClearAfterValues } from "./Constants";
import { AnalyticEvents } from "../../Constants";
import { CustomStatusSetting } from "../user_settings/UserSettings";
import Module3771 from "../../_bundle/Module3771";
import getClearAfterDuration from "./utils/getClearAfterDuration";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
export default function setCustomStatus(a0) {
const { text, emojiInfo, clearAfter, analyticsContext } = a0;
let createdAtMs = a0.createdAtMs;
const { prompt, analyticsLocations } = a0;
const r10 = text.trim();
if (!(r10.length > 0) && emojiInfo == null) {
return CustomStatusSetting.updateSetting(void 0);
}
const text2 = r10.length > 0 ? r10 : "";
const expiresAtMs = clearAfter != null ? clearAfter !== ClearAfterValues.DONT_CLEAR ? String(Module3771().add(getClearAfterDuration(clearAfter), "ms").toDate().getTime()) : "0" : "0";
const emojiId = emojiInfo != null ? emojiInfo.id != null ? emojiInfo.id : "0" : "0";
const emojiName = emojiInfo != null ? emojiInfo.name : "";
const r63 = String;
if (createdAtMs == null) {
createdAtMs = Module3771().toDate().getTime();
}
const r72 = CustomStatusSetting.updateSetting({
text: text2,
expiresAtMs,
emojiId,
emojiName,
createdAtMs: r63(createdAtMs)
});
AnalyticsUtils.track(AnalyticEvents.CUSTOM_STATUS_UPDATED, {
location: analyticsContext != null ? analyticsContext.location : null,
emoji_type: emojiInfo == null ? null : emojiInfo.id != null ? "custom" : "unicode",
text_len: r10.length,
clear_after: clearAfter != null ? `${clearAfter}` : null,
prompt_type: prompt?.value,
location_stack: analyticsLocations
});
return r72;
};
@@ -0,0 +1,28 @@
// Metro module 11974 (f11975).
import { ClearAfterValues } from "../Constants";
import { CustomStatusSetting } from "../../user_settings/UserSettings";
let c8218_3 = [ClearAfterValues.MINUTES_30, ClearAfterValues.HOURS_1, ClearAfterValues.HOURS_4];
export default function computeInitialClearAfter() {
const setting = CustomStatusSetting.getSetting();
if (setting != null && setting.expiresAtMs !== "") {
const r9 = Number(setting.expiresAtMs);
if (isNaN(r9)) {
return ClearAfterValues.TODAY;
}
if (r9 === 0) {
return ClearAfterValues.DONT_CLEAR;
}
const date = new Date();
const date2 = new Date(r9);
if (date.getFullYear() === date2.getFullYear() && date.getMonth() === date2.getMonth() && date.getDate() === date2.getDate()) {
let c19309_0 = Number(r9) - Date.now();
let r56 = c8218_3.find((item) => c19309_0 <= item);
if (r56 == null) {
r56 = ClearAfterValues.TODAY;
}
return r56;
}
return ClearAfterValues.TODAY;
}
return ClearAfterValues.TODAY;
};
@@ -0,0 +1,68 @@
// Metro module 11982 (f11983).
import { ClearAfterValues } from "../Constants";
import { isSameDay } from "../../../utils/DateUtils";
import { intl, t } from "../../../intl/index.native";
import Durations from "../../../utils/Durations";
import { assertNever } from "../../../utils/GlobalUtils";
export default function formatClearAfterOption(a0) {
if (ClearAfterValues.TODAY === a0) {
const r241 = intl.formatToPlainString(t.Rea2gR, {
hours: 24
});
const DAY = Durations.Millis.DAY;
const r251 = Date.now() + DAY;
return `${r241} (${isSameDay(new Date(), new Date(r251)) ? intl.data.formatTime(r251, {
format: "short"
}) : intl.formatToPlainString(t.DN91Jz, {
time: intl.data.formatTime(r251, {
format: "short"
})
})})`;
}
if (ClearAfterValues.HOURS_4 === a0) {
const r173 = intl.formatToPlainString(t.Rea2gR, {
hours: 4
});
const r180 = 4 * Durations.Millis.HOUR;
const r185 = Date.now() + r180;
return `${r173} (${isSameDay(new Date(), new Date(r185)) ? intl.data.formatTime(r185, {
format: "short"
}) : intl.formatToPlainString(t.DN91Jz, {
time: intl.data.formatTime(r185, {
format: "short"
})
})})`;
}
if (ClearAfterValues.HOURS_1 === a0) {
const r107 = intl.formatToPlainString(t.Rea2gR, {
hours: 1
});
const HOUR = Durations.Millis.HOUR;
const r117 = Date.now() + HOUR;
return `${r107} (${isSameDay(new Date(), new Date(r117)) ? intl.data.formatTime(r117, {
format: "short"
}) : intl.formatToPlainString(t.DN91Jz, {
time: intl.data.formatTime(r117, {
format: "short"
})
})})`;
}
if (ClearAfterValues.MINUTES_30 === a0) {
const r8 = intl.formatToPlainString(t.TS3eJb, {
minutes: 30
});
const r55 = 30 * Durations.Millis.MINUTE;
const r9 = Date.now() + r55;
return `${r8} (${isSameDay(new Date(), new Date(r9)) ? intl.data.formatTime(r9, {
format: "short"
}) : intl.formatToPlainString(t.DN91Jz, {
time: intl.data.formatTime(r9, {
format: "short"
})
})})`;
}
if (ClearAfterValues.DONT_CLEAR === a0) {
return intl.string(t.bRn8cq);
}
assertNever(a0);
};
@@ -0,0 +1,56 @@
// Metro module 11983 (f11984).
import { ClearAfterValues } from "../Constants";
import { isSameDay } from "../../../utils/DateUtils";
import { intl, t } from "../../../intl/index.native";
import Durations from "../../../utils/Durations";
import { assertNever } from "../../../utils/GlobalUtils";
export default function formatClearAfterValue(a0) {
if (ClearAfterValues.TODAY === a0) {
const DAY = Durations.Millis.DAY;
const r187 = Date.now() + DAY;
return isSameDay(new Date(), new Date(r187)) ? intl.data.formatTime(r187, {
format: "short"
}) : intl.formatToPlainString(t.bI7n9i, {
time: intl.data.formatTime(r187, {
format: "short"
})
});
}
if (ClearAfterValues.HOURS_4 === a0) {
const r134 = 4 * Durations.Millis.HOUR;
const r139 = Date.now() + r134;
return isSameDay(new Date(), new Date(r139)) ? intl.data.formatTime(r139, {
format: "short"
}) : intl.formatToPlainString(t.bI7n9i, {
time: intl.data.formatTime(r139, {
format: "short"
})
});
}
if (ClearAfterValues.HOURS_1 === a0) {
const HOUR = Durations.Millis.HOUR;
const r89 = Date.now() + HOUR;
return isSameDay(new Date(), new Date(r89)) ? intl.data.formatTime(r89, {
format: "short"
}) : intl.formatToPlainString(t.bI7n9i, {
time: intl.data.formatTime(r89, {
format: "short"
})
});
}
if (ClearAfterValues.MINUTES_30 === a0) {
const r42 = 30 * Durations.Millis.MINUTE;
const r7 = Date.now() + r42;
return isSameDay(new Date(), new Date(r7)) ? intl.data.formatTime(r7, {
format: "short"
}) : intl.formatToPlainString(t.bI7n9i, {
time: intl.data.formatTime(r7, {
format: "short"
})
});
}
if (ClearAfterValues.DONT_CLEAR === a0) {
return intl.string(t.bRn8cq);
}
assertNever(a0);
};
@@ -0,0 +1,13 @@
// Metro module 11976 (f11977).
import { ClearAfterValues } from "../Constants";
import Durations from "../../../utils/Durations";
import Module38 from "../../../_bundle/Module38";
export default function getClearAfterDuration(a0) {
let r2 = a0;
if (a0 === ClearAfterValues.TODAY) {
r2 = Durations.Millis.DAY;
} else {
Module38(typeof a0 === "number", "Invalid custom status clear timeout");
}
return r2;
};
@@ -0,0 +1,10 @@
// Metro module 11973 (f11974).
import { CustomStatusPromptValues, CustomStatusPrompts } from "../Constants";
import { intl, t } from "../../../intl/index.native";
export default function getRandomCustomStatusPrompt(a0) {
const r9 = a0 != null && a0.size > 0 ? CustomStatusPrompts.filter((customStatusPrompt) => !a0.has(customStatusPrompt.value)) : CustomStatusPrompts;
return r9.length === 0 ? {
value: CustomStatusPromptValues.ADD_STATUS,
label: () => intl.string(t.Vq4UmS)
} : r9[Math.floor(Math.random() * r9.length)];
};
@@ -0,0 +1,5 @@
// Metro module 15059 (f15060).
import { ActivityTypes } from "../../../Constants";
export function isActivityPermanentCustomStatus(a0) {
return a0.type === ActivityTypes.CUSTOM_STATUS && a0.timestamps?.end == null;
}
@@ -0,0 +1,5 @@
// Metro module 15060 (f15061).
import { ActivityTypes } from "../../../Constants";
export function isActivityTemporaryCustomStatus(a0) {
return a0.type === ActivityTypes.CUSTOM_STATUS && a0.timestamps?.end != null && a0.timestamps?.end > 0;
}
@@ -0,0 +1,9 @@
// Metro module 11977 (f11978).
import setCustomStatus from "../setCustomStatus";
export default function removeCustomStatus() {
setCustomStatus({
text: "",
emojiInfo: null,
clearAfter: null
});
};
@@ -0,0 +1,15 @@
// Metro module 11964 (f11965).
import AuthenticationStore from "../../../stores/AuthenticationStore";
import PresenceStore from "../../../stores/PresenceStore";
import { ActivityTypes } from "../../../Constants";
import { useStateFromStores } from "../../../_bundle/Module589";
import { useCustomStatusActivity } from "./userSettingToActivity";
export default function useCustomStatusActivityForUser(c19300_0) {
const stateFromStores = useStateFromStores([AuthenticationStore], () => AuthenticationStore.getId() === c19300_0);
const customStatusActivity = useCustomStatusActivity();
let r23 = useStateFromStores([PresenceStore], () => PresenceStore.findActivity(c19300_0, (a0) => a0.type === ActivityTypes.CUSTOM_STATUS));
if (stateFromStores) {
r23 = customStatusActivity;
}
return r23;
};
@@ -0,0 +1,57 @@
// Metro module 8080 (f8081).
import { useMemo } from "react";
import EmojiStore from "../../emojis/EmojiStore";
import { ActivityTypes } from "../../../Constants";
import UnicodeEmojis from "../../emojis/UnicodeEmojis";
import { CustomStatusSetting } from "../../user_settings/UserSettings";
import { useStateFromStores } from "../../../_bundle/Module589";
const _activityFromSetting = function _activityFromSetting(setting, stateFromStores) {
let emoji;
if (stateFromStores != null) {
emoji = {
id: stateFromStores.id,
name: stateFromStores.name,
animated: stateFromStores.animated
};
} else {
const r1 = setting.emojiName != null;
emoji = null;
if (r1) {
const emojiName = setting.emojiName;
emoji = null;
if (emojiName !== "") {
const byName = UnicodeEmojis.getByName(UnicodeEmojis.convertSurrogateToName(setting.emojiName, false));
emoji = byName != null ? {
id: null,
name: byName.surrogates,
animated: false
} : null;
}
}
}
const end = Number(setting.expiresAtMs);
const value = setting.label?.value;
return {
name: "Custom Status",
type: ActivityTypes.CUSTOM_STATUS,
state: setting.text.length > 0 ? setting.text : void 0,
timestamps: end > 0 ? {
end
} : void 0,
emoji,
details: value,
metadata: {
label: value
}
};
};
export function getActivityFromCustomStatus(a0) {
const emojiId2 = a0.emojiId;
return _activityFromSetting(a0, emojiId2 != null ? emojiId2 !== "0" ? EmojiStore.getUsableCustomEmojiById(emojiId2) : null : null);
}
export function useCustomStatusActivity() {
const setting = CustomStatusSetting.useSetting();
const emojiId = setting?.emojiId;
const stateFromStores = useStateFromStores([EmojiStore], () => emojiId != null ? emojiId !== "0" ? EmojiStore.getUsableCustomEmojiById(emojiId) : null : null, [emojiId]);
return useMemo(() => setting != null ? _activityFromSetting(setting, stateFromStores) : null, [setting, stateFromStores]);
}