RandomClear icon

Explicit send consent before sending

RandomClear | PRO | 02/28/18 11:41:05 AM UTC | 0 ⭐ | 10677 👁️ | Never ⏰ | []
Delphi |

1.95 KB

|

None

|

0 👍

/

0 👎

// This sample will show you how you can explicitly ask user to confirm sending.
// This may be required by some data privacy standards.
 
uses
  EDialog, // for RegisterDialogClassFirst
  EDialogWinAPIMSClassic, // for TMSClassicDialog
  EDialogWinAPIEurekaLogDetailed, // for TEurekaLogDetailedDialog
  ETypes; // for TResponse
 
type
  // Override sending report in all dialog classes which are used in application
  TMSClassicDialog = class(EDialogWinAPIMSClassic.TMSClassicDialog)
    function SendBugReportInternal: TResponse; override;
  end;
 
  TEurekaLogDetailedDialog = class(EDialogWinAPIEurekaLogDetailed.TEurekaLogDetailedDialog)
    function SendBugReportInternal: TResponse; override;
  end;
 
function TMSClassicDialog.SendBugReportInternal: TResponse;
begin
  // Ask consent first
  if Application.MessageBox('Do you want to send bug report with your private data?',
     'Send consent', MB_YESNO or MB_DEFBUTTON2) <> mrYes then
  begin
    // If user does not agree to send report - indicate send was cancelled
    Finalize(Result);
    FillChar(Result, SizeOf(Result), 0);
    Result.SendResult := srCancelled;
    Result.ErrorMessage := 'Send consent was not given';
  end
  else
    // ...otherwise (user agrees) - do a real send
    Result := inherited SendBugReportInternal;
end;
 
function TEurekaLogDetailedDialog.SendBugReportInternal: TResponse;
begin
  if Application.MessageBox('Do you want to send bug report with this data?',
     'Send consent', MB_YESNO or MB_DEFBUTTON2) <> mrYes then
  begin
    Finalize(Result);
    FillChar(Result, SizeOf(Result), 0);
    Result.SendResult := srCancelled;
    Result.ErrorMessage := 'Send consent was not given';
  end
  else
    Result := inherited SendBugReportInternal;
end;
 
initialization
  // Don't forget to register your dialog classes to override EurekaLog's ones
  RegisterDialogClassFirst(TMSClassicDialog);
  RegisterDialogClassFirst(TEurekaLogDetailedDialog);
end.

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