Pass in cancellation object

This commit is contained in:
RMidhunSuresh 2023-03-27 14:39:25 +05:30
parent d32d0def36
commit 0588d04742
2 changed files with 9 additions and 8 deletions

View File

@ -75,9 +75,10 @@ export class DeviceVerificationViewModel extends ErrorReportViewModel<SegmentTyp
this.track(this.sas.disposableOn("VerificationCancelled", (cancellation) => {
this.createViewModelAndEmit(
new VerificationCancelledViewModel(
this.childOptions({ cancellationCode: cancellation!.code, cancelledByUs: cancellation!.cancelledByUs, })
));
}));
this.childOptions({ cancellation: cancellation! })
)
);
}));
this.track(this.sas.disposableOn("VerificationCompleted", (deviceId) => {
this.createViewModelAndEmit(
new VerificationCompleteViewModel(this.childOptions({ deviceId: deviceId! }))

View File

@ -16,20 +16,20 @@ limitations under the License.
import {ViewModel, Options as BaseOptions} from "../../../ViewModel";
import {SegmentType} from "../../../navigation/index";
import {CancelReason} from "../../../../matrix/verification/SAS/channel/types";
import type {CancelReason} from "../../../../matrix/verification/SAS/channel/types";
import type {IChannel} from "../../../../matrix/verification/SAS/channel/Channel";
type Options = BaseOptions & {
cancellationCode: CancelReason;
cancelledByUs: boolean;
cancellation: IChannel["cancellation"];
};
export class VerificationCancelledViewModel extends ViewModel<SegmentType, Options> {
get cancelCode(): CancelReason {
return this.options.cancellationCode;
return this.options.cancellation.code;
}
get isCancelledByUs(): boolean {
return this.options.cancelledByUs;
return this.options.cancellation.cancelledByUs;
}
gotoSettings() {