mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-01-22 10:11:39 +01:00
Fix rebase
This commit is contained in:
parent
f822a7a344
commit
53c0fc2934
@ -34,7 +34,7 @@ export type SegmentType = {
|
||||
"details": true;
|
||||
"members": true;
|
||||
"member": string;
|
||||
"device-verification": string;
|
||||
"device-verification": string | boolean;
|
||||
"join-room": true;
|
||||
};
|
||||
|
||||
|
@ -97,13 +97,12 @@ export class SessionViewModel extends ViewModel {
|
||||
}));
|
||||
this._updateJoinRoom(joinRoom.get());
|
||||
|
||||
if (this._client.session.features.crossSigning) {
|
||||
|
||||
const verification = this.navigation.observe("device-verification");
|
||||
this.track(verification.subscribe((txnId) => {
|
||||
this._updateVerification(txnId);
|
||||
}));
|
||||
this._updateVerification(verification.get());
|
||||
if (this.features.crossSigning) {
|
||||
const verification = this.navigation.observe("device-verification");
|
||||
this.track(verification.subscribe((txnId) => {
|
||||
this._updateVerification(txnId);
|
||||
}));
|
||||
this._updateVerification(verification.get());
|
||||
}
|
||||
|
||||
const lightbox = this.navigation.observe("lightbox");
|
||||
|
@ -33,10 +33,16 @@ export class ToastCollectionViewModel extends ViewModel<SegmentType, Options> {
|
||||
constructor(options: Options) {
|
||||
super(options);
|
||||
const session = this.getOption("session");
|
||||
const vms: IToastCollection["toastViewModels"][] = [
|
||||
this.track(new CallToastCollectionViewModel(this.childOptions({ session }))),
|
||||
this.track(new VerificationToastCollectionViewModel(this.childOptions({session}))),
|
||||
].map(vm => vm.toastViewModels);
|
||||
this.toastViewModels = new ConcatList(...vms);
|
||||
const collectionVms: IToastCollection[] = [];
|
||||
if (this.features.calls) {
|
||||
collectionVms.push(this.track(new CallToastCollectionViewModel(this.childOptions({ session }))));
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,18 +32,13 @@ export class VerificationToastCollectionViewModel extends ViewModel<SegmentType,
|
||||
|
||||
constructor(options: 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) {
|
||||
const dismiss = () => {
|
||||
|
@ -22,7 +22,7 @@ type Options<N extends MinimumNeededSegmentType = SegmentType> = {
|
||||
} & BaseClassOptions<N>;
|
||||
|
||||
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> {
|
||||
|
@ -51,7 +51,7 @@ export class DeviceVerificationViewModel extends ErrorReportViewModel<SegmentTyp
|
||||
|
||||
private async start(requestOrUserId: SASRequest | string) {
|
||||
await this.logAndCatch("DeviceVerificationViewModel.start", (log) => {
|
||||
const crossSigning = this.session.crossSigning;
|
||||
const crossSigning = this.session.crossSigning.get();
|
||||
this.sas = crossSigning.startVerification(requestOrUserId, log);
|
||||
this.addEventListeners();
|
||||
if (typeof requestOrUserId === "string") {
|
||||
|
@ -41,8 +41,9 @@ export class ToastCollectionView extends TemplateView<ToastCollectionViewModel>
|
||||
list: vm.toastViewModels,
|
||||
parentProvidesUpdates: false,
|
||||
}, (vm: CallToastNotificationViewModel) => toastViewModelToView(vm));
|
||||
|
||||
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