Browse Source

identity-verification-view: Use AdwWrapBox

When there are 2 buttons to accept or cancel, use AdwWrapBox to show
them next to each other or one on top of the other, depending on the
available space.
pipelines/816199
Kévin Commaille 12 months ago
parent
commit
be97fb5d03
No known key found for this signature in database
GPG Key ID: C971D9DBC9D678D
  1. 46
      src/identity_verification_view/accept_request_page.ui
  2. 5
      src/identity_verification_view/cancelled_page.rs
  3. 43
      src/identity_verification_view/cancelled_page.ui
  4. 57
      src/identity_verification_view/confirm_qr_code_page.ui
  5. 49
      src/identity_verification_view/sas_page.ui
  6. 5
      src/session/model/verification/identity_verification.rs

46
src/identity_verification_view/accept_request_page.ui

@ -14,6 +14,7 @@
<property name="orientation">vertical</property>
<property name="spacing">18</property>
<property name="valign">center</property>
<property name="margin-bottom">24</property>
<child>
<object class="GtkLabel" id="title">
<property name="wrap">True</property>
@ -42,25 +43,32 @@
</object>
</child>
<child>
<object class="LoadingButton" id="decline_btn">
<property name="content-label" translatable="yes">Decline</property>
<property name="halign">center</property>
<signal name="clicked" handler="decline" swapped="yes"/>
<style>
<class name="destructive-action"/>
<class name="pill"/>
</style>
</object>
</child>
<child>
<object class="LoadingButton" id="accept_btn">
<property name="content-label" translatable="yes">Verify</property>
<property name="halign">center</property>
<signal name="clicked" handler="accept" swapped="yes"/>
<style>
<class name="suggested-action"/>
<class name="pill"/>
</style>
<object class="AdwWrapBox">
<property name="child-spacing">12</property>
<property name="line-spacing">12</property>
<property name="align">0.5</property>
<child>
<object class="LoadingButton" id="decline_btn">
<property name="content-label" translatable="yes">Decline</property>
<property name="halign">center</property>
<signal name="clicked" handler="decline" swapped="yes"/>
<style>
<class name="destructive-action"/>
<class name="pill"/>
</style>
</object>
</child>
<child>
<object class="LoadingButton" id="accept_btn">
<property name="content-label" translatable="yes">Verify</property>
<property name="halign">center</property>
<signal name="clicked" handler="accept" swapped="yes"/>
<style>
<class name="suggested-action"/>
<class name="pill"/>
</style>
</object>
</child>
</object>
</child>
</object>

5
src/identity_verification_view/cancelled_page.rs

@ -168,6 +168,11 @@ impl CancelledPage {
gettext("Verification Error")
};
imp.title.set_text(&title);
// If the verification was started by one of our other devices, let it offer to
// try again.
let offer_to_retry = !verification.is_self_verification() || verification.started_by_us();
imp.try_again_btn.set_visible(offer_to_retry);
}
/// Reset the UI to its initial state.

43
src/identity_verification_view/cancelled_page.ui

@ -36,24 +36,31 @@
</object>
</child>
<child>
<object class="LoadingButton" id="try_again_btn">
<property name="halign">center</property>
<property name="content-label" translatable="yes">Send New Request</property>
<signal name="clicked" handler="try_again" swapped="yes"/>
<style>
<class name="suggested-action"/>
<class name="pill"/>
</style>
</object>
</child>
<child>
<object class="LoadingButton" id="dismiss_btn">
<property name="halign">center</property>
<property name="content-label" translatable="yes">_Done</property>
<signal name="clicked" handler="dismiss" swapped="yes"/>
<style>
<class name="pill"/>
</style>
<object class="AdwWrapBox">
<property name="child-spacing">12</property>
<property name="line-spacing">12</property>
<property name="align">0.5</property>
<child>
<object class="LoadingButton" id="dismiss_btn">
<property name="halign">center</property>
<property name="content-label" translatable="yes">_Done</property>
<signal name="clicked" handler="dismiss" swapped="yes"/>
<style>
<class name="pill"/>
</style>
</object>
</child>
<child>
<object class="LoadingButton" id="try_again_btn">
<property name="halign">center</property>
<property name="content-label" translatable="yes">Send New Request</property>
<signal name="clicked" handler="try_again" swapped="yes"/>
<style>
<class name="suggested-action"/>
<class name="pill"/>
</style>
</object>
</child>
</object>
</child>
</object>

