mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-01-22 18:21:39 +01:00
Fix rebase
This commit is contained in:
parent
f822a7a344
commit
53c0fc2934
@ -34,7 +34,7 @@ export type SegmentType = {
|
|||||||
"details": true;
|
"details": true;
|
||||||
"members": true;
|
"members": true;
|
||||||
"member": string;
|
"member": string;
|
||||||
"device-verification": string;
|
"device-verification": string | boolean;
|
||||||
"join-room": true;
|
"join-room": true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -97,8 +97,7 @@ export class SessionViewModel extends ViewModel {
|
|||||||
}));
|
}));
|
||||||
this._updateJoinRoom(joinRoom.get());
|
this._updateJoinRoom(joinRoom.get());
|
||||||
|
|
||||||
if (this._client.session.features.crossSigning) {
|
if (this.features.crossSigning) {
|
||||||
|
|
||||||
const verification = this.navigation.observe("device-verification");
|
const verification = this.navigation.observe("device-verification");
|
||||||
this.track(verification.subscribe((txnId) => {
|
this.track(verification.subscribe((txnId) => {
|
||||||
this._updateVerification(txnId);
|
this._updateVerification(txnId);
|
||||||
|
@ -33,10 +33,16 @@ export class ToastCollectionViewModel extends ViewModel<SegmentType, Options> {
|
|||||||
constructor(options: Options) {
|
constructor(options: Options) {
|
||||||
super(options);
|
super(options);
|
||||||
const session = this.getOption("session");
|
const session = this.getOption("session");
|
||||||
const vms: IToastCollection["toastViewModels"][] = [
|
const collectionVms: IToastCollection[] = [];
|
||||||
this.track(new CallToastCollectionViewModel(this.childOptions({ session }))),
|
if (this.features.calls) {
|
||||||
this.track(new VerificationToastCollectionViewModel(this.childOptions({session}))),
|
collectionVms.push(this.track(new CallToastCollectionViewModel(this.childOptions({ session }))));
|
||||||
].map(vm => vm.toastViewModels);
|
}
|
||||||
|
if (this.features.crossSigning) {
|
||||||
|
collectionVms.push(this.track(new VerificationToastCollectionViewModel(this.childOptions({ session }))));
|
||||||
|
}
|
||||||
|
const vms: IToastCollection["toastViewModels"][] = collectionVms.map(vm => vm.toastViewModels);
|
||||||
|
if (vms.length !== 0) {
|
||||||
this.toastViewModels = new ConcatList(...vms);
|
this.toastViewModels = new ConcatList(...vms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -32,18 +32,13 @@ export class VerificationToastCollectionViewModel extends ViewModel<SegmentType,
|
|||||||
|
|
||||||
constructor(options: Options) {
|
constructor(options: Options) {
|
||||||
super(options);
|
super(options);
|
||||||
this.observeSASRequests();
|
this.track(
|
||||||
|
options.session.crossSigning.subscribe((crossSigning) => {
|
||||||
|
this.track(crossSigning.receivedSASVerifications.subscribe(this));
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async observeSASRequests() {
|
|
||||||
const session = this.getOption("session");
|
|
||||||
if (this.features.crossSigning) {
|
|
||||||
// todo: hack to wait for crossSigning; remove
|
|
||||||
await new Promise(r => setTimeout(r, 3000));
|
|
||||||
const map = session.crossSigning.receivedSASVerifications;
|
|
||||||
this.track(map.subscribe(this));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async onAdd(_, request: SASRequest) {
|
async onAdd(_, request: SASRequest) {
|
||||||
const dismiss = () => {
|
const dismiss = () => {
|
||||||
|
@ -22,7 +22,7 @@ type Options<N extends MinimumNeededSegmentType = SegmentType> = {
|
|||||||
} & BaseClassOptions<N>;
|
} & BaseClassOptions<N>;
|
||||||
|
|
||||||
type MinimumNeededSegmentType = {
|
type MinimumNeededSegmentType = {
|
||||||
"device-verification": string;
|
"device-verification": string | boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export class VerificationToastNotificationViewModel<N extends MinimumNeededSegmentType = SegmentType, O extends Options<N> = Options<N>> extends BaseToastNotificationViewModel<N, O> {
|
export class VerificationToastNotificationViewModel<N extends MinimumNeededSegmentType = SegmentType, O extends Options<N> = Options<N>> extends BaseToastNotificationViewModel<N, O> {
|
||||||
|
@ -51,7 +51,7 @@ export class DeviceVerificationViewModel extends ErrorReportViewModel<SegmentTyp
|
|||||||
|
|
||||||
private async start(requestOrUserId: SASRequest | string) {
|
private async start(requestOrUserId: SASRequest | string) {
|
||||||
await this.logAndCatch("DeviceVerificationViewModel.start", (log) => {
|
await this.logAndCatch("DeviceVerificationViewModel.start", (log) => {
|
||||||
const crossSigning = this.session.crossSigning;
|
const crossSigning = this.session.crossSigning.get();
|
||||||
this.sas = crossSigning.startVerification(requestOrUserId, log);
|
this.sas = crossSigning.startVerification(requestOrUserId, log);
|
||||||
this.addEventListeners();
|
this.addEventListeners();
|
||||||
if (typeof requestOrUserId === "string") {
|
if (typeof requestOrUserId === "string") {
|
||||||
|
@ -41,8 +41,9 @@ export class ToastCollectionView extends TemplateView<ToastCollectionViewModel>
|
|||||||
list: vm.toastViewModels,
|
list: vm.toastViewModels,
|
||||||
parentProvidesUpdates: false,
|
parentProvidesUpdates: false,
|
||||||
}, (vm: CallToastNotificationViewModel) => toastViewModelToView(vm));
|
}, (vm: CallToastNotificationViewModel) => toastViewModelToView(vm));
|
||||||
|
|
||||||
return t.div({ className: "ToastCollectionView" }, [
|
return t.div({ className: "ToastCollectionView" }, [
|
||||||
t.view(view),
|
t.if(vm => !!vm.toastViewModels, (t) => t.view(view)),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user