fix(android): a refusal always hands control back

The form disables its Save button on send, so a refusal that only speaks
leaves it dead with the typed text behind it - which is what happened to
the one guard added with entry creation: name it, press Save, nothing.

The rule had already been forgotten twice before, at the editor. It is a
procedure now rather than two calls side by side, because two calls side
by side is exactly what gets written as one.

Measured on the device: refuse, let the message fade, refuse again - the
second press produces the message, so the button had come back.
This commit is contained in:
r-zakarya
2026-08-21 14:29:56 +01:00
parent d65fe909b4
commit 078d548110
+16 -7
View File
@@ -204,6 +204,7 @@ type
procedure PatchSelfCheck; procedure PatchSelfCheck;
{$ENDIF} {$ENDIF}
procedure OpenEntry(AVaultIndex: Integer); procedure OpenEntry(AVaultIndex: Integer);
procedure RefuseChange(const AMessage: string);
procedure CommitChange(const ALabel, AComment, AReopenUuid: string; procedure CommitChange(const ALabel, AComment, AReopenUuid: string;
const APatch: TFunc<string, string>); const APatch: TFunc<string, string>);
procedure SaveEntryPassword(const ANewValue: string); procedure SaveEntryPassword(const ANewValue: string);
@@ -606,6 +607,17 @@ end;
/// tout - y compris le dechiffrement, parce que le contenu a change. Trois /// tout - y compris le dechiffrement, parce que le contenu a change. Trois
/// essais : au-dela, c'est que l'autre appareil publie en boucle, et insister /// essais : au-dela, c'est que l'autre appareil publie en boucle, et insister
/// n'y changerait rien. /// n'y changerait rien.
/// REFUSER, ET RENDRE LA MAIN. Les deux, toujours, et c'est pour cela que ca
/// tient en une procedure plutot qu'en deux appels cote a cote : la page
/// desactive son bouton en envoyant, donc un refus qui se contente de parler
/// laisse un formulaire mort avec la saisie derriere. La regle s'est deja fait
/// oublier trois fois - a l'editeur, puis au formulaire de creation.
procedure TForm8.RefuseChange(const AMessage: string);
begin
WebCall('PM.toast(' + JsArg(AMessage) + ')');
WebCall('PM.editDone()');
end;
/// ENREGISTRER UNE MODIFICATION - un seul chemin, deux transports. /// ENREGISTRER UNE MODIFICATION - un seul chemin, deux transports.
/// ///
/// La regle qui tranche : SI UN CONTENEUR LOCAL EXISTE, C'EST LUI L'AUTORITE. /// La regle qui tranche : SI UN CONTENEUR LOCAL EXISTE, C'EST LUI L'AUTORITE.
@@ -626,14 +638,12 @@ begin
// Cancel lui-meme ne repondait plus - un cul-de-sac dont rien ne sortait. // Cancel lui-meme ne repondait plus - un cul-de-sac dont rien ne sortait.
if FBusy then if FBusy then
begin begin
WebCall('PM.toast("Busy - wait for the current operation")'); RefuseChange('Busy - wait for the current operation');
WebCall('PM.editDone()');
Exit; Exit;
end; end;
if FSyncPwd = '' then if FSyncPwd = '' then
begin begin
WebCall('PM.toast("Master password missing - open the vault first")'); RefuseChange('Master password missing - open the vault first');
WebCall('PM.editDone()');
Exit; Exit;
end; end;
SetBusy(True); SetBusy(True);
@@ -792,8 +802,7 @@ var
begin begin
if FCurrent.Uuid = '' then if FCurrent.Uuid = '' then
begin begin
WebCall('PM.toast("This entry has no uuid - cannot be updated")'); RefuseChange('This entry has no uuid - cannot be updated');
WebCall('PM.editDone()');
Exit; Exit;
end; end;
LUuid := FCurrent.Uuid; LUuid := FCurrent.Uuid;
@@ -811,7 +820,7 @@ begin
// liste, et rien ne permettrait de la retrouver pour la corriger. // liste, et rien ne permettrait de la retrouver pour la corriger.
if (ATitle = '') and (ASite = '') and (AUser = '') then if (ATitle = '') and (ASite = '') and (AUser = '') then
begin begin
WebCall('PM.toast("Give it at least a name")'); RefuseChange('Give it at least a name');
Exit; Exit;
end; end;
CommitChange('Added: ' + ATitle, 'new entry from phone', '', CommitChange('Added: ' + ATitle, 'new entry from phone', '',