mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
make features available in Client and Session
This commit is contained in:
parent
f65b43f612
commit
d5929d9ebe
@ -55,7 +55,7 @@ export class LoginViewModel extends ViewModel<SegmentType, Options> {
|
|||||||
const {ready, defaultHomeserver, loginToken} = options;
|
const {ready, defaultHomeserver, loginToken} = options;
|
||||||
this._ready = ready;
|
this._ready = ready;
|
||||||
this._loginToken = loginToken;
|
this._loginToken = loginToken;
|
||||||
this._client = new Client(this.platform);
|
this._client = new Client(this.platform, this.features);
|
||||||
this._homeserver = defaultHomeserver;
|
this._homeserver = defaultHomeserver;
|
||||||
this._initViewModels();
|
this._initViewModels();
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ import {TokenLoginMethod} from "./login/TokenLoginMethod";
|
|||||||
import {SSOLoginHelper} from "./login/SSOLoginHelper";
|
import {SSOLoginHelper} from "./login/SSOLoginHelper";
|
||||||
import {getDehydratedDevice} from "./e2ee/Dehydration.js";
|
import {getDehydratedDevice} from "./e2ee/Dehydration.js";
|
||||||
import {Registration} from "./registration/Registration";
|
import {Registration} from "./registration/Registration";
|
||||||
|
import {FeatureSet} from "../features";
|
||||||
|
|
||||||
export const LoadStatus = createEnum(
|
export const LoadStatus = createEnum(
|
||||||
"NotLoading",
|
"NotLoading",
|
||||||
@ -53,7 +54,7 @@ export const LoginFailure = createEnum(
|
|||||||
);
|
);
|
||||||
|
|
||||||
export class Client {
|
export class Client {
|
||||||
constructor(platform) {
|
constructor(platform, features = new FeatureSet(0)) {
|
||||||
this._platform = platform;
|
this._platform = platform;
|
||||||
this._sessionStartedByReconnector = false;
|
this._sessionStartedByReconnector = false;
|
||||||
this._status = new ObservableValue(LoadStatus.NotLoading);
|
this._status = new ObservableValue(LoadStatus.NotLoading);
|
||||||
@ -68,6 +69,7 @@ export class Client {
|
|||||||
this._olmPromise = platform.loadOlm();
|
this._olmPromise = platform.loadOlm();
|
||||||
this._workerPromise = platform.loadOlmWorker();
|
this._workerPromise = platform.loadOlmWorker();
|
||||||
this._accountSetup = undefined;
|
this._accountSetup = undefined;
|
||||||
|
this._features = features;
|
||||||
}
|
}
|
||||||
|
|
||||||
createNewSessionId() {
|
createNewSessionId() {
|
||||||
@ -278,6 +280,7 @@ export class Client {
|
|||||||
olmWorker,
|
olmWorker,
|
||||||
mediaRepository,
|
mediaRepository,
|
||||||
platform: this._platform,
|
platform: this._platform,
|
||||||
|
features: this._features
|
||||||
});
|
});
|
||||||
await this._session.load(log);
|
await this._session.load(log);
|
||||||
if (dehydratedDevice) {
|
if (dehydratedDevice) {
|
||||||
|
@ -54,7 +54,7 @@ const PUSHER_KEY = "pusher";
|
|||||||
|
|
||||||
export class Session {
|
export class Session {
|
||||||
// sessionInfo contains deviceId, userId and homeserver
|
// 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._platform = platform;
|
||||||
this._storage = storage;
|
this._storage = storage;
|
||||||
this._hsApi = hsApi;
|
this._hsApi = hsApi;
|
||||||
|
Loading…
Reference in New Issue
Block a user