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.track(this.sas.disposableOn("VerificationCancelled", (cancellation) => {
this.createViewModelAndEmit( this.createViewModelAndEmit(
new VerificationCancelledViewModel( new VerificationCancelledViewModel(
this.childOptions({ cancellationCode: cancellation!.code, cancelledByUs: cancellation!.cancelledByUs, }) this.childOptions({ cancellation: cancellation! })
)); )
})); );
}));
this.track(this.sas.disposableOn("VerificationCompleted", (deviceId) => { this.track(this.sas.disposableOn("VerificationCompleted", (deviceId) => {
this.createViewModelAndEmit( this.createViewModelAndEmit(
new VerificationCompleteViewModel(this.childOptions({ deviceId: deviceId! })) new VerificationCompleteViewModel(this.childOptions({ deviceId: deviceId! }))

View File

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