57
src/identity_verification_view/confirm_qr_code_page.ui

@ -43,31 +43,38 @@
</object>
</child>
<child>
<object class="LoadingButton" id="confirm_btn">
<property name="content-label" translatable="yes">Confirm</property>
<property name="halign">center</property>
<signal name="clicked" handler="confirm_scanned" swapped="yes"/>
<accessibility>
<relation name="described-by">question</relation>
</accessibility>
<style>
<class name="suggested-action"/>
<class name="pill"/>
</style>
</object>
</child>
<child>
<object class="LoadingButton" id="cancel_btn">
<property name="content-label" translatable="yes">Cancel</property>
<property name="halign">center</property>
<signal name="clicked" handler="cancel" swapped="yes"/>
<accessibility>
<relation name="described-by">question</relation>
</accessibility>
<style>
<class name="destructive-action"/>
<class name="pill"/>
</style>
<object class="AdwWrapBox">
<property name="child-spacing">12</property>
<property name="line-spacing">12</property>
<property name="align">0.5</property>
<child>
<object class="LoadingButton" id="cancel_btn">
<property name="content-label" translatable="yes">Cancel</property>
<property name="halign">center</property>
<signal name="clicked" handler="cancel" swapped="yes"/>
<accessibility>
<relation name="described-by">question</relation>
</accessibility>
<style>
<class name="destructive-action"/>
<class name="pill"/>
</style>
</object>
</child>
<child>
<object class="LoadingButton" id="confirm_btn">
<property name="content-label" translatable="yes">Confirm</property>
<property name="halign">center</property>
<signal name="clicked" handler="confirm_scanned" swapped="yes"/>
<accessibility>
<relation name="described-by">question</relation>
</accessibility>
<style>
<class name="suggested-action"/>
<class name="pill"/>
</style>
</object>
</child>
</object>
</child>
</object>

49
src/identity_verification_view/sas_page.ui

@ -52,27 +52,34 @@
</object>
</child>
<child>
<object class="LoadingButton" id="mismatch_btn">
<!-- Translators: During emoji comparison, this is the label of the button to click when the emojis do not match. -->
<property name="content-label" translatable="yes">Do Not Match</property>
<property name="halign">center</property>
<signal name="clicked" handler="data_mismatch" swapped="yes"/>
<style>
<class name="destructive-action"/>
<class name="pill"/>
</style>
</object>
</child>
<child>
<object class="LoadingButton" id="match_btn">
<!-- Translators: During emoji comparison, this is the label of the button to click when the emojis match. -->
<property name="content-label" translatable="yes">Match</property>
<property name="halign">center</property>
<signal name="clicked" handler="data_match" swapped="yes"/>
<style>
<class name="suggested-action"/>
<class name="pill"/>
</style>
<object class="AdwWrapBox">
<property name="child-spacing">12</property>
<property name="line-spacing">12</property>
<property name="align">0.5</property>
<child>
<object class="LoadingButton" id="mismatch_btn">
<!-- Translators: During emoji comparison, this is the label of the button to click when the emojis do not match. -->
<property name="content-label" translatable="yes">Do Not Match</property>
<property name="halign">center</property>
<signal name="clicked" handler="data_mismatch" swapped="yes"/>
<style>
<class name="destructive-action"/>
<class name="pill"/>
</style>
</object>
</child>
<child>
<object class="LoadingButton" id="match_btn">
<!-- Translators: During emoji comparison, this is the label of the button to click when the emojis match. -->
<property name="content-label" translatable="yes">Match</property>
<property name="halign">center</property>
<signal name="clicked" handler="data_match" swapped="yes"/>
<style>
<class name="suggested-action"/>
<class name="pill"/>
</style>
</object>
</child>
</object>
</child>
</object>

5
src/session/model/verification/identity_verification.rs

@ -431,6 +431,11 @@ impl IdentityVerification {
self.request().is_self_verification()
}
/// Whether we started this verification.
pub fn started_by_us(&self) -> bool {
self.request().we_started()
}
/// The ID of the other device that is being verified.
pub fn other_device_id(&self) -> Option<OwnedDeviceId> {
let request_state = self.request().state();

Loading…
Cancel
Save