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

@@ -0,0 +1,28 @@
// Metro module 14462 (f14463).
import { createApexExperiment } from "../../experiments/apex/index";
const apexExperiment = createApexExperiment({
kind: "user",
name: "2026-03-friend-is-online-v3",
defaultConfig: {
showSettingsToggle: false
},
variations: {
1: {
showSettingsToggle: true
},
2: {
showSettingsToggle: true
}
}
});
export default apexExperiment;
export function useFriendOnlineNotificationExperiment(a0) {
return apexExperiment.useConfig({
location: a0
});
}
export function isEligibleForFriendOnlineNotifications(a0) {
return apexExperiment.getConfig({
location: a0
}).showSettingsToggle;
}
@@ -0,0 +1,19 @@
// Metro module 14463 (f14464).
import { NotificationSettingsUpdateType } from "../NotificationConstants";
import { AnalyticEvents } from "../../../Constants";
import { EnableFriendOnlineNotifications, NotifyFriendsOnComeOnline } from "../../user_settings/UserSettings";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
export function onFriendOnlineNotificationSettingsChanged(a0) {
EnableFriendOnlineNotifications.updateSetting(a0);
AnalyticsUtils.track(AnalyticEvents.NOTIFICATION_SETTINGS_UPDATED, {
update_type: NotificationSettingsUpdateType.ACCOUNT,
friend_online_notifications: a0
});
}
export function onNotifyFriendsOnComeOnlineSettingsChanged(a0) {
NotifyFriendsOnComeOnline.updateSetting(a0);
AnalyticsUtils.track(AnalyticEvents.NOTIFICATION_SETTINGS_UPDATED, {
update_type: NotificationSettingsUpdateType.ACCOUNT,
notify_friends_on_come_online: a0
});
}
@@ -0,0 +1,108 @@
// Metro module 16647 (f16648).
import SelfPresenceStore from "../../../stores/SelfPresenceStore";
import FriendOnlineTimerStore from "./FriendOnlineTimerStore";
import { Endpoints } from "../../../Constants";
import { StatusTypes } from "../../../_bundle/Module505";
import Durations from "../../../utils/Durations";
import { HTTP, HTTPResponseError } from "../../../_bundle/sendRequest";
import SentryUtils_native from "../../../utils/SentryUtils.native";
import Dispatcher from "../../../Dispatcher";
import AutomaticLifecycleManager from "../../../lib/AutomaticLifecycleManager";
import { NotifyFriendsOnComeOnline } from "../../user_settings/UserSettings";
let c11986_8;
let _reportSessionMeaningfullyOnline = function _reportSessionMeaningfullyOnline() {
const r8 = async () => {
let c28482_2;
let c28482_3 = 0;
let c31089_0;
L10: {
try {
c28482_3 = 1;
await HTTP.post({
url: Endpoints.USER_MEANINGFULLY_ONLINE,
rejectWithError: true
});
c28482_3 = 0;
Dispatcher.dispatch({
type: "FRIEND_ONLINE_TIMER_REPORTED",
timestampMs: Date.now()
});
} catch ($e) {
const r26 = $e;
let r7 = r26;
c28482_2 = r26;
if (c28482_3 !== 0) {
while (true) {
try {
const r71 = c28482_2;
c28482_3 = 0;
c31089_0 = r71;
if (c31089_0 instanceof HTTPResponseError && c31089_0.status === 429) {
Dispatcher.dispatch({
type: "FRIEND_ONLINE_TIMER_REPORTED",
timestampMs: Date.now()
});
break L10;
}
SentryUtils_native.captureException(c31089_0, {
tags: {
app_context: "session_timer"
}
});
} catch (r67) {
r7 = r67;
c28482_2 = r67;
if (c28482_3 === 0) {
break;
}
continue;
}
return void 0;
}
}
throw r7;
}
}
};
_reportSessionMeaningfullyOnline = r8;
return r8.apply(this, arguments);
};
c11986_8 = 5 * Durations.Millis.MINUTE;
class FriendOnlineTimerManager extends AutomaticLifecycleManager {
constructor() {
super(...arguments);
const _this = this;
this.timerId = null;
this.actions = {
POST_CONNECTION_OPEN: () => _this.start(),
CONNECTION_RESUMED: () => _this.start(),
CONNECTION_CLOSED: () => _this.clear(),
CONNECTION_INTERRUPTED: () => _this.clear(),
SELF_PRESENCE_STORE_UPDATE: () => _this.start()
};
this.start = () => {
if (NotifyFriendsOnComeOnline.getSetting() && FriendOnlineTimerStore.isCooldownElapsed() && _this.timerId == null && [StatusTypes.ONLINE, StatusTypes.STREAMING].includes(SelfPresenceStore.getStatus())) {
_this.timerId = setTimeout(() => {
_this.timerId = null;
if ([StatusTypes.ONLINE, StatusTypes.STREAMING].includes(SelfPresenceStore.getStatus()) && FriendOnlineTimerStore.isCooldownElapsed()) {
(function reportSessionMeaningfullyOnline() {
return _reportSessionMeaningfullyOnline.apply(this, arguments);
})();
}
}, c11986_8);
}
};
this.clear = () => {
if (_this.timerId != null) {
clearTimeout(_this.timerId);
_this.timerId = null;
}
};
}
_initialize() {}
_terminate() {
this.clear();
}
}
const friendOnlineTimerManager = new FriendOnlineTimerManager();
export default friendOnlineTimerManager;
@@ -0,0 +1,32 @@
// Metro module 16648 (f16649).
import Durations from "../../../utils/Durations";
import Module589 from "../../../_bundle/Module589";
import Dispatcher from "../../../Dispatcher";
const HOUR = Durations.Millis.HOUR;
let c11987_1 = {
lastReportedAtMs: null
};
let c11987_2 = c11987_1;
class FriendOnlineTimerStore extends Module589.PersistedStore {
static displayName = "FriendOnlineTimerStore";
static persistKey = "FriendOnlineTimerStore";
initialize(r2 = c11987_1) {
if (r2 == null) {
r2 = c11987_1;
}
c11987_2 = r2;
}
isCooldownElapsed() {
return c11987_2.lastReportedAtMs == null || Date.now() - c11987_2.lastReportedAtMs >= HOUR;
}
getState() {
return c11987_2;
}
}
const friendOnlineTimerStore = new FriendOnlineTimerStore(Dispatcher, {
FRIEND_ONLINE_TIMER_REPORTED: function setLastReportedAtMs(a0) {
c11987_2.lastReportedAtMs = a0.timestampMs;
return true;
}
});
export default friendOnlineTimerStore;