mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-24 16:48:52 -04:00
Add cancel methods and rename callback method
This commit is contained in:
@@ -162,7 +162,7 @@ interface Sas {
|
||||
sequence<i32>? get_emoji_indices();
|
||||
sequence<i32>? get_decimals();
|
||||
|
||||
void changes(SasListener callback);
|
||||
void set_changes_listener(SasListener callback);
|
||||
SasState state();
|
||||
};
|
||||
|
||||
@@ -192,6 +192,7 @@ interface QrCode {
|
||||
string? room_id();
|
||||
boolean we_started();
|
||||
boolean is_done();
|
||||
boolean is_cancelled();
|
||||
CancelInfo? cancel_info();
|
||||
|
||||
boolean reciprocated();
|
||||
@@ -211,6 +212,8 @@ interface VerificationRequest {
|
||||
boolean is_ready();
|
||||
boolean is_done();
|
||||
boolean is_passive();
|
||||
boolean is_cancelled();
|
||||
CancelInfo? cancel_info();
|
||||
|
||||
sequence<string>? their_supported_methods();
|
||||
sequence<string>? our_supported_methods();
|
||||
@@ -223,6 +226,8 @@ interface VerificationRequest {
|
||||
[Throws=CryptoStoreError]
|
||||
QrCode? start_qr_verification();
|
||||
ScanResult? scan_qr_code([ByRef] string data);
|
||||
|
||||
OutgoingVerificationRequest? cancel();
|
||||
};
|
||||
|
||||
dictionary RequestVerificationResult {
|
||||
|
||||
@@ -194,7 +194,7 @@ impl Sas {
|
||||
self.inner.decimals().map(|v| [v.0.into(), v.1.into(), v.2.into()].to_vec())
|
||||
}
|
||||
|
||||
/// Listen for changes in the SAS verification process.
|
||||
/// Set a listener for changes in the SAS verification process.
|
||||
///
|
||||
/// The given callback will be called whenever the state changes.
|
||||
///
|
||||
@@ -239,7 +239,7 @@ impl Sas {
|
||||
/// │ Done │
|
||||
/// └───────┘
|
||||
/// ```
|
||||
pub fn changes(&self, callback: Box<dyn SasListener>) {
|
||||
pub fn set_changes_listener(&self, callback: Box<dyn SasListener>) {
|
||||
let stream = self.inner.changes();
|
||||
|
||||
self.runtime.spawn(Self::changes_callback(stream, callback));
|
||||
@@ -302,6 +302,11 @@ impl QrCode {
|
||||
self.inner.is_done()
|
||||
}
|
||||
|
||||
/// Has the verification flow been cancelled.
|
||||
pub fn is_cancelled(&self) -> bool {
|
||||
self.inner.is_cancelled()
|
||||
}
|
||||
|
||||
/// Did we initiate the verification flow.
|
||||
pub fn we_started(&self) -> bool {
|
||||
self.inner.we_started()
|
||||
@@ -469,6 +474,17 @@ impl VerificationRequest {
|
||||
self.inner.is_passive()
|
||||
}
|
||||
|
||||
/// Has the verification flow that been cancelled.
|
||||
pub fn is_cancelled(&self) -> bool {
|
||||
self.inner.is_cancelled()
|
||||
}
|
||||
|
||||
/// Get info about the cancellation if the verification request has been
|
||||
/// cancelled.
|
||||
pub fn cancel_info(&self) -> Option<CancelInfo> {
|
||||
self.inner.cancel_info().map(|v| v.into())
|
||||
}
|
||||
|
||||
/// Get the supported verification methods of the other side.
|
||||
///
|
||||
/// Will be present only if the other side requested the verification or if
|
||||
|
||||
Reference in New Issue
Block a user