119 lines
2.6 KiB
TypeScript
119 lines
2.6 KiB
TypeScript
// Metro module 12491 (f12492).
|
|
import { t } from "../../../intl/index.native";
|
|
import useCountdown from "../../../hooks/useCountdown";
|
|
import { unitsAsStrings } from "../../../utils/DateUtils";
|
|
import SentryUtils_native from "../../../utils/SentryUtils.native";
|
|
let c8633_3;
|
|
const roundFPCountdownUnits = function roundFPCountdownUnits(a0) {
|
|
const r4 = {
|
|
...a0
|
|
};
|
|
if (r4.seconds > 0) {
|
|
r4.minutes = r4.minutes + 1;
|
|
r4.seconds = 0;
|
|
}
|
|
if (r4.minutes === 60) {
|
|
r4.hours = r4.hours + 1;
|
|
r4.minutes = 0;
|
|
}
|
|
if (r4.hours === 24) {
|
|
r4.days = r4.days + 1;
|
|
r4.hours = 0;
|
|
}
|
|
if (r4.days > 0) {
|
|
return {
|
|
days: r4.hours > 0 ? r4.days + 1 : r4.days,
|
|
hours: 0,
|
|
minutes: 0,
|
|
seconds: 0
|
|
};
|
|
}
|
|
if (r4.hours > 0) {
|
|
const hours2 = r4.minutes > 45 ? r4.hours + 1 : r4.hours;
|
|
return hours2 > 11 ? {
|
|
days: 1,
|
|
hours: 0,
|
|
minutes: 0,
|
|
seconds: 0
|
|
} : {
|
|
days: 0,
|
|
hours: hours2,
|
|
minutes: 0,
|
|
seconds: 0
|
|
};
|
|
}
|
|
if (r4.minutes > 0) {
|
|
const hours = r4.minutes > 45 ? 1 : 0;
|
|
return {
|
|
days: 0,
|
|
hours,
|
|
minutes: hours !== 1 ? r4.minutes : 0,
|
|
seconds: 0
|
|
};
|
|
}
|
|
return r4.seconds > 0 ? {
|
|
days: 0,
|
|
hours: 0,
|
|
minutes: 1,
|
|
seconds: 0
|
|
} : r4;
|
|
};
|
|
c8633_3 = {
|
|
SHORT_TIME_LEFT: 0,
|
|
0: "SHORT_TIME_LEFT",
|
|
LONG_TIME_LEFT: 1,
|
|
1: "LONG_TIME_LEFT",
|
|
ENDS_IN: 2,
|
|
2: "ENDS_IN",
|
|
SHORT_TIME: 3,
|
|
3: "SHORT_TIME",
|
|
CREDITS_ENDS_IN: 4,
|
|
4: "CREDITS_ENDS_IN"
|
|
};
|
|
export default function useFPDurationLeft(a0, a1) {
|
|
let r30, r120;
|
|
if (c8633_3.SHORT_TIME_LEFT === a1) {
|
|
r30 = {
|
|
days: t["/wnvqA"],
|
|
hours: t.Jsq0XN,
|
|
minutes: t["SBd+Bs"]
|
|
};
|
|
} else if (c8633_3.LONG_TIME_LEFT === a1) {
|
|
r30 = {
|
|
days: t.UD5nn5,
|
|
hours: t.Hg8Fee,
|
|
minutes: t.XSbQZZ
|
|
};
|
|
} else if (c8633_3.ENDS_IN === a1) {
|
|
r30 = {
|
|
days: t.rLqNad,
|
|
hours: t.d1LvCA,
|
|
minutes: t.Z2LX7K
|
|
};
|
|
} else if (c8633_3.CREDITS_ENDS_IN === a1) {
|
|
r30 = {
|
|
days: t.xQ3zuN,
|
|
hours: t.SFU7QN,
|
|
minutes: t.Y4FNdL
|
|
};
|
|
} else {
|
|
if (c8633_3.SHORT_TIME !== a1) {
|
|
throw new Error(`Unknown messageType (${a1}) when rendering time left`);
|
|
}
|
|
r30 = {
|
|
days: t.fYmirx,
|
|
hours: t["C3RO+g"],
|
|
minutes: t.r77oHc
|
|
};
|
|
}
|
|
const r115 = roundFPCountdownUnits(useCountdown(a0.toDate(), 60000));
|
|
try {
|
|
r120 = unitsAsStrings(r115, r30);
|
|
} catch ($e) {
|
|
SentryUtils_native.captureMessage("Error trying to format string for fractional nitro duration pill");
|
|
}
|
|
return r120;
|
|
};
|
|
export { c8633_3 as CountDownMessageTypes };
|
|
export { roundFPCountdownUnits };
|