make features available in Client and Session

This commit is contained in:
Bruno Windels 2023-02-09 11:53:39 +01:00
parent f65b43f612
commit d5929d9ebe
3 changed files with 6 additions and 3 deletions

View File

@ -55,7 +55,7 @@ export class LoginViewModel extends ViewModel<SegmentType, Options> {
const {ready, defaultHomeserver, loginToken} = options;
this._ready = ready;
this._loginToken = loginToken;
this._client = new Client(this.platform);
this._client = new Client(this.platform, this.features);
this._homeserver = defaultHomeserver;
this._initViewModels();
}

View File

@ -31,6 +31,7 @@ import {TokenLoginMethod} from "./login/TokenLoginMethod";
import {SSOLoginHelper} from "./login/SSOLoginHelper";
import {getDehydratedDevice} from "./e2ee/Dehydration.js";
import {Registration} from "./registration/Registration";
import {FeatureSet} from "../features";
export const LoadStatus = createEnum(
"NotLoading",
@ -53,7 +54,7 @@ export const LoginFailure = createEnum(
);
export class Client {
constructor(platform) {
constructor(platform, features = new FeatureSet(0)) {
this._platform = platform;
this._sessionStartedByReconnector = false;
this._status = new ObservableValue(LoadStatus.NotLoading);
@ -68,6 +69,7 @@ export class Client {
this._olmPromise = platform.loadOlm();
this._workerPromise = platform.loadOlmWorker();
this._accountSetup = undefined;
this._features = features;
}
createNewSessionId() {
@ -278,6 +280,7 @@ export class Client {
olmWorker,
mediaRepository,
platform: this._platform,
features: this._features
});
await this._session.load(log);
if (dehydratedDevice) {

View File

@ -54,7 +54,7 @@ const PUSHER_KEY = "pusher";
export class Session {
// sessionInfo contains deviceId, userId and homeserver
constructor({storage, hsApi, sessionInfo, olm, olmWorker, platform, mediaRepository}) {
constructor({storage, hsApi, sessionInfo, olm, olmWorker, platform, mediaRepository, features}) {
this._platform = platform;
this._storage = storage;
this._hsApi = hsApi;