42 lines
1.6 KiB
TypeScript
42 lines
1.6 KiB
TypeScript
// Metro module 16735 (f16736).
|
|
import AuthenticationStore from "../../../stores/AuthenticationStore";
|
|
import AppStateStore from "../../../stores/native/AppStateStore";
|
|
import { AnalyticEvents, AppStates } from "../../../Constants";
|
|
import Logger from "../../debug/Logger";
|
|
import Module10 from "../../../_bundle/Module10";
|
|
import Dispatcher from "../../../Dispatcher";
|
|
import * as _RTCConnectionStore from "../../../stores/RTCConnectionStore";
|
|
import BundleUpdaterActionCreators from "../../../actions/native/BundleUpdaterActionCreators";
|
|
import { trackAppOpened } from "../../tti_analytics/native/TTIAnalyticsUtils";
|
|
import { setSystemThemeIfNeeded } from "../../user_settings/ThemeActionCreators";
|
|
import TTITracker from "../../tti_analytics/TTITracker";
|
|
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
|
|
let c12063_7 = new Logger("index.native.tsx");
|
|
export default function handleAppStateChanged(a0) {
|
|
const state = AppStateStore.getState();
|
|
Module10.markAndLog(c12063_7, "🏃", `AppState changing from ${state} to ${a0}`);
|
|
Dispatcher.dispatch({
|
|
type: "APP_STATE_UPDATE",
|
|
state: a0
|
|
});
|
|
let r29 = state === AppStates.BACKGROUND && a0 === AppStates.ACTIVE;
|
|
const r0 = state === AppStates.ACTIVE && a0 !== AppStates.ACTIVE;
|
|
if (r29) {
|
|
r29 = AuthenticationStore.isAuthenticated();
|
|
}
|
|
if (r29) {
|
|
r29 = _RTCConnectionStore.default.isDisconnected();
|
|
}
|
|
if (r29) {
|
|
BundleUpdaterActionCreators.deferUpdate();
|
|
}
|
|
if (a0 === AppStates.ACTIVE) {
|
|
trackAppOpened("launcher");
|
|
setSystemThemeIfNeeded();
|
|
}
|
|
TTITracker.appStateChanged(a0);
|
|
if (r0) {
|
|
AnalyticsUtils.track(AnalyticEvents.APP_BACKGROUND, {});
|
|
}
|
|
};
|