Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

SecretItemRow: Delete secrets the recommended way #24

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions src/Widgets/SecretItemRow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,15 @@ public class Wallet.SecretItemRow : Gtk.ListBoxRow {
revealer.reveal_child = false;

GLib.Timeout.add (revealer.transition_duration, () => {
delete_secret ();
var schema = new Secret.Schema (
"io.elementary.switchboard.wallet", Secret.SchemaFlags.NONE,
"brand", Secret.SchemaAttributeType.STRING,
"exp", Secret.SchemaAttributeType.STRING
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This copies code from elsewhere - maybe should be held in a shared class and accessed with e.g. WalletSchema.get_default () (?) Can be another PR though


Secret.password_clearv.begin (schema, secret_item.get_attributes (), null);
Copy link
Collaborator

@jeremypw jeremypw Apr 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deletes all cards with the same brand and expiry date (?) Can there be more than one?

Just confirmed that it is possible to add two cards with the same attributes but different number and CVC. Deleting one does delete both of them.

return Gdk.EVENT_STOP;
});
});

focus_out_event.connect (() => {
close_revealer.reveal_child = false;
});
}

private async void delete_secret () {
try {
yield secret_item.delete (null);
destroy ();
} catch (Error error) {
critical (error.message);
}
}
}