Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user to supress handing the UpdateReadyMemo event #93

Closed

Conversation

ajtruckle
Copy link
Contributor

@ajtruckle ajtruckle commented Apr 7, 2024

The logic is problematic to use as it is written with respects to the handling of the UpdateReadyMemo event.

Here are a couple of questions that raise this issue:

  1. How to resolve issue with UpdateReadyMemo output using Inno Setup with Inno Dependency Installer Setup?
  2. Inno Setup having multiple UpdateReadyMemo events

This is the solution that I have come up with and I have tested on our spare laptop. I feel that these changes to the library are consistent with the ware it currently works.


This is the way have decided to resolve this issue (please note that I also duplicated this as an answer to the first StackOverflow question above):

  1. I introduced a new global variable to the library:
Dependency_NeedRestart, Dependency_ForceX86, Dependency_IgnoreUpdateReadyMemoEvent: Boolean;
  1. I updated the UpdateReadyMemo handler as follows:
<event('UpdateReadyMemo')>
function Dependency_Internal3(const Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
begin
  Result := '';

  if not Dependency_IgnoreUpdateReadyMemoEvent then begin
      if MemoUserInfoInfo <> '' then begin
        Result := Result + MemoUserInfoInfo + Newline + NewLine;
      end;
      if MemoDirInfo <> '' then begin
        Result := Result + MemoDirInfo + Newline + NewLine;
      end;
      if MemoTypeInfo <> '' then begin
        Result := Result + MemoTypeInfo + Newline + NewLine;
      end;
      if MemoComponentsInfo <> '' then begin
        Result := Result + MemoComponentsInfo + Newline + NewLine;
      end;
      if MemoGroupInfo <> '' then begin
        Result := Result + MemoGroupInfo + Newline + NewLine;
      end;
      if MemoTasksInfo <> '' then begin
        Result := Result + MemoTasksInfo;
      end;

      if Dependency_Memo <> '' then begin
        if MemoTasksInfo = '' then begin
          Result := Result + SetupMessage(msgReadyMemoTasks);
        end;
        Result := Result + FmtMessage(Dependency_Memo, [Space]);
      end;
    end;
end;
  1. I added this line at the top of the InitializeSetup function in my installer:

    Dependency_IgnoreUpdateReadyMemoEvent := True;
    
  2. Finally, I modified my version of UpdateReadyMemo:

function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
begin
    Result := '';
    if MemoUserInfoInfo <> '' then
        Result := Result + MemoUserInfoInfo + NewLine + NewLine;
    if MemoDirInfo <> '' then
        Result := Result + MemoDirInfo + NewLine + NewLine;
    if MemoComponentsInfo <> '' then
        Result := Result + MemoComponentsInfo + NewLine + NewLine;
    if MemoGroupInfo <> '' then
        Result := Result + MemoGroupInfo + NewLine + NewLine;
    if (MemoTasksInfo <> '') then
        Result := Result + MemoTasksInfo + NewLine + NewLine;

    { Only display the Auto Backup Settings info if it is a new install }
    if (not bIsUpgrading) then
        Result := Result + AutoBackupPage_MemoInfo(Space, NewLine);

    if ((FilesToDownload <> '') or (Dependency_Memo <> '') or WizardIsComponentSelected('downloadhelp')) then
    begin
        Result := Result + ExpandConstant('{cm:ReadyMemo_Download}');
        
        if (Dependency_Memo <> '') then begin
            Result := Result + FmtMessage(Dependency_Memo, [Space]); 
            Log('UpdateReadyMemo FileToDownload: ' + Dependency_Memo);

            if (FilesToDownload <> '') then
                Result := Result + NewLine;
        end;

        if (FilesToDownload <> '') then begin
            Result := Result + FilesToDownload; 
            Log('UpdateReadyMemo FileToDownload: ' + FilesToDownload);
        end;
    end;
end;

I have done some initial tests and the results were good:

enter image description here

enter image description here


Some instructions would need to be added to the documentation to explain feature but I am unsure about how to do that.

@DomGries DomGries closed this in 26f72a5 Apr 14, 2024
@ajtruckle ajtruckle deleted the option-ignore-updatereadymemo-event branch April 14, 2024 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant