2022-07-30 16:32:13 +03:00
|
|
|
import { server } from "../const/config";
|
2022-07-14 13:38:00 +03:00
|
|
|
import { Texts, TrTr } from "../const/texts";
|
2024-06-17 17:25:40 +03:00
|
|
|
import { RTMT, RTMTWS } from "@mancala/core";
|
2022-07-30 16:32:13 +03:00
|
|
|
import { HttpServiceImpl } from "../service/HttpService";
|
|
|
|
|
import { GameStore, GameStoreImpl } from "../store/GameStore";
|
|
|
|
|
import { UserKeyStore, UserKeyStoreImpl } from "../store/KeyStore";
|
2022-07-14 13:38:00 +03:00
|
|
|
import ThemeManager from "../theme/ThemeManager";
|
2021-06-27 19:28:55 +03:00
|
|
|
|
2022-05-15 01:58:57 +03:00
|
|
|
export type Context = {
|
|
|
|
|
rtmt: RTMT;
|
|
|
|
|
userKeyStore: UserKeyStore;
|
|
|
|
|
texts: Texts;
|
|
|
|
|
themeManager: ThemeManager;
|
2022-07-30 16:32:13 +03:00
|
|
|
gameStore: GameStore;
|
2022-05-15 01:58:57 +03:00
|
|
|
};
|
2021-06-27 19:28:55 +03:00
|
|
|
|
2022-07-30 16:32:13 +03:00
|
|
|
export const initContext = (): Context => {
|
2022-05-15 01:58:57 +03:00
|
|
|
const rtmt = new RTMTWS();
|
2022-07-30 16:32:13 +03:00
|
|
|
const httpService = new HttpServiceImpl(server.serverAdress);
|
|
|
|
|
const userKeyStore = new UserKeyStoreImpl({ httpService });
|
|
|
|
|
const gameStore = new GameStoreImpl({ httpService });
|
2022-05-15 01:58:57 +03:00
|
|
|
const texts = TrTr;
|
2022-06-04 19:28:57 +03:00
|
|
|
const themeManager = new ThemeManager();
|
2022-05-15 01:58:57 +03:00
|
|
|
return {
|
|
|
|
|
rtmt: rtmt,
|
|
|
|
|
userKeyStore: userKeyStore,
|
|
|
|
|
texts: texts,
|
|
|
|
|
themeManager,
|
2022-07-30 16:32:13 +03:00
|
|
|
gameStore
|
2022-05-15 01:58:57 +03:00
|
|
|
};
|
|
|
|
|
};
|