31 lines
1.2 KiB
TypeScript
31 lines
1.2 KiB
TypeScript
// Metro module 13599 (f13600).
|
|
import GameRelationshipStore from "./GameRelationshipStore";
|
|
import { RelationshipTypes } from "../../Constants";
|
|
import LifecycleManager from "../../lib/LifecycleManager";
|
|
import Dispatcher from "../../Dispatcher";
|
|
import ApplicationActionCreators from "../applications/ApplicationActionCreators";
|
|
class GameRelationshipManager extends LifecycleManager {
|
|
handlePostConnectionOpen = () => {
|
|
const gameRelationships = GameRelationshipStore.getGameRelationships();
|
|
const set = new Set();
|
|
let c27526_0 = set;
|
|
gameRelationships.values().forEach((item) => {
|
|
if (item.type === RelationshipTypes.PENDING_INCOMING) {
|
|
c27526_0.add(item.applicationId);
|
|
}
|
|
});
|
|
ApplicationActionCreators.fetchApplications(Array.from(set));
|
|
};
|
|
_initialize() {
|
|
Dispatcher.subscribe("POST_CONNECTION_OPEN", this.handlePostConnectionOpen);
|
|
}
|
|
_terminate() {
|
|
Dispatcher.unsubscribe("POST_CONNECTION_OPEN", this.handlePostConnectionOpen);
|
|
}
|
|
destroy() {
|
|
Dispatcher.unsubscribe("POST_CONNECTION_OPEN", this.handlePostConnectionOpen);
|
|
}
|
|
}
|
|
const gameRelationshipManager = new GameRelationshipManager();
|
|
export default gameRelationshipManager;
|